void OnSysColourChanged(wxSysColourChangedEvent& event);
void OnSize(wxSizeEvent& event);
+ void OnIconized(wxIconizeEvent& event);
bool HandleActivate(int state, bool minimized, WXHWND activate);
bool HandleCommand(WXWORD id, WXWORD cmd, WXHWND control);
virtual WXHICON GetDefaultIcon() const;
+ // set the size of the MDI client window to match the frame size
+ void UpdateClientSize();
+
+
wxMDIClientWindow * m_clientWindow;
wxMDIChildFrame * m_currentChild;
wxMenu* m_windowMenu;
private:
bool m_needsInitialShow; // Show must be called in idle time after Creation
bool m_needsResize; // flag which tells us to artificially resize the frame
- virtual void DetachMenuBar() ;
+ virtual void DetachMenuBar() ;
DECLARE_EVENT_TABLE()
DECLARE_DYNAMIC_CLASS_NO_COPY(wxMDIChildFrame)
BEGIN_EVENT_TABLE(wxMDIParentFrame, wxFrame)
EVT_SIZE(wxMDIParentFrame::OnSize)
+ EVT_ICONIZE(wxMDIParentFrame::OnIconized)
EVT_SYS_COLOUR_CHANGED(wxMDIParentFrame::OnSysColourChanged)
END_EVENT_TABLE()
}
}
-void wxMDIParentFrame::OnSize(wxSizeEvent&)
+void wxMDIParentFrame::UpdateClientSize()
{
if ( GetClientWindow() )
{
}
}
+void wxMDIParentFrame::OnSize(wxSizeEvent& WXUNUSED(event))
+{
+ UpdateClientSize();
+
+ // do not call event.Skip() here, it somehow messes up MDI client window
+}
+
+void wxMDIParentFrame::OnIconized(wxIconizeEvent& event)
+{
+ event.Skip();
+
+ if ( !event.Iconized() )
+ {
+ UpdateClientSize();
+ }
+}
+
// Returns the active MDI child window
wxMDIChildFrame *wxMDIParentFrame::GetActiveChild() const
{
void wxMDIChildFrame::DetachMenuBar()
{
- RemoveWindowMenu(NULL, m_hMenu);
- wxFrame::DetachMenuBar();
+ RemoveWindowMenu(NULL, m_hMenu);
+ wxFrame::DetachMenuBar();
}
WXHICON wxMDIChildFrame::GetDefaultIcon() const
// (see OGL studio sample). So check if the position is changed and if so,
// redraw the MDI child frames.
- wxPoint oldPos = GetPosition();
+ const wxPoint oldPos = GetPosition();
- wxWindow::DoSetSize(x, y, width, height, sizeFlags);
+ wxWindow::DoSetSize(x, y, width, height, sizeFlags | wxSIZE_FORCE);
- wxPoint newPos = GetPosition();
+ const wxPoint newPos = GetPosition();
if ((newPos.x != oldPos.x) || (newPos.y != oldPos.y))
{