X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/89c7e9622933c3ee7906c39bc3927a7d5616b94b..a5e13868ca700aa39bae26b8fb13c640f466d9f0:/src/motif/frame.cpp diff --git a/src/motif/frame.cpp b/src/motif/frame.cpp index c3222764ab..c294be1df8 100644 --- a/src/motif/frame.cpp +++ b/src/motif/frame.cpp @@ -51,7 +51,7 @@ #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); @@ -126,7 +126,9 @@ bool wxFrame::Create(wxWindow *parent, 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; @@ -221,6 +223,8 @@ bool wxFrame::Create(wxWindow *parent, m_mainWidget = m_frameWidget; + ChangeFont(FALSE); + // This patch comes from Torsten Liermann lier@lier1.muc.de if (XmIsMotifWMRunning( (Widget) m_frameShell )) { @@ -264,6 +268,8 @@ bool wxFrame::Create(wxWindow *parent, #endif #endif + ChangeBackgroundColour(); + PreResize(); wxSizeEvent sizeEvent(wxSize(width, height), GetId()); @@ -310,14 +316,21 @@ wxFrame::~wxFrame() 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); @@ -348,7 +361,16 @@ void wxFrame::GetClientSize(int *x, int *y) const 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 @@ -368,6 +390,7 @@ void wxFrame::GetClientSize(int *x, int *y) const yy -= ys; } } + */ *x = xx; *y = yy; } @@ -384,14 +407,22 @@ void wxFrame::SetClientSize(int width, int height) 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(); @@ -875,26 +906,15 @@ wxToolBar* wxFrame::CreateToolBar(long style, wxWindowID id, const wxString& nam 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; @@ -905,7 +925,7 @@ void wxFrame::PositionToolBar() // 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 { @@ -975,7 +995,7 @@ void wxFrame::SetToolBar(wxToolBar *toolbar) 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; @@ -1013,6 +1033,7 @@ static void wxFrameMapProc(Widget frameShell, XtPointer clientData, //// Motif-specific bool wxFrame::PreResize() { + PositionToolBar(); PositionStatusBar(); return TRUE; } @@ -1022,6 +1043,21 @@ WXWidget wxFrame::GetClientWidget() const 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; @@ -1032,3 +1068,4 @@ void wxCloseFrameCallback(Widget widget, XtPointer client_data, XmAnyCallbackStr // May delete the frame (with delayed deletion) frame->GetEventHandler()->ProcessEvent(closeEvent); } +