X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/8704bf74fba8523e2e174bd5a8195b5202009cd0..b91b22004d7095481b4fd8a15e21b44527604245:/src/motif/frame.cpp diff --git a/src/motif/frame.cpp b/src/motif/frame.cpp index c0a24a49ef..9a57776df7 100644 --- a/src/motif/frame.cpp +++ b/src/motif/frame.cpp @@ -50,11 +50,13 @@ #include "wx/motif/private.h" +extern wxHashTable *wxWidgetHashTable; + void wxCloseFrameCallback(Widget, XtPointer, XmAnyCallbackStruct *cbs); -void wxFrameFocusProc(Widget workArea, XtPointer clientData, +void wxFrameFocusProc(Widget workArea, XtPointer clientData, XmAnyCallbackStruct *cbs); -static void wxFrameMapProc(Widget frameShell, XtPointer clientData, - XCrossingEvent * event); +static void wxFrameMapProc(Widget frameShell, XtPointer clientData, + XCrossingEvent * event); extern wxList wxModelessWindows; extern wxList wxPendingDelete; @@ -65,12 +67,12 @@ static bool wxTopLevelUsed = FALSE; #if !USE_SHARED_LIBRARY BEGIN_EVENT_TABLE(wxFrame, wxWindow) - EVT_SIZE(wxFrame::OnSize) - EVT_ACTIVATE(wxFrame::OnActivate) - EVT_MENU_HIGHLIGHT_ALL(wxFrame::OnMenuHighlight) - EVT_SYS_COLOUR_CHANGED(wxFrame::OnSysColourChanged) - EVT_IDLE(wxFrame::OnIdle) - EVT_CLOSE(wxFrame::OnCloseWindow) +EVT_SIZE(wxFrame::OnSize) +EVT_ACTIVATE(wxFrame::OnActivate) +EVT_MENU_HIGHLIGHT_ALL(wxFrame::OnMenuHighlight) +EVT_SYS_COLOUR_CHANGED(wxFrame::OnSysColourChanged) +EVT_IDLE(wxFrame::OnIdle) +EVT_CLOSE(wxFrame::OnCloseWindow) END_EVENT_TABLE() IMPLEMENT_DYNAMIC_CLASS(wxFrame, wxWindow) @@ -84,11 +86,14 @@ bool wxFrame::m_useNativeStatusBar = FALSE; wxFrame::wxFrame() { +#if wxUSE_TOOLBAR m_frameToolBar = NULL ; +#endif // wxUSE_TOOLBAR + m_frameMenuBar = NULL; m_frameStatusBar = NULL; - m_windowParent = NULL; + m_parent = NULL; m_iconized = FALSE; //// Motif-specific @@ -101,451 +106,487 @@ wxFrame::wxFrame() } bool wxFrame::Create(wxWindow *parent, - wxWindowID id, - const wxString& title, - const wxPoint& pos, - const wxSize& size, - long style, - const wxString& name) + wxWindowID id, + const wxString& title, + const wxPoint& pos, + const wxSize& size, + long style, + const wxString& name) { - if (!parent) - wxTopLevelWindows.Append(this); - - SetName(name); - - m_windowStyle = style; - m_frameMenuBar = NULL; - m_frameToolBar = NULL ; - m_frameStatusBar = NULL; - - //// Motif-specific - m_frameShell = (WXWidget) NULL; - m_frameWidget = (WXWidget) NULL;; - m_workArea = (WXWidget) NULL;; - m_clientArea = (WXWidget) NULL;; - m_visibleStatus = TRUE; - m_title = ""; - - SetBackgroundColour(wxSystemSettings::GetSystemColour(wxSYS_COLOUR_APPWORKSPACE)); - - if ( id > -1 ) - m_windowId = id; - else - m_windowId = (int)NewControlId(); - - if (parent) parent->AddChild(this); - - wxModelessWindows.Append(this); - - int x = pos.x; int y = pos.y; - int width = size.x; int height = size.y; - - if (wxTopLevelUsed) - // Change suggested by Matthew Flatt - m_frameShell = (WXWidget) XtAppCreateShell(name, wxTheApp->GetClassName(), topLevelShellWidgetClass, (Display*) wxGetDisplay(), NULL, 0); - else - { - m_frameShell = wxTheApp->GetTopLevelWidget(); - wxTopLevelUsed = TRUE; - } - - XtVaSetValues((Widget) m_frameShell, - // Allows menu to resize - XmNallowShellResize, True, - XmNdeleteResponse, XmDO_NOTHING, - XmNmappedWhenManaged, False, - XmNiconic, (style & wxICONIZE) ? TRUE : FALSE, - NULL); - - if (!title.IsNull()) - XtVaSetValues((Widget) m_frameShell, - XmNtitle, (const char*) title, - NULL); + if (!parent) + wxTopLevelWindows.Append(this); - m_frameWidget = (WXWidget) XtVaCreateManagedWidget("main_window", - xmMainWindowWidgetClass, (Widget) m_frameShell, - XmNresizePolicy, XmRESIZE_NONE, - NULL); + SetName(name); - m_workArea = (WXWidget) XtVaCreateWidget("form", - xmFormWidgetClass, (Widget) m_frameWidget, - XmNresizePolicy, XmRESIZE_NONE, - NULL); - - m_clientArea = (WXWidget) XtVaCreateWidget("client", - xmBulletinBoardWidgetClass, (Widget) m_workArea, - XmNmarginWidth, 0, - XmNmarginHeight, 0, - XmNrightAttachment, XmATTACH_FORM, - XmNleftAttachment, XmATTACH_FORM, - XmNtopAttachment, XmATTACH_FORM, - XmNbottomAttachment, XmATTACH_FORM, -// XmNresizePolicy, XmRESIZE_ANY, - NULL); - - XtVaSetValues((Widget) m_frameWidget, - XmNworkWindow, (Widget) m_workArea, - NULL); - - - XtManageChild((Widget) m_clientArea); - XtManageChild((Widget) m_workArea); - - wxASSERT_MSG ((wxWidgetHashTable->Get((long)m_workArea) == (wxObject*) NULL), "Widget table clash in frame.cpp") ; - - wxAddWindowToTable((Widget) m_workArea, this); + m_windowStyle = style; + m_frameMenuBar = NULL; +#if wxUSE_TOOLBAR + m_frameToolBar = NULL ; +#endif // wxUSE_TOOLBAR + m_frameStatusBar = NULL; - XtTranslations ptr ; + //// Motif-specific + m_frameShell = (WXWidget) NULL; + m_frameWidget = (WXWidget) NULL;; + m_workArea = (WXWidget) NULL;; + m_clientArea = (WXWidget) NULL;; + m_visibleStatus = TRUE; + m_title = ""; - XtOverrideTranslations((Widget) m_workArea, - ptr = XtParseTranslationTable(": resize()")); + m_backgroundColour = wxSystemSettings::GetSystemColour(wxSYS_COLOUR_APPWORKSPACE); + m_foregroundColour = *wxBLACK; + m_font = wxSystemSettings::GetSystemFont(wxSYS_DEFAULT_GUI_FONT); - XtFree((char *)ptr); + if ( id > -1 ) + m_windowId = id; + else + m_windowId = (int)NewControlId(); - XtAddCallback((Widget) m_workArea, XmNfocusCallback, - (XtCallbackProc)wxFrameFocusProc, (XtPointer)this); + if (parent) parent->AddChild(this); - /* Part of show-&-hide fix */ - XtAddEventHandler((Widget) m_frameShell, StructureNotifyMask, - False, (XtEventHandler)wxFrameMapProc, - (XtPointer)m_workArea); + wxModelessWindows.Append(this); - if (x > -1) - XtVaSetValues((Widget) m_frameShell, XmNx, x, NULL); - if (y > -1) - XtVaSetValues((Widget) m_frameShell, XmNy, y, NULL); - if (width > -1) - XtVaSetValues((Widget) m_frameShell, XmNwidth, width, NULL); - if (height > -1) - XtVaSetValues((Widget) m_frameShell, XmNheight, height, NULL); + int x = pos.x; int y = pos.y; + int width = size.x; int height = size.y; - m_mainWidget = m_frameWidget; + if (wxTopLevelUsed) + // Change suggested by Matthew Flatt + m_frameShell = (WXWidget) XtAppCreateShell(name, wxTheApp->GetClassName(), topLevelShellWidgetClass, (Display*) wxGetDisplay(), NULL, 0); + else + { + m_frameShell = wxTheApp->GetTopLevelWidget(); + wxTopLevelUsed = TRUE; + } - // This patch comes from Torsten Liermann lier@lier1.muc.de - if (XmIsMotifWMRunning( (Widget) m_frameShell )) - { - int decor = 0 ; - if (style & wxRESIZE_BORDER) - decor |= MWM_DECOR_RESIZEH ; - if (style & wxSYSTEM_MENU) - decor |= MWM_DECOR_MENU; - if ((style & wxCAPTION) || - (style & wxTINY_CAPTION_HORIZ) || - (style & wxTINY_CAPTION_VERT)) - decor |= MWM_DECOR_TITLE; - if (style & wxTHICK_FRAME) - decor |= MWM_DECOR_BORDER; - if (style & wxTHICK_FRAME) - decor |= MWM_DECOR_BORDER; - if (style & wxMINIMIZE_BOX) - decor |= MWM_DECOR_MINIMIZE; - if (style & wxMAXIMIZE_BOX) - decor |= MWM_DECOR_MAXIMIZE; - XtVaSetValues((Widget) m_frameShell,XmNmwmDecorations,decor,NULL) ; - } - // This allows non-Motif window managers to support at least the - // no-decorations case. - else - { - if (style == 0) - XtVaSetValues((Widget) m_frameShell,XmNoverrideRedirect,TRUE,NULL); - } - XtRealizeWidget((Widget) m_frameShell); + XtVaSetValues((Widget) m_frameShell, + // Allows menu to resize + XmNallowShellResize, True, + XmNdeleteResponse, XmDO_NOTHING, + XmNmappedWhenManaged, False, + XmNiconic, (style & wxICONIZE) ? TRUE : FALSE, + NULL); + + if (!title.IsNull()) + XtVaSetValues((Widget) m_frameShell, + XmNtitle, (const char*) title, + NULL); + + m_frameWidget = (WXWidget) XtVaCreateManagedWidget("main_window", + xmMainWindowWidgetClass, (Widget) m_frameShell, + XmNresizePolicy, XmRESIZE_NONE, + NULL); + + m_workArea = (WXWidget) XtVaCreateWidget("form", + xmFormWidgetClass, (Widget) m_frameWidget, + XmNresizePolicy, XmRESIZE_NONE, + NULL); + + m_clientArea = (WXWidget) XtVaCreateWidget("client", + xmBulletinBoardWidgetClass, (Widget) m_workArea, + XmNmarginWidth, 0, + XmNmarginHeight, 0, + XmNrightAttachment, XmATTACH_FORM, + XmNleftAttachment, XmATTACH_FORM, + XmNtopAttachment, XmATTACH_FORM, + XmNbottomAttachment, XmATTACH_FORM, + // XmNresizePolicy, XmRESIZE_ANY, + NULL); + + XtAddEventHandler((Widget) m_clientArea, ExposureMask,FALSE, + wxUniversalRepaintProc, (XtPointer) this); + + XtVaSetValues((Widget) m_frameWidget, + XmNworkWindow, (Widget) m_workArea, + NULL); + + XtManageChild((Widget) m_clientArea); + XtManageChild((Widget) m_workArea); + + wxASSERT_MSG( !wxGetWindowFromTable((Widget)m_workArea), + "Widget table clash in frame.cpp") ; + + wxAddWindowToTable((Widget) m_workArea, this); + + XtTranslations ptr ; + + XtOverrideTranslations((Widget) m_workArea, + ptr = XtParseTranslationTable(": resize()")); + + XtFree((char *)ptr); + + XtAddCallback((Widget) m_workArea, XmNfocusCallback, + (XtCallbackProc)wxFrameFocusProc, (XtPointer)this); + + /* Part of show-&-hide fix */ + XtAddEventHandler((Widget) m_frameShell, StructureNotifyMask, + False, (XtEventHandler)wxFrameMapProc, + (XtPointer)m_workArea); + + if (x > -1) + XtVaSetValues((Widget) m_frameShell, XmNx, x, NULL); + if (y > -1) + XtVaSetValues((Widget) m_frameShell, XmNy, y, NULL); + if (width > -1) + XtVaSetValues((Widget) m_frameShell, XmNwidth, width, NULL); + if (height > -1) + XtVaSetValues((Widget) m_frameShell, XmNheight, height, NULL); + + m_mainWidget = m_frameWidget; + + ChangeFont(FALSE); + + // This patch comes from Torsten Liermann lier@lier1.muc.de + if (XmIsMotifWMRunning( (Widget) m_frameShell )) + { + int decor = 0 ; + if (style & wxRESIZE_BORDER) + decor |= MWM_DECOR_RESIZEH ; + if (style & wxSYSTEM_MENU) + decor |= MWM_DECOR_MENU; + if ((style & wxCAPTION) || + (style & wxTINY_CAPTION_HORIZ) || + (style & wxTINY_CAPTION_VERT)) + decor |= MWM_DECOR_TITLE; + if (style & wxTHICK_FRAME) + decor |= MWM_DECOR_BORDER; + if (style & wxTHICK_FRAME) + decor |= MWM_DECOR_BORDER; + if (style & wxMINIMIZE_BOX) + decor |= MWM_DECOR_MINIMIZE; + if (style & wxMAXIMIZE_BOX) + decor |= MWM_DECOR_MAXIMIZE; + XtVaSetValues((Widget) m_frameShell,XmNmwmDecorations,decor,NULL) ; + } + // This allows non-Motif window managers to support at least the + // no-decorations case. + else + { + if (style == 0) + XtVaSetValues((Widget) m_frameShell,XmNoverrideRedirect,TRUE,NULL); + } + XtRealizeWidget((Widget) m_frameShell); - // Intercept CLOSE messages from the window manager - Atom WM_DELETE_WINDOW = XmInternAtom(XtDisplay((Widget) m_frameShell), "WM_DELETE_WINDOW", False); + // Intercept CLOSE messages from the window manager + Atom WM_DELETE_WINDOW = XmInternAtom(XtDisplay((Widget) m_frameShell), "WM_DELETE_WINDOW", False); #if (XmREVISION > 1 || XmVERSION > 1) - XmAddWMProtocolCallback((Widget) m_frameShell, WM_DELETE_WINDOW, (XtCallbackProc) wxCloseFrameCallback, (XtPointer)this); + XmAddWMProtocolCallback((Widget) m_frameShell, WM_DELETE_WINDOW, (XtCallbackProc) wxCloseFrameCallback, (XtPointer)this); #else #if XmREVISION == 1 - XmAddWMProtocolCallback((Widget) m_frameShell, WM_DELETE_WINDOW, (XtCallbackProc) wxCloseFrameCallback, (caddr_t)this); + XmAddWMProtocolCallback((Widget) m_frameShell, WM_DELETE_WINDOW, (XtCallbackProc) wxCloseFrameCallback, (caddr_t)this); #else - XmAddWMProtocolCallback((Widget) m_frameShell, WM_DELETE_WINDOW, (void (*)())wxCloseFrameCallback, (caddr_t)this); + XmAddWMProtocolCallback((Widget) m_frameShell, WM_DELETE_WINDOW, (void (*)())wxCloseFrameCallback, (caddr_t)this); #endif #endif - PreResize(); + ChangeBackgroundColour(); - wxSizeEvent sizeEvent(wxSize(width, height), GetId()); - sizeEvent.SetEventObject(this); + PreResize(); - GetEventHandler()->ProcessEvent(sizeEvent); + wxSizeEvent sizeEvent(wxSize(width, height), GetId()); + sizeEvent.SetEventObject(this); - return TRUE; + GetEventHandler()->ProcessEvent(sizeEvent); + + return TRUE; } wxFrame::~wxFrame() { - if (GetMainWidget()) - Show(FALSE); + if (m_clientArea) + XtRemoveEventHandler((Widget) m_clientArea, ExposureMask, FALSE, + wxUniversalRepaintProc, (XtPointer) this); - if (m_frameMenuBar) - { -// Hack to stop core dump on Ultrix, OSF, for some strange reason. + if (GetMainWidget()) + Show(FALSE); + + if (m_frameMenuBar) + { + m_frameMenuBar->DestroyMenuBar(); + + // Hack to stop core dump on Ultrix, OSF, for some strange reason. #if MOTIF_MENUBAR_DELETE_FIX - GetMenuBar()->SetMainWidget((WXWidget) NULL); + GetMenuBar()->SetMainWidget((WXWidget) NULL); #endif - delete m_frameMenuBar; - m_frameMenuBar = NULL; - } + delete m_frameMenuBar; + m_frameMenuBar = NULL; + } - wxTopLevelWindows.DeleteObject(this); - wxModelessWindows.DeleteObject(this); + wxTopLevelWindows.DeleteObject(this); + wxModelessWindows.DeleteObject(this); - if (m_frameStatusBar) - delete m_frameStatusBar; + if (m_frameStatusBar) + delete m_frameStatusBar; - DestroyChildren(); + DestroyChildren(); -/* - int i; - for (i = 0; i < wxMAX_STATUS; i++) + /* + int i; + for (i = 0; i < wxMAX_STATUS; i++) if (statusTextWidget[i]) - XtDestroyWidget (statusTextWidget[i]); - - if (statusLineForm) - XtDestroyWidget (statusLineForm); + XtDestroyWidget (statusTextWidget[i]); - if (statusLineWidget) - XtDestroyWidget (statusLineWidget); - */ + if (statusLineForm) + XtDestroyWidget (statusLineForm); - if (m_workArea) - { - wxDeleteWindowFromTable((Widget) m_workArea); + if (statusLineWidget) + XtDestroyWidget (statusLineWidget); + */ - XtDestroyWidget ((Widget) m_workArea); - } + if (m_workArea) + { + wxDeleteWindowFromTable((Widget) m_workArea); - if (m_frameWidget) - { - wxDeleteWindowFromTable((Widget) m_frameWidget); - XtDestroyWidget ((Widget) m_frameWidget); - } + XtDestroyWidget ((Widget) m_workArea); + } - if (m_frameShell) - XtDestroyWidget ((Widget) m_frameShell); + if (m_frameWidget) + { + wxDeleteWindowFromTable((Widget) m_frameWidget); + XtDestroyWidget ((Widget) m_frameWidget); + } - SetMainWidget((WXWidget) NULL); + if (m_frameShell) + XtDestroyWidget ((Widget) m_frameShell); -/* Check if it's the last top-level window */ + SetMainWidget((WXWidget) NULL); - if (wxTheApp && (wxTopLevelWindows.Number() == 0)) - { - wxTheApp->SetTopWindow(NULL); + /* Check if it's the last top-level window */ - if (wxTheApp->GetExitOnFrameDelete()) + if (wxTheApp && (wxTopLevelWindows.Number() == 0)) { - // Signal to the app that we're going to close - wxTheApp->ExitMainLoop(); + wxTheApp->SetTopWindow(NULL); + + if (wxTheApp->GetExitOnFrameDelete()) + { + // Signal to the app that we're going to close + wxTheApp->ExitMainLoop(); + } } - } } // Get size *available for subwindows* i.e. excluding menu bar, toolbar etc. void wxFrame::GetClientSize(int *x, int *y) const { - Dimension xx, yy; - XtVaGetValues((Widget) m_workArea, XmNwidth, &xx, XmNheight, &yy, NULL); + Dimension xx, yy; + XtVaGetValues((Widget) m_workArea, XmNwidth, &xx, XmNheight, &yy, NULL); - if (m_frameStatusBar) - { - int sbw, sbh; - m_frameStatusBar->GetSize(& sbw, & sbh); - yy -= sbh; - } - if (m_frameToolBar) - { - int tbw, tbh; - m_frameToolBar->GetSize(& tbw, & tbh); - if (m_frameToolBar->GetWindowStyleFlag() & wxTB_VERTICAL) - xx -= tbw; - else - yy -= tbh; - } -/* - if (GetMenuBar() != (wxMenuBar*) NULL) - { + if (m_frameStatusBar) + { + int sbw, sbh; + m_frameStatusBar->GetSize(& sbw, & sbh); + yy -= sbh; + } +#if wxUSE_TOOLBAR + if (m_frameToolBar) + { + int tbw, tbh; + m_frameToolBar->GetSize(& tbw, & tbh); + if (m_frameToolBar->GetWindowStyleFlag() & wxTB_VERTICAL) + xx -= tbw; + else + yy -= tbh; + } +#endif // wxUSE_TOOLBAR + /* + if (GetMenuBar() != (wxMenuBar*) NULL) + { // it seems that if a frame holds a panel, the menu bar size // gets automatically taken care of --- grano@cs.helsinki.fi 4.4.95 bool hasSubPanel = FALSE; - for(wxNode* node = GetChildren()->First(); node; node = node->Next()) + for(wxNode* node = GetChildren().First(); node; node = node->Next()) { - wxWindow *win = (wxWindow *)node->Data(); - hasSubPanel = (win->IsKindOf(CLASSINFO(wxPanel)) && !win->IsKindOf(CLASSINFO(wxDialog))); + wxWindow *win = (wxWindow *)node->Data(); + hasSubPanel = (win->IsKindOf(CLASSINFO(wxPanel)) && !win->IsKindOf(CLASSINFO(wxDialog))); if (hasSubPanel) - break; - } - if (! hasSubPanel) { + break; + } + if (! hasSubPanel) { Dimension ys; XtVaGetValues((Widget) GetMenuBarWidget(), XmNheight, &ys, NULL); yy -= ys; - } - } - */ + } + } + */ - *x = xx; *y = yy; + *x = xx; *y = yy; } // Set the client size (i.e. leave the calculation of borders etc. // to wxWindows) -void wxFrame::SetClientSize(int width, int height) +void wxFrame::DoSetClientSize(int width, int height) { - // Calculate how large the new main window should be - // by finding the difference between the client area and the - // main window area, and adding on to the new client area - if (width > -1) - XtVaSetValues((Widget) m_workArea, XmNwidth, width, NULL); + // Calculate how large the new main window should be + // by finding the difference between the client area and the + // main window area, and adding on to the new client area + if (width > -1) + XtVaSetValues((Widget) m_workArea, XmNwidth, width, NULL); - if (height > -1) - { - if (m_frameStatusBar) - { - int sbw, sbh; - m_frameStatusBar->GetSize(& sbw, & sbh); - height += sbh; - } - if (m_frameToolBar) + if (height > -1) { - int tbw, tbh; - m_frameToolBar->GetSize(& tbw, & tbh); - if (m_frameToolBar->GetWindowStyleFlag() & wxTB_VERTICAL) - width += tbw; - else - height += tbh; - } + if (m_frameStatusBar) + { + int sbw, sbh; + m_frameStatusBar->GetSize(& sbw, & sbh); + height += sbh; + } +#if wxUSE_TOOLBAR + if (m_frameToolBar) + { + int tbw, tbh; + m_frameToolBar->GetSize(& tbw, & tbh); + if (m_frameToolBar->GetWindowStyleFlag() & wxTB_VERTICAL) + width += tbw; + else + height += tbh; + } +#endif // wxUSE_TOOLBAR - XtVaSetValues((Widget) m_workArea, XmNheight, height, NULL); - } - PreResize(); + XtVaSetValues((Widget) m_workArea, XmNheight, height, NULL); + } + PreResize(); - wxSizeEvent sizeEvent(wxSize(width, height), GetId()); - sizeEvent.SetEventObject(this); + wxSizeEvent sizeEvent(wxSize(width, height), GetId()); + sizeEvent.SetEventObject(this); - GetEventHandler()->ProcessEvent(sizeEvent); + GetEventHandler()->ProcessEvent(sizeEvent); } void wxFrame::GetSize(int *width, int *height) const { - Dimension xx, yy; - XtVaGetValues((Widget) m_frameShell, XmNwidth, &xx, XmNheight, &yy, NULL); - *width = xx; *height = yy; + Dimension xx, yy; + XtVaGetValues((Widget) m_frameShell, XmNwidth, &xx, XmNheight, &yy, NULL); + *width = xx; *height = yy; } void wxFrame::GetPosition(int *x, int *y) const { Window parent_window = XtWindow((Widget) m_frameShell), - next_parent = XtWindow((Widget) m_frameShell), - root = RootWindowOfScreen(XtScreen((Widget) m_frameShell)); + next_parent = XtWindow((Widget) m_frameShell), + root = RootWindowOfScreen(XtScreen((Widget) m_frameShell)); // search for the parent that is child of ROOT, because the WM may // reparent twice and notify only the next parent (like FVWM) while (next_parent != root) { - Window *theChildren; unsigned int n; - parent_window = next_parent; - XQueryTree(XtDisplay((Widget) m_frameShell), parent_window, &root, - &next_parent, &theChildren, &n); - XFree(theChildren); // not needed + Window *theChildren; unsigned int n; + parent_window = next_parent; + XQueryTree(XtDisplay((Widget) m_frameShell), parent_window, &root, + &next_parent, &theChildren, &n); + XFree(theChildren); // not needed } int xx, yy; unsigned int dummy; XGetGeometry(XtDisplay((Widget) m_frameShell), parent_window, &root, - &xx, &yy, &dummy, &dummy, &dummy, &dummy); + &xx, &yy, &dummy, &dummy, &dummy, &dummy); if (x) *x = xx; if (y) *y = yy; } -void wxFrame::SetSize(int x, int y, int width, int height, int sizeFlags) +void wxFrame::DoSetSize(int x, int y, int width, int height, int sizeFlags) { - if (x > -1) - XtVaSetValues((Widget) m_frameShell, XmNx, x, NULL); - if (y > -1) - XtVaSetValues((Widget) m_frameShell, XmNy, y, NULL); - if (width > -1) - XtVaSetValues((Widget) m_frameWidget, XmNwidth, width, NULL); - if (height > -1) - XtVaSetValues((Widget) m_frameWidget, XmNheight, height, NULL); - - if (!(height == -1 && width == -1)) - { - PreResize(); - wxSizeEvent sizeEvent(wxSize(width, height), GetId()); - sizeEvent.SetEventObject(this); + if (x > -1) + XtVaSetValues((Widget) m_frameShell, XmNx, x, NULL); + if (y > -1) + XtVaSetValues((Widget) m_frameShell, XmNy, y, NULL); + if (width > -1) + XtVaSetValues((Widget) m_frameWidget, XmNwidth, width, NULL); + if (height > -1) + XtVaSetValues((Widget) m_frameWidget, XmNheight, height, NULL); + + if (!(height == -1 && width == -1)) + { + PreResize(); - GetEventHandler()->ProcessEvent(sizeEvent); - } + wxSizeEvent sizeEvent(wxSize(width, height), GetId()); + sizeEvent.SetEventObject(this); + + GetEventHandler()->ProcessEvent(sizeEvent); + } } bool wxFrame::Show(bool show) { - m_visibleStatus = show; /* show-&-hide fix */ - - m_isShown = show; - if (show) { - XtMapWidget((Widget) m_frameShell); - XRaiseWindow(XtDisplay((Widget) m_frameShell), XtWindow((Widget) m_frameShell)); - } else { - XtUnmapWidget((Widget) m_frameShell); -// XmUpdateDisplay(wxTheApp->topLevel); // Experimental: may be responsible for crashes - } - return TRUE; + if (!m_frameShell) + return wxWindow::Show(show); + + m_visibleStatus = show; /* show-&-hide fix */ + + m_isShown = show; + if (show) { + XtMapWidget((Widget) m_frameShell); + XRaiseWindow(XtDisplay((Widget) m_frameShell), XtWindow((Widget) m_frameShell)); + } else { + XtUnmapWidget((Widget) m_frameShell); + // XmUpdateDisplay(wxTheApp->topLevel); // Experimental: may be responsible for crashes + } + return TRUE; } void wxFrame::Iconize(bool iconize) { - if (!iconize) - Show(TRUE); + if (!iconize) + Show(TRUE); - XtVaSetValues((Widget) m_frameShell, XmNiconic, (Boolean)iconize, NULL); + if (m_frameShell) + XtVaSetValues((Widget) m_frameShell, XmNiconic, (Boolean)iconize, NULL); } // Equivalent to maximize/restore in Windows void wxFrame::Maximize(bool maximize) { - Show(TRUE); + Show(TRUE); - if (maximize) - XtVaSetValues((Widget) m_frameShell, XmNiconic, FALSE, NULL); + if (maximize && m_frameShell) + XtVaSetValues((Widget) m_frameShell, XmNiconic, FALSE, NULL); } bool wxFrame::IsIconized() const { - Boolean iconic; - XtVaGetValues((Widget) m_frameShell, XmNiconic, &iconic, NULL); - return iconic; + if (!m_frameShell) + return FALSE; + + Boolean iconic; + XtVaGetValues((Widget) m_frameShell, XmNiconic, &iconic, NULL); + return iconic; +} + +// Is it maximized? +bool wxFrame::IsMaximized(void) const +{ + // No maximizing in Motif (?) + return FALSE; } void wxFrame::SetTitle(const wxString& title) { - if (title == m_title) - return; - - m_title = title; - - if (!title.IsNull()) - XtVaSetValues((Widget) m_frameShell, - XmNtitle, (const char*) title, - XmNiconName, (const char*) title, - NULL); + if (title == m_title) + return; + + m_title = title; + + if (!title.IsNull()) + XtVaSetValues((Widget) m_frameShell, + XmNtitle, (const char*) title, + XmNiconName, (const char*) title, + NULL); } void wxFrame::SetIcon(const wxIcon& icon) { - m_icon = icon; + m_icon = icon; - // TODO - /* - if (!icon.Ok() || !icon.GetPixmap()) - return; + if (!m_frameShell) + return; - XtVaSetValues((Widget) m_frameShell, XtNiconPixmap, icon->.GetPixmap(), NULL); - */ + if (!icon.Ok() || !icon.GetPixmap()) + return; + + XtVaSetValues((Widget) m_frameShell, XtNiconPixmap, icon.GetPixmap(), NULL); } wxStatusBar *wxFrame::OnCreateStatusBar(int number, long style, wxWindowID id, - const wxString& name) + const wxString& name) { wxStatusBar *statusBar = NULL; @@ -554,7 +595,7 @@ wxStatusBar *wxFrame::OnCreateStatusBar(int number, long style, wxWindowID id, // Set the height according to the font and the border size wxClientDC dc(statusBar); - dc.SetFont(* statusBar->GetFont()); + dc.SetFont(statusBar->GetFont()); long x, y; dc.GetTextExtent("X", &x, &y); @@ -568,42 +609,42 @@ wxStatusBar *wxFrame::OnCreateStatusBar(int number, long style, wxWindowID id, } wxStatusBar* wxFrame::CreateStatusBar(int number, long style, wxWindowID id, - const wxString& name) + const wxString& name) { - // Calling CreateStatusBar twice is an error. - wxCHECK_MSG( m_frameStatusBar == NULL, FALSE, - "recreating status bar in wxFrame" ); + // Calling CreateStatusBar twice is an error. + wxCHECK_MSG( m_frameStatusBar == NULL, FALSE, + "recreating status bar in wxFrame" ); - m_frameStatusBar = OnCreateStatusBar(number, style, id, - name); - if ( m_frameStatusBar ) - { - PositionStatusBar(); - return m_frameStatusBar; - } - else - return NULL; + m_frameStatusBar = OnCreateStatusBar(number, style, id, + name); + if ( m_frameStatusBar ) + { + PositionStatusBar(); + return m_frameStatusBar; + } + else + return NULL; } void wxFrame::SetStatusText(const wxString& text, int number) { - wxCHECK_RET( m_frameStatusBar != NULL, "no statusbar to set text for" ); + wxCHECK_RET( m_frameStatusBar != NULL, "no statusbar to set text for" ); - m_frameStatusBar->SetStatusText(text, number); + m_frameStatusBar->SetStatusText(text, number); } void wxFrame::SetStatusWidths(int n, const int widths_field[]) { - wxCHECK_RET( m_frameStatusBar != NULL, "no statusbar to set widths for" ); + wxCHECK_RET( m_frameStatusBar != NULL, "no statusbar to set widths for" ); - m_frameStatusBar->SetStatusWidths(n, widths_field); - PositionStatusBar(); + m_frameStatusBar->SetStatusWidths(n, widths_field); + PositionStatusBar(); } void wxFrame::PositionStatusBar() { if (!m_frameStatusBar) - return; + return; int w, h; GetClientSize(&w, &h); @@ -617,10 +658,10 @@ void wxFrame::PositionStatusBar() WXWidget wxFrame::GetMenuBarWidget() const { - if (GetMenuBar()) - return GetMenuBar()->GetMainWidget(); - else - return (WXWidget) NULL; + if (GetMenuBar()) + return GetMenuBar()->GetMainWidget(); + else + return (WXWidget) NULL; } void wxFrame::SetMenuBar(wxMenuBar *menuBar) @@ -632,61 +673,45 @@ void wxFrame::SetMenuBar(wxMenuBar *menuBar) } // Currently can't set it twice - wxASSERT_MSG( (m_frameMenuBar == (wxMenuBar*) NULL), "Cannot set the menubar more than once"); - - m_frameMenuBar = menuBar; - - Widget menuBarW = XmCreateMenuBar ((Widget) m_frameWidget, "MenuBar", NULL, 0); - m_frameMenuBar->SetMainWidget( (WXWidget) menuBarW); + // wxASSERT_MSG( (m_frameMenuBar == (wxMenuBar*) NULL), "Cannot set the menubar more than once"); - int i; - for (i = 0; i < menuBar->GetMenuCount(); i++) + if (m_frameMenuBar) { - wxMenu *menu = menuBar->GetMenu(i); - wxString title(menuBar->m_titles[i]); - menu->SetButtonWidget(menu->CreateMenu (menuBar, menuBarW, menu, title, TRUE)); - - /* - * COMMENT THIS OUT IF YOU DON'T LIKE A RIGHT-JUSTIFIED HELP MENU - */ - wxStripMenuCodes ((char*) (const char*) title, wxBuffer); - - if (strcmp (wxBuffer, "Help") == 0) - XtVaSetValues ((Widget) menuBarW, XmNmenuHelpWidget, (Widget) menu->GetButtonWidget(), NULL); + m_frameMenuBar->DestroyMenuBar(); + delete m_frameMenuBar; } - XtRealizeWidget ((Widget) menuBarW); - XtManageChild ((Widget) menuBarW); - menuBar->SetMenuBarFrame(this); + m_frameMenuBar = menuBar; + m_frameMenuBar->CreateMenuBar(this); } void wxFrame::Fit() { - // Work out max. size - wxNode *node = GetChildren()->First(); - int max_width = 0; - int max_height = 0; - while (node) - { - // Find a child that's a subwindow, but not a dialog box. - wxWindow *win = (wxWindow *)node->Data(); - - if (!win->IsKindOf(CLASSINFO(wxFrame)) && - !win->IsKindOf(CLASSINFO(wxDialog))) + // Work out max. size + wxNode *node = GetChildren().First(); + int max_width = 0; + int max_height = 0; + while (node) { - int width, height; - int x, y; - win->GetSize(&width, &height); - win->GetPosition(&x, &y); - - if ((x + width) > max_width) - max_width = x + width; - if ((y + height) > max_height) - max_height = y + height; + // Find a child that's a subwindow, but not a dialog box. + wxWindow *win = (wxWindow *)node->Data(); + + if (!win->IsKindOf(CLASSINFO(wxFrame)) && + !win->IsKindOf(CLASSINFO(wxDialog))) + { + int width, height; + int x, y; + win->GetSize(&width, &height); + win->GetPosition(&x, &y); + + if ((x + width) > max_width) + max_width = x + width; + if ((y + height) > max_height) + max_height = y + height; + } + node = node->Next(); } - node = node->Next(); - } - SetClientSize(max_width, max_height); + SetClientSize(max_width, max_height); } // Responds to colour changes, and passes event on to children. @@ -710,137 +735,128 @@ void wxFrame::OnSysColourChanged(wxSysColourChangedEvent& event) // resize to client rectangle size void wxFrame::OnSize(wxSizeEvent& event) { - // if we're using constraints - do use them - #if wxUSE_CONSTRAINTS + // if we're using constraints - do use them +#if wxUSE_CONSTRAINTS if ( GetAutoLayout() ) { - Layout(); - return; + Layout(); + return; } - #endif +#endif - // do we have _exactly_ one child? - wxWindow *child = NULL; - for ( wxNode *node = GetChildren()->First(); node; node = node->Next() ) - { - wxWindow *win = (wxWindow *)node->Data(); - if ( !win->IsKindOf(CLASSINFO(wxFrame)) && - !win->IsKindOf(CLASSINFO(wxDialog)) && - (win != GetStatusBar()) && - (win != GetToolBar()) ) + // do we have _exactly_ one child? + wxWindow *child = NULL; + for ( wxNode *node = GetChildren().First(); node; node = node->Next() ) { - if ( child ) - return; // it's our second subwindow - nothing to do - child = win; + wxWindow *win = (wxWindow *)node->Data(); + if ( !win->IsKindOf(CLASSINFO(wxFrame)) && + !win->IsKindOf(CLASSINFO(wxDialog)) && + (win != GetStatusBar()) +#if wxUSE_TOOLBAR + && (win != GetToolBar()) +#endif // wxUSE_TOOLBAR + ) + { + if ( child ) + return; // it's our second subwindow - nothing to do + child = win; + } } - } - if ( child ) { - // we have exactly one child - set it's size to fill the whole frame - int clientW, clientH; - GetClientSize(&clientW, &clientH); + if ( child ) { + // we have exactly one child - set it's size to fill the whole frame + int clientW, clientH; + GetClientSize(&clientW, &clientH); - int x = 0; - int y = 0; + int x = 0; + int y = 0; - child->SetSize(x, y, clientW, clientH); - } + child->SetSize(x, y, clientW, clientH); + } } // Default activation behaviour - set the focus for the first child // subwindow found. void wxFrame::OnActivate(wxActivateEvent& event) { - for(wxNode *node = GetChildren()->First(); node; node = node->Next()) - { - // Find a child that's a subwindow, but not a dialog box. - wxWindow *child = (wxWindow *)node->Data(); - if (!child->IsKindOf(CLASSINFO(wxFrame)) && - !child->IsKindOf(CLASSINFO(wxDialog))) + for(wxNode *node = GetChildren().First(); node; node = node->Next()) { -#if WXDEBUG > 1 - wxDebugMsg("wxFrame::OnActivate: about to set the child's focus.\n"); -#endif - child->SetFocus(); - return; + // Find a child that's a subwindow, but not a dialog box. + wxWindow *child = (wxWindow *)node->Data(); + if (!child->IsKindOf(CLASSINFO(wxFrame)) && + !child->IsKindOf(CLASSINFO(wxDialog))) + { + child->SetFocus(); + return; + } } - } } -// The default implementation for the close window event - calls +// The default implementation for the close window event. // OnClose for backward compatibility. void wxFrame::OnCloseWindow(wxCloseEvent& event) { - // Compatibility - if ( GetEventHandler()->OnClose() || event.GetForce()) - { - this->Destroy(); - } -} - -bool wxFrame::OnClose() -{ - return TRUE; + this->Destroy(); } // Destroy the window (delayed, if a managed window) bool wxFrame::Destroy() { - if (!wxPendingDelete.Member(this)) - wxPendingDelete.Append(this); - return TRUE; + if (!wxPendingDelete.Member(this)) + wxPendingDelete.Append(this); + return TRUE; } // Default menu selection behaviour - display a help string void wxFrame::OnMenuHighlight(wxMenuEvent& event) { - if (GetStatusBar()) - { - if (event.GetMenuId() == -1) - SetStatusText(""); - else + if (GetStatusBar()) { - wxMenuBar *menuBar = GetMenuBar(); - if (menuBar) - { - wxString helpString(menuBar->GetHelpString(event.GetMenuId())); - if (helpString != "") - SetStatusText(helpString); - } + if (event.GetMenuId() == -1) + SetStatusText(""); + else + { + wxMenuBar *menuBar = GetMenuBar(); + if (menuBar) + { + wxString helpString(menuBar->GetHelpString(event.GetMenuId())); + if (helpString != "") + SetStatusText(helpString); + } + } } - } } wxMenuBar *wxFrame::GetMenuBar() const { - return m_frameMenuBar; + return m_frameMenuBar; } void wxFrame::Centre(int direction) { - int display_width, display_height, width, height, x, y; - wxDisplaySize(&display_width, &display_height); + int display_width, display_height, width, height, x, y; + wxDisplaySize(&display_width, &display_height); - GetSize(&width, &height); - GetPosition(&x, &y); + GetSize(&width, &height); + GetPosition(&x, &y); - if (direction & wxHORIZONTAL) - x = (int)((display_width - width)/2); - if (direction & wxVERTICAL) - y = (int)((display_height - height)/2); + if (direction & wxHORIZONTAL) + x = (int)((display_width - width)/2); + if (direction & wxVERTICAL) + y = (int)((display_height - height)/2); - SetSize(x, y, width, height); + SetSize(x, y, width, height); } // Call this to simulate a menu command void wxFrame::Command(int id) { - ProcessCommand(id); + ProcessCommand(id); } void wxFrame::ProcessCommand(int id) { - wxCommandEvent commandEvent(wxEVENT_TYPE_MENU_COMMAND, id); + wxCommandEvent commandEvent(wxEVT_COMMAND_MENU_SELECTED, id); commandEvent.SetInt( id ); commandEvent.SetEventObject( this ); @@ -856,13 +872,16 @@ void wxFrame::ProcessCommand(int id) } */ - GetEventHandler()->ProcessEvent(commandEvent); + wxEvtHandler* evtHandler = GetEventHandler(); + + evtHandler->ProcessEvent(commandEvent); } // Checks if there is a toolbar, and returns the first free client position wxPoint wxFrame::GetClientAreaOrigin() const { wxPoint pt(0, 0); +#if wxUSE_TOOLBAR if (GetToolBar()) { int w, h; @@ -877,13 +896,40 @@ wxPoint wxFrame::GetClientAreaOrigin() const pt.y += h; } } +#endif // wxUSE_TOOLBAR + 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); +} + +#if wxUSE_TOOLBAR wxToolBar* wxFrame::CreateToolBar(long style, wxWindowID id, const wxString& name) { wxCHECK_MSG( m_frameToolBar == NULL, FALSE, - "recreating toolbar in wxFrame" ); + "recreating toolbar in wxFrame" ); wxToolBar* toolBar = OnCreateToolBar(style, id, name); if (toolBar) @@ -903,6 +949,16 @@ wxToolBar* wxFrame::OnCreateToolBar(long style, wxWindowID id, const wxString& n return new wxToolBar(this, id, wxPoint(0, 0), wxSize(100, 24), style, name); } +void wxFrame::SetToolBar(wxToolBar *toolbar) +{ + m_frameToolBar = toolbar; +} + +wxToolBar *wxFrame::GetToolBar() const +{ + return m_frameToolBar; +} + void wxFrame::PositionToolBar() { int cw, ch; @@ -928,40 +984,41 @@ void wxFrame::PositionToolBar() } } } +#endif // wxUSE_TOOLBAR void wxFrame::CaptureMouse() { - if (m_winCaptured) - return; - - if (GetMainWidget()) - XtAddGrab((Widget) m_frameShell, TRUE, FALSE); - m_winCaptured = TRUE; + if (m_winCaptured) + return; + + if (GetMainWidget()) + XtAddGrab((Widget) m_frameShell, TRUE, FALSE); + m_winCaptured = TRUE; } void wxFrame::ReleaseMouse() { - if (!m_winCaptured) - return; - - if (GetMainWidget()) - XtRemoveGrab((Widget) m_frameShell); - m_winCaptured = FALSE; + if (!m_winCaptured) + return; + + if (GetMainWidget()) + XtRemoveGrab((Widget) m_frameShell); + m_winCaptured = FALSE; } void wxFrame::Raise(void) { Window parent_window = XtWindow((Widget) m_frameShell), - next_parent = XtWindow((Widget) m_frameShell), - root = RootWindowOfScreen(XtScreen((Widget) m_frameShell)); + next_parent = XtWindow((Widget) m_frameShell), + root = RootWindowOfScreen(XtScreen((Widget) m_frameShell)); // search for the parent that is child of ROOT, because the WM may // reparent twice and notify only the next parent (like FVWM) while (next_parent != root) { - Window *theChildren; unsigned int n; - parent_window = next_parent; - XQueryTree(XtDisplay((Widget) m_frameShell), parent_window, &root, - &next_parent, &theChildren, &n); - XFree(theChildren); // not needed + Window *theChildren; unsigned int n; + parent_window = next_parent; + XQueryTree(XtDisplay((Widget) m_frameShell), parent_window, &root, + &next_parent, &theChildren, &n); + XFree(theChildren); // not needed } XRaiseWindow(XtDisplay((Widget) m_frameShell), parent_window); } @@ -969,81 +1026,94 @@ void wxFrame::Raise(void) void wxFrame::Lower(void) { Window parent_window = XtWindow((Widget) m_frameShell), - next_parent = XtWindow((Widget) m_frameShell), - root = RootWindowOfScreen(XtScreen((Widget) m_frameShell)); + next_parent = XtWindow((Widget) m_frameShell), + root = RootWindowOfScreen(XtScreen((Widget) m_frameShell)); // search for the parent that is child of ROOT, because the WM may // reparent twice and notify only the next parent (like FVWM) while (next_parent != root) { - Window *theChildren; unsigned int n; - parent_window = next_parent; - XQueryTree(XtDisplay((Widget) m_frameShell), parent_window, &root, - &next_parent, &theChildren, &n); - XFree(theChildren); // not needed + Window *theChildren; unsigned int n; + parent_window = next_parent; + XQueryTree(XtDisplay((Widget) m_frameShell), parent_window, &root, + &next_parent, &theChildren, &n); + XFree(theChildren); // not needed } XLowerWindow(XtDisplay((Widget) m_frameShell), parent_window); } -void wxFrame::SetToolBar(wxToolBar *toolbar) -{ m_frameToolBar = toolbar; } - -wxToolBar *wxFrame::GetToolBar() const -{ return m_frameToolBar; } - -void wxFrameFocusProc(Widget workArea, XtPointer clientData, +void wxFrameFocusProc(Widget workArea, XtPointer clientData, XmAnyCallbackStruct *cbs) { - wxFrame *frame = (wxFrame *)clientData; - - // wxDebugMsg("focus proc from frame %ld\n",(long)frame); - // TODO - // frame->GetEventHandler()->OnSetFocus(); + // wxDebugMsg("focus proc from frame %ld\n",(long)frame); + // TODO + // wxFrame *frame = (wxFrame *)clientData; + // frame->GetEventHandler()->OnSetFocus(); } /* MATTEW: Used to insure that hide-&-show within an event cycle works */ -static void wxFrameMapProc(Widget frameShell, XtPointer clientData, - XCrossingEvent * event) +static void wxFrameMapProc(Widget frameShell, XtPointer clientData, + XCrossingEvent * event) { - wxFrame *frame = (wxFrame *)wxWidgetHashTable->Get((long)clientData); + wxFrame *frame = (wxFrame *)wxGetWindowFromTable((Widget)clientData); - if (frame) { - XEvent *e = (XEvent *)event; + if (frame) { + XEvent *e = (XEvent *)event; - if (e->xany.type == MapNotify) - { - // Iconize fix - XtVaSetValues(frameShell, XmNiconic, (Boolean)False, NULL); - if (!frame->GetVisibleStatus()) - { - /* We really wanted this to be hidden! */ - XtUnmapWidget((Widget) frame->GetShellWidget()); - } + if (e->xany.type == MapNotify) + { + // Iconize fix + XtVaSetValues(frameShell, XmNiconic, (Boolean)False, NULL); + if (!frame->GetVisibleStatus()) + { + /* We really wanted this to be hidden! */ + XtUnmapWidget((Widget) frame->GetShellWidget()); + } + } + else if (e->xany.type == UnmapNotify) + // Iconize fix + XtVaSetValues(frameShell, XmNiconic, (Boolean)True, NULL); } - else if (e->xany.type == UnmapNotify) - // Iconize fix - XtVaSetValues(frameShell, XmNiconic, (Boolean)True, NULL); - } } //// Motif-specific bool wxFrame::PreResize() { - PositionToolBar(); - PositionStatusBar(); - return TRUE; +#if wxUSE_TOOLBAR + PositionToolBar(); +#endif // wxUSE_TOOLBAR + PositionStatusBar(); + return TRUE; } WXWidget wxFrame::GetClientWidget() const { - return m_clientArea; + return m_clientArea; +} + +void wxFrame::ChangeFont(bool keepOriginalSize) +{ + // TODO +} + +void wxFrame::ChangeBackgroundColour() +{ + if (GetClientWidget()) + DoChangeBackgroundColour(GetClientWidget(), m_backgroundColour); +} + +void wxFrame::ChangeForegroundColour() +{ + if (GetClientWidget()) + DoChangeForegroundColour(GetClientWidget(), m_foregroundColour); } void wxCloseFrameCallback(Widget widget, XtPointer client_data, XmAnyCallbackStruct *cbs) { - wxFrame *frame = (wxFrame *)client_data; + wxFrame *frame = (wxFrame *)client_data; - wxCloseEvent closeEvent(wxEVT_CLOSE_WINDOW, frame->GetId()); - closeEvent.SetEventObject(frame); + wxCloseEvent closeEvent(wxEVT_CLOSE_WINDOW, frame->GetId()); + closeEvent.SetEventObject(frame); - // May delete the frame (with delayed deletion) - frame->GetEventHandler()->ProcessEvent(closeEvent); + // May delete the frame (with delayed deletion) + frame->GetEventHandler()->ProcessEvent(closeEvent); } +