#include "wx/motif/private.h"
void wxCloseFrameCallback(Widget, XtPointer, XmAnyCallbackStruct *cbs);
-static void wxFrameFocusProc(Widget workArea, XtPointer clientData,
+void wxFrameFocusProc(Widget workArea, XtPointer clientData,
XmAnyCallbackStruct *cbs);
static void wxFrameMapProc(Widget frameShell, XtPointer clientData,
XCrossingEvent * event);
m_visibleStatus = TRUE;
m_title = "";
- SetBackgroundColour(wxSystemSettings::GetSystemColour(wxSYS_COLOUR_APPWORKSPACE));
+ m_backgroundColour = wxSystemSettings::GetSystemColour(wxSYS_COLOUR_APPWORKSPACE);
+ m_foregroundColour = *wxBLACK;
+ m_windowFont = wxSystemSettings::GetSystemFont(wxSYS_DEFAULT_GUI_FONT);
if ( id > -1 )
m_windowId = id;
m_mainWidget = m_frameWidget;
+ ChangeFont(FALSE);
+
// This patch comes from Torsten Liermann lier@lier1.muc.de
if (XmIsMotifWMRunning( (Widget) m_frameShell ))
{
#endif
#endif
+ ChangeBackgroundColour();
+
PreResize();
wxSizeEvent sizeEvent(wxSize(width, height), GetId());
XtDestroyWidget (statusLineWidget);
*/
- wxDeleteWindowFromTable((Widget) m_workArea);
+ if (m_workArea)
+ {
+ wxDeleteWindowFromTable((Widget) m_workArea);
- XtDestroyWidget ((Widget) m_workArea);
- XtDestroyWidget ((Widget) m_frameWidget);
+ XtDestroyWidget ((Widget) m_workArea);
+ }
- wxDeleteWindowFromTable((Widget) m_frameWidget);
+ if (m_frameWidget)
+ {
+ wxDeleteWindowFromTable((Widget) m_frameWidget);
+ XtDestroyWidget ((Widget) m_frameWidget);
+ }
- XtDestroyWidget ((Widget) m_frameShell);
+ if (m_frameShell)
+ XtDestroyWidget ((Widget) m_frameShell);
SetMainWidget((WXWidget) NULL);
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)
{
// it seems that if a frame holds a panel, the menu bar size
yy -= ys;
}
}
+ */
*x = xx; *y = yy;
}
if (height > -1)
{
- /* TODO
- if (status_line_exists)
+ if (m_frameStatusBar)
{
- Dimension ys;
- XtVaGetValues(statusLineWidget, XmNheight, &ys, NULL);
- height += ys;
+ int sbw, sbh;
+ m_frameStatusBar->GetSize(& sbw, & sbh);
+ height += sbh;
+ }
+ if (m_frameToolBar)
+ {
+ int tbw, tbh;
+ m_frameToolBar->GetSize(& tbw, & tbh);
+ if (m_frameToolBar->GetWindowStyleFlag() & wxTB_VERTICAL)
+ width += tbw;
+ else
+ height += tbh;
}
- */
+
XtVaSetValues((Widget) m_workArea, XmNheight, height, NULL);
}
PreResize();
wxToolBar* wxFrame::OnCreateToolBar(long style, wxWindowID id, const wxString& name)
{
- return new wxToolBar(this, id, wxDefaultPosition, wxDefaultSize, style, name);
+ return new wxToolBar(this, id, wxPoint(0, 0), wxSize(100, 24), style, name);
}
void wxFrame::PositionToolBar()
{
int cw, ch;
- // TODO: we actually need to use the low-level client size, before
- // the toolbar/status bar were added.
- // So DEFINITELY replace the line below with something appropriate.
-
GetClientSize(& cw, &ch);
- if ( GetStatusBar() )
- {
- int statusX, statusY;
- GetStatusBar()->GetClientSize(&statusX, &statusY);
- ch -= statusY;
- }
-
if (GetToolBar())
{
int tw, th;
// Use the 'real' position. wxSIZE_NO_ADJUSTMENTS
// means, pretend we don't have toolbar/status bar, so we
// have the original client size.
- GetToolBar()->SetSize(0, 0, tw, ch, wxSIZE_NO_ADJUSTMENTS);
+ GetToolBar()->SetSize(0, 0, tw, ch + th, wxSIZE_NO_ADJUSTMENTS);
}
else
{
wxToolBar *wxFrame::GetToolBar() const
{ return m_frameToolBar; }
-static void wxFrameFocusProc(Widget workArea, XtPointer clientData,
+void wxFrameFocusProc(Widget workArea, XtPointer clientData,
XmAnyCallbackStruct *cbs)
{
wxFrame *frame = (wxFrame *)clientData;
//// Motif-specific
bool wxFrame::PreResize()
{
+ PositionToolBar();
PositionStatusBar();
return TRUE;
}
return m_clientArea;
}
+void wxFrame::ChangeFont(bool keepOriginalSize)
+{
+ // TODO
+}
+
+void wxFrame::ChangeBackgroundColour()
+{
+ // TODO
+}
+
+void wxFrame::ChangeForegroundColour()
+{
+ // TODO
+}
+
void wxCloseFrameCallback(Widget widget, XtPointer client_data, XmAnyCallbackStruct *cbs)
{
wxFrame *frame = (wxFrame *)client_data;
// May delete the frame (with delayed deletion)
frame->GetEventHandler()->ProcessEvent(closeEvent);
}
+