extern wxList wxModelessWindows;
extern wxList wxPendingDelete;
extern char wxFrameClassName[];
+extern wxMenu *wxCurrentPopupMenu;
#if !USE_SHARED_LIBRARY
BEGIN_EVENT_TABLE(wxFrame, wxWindow)
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)
{
menu_bar->m_menuBarFrame = this;
}
+#if 0
bool wxFrame::LoadAccelerators(const wxString& table)
{
m_acceleratorTable = (WXHANDLE)
return (m_acceleratorTable != (WXHANDLE) NULL);
}
+#endif
void wxFrame::Fit(void)
{
#endif
switch (id)
{
- case SIZEFULLSCREEN:
case SIZENORMAL:
+ // restore all child frames too
+ IconizeChildFrames(FALSE);
+
+ // fall through
+
+ case SIZEFULLSCREEN:
m_iconized = FALSE;
break;
+
case SIZEICONIC:
+ // iconize all child frames too
+ IconizeChildFrames(TRUE);
+
m_iconized = TRUE;
break;
}
if (win)
return win->MSWCommand(cmd, id);
+ if (wxCurrentPopupMenu)
+ {
+ wxMenu *popupMenu = wxCurrentPopupMenu;
+ wxCurrentPopupMenu = NULL;
+ if (popupMenu->MSWCommand(cmd, id))
+ return TRUE;
+ }
+
if (GetMenuBar() && GetMenuBar()->FindItemForId(id))
{
ProcessCommand(id);
bool wxFrame::MSWProcessMessage(WXMSG* pMsg)
{
- if (m_acceleratorTable != 0 &&
- ::TranslateAccelerator((HWND) GetHWND(), (HACCEL) m_acceleratorTable, (MSG *)pMsg))
+ return FALSE;
+}
+
+bool wxFrame::MSWTranslateMessage(WXMSG* pMsg)
+{
+ if (m_acceleratorTable.Ok() &&
+ ::TranslateAccelerator((HWND) GetHWND(), (HACCEL) m_acceleratorTable.GetHACCEL(), (MSG *)pMsg))
return TRUE;
return 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)
+{
+ wxWindow *child = NULL;
+ for ( wxNode *node = GetChildren()->First(); node; node = node->Next() ) {
+ wxWindow *win = (wxWindow *)node->Data();
+ if ( win->IsKindOf(CLASSINFO(wxFrame)) ) {
+ ((wxFrame *)win)->Iconize(bIconize);
+ }
+ }
+}
+