From: Julian Smart Date: Thu, 28 Oct 1999 09:15:42 +0000 (+0000) Subject: Do... fixes and OnMenuHighlight correction (so MDI sample now works) X-Git-Url: https://git.saurik.com/wxWidgets.git/commitdiff_plain/449f38b57e7ddcfd0d0de6449aceebb4e5abffc9 Do... fixes and OnMenuHighlight correction (so MDI sample now works) git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@4236 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- diff --git a/include/wx/motif/frame.h b/include/wx/motif/frame.h index b8f741e825..11e67cb620 100644 --- a/include/wx/motif/frame.h +++ b/include/wx/motif/frame.h @@ -56,14 +56,6 @@ public: virtual bool Destroy(); - void GetClientSize(int *width, int *height) const; - void GetSize(int *width, int *height) const ; - void GetPosition(int *x, int *y) const ; - - wxSize GetSize() const { return wxWindow::GetSize(); } - wxPoint GetPosition() const { return wxWindow::GetPosition(); } - wxSize GetClientSize() const { return wxWindow::GetClientSize(); } - void ClientToScreen(int *x, int *y) const; wxPoint ClientToScreen(const wxPoint& pt) const { return wxWindow::ClientToScreen(pt); } @@ -174,6 +166,11 @@ public: bool PreResize(); +protected: + void DoGetClientSize(int *width, int *height) const; + void DoGetSize(int *width, int *height) const ; + void DoGetPosition(int *x, int *y) const ; + protected: wxMenuBar * m_frameMenuBar; wxStatusBar * m_frameStatusBar; diff --git a/include/wx/motif/mdi.h b/include/wx/motif/mdi.h index 143596828a..79e52de767 100644 --- a/include/wx/motif/mdi.h +++ b/include/wx/motif/mdi.h @@ -65,15 +65,10 @@ public: void OnSize(wxSizeEvent& event); void OnActivate(wxActivateEvent& event); void OnSysColourChanged(wxSysColourChangedEvent& event); + void OnMenuHighlight(wxMenuEvent& event); void SetMenuBar(wxMenuBar *menu_bar); - // Gets the size available for subwindows after menu size, toolbar size - // and status bar size have been subtracted. If you want to manage your own - // toolbar(s), don't call SetToolBar. - void GetClientSize(int *width, int *height) const; - wxSize GetClientSize() const { return wxWindow::GetClientSize(); } - // Get the active MDI child window wxMDIChildFrame *GetActiveChild() const ; @@ -110,6 +105,10 @@ protected: int sizeFlags = wxSIZE_AUTO); virtual void DoSetClientSize(int width, int height); + // Gets the size available for subwindows after menu size, toolbar size + // and status bar size have been subtracted. If you want to manage your own + // toolbar(s), don't call SetToolBar. + void DoGetClientSize(int *width, int *height) const; protected: @@ -151,10 +150,6 @@ public: void SetMenuBar(wxMenuBar *menu_bar); void SetTitle(const wxString& title); - void GetClientSize(int *width, int *height) const; - void GetSize(int *width, int *height) const; - void GetPosition(int *x, int *y) const ; - // Set icon virtual void SetIcon(const wxIcon& icon); @@ -199,6 +194,10 @@ protected: int width, int height, int sizeFlags = wxSIZE_AUTO); virtual void DoSetClientSize(int width, int height); + + void DoGetClientSize(int *width, int *height) const; + void DoGetSize(int *width, int *height) const; + void DoGetPosition(int *x, int *y) const ; }; /* The client window is a child of the parent MDI frame, and itself @@ -221,10 +220,6 @@ public: ~wxMDIClientWindow(); - void GetClientSize(int *width, int *height) const; - void GetSize(int *width, int *height) const ; - void GetPosition(int *x, int *y) const ; - // Note: this is virtual, to allow overridden behaviour. virtual bool CreateClient(wxMDIParentFrame *parent, long style = wxVSCROLL | wxHSCROLL); @@ -240,6 +235,11 @@ protected: int sizeFlags = wxSIZE_AUTO); virtual void DoSetClientSize(int width, int height); + void DoGetClientSize(int *width, int *height) const; + void DoGetSize(int *width, int *height) const ; + void DoGetPosition(int *x, int *y) const ; + + private: DECLARE_EVENT_TABLE() }; diff --git a/src/motif/frame.cpp b/src/motif/frame.cpp index cc64567c87..8cd57cb702 100644 --- a/src/motif/frame.cpp +++ b/src/motif/frame.cpp @@ -400,7 +400,7 @@ wxFrame::~wxFrame() } // Get size *available for subwindows* i.e. excluding menu bar, toolbar etc. -void wxFrame::GetClientSize(int *x, int *y) const +void wxFrame::DoGetClientSize(int *x, int *y) const { Dimension xx, yy; XtVaGetValues((Widget) m_workArea, XmNwidth, &xx, XmNheight, &yy, NULL); @@ -488,14 +488,14 @@ void wxFrame::DoSetClientSize(int width, int height) } -void wxFrame::GetSize(int *width, int *height) const +void wxFrame::DoGetSize(int *width, int *height) const { Dimension xx, yy; XtVaGetValues((Widget) m_frameShell, XmNwidth, &xx, XmNheight, &yy, NULL); *width = xx; *height = yy; } -void wxFrame::GetPosition(int *x, int *y) const +void wxFrame::DoGetPosition(int *x, int *y) const { Window parent_window = XtWindow((Widget) m_frameShell), next_parent = XtWindow((Widget) m_frameShell), diff --git a/src/motif/mdi.cpp b/src/motif/mdi.cpp index 11c0daba9f..520bfd99e7 100644 --- a/src/motif/mdi.cpp +++ b/src/motif/mdi.cpp @@ -47,6 +47,7 @@ BEGIN_EVENT_TABLE(wxMDIParentFrame, wxFrame) EVT_SIZE(wxMDIParentFrame::OnSize) EVT_ACTIVATE(wxMDIParentFrame::OnActivate) EVT_SYS_COLOUR_CHANGED(wxMDIParentFrame::OnSysColourChanged) + EVT_MENU_HIGHLIGHT_ALL(wxMDIParentFrame::OnMenuHighlight) END_EVENT_TABLE() BEGIN_EVENT_TABLE(wxMDIClientWindow, wxNotebook) @@ -131,9 +132,9 @@ void wxMDIParentFrame::OnSize(wxSizeEvent& WXUNUSED(event)) GetClientWindow()->SetSize(x, y, width, height); } -void wxMDIParentFrame::GetClientSize(int *width, int *height) const +void wxMDIParentFrame::DoGetClientSize(int *width, int *height) const { - wxFrame::GetClientSize(width, height); + wxFrame::DoGetClientSize(width, height); } void wxMDIParentFrame::OnActivate(wxActivateEvent& WXUNUSED(event)) @@ -283,6 +284,30 @@ void wxMDIParentFrame::ActivatePrevious() // TODO } +// Default menu selection behaviour - display a help string +void wxMDIParentFrame::OnMenuHighlight(wxMenuEvent& event) +{ + if (GetStatusBar()) + { + if (event.GetMenuId() == -1) + SetStatusText(""); + else + { + wxMenuBar *menuBar = (wxMenuBar*) NULL; + if (GetActiveChild()) + menuBar = GetActiveChild()->GetMenuBar(); + else + menuBar = GetMenuBar(); + if (menuBar) + { + wxString helpString(menuBar->GetHelpString(event.GetMenuId())); + if (helpString != "") + SetStatusText(helpString); + } + } + } +} + // Child frame wxMDIChildFrame::wxMDIChildFrame() @@ -453,9 +478,9 @@ void wxMDIChildFrame::DoSetClientSize(int width, int height) wxWindow::DoSetClientSize(width, height); } -void wxMDIChildFrame::GetClientSize(int* width, int* height) const +void wxMDIChildFrame::DoGetClientSize(int* width, int* height) const { - wxWindow::GetSize(width, height); + wxWindow::DoGetSize(width, height); } void wxMDIChildFrame::DoSetSize(int x, int y, int width, int height, int sizeFlags) @@ -463,14 +488,14 @@ void wxMDIChildFrame::DoSetSize(int x, int y, int width, int height, int sizeFla wxWindow::DoSetSize(x, y, width, height, sizeFlags); } -void wxMDIChildFrame::GetSize(int* width, int* height) const +void wxMDIChildFrame::DoGetSize(int* width, int* height) const { - wxWindow::GetSize(width, height); + wxWindow::DoGetSize(width, height); } -void wxMDIChildFrame::GetPosition(int *x, int *y) const +void wxMDIChildFrame::DoGetPosition(int *x, int *y) const { - wxWindow::GetPosition(x, y); + wxWindow::DoGetPosition(x, y); } bool wxMDIChildFrame::Show(bool show) @@ -614,19 +639,19 @@ void wxMDIClientWindow::DoSetClientSize(int width, int height) wxWindow::DoSetClientSize(width, height); } -void wxMDIClientWindow::GetClientSize(int *width, int *height) const +void wxMDIClientWindow::DoGetClientSize(int *width, int *height) const { - wxWindow::GetClientSize(width, height); + wxWindow::DoGetClientSize(width, height); } -void wxMDIClientWindow::GetSize(int *width, int *height) const +void wxMDIClientWindow::DoGetSize(int *width, int *height) const { - wxWindow::GetSize(width, height); + wxWindow::DoGetSize(width, height); } -void wxMDIClientWindow::GetPosition(int *x, int *y) const +void wxMDIClientWindow::DoGetPosition(int *x, int *y) const { - wxWindow::GetPosition(x, y); + wxWindow::DoGetPosition(x, y); } // Explicitly call default scroll behaviour