]> git.saurik.com Git - wxWidgets.git/blobdiff - src/ribbon/control.cpp
Added ability to switch off more components of the size page UI
[wxWidgets.git] / src / ribbon / control.cpp
index a963a6c4c16c9fde4c91deb704cf9c7868409033..9867ecf7d28d18426b573edd759c333c9ea3b02a 100644 (file)
@@ -8,16 +8,18 @@
 // Copyright:   (C) Peter Cawley
 // Licence:     wxWindows licence
 ///////////////////////////////////////////////////////////////////////////////
+
 #include "wx/wxprec.h"
 
 #ifdef __BORLANDC__
     #pragma hdrstop
 #endif
 
-#include "wx/ribbon/control.h"
-
 #if wxUSE_RIBBON
 
+#include "wx/ribbon/control.h"
+#include "wx/ribbon/bar.h"
+
 #ifndef WX_PRECOMP
 #endif
 
 
 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)
@@ -106,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