#undef LoadAccelerators
#endif
-#if USE_NATIVE_STATUSBAR
+#if wxUSE_NATIVE_STATUSBAR
#include <wx/msw/statbr95.h>
#endif
IMPLEMENT_DYNAMIC_CLASS(wxFrame, wxWindow)
#endif
-#if USE_NATIVE_STATUSBAR
+#if wxUSE_NATIVE_STATUSBAR
bool wxFrame::m_useNativeStatusBar = TRUE;
#else
bool wxFrame::m_useNativeStatusBar = FALSE;
int height = size.y;
m_iconized = FALSE;
- MSWCreate(m_windowId, (wxWindow *)parent, wxFrameClassName, this, (char *)(const char *)title,
- x, y, width, height, style);
+
+ // we pass NULL as parent to MSWCreate because frames with parents behave
+ // very strangely under Win95 shell
+ MSWCreate(m_windowId, NULL, wxFrameClassName, this, title,
+ x, y, width, height, style);
wxModelessWindows.Append(this);
return TRUE;
#endif
}
-void wxFrame::SetAcceleratorTable(const wxAcceleratorTable& accel)
-{
- m_acceleratorTable = accel;
-}
-
wxStatusBar *wxFrame::OnCreateStatusBar(int number, long style, wxWindowID id,
const wxString& name)
{
wxStatusBar *statusBar = NULL;
-#if USE_NATIVE_STATUSBAR
+#if wxUSE_NATIVE_STATUSBAR
if (UsesNativeStatusBar())
{
statusBar = new wxStatusBar95(this, id, style);
{
// native status bar positions itself
if (m_frameStatusBar
-#if USE_NATIVE_STATUSBAR
+#if wxUSE_NATIVE_STATUSBAR
&& !m_frameStatusBar->IsKindOf(CLASSINFO(wxStatusBar95))
#endif
)
{
wxSysColourChangedEvent event2;
event2.SetEventObject( m_frameStatusBar );
- m_frameStatusBar->ProcessEvent(event2);
+ m_frameStatusBar->GetEventHandler()->ProcessEvent(event2);
}
// Propagate the event to the non-top-level children
// Keep this in wxFrame because it saves recoding this function
// in wxTinyFrame
-#if USE_ITSY_BITSY
+#if wxUSE_ITSY_BITSY
if (style & wxTINY_CAPTION_VERT)
msflags |= IBS_VERTCAPTION;
if (style & wxTINY_CAPTION_HORIZ)
bool wxFrame::MSWOnPaint(void)
{
-#if WXDEBUG > 1
- wxDebugMsg("wxFrameWnd::OnPaint %d\n", handle);
-#endif
RECT rect;
if (GetUpdateRect((HWND) GetHWND(), &rect, FALSE))
{
if (m_iconized)
{
HICON the_icon;
- if (m_icon.Ok())
- the_icon = (HICON) m_icon.GetHICON();
- if (the_icon == 0)
+ if (m_icon.Ok())
+ the_icon = (HICON) m_icon.GetHICON();
+ else
the_icon = (HICON) m_defaultIcon;
PAINTSTRUCT ps;
void wxFrame::MSWOnSize(int x, int y, WXUINT id)
{
-#if WXDEBUG > 1
- wxDebugMsg("wxFrameWnd::OnSize %d\n", m_hWnd);
-#endif
switch (id)
{
- case SIZEFULLSCREEN:
case SIZENORMAL:
+ // only do it it if we were iconized before, otherwise resizing the
+ // parent frame has a curious side effect of bringing it under it's
+ // children
+ if ( !m_iconized )
+ break;
+
+ // restore all child frames too
+ IconizeChildFrames(FALSE);
+
+ // fall through
+
+ case SIZEFULLSCREEN:
m_iconized = FALSE;
- break;
+ break;
+
case SIZEICONIC:
+ // iconize all child frames too
+ IconizeChildFrames(TRUE);
+
m_iconized = TRUE;
- break;
+ break;
}
if (!m_iconized)
{
// forward WM_SIZE to status bar control
-#if USE_NATIVE_STATUSBAR
+#if wxUSE_NATIVE_STATUSBAR
if (m_frameStatusBar && m_frameStatusBar->IsKindOf(CLASSINFO(wxStatusBar95)))
{
wxSizeEvent event(wxSize(x, y), m_frameStatusBar->GetId());
bool wxFrame::MSWOnClose(void)
{
-#if WXDEBUG > 1
- wxDebugMsg("wxFrameWnd::OnClose %d\n", handle);
-#endif
return Close();
}
bool wxFrame::MSWOnCommand(WXWORD id, WXWORD cmd, WXHWND control)
{
-#if WXDEBUG > 1
- wxDebugMsg("wxFrameWnd::OnCommand %d\n", handle);
-#endif
if (cmd == 0 || cmd == 1 ) // Can be either a menu command or an accelerator.
{
// In case it's e.g. a toolbar.
void wxFrame::OnSize(wxSizeEvent& event)
{
// if we're using constraints - do use them
- #if USE_CONSTRAINTS
+ #if wxUSE_CONSTRAINTS
if ( GetAutoLayout() ) {
Layout();
return;
if (!child->IsKindOf(CLASSINFO(wxFrame)) &&
!child->IsKindOf(CLASSINFO(wxDialog)))
{
-#if WXDEBUG > 1
- wxDebugMsg("wxFrame::OnActivate: about to set the child's focus.\n");
-#endif
child->SetFocus();
return;
}
{
this->Destroy();
}
+ else
+ event.Veto(TRUE);
}
bool wxFrame::OnClose(void)
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);
+}
+
wxToolBar* wxFrame::CreateToolBar(long style, wxWindowID id, const wxString& name)
{
wxCHECK_MSG( m_frameToolBar == NULL, FALSE,
void wxFrame::PositionToolBar(void)
{
- int cw, ch;
-
RECT rect;
::GetClientRect((HWND) GetHWND(), &rect);
}
}
}
+
+// propagate our state change to all child frames
+void wxFrame::IconizeChildFrames(bool bIconize)
+{
+ for ( wxNode *node = GetChildren()->First(); node; node = node->Next() ) {
+ wxWindow *win = (wxWindow *)node->Data();
+ if ( win->IsKindOf(CLASSINFO(wxFrame)) ) {
+ ((wxFrame *)win)->Iconize(bIconize);
+ }
+ }
+}
+