]>
git.saurik.com Git - wxWidgets.git/blob - interface/wx/ribbon/control.h
88e0c85ee0d9523166c2b971dad4c4aeb4c2503a
1 ///////////////////////////////////////////////////////////////////////////////
2 // Name: ribbon/control.h
3 // Purpose: interface of wxRibbonControl
4 // Author: Peter Cawley
6 // Licence: wxWindows licence
7 ///////////////////////////////////////////////////////////////////////////////
10 @class wxRibbonControl
12 wxRibbonControl serves as a base class for all controls which share the
13 ribbon characteristics of having a ribbon art provider, and (optionally)
14 non-continuous resizing. Despite what the name may imply, it is not the
15 top-level control for creating a ribbon interface - that is wxRibbonBar.
17 Ribbon controls often have a region which is "transparent", and shows the
18 contents of the ribbon page or panel behind it. If implementing a new
19 ribbon control, then it may be useful to realise that this effect is done
20 by the art provider when painting the background of the control, and hence
21 in the paint handler for the new control, you should call a draw background
22 method on the art provider (wxRibbonArtProvider::DrawButtonBarBackground()
23 and wxRibbonArtProvider::DrawToolBarBackground() typically just redraw what
24 is behind the rectangle being painted) if you want transparent regions.
29 class wxRibbonControl
: public wxControl
40 If @a parent is a wxRibbonControl with a non-NULL art provider, then
41 the art provider of new control is set to that of @a parent.
43 wxRibbonControl(wxWindow
*parent
, wxWindowID id
,
44 const wxPoint
& pos
= wxDefaultPosition
,
45 const wxSize
& size
= wxDefaultSize
, long style
= 0,
46 const wxValidator
& validator
= wxDefaultValidator
,
47 const wxString
& name
= wxControlNameStr
);
50 Set the art provider to be used. In many cases, setting the art provider
51 will also set the art provider on all child windows which extend
54 In most cases, controls will not take ownership of the given pointer,
55 with the notable exception being wxRibbonBar::SetArtProvider().
57 virtual void SetArtProvider(wxRibbonArtProvider
* art
);
60 Get the art provider to be used. Note that until an art provider has
61 been set in some way, this function may return NULL.
63 wxRibbonArtProvider
* GetArtProvider() const;
66 @return @true if this window can take any size (greater than its minimum
67 size), @false if it can only take certain sizes.
69 @see GetNextSmallerSize()
70 @see GetNextLargerSize()
72 virtual bool IsSizingContinuous() const;
75 If sizing is not continuous, then return a suitable size for the control
76 which is smaller than the current size.
79 The direction(s) in which the size should reduce.
81 The current size if there is no smaller size, otherwise a suitable
82 size which is smaller in the given direction(s), and the same as the
83 current size in the other direction (if any).
85 @see IsSizingContinuous()
87 wxSize
GetNextSmallerSize(wxOrientation direction
) const;
90 If sizing is not continuous, then return a suitable size for the control
91 which is smaller than the given size.
94 The direction(s) in which the size should reduce.
96 The size for which a smaller size should be found.
98 @a relative_to if there is no smaller size, otherwise a suitable
99 size which is smaller in the given direction(s), and the same as
100 @a relative_to in the other direction (if any).
102 @see IsSizingContinuous()
103 @see DoGetNextSmallerSize()
105 wxSize
GetNextSmallerSize(wxOrientation direction
, wxSize relative_to
) const;
108 If sizing is not continuous, then return a suitable size for the control
109 which is larger than the current size.
112 The direction(s) in which the size should increase.
114 The current size if there is no larger size, otherwise a suitable
115 size which is larger in the given direction(s), and the same as the
116 current size in the other direction (if any).
118 @see IsSizingContinuous()
120 wxSize
GetNextLargerSize(wxOrientation direction
) const;
123 If sizing is not continuous, then return a suitable size for the control
124 which is larger than the given size.
127 The direction(s) in which the size should increase.
129 The size for which a larger size should be found.
131 @a relative_to if there is no larger size, otherwise a suitable
132 size which is larger in the given direction(s), and the same as
133 @a relative_to in the other direction (if any).
135 @see IsSizingContinuous()
136 @see DoGetNextLargerSize()
138 wxSize
GetNextLargerSize(wxOrientation direction
, wxSize relative_to
) const;
141 Perform initial size and layout calculations after children have been
142 added, and/or realize children.
144 virtual bool Realize();
152 Get the first ancestor which is a wxRibbonBar (or derived) or NULL
153 if not having such parent.
157 virtual wxRibbonBar
* GetAncestorRibbonBar()const;
161 Finds the best width and height given the parent's width and height.
162 Used to implement the wxRIBBON_PANEL_FLEXIBLE panel style.
164 virtual wxSize
GetBestSizeForParentSize(const wxSize
& parentSize
) const;
167 Implementation of GetNextSmallerSize().
168 Controls which have non-continuous sizing must override this virtual
169 function rather than GetNextSmallerSize().
171 virtual wxSize
DoGetNextSmallerSize(wxOrientation direction
,
172 wxSize relative_to
) const;
175 Implementation of GetNextLargerSize().
176 Controls which have non-continuous sizing must override this virtual
177 function rather than GetNextLargerSize().
179 virtual wxSize
DoGetNextLargerSize(wxOrientation direction
,
180 wxSize relative_to
) const;