1 ///////////////////////////////////////////////////////////////////////////////
3 // Purpose: interface of wxRibbonBar
4 // Author: Peter Cawley
6 // Licence: wxWindows licence
7 ///////////////////////////////////////////////////////////////////////////////
10 @class wxRibbonBarEvent
12 Event used to indicate various actions relating to a wxRibbonBar.
14 See wxRibbonBar for available event types.
17 @category{events,ribbon}
21 class wxRibbonBarEvent
: public wxNotifyEvent
27 wxRibbonBarEvent(wxEventType command_type
= wxEVT_NULL
,
29 wxRibbonPage
* page
= NULL
);
32 Returns the page being changed to, or being clicked on.
34 wxRibbonPage
* GetPage();
37 Sets the page relating to this event.
39 void SetPage(wxRibbonPage
* page
);
45 Top-level control in a ribbon user interface. Serves as a tabbed container
46 for wxRibbonPage - a ribbon user interface typically has a ribbon bar,
47 which contains one or more wxRibbonPages, which in turn each contain one
48 or more wxRibbonPanels, which in turn contain controls.
50 While a wxRibbonBar has tabs similar to a wxNotebook, it does not follow
51 the same API for adding pages. Containers like wxNotebook can contain any
52 type of window as a page, hence the normal procedure is to create the
53 sub-window and then call wxBookCtrlBase::AddPage(). As wxRibbonBar can only
54 have wxRibbonPage as children (and a wxRibbonPage can only have a
55 wxRibbonBar as parent), when a page is created, it is automatically added
56 to the bar - there is no AddPage equivalent to call.
58 After all pages have been created, and all controls and panels placed on
59 those pages, Realize() must be called.
65 @style{wxRIBBON_BAR_DEFAULT_STYLE}
66 Defined as wxRIBBON_BAR_FLOW_HORIZONTAL |
67 wxRIBBON_BAR_SHOW_PAGE_LABELS | wxRIBBON_BAR_SHOW_PANEL_EXT_BUTTONS |
68 wxRIBBON_BAR_SHOW_TOGGLE_BUTTON | wxRIBBON_BAR_SHOW_HELP_BUTTON.
69 @style{wxRIBBON_BAR_FOLDBAR_STYLE}
70 Defined as wxRIBBON_BAR_FLOW_VERTICAL | wxRIBBON_BAR_SHOW_PAGE_ICONS
71 | wxRIBBON_BAR_SHOW_PANEL_EXT_BUTTONS |
72 wxRIBBON_BAR_SHOW_PANEL_MINIMISE_BUTTONS
73 @style{wxRIBBON_BAR_SHOW_PAGE_LABELS}
74 Causes labels to be shown on the tabs in the ribbon bar.
75 @style{wxRIBBON_BAR_SHOW_PAGE_ICONS}
76 Causes icons to be shown on the tabs in the ribbon bar.
77 @style{wxRIBBON_BAR_FLOW_HORIZONTAL}
78 Causes panels within pages to stack horizontally.
79 @style{wxRIBBON_BAR_FLOW_VERTICAL}
80 Causes panels within pages to stack vertically.
81 @style{wxRIBBON_BAR_SHOW_PANEL_EXT_BUTTONS}
82 Causes extension buttons to be shown on panels (where the panel has
84 @style{wxRIBBON_BAR_SHOW_PANEL_MINIMISE_BUTTONS}
85 Causes minimise buttons to be shown on panels (where the panel has
87 @style{wxRIBBON_BAR_SHOW_TOGGLE_BUTTON}
88 Causes a toggle button to appear on the ribbon bar at top-right corner.
89 This style is new since wxWidgets 2.9.5.
90 @style{wxRIBBON_BAR_SHOW_HELP_BUTTON}
91 Causes a help button to appear on the ribbon bar at the top-right corner.
92 This style is new since wxWidgets 2.9.5.
96 @beginEventEmissionTable{wxRibbonBarEvent}
97 @event{EVT_RIBBONBAR_PAGE_CHANGED(id, func)}
98 Triggered after the transition from one page being active to a different
100 @event{EVT_RIBBONBAR_PAGE_CHANGING(id, func)}
101 Triggered prior to the transition from one page being active to a
102 different page being active, and can veto the change.
103 @event{EVT_RIBBONBAR_TAB_MIDDLE_DOWN(id, func)}
104 Triggered when the middle mouse button is pressed on a tab.
105 @event{EVT_RIBBONBAR_TAB_MIDDLE_UP(id, func)}
106 Triggered when the middle mouse button is released on a tab.
107 @event{EVT_RIBBONBAR_TAB_RIGHT_DOWN(id, func)}
108 Triggered when the right mouse button is pressed on a tab.
109 @event{EVT_RIBBONBAR_TAB_RIGHT_UP(id, func)}
110 Triggered when the right mouse button is released on a tab.
111 @event{EVT_RIBBONBAR_TAB_LEFT_DCLICK(id, func)}
112 Triggered when the left mouse button is double clicked on a tab.
113 @event{EVT_RIBBONBAR_TOGGLED(id, func)}
114 Triggered when the button triggering the ribbon bar is clicked. This
115 event is new since wxWidgets 2.9.5.
116 @event{EVT_RIBBONBAR_HELP_CLICK(id, func)}
117 Triggered when the help button is clicked. This even is new since
124 class wxRibbonBar
: public wxRibbonControl
129 With this constructor, Create() should be called in order to create
135 Construct a ribbon bar with the given parameters.
137 wxRibbonBar(wxWindow
* parent
,
138 wxWindowID id
= wxID_ANY
,
139 const wxPoint
& pos
= wxDefaultPosition
,
140 const wxSize
& size
= wxDefaultSize
,
141 long style
= wxRIBBON_BAR_DEFAULT_STYLE
);
144 Create a ribbon bar in two-step ribbon bar construction.
145 Should only be called when the default constructor is used, and
146 arguments have the same meaning as in the full constructor.
148 bool Create(wxWindow
* parent
,
149 wxWindowID id
= wxID_ANY
,
150 const wxPoint
& pos
= wxDefaultPosition
,
151 const wxSize
& size
= wxDefaultSize
,
152 long style
= wxRIBBON_BAR_DEFAULT_STYLE
);
157 virtual ~wxRibbonBar();
160 Set the margin widths (in pixels) on the left and right sides of the
161 tab bar region of the ribbon bar. These margins will be painted with
162 the tab background, but tabs and scroll buttons will never be painted
165 The left margin could be used for rendering something equivalent to the
166 "Office Button", though this is not currently implemented. The right
167 margin could be used for rendering a help button, and/or MDI buttons,
168 but again, this is not currently implemented.
170 void SetTabCtrlMargins(int left
, int right
);
173 Set the art provider to be used be the ribbon bar. Also sets the art
174 provider on all current wxRibbonPage children, and any wxRibbonPage
175 children added in the future.
177 Note that unlike most other ribbon controls, the ribbon bar creates a
178 default art provider when initialised, so an explicit call to
179 SetArtProvider() is not required if the default art provider is
180 sufficient. Also, unlike other ribbon controls, the ribbon bar takes
181 ownership of the given pointer, and will delete it when the art
182 provider is changed or the bar is destroyed. If this behaviour is not
183 desired, then clone the art provider before setting it.
185 void SetArtProvider(wxRibbonArtProvider
* art
);
188 Set the active page by index, without triggering any events.
191 The zero-based index of the page to activate.
192 @return @true if the specified page is now active, @false if it could
193 not be activated (for example because the page index is invalid).
195 bool SetActivePage(size_t page
);
198 Set the active page, without triggering any events.
201 The page to activate.
202 @return @true if the specified page is now active, @false if it could
203 not be activated (for example because the given page is not a child
206 bool SetActivePage(wxRibbonPage
* page
);
209 Get the index of the active page.
211 In the rare case of no page being active, -1 is returned.
213 int GetActivePage() const;
218 NULL will be returned if the given index is out of range.
220 wxRibbonPage
* GetPage(int n
);
223 Get the number of pages in this bar.
227 size_t GetPageCount() const;
230 Dismiss the expanded panel of the currently active page.
232 Calls and returns the value from wxRibbonPage::DismissExpandedPanel()
233 for the currently active page, or @false if there is no active page.
235 bool DismissExpandedPanel();
238 Returns the number for a given ribbon bar page.
240 The number can be used in other ribbon bar calls.
244 int GetPageNumber(wxRibbonPage
* page
) const;
247 Delete a single page from this ribbon bar.
249 The user must call wxRibbonBar::Realize() after one (or more) calls to
254 void DeletePage(size_t n
);
257 Delete all pages from the ribbon bar.
264 Indicates whether the tab for the given page is shown to the user or
267 By default all page tabs are shown.
271 bool IsPageShown(size_t page
) const;
274 Show or hide the tab for a given page.
276 After showing or hiding a tab, you need to call wxRibbonBar::Realize().
277 If you hide the tab for the currently active page (GetActivePage) then
278 you should call SetActivePage to activate a different page.
282 void ShowPage(size_t page
, bool show_tab
=true);
285 Hides the tab for a given page.
287 Equivalent to @c ShowPage(page, false).
291 void HidePage(size_t page
);
294 Indicates whether a tab is currently highlighted.
296 @see AddPageHighlight()
300 bool IsPageHighlighted(size_t page
) const;
303 Highlight the specified tab.
305 Highlighted tabs have a colour between that of the active tab
306 and a tab over which the mouse is hovering. This can be used
307 to make a tab (usually temporarily) more noticeable to the user.
311 void AddPageHighlight(size_t page
, bool highlight
= true);
314 Changes a tab to not be highlighted.
316 @see AddPageHighlight()
320 void RemovePageHighlight(size_t page
);
323 Shows or hides the panel area of the ribbon bar.
325 If the panel area is hidden, then only the tab of the ribbon bar will
326 be shown. This is useful for giving the user more screen space to work
327 with when he/she doesn't need to see the ribbon's options.
331 void ShowPanels(bool show
= true);
334 Hides the panel area of the ribbon bar.
336 This method simply calls ShowPanels() with @false argument.
343 Indicates whether the panel area of the ribbon bar is shown.
349 bool ArePanelsShown() const;
352 Perform initial layout and size calculations of the bar and its
353 children. This must be called after all of the bar's children have been
354 created (and their children created, etc.) - if it is not, then windows
355 may not be laid out or sized correctly.
357 Also calls wxRibbonPage::Realize() on each child page.
359 virtual bool Realize();