X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/798a4529fe37bfd1864b4ed350e7de603bd40f2b..77e0239d76ac5f2dbe9ba53e3278184ce83868ed:/src/motif/frame.cpp?ds=sidebyside diff --git a/src/motif/frame.cpp b/src/motif/frame.cpp index 4dd023b994..d6fc8327db 100644 --- a/src/motif/frame.cpp +++ b/src/motif/frame.cpp @@ -36,6 +36,7 @@ #include "wx/utils.h" #include "wx/log.h" #include "wx/app.h" +#include "wx/icon.h" #ifdef __VMS__ #pragma message disable nosimpint @@ -169,8 +170,8 @@ bool wxFrame::Create(wxWindow *parent, SetTitle( title ); wxLogTrace(wxTRACE_Messages, - "Created frame (0x%08x) with work area 0x%08x and client " - "area 0x%08x", m_mainWidget, m_workArea, m_clientArea); + "Created frame (0x%p) with work area 0x%p and client " + "area 0x%p", m_mainWidget, m_workArea, m_clientArea); XtAddEventHandler((Widget) m_clientArea, ExposureMask,FALSE, wxUniversalRepaintProc, (XtPointer) this); @@ -309,15 +310,19 @@ wxFrame::~wxFrame() delete m_frameStatusBar; m_frameStatusBar = NULL; } + + PreDestroy(); + DoDestroy(); } void wxFrame::DoDestroy() { Widget frameShell = (Widget)GetShellWidget(); - XtRemoveEventHandler( frameShell, StructureNotifyMask, - False, (XtEventHandler)wxFrameMapProc, - (XtPointer)this ); + if( frameShell ) + XtRemoveEventHandler( frameShell, StructureNotifyMask, + False, (XtEventHandler)wxFrameMapProc, + (XtPointer)this ); if( m_clientArea ) { @@ -500,10 +505,12 @@ void wxFrame::DoSetIcon(const wxIcon& icon) if (!m_frameShell) return; - if (!icon.Ok() || !icon.GetPixmap()) + if (!icon.Ok() || !icon.GetDrawable()) return; - XtVaSetValues((Widget) m_frameShell, XtNiconPixmap, icon.GetPixmap(), NULL); + XtVaSetValues((Widget) m_frameShell, + XtNiconPixmap, icon.GetDrawable(), + NULL); } void wxFrame::SetIcon(const wxIcon& icon) @@ -591,10 +598,11 @@ void wxFrame::OnActivate(wxActivateEvent& event) if (!event.GetActive()) return; - for(wxNode *node = GetChildren().First(); node; node = node->Next()) + for(wxWindowList::Node *node = GetChildren().GetFirst(); node; + node = node->GetNext()) { // Find a child that's a subwindow, but not a dialog box. - wxWindow *child = (wxWindow *)node->Data(); + wxWindow *child = node->GetData(); if (!child->IsTopLevel()) { child->SetFocus(); @@ -603,6 +611,13 @@ void wxFrame::OnActivate(wxActivateEvent& event) } } +void wxFrame::SendSizeEvent() +{ + wxSizeEvent event(GetSize(), GetId()); + event.SetEventObject(this); + GetEventHandler()->AddPendingEvent(event); +} + #if wxUSE_TOOLBAR wxToolBar* wxFrame::CreateToolBar(long style, @@ -617,6 +632,12 @@ wxToolBar* wxFrame::CreateToolBar(long style, return m_frameToolBar; } +void wxFrame::SetToolBar(wxToolBar *toolbar) +{ + wxFrameBase::SetToolBar(toolbar); + SendSizeEvent(); +} + void wxFrame::PositionToolBar() { wxToolBar* tb = GetToolBar(); @@ -641,7 +662,7 @@ void wxFrame::PositionToolBar() tw = cw; } - tb->SetSize(0, 0, tw, th, wxSIZE_NO_ADJUSTMENTS); + tb->SetSize(0, 0, -1, -1, wxSIZE_NO_ADJUSTMENTS); } } #endif // wxUSE_TOOLBAR @@ -673,13 +694,13 @@ void wxFrame::ChangeFont(bool WXUNUSED(keepOriginalSize)) void wxFrame::ChangeBackgroundColour() { if (GetClientWidget()) - DoChangeBackgroundColour(GetClientWidget(), m_backgroundColour); + wxDoChangeBackgroundColour(GetClientWidget(), m_backgroundColour); } void wxFrame::ChangeForegroundColour() { if (GetClientWidget()) - DoChangeForegroundColour(GetClientWidget(), m_foregroundColour); + wxDoChangeForegroundColour(GetClientWidget(), m_foregroundColour); } /* MATTEW: Used to insure that hide-&-show within an event cycle works */