/////////////////////////////////////////////////////////////////////////////
// Name: msw/frame.cpp
-// Purpose: wxFrameMSW
+// Purpose: wxFrame
// Author: Julian Smart
// Modified by:
// Created: 01/02/97
// event tables
// ----------------------------------------------------------------------------
-BEGIN_EVENT_TABLE(wxFrameMSW, wxFrameBase)
- EVT_ACTIVATE(wxFrameMSW::OnActivate)
- EVT_SYS_COLOUR_CHANGED(wxFrameMSW::OnSysColourChanged)
+BEGIN_EVENT_TABLE(wxFrame, wxFrameBase)
+ EVT_ACTIVATE(wxFrame::OnActivate)
+ EVT_SYS_COLOUR_CHANGED(wxFrame::OnSysColourChanged)
END_EVENT_TABLE()
-#ifndef __WXUNIVERSAL__
- IMPLEMENT_DYNAMIC_CLASS(wxFrame, wxWindow)
-#endif
+IMPLEMENT_DYNAMIC_CLASS(wxFrame, wxWindow)
// ============================================================================
// implementation
#if wxUSE_STATUSBAR
#if wxUSE_NATIVE_STATUSBAR
- bool wxFrameMSW::m_useNativeStatusBar = TRUE;
+ bool wxFrame::m_useNativeStatusBar = TRUE;
#else
- bool wxFrameMSW::m_useNativeStatusBar = FALSE;
+ bool wxFrame::m_useNativeStatusBar = FALSE;
#endif
#endif // wxUSE_NATIVE_STATUSBAR
// creation/destruction
// ----------------------------------------------------------------------------
-void wxFrameMSW::Init()
+void wxFrame::Init()
{
#if wxUSE_TOOLTIPS
m_hwndToolTip = 0;
m_fsToolBarHeight = 0;
// m_fsMenu = 0;
+ m_wasMinimized = FALSE;
+
m_winLastFocused = (wxWindow *)NULL;
}
-bool wxFrameMSW::Create(wxWindow *parent,
+bool wxFrame::Create(wxWindow *parent,
wxWindowID id,
const wxString& title,
const wxPoint& pos,
return TRUE;
}
-wxFrameMSW::~wxFrameMSW()
+wxFrame::~wxFrame()
{
m_isBeingDeleted = TRUE;
}
// Get size *available for subwindows* i.e. excluding menu bar, toolbar etc.
-void wxFrameMSW::DoGetClientSize(int *x, int *y) const
+void wxFrame::DoGetClientSize(int *x, int *y) const
{
RECT rect;
::GetClientRect(GetHwnd(), &rect);
*y = rect.bottom;
}
-void wxFrameMSW::DoSetClientSize(int width, int height)
+void wxFrame::DoSetClientSize(int width, int height)
{
// leave enough space for the status bar if we have (and show) it
#if wxUSE_STATUSBAR
}
// ----------------------------------------------------------------------------
-// wxFrameMSW: various geometry-related functions
+// wxFrame: various geometry-related functions
// ----------------------------------------------------------------------------
-void wxFrameMSW::Raise()
+void wxFrame::Raise()
{
#ifdef __WIN16__
// no SetForegroundWindow() in Win16
}
// generate an artificial resize event
-void wxFrameMSW::SendSizeEvent()
+void wxFrame::SendSizeEvent()
{
if ( !m_iconized )
{
}
#if wxUSE_STATUSBAR
-wxStatusBar *wxFrameMSW::OnCreateStatusBar(int number,
+wxStatusBar *wxFrame::OnCreateStatusBar(int number,
long style,
wxWindowID id,
const wxString& name)
return statusBar;
}
-void wxFrameMSW::PositionStatusBar()
+void wxFrame::PositionStatusBar()
{
if ( !m_frameStatusBar )
return;
#if wxUSE_MENUS_NATIVE
-void wxFrameMSW::AttachMenuBar(wxMenuBar *menubar)
+void wxFrame::AttachMenuBar(wxMenuBar *menubar)
{
wxFrameBase::AttachMenuBar(menubar);
}
}
-void wxFrameMSW::InternalSetMenuBar()
+void wxFrame::InternalSetMenuBar()
{
#ifndef __WXMICROWIN__
if ( !::SetMenu(GetHwnd(), (HMENU)m_hMenu) )
#endif // wxUSE_MENUS_NATIVE
// Responds to colour changes, and passes event on to children.
-void wxFrameMSW::OnSysColourChanged(wxSysColourChangedEvent& event)
+void wxFrame::OnSysColourChanged(wxSysColourChangedEvent& event)
{
SetBackgroundColour(wxSystemSettings::GetSystemColour(wxSYS_COLOUR_APPWORKSPACE));
Refresh();
}
// Pass TRUE to show full screen, FALSE to restore.
-bool wxFrameMSW::ShowFullScreen(bool show, long style)
+bool wxFrame::ShowFullScreen(bool show, long style)
{
if ( IsFullScreen() == show )
return FALSE;
// Default activation behaviour - set the focus for the first child
// subwindow found.
-void wxFrameMSW::OnActivate(wxActivateEvent& event)
+void wxFrame::OnActivate(wxActivateEvent& event)
{
if ( event.GetActive() )
{
// restore focus to the child which was last focused
- wxLogTrace(_T("focus"), _T("wxFrameMSW %08x activated."), m_hWnd);
+ wxLogTrace(_T("focus"), _T("wxFrame %08x activated."), m_hWnd);
wxWindow *parent = m_winLastFocused ? m_winLastFocused->GetParent()
: NULL;
}
wxLogTrace(_T("focus"),
- _T("wxFrameMSW %08x deactivated, last focused: %08x."),
+ _T("wxFrame %08x deactivated, last focused: %08x."),
m_hWnd,
m_winLastFocused ? GetHwndOf(m_winLastFocused)
: NULL);
#if wxUSE_TOOLBAR
-wxToolBar* wxFrameMSW::CreateToolBar(long style, wxWindowID id, const wxString& name)
+wxToolBar* wxFrame::CreateToolBar(long style, wxWindowID id, const wxString& name)
{
if ( wxFrameBase::CreateToolBar(style, id, name) )
{
return m_frameToolBar;
}
-void wxFrameMSW::PositionToolBar()
+void wxFrame::PositionToolBar()
{
RECT rect;
::GetClientRect(GetHwnd(), &rect);
// propagate our state change to all child frames: this allows us to emulate X
// Windows behaviour where child frames float independently of the parent one
// on the desktop, but are iconized/restored with it
-void wxFrameMSW::IconizeChildFrames(bool bIconize)
+void wxFrame::IconizeChildFrames(bool bIconize)
{
for ( wxWindowList::Node *node = GetChildren().GetFirst();
node;
#endif // wxUSE_MDI_ARCHITECTURE
)
{
- frame->Iconize(bIconize);
+ // we don't want to restore the child frames which had been
+ // iconized even before we were iconized, so save the child frame
+ // status when iconizing the parent frame and check it when
+ // restoring it
+ if ( bIconize )
+ {
+ // note that we shouldn't touch the hidden frames neither
+ // because iconizing/restoring them would show them as a side
+ // effect
+ frame->m_wasMinimized = frame->IsIconized() || !frame->IsShown();
+ }
+
+ // this test works for both iconizing and restoring
+ if ( !frame->m_wasMinimized )
+ frame->Iconize(bIconize);
}
}
}
-WXHICON wxFrameMSW::GetDefaultIcon() const
+WXHICON wxFrame::GetDefaultIcon() const
{
return (WXHICON)(wxSTD_FRAME_ICON ? wxSTD_FRAME_ICON
: wxDEFAULT_FRAME_ICON);
// preprocessing
// ---------------------------------------------------------------------------
-bool wxFrameMSW::MSWTranslateMessage(WXMSG* pMsg)
+bool wxFrame::MSWTranslateMessage(WXMSG* pMsg)
{
if ( wxWindow::MSWTranslateMessage(pMsg) )
return TRUE;
// our private (non virtual) message handlers
// ---------------------------------------------------------------------------
-bool wxFrameMSW::HandlePaint()
+bool wxFrame::HandlePaint()
{
RECT rect;
if ( GetUpdateRect(GetHwnd(), &rect, FALSE) )
}
}
-bool wxFrameMSW::HandleSize(int x, int y, WXUINT id)
+bool wxFrame::HandleSize(int x, int y, WXUINT id)
{
bool processed = FALSE;
#ifndef __WXMICROWIN__
return processed;
}
-bool wxFrameMSW::HandleCommand(WXWORD id, WXWORD cmd, WXHWND control)
+bool wxFrame::HandleCommand(WXWORD id, WXWORD cmd, WXHWND control)
{
if ( control )
{
return FALSE;
}
-bool wxFrameMSW::HandleMenuSelect(WXWORD nItem, WXWORD flags, WXHMENU hMenu)
+bool wxFrame::HandleMenuSelect(WXWORD nItem, WXWORD flags, WXHMENU hMenu)
{
int item;
if ( flags == 0xFFFF && hMenu == 0 )
}
// ---------------------------------------------------------------------------
-// the window proc for wxFrameMSW
+// the window proc for wxFrame
// ---------------------------------------------------------------------------
-long wxFrameMSW::MSWWindowProc(WXUINT message, WXWPARAM wParam, WXLPARAM lParam)
+long wxFrame::MSWWindowProc(WXUINT message, WXWPARAM wParam, WXLPARAM lParam)
{
long rc = 0;
bool processed = FALSE;