wxFrame::wxFrame()
{
+#if wxUSE_TOOLBAR
m_frameToolBar = NULL ;
+#endif // wxUSE_TOOLBAR
+
m_frameMenuBar = NULL;
m_frameStatusBar = NULL;
m_windowStyle = style;
m_frameMenuBar = NULL;
+#if wxUSE_TOOLBAR
m_frameToolBar = NULL ;
+#endif // wxUSE_TOOLBAR
m_frameStatusBar = NULL;
//// Motif-specific
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);
wxFrame::~wxFrame()
{
+ if (m_clientArea)
+ XtRemoveEventHandler((Widget) m_clientArea, ExposureMask, FALSE,
+ wxUniversalRepaintProc, (XtPointer) this);
+
if (GetMainWidget())
Show(FALSE);
-
+
if (m_frameMenuBar)
{
m_frameMenuBar->DestroyMenuBar();
m_frameStatusBar->GetSize(& sbw, & sbh);
yy -= sbh;
}
+#if wxUSE_TOOLBAR
if (m_frameToolBar)
{
int tbw, tbh;
else
yy -= tbh;
}
+#endif // wxUSE_TOOLBAR
/*
if (GetMenuBar() != (wxMenuBar*) NULL)
{
// 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
m_frameStatusBar->GetSize(& sbw, & sbh);
height += sbh;
}
+#if wxUSE_TOOLBAR
if (m_frameToolBar)
{
int tbw, tbh;
else
height += tbh;
}
+#endif // wxUSE_TOOLBAR
XtVaSetValues((Widget) m_workArea, XmNheight, height, NULL);
}
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);
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
}
}
-// 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)
wxPoint wxFrame::GetClientAreaOrigin() const
{
wxPoint pt(0, 0);
+#if wxUSE_TOOLBAR
if (GetToolBar())
{
int w, h;
pt.y += h;
}
}
+#endif // wxUSE_TOOLBAR
+
return pt;
}
wxWindow::ClientToScreen(x, y);
}
+#if wxUSE_TOOLBAR
wxToolBar* wxFrame::CreateToolBar(long style, wxWindowID id, const wxString& name)
{
wxCHECK_MSG( m_frameToolBar == NULL, FALSE,
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;
}
}
}
+#endif // wxUSE_TOOLBAR
void wxFrame::CaptureMouse()
{
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)
{
//// Motif-specific
bool wxFrame::PreResize()
{
+#if wxUSE_TOOLBAR
PositionToolBar();
+#endif // wxUSE_TOOLBAR
PositionStatusBar();
return TRUE;
}