void MyFrame::DoCreateStatusBar(MyFrame::StatusBarKind kind, long style) { wxStatusBar *statbarOld = GetStatusBar(); if ( statbarOld ) { SetStatusBar(NULL); delete statbarOld; } wxStatusBar *statbarNew = NULL; switch ( kind ) { case StatBar_Default: statbarNew = new wxStatusBar(this, wxID_ANY, style, "wxStatusBar"); statbarNew->SetFieldsCount(2); break; case StatBar_Custom: statbarNew = new MyStatusBar(this, style); break; default: wxFAIL_MSG(wxT("unknown status bar kind")); } SetStatusBar(statbarNew); ApplyPaneStyle(); PositionStatusBar(); m_statbarKind = kind; }
void wxFrameBase::SetStatusWidths(int n, const int widths_field[] ) { wxCHECK_RET( m_frameStatusBar != NULL, wxT("no statusbar to set widths for") ); m_frameStatusBar->SetStatusWidths(n, widths_field); PositionStatusBar(); }
bool wxFrame::HandleSize(int WXUNUSED(x), int WXUNUSED(y), WXUINT id) { #if !defined(__WXMICROWIN__) && !defined(__WXWINCE__) switch ( id ) { case SIZE_RESTORED: case SIZE_MAXIMIZED: // only do it it if we were iconized before, otherwise resizing the // parent frame has a curious side effect of bringing it under it's // children if ( !m_iconized ) break; // restore all child frames too IconizeChildFrames(false); (void)SendIconizeEvent(false); break; case SIZE_MINIMIZED: // iconize all child frames too IconizeChildFrames(true); break; } #else wxUnusedVar(id); #endif // !__WXWINCE__ if ( !m_iconized ) { #if wxUSE_STATUSBAR PositionStatusBar(); #endif // wxUSE_STATUSBAR #if wxUSE_TOOLBAR PositionToolBar(); #endif // wxUSE_TOOLBAR #if defined(WINCE_WITH_COMMANDBAR) // Position the menu command bar if (GetMenuBar() && GetMenuBar()->GetCommandBar()) { RECT rect; ::GetWindowRect((HWND) GetMenuBar()->GetCommandBar(), &rect); wxSize clientSz = GetClientSize(); if ( !::MoveWindow((HWND) GetMenuBar()->GetCommandBar(), 0, 0, clientSz.x, rect.bottom - rect.top, true ) ) { wxLogLastError(wxT("MoveWindow")); } } #endif // WINCE_WITH_COMMANDBAR } // call the base class version to generate the appropriate events return false; }
void wxFrame::PositionBars() { #if wxUSE_STATUSBAR PositionStatusBar(); #endif #if wxUSE_TOOLBAR PositionToolBar(); #endif }
void wxFrameBase::SetStatusBar(wxStatusBar *statBar) { bool hadBar = m_frameStatusBar != NULL; m_frameStatusBar = statBar; if ( (m_frameStatusBar != NULL) != hadBar ) { PositionStatusBar(); DoLayout(); } }
//// Motif-specific bool wxFrame::PreResize() { #if wxUSE_TOOLBAR PositionToolBar(); #endif // wxUSE_TOOLBAR #if wxUSE_STATUSBAR PositionStatusBar(); #endif // wxUSE_STATUSBAR return true; }
void MainFrame::OnInit(void) { an_statusbar = new AnStatusBar(this); setMessageString(); setConnectionString(false, wxEmptyString); SetStatusBar(an_statusbar); GetStatusBar()->Show(); PositionStatusBar(); Layout(); }
void wxFrame::OnSize(wxSizeEvent& event) { #if wxUSE_MENUS PositionMenuBar(); #endif // wxUSE_MENUS #if wxUSE_STATUSBAR PositionStatusBar(); #endif // wxUSE_STATUSBAR #if wxUSE_TOOLBAR PositionToolBar(); #endif // wxUSE_TOOLBAR event.Skip(); }
bool wxFrame::HandleSize(int WXUNUSED(x), int WXUNUSED(y), WXUINT id) { switch ( id ) { case SIZE_RESTORED: case SIZE_MAXIMIZED: // only do it it if we were iconized before, otherwise resizing the // parent frame has a curious side effect of bringing it under it's // children if ( !m_iconized ) break; // restore all child frames too IconizeChildFrames(false); (void)SendIconizeEvent(false); break; case SIZE_MINIMIZED: // iconize all child frames too IconizeChildFrames(true); break; } if ( !m_iconized ) { #if wxUSE_STATUSBAR PositionStatusBar(); #endif // wxUSE_STATUSBAR #if wxUSE_TOOLBAR PositionToolBar(); #endif // wxUSE_TOOLBAR } // call the base class version to generate the appropriate events return false; }
void EnviroFrame::CreateUI() { VTLOG1("Frame window: creating menus and toolbars.\n"); CreateMenus(); // Create StatusBar m_pStatusBar = new MyStatusBar(this); SetStatusBar(m_pStatusBar); m_pStatusBar->Show(); m_pStatusBar->UpdateText(); PositionStatusBar(); #ifdef VTP_NVIDIA_PERFORMANCE_MONITORING // Stop crash in update toolbar m_pCameraDlg = NULL; m_pLocationDlg = NULL; m_pLODDlg = NULL; m_pPerformanceMonitorDlg = NULL; #endif // An array of values to tell wxWidgets how to make our OpenGL context. std::vector<int> gl_attribs; gl_attribs.push_back(WX_GL_RGBA); // Full color gl_attribs.push_back(WX_GL_DOUBLEBUFFER); gl_attribs.push_back(WX_GL_BUFFER_SIZE); // 24-bit Z-buffer gl_attribs.push_back(24); gl_attribs.push_back(WX_GL_DEPTH_SIZE); gl_attribs.push_back(24); VTLOG("Anti-aliasing multisamples: %d\n", g_Options.m_iMultiSamples); #if wxCHECK_VERSION(2, 9, 0) if (g_Options.m_iMultiSamples > 0) { gl_attribs.push_back(WX_GL_SAMPLE_BUFFERS); gl_attribs.push_back(1); gl_attribs.push_back(WX_GL_SAMPLES); gl_attribs.push_back(g_Options.m_iMultiSamples); } #endif if (g_Options.m_bStereo && g_Options.m_iStereoMode == 1) // 1 = Quad-buffer stereo { gl_attribs.push_back(WX_GL_STEREO); } // Zero terminates the array gl_attribs.push_back(0); VTLOG("Frame window: creating view canvas.\n"); m_canvas = new EnviroCanvas(this, -1, wxPoint(0, 0), wxSize(-1, -1), 0, _T("vtGLCanvas"), &gl_attribs.front()); // Show the frame VTLOG("Showing the main frame\n"); Show(true); VTLOG("Constructing dialogs\n"); m_pBuildingDlg = new BuildingDlg3d(this, -1, _("Building Properties")); m_pCameraDlg = new CameraDlg(this, -1, _("Camera-View")); m_pDistanceDlg = new DistanceDlg3d(this, -1, _("Distance")); m_pEphemDlg = new EphemDlg(this, -1, _("Ephemeris")); m_pFenceDlg = new LinearStructureDlg3d(this, -1, _("Linear Structures")); m_pInstanceDlg = new InstanceDlg3d(this, this, -1, _("Instances"), wxDefaultPosition, wxDefaultSize, wxDEFAULT_DIALOG_STYLE | wxRESIZE_BORDER); m_pTagDlg = new TagDlg(this, -1, _("Tags"), wxDefaultPosition, wxDefaultSize, wxDEFAULT_DIALOG_STYLE | wxRESIZE_BORDER); m_pTagDlg->SetSize(440,80); m_pLODDlg = new LODDlg(this, -1, _("Terrain LOD Info"), wxDefaultPosition, wxDefaultSize, wxDEFAULT_DIALOG_STYLE | wxRESIZE_BORDER); // m_pLODDlg->Show(); // Enable this to see the LOD dialog immediately m_pPlantDlg = new PlantDlg(this, -1, _("Plants")); m_pPlantDlg->ShowOnlyAvailableSpecies(g_Options.m_bOnlyAvailableSpecies); m_pPlantDlg->SetLang(wxGetApp().GetLanguageCode()); m_pLocationDlg = new LocationDlg(this, -1, _("Locations"), wxDefaultPosition, wxDefaultSize, wxDEFAULT_DIALOG_STYLE | wxRESIZE_BORDER); m_pSceneGraphDlg = new SceneGraphDlg(this, -1, _("Scene Graph"), wxDefaultPosition, wxDefaultSize, wxDEFAULT_DIALOG_STYLE | wxRESIZE_BORDER); m_pSceneGraphDlg->SetSize(450, 600); m_pTimeDlg = new TimeDlg(this, -1, _("Time")); m_pUtilDlg = new UtilDlg(this, -1, _("Utility Poles")); m_pScenarioSelectDialog = new ScenarioSelectDialog(this, -1, _("Scenarios")); m_pVehicleDlg = new VehicleDlg(this, -1, _("Vehicles")); m_pDriveDlg = new DriveDlg(this); m_pProfileDlg = NULL; #ifdef VTP_NVIDIA_PERFORMANCE_MONITORING m_pPerformanceMonitorDlg = new CPerformanceMonitorDialog(this, wxID_ANY, _("Performance Monitor")); #endif m_pVIADlg = new VIADlg(this); #if wxVERSION_NUMBER < 2900 // before 2.9.0 if (m_canvas) m_canvas->SetCurrent(); #else // Still need to do a "SetCurrent" here? It's more complicated now in wx 2.9.x, // and it's probably already taken care of by GraphicsWindowWX? #endif m_mgr.AddPane(m_canvas, wxAuiPaneInfo(). Name(wxT("canvas")).Caption(wxT("Canvas")). CenterPane()); m_mgr.Update(); m_pLayerDlg = new LayerDlg(this, -1, _("Layers"), wxDefaultPosition, wxDefaultSize, wxDEFAULT_DIALOG_STYLE | wxRESIZE_BORDER); m_pLayerDlg->SetSize(500, -1); m_mgr.AddPane(m_pLayerDlg, wxAuiPaneInfo(). Name(_T("layers")).Caption(_("Layers")). Left()); m_mgr.Update(); }
// Pass true to show full screen, false to restore. bool wxFrame::ShowFullScreen(bool show, long style) { if ( IsFullScreen() == show ) return false; if (show) { // zap the toolbar, menubar, and statusbar if needed #if wxUSE_TOOLBAR wxToolBar *theToolBar = GetToolBar(); if ((style & wxFULLSCREEN_NOTOOLBAR) && theToolBar) { if ( theToolBar->IsShown() ) { theToolBar->SetSize(wxDefaultCoord,0); theToolBar->Show(false); } else // prevent it from being restored later { style &= ~wxFULLSCREEN_NOTOOLBAR; } } #endif // wxUSE_TOOLBAR if (style & wxFULLSCREEN_NOMENUBAR) SetMenu((HWND)GetHWND(), (HMENU) NULL); #if wxUSE_STATUSBAR wxStatusBar *theStatusBar = GetStatusBar(); // Save the number of fields in the statusbar if ((style & wxFULLSCREEN_NOSTATUSBAR) && theStatusBar) { if ( theStatusBar->IsShown() ) theStatusBar->Show(false); else style &= ~wxFULLSCREEN_NOSTATUSBAR; } #endif // wxUSE_STATUSBAR } else // restore to normal { // restore the toolbar, menubar, and statusbar if we had hid them #if wxUSE_TOOLBAR wxToolBar *theToolBar = GetToolBar(); if ((m_fsStyle & wxFULLSCREEN_NOTOOLBAR) && theToolBar) { theToolBar->Show(true); } #endif // wxUSE_TOOLBAR #if wxUSE_MENUS if (m_fsStyle & wxFULLSCREEN_NOMENUBAR) { const WXHMENU hmenu = MSWGetActiveMenu(); if ( hmenu ) ::SetMenu(GetHwnd(), (HMENU)hmenu); } #endif // wxUSE_MENUS #if wxUSE_STATUSBAR wxStatusBar *theStatusBar = GetStatusBar(); if ((m_fsStyle & wxFULLSCREEN_NOSTATUSBAR) && theStatusBar) { theStatusBar->Show(true); PositionStatusBar(); } #endif // wxUSE_STATUSBAR } return wxFrameBase::ShowFullScreen(show, style); }
// Frame constructor - read settings from config file, create the panel and add menus and status bar to it SimpleGoFrame::SimpleGoFrame(const wxString& title, const wxPoint& pos, const wxSize& size, long style) : wxFrame(NULL, -1, title, pos, size, style) { panel = new SimpleGoPanel(this); wxFileConfig config("simplego", wxEmptyString, wxStandardPaths::Get().GetUserDataDir()); config.Read("boardsize", &(panel->boardsize), 19); config.Read("blackname", &blackname, "Black"); config.Read("whitename", &whitename, "White"); config.Read("blacklevel", &blacklevel, 0); config.Read("whitelevel", &whitelevel, 0); config.Read("timeout", &timeout, 3); config.Read("komi", &komi, 6.5); config.Read("suicide", &suicide, 0); if(!(panel->boardsize>=2 && panel->boardsize<=19)) panel->boardsize = 19; if(!(blacklevel>=0 && blacklevel<=10)) blacklevel = 0; if(!(whitelevel>=0 && whitelevel<=10)) whitelevel = 0; if(!(komi>=-1000 && komi<=1000)) komi = 6.5; wxMenuBar* menubar = new wxMenuBar; gamemenu = new wxMenu; playmenu = new wxMenu; gamemenu->Append(ID_NEW_GAME, wxT("&New game")); gamemenu->Append(ID_BOARD_SIZE, wxT("&Board size...")); gamemenu->Append(ID_SETTINGS, wxT("&Settings...")); playmenu->Append(ID_PASS, wxT("&Pass")); playmenu->Append(ID_GO_TO_MOVE, wxT("&Go to move...")); playmenu->Append(ID_GNUGO, wxT("&Make GNU Go move")); playmenu->Append(ID_RANDOM, wxT("&Random!"), "", wxITEM_CHECK); gamemenu->Append(ID_SCORE_GAME, wxT("S&core game")); gamemenu->Append(ID_LOAD_GAME, wxT("&Load game...")); gamemenu->Append(ID_SAVE_GAME, wxT("&Save game...")); gamemenu->AppendSeparator(); gamemenu->Append(ID_ABOUT, wxT("Ab&out...")); #ifdef __WXMSW__ playmenu->Enable(ID_GNUGO, false); #else signal(SIGCHLD, SIG_IGN); #endif Connect(ID_NEW_GAME, wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler(SimpleGoFrame::NewGame)); Connect(ID_BOARD_SIZE, wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler(SimpleGoFrame::GetBoard)); Connect(ID_SETTINGS, wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler(SimpleGoFrame::Settings)); Connect(ID_PASS, wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler(SimpleGoFrame::Pass)); Connect(ID_GO_TO_MOVE, wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler(SimpleGoFrame::GoToMove)); Connect(ID_GNUGO, wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler(SimpleGoFrame::GNUGoMove)); Connect(ID_SCORE_GAME, wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler(SimpleGoFrame::ScoreGame)); Connect(ID_LOAD_GAME, wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler(SimpleGoFrame::LoadGame)); Connect(ID_SAVE_GAME, wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler(SimpleGoFrame::SaveGame)); Connect(ID_ABOUT, wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler(SimpleGoFrame::About)); menubar->Append(gamemenu, wxT("&Game")); menubar->Append(playmenu, wxT("&Play")); SetMenuBar(menubar); int styles[1] = {wxSB_SUNKEN}; statusbar = new SimpleGoStatusBar(this); SetStatusBar(statusbar); PositionStatusBar(); statusbar->SetStatusStyles(1, styles); SetSize(panel->boardsize); panel->InitGame(); panel->UpdateBoard(); }
bool wxFrame::HandleSize( int nX, int nY, WXUINT nId ) { bool bProcessed = false; switch (nId) { case kSizeNormal: // // Only do it it if we were iconized before, otherwise resizing the // parent frame has a curious side effect of bringing it under it's // children if (!m_bIconized ) break; // // restore all child frames too // IconizeChildFrames(false); (void)SendIconizeEvent(false); // // fall through // case kSizeMax: m_bIconized = false; break; case kSizeMin: // // Iconize all child frames too // IconizeChildFrames(true); (void)SendIconizeEvent(); m_bIconized = true; break; } if (!m_bIconized) { // // forward WM_SIZE to status bar control // #if wxUSE_NATIVE_STATUSBAR if (m_frameStatusBar && m_frameStatusBar->IsKindOf(CLASSINFO(wxStatusBar95))) { wxSizeEvent vEvent( wxSize( nX ,nY ) ,m_frameStatusBar->GetId() ); vEvent.SetEventObject(m_frameStatusBar); m_frameStatusBar->OnSize(vEvent); } #endif // wxUSE_NATIVE_STATUSBAR PositionStatusBar(); #if wxUSE_TOOLBAR PositionToolBar(); #endif // wxUSE_TOOLBAR bProcessed = wxWindow::HandleSize( nX ,nY ,nId ); } return bProcessed; } // end of wxFrame::HandleSize
// Pass true to show full screen, false to restore. bool wxFrame::ShowFullScreen(bool show, long style) { // TODO-CE: add support for CE #if !defined(__WXMICROWIN__) && !defined(__WXWINCE__) if ( IsFullScreen() == show ) return false; if (show) { // zap the toolbar, menubar, and statusbar if needed // // TODO: hide commandbar for WINCE_WITH_COMMANDBAR #if wxUSE_TOOLBAR wxToolBar *theToolBar = GetToolBar(); if ((style & wxFULLSCREEN_NOTOOLBAR) && theToolBar) { if ( theToolBar->IsShown() ) { theToolBar->SetSize(wxDefaultCoord,0); theToolBar->Show(false); } else // prevent it from being restored later { style &= ~wxFULLSCREEN_NOTOOLBAR; } } #endif // wxUSE_TOOLBAR if (style & wxFULLSCREEN_NOMENUBAR) SetMenu((HWND)GetHWND(), (HMENU) NULL); #if wxUSE_STATUSBAR wxStatusBar *theStatusBar = GetStatusBar(); // Save the number of fields in the statusbar if ((style & wxFULLSCREEN_NOSTATUSBAR) && theStatusBar) { if ( theStatusBar->IsShown() ) theStatusBar->Show(false); else style &= ~wxFULLSCREEN_NOSTATUSBAR; } #endif // wxUSE_STATUSBAR } else // restore to normal { // restore the toolbar, menubar, and statusbar if we had hid them #if wxUSE_TOOLBAR wxToolBar *theToolBar = GetToolBar(); if ((m_fsStyle & wxFULLSCREEN_NOTOOLBAR) && theToolBar) { theToolBar->Show(true); } #endif // wxUSE_TOOLBAR if (m_fsStyle & wxFULLSCREEN_NOMENUBAR) { WXHMENU menu = m_hMenu; #if wxUSE_MDI_ARCHITECTURE wxMDIParentFrame *frame = wxDynamicCast(this, wxMDIParentFrame); if (frame) { wxMDIChildFrame *child = frame->GetActiveChild(); if (child) { menu = child->GetWinMenu(); } } #endif // wxUSE_MDI_ARCHITECTURE if (menu) { ::SetMenu(GetHwnd(), (HMENU)menu); } } #if wxUSE_STATUSBAR wxStatusBar *theStatusBar = GetStatusBar(); if ((m_fsStyle & wxFULLSCREEN_NOSTATUSBAR) && theStatusBar) { theStatusBar->Show(true); PositionStatusBar(); } #endif // wxUSE_STATUSBAR } #endif // !defined(__WXMICROWIN__) && !defined(__WXWINCE__) return wxFrameBase::ShowFullScreen(show, style); }