Dialog::Dialog(UIWindow *parent, float width, float height, bool modal) : UIWindow(/*modal ? new Substrate(parent) :*/ parent) , _mouseX(0) , _mouseY(0) , _easyMove(false) { SetTexture("ui/window", false); Resize(width, height); Move(std::floor((parent->GetWidth() - GetWidth()) / 2), std::floor((parent->GetHeight() - GetHeight()) / 2)); SetDrawBorder(true); SetDrawBackground(true); GetManager().SetFocusWnd(this); }
bool Desktop::OnRawChar(int c) { Dialog *dlg = NULL; switch( c ) { // case VK_TAB: // _score->SetVisible(!_score->GetVisible()); // break; case VK_OEM_3: // '~' if( _con->GetVisible() ) { _con->SetVisible(false); } else { _con->SetVisible(true); GetManager()->SetFocusWnd(_con); } break; case VK_ESCAPE: if( _con->Contains(GetManager()->GetFocusWnd()) ) { _con->SetVisible(false); } else { dlg = new MainMenuDlg(this); SetDrawBackground(true); dlg->eventClose = std::bind(&Desktop::OnCloseChild, this, _1); } break; case VK_F2: dlg = new NewGameDlg(this, g_level.get()); SetDrawBackground(true); dlg->eventClose = bind(&Desktop::OnCloseChild, this, _1); break; case VK_F12: dlg = new SettingsDlg(this); SetDrawBackground(true); dlg->eventClose = bind(&Desktop::OnCloseChild, this, _1); break; case VK_F5: g_level->SetEditorMode(!g_level->GetEditorMode()); break; case VK_F8: if( g_level->GetEditorMode() ) { dlg = new MapSettingsDlg(this); SetDrawBackground(true); dlg->eventClose = std::bind(&Desktop::OnCloseChild, this, _1); } break; default: return false; } return true; }
void Desktop::OnCloseChild(int result) { SetDrawBackground(false); }