//---------------------------------------------------------------------------------- // DoDialog: Display this dialog as a modal dialog. //---------------------------------------------------------------------------------- int LoginCtrl::DoDialog(const GUIString& theTitle, const GUIString& theText, Window *pParent) { PlatformWindowPtr pWindow = new PlatformWindow; pWindow->SetParent(pParent); pWindow->SetTitle(theTitle); m_pText->SetText(theText); m_pText->SetDesiredSize(); pWindow->SetCreateFlags(CreateWindow_SizeSpecClientArea | CreateWindow_NotSizeable); RecalcLayout(); WONRectangle aRect; if (pParent != NULL) pParent->GetScreenPos(aRect); else pWindow->GetWindowManager()->GetScreenRect(aRect); // Center it on top of its parent (or the desktop). pWindow->Create(WONRectangle(aRect.Left() + (aRect.Width() - Width()) / 2, aRect.Top() + (aRect.Height() - Height()) / 2, Width(), Height())); pWindow->AddComponent(this); m_pLoginNameInputBox->RequestFocus(); int nResult = pWindow->DoDialog(this); pWindow->Close(); return nResult; }
//---------------------------------------------------------------------------------- // DoDialog: Display this dialog as a modal dialog. //---------------------------------------------------------------------------------- int AboutDlg::DoDialog(Window *pParent) { PlatformWindowPtr pWindow = new PlatformWindow; pWindow->SetParent(pParent); pWindow->SetTitle(GetCustomInfo()->GetResourceManager()->GetString(IDS_ABOUT_DLG_TITLE)); pWindow->SetCreateFlags(CreateWindow_SizeSpecClientArea | CreateWindow_NotSizeable); WONRectangle aRect; if (pParent != NULL) pParent->GetScreenPos(aRect); else pWindow->GetWindowManager()->GetScreenRect(aRect); // Center it on top of its parent (or the desktop). pWindow->Create(WONRectangle(aRect.Left() + (aRect.Width() - Width()) / 2, aRect.Top() + (aRect.Height() - Height()) / 2, Width(), Height())); pWindow->AddComponent(this); m_pCloseButton->RequestFocus(); int nResult = pWindow->DoDialog(this); pWindow->Close(); return nResult; }
//---------------------------------------------------------------------------------- // InitWindow: Initialize the main window. //---------------------------------------------------------------------------------- void InitWindow(Window* pWindow) { // Create Window WONRectangle aScreenRect; g_pWindowMgr->GetScreenRect(aScreenRect); int aCreateFlags = CreateWindow_Centered | CreateWindow_SizeSpecClientArea | CreateWindow_HideAtFirst; int aWidth = 640; int aHeight = 480; // // If the dialog is not resizeable, disable that ability now. // if (! GetCustomInfo()->GetResourceManager()->GetResizeable()) // aCreateFlags |= CreateWindow_NotSizeable; pWindow->SetCreateFlags(aCreateFlags); pWindow->Create(WONRectangle(0, 0, aWidth, aHeight)); // Make sure the user cannot make it smaller than the original starting size. WONRectangle rScreen; pWindow->GetScreenPos(rScreen); pWindow->SetMinWindowSize(rScreen.Width(), rScreen.Height()); }