]>
git.saurik.com Git - wxWidgets.git/blob - src/ribbon/control.cpp
1 ///////////////////////////////////////////////////////////////////////////////
2 // Name: src/ribbon/control.cpp
3 // Purpose: Extension of wxControl with common ribbon methods
4 // Author: Peter Cawley
7 // Copyright: (C) Peter Cawley
8 // Licence: wxWindows licence
9 ///////////////////////////////////////////////////////////////////////////////
11 #include "wx/wxprec.h"
19 #include "wx/ribbon/control.h"
20 #include "wx/ribbon/bar.h"
26 #include "wx/msw/private.h"
29 IMPLEMENT_CLASS(wxRibbonControl
, wxControl
)
31 bool wxRibbonControl::Create(wxWindow
*parent
, wxWindowID id
,
33 const wxSize
& size
, long style
,
34 const wxValidator
& validator
,
37 if ( !wxControl::Create(parent
, id
, pos
, size
, style
, validator
, name
) )
40 wxRibbonControl
*ribbon_parent
= wxDynamicCast(parent
, wxRibbonControl
);
43 m_art
= ribbon_parent
->GetArtProvider();
49 void wxRibbonControl::SetArtProvider(wxRibbonArtProvider
* art
)
54 wxSize
wxRibbonControl::DoGetNextSmallerSize(wxOrientation direction
,
57 // Dummy implementation for code which doesn't check for IsSizingContinuous() == true
58 wxSize
minimum(GetMinSize());
59 if((direction
& wxHORIZONTAL
) && size
.x
> minimum
.x
)
63 if((direction
& wxVERTICAL
) && size
.y
> minimum
.y
)
70 wxSize
wxRibbonControl::DoGetNextLargerSize(wxOrientation direction
,
73 // Dummy implementation for code which doesn't check for IsSizingContinuous() == true
74 if(direction
& wxHORIZONTAL
)
78 if(direction
& wxVERTICAL
)
85 wxSize
wxRibbonControl::GetNextSmallerSize(wxOrientation direction
,
86 wxSize relative_to
) const
88 return DoGetNextSmallerSize(direction
, relative_to
);
91 wxSize
wxRibbonControl::GetNextLargerSize(wxOrientation direction
,
92 wxSize relative_to
) const
94 return DoGetNextLargerSize(direction
, relative_to
);
97 wxSize
wxRibbonControl::GetNextSmallerSize(wxOrientation direction
) const
99 return DoGetNextSmallerSize(direction
, GetSize());
102 wxSize
wxRibbonControl::GetNextLargerSize(wxOrientation direction
) const
104 return DoGetNextLargerSize(direction
, GetSize());
107 bool wxRibbonControl::Realize()
112 wxRibbonBar
* wxRibbonControl::GetAncestorRibbonBar()const
114 for ( wxWindow
* win
= GetParent(); win
; win
= win
->GetParent() )
116 wxRibbonBar
* bar
= wxDynamicCast(win
, wxRibbonBar
);
124 #endif // wxUSE_RIBBON