X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/4cf018e14ea61679b99874765f232b2032b3d3f8..88932ec82d048d006cdc81bd309f5e59aee799ac:/src/ribbon/control.cpp?ds=sidebyside diff --git a/src/ribbon/control.cpp b/src/ribbon/control.cpp index beb97ab70a..9867ecf7d2 100644 --- a/src/ribbon/control.cpp +++ b/src/ribbon/control.cpp @@ -18,6 +18,7 @@ #if wxUSE_RIBBON #include "wx/ribbon/control.h" +#include "wx/ribbon/bar.h" #ifndef WX_PRECOMP #endif @@ -28,20 +29,22 @@ IMPLEMENT_CLASS(wxRibbonControl, wxControl) -wxRibbonControl::wxRibbonControl(wxWindow *parent, wxWindowID id, +bool wxRibbonControl::Create(wxWindow *parent, wxWindowID id, const wxPoint& pos, const wxSize& size, long style, const wxValidator& validator, const wxString& name) - : wxControl(parent, id, pos, size, style, validator, name) { - m_art = NULL; + if ( !wxControl::Create(parent, id, pos, size, style, validator, name) ) + return false; wxRibbonControl *ribbon_parent = wxDynamicCast(parent, wxRibbonControl); if(ribbon_parent) { m_art = ribbon_parent->GetArtProvider(); } + + return true; } void wxRibbonControl::SetArtProvider(wxRibbonArtProvider* art) @@ -107,4 +110,16 @@ bool wxRibbonControl::Realize() return true; } +wxRibbonBar* wxRibbonControl::GetAncestorRibbonBar()const +{ + for ( wxWindow* win = GetParent(); win; win = win->GetParent() ) + { + wxRibbonBar* bar = wxDynamicCast(win, wxRibbonBar); + if ( bar ) + return bar; + } + + return NULL; +} + #endif // wxUSE_RIBBON