New method allowing to find the ribbon bar containing the given window.
See #14283.
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@71641
c3d73ce0-8a6f-49c7-b76d-
6d57e0e08775
#include "wx/control.h"
#include "wx/dynarray.h"
+class wxRibbonBar;
class wxRibbonArtProvider;
class WXDLLIMPEXP_RIBBON wxRibbonControl : public wxControl
virtual bool Realize();
bool Realise() {return Realize();}
+ virtual wxRibbonBar* GetAncestorRibbonBar()const;
+
// Finds the best width and height given the parent's width and height
virtual wxSize GetBestSizeForParentSize(const wxSize& WXUNUSED(parentSize)) const { return GetBestSize(); }
*/
bool Realise();
+ /**
+ Get the first ancestor which is a wxRibbonBar (or derived) or NULL
+ if not having such parent.
+
+ @since 2.9.4
+ */
+ virtual wxRibbonBar* GetAncestorRibbonBar()const;
+
+
/**
Finds the best width and height given the parent's width and height.
Used to implement the wxRIBBON_PANEL_FLEXIBLE panel style.
#if wxUSE_RIBBON
#include "wx/ribbon/control.h"
+#include "wx/ribbon/bar.h"
#ifndef WX_PRECOMP
#endif
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