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
This commit is contained in:
Julian Smart 1999-10-28 09:15:42 +00:00
parent 2bd5bbc948
commit 449f38b57e
4 changed files with 61 additions and 39 deletions

View File

@ -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;

View File

@ -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()
};

View File

@ -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),

View File

@ -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