-// The default implementation for the close window event.
-void wxFrame::OnCloseWindow(wxCloseEvent& event)
-{
- Destroy();
-}
-
-// 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())
- {
- int menuId = event.GetMenuId();
- if ( menuId != -1 )
- {
- wxMenuBar *menuBar = GetMenuBar();
- if (menuBar && menuBar->FindItem(menuId))
- {
- // set status text even if the string is empty - this will at
- // least remove the string from the item which was previously
- // selected
- SetStatusText(menuBar->GetHelpString(menuId));
- }
- }
- }
-}
-
-wxMenuBar *wxFrame::GetMenuBar() const
-{
- return m_frameMenuBar;
-}
-
-bool wxFrame::ProcessCommand(int id)
-{
- wxMenuBar *bar = GetMenuBar() ;
- if ( !bar )
- return FALSE;
-
- wxMenuItem *item = bar->FindItemForId(id);
- if ( !item )
- return FALSE;
-
- if ( item->IsCheckable() )
- {
- bar->Check(id, !bar->IsChecked(id)) ;
- }
-
- wxCommandEvent commandEvent(wxEVT_COMMAND_MENU_SELECTED, id);
- commandEvent.SetInt( id );
- commandEvent.SetEventObject( this );
-
- return GetEventHandler()->ProcessEvent(commandEvent);
-}
-
-// Checks if there is a toolbar, and returns the first free client position
-wxPoint wxFrame::GetClientAreaOrigin() const
-{
- wxPoint pt(0, 0);
- if (GetToolBar())
- {
- int w, h;
- GetToolBar()->GetSize(& w, & h);
-
- if (GetToolBar()->GetWindowStyleFlag() & wxTB_VERTICAL)
- {
- pt.x += w;
- }
- else
- {
- pt.y += h;
- }
- }
- return pt;
-}
-
-void wxFrame::ScreenToClient(int *x, int *y) const
-{
- wxWindow::ScreenToClient(x, y);
-
- // We may be faking the client origin.
- // So a window that's really at (0, 30) may appear
- // (to wxWin apps) to be at (0, 0).
- wxPoint pt(GetClientAreaOrigin());
- *x -= pt.x;
- *y -= pt.y;
-}
-
-void wxFrame::ClientToScreen(int *x, int *y) const
-{
- // We may be faking the client origin.
- // So a window that's really at (0, 30) may appear
- // (to wxWin apps) to be at (0, 0).
- wxPoint pt1(GetClientAreaOrigin());
- *x += pt1.x;
- *y += pt1.y;
-
- wxWindow::ClientToScreen(x, y);
-}