-// The default implementation for the close window event - calls
-// OnClose for backward compatibility.
-
-void wxFrame::OnCloseWindow(wxCloseEvent& event)
-{
- // Compatibility
- if ( GetEventHandler()->OnClose() || !event.CanVeto())
- {
- this->Destroy();
- }
- else
- event.Veto(TRUE);
-}
-
-bool wxFrame::OnClose()
-{
- return TRUE;
-}
-
-// Destroy the window (delayed, if a managed window)
-bool wxFrame::Destroy()
-{
- if (!wxPendingDelete.Member(this))
- wxPendingDelete.Append(this);
- return TRUE;
-}
-
-// Default menu selection behaviour - display a help string
-void wxFrame::OnMenuHighlight(wxMenuEvent& event)
-{
- if (GetStatusBar())
- {
- if (event.GetMenuId() == -1)
- SetStatusText("");
- else
- {
- wxMenuBar *menuBar = GetMenuBar();
- if (menuBar)
- {
- wxString helpString(menuBar->GetHelpString(event.GetMenuId()));
- if (helpString != "")
- SetStatusText(helpString);
- }
- }
- }
-}
-
-wxMenuBar *wxFrame::GetMenuBar() const
-{
- return m_frameMenuBar;
-}
-
-void wxFrame::Centre(int direction)
-{
- int display_width, display_height, width, height, x, y;
- wxDisplaySize(&display_width, &display_height);
-
- GetSize(&width, &height);
- GetPosition(&x, &y);
-
- if (direction & wxHORIZONTAL)
- x = (int)((display_width - width)/2);
- if (direction & wxVERTICAL)
- y = (int)((display_height - height)/2);
-
- SetSize(x, y, width, height);
-}
-
-// Call this to simulate a menu command
-void wxFrame::Command(int id)
-{
- ProcessCommand(id);
-}
-
-void wxFrame::ProcessCommand(int id)
-{
- wxCommandEvent commandEvent(wxEVT_COMMAND_MENU_SELECTED, id);
- commandEvent.SetInt( id );
- commandEvent.SetEventObject( this );
-
- wxMenuBar *bar = GetMenuBar() ;
- if (!bar)
- return;
-
-/* TODO: check the menu item if required
- wxMenuItem *item = bar->FindItemForId(id) ;
- if (item && item->IsCheckable())
- {
- bar->Check(id,!bar->Checked(id)) ;
- }
-*/
-
- GetEventHandler()->ProcessEvent(commandEvent);
-}
-
-// Checks if there is a toolbar, and returns the first free client position
-wxPoint wxFrame::GetClientAreaOrigin() const
-{
- wxPoint pt(0, 0);