1 ///////////////////////////////////////////////////////////////////////////////
2 // Name: ribbondemo.cpp
3 // Purpose: wxRibbon: Ribbon user interface - sample/test program
4 // Author: Peter Cawley
8 // Copyright: (C) Copyright 2009, Peter Cawley
9 // Licence: wxWindows Library Licence
10 ///////////////////////////////////////////////////////////////////////////////
12 #include "wx/wxprec.h"
20 #include "wx/textctrl.h"
21 #include "wx/ribbon/bar.h"
22 #include "wx/ribbon/buttonbar.h"
23 #include "wx/ribbon/gallery.h"
24 #include "wx/ribbon/toolbar.h"
27 #include "wx/msgdlg.h"
28 #include "wx/dcbuffer.h"
29 #include "wx/colordlg.h"
30 #include "wx/artprov.h"
31 #include "wx/combobox.h"
32 #include "wx/tglbtn.h"
33 #include "wx/wrapsizer.h"
37 class MyApp
: public wxApp
48 class MyFrame
: public wxFrame
56 ID_CIRCLE
= wxID_HIGHEST
+ 1,
61 ID_SELECTION_EXPAND_H
,
62 ID_SELECTION_EXPAND_V
,
63 ID_SELECTION_CONTRACT
,
71 ID_POSITION_TOP_ICONS
,
74 ID_POSITION_LEFT_LABELS
,
75 ID_POSITION_LEFT_BOTH
,
85 ID_UI_CHANGE_TEXT_UPDATED
,
91 void OnEnableUpdateUI(wxUpdateUIEvent
& evt
);
92 void OnCheckUpdateUI(wxUpdateUIEvent
& evt
);
93 void OnChangeTextUpdateUI(wxUpdateUIEvent
& evt
);
94 void OnCheck(wxRibbonButtonBarEvent
& evt
);
95 void OnEnable(wxRibbonButtonBarEvent
& evt
);
96 void OnDisable(wxRibbonButtonBarEvent
& evt
);
97 void OnChangeText1(wxRibbonButtonBarEvent
& evt
);
98 void OnChangeText2(wxRibbonButtonBarEvent
& evt
);
99 void OnCircleButton(wxRibbonButtonBarEvent
& evt
);
100 void OnCrossButton(wxRibbonButtonBarEvent
& evt
);
101 void OnTriangleButton(wxRibbonButtonBarEvent
& evt
);
102 void OnTriangleDropdown(wxRibbonButtonBarEvent
& evt
);
103 void OnSquareButton(wxRibbonButtonBarEvent
& evt
);
104 void OnPolygonDropdown(wxRibbonButtonBarEvent
& evt
);
105 void OnSelectionExpandVButton(wxRibbonButtonBarEvent
& evt
);
106 void OnSelectionExpandHButton(wxRibbonButtonBarEvent
& evt
);
107 void OnSelectionContractButton(wxRibbonButtonBarEvent
& evt
);
108 void OnHoveredColourChange(wxRibbonGalleryEvent
& evt
);
109 void OnPrimaryColourSelect(wxRibbonGalleryEvent
& evt
);
110 void OnSecondaryColourSelect(wxRibbonGalleryEvent
& evt
);
111 void OnColourGalleryButton(wxCommandEvent
& evt
);
112 void OnDefaultProvider(wxRibbonButtonBarEvent
& evt
);
113 void OnAUIProvider(wxRibbonButtonBarEvent
& evt
);
114 void OnMSWProvider(wxRibbonButtonBarEvent
& evt
);
115 void OnJustify(wxRibbonToolBarEvent
& evt
);
116 void OnJustifyUpdateUI(wxUpdateUIEvent
& evt
);
117 void OnNew(wxRibbonToolBarEvent
& evt
);
118 void OnNewDropdown(wxRibbonToolBarEvent
& evt
);
119 void OnPrint(wxRibbonToolBarEvent
& evt
);
120 void OnPrintDropdown(wxRibbonToolBarEvent
& evt
);
121 void OnRedoDropdown(wxRibbonToolBarEvent
& evt
);
122 void OnUndoDropdown(wxRibbonToolBarEvent
& evt
);
123 void OnPositionTop(wxRibbonToolBarEvent
& evt
);
124 void OnPositionTopLabels(wxCommandEvent
& evt
);
125 void OnPositionTopIcons(wxCommandEvent
& evt
);
126 void OnPositionTopBoth(wxCommandEvent
& evt
);
127 void OnPositionTopDropdown(wxRibbonToolBarEvent
& evt
);
128 void OnPositionLeft(wxRibbonToolBarEvent
& evt
);
129 void OnPositionLeftLabels(wxCommandEvent
& evt
);
130 void OnPositionLeftIcons(wxCommandEvent
& evt
);
131 void OnPositionLeftBoth(wxCommandEvent
& evt
);
132 void OnPositionLeftDropdown(wxRibbonToolBarEvent
& evt
);
133 void OnRemovePage(wxRibbonButtonBarEvent
& evt
);
134 void OnHidePages(wxRibbonButtonBarEvent
& evt
);
135 void OnShowPages(wxRibbonButtonBarEvent
& evt
);
136 void OnTogglePanels(wxCommandEvent
& evt
);
138 void OnExtButton(wxRibbonPanelEvent
& evt
);
141 wxRibbonGallery
* PopulateColoursPanel(wxWindow
* panel
, wxColour def
,
143 void AddText(wxString msg
);
144 wxRibbonGalleryItem
* AddColourToGallery(wxRibbonGallery
*gallery
,
145 wxString name
, wxMemoryDC
& dc
, wxColour
* value
= NULL
);
146 wxColour
GetGalleryColour(wxRibbonGallery
*gallery
,
147 wxRibbonGalleryItem
* item
, wxString
* name
);
148 void ResetGalleryArtProviders();
149 void SetArtProvider(wxRibbonArtProvider
* prov
);
150 void SetBarStyle(long style
);
152 wxRibbonBar
* m_ribbon
;
153 wxRibbonGallery
* m_primary_gallery
;
154 wxRibbonGallery
* m_secondary_gallery
;
155 wxTextCtrl
* m_logwindow
;
156 wxToggleButton
* m_togglePanels
;
158 wxColourData m_colour_data
;
159 wxColour m_default_primary
;
160 wxColour m_default_secondary
;
161 wxColour m_default_tertiary
;
162 wxMemoryDC m_bitmap_creation_dc
;
167 DECLARE_EVENT_TABLE()
170 // -- implementations --
177 wxFrame
* frame
= new MyFrame
;
183 BEGIN_EVENT_TABLE(MyFrame
, wxFrame
)
184 EVT_RIBBONBUTTONBAR_CLICKED(ID_ENABLE
, MyFrame::OnEnable
)
185 EVT_RIBBONBUTTONBAR_CLICKED(ID_DISABLE
, MyFrame::OnDisable
)
186 EVT_UPDATE_UI(ID_UI_ENABLE_UPDATED
, MyFrame::OnEnableUpdateUI
)
187 EVT_RIBBONBUTTONBAR_CLICKED(ID_CHECK
, MyFrame::OnCheck
)
188 EVT_UPDATE_UI(ID_UI_CHECK_UPDATED
, MyFrame::OnCheckUpdateUI
)
189 EVT_RIBBONBUTTONBAR_CLICKED(ID_CHANGE_TEXT1
, MyFrame::OnChangeText1
)
190 EVT_RIBBONBUTTONBAR_CLICKED(ID_CHANGE_TEXT2
, MyFrame::OnChangeText2
)
191 EVT_UPDATE_UI(ID_UI_CHANGE_TEXT_UPDATED
, MyFrame::OnChangeTextUpdateUI
)
192 EVT_RIBBONBUTTONBAR_CLICKED(ID_DEFAULT_PROVIDER
, MyFrame::OnDefaultProvider
)
193 EVT_RIBBONBUTTONBAR_CLICKED(ID_AUI_PROVIDER
, MyFrame::OnAUIProvider
)
194 EVT_RIBBONBUTTONBAR_CLICKED(ID_MSW_PROVIDER
, MyFrame::OnMSWProvider
)
195 EVT_RIBBONBUTTONBAR_CLICKED(ID_SELECTION_EXPAND_H
, MyFrame::OnSelectionExpandHButton
)
196 EVT_RIBBONBUTTONBAR_CLICKED(ID_SELECTION_EXPAND_V
, MyFrame::OnSelectionExpandVButton
)
197 EVT_RIBBONBUTTONBAR_CLICKED(ID_SELECTION_CONTRACT
, MyFrame::OnSelectionContractButton
)
198 EVT_RIBBONBUTTONBAR_CLICKED(ID_CIRCLE
, MyFrame::OnCircleButton
)
199 EVT_RIBBONBUTTONBAR_CLICKED(ID_CROSS
, MyFrame::OnCrossButton
)
200 EVT_RIBBONBUTTONBAR_CLICKED(ID_TRIANGLE
, MyFrame::OnTriangleButton
)
201 EVT_RIBBONBUTTONBAR_CLICKED(ID_SQUARE
, MyFrame::OnSquareButton
)
202 EVT_RIBBONBUTTONBAR_DROPDOWN_CLICKED(ID_TRIANGLE
, MyFrame::OnTriangleDropdown
)
203 EVT_RIBBONBUTTONBAR_DROPDOWN_CLICKED(ID_POLYGON
, MyFrame::OnPolygonDropdown
)
204 EVT_RIBBONGALLERY_HOVER_CHANGED(ID_PRIMARY_COLOUR
, MyFrame::OnHoveredColourChange
)
205 EVT_RIBBONGALLERY_HOVER_CHANGED(ID_SECONDARY_COLOUR
, MyFrame::OnHoveredColourChange
)
206 EVT_RIBBONGALLERY_SELECTED(ID_PRIMARY_COLOUR
, MyFrame::OnPrimaryColourSelect
)
207 EVT_RIBBONGALLERY_SELECTED(ID_SECONDARY_COLOUR
, MyFrame::OnSecondaryColourSelect
)
208 EVT_RIBBONTOOLBAR_CLICKED(wxID_JUSTIFY_LEFT
, MyFrame::OnJustify
)
209 EVT_RIBBONTOOLBAR_CLICKED(wxID_JUSTIFY_CENTER
, MyFrame::OnJustify
)
210 EVT_RIBBONTOOLBAR_CLICKED(wxID_JUSTIFY_RIGHT
, MyFrame::OnJustify
)
211 EVT_UPDATE_UI(wxID_JUSTIFY_LEFT
, MyFrame::OnJustifyUpdateUI
)
212 EVT_UPDATE_UI(wxID_JUSTIFY_CENTER
, MyFrame::OnJustifyUpdateUI
)
213 EVT_UPDATE_UI(wxID_JUSTIFY_RIGHT
, MyFrame::OnJustifyUpdateUI
)
214 EVT_RIBBONTOOLBAR_CLICKED(wxID_NEW
, MyFrame::OnNew
)
215 EVT_RIBBONTOOLBAR_DROPDOWN_CLICKED(wxID_NEW
, MyFrame::OnNewDropdown
)
216 EVT_RIBBONTOOLBAR_CLICKED(wxID_PRINT
, MyFrame::OnPrint
)
217 EVT_RIBBONTOOLBAR_DROPDOWN_CLICKED(wxID_PRINT
, MyFrame::OnPrintDropdown
)
218 EVT_RIBBONTOOLBAR_DROPDOWN_CLICKED(wxID_REDO
, MyFrame::OnRedoDropdown
)
219 EVT_RIBBONTOOLBAR_DROPDOWN_CLICKED(wxID_UNDO
, MyFrame::OnUndoDropdown
)
220 EVT_RIBBONTOOLBAR_CLICKED(ID_POSITION_LEFT
, MyFrame::OnPositionLeft
)
221 EVT_RIBBONTOOLBAR_DROPDOWN_CLICKED(ID_POSITION_LEFT
, MyFrame::OnPositionLeftDropdown
)
222 EVT_RIBBONTOOLBAR_CLICKED(ID_POSITION_TOP
, MyFrame::OnPositionTop
)
223 EVT_RIBBONTOOLBAR_DROPDOWN_CLICKED(ID_POSITION_TOP
, MyFrame::OnPositionTopDropdown
)
224 EVT_BUTTON(ID_PRIMARY_COLOUR
, MyFrame::OnColourGalleryButton
)
225 EVT_BUTTON(ID_SECONDARY_COLOUR
, MyFrame::OnColourGalleryButton
)
226 EVT_MENU(ID_POSITION_LEFT
, MyFrame::OnPositionLeftIcons
)
227 EVT_MENU(ID_POSITION_LEFT_LABELS
, MyFrame::OnPositionLeftLabels
)
228 EVT_MENU(ID_POSITION_LEFT_BOTH
, MyFrame::OnPositionLeftBoth
)
229 EVT_MENU(ID_POSITION_TOP
, MyFrame::OnPositionTopLabels
)
230 EVT_MENU(ID_POSITION_TOP_ICONS
, MyFrame::OnPositionTopIcons
)
231 EVT_MENU(ID_POSITION_TOP_BOTH
, MyFrame::OnPositionTopBoth
)
232 EVT_TOGGLEBUTTON(ID_TOGGLE_PANELS
, MyFrame::OnTogglePanels
)
233 EVT_RIBBONPANEL_EXTBUTTON_ACTIVATED(wxID_ANY
, MyFrame::OnExtButton
)
234 EVT_RIBBONBUTTONBAR_CLICKED(ID_REMOVE_PAGE
, MyFrame::OnRemovePage
)
235 EVT_RIBBONBUTTONBAR_CLICKED(ID_HIDE_PAGES
, MyFrame::OnHidePages
)
236 EVT_RIBBONBUTTONBAR_CLICKED(ID_SHOW_PAGES
, MyFrame::OnShowPages
)
239 #include "align_center.xpm"
240 #include "align_left.xpm"
241 #include "align_right.xpm"
242 #include "aui_style.xpm"
243 #include "auto_crop_selection.xpm"
244 #include "auto_crop_selection_small.xpm"
245 #include "circle.xpm"
246 #include "circle_small.xpm"
247 #include "colours.xpm"
250 #include "expand_selection_v.xpm"
251 #include "expand_selection_h.xpm"
253 #include "hexagon.xpm"
254 #include "msw_style.xpm"
255 #include "position_left_small.xpm"
256 #include "position_top_small.xpm"
257 #include "ribbon.xpm"
258 #include "selection_panel.xpm"
259 #include "square.xpm"
260 #include "triangle.xpm"
263 : wxFrame(NULL
, wxID_ANY
, wxT("wxRibbon Sample Application"), wxDefaultPosition
, wxSize(800, 600), wxDEFAULT_FRAME_STYLE
)
265 m_ribbon
= new wxRibbonBar(this, wxID_ANY
,
266 wxDefaultPosition
, wxDefaultSize
,
267 wxRIBBON_BAR_DEFAULT_STYLE
|
268 wxRIBBON_BAR_SHOW_PANEL_EXT_BUTTONS
);
271 wxRibbonPage
* home
= new wxRibbonPage(m_ribbon
, wxID_ANY
, wxT("Examples"), ribbon_xpm
);
272 wxRibbonPanel
*toolbar_panel
= new wxRibbonPanel(home
, wxID_ANY
, wxT("Toolbar"),
273 wxNullBitmap
, wxDefaultPosition
, wxDefaultSize
,
274 wxRIBBON_PANEL_NO_AUTO_MINIMISE
|
275 wxRIBBON_PANEL_EXT_BUTTON
);
276 wxRibbonToolBar
*toolbar
= new wxRibbonToolBar(toolbar_panel
, ID_MAIN_TOOLBAR
);
277 toolbar
->AddToggleTool(wxID_JUSTIFY_LEFT
, align_left_xpm
);
278 toolbar
->AddToggleTool(wxID_JUSTIFY_CENTER
, align_center_xpm
);
279 toolbar
->AddToggleTool(wxID_JUSTIFY_RIGHT
, align_right_xpm
);
280 toolbar
->AddSeparator();
281 toolbar
->AddHybridTool(wxID_NEW
, wxArtProvider::GetBitmap(wxART_NEW
, wxART_OTHER
, wxSize(16, 15)));
282 toolbar
->AddTool(wxID_OPEN
, wxArtProvider::GetBitmap(wxART_FILE_OPEN
, wxART_OTHER
, wxSize(16, 15)), "Open something");
283 toolbar
->AddTool(wxID_SAVE
, wxArtProvider::GetBitmap(wxART_FILE_SAVE
, wxART_OTHER
, wxSize(16, 15)), "Save something");
284 toolbar
->AddTool(wxID_SAVEAS
, wxArtProvider::GetBitmap(wxART_FILE_SAVE_AS
, wxART_OTHER
, wxSize(16, 15)), "Save something as ...");
285 toolbar
->EnableTool(wxID_OPEN
, false);
286 toolbar
->EnableTool(wxID_SAVE
, false);
287 toolbar
->EnableTool(wxID_SAVEAS
, false);
288 toolbar
->AddSeparator();
289 toolbar
->AddDropdownTool(wxID_UNDO
, wxArtProvider::GetBitmap(wxART_UNDO
, wxART_OTHER
, wxSize(16, 15)));
290 toolbar
->AddDropdownTool(wxID_REDO
, wxArtProvider::GetBitmap(wxART_REDO
, wxART_OTHER
, wxSize(16, 15)));
291 toolbar
->AddSeparator();
292 toolbar
->AddTool(wxID_ANY
, wxArtProvider::GetBitmap(wxART_REPORT_VIEW
, wxART_OTHER
, wxSize(16, 15)));
293 toolbar
->AddTool(wxID_ANY
, wxArtProvider::GetBitmap(wxART_LIST_VIEW
, wxART_OTHER
, wxSize(16, 15)));
294 toolbar
->AddSeparator();
295 toolbar
->AddHybridTool(ID_POSITION_LEFT
, position_left_xpm
,
296 "Align ribbonbar vertically\non the left\nfor demonstration purposes");
297 toolbar
->AddHybridTool(ID_POSITION_TOP
, position_top_xpm
,
298 "Align the ribbonbar horizontally\nat the top\nfor demonstration purposes");
299 toolbar
->AddSeparator();
300 toolbar
->AddHybridTool(wxID_PRINT
, wxArtProvider::GetBitmap(wxART_PRINT
, wxART_OTHER
, wxSize(16, 15)),
301 "This is the Print button tooltip\ndemonstrating a tooltip");
302 toolbar
->SetRows(2, 3);
304 wxRibbonPanel
*selection_panel
= new wxRibbonPanel(home
, wxID_ANY
, wxT("Selection"), wxBitmap(selection_panel_xpm
));
305 wxRibbonButtonBar
*selection
= new wxRibbonButtonBar(selection_panel
);
306 selection
->AddButton(ID_SELECTION_EXPAND_V
, wxT("Expand Vertically"), wxBitmap(expand_selection_v_xpm
),
307 "This is a tooltip for Expand Vertically\ndemonstrating a tooltip");
308 selection
->AddButton(ID_SELECTION_EXPAND_H
, wxT("Expand Horizontally"), wxBitmap(expand_selection_h_xpm
), wxEmptyString
);
309 selection
->AddButton(ID_SELECTION_CONTRACT
, wxT("Contract"), wxBitmap(auto_crop_selection_xpm
), wxBitmap(auto_crop_selection_small_xpm
));
311 wxRibbonPanel
*shapes_panel
= new wxRibbonPanel(home
, wxID_ANY
, wxT("Shapes"), wxBitmap(circle_small_xpm
));
312 wxRibbonButtonBar
*shapes
= new wxRibbonButtonBar(shapes_panel
);
313 shapes
->AddButton(ID_CIRCLE
, wxT("Circle"), wxBitmap(circle_xpm
), wxBitmap(circle_small_xpm
),
314 wxNullBitmap
, wxNullBitmap
, wxRIBBON_BUTTON_NORMAL
,
315 "This is a tooltip for the circle button\ndemonstrating another tooltip");
316 shapes
->AddButton(ID_CROSS
, wxT("Cross"), wxBitmap(cross_xpm
), wxEmptyString
);
317 shapes
->AddHybridButton(ID_TRIANGLE
, wxT("Triangle"), wxBitmap(triangle_xpm
));
318 shapes
->AddButton(ID_SQUARE
, wxT("Square"), wxBitmap(square_xpm
), wxEmptyString
);
319 shapes
->AddDropdownButton(ID_POLYGON
, wxT("Other Polygon"), wxBitmap(hexagon_xpm
), wxEmptyString
);
321 wxRibbonPanel
*sizer_panel
= new wxRibbonPanel(home
, wxID_ANY
, wxT("Panel with Sizer"),
322 wxNullBitmap
, wxDefaultPosition
, wxDefaultSize
,
323 wxRIBBON_PANEL_DEFAULT_STYLE
);
326 as
.Add("Item 1 using a box sizer now");
327 as
.Add("Item 2 using a box sizer now");
328 wxComboBox
* sizer_panelcombo
= new wxComboBox(sizer_panel
, wxID_ANY
,
330 wxDefaultPosition
, wxDefaultSize
,
333 wxComboBox
* sizer_panelcombo2
= new wxComboBox(sizer_panel
, wxID_ANY
,
335 wxDefaultPosition
, wxDefaultSize
,
338 sizer_panelcombo
->Select(0);
339 sizer_panelcombo2
->Select(1);
340 sizer_panelcombo
->SetMinSize(wxSize(150, -1));
341 sizer_panelcombo2
->SetMinSize(wxSize(150, -1));
343 //not using wxWrapSizer(wxHORIZONTAL) as it reports an incorrect min height
344 wxSizer
* sizer_panelsizer
= new wxBoxSizer(wxVERTICAL
);
345 sizer_panelsizer
->AddStretchSpacer(1);
346 sizer_panelsizer
->Add(sizer_panelcombo
, 0, wxALL
|wxEXPAND
, 2);
347 sizer_panelsizer
->Add(sizer_panelcombo2
, 0, wxALL
|wxEXPAND
, 2);
348 sizer_panelsizer
->AddStretchSpacer(1);
349 sizer_panel
->SetSizer(sizer_panelsizer
);
351 wxFont
label_font(8, wxFONTFAMILY_DEFAULT
, wxFONTSTYLE_NORMAL
, wxFONTWEIGHT_LIGHT
);
352 m_bitmap_creation_dc
.SetFont(label_font
);
354 wxRibbonPage
* scheme
= new wxRibbonPage(m_ribbon
, wxID_ANY
, wxT("Appearance"), eye_xpm
);
355 m_ribbon
->GetArtProvider()->GetColourScheme(&m_default_primary
,
356 &m_default_secondary
, &m_default_tertiary
);
357 wxRibbonPanel
*provider_panel
= new wxRibbonPanel(scheme
, wxID_ANY
,
358 wxT("Art"), wxNullBitmap
, wxDefaultPosition
, wxDefaultSize
, wxRIBBON_PANEL_NO_AUTO_MINIMISE
);
359 wxRibbonButtonBar
*provider_bar
= new wxRibbonButtonBar(provider_panel
, wxID_ANY
);
360 provider_bar
->AddButton(ID_DEFAULT_PROVIDER
, wxT("Default Provider"),
361 wxArtProvider::GetBitmap(wxART_QUESTION
, wxART_OTHER
, wxSize(32, 32)));
362 provider_bar
->AddButton(ID_AUI_PROVIDER
, wxT("AUI Provider"), aui_style_xpm
);
363 provider_bar
->AddButton(ID_MSW_PROVIDER
, wxT("MSW Provider"), msw_style_xpm
);
364 wxRibbonPanel
*primary_panel
= new wxRibbonPanel(scheme
, wxID_ANY
,
365 wxT("Primary Colour"), colours_xpm
);
366 m_primary_gallery
= PopulateColoursPanel(primary_panel
,
367 m_default_primary
, ID_PRIMARY_COLOUR
);
368 wxRibbonPanel
*secondary_panel
= new wxRibbonPanel(scheme
, wxID_ANY
,
369 wxT("Secondary Colour"), colours_xpm
);
370 m_secondary_gallery
= PopulateColoursPanel(secondary_panel
,
371 m_default_secondary
, ID_SECONDARY_COLOUR
);
374 wxRibbonPage
* page
= new wxRibbonPage(m_ribbon
, wxID_ANY
, wxT("UI Updated"), ribbon_xpm
);
375 wxRibbonPanel
*panel
= new wxRibbonPanel(page
, wxID_ANY
, wxT("Enable/Disable"), ribbon_xpm
);
376 wxRibbonButtonBar
*bar
= new wxRibbonButtonBar(panel
, wxID_ANY
);
377 bar
->AddButton(ID_DISABLED
, wxT("Disabled"), ribbon_xpm
);
378 bar
->AddButton(ID_ENABLE
, wxT("Enable"), ribbon_xpm
);
379 bar
->AddButton(ID_DISABLE
, wxT("Disable"), ribbon_xpm
);
380 bar
->AddButton(ID_UI_ENABLE_UPDATED
, wxT("Enable UI updated"), ribbon_xpm
);
381 bar
->EnableButton(ID_DISABLED
, false);
384 panel
= new wxRibbonPanel(page
, wxID_ANY
, wxT("Toggle"), ribbon_xpm
);
385 bar
= new wxRibbonButtonBar(panel
, wxID_ANY
);
386 bar
->AddButton(ID_CHECK
, wxT("Toggle"), ribbon_xpm
);
387 bar
->AddToggleButton(ID_UI_CHECK_UPDATED
, wxT("Toggled UI updated"), ribbon_xpm
);
390 panel
= new wxRibbonPanel(page
, wxID_ANY
, wxT("Change text"), ribbon_xpm
);
391 bar
= new wxRibbonButtonBar(panel
, wxID_ANY
);
392 bar
->AddButton(ID_CHANGE_TEXT1
, wxT("One"), ribbon_xpm
);
393 bar
->AddButton(ID_CHANGE_TEXT2
, wxT("Two"), ribbon_xpm
);
394 bar
->AddButton(ID_UI_CHANGE_TEXT_UPDATED
, wxT("Zero"), ribbon_xpm
);
396 new wxRibbonPage(m_ribbon
, wxID_ANY
, wxT("Empty Page"), empty_xpm
);
398 wxRibbonPage
* page
= new wxRibbonPage(m_ribbon
, wxID_ANY
, wxT("Another Page"), empty_xpm
);
399 wxRibbonPanel
*panel
= new wxRibbonPanel(page
, wxID_ANY
, wxT("Page manipulation"), ribbon_xpm
);
400 wxRibbonButtonBar
*bar
= new wxRibbonButtonBar(panel
, wxID_ANY
);
401 bar
->AddButton(ID_REMOVE_PAGE
, wxT("Remove"), wxArtProvider::GetBitmap(wxART_DELETE
, wxART_OTHER
, wxSize(24, 24)));
402 bar
->AddButton(ID_HIDE_PAGES
, wxT("Hide Pages"), ribbon_xpm
);
403 bar
->AddButton(ID_SHOW_PAGES
, wxT("Show Pages"), ribbon_xpm
);
408 m_logwindow
= new wxTextCtrl(this, wxID_ANY
, wxEmptyString
,
409 wxDefaultPosition
, wxDefaultSize
, wxTE_MULTILINE
| wxTE_READONLY
|
410 wxTE_LEFT
| wxTE_BESTWRAP
| wxBORDER_NONE
);
412 m_togglePanels
= new wxToggleButton(this, ID_TOGGLE_PANELS
, "&Toggle panels");
413 m_togglePanels
->SetValue(true);
415 wxSizer
*s
= new wxBoxSizer(wxVERTICAL
);
417 s
->Add(m_ribbon
, 0, wxEXPAND
);
418 s
->Add(m_logwindow
, 1, wxEXPAND
);
419 s
->Add(m_togglePanels
, wxSizerFlags().Border());
424 void MyFrame::SetBarStyle(long style
)
427 m_ribbon
->SetWindowStyleFlag(style
);
428 wxBoxSizer
*pTopSize
= reinterpret_cast<wxBoxSizer
*>(GetSizer());
429 wxRibbonToolBar
*pToolbar
= wxDynamicCast(FindWindow(ID_MAIN_TOOLBAR
), wxRibbonToolBar
);
430 if(style
& wxRIBBON_BAR_FLOW_VERTICAL
)
432 m_ribbon
->SetTabCtrlMargins(10, 10);
433 pTopSize
->SetOrientation(wxHORIZONTAL
);
435 pToolbar
->SetRows(3, 5);
439 m_ribbon
->SetTabCtrlMargins(50, 20);
440 pTopSize
->SetOrientation(wxVERTICAL
);
442 pToolbar
->SetRows(2, 3);
453 class ColourClientData
: public wxClientData
456 ColourClientData(const wxString
& name
, const wxColour
& colour
)
457 : m_name(name
), m_colour(colour
) {}
459 const wxString
& GetName() const {return m_name
;}
460 const wxColour
& GetColour() const {return m_colour
;}
467 wxRibbonGallery
* MyFrame::PopulateColoursPanel(wxWindow
* panel
,
468 wxColour def
, int gallery_id
)
470 wxRibbonGallery
*gallery
= wxDynamicCast(panel
->FindWindow(gallery_id
), wxRibbonGallery
);
474 gallery
= new wxRibbonGallery(panel
, gallery_id
);
475 wxMemoryDC
& dc
= m_bitmap_creation_dc
;
476 wxRibbonGalleryItem
*def_item
=
477 AddColourToGallery(gallery
, wxT("Default"), dc
, &def
);
478 gallery
->SetSelection(def_item
);
479 AddColourToGallery(gallery
, wxT("BLUE"), dc
);
480 AddColourToGallery(gallery
, wxT("BLUE VIOLET"), dc
);
481 AddColourToGallery(gallery
, wxT("BROWN"), dc
);
482 AddColourToGallery(gallery
, wxT("CADET BLUE"), dc
);
483 AddColourToGallery(gallery
, wxT("CORAL"), dc
);
484 AddColourToGallery(gallery
, wxT("CYAN"), dc
);
485 AddColourToGallery(gallery
, wxT("DARK GREEN"), dc
);
486 AddColourToGallery(gallery
, wxT("DARK ORCHID"), dc
);
487 AddColourToGallery(gallery
, wxT("FIREBRICK"), dc
);
488 AddColourToGallery(gallery
, wxT("GOLD"), dc
);
489 AddColourToGallery(gallery
, wxT("GOLDENROD"), dc
);
490 AddColourToGallery(gallery
, wxT("GREEN"), dc
);
491 AddColourToGallery(gallery
, wxT("INDIAN RED"), dc
);
492 AddColourToGallery(gallery
, wxT("KHAKI"), dc
);
493 AddColourToGallery(gallery
, wxT("LIGHT BLUE"), dc
);
494 AddColourToGallery(gallery
, wxT("LIME GREEN"), dc
);
495 AddColourToGallery(gallery
, wxT("MAGENTA"), dc
);
496 AddColourToGallery(gallery
, wxT("MAROON"), dc
);
497 AddColourToGallery(gallery
, wxT("NAVY"), dc
);
498 AddColourToGallery(gallery
, wxT("ORANGE"), dc
);
499 AddColourToGallery(gallery
, wxT("ORCHID"), dc
);
500 AddColourToGallery(gallery
, wxT("PINK"), dc
);
501 AddColourToGallery(gallery
, wxT("PLUM"), dc
);
502 AddColourToGallery(gallery
, wxT("PURPLE"), dc
);
503 AddColourToGallery(gallery
, wxT("RED"), dc
);
504 AddColourToGallery(gallery
, wxT("SALMON"), dc
);
505 AddColourToGallery(gallery
, wxT("SEA GREEN"), dc
);
506 AddColourToGallery(gallery
, wxT("SIENNA"), dc
);
507 AddColourToGallery(gallery
, wxT("SKY BLUE"), dc
);
508 AddColourToGallery(gallery
, wxT("TAN"), dc
);
509 AddColourToGallery(gallery
, wxT("THISTLE"), dc
);
510 AddColourToGallery(gallery
, wxT("TURQUOISE"), dc
);
511 AddColourToGallery(gallery
, wxT("VIOLET"), dc
);
512 AddColourToGallery(gallery
, wxT("VIOLET RED"), dc
);
513 AddColourToGallery(gallery
, wxT("WHEAT"), dc
);
514 AddColourToGallery(gallery
, wxT("WHITE"), dc
);
515 AddColourToGallery(gallery
, wxT("YELLOW"), dc
);
520 wxColour
MyFrame::GetGalleryColour(wxRibbonGallery
*gallery
,
521 wxRibbonGalleryItem
* item
, wxString
* name
)
523 ColourClientData
*data
= (ColourClientData
*)gallery
->GetItemClientObject(item
);
525 *name
= data
->GetName();
526 return data
->GetColour();
529 void MyFrame::OnHoveredColourChange(wxRibbonGalleryEvent
& evt
)
531 // Set the background of the gallery to the hovered colour, or back to the
532 // default if there is no longer a hovered item.
534 wxRibbonGallery
*gallery
= evt
.GetGallery();
535 wxRibbonArtProvider
*provider
= gallery
->GetArtProvider();
537 if(evt
.GetGalleryItem() != NULL
)
539 if(provider
== m_ribbon
->GetArtProvider())
541 provider
= provider
->Clone();
542 gallery
->SetArtProvider(provider
);
544 provider
->SetColour(wxRIBBON_ART_GALLERY_HOVER_BACKGROUND_COLOUR
,
545 GetGalleryColour(evt
.GetGallery(), evt
.GetGalleryItem(), NULL
));
549 if(provider
!= m_ribbon
->GetArtProvider())
551 gallery
->SetArtProvider(m_ribbon
->GetArtProvider());
557 void MyFrame::OnPrimaryColourSelect(wxRibbonGalleryEvent
& evt
)
560 wxColour colour
= GetGalleryColour(evt
.GetGallery(), evt
.GetGalleryItem(), &name
);
561 AddText(wxT("Colour \"") + name
+ wxT("\" selected as primary."));
562 wxColour secondary
, tertiary
;
563 m_ribbon
->GetArtProvider()->GetColourScheme(NULL
, &secondary
, &tertiary
);
564 m_ribbon
->GetArtProvider()->SetColourScheme(colour
, secondary
, tertiary
);
565 ResetGalleryArtProviders();
569 void MyFrame::OnSecondaryColourSelect(wxRibbonGalleryEvent
& evt
)
572 wxColour colour
= GetGalleryColour(evt
.GetGallery(), evt
.GetGalleryItem(), &name
);
573 AddText(wxT("Colour \"") + name
+ wxT("\" selected as secondary."));
574 wxColour primary
, tertiary
;
575 m_ribbon
->GetArtProvider()->GetColourScheme(&primary
, NULL
, &tertiary
);
576 m_ribbon
->GetArtProvider()->SetColourScheme(primary
, colour
, tertiary
);
577 ResetGalleryArtProviders();
581 void MyFrame::ResetGalleryArtProviders()
583 if(m_primary_gallery
->GetArtProvider() != m_ribbon
->GetArtProvider())
585 delete m_primary_gallery
->GetArtProvider();
586 m_primary_gallery
->SetArtProvider(m_ribbon
->GetArtProvider());
588 if(m_secondary_gallery
->GetArtProvider() != m_ribbon
->GetArtProvider())
590 delete m_secondary_gallery
->GetArtProvider();
591 m_secondary_gallery
->SetArtProvider(m_ribbon
->GetArtProvider());
595 void MyFrame::OnChangeText1(wxRibbonButtonBarEvent
& WXUNUSED(evt
))
597 m_new_text
= wxT("One");
600 void MyFrame::OnChangeText2(wxRibbonButtonBarEvent
& WXUNUSED(evt
))
602 m_new_text
= wxT("Two");
605 void MyFrame::OnEnable(wxRibbonButtonBarEvent
& WXUNUSED(evt
))
610 void MyFrame::OnDisable(wxRibbonButtonBarEvent
& WXUNUSED(evt
))
615 void MyFrame::OnCheck(wxRibbonButtonBarEvent
& WXUNUSED(evt
))
617 m_bChecked
= !m_bChecked
;
620 void MyFrame::OnEnableUpdateUI(wxUpdateUIEvent
& evt
)
622 evt
.Enable(m_bEnabled
);
625 void MyFrame::OnCheckUpdateUI(wxUpdateUIEvent
& evt
)
627 evt
.Check(m_bChecked
);
630 void MyFrame::OnChangeTextUpdateUI(wxUpdateUIEvent
& evt
)
632 if ( !m_new_text
.IsEmpty() )
634 evt
.SetText(m_new_text
);
635 m_new_text
= wxT("");
639 void MyFrame::OnSelectionExpandHButton(wxRibbonButtonBarEvent
& WXUNUSED(evt
))
641 AddText(wxT("Expand selection horizontally button clicked."));
644 void MyFrame::OnSelectionExpandVButton(wxRibbonButtonBarEvent
& WXUNUSED(evt
))
646 AddText(wxT("Expand selection vertically button clicked."));
649 void MyFrame::OnSelectionContractButton(wxRibbonButtonBarEvent
& WXUNUSED(evt
))
651 AddText(wxT("Contract selection button clicked."));
654 void MyFrame::OnCircleButton(wxRibbonButtonBarEvent
& WXUNUSED(evt
))
656 AddText(wxT("Circle button clicked."));
659 void MyFrame::OnCrossButton(wxRibbonButtonBarEvent
& WXUNUSED(evt
))
661 AddText(wxT("Cross button clicked."));
664 void MyFrame::OnTriangleButton(wxRibbonButtonBarEvent
& WXUNUSED(evt
))
666 AddText(wxT("Triangle button clicked."));
669 void MyFrame::OnTriangleDropdown(wxRibbonButtonBarEvent
& evt
)
672 menu
.Append(wxID_ANY
, wxT("Equilateral"));
673 menu
.Append(wxID_ANY
, wxT("Isosceles"));
674 menu
.Append(wxID_ANY
, wxT("Scalene"));
676 evt
.PopupMenu(&menu
);
679 void MyFrame::OnSquareButton(wxRibbonButtonBarEvent
& WXUNUSED(evt
))
681 AddText(wxT("Square button clicked."));
684 void MyFrame::OnPolygonDropdown(wxRibbonButtonBarEvent
& evt
)
687 menu
.Append(wxID_ANY
, wxT("Pentagon (5 sided)"));
688 menu
.Append(wxID_ANY
, wxT("Hexagon (6 sided)"));
689 menu
.Append(wxID_ANY
, wxT("Heptagon (7 sided)"));
690 menu
.Append(wxID_ANY
, wxT("Octogon (8 sided)"));
691 menu
.Append(wxID_ANY
, wxT("Nonagon (9 sided)"));
692 menu
.Append(wxID_ANY
, wxT("Decagon (10 sided)"));
694 evt
.PopupMenu(&menu
);
697 void MyFrame::OnJustify(wxRibbonToolBarEvent
& evt
)
699 long style
= m_logwindow
->GetWindowStyle() &
700 ~(wxTE_LEFT
| wxTE_CENTER
| wxTE_RIGHT
);
703 case wxID_JUSTIFY_LEFT
:
704 m_logwindow
->SetWindowStyle(style
| wxTE_LEFT
);
706 case wxID_JUSTIFY_CENTER
:
707 m_logwindow
->SetWindowStyle(style
| wxTE_CENTER
);
709 case wxID_JUSTIFY_RIGHT
:
710 m_logwindow
->SetWindowStyle(style
| wxTE_RIGHT
);
715 void MyFrame::OnJustifyUpdateUI(wxUpdateUIEvent
& evt
)
719 case wxID_JUSTIFY_LEFT
:
720 evt
.Check(!m_logwindow
->HasFlag(wxTE_CENTER
| wxTE_RIGHT
));
722 case wxID_JUSTIFY_CENTER
:
723 evt
.Check(m_logwindow
->HasFlag(wxTE_CENTER
));
725 case wxID_JUSTIFY_RIGHT
:
726 evt
.Check(m_logwindow
->HasFlag(wxTE_RIGHT
));
731 void MyFrame::OnNew(wxRibbonToolBarEvent
& WXUNUSED(evt
))
733 AddText(wxT("New button clicked."));
736 void MyFrame::OnNewDropdown(wxRibbonToolBarEvent
& evt
)
739 menu
.Append(wxID_ANY
, wxT("New Document"));
740 menu
.Append(wxID_ANY
, wxT("New Template"));
741 menu
.Append(wxID_ANY
, wxT("New Mail"));
743 evt
.PopupMenu(&menu
);
746 void MyFrame::OnPrint(wxRibbonToolBarEvent
& WXUNUSED(evt
))
748 AddText(wxT("Print button clicked."));
751 void MyFrame::OnPrintDropdown(wxRibbonToolBarEvent
& evt
)
754 menu
.Append(wxID_ANY
, wxT("Print"));
755 menu
.Append(wxID_ANY
, wxT("Preview"));
756 menu
.Append(wxID_ANY
, wxT("Options"));
758 evt
.PopupMenu(&menu
);
761 void MyFrame::OnRedoDropdown(wxRibbonToolBarEvent
& evt
)
764 menu
.Append(wxID_ANY
, wxT("Redo E"));
765 menu
.Append(wxID_ANY
, wxT("Redo F"));
766 menu
.Append(wxID_ANY
, wxT("Redo G"));
768 evt
.PopupMenu(&menu
);
771 void MyFrame::OnUndoDropdown(wxRibbonToolBarEvent
& evt
)
774 menu
.Append(wxID_ANY
, wxT("Undo C"));
775 menu
.Append(wxID_ANY
, wxT("Undo B"));
776 menu
.Append(wxID_ANY
, wxT("Undo A"));
778 evt
.PopupMenu(&menu
);
781 void MyFrame::OnPositionTopLabels(wxCommandEvent
& WXUNUSED(evt
))
783 SetBarStyle(wxRIBBON_BAR_DEFAULT_STYLE
);
786 void MyFrame::OnPositionTopIcons(wxCommandEvent
& WXUNUSED(evt
))
788 SetBarStyle((wxRIBBON_BAR_DEFAULT_STYLE
&~wxRIBBON_BAR_SHOW_PAGE_LABELS
)
789 | wxRIBBON_BAR_SHOW_PAGE_ICONS
);
792 void MyFrame::OnPositionTopBoth(wxCommandEvent
& WXUNUSED(evt
))
794 SetBarStyle(wxRIBBON_BAR_DEFAULT_STYLE
| wxRIBBON_BAR_SHOW_PAGE_ICONS
);
797 void MyFrame::OnPositionLeftLabels(wxCommandEvent
& WXUNUSED(evt
))
799 SetBarStyle(wxRIBBON_BAR_DEFAULT_STYLE
| wxRIBBON_BAR_FLOW_VERTICAL
);
802 void MyFrame::OnPositionLeftIcons(wxCommandEvent
& WXUNUSED(evt
))
804 SetBarStyle((wxRIBBON_BAR_DEFAULT_STYLE
&~wxRIBBON_BAR_SHOW_PAGE_LABELS
) |
805 wxRIBBON_BAR_SHOW_PAGE_ICONS
| wxRIBBON_BAR_FLOW_VERTICAL
);
808 void MyFrame::OnPositionLeftBoth(wxCommandEvent
& WXUNUSED(evt
))
810 SetBarStyle(wxRIBBON_BAR_DEFAULT_STYLE
| wxRIBBON_BAR_SHOW_PAGE_ICONS
|
811 wxRIBBON_BAR_FLOW_VERTICAL
);
814 void MyFrame::OnPositionTop(wxRibbonToolBarEvent
& evt
)
816 OnPositionTopLabels(evt
);
819 void MyFrame::OnPositionTopDropdown(wxRibbonToolBarEvent
& evt
)
822 menu
.Append(ID_POSITION_TOP
, wxT("Top with Labels"));
823 menu
.Append(ID_POSITION_TOP_ICONS
, wxT("Top with Icons"));
824 menu
.Append(ID_POSITION_TOP_BOTH
, wxT("Top with Both"));
825 evt
.PopupMenu(&menu
);
828 void MyFrame::OnPositionLeft(wxRibbonToolBarEvent
& evt
)
830 OnPositionLeftIcons(evt
);
833 void MyFrame::OnPositionLeftDropdown(wxRibbonToolBarEvent
& evt
)
836 menu
.Append(ID_POSITION_LEFT
, wxT("Left with Icons"));
837 menu
.Append(ID_POSITION_LEFT_LABELS
, wxT("Left with Labels"));
838 menu
.Append(ID_POSITION_LEFT_BOTH
, wxT("Left with Both"));
839 evt
.PopupMenu(&menu
);
842 void MyFrame::OnTogglePanels(wxCommandEvent
& WXUNUSED(evt
))
844 m_ribbon
->ShowPanels(m_togglePanels
->GetValue());
847 void MyFrame::OnExtButton(wxRibbonPanelEvent
& WXUNUSED(evt
))
849 wxMessageBox("Extension button clicked");
852 void MyFrame::AddText(wxString msg
)
854 m_logwindow
->AppendText(msg
);
855 m_logwindow
->AppendText(wxT("\n"));
856 m_ribbon
->DismissExpandedPanel();
859 wxRibbonGalleryItem
* MyFrame::AddColourToGallery(wxRibbonGallery
*gallery
,
860 wxString colour
, wxMemoryDC
& dc
,
863 wxRibbonGalleryItem
* item
= NULL
;
865 if (colour
!= wxT("Default"))
866 c
= wxColour(colour
);
871 const int iWidth
= 64;
872 const int iHeight
= 40;
874 wxBitmap
bitmap(iWidth
, iHeight
);
875 dc
.SelectObject(bitmap
);
877 dc
.SetPen(*wxBLACK_PEN
);
879 dc
.DrawRectangle(0, 0, iWidth
, iHeight
);
881 colour
= colour
.Mid(0, 1) + colour
.Mid(1).Lower();
882 wxSize size
= dc
.GetTextExtent(colour
);
883 wxColour foreground
= wxColour(~c
.Red(), ~c
.Green(), ~c
.Blue());
884 if(abs(foreground
.Red() - c
.Red()) + abs(foreground
.Blue() - c
.Blue())
885 + abs(foreground
.Green() - c
.Green()) < 64)
887 // Foreground too similar to background - use a different
888 // strategy to find a contrasting colour
889 foreground
= wxColour((c
.Red() + 64) % 256, 255 - c
.Green(),
890 (c
.Blue() + 192) % 256);
892 dc
.SetTextForeground(foreground
);
893 dc
.DrawText(colour
, (iWidth
- size
.GetWidth() + 1) / 2,
894 (iHeight
- size
.GetHeight()) / 2);
895 dc
.SelectObjectAsSource(wxNullBitmap
);
897 item
= gallery
->Append(bitmap
, wxID_ANY
);
898 gallery
->SetItemClientObject(item
, new ColourClientData(colour
, c
));
903 void MyFrame::OnColourGalleryButton(wxCommandEvent
& evt
)
905 wxRibbonGallery
*gallery
= wxDynamicCast(evt
.GetEventObject(), wxRibbonGallery
);
909 m_ribbon
->DismissExpandedPanel();
910 if(gallery
->GetSelection())
911 m_colour_data
.SetColour(GetGalleryColour(gallery
, gallery
->GetSelection(), NULL
));
912 wxColourDialog
dlg(this, &m_colour_data
);
913 if(dlg
.ShowModal() == wxID_OK
)
915 m_colour_data
= dlg
.GetColourData();
916 wxColour clr
= m_colour_data
.GetColour();
918 // Try to find colour in gallery
919 wxRibbonGalleryItem
*item
= NULL
;
920 for(unsigned int i
= 0; i
< gallery
->GetCount(); ++i
)
922 item
= gallery
->GetItem(i
);
923 if(GetGalleryColour(gallery
, item
, NULL
) == clr
)
929 // Colour not in gallery - add it
932 item
= AddColourToGallery(gallery
,
933 clr
.GetAsString(wxC2S_HTML_SYNTAX
), m_bitmap_creation_dc
,
939 gallery
->EnsureVisible(item
);
940 gallery
->SetSelection(item
);
942 // Send an event to respond to the selection change
943 wxRibbonGalleryEvent
dummy(wxEVT_COMMAND_RIBBONGALLERY_SELECTED
, gallery
->GetId());
944 dummy
.SetEventObject(gallery
);
945 dummy
.SetGallery(gallery
);
946 dummy
.SetGalleryItem(item
);
947 ProcessWindowEvent(dummy
);
951 void MyFrame::OnDefaultProvider(wxRibbonButtonBarEvent
& WXUNUSED(evt
))
953 m_ribbon
->DismissExpandedPanel();
954 SetArtProvider(new wxRibbonDefaultArtProvider
);
957 void MyFrame::OnAUIProvider(wxRibbonButtonBarEvent
& WXUNUSED(evt
))
959 m_ribbon
->DismissExpandedPanel();
960 SetArtProvider(new wxRibbonAUIArtProvider
);
963 void MyFrame::OnMSWProvider(wxRibbonButtonBarEvent
& WXUNUSED(evt
))
965 m_ribbon
->DismissExpandedPanel();
966 SetArtProvider(new wxRibbonMSWArtProvider
);
969 void MyFrame::SetArtProvider(wxRibbonArtProvider
*prov
)
972 m_ribbon
->SetArtProvider(prov
);
974 prov
->GetColourScheme(&m_default_primary
, &m_default_secondary
,
975 &m_default_tertiary
);
976 PopulateColoursPanel(m_primary_gallery
->GetParent(), m_default_primary
,
978 PopulateColoursPanel(m_secondary_gallery
->GetParent(), m_default_secondary
,
979 ID_SECONDARY_COLOUR
);
983 GetSizer()->Layout();
986 void MyFrame::OnRemovePage(wxRibbonButtonBarEvent
& WXUNUSED(evt
))
988 size_t n
= m_ribbon
->GetPageCount();
991 m_ribbon
->DeletePage(n
-1);
996 void MyFrame::OnHidePages(wxRibbonButtonBarEvent
& WXUNUSED(evt
))
998 m_ribbon
->HidePage(1);
999 m_ribbon
->HidePage(2);
1000 m_ribbon
->HidePage(3);
1001 m_ribbon
->Realize();
1004 void MyFrame::OnShowPages(wxRibbonButtonBarEvent
& WXUNUSED(evt
))
1006 m_ribbon
->ShowPage(1);
1007 m_ribbon
->ShowPage(2);
1008 m_ribbon
->ShowPage(3);
1009 m_ribbon
->Realize();