bool wxGISApplication::CreateApp(void) { CreateStatusBar(); wxFrame::GetStatusBar()->SetStatusText(_("Ready")); if(!wxGISApplicationBase::CreateApp()) return false; //load commandbars SerializeCommandBars(); //load accelerators m_pGISAcceleratorTable = new wxGISAcceleratorTable(this); wxGISAppConfig oConfig = GetConfig(); if(!oConfig.IsOk()) return false; // create MenuBar wxXmlNode* pMenuBarNode = oConfig.GetConfigNode(enumGISHKCU, GetAppName() + wxString(wxT("/frame/menubar"))); m_pMenuBar = new wxGISMenuBar(wxMB_DOCKABLE, this, pMenuBarNode); //wxMB_DOCKABLE SetMenuBar(static_cast<wxMenuBar*>(m_pMenuBar)); //mark menues from menu bar as enumGISTAMMenubar for(size_t i = 0; i < m_CommandBarArray.GetCount(); ++i) if(m_pMenuBar->IsMenuBarMenu(m_CommandBarArray[i]->GetName())) m_CommandBarArray[i]->SetType(enumGISCBMenubar); // min size for the frame itself isn't completely done. // see the end up wxAuiManager::Update() for the test // code. For now, just hard code a frame minimum size SetMinSize(wxSize(800,480)); SerializeFramePos(false); SetAcceleratorTable(m_pGISAcceleratorTable->GetAcceleratorTable()); SetApplication( this ); // wxHtmlWindow *pHtmlText = new wxHtmlWindow(this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxHW_DEFAULT_STYLE | wxBORDER_THEME); // pHtmlText->SetPage(wxT("<html><body><h1>Error</h1>Some error occurred :-H)</body></hmtl>")); // pHtmlText->Show(false); // RegisterChildWindow(pHtmlText->GetId()); // //#ifdef __WXGTK__ // // wxGISToolBarMenu* pToolBarMenu = dynamic_cast<wxGISToolBarMenu*>(GetCommandBar(TOOLBARMENUNAME)); // //if(pToolBarMenu) // // PushEventHandler(pToolBarMenu); //// m_pMenuBar->PushEventHandler(this); //#endif return true; }
wxGxObjectDialog::~wxGxObjectDialog() { if(m_pwxGxContentView) m_pwxGxContentView->Deactivate(); if(m_PopupCtrl) m_PopupCtrl->Deactivate(); SerializeFramePos(true); RemoveAllFilters(); wxDELETE(m_pwxGxContentView); wxDELETE(m_pGISAcceleratorTable); }
void wxGxObjectDialog::OnInit() { long nStyle = wxLC_LIST | wxLC_EDIT_LABELS | wxLC_SORT_ASCENDING | wxBORDER_THEME; if(!m_bAllowMultiSelect) nStyle |= wxLC_SINGLE_SEL; m_pwxGxContentView = new wxGxDialogContentView(this, LISTCTRLID, wxDefaultPosition, wxDefaultSize, nStyle); wxGISAppConfig oConfig = GetConfig(); if(oConfig.IsOk()) { wxXmlNode* pContentViewConf = oConfig.GetConfigNode(enumGISHKCU, GetAppName() + wxString(wxT("/frame/views/contentsview"))); m_pwxGxContentView->Activate(this, pContentViewConf); } RegisterChildWindow(m_pwxGxContentView->GetId()); bMainSizer->Insert(1, m_pwxGxContentView, 1, wxALL|wxEXPAND, 5 ); //m_pwxGxContentView->Connect( wxEVT_COMMAND_LIST_ITEM_SELECTED, wxListEventHandler( wxGxObjectDialog::OnItemSelected ), NULL, this ); //m_pwxGxContentView->Connect( wxEVT_COMMAND_LIST_ITEM_DESELECTED, wxListEventHandler( wxGxObjectDialog::OnItemSelected ), NULL, this ); m_pwxGxContentView->Bind( wxEVT_COMMAND_LIST_ITEM_SELECTED, &wxGxObjectDialog::OnItemSelected, this ); m_pwxGxContentView->Bind( wxEVT_COMMAND_LIST_ITEM_DESELECTED, &wxGxObjectDialog::OnItemSelected, this ); for(size_t i = 0; i < m_FilterArray.size(); ++i) m_WildcardCombo->AppendString(m_FilterArray[i]->GetName()); if(m_FilterArray.size() > 1 && m_bAllFilters) m_WildcardCombo->AppendString(_("All listed filters")); if(m_FilterArray.size() == 0) m_WildcardCombo->AppendString(_("All items")); m_WildcardCombo->Select(m_nDefaultFilter); m_pwxGxContentView->SetCurrentFilter(m_nDefaultFilter); m_pwxGxContentView->SetFilters(m_FilterArray); wxString sLastPath = m_sStartPath; if(sLastPath.IsEmpty()) { if(oConfig.IsOk()) sLastPath = oConfig.Read(enumGISHKCU, GetAppName() + wxString(wxT("/lastpath/path")), m_pCatalog->GetName()); else sLastPath = m_pCatalog->GetName(); } SetLocation(sLastPath); m_NameTextCtrl->SetFocus(); SerializeFramePos(false); }
void wxGISApplication::OnClose(wxCloseEvent& event) { event.Skip(); if(m_pGISAcceleratorTable) m_pGISAcceleratorTable->Store(); wxDELETE(m_pGISAcceleratorTable); wxGISAppConfig oConfig = GetConfig(); if(m_pMenuBar && oConfig.IsOk()) { wxXmlNode* pMenuBarNode = oConfig.GetConfigNode(enumGISHKCU, GetAppName() + wxString(wxT("/frame/menubar"))); if(!pMenuBarNode) pMenuBarNode = oConfig.CreateConfigNode(enumGISHKCU, GetAppName() + wxString(wxT("/frame/menubar"))); m_pMenuBar->Serialize(pMenuBarNode); } //wxDELETE(m_pMenuBar); delete by wxApp SerializeCommandBars(true); SerializeFramePos(true); wxFrame::OnCloseWindow(event); }