]>
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
8 // Copyright: (C) Peter Cawley
9 // Licence: wxWindows licence
10 ///////////////////////////////////////////////////////////////////////////////
12 #include "wx/wxprec.h"
20 #include "wx/ribbon/control.h"
21 #include "wx/ribbon/bar.h"
27 #include "wx/msw/private.h"
30 IMPLEMENT_CLASS(wxRibbonControl
, wxControl
)
32 bool wxRibbonControl::Create(wxWindow
*parent
, wxWindowID id
,
34 const wxSize
& size
, long style
,
35 const wxValidator
& validator
,
38 if ( !wxControl::Create(parent
, id
, pos
, size
, style
, validator
, name
) )
41 wxRibbonControl
*ribbon_parent
= wxDynamicCast(parent
, wxRibbonControl
);
44 m_art
= ribbon_parent
->GetArtProvider();
50 void wxRibbonControl::SetArtProvider(wxRibbonArtProvider
* art
)
55 wxSize
wxRibbonControl::DoGetNextSmallerSize(wxOrientation direction
,
58 // Dummy implementation for code which doesn't check for IsSizingContinuous() == true
59 wxSize
minimum(GetMinSize());
60 if((direction
& wxHORIZONTAL
) && size
.x
> minimum
.x
)
64 if((direction
& wxVERTICAL
) && size
.y
> minimum
.y
)
71 wxSize
wxRibbonControl::DoGetNextLargerSize(wxOrientation direction
,
74 // Dummy implementation for code which doesn't check for IsSizingContinuous() == true
75 if(direction
& wxHORIZONTAL
)
79 if(direction
& wxVERTICAL
)
86 wxSize
wxRibbonControl::GetNextSmallerSize(wxOrientation direction
,
87 wxSize relative_to
) const
89 return DoGetNextSmallerSize(direction
, relative_to
);
92 wxSize
wxRibbonControl::GetNextLargerSize(wxOrientation direction
,
93 wxSize relative_to
) const
95 return DoGetNextLargerSize(direction
, relative_to
);
98 wxSize
wxRibbonControl::GetNextSmallerSize(wxOrientation direction
) const
100 return DoGetNextSmallerSize(direction
, GetSize());
103 wxSize
wxRibbonControl::GetNextLargerSize(wxOrientation direction
) const
105 return DoGetNextLargerSize(direction
, GetSize());
108 bool wxRibbonControl::Realize()
113 wxRibbonBar
* wxRibbonControl::GetAncestorRibbonBar()const
115 for ( wxWindow
* win
= GetParent(); win
; win
= win
->GetParent() )
117 wxRibbonBar
* bar
= wxDynamicCast(win
, wxRibbonBar
);
125 #endif // wxUSE_RIBBON