void pymms::gui::GUIWindowManager::__render() { Render* pRenderer = S_Render::get_instance(); GUIWindow* pWindow = (!m_vecWindows.empty()?m_vecWindows.front():0); if(pWindow && pWindow->getActive()) { if(!pWindow->getOverlay()) { pRenderer->prepare_new_image(); pWindow->render(); pRenderer->draw_and_release("Window"); } else { pRenderer->wait_and_aquire(); if (m_windowOverlay.elements.size() > 0) m_windowOverlay.partial_cleanup(); pWindow->render(&m_windowOverlay); pRenderer->draw_and_release("Window", true); } } }
GUIWindow * GUIManager::PickWindow( const Point2 & ptScreenPos ) const { UInt iTopMostDepth = GUIWINDOW_MAX_DEPTH; GUIWindow * pTopMostWindow = NULL; WindowMap::Iterator it; GUIWindow * pCurWindow; Rectangle2 rectWindow; UInt iCurDepth; for( it = m_mapWindows.Begin(); !(it.IsNull()); ++it ) { pCurWindow = it.GetItem(); if ( !(pCurWindow->IsVisible()) ) continue; rectWindow = pCurWindow->GetWindowRect(); if ( !(rectWindow.Contains(ptScreenPos)) ) continue; iCurDepth = pCurWindow->GetDepth(); if ( iCurDepth < iTopMostDepth ) { iTopMostDepth = iCurDepth; pTopMostWindow = pCurWindow; if ( iTopMostDepth == GUIWINDOW_MIN_DEPTH ) break; // Must be the good one } } return pTopMostWindow; }
void pymms::gui::GUIWindowManager::unregisterWindow(GUIWindow* pWindow) { ost::MutexLock lock(m_windowManagerLock); Render* pRenderer = S_Render::get_instance(); for (std::vector<GUIWindow*>::iterator i = m_vecWindows.begin(), end = m_vecWindows.end(); i != end; i++) { if((*i) == pWindow) { if(pWindow->getOverlay()) { pRenderer->wait_and_aquire(); m_windowOverlay.cleanup(); pRenderer->image_mut.leaveMutex(); } m_vecWindows.erase(i); pWindow->setActive(false); GUIWindow* pFrontWindow = (!m_vecWindows.empty()?m_vecWindows.front():0); if(pFrontWindow) pFrontWindow->setActive(true); __render(); return; } } }
void pymms::gui::GUIWindowManager::sendMessage(GUIMessage& message) { GUIWindow* pWindow = (!m_vecWindows.empty()?m_vecWindows.front():0); if(pWindow && pWindow->getActive()) pWindow->onMessage(message); }
Void GUIManager::OnMouseDblClick( const Point2 & ptScreenPos, KeyCode iKey ) { // Special State : moving / resizing if ( m_guiMoveResize.IsActive() ) { // Ignore event emission return; } // Special State : menu loop if ( m_guiMenuLoop.IsZombie() ) m_guiMenuLoop.Reset(); // Handle overlays GUIOverlay * pTargetOverlay = PickOverlay( ptScreenPos ); // Track focus Overlay if ( m_pOverlayFocus != pTargetOverlay ) { if ( m_pOverlayFocus != NULL ) m_pOverlayFocus->_PostEvent_FocusLoss(); if ( pTargetOverlay != NULL ) pTargetOverlay->_PostEvent_FocusGain(); m_pOverlayFocus = pTargetOverlay; } // Special State : menu loop if ( m_guiMenuLoop.IsActive() ) { if ( (pTargetOverlay == NULL) || (pTargetOverlay->GetType() != GUIOVERLAY_MENU) ) { m_guiMenuLoop.Stop( true ); m_guiMenuLoop.Reset(); } } if ( pTargetOverlay != NULL ) { pTargetOverlay->_PostEvent_MouseDblClick( ptScreenPos, iKey ); return; } // Handle windows GUIWindow * pTargetWindow = PickWindow( ptScreenPos ); // Track focus Window if ( m_pFocus != pTargetWindow ) { if ( m_pFocus != NULL ) m_pFocus->_PostEvent_FocusLoss(); else m_pBackboard->_PostEvent_FocusLoss(); if ( pTargetWindow != NULL ) pTargetWindow->_PostEvent_FocusGain(); else m_pBackboard->_PostEvent_FocusGain(); m_pFocus = pTargetWindow; } if ( pTargetWindow != NULL ) pTargetWindow->_PostEvent_MouseDblClick( ptScreenPos, iKey ); else m_pBackboard->_PostEvent_MouseDblClick( ptScreenPos, iKey ); }
Void GUIManager::OnMouseMove( const Point2 & ptScreenPos ) { // Special State : moving / resizing if ( m_guiMoveResize.IsActive() ) { // Update if ( m_guiMoveResize.IsMoving() ) m_guiMoveResize.UpdateMove( ptScreenPos ); if ( m_guiMoveResize.IsResizing() ) m_guiMoveResize.UpdateResize( ptScreenPos ); // Ignore event emission return; } // Special State : menu loop if ( m_guiMenuLoop.IsZombie() ) m_guiMenuLoop.Reset(); // Handle overlays GUIOverlay * pTargetOverlay = PickOverlay( ptScreenPos ); // Track mouse-over Overlay if ( m_pOverlayMousedOver != pTargetOverlay ) { if ( m_pOverlayMousedOver != NULL ) m_pOverlayMousedOver->_PostEvent_RollOut(); if ( pTargetOverlay != NULL ) pTargetOverlay->_PostEvent_RollIn(); m_pOverlayMousedOver = pTargetOverlay; } if ( pTargetOverlay != NULL ) { pTargetOverlay->_PostEvent_MouseMove( ptScreenPos ); return; } // Handle windows GUIWindow * pTargetWindow = PickWindow( ptScreenPos ); // Track mouse-over Window if ( m_pMousedOver != pTargetWindow ) { if ( m_pMousedOver != NULL ) m_pMousedOver->_PostEvent_RollOut(); else m_pBackboard->_PostEvent_RollOut(); if ( pTargetWindow != NULL ) pTargetWindow->_PostEvent_RollIn(); else m_pBackboard->_PostEvent_RollIn(); m_pMousedOver = pTargetWindow; } if ( pTargetWindow != NULL ) pTargetWindow->_PostEvent_MouseMove( ptScreenPos ); else m_pBackboard->_PostEvent_MouseMove( ptScreenPos ); }
void pymms::gui::GUIWindowManager::setDefaultActive(bool bActive) { ost::MutexLock lock(m_windowManagerLock); GUIWindow* pFrontWindow = (!m_vecWindows.empty()?m_vecWindows.front():0); if(pFrontWindow) { pFrontWindow->setActive(bActive); if(bActive) __render(); } }
void Button::MousePressed(const MouseEvent& lEvent) { if(IsDisabled()) { return; } // If our parent is a GUIWindow, then makew this window have focus in the GUI, used to make it's depth the highest if(GetParent() != NULL && GetParent()->GetComponentType() == EComponentType_GUIWindow) { GUIWindow* lpParentWindow = (GUIWindow *)GetParent(); lpParentWindow->SetFocusWindow(); } SetSelected(true); OnMousePressed(); // Colour change if(m_bChangeLabelText) { for(unsigned int i = 0; i < m_vpAddedComponentList.size(); i++) { if(m_vpAddedComponentList[i]->GetComponentType() == EComponentType_Label) { ((Label*)m_vpAddedComponentList[i])->SetColour(m_PressedLabelColour); } } m_label.SetColour(m_PressedLabelColour); } // Position change if(m_offsetApplied == false) { for(unsigned int i = 0; i < m_vpAddedComponentList.size(); i++) { m_vpAddedComponentList[i]->SetLocation(m_vpAddedComponentList[i]->GetLocation().m_x + m_pressedOffsetX, m_vpAddedComponentList[i]->GetLocation().m_y + m_pressedOffsetY); } m_label.SetLocation(m_label.GetLocation().m_x + m_pressedOffsetX, m_label.GetLocation().m_y + m_pressedOffsetY); m_offsetApplied = true; } if(m_Callback_Pressed) { m_Callback_Pressed(m_pCallbackData_Pressed); } }
Point GUIWindow::WindowToClient(Point coord) { Point temp = coord; GUIWindow *currentParent = Parent; while (currentParent != 0) { temp.X += currentParent->X(); temp.Y += currentParent->Y(); currentParent = currentParent->Parent; } return temp; }
Point GUIWindow::ClientToWindow(Point coord) { Point temp = coord; GUIWindow *currentParent = Parent; while (currentParent != 0) { if (currentParent) { temp.X -= currentParent->X(); temp.Y -= currentParent->Y(); currentParent = currentParent->Parent; } } return temp; }
void MenuItem::MousePressed(const MouseEvent& lEvent) { if(!IsParentMenuOpen()) { return; } // If our parent is a GUIWindow, then makew this window have focus in the GUI, used to make it's depth the highest if(GetParent() != NULL && GetParent()->GetComponentType() == EComponentType_GUIWindow) { GUIWindow* lpParentWindow = (GUIWindow *)GetParent(); lpParentWindow->SetFocusWindow(); } SetSelected(true); OnMousePressed(); }
//----- (00411150) -------------------------------------------------------- void BookUI_DrawTownPortalMap() { int v3; // edi@17 GUIWindow TownPortalWindow; // [sp+Ch] [bp-64h]@1 POINT a2; // [sp+68h] [bp-8h]@17 pRenderer->ClearZBuffer(0, 479); pRenderer->DrawTextureTransparent(8, 8, pTexture_CurrentBook); pRenderer->DrawTextureTransparent(471, 445, pIcons_LOD->GetTexture(uExitCancelTextureId)); TownPortalWindow.uFrameX = game_viewport_x; TownPortalWindow.uFrameY = game_viewport_y; TownPortalWindow.uFrameWidth = game_viewport_width; TownPortalWindow.uFrameHeight = game_viewport_height; TownPortalWindow.uFrameZ = game_viewport_z; TownPortalWindow.uFrameW = game_viewport_w; const uint fountain_bits_lut[] = {PARTY_QUEST_FOUNTAIN_HARMONDALE, PARTY_QUEST_FOUNTAIN_PIERPONT, PARTY_QUEST_FOUNTAIN_NIGHON, PARTY_QUEST_FOUNTAIN_EVENMORN_ISLE, PARTY_QUEST_FOUNTAIN_CELESTIA, PARTY_QUEST_FOUNTAIN_THE_PIT}; for (uint i = 0; i < 6; ++i) { if (_449B57_test_bit(pParty->_quest_bits, fountain_bits_lut[i])) pRenderer->DrawMaskToZBuffer(pTownPortalBook_xs[i], pTownPortalBook_ys[i], pTexture_TownPortalIcons[i], i + 1); } pMouse->GetCursorPos(&a2); v3 = pRenderer->pActiveZBuffer[a2.x + pSRZBufferLineOffsets[a2.y]] & 0xFFFF; if (v3) { if (_449B57_test_bit(pParty->_quest_bits, fountain_bits_lut[v3 - 1])) pRenderer->DrawTextureIndexed(pTownPortalBook_xs[v3 - 1], pTownPortalBook_ys[v3 - 1], pTexture_TownPortalIcons[v3 - 1]); } TownPortalWindow.DrawTitleText(pBook2Font, 0, 22, 0, pGlobalTXT_LocalizationStrings[10], 3); }
void pymms::gui::GUIWindowManager::setActiveWindow(int iWindowId) { ost::MutexLock lock(m_windowManagerLock); for (std::vector<GUIWindow*>::iterator i = m_vecWindows.begin(), end = m_vecWindows.end(); i != end; i++) { if((*i)->getId() == iWindowId) { GUIWindow* pFrontWindow = (!m_vecWindows.empty()?m_vecWindows.front():0); if((pFrontWindow != *i) && pFrontWindow) pFrontWindow->setActive(false); m_vecWindows.erase(i); m_vecWindows.insert(m_vecWindows.begin(), *i); (*i)->setActive(true); __render(); return; } } }
void UIIntVarOffField::Draw(GUIWindow &w,int offset) { GUITextProperties props ; GUIPoint position=GetPosition() ; if (focus_) { ((AppWindow&)w).SetColor(CD_HILITE2) ; props.invert_=true ; } else { ((AppWindow&)w).SetColor(CD_NORMAL) ; } Variable::Type type=src_.GetType() ; char buffer[80] ; switch (type) { case Variable::INT: { int ivalue=src_.GetInt() ; if (ivalue!=VAR_OFF) { sprintf(buffer,format_,ivalue,ivalue) ; } else { char format[256] ; strcpy(format,format_) ; char *location=strchr(format,'%') ; if (location) { while((*location!=0)&&(*location!='x')&&(*location!='X')&&(*location!='d')) { location++ ; } if (*location!=0) { *location='s' ; } else { location=0 ; } } if (location) { sprintf(buffer,format,"--") ; } else { sprintf(buffer,"++wtf++") ; } } } break ; default: strcpy(buffer,"++wtf++"); } w.DrawString(buffer,position,props) ; } ;
void UIIntField::Draw(GUIWindow &w) { GUITextProperties props ; GUIPoint position=GetPosition() ; if (focus_) { ((AppWindow&)w).SetColor(CD_HILITE2) ; props.invert_=true ; } else { ((AppWindow&)w).SetColor(CD_NORMAL) ; } char buffer[80] ; int value=*src_ ; sprintf(buffer,format_,value) ; w.DrawString(buffer,position,props) ; } ;
void Slider::MousePressed(const MouseEvent& lEvent) { int lSliderX; int lSliderY; int lSliderWidth; int lSliderHeight; int lBarX; int lBarY; int lBarWidth; int lBarHeight; if(m_eSliderDirection == ESliderDirection_Horizontal) { lSliderX = GetLocationOnScreen().m_x + (int)((m_dimensions.m_width - m_sliderWidth) * ((m_currentValue - m_minValue) / (m_maxValue - m_minValue))); lSliderY = GetLocationOnScreen().m_y; lSliderWidth = m_sliderWidth; lSliderHeight = m_dimensions.m_height; lBarX = GetLocationOnScreen().m_x + (m_sliderWidth / 2); lBarY = GetLocationOnScreen().m_y + (m_dimensions.m_height / 2) - (m_barHeight / 2); lBarWidth = m_dimensions.m_width - m_sliderWidth; lBarHeight = m_barHeight; } else //if(m_eSliderDirection == ESliderDirection_Vertical) { lSliderX = GetLocationOnScreen().m_x; lSliderY = GetLocationOnScreen().m_y + (int)((m_dimensions.m_height - m_sliderWidth) * ((m_currentValue - m_minValue) / (m_maxValue - m_minValue))); lSliderWidth = m_dimensions.m_width; lSliderHeight = m_sliderWidth; lBarX = GetLocationOnScreen().m_x + (m_dimensions.m_width / 2) - (m_barHeight / 2); lBarY = GetLocationOnScreen().m_y + (m_sliderWidth / 2); lBarWidth = m_barHeight; lBarHeight = m_dimensions.m_height - m_sliderWidth; } int mouseX = lEvent.GetX(); int mouseY = lEvent.GetY(); // Check to see if we have clicked the slider to start dragging if((mouseX >= lSliderX) && (mouseX < lSliderX + lSliderWidth) && (mouseY >= lSliderY) && (mouseY < lSliderY + lSliderHeight)) { if(m_bAllowDragging) { m_bDragging = true; m_bAllowDragginOutside = true; } } else { // Check to see if we have clicked on the bar to 'zoom' to a location if((mouseX >= lBarX) && (mouseX < lBarX + lBarWidth) && (mouseY >= lBarY) && (mouseY < lBarY + lBarHeight)) { if(m_bAllowReleasingOnBar && !m_bDragging) { m_bPressedBar = true; } } else { // Don't allow releasing on the bar since we didnt first click on the bar, have to wait for release now m_bAllowReleasingOnBar = false; } // Don't allow dragging, or dragging outside, since our first press wasnt on the slider, have to wait for release now if(!m_bDragging) { m_bAllowDragging = false; m_bAllowDragginOutside = false; } } // If our parent is a GUIWindow, then makew this window have focus in the GUI, used to make it's depth the highest if(GetParent() != NULL && GetParent()->GetComponentType() == EComponentType_GUIWindow) { GUIWindow* lpParentWindow = (GUIWindow *)GetParent(); lpParentWindow->SetFocusWindow(); } OnMousePressed(); }
Component* SelectionManager::GetComponentAt(int x, int y) { // ---------------------- // TODO // This needs much work: // * Depth testing // * Focus ordering // ---------------------- ComponentList::const_iterator iterator; Component* lpWindowComponent = 0; float lCurrentDepth = 0; for(iterator = m_vpComponentList.begin(); iterator != m_vpComponentList.end(); ++iterator) { // We have only found a selection if the component is enabled if((*iterator)->IsEnabled() && (*iterator)->IsVisible() && (*iterator)->IsParentEnabled() && (*iterator)->IsParentVisible()) { Point l_location = (*iterator)->GetLocationOnScreen(); Dimensions l_dimensions = (*iterator)->GetDimensions(); int l_left = l_location.m_x; int l_right = l_location.m_x + l_dimensions.m_width; int l_top = l_location.m_y + l_dimensions.m_height; int l_bottom = l_location.m_y; if( (x < l_right && x >= l_left) && (y <= l_top && y > l_bottom) ) { if((*iterator)->GetComponentType() == EComponentType_GUIWindow) { // Hack : If we have found a window component, then dont return it just yet, let us see if we can find something else GUIWindow* lpWindow = (GUIWindow*)(*iterator); if(!lpWindow->GetMinimized()) { // ONLY if we are not minimized... if we are minimized then don't return this window if(lpWindow->GetDepth() > lCurrentDepth) { lCurrentDepth = lpWindow->GetDepth(); lpWindowComponent = (*iterator); } } } else { if((*iterator)->GetDepth() > lCurrentDepth) { if((*iterator)->GetParent() && (*iterator)->GetParent()->GetComponentType() == EComponentType_ScrollBar) { // Check scroll area of parent ScrollBar* lpScrollBar = (ScrollBar*)(*iterator)->GetParent(); Dimensions lScrollbarParent; if(lpScrollBar->GetParent() != NULL) { lScrollbarParent = lpScrollBar->GetParent()->GetDimensions(); } Dimensions lScrollbar = lpScrollBar->GetDimensions(); Dimensions lScrollArea = lpScrollBar->GetScrollArea(); int l_scrollleft = lScrollbarParent.m_x + lScrollbar.m_x + lScrollArea.m_x; int l_scrollright = lScrollbarParent.m_x + lScrollbar.m_x + lScrollArea.m_x + lScrollArea.m_width; int l_scrolltop = lScrollbarParent.m_y + lScrollbar.m_y + lScrollArea.m_y + lScrollArea.m_height; int l_scrollbottom = lScrollbarParent.m_y + lScrollbar.m_y + lScrollArea.m_y; if( x > l_scrollright || x < l_scrollleft || y > l_scrolltop || y < l_scrollbottom ) { continue; } } lCurrentDepth = (*iterator)->GetDepth(); lpWindowComponent = (*iterator); } } } } } // If we haven't found any components, but we DO have a GUI window, then return that, else NOTHING return lpWindowComponent; }
//----- (00410DEC) -------------------------------------------------------- unsigned int DrawLloydBeaconsScreen() { Player *pPlayer; // esi@1 const char *pText; // eax@1 int pTextHeight; // eax@14 int RemainingTime; // kr08_8@14 unsigned int pHours; // esi@14 unsigned int pDays; // eax@14 const char *pSelectionText; // eax@19 Texture *v19; // [sp-4h] [bp-8Ch]@4 GUIWindow pWindow; // [sp+Ch] [bp-7Ch]@1 char *Str; // [sp+74h] [bp-14h]@14 int BeaconID; // [sp+78h] [bp-10h]@11 int uNumMaxBeacons; // [sp+84h] [bp-4h]@6 pPlayer = &pParty->pPlayers[_506348_current_lloyd_playerid]; pRenderer->DrawTextureIndexed(8, 8, pTexture_LloydBeacons[(unsigned __int8)bRecallingBeacon]); pText = pGlobalTXT_LocalizationStrings[523]; // Recall Beacon pWindow.uFrameX = game_viewport_x; pWindow.uFrameY = game_viewport_y; pWindow.uFrameWidth = 428; pWindow.uFrameHeight = game_viewport_height; pWindow.uFrameZ = 435; pWindow.uFrameW = game_viewport_w; if ( !bRecallingBeacon ) pText = pGlobalTXT_LocalizationStrings[375]; // Set Beacon sprintf(pTmpBuf.data(), "%s", pText); pWindow.DrawTitleText(pBook2Font, 0, 22, 0, pTmpBuf.data(), 3); if ( bRecallingBeacon ) { pRenderer->DrawTextureTransparent(pBtn_Book_1->uX, pBtn_Book_1->uY, pTex_book_button1_on); v19 = pTex_book_button1_off; } else { pRenderer->DrawTextureTransparent(pBtn_Book_1->uX, pBtn_Book_1->uY, pTex_book_button1_off); v19 = pTex_book_button1_on; } pRenderer->DrawTextureTransparent(pBtn_Book_2->uX, pBtn_Book_2->uY, v19); uNumMaxBeacons = 1; if ( HIBYTE(pPlayer->pActiveSkills[PLAYER_SKILL_WATER]) & 1 || (pPlayer->pActiveSkills[PLAYER_SKILL_WATER] & 0x80u) != 0 ) { uNumMaxBeacons = 5; } else { if ( pPlayer->pActiveSkills[PLAYER_SKILL_WATER] & 0x40 ) uNumMaxBeacons = 3; } if ( uNumMaxBeacons > 0 ) { for ( BeaconID = 0; BeaconID < uNumMaxBeacons; BeaconID++ ) { pWindow.uFrameWidth = 92; pWindow.uFrameHeight = 68; pWindow.uFrameY = pLloydsBeaconsPreviewYs[BeaconID]; pWindow.uFrameX = pLloydsBeaconsPreviewXs[BeaconID]; pWindow.uFrameW = pWindow.uFrameY + 67; pWindow.uFrameZ = pLloydsBeaconsPreviewXs[BeaconID] + 91; //if ( pSavegameThumbnails[BeaconID].pPixels != 0 ) if ( pPlayer->pInstalledBeacons[BeaconID].SaveFileID != 0 ) { pRenderer->DrawTextureTransparent(pLloydsBeacons_SomeXs[BeaconID], pLloydsBeacons_SomeYs[BeaconID], pTexture_CurrentBook); pRenderer->DrawTextureRGB(pLloydsBeaconsPreviewXs[BeaconID], pLloydsBeaconsPreviewYs[BeaconID], &pSavegameThumbnails[BeaconID]); Str = pMapStats->pInfos[pMapStats->sub_410D99_get_map_index(pPlayer->pInstalledBeacons[BeaconID].SaveFileID)].pName; pTextHeight = pSpellFont->CalcTextHeight(Str, &pWindow, 0, 0); pWindow.uFrameY += -6 - pTextHeight; pWindow.DrawTitleText(pSpellFont, 0, 0, 1, Str, 3); RemainingTime = pPlayer->pInstalledBeacons[BeaconID].uBeaconTime - pParty->uTimePlayed; pHours = (signed __int64)((double)RemainingTime * 0.234375) / 60 / 60; pDays = pHours / 24; if ( pDays ) { sprintf(pTmpBuf.data(), "%lu %s", pDays + 1, pGlobalTXT_LocalizationStrings[57]);//days pWindow.uFrameY = pWindow.uFrameY + pWindow.uFrameHeight + 4; pWindow.DrawTitleText(pSpellFont, 0, 0, 1, pTmpBuf.data(), 3); continue; } else { if ( pHours + 1 <= 23 ) { if ( pHours < 1 ) pSelectionText = pGlobalTXT_LocalizationStrings[109];// Hour else pSelectionText = pGlobalTXT_LocalizationStrings[110];// Hours sprintf(pTmpBuf.data(), "%lu %s", pHours + 1, pSelectionText); pWindow.uFrameY = pWindow.uFrameY + pWindow.uFrameHeight + 4; pWindow.DrawTitleText(pSpellFont, 0, 0, 1, pTmpBuf.data(), 3); continue; } } sprintf(pTmpBuf.data(), "%lu %s", pDays + 1, pGlobalTXT_LocalizationStrings[56]);//Day pWindow.uFrameY = pWindow.uFrameY + pWindow.uFrameHeight + 4; pWindow.DrawTitleText(pSpellFont, 0, 0, 1, pTmpBuf.data(), 3); continue; } if ( !bRecallingBeacon ) { pRenderer->DrawTextureTransparent(pLloydsBeacons_SomeXs[BeaconID], pLloydsBeacons_SomeYs[BeaconID], pTexture_CurrentBook); pTextHeight = pSpellFont->CalcTextHeight(pGlobalTXT_LocalizationStrings[19], &pWindow, 0, 0); pWindow.DrawTitleText(pSpellFont, 0, (signed int)pWindow.uFrameHeight / 2 - pTextHeight / 2, 1, pGlobalTXT_LocalizationStrings[19], 3);//Доступно } } } if ( byte_506360 ) pMessageQueue_50CBD0->AddGUIMessage(UIMSG_CloseAfterInstallBeacon, 0, 0); return BeaconID; }
// < Operator (Used for GUIWindow depth sorting) bool GUIWindow::operator<(const GUIWindow &w) const { return(GetDepth() < w.GetDepth()); }
void RecieveKeyboardKey(KeyboardKey *Key) { if (!GetDesktop()->IsVisible()) { return; } bool IsShiftPressed = Input::IsShiftDown(); GUIWindow *TargetControl = GUI::GetActiveControl(); GUIWindow *TargetWindow = GUI::GetActiveWindow(); // Mouse handling. if (Key->KeyCode == 0x01) // Handle left clicks. { Point ClickPoint; ClickPoint.X = Input::ClientCursorPos.x; ClickPoint.Y = Input::ClientCursorPos.y; GUIWindow *ClickedWindow = GetDesktop()->ChildAtPoint(ClickPoint); // Check if a valid window was found. if (ClickedWindow != 0) { bool WasActive = false; if (ClickedWindow->Active()) { WasActive = true; } else { GetDesktop()->SetActiveChild(ClickedWindow); } GUIWindow *ClickedControl = ClickedWindow->ChildAtPoint(ClickPoint); // Check if a valid control was found. if (ClickedControl != 0) { ClickedWindow->SetActiveChild(ClickedControl); if (ClickedControl->IsButton()) { ClickedControl->PushState = PUSH_STATE_PUSHED; } } else { if (WasActive) { ClickedWindow->SetActiveChild(0); } } } } // Keyboard (typing stuff) handling. if (TargetControl != 0 && TargetWindow != 0) { if (Key->KeyCode == 0x0D) // Handle enter. { if (TargetControl->OnEnter != 0) { (*TargetControl->OnEnter)(); } } if (TargetControl->CanBeTypedIn()) { if (Key->CheckForRepeat()) { Key->SetRepeatComplete(); } if ((Key->HasCapitalChar() && IsShiftPressed)) { TargetControl->Text += Key->CapitalKey; TargetControl->CaretPosition += 1; } else if (Key->HasChar()) { TargetControl->Text += Key->Key; TargetControl->CaretPosition += 1; } else if (Key->KeyCode == 0x08) // Handle backspace. { if (TargetControl->Text.length() > 0 && TargetControl->CaretPosition > 0) { TargetControl->Text.Trim(TargetControl->CaretPosition-1, TargetControl->CaretPosition); TargetControl->CaretPosition -= 1; } } else if (Key->KeyCode == 0x2E) // Handle delete. { if (TargetControl->Text.length() > 0 && TargetControl->CaretPosition < TargetControl->Text.length()) { TargetControl->Text.Trim(TargetControl->CaretPosition, TargetControl->CaretPosition+1); } } else if (Key->KeyCode == 0x25) // Handle left arrow key { if (TargetControl->CaretPosition > 0) { TargetControl->CaretPosition -= 1; } } else if (Key->KeyCode == 0x27) // Handle right arrow key { if (TargetControl->CaretPosition < TargetControl->Text.length()) { TargetControl->CaretPosition += 1; } } } } }