X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/c75e66953f7e46b9a488fd5a4aa1ec726621b13f..eb082a088a77e8afb3c5a87880a42b9ec9a487e3:/src/motif/frame.cpp diff --git a/src/motif/frame.cpp b/src/motif/frame.cpp index 6f126aae72..98682e8b99 100644 --- a/src/motif/frame.cpp +++ b/src/motif/frame.cpp @@ -84,7 +84,10 @@ bool wxFrame::m_useNativeStatusBar = FALSE; wxFrame::wxFrame() { +#if wxUSE_TOOLBAR m_frameToolBar = NULL ; +#endif // wxUSE_TOOLBAR + m_frameMenuBar = NULL; m_frameStatusBar = NULL; @@ -115,7 +118,9 @@ bool wxFrame::Create(wxWindow *parent, m_windowStyle = style; m_frameMenuBar = NULL; +#if wxUSE_TOOLBAR m_frameToolBar = NULL ; +#endif // wxUSE_TOOLBAR m_frameStatusBar = NULL; //// Motif-specific @@ -184,12 +189,14 @@ bool wxFrame::Create(wxWindow *parent, 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); @@ -282,9 +289,13 @@ bool wxFrame::Create(wxWindow *parent, wxFrame::~wxFrame() { + if (m_clientArea) + XtRemoveEventHandler((Widget) m_clientArea, ExposureMask, FALSE, + wxUniversalRepaintProc, (XtPointer) this); + if (GetMainWidget()) Show(FALSE); - + if (m_frameMenuBar) { m_frameMenuBar->DestroyMenuBar(); @@ -363,6 +374,7 @@ void wxFrame::GetClientSize(int *x, int *y) const m_frameStatusBar->GetSize(& sbw, & sbh); yy -= sbh; } +#if wxUSE_TOOLBAR if (m_frameToolBar) { int tbw, tbh; @@ -372,6 +384,7 @@ void wxFrame::GetClientSize(int *x, int *y) const else yy -= tbh; } +#endif // wxUSE_TOOLBAR /* if (GetMenuBar() != (wxMenuBar*) NULL) { @@ -399,7 +412,7 @@ void wxFrame::GetClientSize(int *x, int *y) const // 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 @@ -415,6 +428,7 @@ void wxFrame::SetClientSize(int width, int height) m_frameStatusBar->GetSize(& sbw, & sbh); height += sbh; } +#if wxUSE_TOOLBAR if (m_frameToolBar) { int tbw, tbh; @@ -424,6 +438,7 @@ void wxFrame::SetClientSize(int width, int height) else height += tbh; } +#endif // wxUSE_TOOLBAR XtVaSetValues((Widget) m_workArea, XmNheight, height, NULL); } @@ -465,7 +480,7 @@ void wxFrame::GetPosition(int *x, int *y) const 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); @@ -732,8 +747,11 @@ void wxFrame::OnSize(wxSizeEvent& event) wxWindow *win = (wxWindow *)node->Data(); if ( !win->IsKindOf(CLASSINFO(wxFrame)) && !win->IsKindOf(CLASSINFO(wxDialog)) && - (win != GetStatusBar()) && - (win != GetToolBar()) ) + (win != GetStatusBar()) +#if wxUSE_TOOLBAR + && (win != GetToolBar()) +#endif // wxUSE_TOOLBAR + ) { if ( child ) return; // it's our second subwindow - nothing to do @@ -770,21 +788,12 @@ void wxFrame::OnActivate(wxActivateEvent& event) } } -// 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) @@ -860,13 +869,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; @@ -881,6 +893,8 @@ wxPoint wxFrame::GetClientAreaOrigin() const pt.y += h; } } +#endif // wxUSE_TOOLBAR + return pt; } @@ -908,6 +922,7 @@ void wxFrame::ClientToScreen(int *x, int *y) const wxWindow::ClientToScreen(x, y); } +#if wxUSE_TOOLBAR wxToolBar* wxFrame::CreateToolBar(long style, wxWindowID id, const wxString& name) { wxCHECK_MSG( m_frameToolBar == NULL, FALSE, @@ -931,6 +946,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; @@ -956,6 +981,7 @@ void wxFrame::PositionToolBar() } } } +#endif // wxUSE_TOOLBAR void wxFrame::CaptureMouse() { @@ -1011,12 +1037,6 @@ void wxFrame::Lower(void) 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, XmAnyCallbackStruct *cbs) { @@ -1055,7 +1075,9 @@ static void wxFrameMapProc(Widget frameShell, XtPointer clientData, //// Motif-specific bool wxFrame::PreResize() { +#if wxUSE_TOOLBAR PositionToolBar(); +#endif // wxUSE_TOOLBAR PositionStatusBar(); return TRUE; }