1 ///////////////////////////////////////////////////////////////////////////////
2 // Name: src/ribbon/art_msw.cpp
3 // Purpose: MSW style art provider for ribbon interface
4 // Author: Peter Cawley
8 // Copyright: (C) Peter Cawley
9 // Licence: wxWindows licence
10 ///////////////////////////////////////////////////////////////////////////////
12 #include "wx/wxprec.h"
18 #include "wx/dcmemory.h"
19 #include "wx/ribbon/art.h"
23 #include "wx/ribbon/art_internal.h"
24 #include "wx/ribbon/bar.h"
25 #include "wx/ribbon/buttonbar.h"
26 #include "wx/ribbon/gallery.h"
27 #include "wx/ribbon/toolbar.h"
33 #include "wx/msw/private.h"
36 static const char* const gallery_up_xpm
[] = {
46 static const char* const gallery_down_xpm
[] = {
56 static const char* const gallery_left_xpm
[] = {
66 static const char* const gallery_right_xpm
[] = {
76 static const char* const gallery_extension_xpm
[] = {
86 wxRibbonMSWArtProvider::wxRibbonMSWArtProvider(bool set_colour_scheme
)
89 m_tab_label_font
= *wxNORMAL_FONT
;
90 m_button_bar_label_font
= m_tab_label_font
;
91 m_panel_label_font
= m_tab_label_font
;
96 wxColour(194, 216, 241),
97 wxColour(255, 223, 114),
101 m_cached_tab_separator_visibility
= -10.0; // valid visibilities are in range [0, 1]
102 m_tab_separation_size
= 3;
103 m_page_border_left
= 2;
104 m_page_border_top
= 1;
105 m_page_border_right
= 2;
106 m_page_border_bottom
= 3;
107 m_panel_x_separation_size
= 1;
108 m_panel_y_separation_size
= 1;
109 m_tool_group_separation_size
= 3;
110 m_gallery_bitmap_padding_left_size
= 4;
111 m_gallery_bitmap_padding_right_size
= 4;
112 m_gallery_bitmap_padding_top_size
= 4;
113 m_gallery_bitmap_padding_bottom_size
= 4;
116 wxRibbonMSWArtProvider::~wxRibbonMSWArtProvider()
120 void wxRibbonMSWArtProvider::GetColourScheme(
123 wxColour
* tertiary
) const
126 *primary
= m_primary_scheme_colour
;
127 if(secondary
!= NULL
)
128 *secondary
= m_secondary_scheme_colour
;
130 *tertiary
= m_tertiary_scheme_colour
;
133 void wxRibbonMSWArtProvider::SetColourScheme(
134 const wxColour
& primary
,
135 const wxColour
& secondary
,
136 const wxColour
& tertiary
)
138 m_primary_scheme_colour
= primary
;
139 m_secondary_scheme_colour
= secondary
;
140 m_tertiary_scheme_colour
= tertiary
;
142 wxRibbonHSLColour
primary_hsl(primary
);
143 wxRibbonHSLColour
secondary_hsl(secondary
);
144 // tertiary not used for anything
146 // Map primary saturation from [0, 1] to [.25, .75]
147 primary_hsl
.saturation
= cos(primary_hsl
.saturation
* M_PI
) * -0.25 + 0.5;
149 // Map primary luminance from [0, 1] to [.23, .83]
150 primary_hsl
.luminance
= cos(primary_hsl
.luminance
* M_PI
) * -0.3 + 0.53;
152 // Map secondary saturation from [0, 1] to [0.16, 0.84]
153 secondary_hsl
.saturation
= cos(secondary_hsl
.saturation
* M_PI
) * -0.34 + 0.5;
155 // Map secondary luminance from [0, 1] to [0.1, 0.9]
156 secondary_hsl
.luminance
= cos(secondary_hsl
.luminance
* M_PI
) * -0.4 + 0.5;
158 #define LikePrimary(h, s, l) \
159 primary_hsl.ShiftHue(h ## f).Saturated(s ## f).Lighter(l ## f).ToRGB()
160 #define LikeSecondary(h, s, l) \
161 secondary_hsl.ShiftHue(h ## f).Saturated(s ## f).Lighter(l ## f).ToRGB()
163 m_page_border_pen
= LikePrimary(1.4, 0.00, -0.08);
165 m_page_background_top_colour
= LikePrimary(-0.1, -0.03, 0.12);
166 m_page_hover_background_top_colour
= LikePrimary(-2.8, 0.27, 0.17);
167 m_page_background_top_gradient_colour
= LikePrimary(0.1, -0.10, 0.08);
168 m_page_hover_background_top_gradient_colour
= LikePrimary(3.2, 0.16, 0.13);
169 m_page_background_colour
= LikePrimary(0.4, -0.09, 0.05);
170 m_page_hover_background_colour
= LikePrimary(0.1, 0.19, 0.10);
171 m_page_background_gradient_colour
= LikePrimary(-3.2, 0.27, 0.10);
172 m_page_hover_background_gradient_colour
= LikePrimary(1.8, 0.01, 0.15);
174 m_tab_active_background_colour
= LikePrimary(-0.1, -0.31, 0.16);
175 m_tab_active_background_gradient_colour
= LikePrimary(-0.1, -0.03, 0.12);
176 m_tab_separator_colour
= LikePrimary(0.9, 0.24, 0.05);
177 m_tab_ctrl_background_brush
= LikePrimary(1.0, 0.39, 0.07);
178 m_tab_hover_background_colour
= LikePrimary(1.3, 0.15, 0.10);
179 m_tab_hover_background_top_colour
= LikePrimary(1.4, 0.36, 0.08);
180 m_tab_border_pen
= LikePrimary(1.4, 0.03, -0.05);
181 m_tab_separator_gradient_colour
= LikePrimary(1.7, -0.15, -0.18);
182 m_tab_hover_background_top_gradient_colour
= LikePrimary(1.8, 0.34, 0.13);
183 m_tab_label_colour
= LikePrimary(4.3, 0.13, -0.49);
184 m_tab_hover_background_gradient_colour
= LikeSecondary(-1.5, -0.34, 0.01);
186 m_panel_minimised_border_gradient_pen
= LikePrimary(-6.9, -0.17, -0.09);
187 m_panel_minimised_border_pen
= LikePrimary(-5.3, -0.24, -0.06);
188 m_panel_border_gradient_pen
= LikePrimary(-5.2, -0.15, -0.06);
189 m_panel_border_pen
= LikePrimary(-2.8, -0.32, 0.02);
190 m_panel_label_background_brush
= LikePrimary(-1.5, 0.03, 0.05);
191 m_panel_active_background_gradient_colour
= LikePrimary(0.5, 0.34, 0.05);
192 m_panel_hover_label_background_brush
= LikePrimary(1.0, 0.30, 0.09);
193 m_panel_active_background_top_gradient_colour
= LikePrimary(1.4, -0.17, -0.13);
194 m_panel_active_background_colour
= LikePrimary(1.6, -0.18, -0.18);
195 m_panel_active_background_top_colour
= LikePrimary(1.7, -0.20, -0.03);
196 m_panel_label_colour
= LikePrimary(2.8, -0.14, -0.35);
197 m_panel_hover_label_colour
= m_panel_label_colour
;
198 m_panel_minimised_label_colour
= m_tab_label_colour
;
200 m_gallery_button_disabled_background_colour
= LikePrimary(-2.8, -0.46, 0.09);
201 m_gallery_button_disabled_background_top_brush
= LikePrimary(-2.8, -0.36, 0.15);
202 m_gallery_hover_background_brush
= LikePrimary(-0.8, 0.05, 0.15);
203 m_gallery_border_pen
= LikePrimary(0.7, -0.02, 0.03);
204 m_gallery_button_background_top_brush
= LikePrimary(0.8, 0.34, 0.13);
205 m_gallery_button_background_colour
= LikePrimary(1.3, 0.10, 0.08);
206 // SetColour used so that the relevant bitmaps are generated
207 SetColour(wxRIBBON_ART_GALLERY_BUTTON_FACE_COLOUR
, LikePrimary(1.4, -0.21, -0.23));
208 SetColour(wxRIBBON_ART_GALLERY_BUTTON_HOVER_FACE_COLOUR
, LikePrimary(1.5, -0.24, -0.29));
209 SetColour(wxRIBBON_ART_GALLERY_BUTTON_ACTIVE_FACE_COLOUR
, LikePrimary(1.5, -0.24, -0.29));
210 SetColour(wxRIBBON_ART_GALLERY_BUTTON_DISABLED_FACE_COLOUR
, LikePrimary(0.0, -1.0, 0.0));
211 m_gallery_button_disabled_background_gradient_colour
= LikePrimary(1.5, -0.43, 0.12);
212 m_gallery_button_background_gradient_colour
= LikePrimary(1.7, 0.11, 0.09);
213 m_gallery_item_border_pen
= LikeSecondary(-3.9, -0.16, -0.14);
214 m_gallery_button_hover_background_colour
= LikeSecondary(-0.9, 0.16, -0.07);
215 m_gallery_button_hover_background_gradient_colour
= LikeSecondary(0.1, 0.12, 0.03);
216 m_gallery_button_hover_background_top_brush
= LikeSecondary(4.3, 0.16, 0.17);
218 m_gallery_button_active_background_colour
= LikeSecondary(-9.9, 0.03, -0.22);
219 m_gallery_button_active_background_gradient_colour
= LikeSecondary(-9.5, 0.14, -0.11);
220 m_gallery_button_active_background_top_brush
= LikeSecondary(-9.0, 0.15, -0.08);
222 m_button_bar_label_colour
= m_tab_label_colour
;
223 m_button_bar_hover_border_pen
= LikeSecondary(-6.2, -0.47, -0.14);
224 m_button_bar_hover_background_gradient_colour
= LikeSecondary(-0.6, 0.16, 0.04);
225 m_button_bar_hover_background_colour
= LikeSecondary(-0.2, 0.16, -0.10);
226 m_button_bar_hover_background_top_gradient_colour
= LikeSecondary(0.2, 0.16, 0.03);
227 m_button_bar_hover_background_top_colour
= LikeSecondary(8.8, 0.16, 0.17);
228 m_button_bar_active_border_pen
= LikeSecondary(-6.2, -0.47, -0.25);
229 m_button_bar_active_background_top_colour
= LikeSecondary(-8.4, 0.08, 0.06);
230 m_button_bar_active_background_top_gradient_colour
= LikeSecondary(-9.7, 0.13, -0.07);
231 m_button_bar_active_background_colour
= LikeSecondary(-9.9, 0.14, -0.14);
232 m_button_bar_active_background_gradient_colour
= LikeSecondary(-8.7, 0.17, -0.03);
234 m_toolbar_border_pen
= LikePrimary(1.4, -0.21, -0.16);
235 SetColour(wxRIBBON_ART_TOOLBAR_FACE_COLOUR
, LikePrimary(1.4, -0.17, -0.22));
236 m_tool_background_top_colour
= LikePrimary(-1.9, -0.07, 0.06);
237 m_tool_background_top_gradient_colour
= LikePrimary(1.4, 0.12, 0.08);
238 m_tool_background_colour
= LikePrimary(1.4, -0.09, 0.03);
239 m_tool_background_gradient_colour
= LikePrimary(1.9, 0.11, 0.09);
240 m_tool_hover_background_top_colour
= LikeSecondary(3.4, 0.11, 0.16);
241 m_tool_hover_background_top_gradient_colour
= LikeSecondary(-1.4, 0.04, 0.08);
242 m_tool_hover_background_colour
= LikeSecondary(-1.8, 0.16, -0.12);
243 m_tool_hover_background_gradient_colour
= LikeSecondary(-2.6, 0.16, 0.05);
244 m_tool_active_background_top_colour
= LikeSecondary(-9.9, -0.12, -0.09);
245 m_tool_active_background_top_gradient_colour
= LikeSecondary(-8.5, 0.16, -0.12);
246 m_tool_active_background_colour
= LikeSecondary(-7.9, 0.16, -0.20);
247 m_tool_active_background_gradient_colour
= LikeSecondary(-6.6, 0.16, -0.10);
252 // Invalidate cached tab separator
253 m_cached_tab_separator_visibility
= -1.0;
256 wxRibbonArtProvider
* wxRibbonMSWArtProvider::Clone() const
258 wxRibbonMSWArtProvider
*copy
= new wxRibbonMSWArtProvider
;
263 void wxRibbonMSWArtProvider::CloneTo(wxRibbonMSWArtProvider
* copy
) const
265 for(int i
= 0; i
< 4; ++i
)
267 copy
->m_gallery_up_bitmap
[i
] = m_gallery_up_bitmap
[i
];
268 copy
->m_gallery_down_bitmap
[i
] = m_gallery_down_bitmap
[i
];
269 copy
->m_gallery_extension_bitmap
[i
] = m_gallery_extension_bitmap
[i
];
271 copy
->m_toolbar_drop_bitmap
= m_toolbar_drop_bitmap
;
273 copy
->m_primary_scheme_colour
= m_primary_scheme_colour
;
274 copy
->m_secondary_scheme_colour
= m_secondary_scheme_colour
;
275 copy
->m_tertiary_scheme_colour
= m_tertiary_scheme_colour
;
277 copy
->m_button_bar_label_colour
= m_button_bar_label_colour
;
278 copy
->m_tab_label_colour
= m_tab_label_colour
;
279 copy
->m_tab_separator_colour
= m_tab_separator_colour
;
280 copy
->m_tab_separator_gradient_colour
= m_tab_separator_gradient_colour
;
281 copy
->m_tab_active_background_colour
= m_tab_hover_background_colour
;
282 copy
->m_tab_active_background_gradient_colour
= m_tab_hover_background_gradient_colour
;
283 copy
->m_tab_hover_background_colour
= m_tab_hover_background_colour
;
284 copy
->m_tab_hover_background_gradient_colour
= m_tab_hover_background_gradient_colour
;
285 copy
->m_tab_hover_background_top_colour
= m_tab_hover_background_top_colour
;
286 copy
->m_tab_hover_background_top_gradient_colour
= m_tab_hover_background_top_gradient_colour
;
287 copy
->m_panel_label_colour
= m_panel_label_colour
;
288 copy
->m_panel_hover_label_colour
= m_panel_hover_label_colour
;
289 copy
->m_panel_minimised_label_colour
= m_panel_minimised_label_colour
;
290 copy
->m_panel_active_background_colour
= m_panel_active_background_colour
;
291 copy
->m_panel_active_background_gradient_colour
= m_panel_active_background_gradient_colour
;
292 copy
->m_panel_active_background_top_colour
= m_panel_active_background_top_colour
;
293 copy
->m_panel_active_background_top_gradient_colour
= m_panel_active_background_top_gradient_colour
;
294 copy
->m_page_background_colour
= m_page_background_colour
;
295 copy
->m_page_background_gradient_colour
= m_page_background_gradient_colour
;
296 copy
->m_page_background_top_colour
= m_page_background_top_colour
;
297 copy
->m_page_background_top_gradient_colour
= m_page_background_top_gradient_colour
;
298 copy
->m_page_hover_background_colour
= m_page_hover_background_colour
;
299 copy
->m_page_hover_background_gradient_colour
= m_page_hover_background_gradient_colour
;
300 copy
->m_page_hover_background_top_colour
= m_page_hover_background_top_colour
;
301 copy
->m_page_hover_background_top_gradient_colour
= m_page_hover_background_top_gradient_colour
;
302 copy
->m_button_bar_hover_background_colour
= m_button_bar_hover_background_colour
;
303 copy
->m_button_bar_hover_background_gradient_colour
= m_button_bar_hover_background_gradient_colour
;
304 copy
->m_button_bar_hover_background_top_colour
= m_button_bar_hover_background_top_colour
;
305 copy
->m_button_bar_hover_background_top_gradient_colour
= m_button_bar_hover_background_top_gradient_colour
;
306 copy
->m_button_bar_active_background_colour
= m_button_bar_active_background_colour
;
307 copy
->m_button_bar_active_background_gradient_colour
= m_button_bar_active_background_gradient_colour
;
308 copy
->m_button_bar_active_background_top_colour
= m_button_bar_active_background_top_colour
;
309 copy
->m_button_bar_active_background_top_gradient_colour
= m_button_bar_active_background_top_gradient_colour
;
310 copy
->m_gallery_button_background_colour
= m_gallery_button_background_colour
;
311 copy
->m_gallery_button_background_gradient_colour
= m_gallery_button_background_gradient_colour
;
312 copy
->m_gallery_button_hover_background_colour
= m_gallery_button_hover_background_colour
;
313 copy
->m_gallery_button_hover_background_gradient_colour
= m_gallery_button_hover_background_gradient_colour
;
314 copy
->m_gallery_button_active_background_colour
= m_gallery_button_active_background_colour
;
315 copy
->m_gallery_button_active_background_gradient_colour
= m_gallery_button_active_background_gradient_colour
;
316 copy
->m_gallery_button_disabled_background_colour
= m_gallery_button_disabled_background_colour
;
317 copy
->m_gallery_button_disabled_background_gradient_colour
= m_gallery_button_disabled_background_gradient_colour
;
318 copy
->m_gallery_button_face_colour
= m_gallery_button_face_colour
;
319 copy
->m_gallery_button_hover_face_colour
= m_gallery_button_hover_face_colour
;
320 copy
->m_gallery_button_active_face_colour
= m_gallery_button_active_face_colour
;
321 copy
->m_gallery_button_disabled_face_colour
= m_gallery_button_disabled_face_colour
;
323 copy
->m_tab_ctrl_background_brush
= m_tab_ctrl_background_brush
;
324 copy
->m_panel_label_background_brush
= m_panel_label_background_brush
;
325 copy
->m_panel_hover_label_background_brush
= m_panel_hover_label_background_brush
;
326 copy
->m_gallery_hover_background_brush
= m_gallery_hover_background_brush
;
327 copy
->m_gallery_button_background_top_brush
= m_gallery_button_background_top_brush
;
328 copy
->m_gallery_button_hover_background_top_brush
= m_gallery_button_hover_background_top_brush
;
329 copy
->m_gallery_button_active_background_top_brush
= m_gallery_button_active_background_top_brush
;
330 copy
->m_gallery_button_disabled_background_top_brush
= m_gallery_button_disabled_background_top_brush
;
332 copy
->m_tab_label_font
= m_tab_label_font
;
333 copy
->m_button_bar_label_font
= m_button_bar_label_font
;
334 copy
->m_panel_label_font
= m_panel_label_font
;
336 copy
->m_page_border_pen
= m_page_border_pen
;
337 copy
->m_panel_border_pen
= m_panel_border_pen
;
338 copy
->m_panel_border_gradient_pen
= m_panel_border_gradient_pen
;
339 copy
->m_panel_minimised_border_pen
= m_panel_minimised_border_pen
;
340 copy
->m_panel_minimised_border_gradient_pen
= m_panel_minimised_border_gradient_pen
;
341 copy
->m_tab_border_pen
= m_tab_border_pen
;
342 copy
->m_gallery_border_pen
= m_gallery_border_pen
;
343 copy
->m_button_bar_hover_border_pen
= m_button_bar_hover_border_pen
;
344 copy
->m_button_bar_active_border_pen
= m_button_bar_active_border_pen
;
345 copy
->m_gallery_item_border_pen
= m_gallery_item_border_pen
;
346 copy
->m_toolbar_border_pen
= m_toolbar_border_pen
;
348 copy
->m_flags
= m_flags
;
349 copy
->m_tab_separation_size
= m_tab_separation_size
;
350 copy
->m_page_border_left
= m_page_border_left
;
351 copy
->m_page_border_top
= m_page_border_top
;
352 copy
->m_page_border_right
= m_page_border_right
;
353 copy
->m_page_border_bottom
= m_page_border_bottom
;
354 copy
->m_panel_x_separation_size
= m_panel_x_separation_size
;
355 copy
->m_panel_y_separation_size
= m_panel_y_separation_size
;
356 copy
->m_gallery_bitmap_padding_left_size
= m_gallery_bitmap_padding_left_size
;
357 copy
->m_gallery_bitmap_padding_right_size
= m_gallery_bitmap_padding_right_size
;
358 copy
->m_gallery_bitmap_padding_top_size
= m_gallery_bitmap_padding_top_size
;
359 copy
->m_gallery_bitmap_padding_bottom_size
= m_gallery_bitmap_padding_bottom_size
;
362 long wxRibbonMSWArtProvider::GetFlags() const
367 void wxRibbonMSWArtProvider::SetFlags(long flags
)
369 if((flags
^ m_flags
) & wxRIBBON_BAR_FLOW_VERTICAL
)
371 if(flags
& wxRIBBON_BAR_FLOW_VERTICAL
)
373 m_page_border_left
++;
374 m_page_border_right
++;
376 m_page_border_bottom
--;
380 m_page_border_left
--;
381 m_page_border_right
--;
383 m_page_border_bottom
++;
388 // Need to reload some bitmaps when flags change
389 #define Reload(setting) SetColour(setting, GetColour(setting))
390 Reload(wxRIBBON_ART_GALLERY_BUTTON_FACE_COLOUR
);
391 Reload(wxRIBBON_ART_GALLERY_BUTTON_HOVER_FACE_COLOUR
);
392 Reload(wxRIBBON_ART_GALLERY_BUTTON_ACTIVE_FACE_COLOUR
);
393 Reload(wxRIBBON_ART_GALLERY_BUTTON_DISABLED_FACE_COLOUR
);
397 int wxRibbonMSWArtProvider::GetMetric(int id
) const
401 case wxRIBBON_ART_TAB_SEPARATION_SIZE
:
402 return m_tab_separation_size
;
403 case wxRIBBON_ART_PAGE_BORDER_LEFT_SIZE
:
404 return m_page_border_left
;
405 case wxRIBBON_ART_PAGE_BORDER_TOP_SIZE
:
406 return m_page_border_top
;
407 case wxRIBBON_ART_PAGE_BORDER_RIGHT_SIZE
:
408 return m_page_border_right
;
409 case wxRIBBON_ART_PAGE_BORDER_BOTTOM_SIZE
:
410 return m_page_border_bottom
;
411 case wxRIBBON_ART_PANEL_X_SEPARATION_SIZE
:
412 return m_panel_x_separation_size
;
413 case wxRIBBON_ART_PANEL_Y_SEPARATION_SIZE
:
414 return m_panel_y_separation_size
;
415 case wxRIBBON_ART_TOOL_GROUP_SEPARATION_SIZE
:
416 return m_tool_group_separation_size
;
417 case wxRIBBON_ART_GALLERY_BITMAP_PADDING_LEFT_SIZE
:
418 return m_gallery_bitmap_padding_left_size
;
419 case wxRIBBON_ART_GALLERY_BITMAP_PADDING_RIGHT_SIZE
:
420 return m_gallery_bitmap_padding_right_size
;
421 case wxRIBBON_ART_GALLERY_BITMAP_PADDING_TOP_SIZE
:
422 return m_gallery_bitmap_padding_top_size
;
423 case wxRIBBON_ART_GALLERY_BITMAP_PADDING_BOTTOM_SIZE
:
424 return m_gallery_bitmap_padding_bottom_size
;
426 wxFAIL_MSG(wxT("Invalid Metric Ordinal"));
433 void wxRibbonMSWArtProvider::SetMetric(int id
, int new_val
)
437 case wxRIBBON_ART_TAB_SEPARATION_SIZE
:
438 m_tab_separation_size
= new_val
;
440 case wxRIBBON_ART_PAGE_BORDER_LEFT_SIZE
:
441 m_page_border_left
= new_val
;
443 case wxRIBBON_ART_PAGE_BORDER_TOP_SIZE
:
444 m_page_border_top
= new_val
;
446 case wxRIBBON_ART_PAGE_BORDER_RIGHT_SIZE
:
447 m_page_border_right
= new_val
;
449 case wxRIBBON_ART_PAGE_BORDER_BOTTOM_SIZE
:
450 m_page_border_bottom
= new_val
;
452 case wxRIBBON_ART_PANEL_X_SEPARATION_SIZE
:
453 m_panel_x_separation_size
= new_val
;
455 case wxRIBBON_ART_PANEL_Y_SEPARATION_SIZE
:
456 m_panel_y_separation_size
= new_val
;
458 case wxRIBBON_ART_TOOL_GROUP_SEPARATION_SIZE
:
459 m_tool_group_separation_size
= new_val
;
461 case wxRIBBON_ART_GALLERY_BITMAP_PADDING_LEFT_SIZE
:
462 m_gallery_bitmap_padding_left_size
= new_val
;
464 case wxRIBBON_ART_GALLERY_BITMAP_PADDING_RIGHT_SIZE
:
465 m_gallery_bitmap_padding_right_size
= new_val
;
467 case wxRIBBON_ART_GALLERY_BITMAP_PADDING_TOP_SIZE
:
468 m_gallery_bitmap_padding_top_size
= new_val
;
470 case wxRIBBON_ART_GALLERY_BITMAP_PADDING_BOTTOM_SIZE
:
471 m_gallery_bitmap_padding_bottom_size
= new_val
;
474 wxFAIL_MSG(wxT("Invalid Metric Ordinal"));
479 void wxRibbonMSWArtProvider::SetFont(int id
, const wxFont
& font
)
483 case wxRIBBON_ART_TAB_LABEL_FONT
:
484 m_tab_label_font
= font
;
486 case wxRIBBON_ART_BUTTON_BAR_LABEL_FONT
:
487 m_button_bar_label_font
= font
;
489 case wxRIBBON_ART_PANEL_LABEL_FONT
:
490 m_panel_label_font
= font
;
493 wxFAIL_MSG(wxT("Invalid Metric Ordinal"));
498 wxFont
wxRibbonMSWArtProvider::GetFont(int id
) const
502 case wxRIBBON_ART_TAB_LABEL_FONT
:
503 return m_tab_label_font
;
504 case wxRIBBON_ART_BUTTON_BAR_LABEL_FONT
:
505 return m_button_bar_label_font
;
506 case wxRIBBON_ART_PANEL_LABEL_FONT
:
507 return m_panel_label_font
;
509 wxFAIL_MSG(wxT("Invalid Metric Ordinal"));
516 wxColour
wxRibbonMSWArtProvider::GetColour(int id
) const
520 case wxRIBBON_ART_BUTTON_BAR_LABEL_COLOUR
:
521 return m_button_bar_label_colour
;
522 case wxRIBBON_ART_BUTTON_BAR_HOVER_BORDER_COLOUR
:
523 return m_button_bar_hover_border_pen
.GetColour();
524 case wxRIBBON_ART_BUTTON_BAR_HOVER_BACKGROUND_TOP_COLOUR
:
525 return m_button_bar_hover_background_top_colour
;
526 case wxRIBBON_ART_BUTTON_BAR_HOVER_BACKGROUND_TOP_GRADIENT_COLOUR
:
527 return m_button_bar_hover_background_top_gradient_colour
;
528 case wxRIBBON_ART_BUTTON_BAR_HOVER_BACKGROUND_COLOUR
:
529 return m_button_bar_hover_background_colour
;
530 case wxRIBBON_ART_BUTTON_BAR_HOVER_BACKGROUND_GRADIENT_COLOUR
:
531 return m_button_bar_hover_background_gradient_colour
;
532 case wxRIBBON_ART_BUTTON_BAR_ACTIVE_BORDER_COLOUR
:
533 return m_button_bar_active_border_pen
.GetColour();
534 case wxRIBBON_ART_BUTTON_BAR_ACTIVE_BACKGROUND_TOP_COLOUR
:
535 return m_button_bar_active_background_top_colour
;
536 case wxRIBBON_ART_BUTTON_BAR_ACTIVE_BACKGROUND_TOP_GRADIENT_COLOUR
:
537 return m_button_bar_active_background_top_gradient_colour
;
538 case wxRIBBON_ART_BUTTON_BAR_ACTIVE_BACKGROUND_COLOUR
:
539 return m_button_bar_active_background_colour
;
540 case wxRIBBON_ART_BUTTON_BAR_ACTIVE_BACKGROUND_GRADIENT_COLOUR
:
541 return m_button_bar_active_background_gradient_colour
;
542 case wxRIBBON_ART_GALLERY_BORDER_COLOUR
:
543 return m_gallery_border_pen
.GetColour();
544 case wxRIBBON_ART_GALLERY_HOVER_BACKGROUND_COLOUR
:
545 return m_gallery_hover_background_brush
.GetColour();
546 case wxRIBBON_ART_GALLERY_BUTTON_BACKGROUND_COLOUR
:
547 return m_gallery_button_background_colour
;
548 case wxRIBBON_ART_GALLERY_BUTTON_BACKGROUND_GRADIENT_COLOUR
:
549 return m_gallery_button_background_gradient_colour
;
550 case wxRIBBON_ART_GALLERY_BUTTON_BACKGROUND_TOP_COLOUR
:
551 return m_gallery_button_background_top_brush
.GetColour();
552 case wxRIBBON_ART_GALLERY_BUTTON_FACE_COLOUR
:
553 return m_gallery_button_face_colour
;
554 case wxRIBBON_ART_GALLERY_BUTTON_HOVER_BACKGROUND_COLOUR
:
555 return m_gallery_button_hover_background_colour
;
556 case wxRIBBON_ART_GALLERY_BUTTON_HOVER_BACKGROUND_GRADIENT_COLOUR
:
557 return m_gallery_button_hover_background_gradient_colour
;
558 case wxRIBBON_ART_GALLERY_BUTTON_HOVER_BACKGROUND_TOP_COLOUR
:
559 return m_gallery_button_hover_background_top_brush
.GetColour();
560 case wxRIBBON_ART_GALLERY_BUTTON_HOVER_FACE_COLOUR
:
561 return m_gallery_button_face_colour
;
562 case wxRIBBON_ART_GALLERY_BUTTON_ACTIVE_BACKGROUND_COLOUR
:
563 return m_gallery_button_active_background_colour
;
564 case wxRIBBON_ART_GALLERY_BUTTON_ACTIVE_BACKGROUND_GRADIENT_COLOUR
:
565 return m_gallery_button_active_background_gradient_colour
;
566 case wxRIBBON_ART_GALLERY_BUTTON_ACTIVE_BACKGROUND_TOP_COLOUR
:
567 return m_gallery_button_background_top_brush
.GetColour();
568 case wxRIBBON_ART_GALLERY_BUTTON_ACTIVE_FACE_COLOUR
:
569 return m_gallery_button_active_face_colour
;
570 case wxRIBBON_ART_GALLERY_BUTTON_DISABLED_BACKGROUND_COLOUR
:
571 return m_gallery_button_disabled_background_colour
;
572 case wxRIBBON_ART_GALLERY_BUTTON_DISABLED_BACKGROUND_GRADIENT_COLOUR
:
573 return m_gallery_button_disabled_background_gradient_colour
;
574 case wxRIBBON_ART_GALLERY_BUTTON_DISABLED_BACKGROUND_TOP_COLOUR
:
575 return m_gallery_button_disabled_background_top_brush
.GetColour();
576 case wxRIBBON_ART_GALLERY_BUTTON_DISABLED_FACE_COLOUR
:
577 return m_gallery_button_disabled_face_colour
;
578 case wxRIBBON_ART_GALLERY_ITEM_BORDER_COLOUR
:
579 return m_gallery_item_border_pen
.GetColour();
580 case wxRIBBON_ART_TAB_CTRL_BACKGROUND_COLOUR
:
581 case wxRIBBON_ART_TAB_CTRL_BACKGROUND_GRADIENT_COLOUR
:
582 return m_tab_ctrl_background_brush
.GetColour();
583 case wxRIBBON_ART_TAB_LABEL_COLOUR
:
584 return m_tab_label_colour
;
585 case wxRIBBON_ART_TAB_SEPARATOR_COLOUR
:
586 return m_tab_separator_colour
;
587 case wxRIBBON_ART_TAB_SEPARATOR_GRADIENT_COLOUR
:
588 return m_tab_separator_gradient_colour
;
589 case wxRIBBON_ART_TAB_ACTIVE_BACKGROUND_TOP_COLOUR
:
590 case wxRIBBON_ART_TAB_ACTIVE_BACKGROUND_TOP_GRADIENT_COLOUR
:
591 return wxColour(0, 0, 0);
592 case wxRIBBON_ART_TAB_ACTIVE_BACKGROUND_COLOUR
:
593 return m_tab_active_background_colour
;
594 case wxRIBBON_ART_TAB_ACTIVE_BACKGROUND_GRADIENT_COLOUR
:
595 return m_tab_active_background_gradient_colour
;
596 case wxRIBBON_ART_TAB_HOVER_BACKGROUND_TOP_COLOUR
:
597 return m_tab_hover_background_top_colour
;
598 case wxRIBBON_ART_TAB_HOVER_BACKGROUND_TOP_GRADIENT_COLOUR
:
599 return m_tab_hover_background_top_gradient_colour
;
600 case wxRIBBON_ART_TAB_HOVER_BACKGROUND_COLOUR
:
601 return m_tab_hover_background_colour
;
602 case wxRIBBON_ART_TAB_HOVER_BACKGROUND_GRADIENT_COLOUR
:
603 return m_tab_hover_background_gradient_colour
;
604 case wxRIBBON_ART_TAB_BORDER_COLOUR
:
605 return m_tab_border_pen
.GetColour();
606 case wxRIBBON_ART_PANEL_BORDER_COLOUR
:
607 return m_panel_border_pen
.GetColour();
608 case wxRIBBON_ART_PANEL_BORDER_GRADIENT_COLOUR
:
609 return m_panel_border_gradient_pen
.GetColour();
610 case wxRIBBON_ART_PANEL_MINIMISED_BORDER_COLOUR
:
611 return m_panel_minimised_border_pen
.GetColour();
612 case wxRIBBON_ART_PANEL_MINIMISED_BORDER_GRADIENT_COLOUR
:
613 return m_panel_minimised_border_gradient_pen
.GetColour();
614 case wxRIBBON_ART_PANEL_LABEL_BACKGROUND_COLOUR
:
615 case wxRIBBON_ART_PANEL_LABEL_BACKGROUND_GRADIENT_COLOUR
:
616 return m_panel_label_background_brush
.GetColour();
617 case wxRIBBON_ART_PANEL_LABEL_COLOUR
:
618 return m_panel_label_colour
;
619 case wxRIBBON_ART_PANEL_MINIMISED_LABEL_COLOUR
:
620 return m_panel_minimised_label_colour
;
621 case wxRIBBON_ART_PANEL_HOVER_LABEL_BACKGROUND_COLOUR
:
622 case wxRIBBON_ART_PANEL_HOVER_LABEL_BACKGROUND_GRADIENT_COLOUR
:
623 return m_panel_hover_label_background_brush
.GetColour();
624 case wxRIBBON_ART_PANEL_HOVER_LABEL_COLOUR
:
625 return m_panel_hover_label_colour
;
626 case wxRIBBON_ART_PANEL_ACTIVE_BACKGROUND_TOP_COLOUR
:
627 return m_panel_active_background_top_colour
;
628 case wxRIBBON_ART_PANEL_ACTIVE_BACKGROUND_TOP_GRADIENT_COLOUR
:
629 return m_panel_active_background_top_gradient_colour
;
630 case wxRIBBON_ART_PANEL_ACTIVE_BACKGROUND_COLOUR
:
631 return m_panel_active_background_colour
;
632 case wxRIBBON_ART_PANEL_ACTIVE_BACKGROUND_GRADIENT_COLOUR
:
633 return m_panel_active_background_gradient_colour
;
634 case wxRIBBON_ART_PAGE_BORDER_COLOUR
:
635 return m_page_border_pen
.GetColour();
636 case wxRIBBON_ART_PAGE_BACKGROUND_TOP_COLOUR
:
637 return m_page_background_top_colour
;
638 case wxRIBBON_ART_PAGE_BACKGROUND_TOP_GRADIENT_COLOUR
:
639 return m_page_background_top_gradient_colour
;
640 case wxRIBBON_ART_PAGE_BACKGROUND_COLOUR
:
641 return m_page_background_colour
;
642 case wxRIBBON_ART_PAGE_BACKGROUND_GRADIENT_COLOUR
:
643 return m_page_background_gradient_colour
;
644 case wxRIBBON_ART_PAGE_HOVER_BACKGROUND_TOP_COLOUR
:
645 return m_page_hover_background_top_colour
;
646 case wxRIBBON_ART_PAGE_HOVER_BACKGROUND_TOP_GRADIENT_COLOUR
:
647 return m_page_hover_background_top_gradient_colour
;
648 case wxRIBBON_ART_PAGE_HOVER_BACKGROUND_COLOUR
:
649 return m_page_hover_background_colour
;
650 case wxRIBBON_ART_PAGE_HOVER_BACKGROUND_GRADIENT_COLOUR
:
651 return m_page_hover_background_gradient_colour
;
652 case wxRIBBON_ART_TOOLBAR_BORDER_COLOUR
:
653 case wxRIBBON_ART_TOOLBAR_HOVER_BORDER_COLOUR
:
654 return m_toolbar_border_pen
.GetColour();
655 case wxRIBBON_ART_TOOLBAR_FACE_COLOUR
:
656 return m_tool_face_colour
;
658 wxFAIL_MSG(wxT("Invalid Metric Ordinal"));
665 void wxRibbonMSWArtProvider::SetColour(int id
, const wxColor
& colour
)
669 case wxRIBBON_ART_BUTTON_BAR_LABEL_COLOUR
:
670 m_button_bar_label_colour
= colour
;
672 case wxRIBBON_ART_BUTTON_BAR_HOVER_BORDER_COLOUR
:
673 m_button_bar_hover_border_pen
.SetColour(colour
);
675 case wxRIBBON_ART_BUTTON_BAR_HOVER_BACKGROUND_TOP_COLOUR
:
676 m_button_bar_hover_background_top_colour
= colour
;
678 case wxRIBBON_ART_BUTTON_BAR_HOVER_BACKGROUND_TOP_GRADIENT_COLOUR
:
679 m_button_bar_hover_background_top_gradient_colour
= colour
;
681 case wxRIBBON_ART_BUTTON_BAR_HOVER_BACKGROUND_COLOUR
:
682 m_button_bar_hover_background_colour
= colour
;
684 case wxRIBBON_ART_BUTTON_BAR_HOVER_BACKGROUND_GRADIENT_COLOUR
:
685 m_button_bar_hover_background_gradient_colour
= colour
;
687 case wxRIBBON_ART_BUTTON_BAR_ACTIVE_BORDER_COLOUR
:
688 m_button_bar_active_border_pen
.SetColour(colour
);
690 case wxRIBBON_ART_BUTTON_BAR_ACTIVE_BACKGROUND_TOP_COLOUR
:
691 m_button_bar_active_background_top_colour
= colour
;
693 case wxRIBBON_ART_BUTTON_BAR_ACTIVE_BACKGROUND_TOP_GRADIENT_COLOUR
:
694 m_button_bar_active_background_top_gradient_colour
= colour
;
696 case wxRIBBON_ART_BUTTON_BAR_ACTIVE_BACKGROUND_COLOUR
:
697 m_button_bar_active_background_colour
= colour
;
699 case wxRIBBON_ART_BUTTON_BAR_ACTIVE_BACKGROUND_GRADIENT_COLOUR
:
700 m_button_bar_active_background_gradient_colour
= colour
;
702 case wxRIBBON_ART_GALLERY_BORDER_COLOUR
:
703 m_gallery_border_pen
.SetColour(colour
);
705 case wxRIBBON_ART_GALLERY_HOVER_BACKGROUND_COLOUR
:
706 m_gallery_hover_background_brush
.SetColour(colour
);
708 case wxRIBBON_ART_GALLERY_BUTTON_BACKGROUND_COLOUR
:
709 m_gallery_button_background_colour
= colour
;
711 case wxRIBBON_ART_GALLERY_BUTTON_BACKGROUND_GRADIENT_COLOUR
:
712 m_gallery_button_background_gradient_colour
= colour
;
714 case wxRIBBON_ART_GALLERY_BUTTON_BACKGROUND_TOP_COLOUR
:
715 m_gallery_button_background_top_brush
.SetColour(colour
);
717 case wxRIBBON_ART_GALLERY_BUTTON_FACE_COLOUR
:
718 m_gallery_button_face_colour
= colour
;
719 if(m_flags
& wxRIBBON_BAR_FLOW_VERTICAL
)
721 m_gallery_up_bitmap
[0] = wxRibbonLoadPixmap(gallery_left_xpm
, colour
);
722 m_gallery_down_bitmap
[0] = wxRibbonLoadPixmap(gallery_right_xpm
, colour
);
726 m_gallery_up_bitmap
[0] = wxRibbonLoadPixmap(gallery_up_xpm
, colour
);
727 m_gallery_down_bitmap
[0] = wxRibbonLoadPixmap(gallery_down_xpm
, colour
);
729 m_gallery_extension_bitmap
[0] = wxRibbonLoadPixmap(gallery_extension_xpm
, colour
);
731 case wxRIBBON_ART_GALLERY_BUTTON_HOVER_BACKGROUND_COLOUR
:
732 m_gallery_button_hover_background_colour
= colour
;
734 case wxRIBBON_ART_GALLERY_BUTTON_HOVER_BACKGROUND_GRADIENT_COLOUR
:
735 m_gallery_button_hover_background_gradient_colour
= colour
;
737 case wxRIBBON_ART_GALLERY_BUTTON_HOVER_BACKGROUND_TOP_COLOUR
:
738 m_gallery_button_hover_background_top_brush
.SetColour(colour
);
740 case wxRIBBON_ART_GALLERY_BUTTON_HOVER_FACE_COLOUR
:
741 m_gallery_button_hover_face_colour
= colour
;
742 if(m_flags
& wxRIBBON_BAR_FLOW_VERTICAL
)
744 m_gallery_up_bitmap
[1] = wxRibbonLoadPixmap(gallery_left_xpm
, colour
);
745 m_gallery_down_bitmap
[1] = wxRibbonLoadPixmap(gallery_right_xpm
, colour
);
749 m_gallery_up_bitmap
[1] = wxRibbonLoadPixmap(gallery_up_xpm
, colour
);
750 m_gallery_down_bitmap
[1] = wxRibbonLoadPixmap(gallery_down_xpm
, colour
);
752 m_gallery_extension_bitmap
[1] = wxRibbonLoadPixmap(gallery_extension_xpm
, colour
);
754 case wxRIBBON_ART_GALLERY_BUTTON_ACTIVE_BACKGROUND_COLOUR
:
755 m_gallery_button_active_background_colour
= colour
;
757 case wxRIBBON_ART_GALLERY_BUTTON_ACTIVE_BACKGROUND_GRADIENT_COLOUR
:
758 m_gallery_button_active_background_gradient_colour
= colour
;
760 case wxRIBBON_ART_GALLERY_BUTTON_ACTIVE_BACKGROUND_TOP_COLOUR
:
761 m_gallery_button_background_top_brush
.SetColour(colour
);
763 case wxRIBBON_ART_GALLERY_BUTTON_ACTIVE_FACE_COLOUR
:
764 m_gallery_button_active_face_colour
= colour
;
765 if(m_flags
& wxRIBBON_BAR_FLOW_VERTICAL
)
767 m_gallery_up_bitmap
[2] = wxRibbonLoadPixmap(gallery_left_xpm
, colour
);
768 m_gallery_down_bitmap
[2] = wxRibbonLoadPixmap(gallery_right_xpm
, colour
);
772 m_gallery_up_bitmap
[2] = wxRibbonLoadPixmap(gallery_up_xpm
, colour
);
773 m_gallery_down_bitmap
[2] = wxRibbonLoadPixmap(gallery_down_xpm
, colour
);
775 m_gallery_extension_bitmap
[2] = wxRibbonLoadPixmap(gallery_extension_xpm
, colour
);
777 case wxRIBBON_ART_GALLERY_BUTTON_DISABLED_BACKGROUND_COLOUR
:
778 m_gallery_button_disabled_background_colour
= colour
;
780 case wxRIBBON_ART_GALLERY_BUTTON_DISABLED_BACKGROUND_GRADIENT_COLOUR
:
781 m_gallery_button_disabled_background_gradient_colour
= colour
;
783 case wxRIBBON_ART_GALLERY_BUTTON_DISABLED_BACKGROUND_TOP_COLOUR
:
784 m_gallery_button_disabled_background_top_brush
.SetColour(colour
);
786 case wxRIBBON_ART_GALLERY_BUTTON_DISABLED_FACE_COLOUR
:
787 m_gallery_button_disabled_face_colour
= colour
;
788 if(m_flags
& wxRIBBON_BAR_FLOW_VERTICAL
)
790 m_gallery_up_bitmap
[3] = wxRibbonLoadPixmap(gallery_left_xpm
, colour
);
791 m_gallery_down_bitmap
[3] = wxRibbonLoadPixmap(gallery_right_xpm
, colour
);
795 m_gallery_up_bitmap
[3] = wxRibbonLoadPixmap(gallery_up_xpm
, colour
);
796 m_gallery_down_bitmap
[3] = wxRibbonLoadPixmap(gallery_down_xpm
, colour
);
798 m_gallery_extension_bitmap
[3] = wxRibbonLoadPixmap(gallery_extension_xpm
, colour
);
800 case wxRIBBON_ART_GALLERY_ITEM_BORDER_COLOUR
:
801 m_gallery_item_border_pen
.SetColour(colour
);
803 case wxRIBBON_ART_TAB_CTRL_BACKGROUND_COLOUR
:
804 case wxRIBBON_ART_TAB_CTRL_BACKGROUND_GRADIENT_COLOUR
:
805 m_tab_ctrl_background_brush
.SetColour(colour
);
806 m_cached_tab_separator_visibility
= -1.0;
808 case wxRIBBON_ART_TAB_LABEL_COLOUR
:
809 m_tab_label_colour
= colour
;
811 case wxRIBBON_ART_TAB_SEPARATOR_COLOUR
:
812 m_tab_separator_colour
= colour
;
813 m_cached_tab_separator_visibility
= -1.0;
815 case wxRIBBON_ART_TAB_SEPARATOR_GRADIENT_COLOUR
:
816 m_tab_separator_gradient_colour
= colour
;
817 m_cached_tab_separator_visibility
= -1.0;
819 case wxRIBBON_ART_TAB_ACTIVE_BACKGROUND_TOP_COLOUR
:
820 case wxRIBBON_ART_TAB_ACTIVE_BACKGROUND_TOP_GRADIENT_COLOUR
:
822 case wxRIBBON_ART_TAB_ACTIVE_BACKGROUND_COLOUR
:
823 m_tab_active_background_colour
= colour
;
825 case wxRIBBON_ART_TAB_ACTIVE_BACKGROUND_GRADIENT_COLOUR
:
826 m_tab_active_background_gradient_colour
= colour
;
828 case wxRIBBON_ART_TAB_HOVER_BACKGROUND_TOP_COLOUR
:
829 m_tab_hover_background_top_colour
= colour
;
831 case wxRIBBON_ART_TAB_HOVER_BACKGROUND_TOP_GRADIENT_COLOUR
:
832 m_tab_hover_background_top_gradient_colour
= colour
;
834 case wxRIBBON_ART_TAB_HOVER_BACKGROUND_COLOUR
:
835 m_tab_hover_background_colour
= colour
;
837 case wxRIBBON_ART_TAB_HOVER_BACKGROUND_GRADIENT_COLOUR
:
838 m_tab_hover_background_gradient_colour
= colour
;
840 case wxRIBBON_ART_TAB_BORDER_COLOUR
:
841 m_tab_border_pen
.SetColour(colour
);
843 case wxRIBBON_ART_PANEL_BORDER_COLOUR
:
844 m_panel_border_pen
.SetColour(colour
);
846 case wxRIBBON_ART_PANEL_BORDER_GRADIENT_COLOUR
:
847 m_panel_border_gradient_pen
.SetColour(colour
);
849 case wxRIBBON_ART_PANEL_MINIMISED_BORDER_COLOUR
:
850 m_panel_minimised_border_pen
.SetColour(colour
);
852 case wxRIBBON_ART_PANEL_MINIMISED_BORDER_GRADIENT_COLOUR
:
853 m_panel_minimised_border_gradient_pen
.SetColour(colour
);
855 case wxRIBBON_ART_PANEL_LABEL_BACKGROUND_COLOUR
:
856 case wxRIBBON_ART_PANEL_LABEL_BACKGROUND_GRADIENT_COLOUR
:
857 m_panel_label_background_brush
.SetColour(colour
);
859 case wxRIBBON_ART_PANEL_LABEL_COLOUR
:
860 m_panel_label_colour
= colour
;
862 case wxRIBBON_ART_PANEL_HOVER_LABEL_BACKGROUND_COLOUR
:
863 case wxRIBBON_ART_PANEL_HOVER_LABEL_BACKGROUND_GRADIENT_COLOUR
:
864 m_panel_hover_label_background_brush
.SetColour(colour
);
866 case wxRIBBON_ART_PANEL_HOVER_LABEL_COLOUR
:
867 m_panel_hover_label_colour
= colour
;
869 case wxRIBBON_ART_PANEL_MINIMISED_LABEL_COLOUR
:
870 m_panel_minimised_label_colour
= colour
;
872 case wxRIBBON_ART_PANEL_ACTIVE_BACKGROUND_TOP_COLOUR
:
873 m_panel_active_background_top_colour
= colour
;
875 case wxRIBBON_ART_PANEL_ACTIVE_BACKGROUND_TOP_GRADIENT_COLOUR
:
876 m_panel_active_background_top_gradient_colour
= colour
;
878 case wxRIBBON_ART_PANEL_ACTIVE_BACKGROUND_COLOUR
:
879 m_panel_active_background_colour
= colour
;
881 case wxRIBBON_ART_PANEL_ACTIVE_BACKGROUND_GRADIENT_COLOUR
:
882 m_panel_active_background_gradient_colour
= colour
;
884 case wxRIBBON_ART_PAGE_BORDER_COLOUR
:
885 m_page_border_pen
.SetColour(colour
);
887 case wxRIBBON_ART_PAGE_BACKGROUND_TOP_COLOUR
:
888 m_page_background_top_colour
= colour
;
890 case wxRIBBON_ART_PAGE_BACKGROUND_TOP_GRADIENT_COLOUR
:
891 m_page_background_top_gradient_colour
= colour
;
893 case wxRIBBON_ART_PAGE_BACKGROUND_COLOUR
:
894 m_page_background_colour
= colour
;
896 case wxRIBBON_ART_PAGE_BACKGROUND_GRADIENT_COLOUR
:
897 m_page_background_gradient_colour
= colour
;
899 case wxRIBBON_ART_PAGE_HOVER_BACKGROUND_TOP_COLOUR
:
900 m_page_hover_background_top_colour
= colour
;
902 case wxRIBBON_ART_PAGE_HOVER_BACKGROUND_TOP_GRADIENT_COLOUR
:
903 m_page_hover_background_top_gradient_colour
= colour
;
905 case wxRIBBON_ART_PAGE_HOVER_BACKGROUND_COLOUR
:
906 m_page_hover_background_colour
= colour
;
908 case wxRIBBON_ART_PAGE_HOVER_BACKGROUND_GRADIENT_COLOUR
:
909 m_page_hover_background_gradient_colour
= colour
;
911 case wxRIBBON_ART_TOOLBAR_BORDER_COLOUR
:
912 case wxRIBBON_ART_TOOLBAR_HOVER_BORDER_COLOUR
:
913 m_toolbar_border_pen
.SetColour(colour
);
915 case wxRIBBON_ART_TOOLBAR_FACE_COLOUR
:
916 m_tool_face_colour
= colour
;
917 m_toolbar_drop_bitmap
= wxRibbonLoadPixmap(gallery_down_xpm
, colour
);
920 wxFAIL_MSG(wxT("Invalid Metric Ordinal"));
925 void wxRibbonMSWArtProvider::DrawTabCtrlBackground(
927 wxWindow
* WXUNUSED(wnd
),
930 dc
.SetPen(*wxTRANSPARENT_PEN
);
931 dc
.SetBrush(m_tab_ctrl_background_brush
);
932 dc
.DrawRectangle(rect
.x
, rect
.y
, rect
.width
, rect
.height
);
934 dc
.SetPen(m_page_border_pen
);
937 dc
.DrawLine(rect
.x
+ 3, rect
.y
+ rect
.height
- 1, rect
.x
+ rect
.width
- 3, rect
.y
+ rect
.height
- 1);
941 dc
.DrawLine(rect
.x
, rect
.y
+ rect
.height
- 1, rect
.x
+ rect
.width
, rect
.y
+ rect
.height
- 1);
945 void wxRibbonMSWArtProvider::DrawTab(
947 wxWindow
* WXUNUSED(wnd
),
948 const wxRibbonPageTabInfo
& tab
)
950 if(tab
.rect
.height
<= 2)
953 if(tab
.active
|| tab
.hovered
)
957 wxRect
background(tab
.rect
);
961 background
.width
-= 4;
962 background
.height
-= 2;
964 dc
.GradientFillLinear(background
, m_tab_active_background_colour
,
965 m_tab_active_background_gradient_colour
, wxSOUTH
);
967 // TODO: active and hovered
971 wxRect
background(tab
.rect
);
975 background
.width
-= 4;
976 background
.height
-= 3;
977 int h
= background
.height
;
978 background
.height
/= 2;
979 dc
.GradientFillLinear(background
,
980 m_tab_hover_background_top_colour
,
981 m_tab_hover_background_top_gradient_colour
, wxSOUTH
);
983 background
.y
+= background
.height
;
984 background
.height
= h
- background
.height
;
985 dc
.GradientFillLinear(background
, m_tab_hover_background_colour
,
986 m_tab_hover_background_gradient_colour
, wxSOUTH
);
989 wxPoint border_points
[6];
990 border_points
[0] = wxPoint(1, tab
.rect
.height
- 2);
991 border_points
[1] = wxPoint(1, 3);
992 border_points
[2] = wxPoint(3, 1);
993 border_points
[3] = wxPoint(tab
.rect
.width
- 4, 1);
994 border_points
[4] = wxPoint(tab
.rect
.width
- 2, 3);
995 border_points
[5] = wxPoint(tab
.rect
.width
- 2, tab
.rect
.height
- 1);
997 dc
.SetPen(m_tab_border_pen
);
998 dc
.DrawLines(sizeof(border_points
)/sizeof(wxPoint
), border_points
, tab
.rect
.x
, tab
.rect
.y
);
1002 // Give the tab a curved outward border at the bottom
1003 dc
.DrawPoint(tab
.rect
.x
, tab
.rect
.y
+ tab
.rect
.height
- 2);
1004 dc
.DrawPoint(tab
.rect
.x
+ tab
.rect
.width
- 1, tab
.rect
.y
+ tab
.rect
.height
- 2);
1006 wxPen
p(m_tab_active_background_gradient_colour
);
1009 // Technically the first two points are the wrong colour, but they're near enough
1010 dc
.DrawPoint(tab
.rect
.x
+ 1, tab
.rect
.y
+ tab
.rect
.height
- 2);
1011 dc
.DrawPoint(tab
.rect
.x
+ tab
.rect
.width
- 2, tab
.rect
.y
+ tab
.rect
.height
- 2);
1012 dc
.DrawPoint(tab
.rect
.x
+ 1, tab
.rect
.y
+ tab
.rect
.height
- 1);
1013 dc
.DrawPoint(tab
.rect
.x
, tab
.rect
.y
+ tab
.rect
.height
- 1);
1014 dc
.DrawPoint(tab
.rect
.x
+ tab
.rect
.width
- 2, tab
.rect
.y
+ tab
.rect
.height
- 1);
1015 dc
.DrawPoint(tab
.rect
.x
+ tab
.rect
.width
- 1, tab
.rect
.y
+ tab
.rect
.height
- 1);
1019 if(m_flags
& wxRIBBON_BAR_SHOW_PAGE_ICONS
)
1021 wxBitmap icon
= tab
.page
->GetIcon();
1022 int x
= tab
.rect
.x
+ 4;
1023 if((m_flags
& wxRIBBON_BAR_SHOW_PAGE_LABELS
) == 0)
1024 x
= tab
.rect
.x
+ (tab
.rect
.width
- icon
.GetWidth()) / 2;
1025 dc
.DrawBitmap(icon
, x
, tab
.rect
.y
+ 1 + (tab
.rect
.height
- 1 -
1026 icon
.GetHeight()) / 2, true);
1028 if(m_flags
& wxRIBBON_BAR_SHOW_PAGE_LABELS
)
1030 wxString label
= tab
.page
->GetLabel();
1031 if(!label
.IsEmpty())
1033 dc
.SetFont(m_tab_label_font
);
1034 dc
.SetTextForeground(m_tab_label_colour
);
1035 dc
.SetBackgroundMode(wxTRANSPARENT
);
1039 dc
.GetTextExtent(label
, &text_width
, &text_height
);
1040 int width
= tab
.rect
.width
- 5;
1041 int x
= tab
.rect
.x
+ 3;
1042 if(m_flags
& wxRIBBON_BAR_SHOW_PAGE_ICONS
)
1044 x
+= 3 + tab
.page
->GetIcon().GetWidth();
1045 width
-= 3 + tab
.page
->GetIcon().GetWidth();
1047 int y
= tab
.rect
.y
+ (tab
.rect
.height
- text_height
) / 2;
1049 if(width
<= text_width
)
1051 dc
.SetClippingRegion(x
, tab
.rect
.y
, width
, tab
.rect
.height
);
1052 dc
.DrawText(label
, x
, y
);
1056 dc
.DrawText(label
, x
+ (width
- text_width
) / 2 + 1, y
);
1062 void wxRibbonMSWArtProvider::DrawTabSeparator(
1068 if(visibility
<= 0.0)
1072 if(visibility
> 1.0)
1077 // The tab separator is relatively expensive to draw (for its size), and is
1078 // usually drawn multiple times sequentially (in different positions), so it
1079 // makes sense to draw it once and cache it.
1080 if(!m_cached_tab_separator
.IsOk() || m_cached_tab_separator
.GetSize() != rect
.GetSize() || visibility
!= m_cached_tab_separator_visibility
)
1082 wxRect
size(rect
.GetSize());
1083 ReallyDrawTabSeparator(wnd
, size
, visibility
);
1085 dc
.DrawBitmap(m_cached_tab_separator
, rect
.x
, rect
.y
, false);
1088 void wxRibbonMSWArtProvider::ReallyDrawTabSeparator(wxWindow
* wnd
, const wxRect
& rect
, double visibility
)
1090 if(!m_cached_tab_separator
.IsOk() || m_cached_tab_separator
.GetSize() != rect
.GetSize())
1092 m_cached_tab_separator
= wxBitmap(rect
.GetSize());
1095 wxMemoryDC
dc(m_cached_tab_separator
);
1096 DrawTabCtrlBackground(dc
, wnd
, rect
);
1098 wxCoord x
= rect
.x
+ rect
.width
/ 2;
1099 double h
= (double)(rect
.height
- 1);
1101 double r1
= m_tab_ctrl_background_brush
.GetColour().Red() * (1.0 - visibility
) + 0.5;
1102 double g1
= m_tab_ctrl_background_brush
.GetColour().Green() * (1.0 - visibility
) + 0.5;
1103 double b1
= m_tab_ctrl_background_brush
.GetColour().Blue() * (1.0 - visibility
) + 0.5;
1104 double r2
= m_tab_separator_colour
.Red();
1105 double g2
= m_tab_separator_colour
.Green();
1106 double b2
= m_tab_separator_colour
.Blue();
1107 double r3
= m_tab_separator_gradient_colour
.Red();
1108 double g3
= m_tab_separator_gradient_colour
.Green();
1109 double b3
= m_tab_separator_gradient_colour
.Blue();
1111 for(int i
= 0; i
< rect
.height
- 1; ++i
)
1113 double p
= ((double)i
)/h
;
1115 double r
= (p
* r3
+ (1.0 - p
) * r2
) * visibility
+ r1
;
1116 double g
= (p
* g3
+ (1.0 - p
) * g2
) * visibility
+ g1
;
1117 double b
= (p
* b3
+ (1.0 - p
) * b2
) * visibility
+ b1
;
1119 wxPen
P(wxColour((unsigned char)r
, (unsigned char)g
, (unsigned char)b
));
1121 dc
.DrawPoint(x
, rect
.y
+ i
);
1124 m_cached_tab_separator_visibility
= visibility
;
1127 void wxRibbonMSWArtProvider::DrawPartialPageBackground(wxDC
& dc
,
1128 wxWindow
* WXUNUSED(wnd
), const wxRect
& rect
, wxRibbonPage
* page
,
1129 wxPoint offset
, bool hovered
)
1131 wxRect
background(page
->GetSize());
1132 page
->AdjustRectToIncludeScrollButtons(&background
);
1133 background
.height
-= 2;
1134 // Page background isn't dependant upon the width of the page
1135 // (at least not the part of it intended to be painted by this
1136 // function). Set to wider than the page itself for when externally
1137 // expanded panels need a background - the expanded panel can be wider
1140 background
.width
= INT_MAX
;
1142 // upper_rect, lower_rect, paint_rect are all in page co-ordinates
1143 wxRect
upper_rect(background
);
1144 upper_rect
.height
/= 5;
1146 wxRect
lower_rect(background
);
1147 lower_rect
.y
+= upper_rect
.height
;
1148 lower_rect
.height
-= upper_rect
.height
;
1150 wxRect
paint_rect(rect
);
1151 paint_rect
.x
+= offset
.x
;
1152 paint_rect
.y
+= offset
.y
;
1154 wxColour bg_top
, bg_top_grad
, bg_btm
, bg_btm_grad
;
1157 bg_top
= m_page_hover_background_top_colour
;
1158 bg_top_grad
= m_page_hover_background_top_gradient_colour
;
1159 bg_btm
= m_page_hover_background_colour
;
1160 bg_btm_grad
= m_page_hover_background_gradient_colour
;
1164 bg_top
= m_page_background_top_colour
;
1165 bg_top_grad
= m_page_background_top_gradient_colour
;
1166 bg_btm
= m_page_background_colour
;
1167 bg_btm_grad
= m_page_background_gradient_colour
;
1170 if(paint_rect
.Intersects(upper_rect
))
1172 wxRect
rect(upper_rect
);
1173 rect
.Intersect(paint_rect
);
1176 wxColour
starting_colour(wxRibbonInterpolateColour(bg_top
, bg_top_grad
,
1177 paint_rect
.y
, upper_rect
.y
, upper_rect
.y
+ upper_rect
.height
));
1178 wxColour
ending_colour(wxRibbonInterpolateColour(bg_top
, bg_top_grad
,
1179 paint_rect
.y
+ paint_rect
.height
, upper_rect
.y
,
1180 upper_rect
.y
+ upper_rect
.height
));
1181 dc
.GradientFillLinear(rect
, starting_colour
, ending_colour
, wxSOUTH
);
1184 if(paint_rect
.Intersects(lower_rect
))
1186 wxRect
rect(lower_rect
);
1187 rect
.Intersect(paint_rect
);
1190 wxColour
starting_colour(wxRibbonInterpolateColour(bg_btm
, bg_btm_grad
,
1191 paint_rect
.y
, lower_rect
.y
, lower_rect
.y
+ lower_rect
.height
));
1192 wxColour
ending_colour(wxRibbonInterpolateColour(bg_btm
, bg_btm_grad
,
1193 paint_rect
.y
+ paint_rect
.height
,
1194 lower_rect
.y
, lower_rect
.y
+ lower_rect
.height
));
1195 dc
.GradientFillLinear(rect
, starting_colour
, ending_colour
, wxSOUTH
);
1199 void wxRibbonMSWArtProvider::DrawPageBackground(
1201 wxWindow
* WXUNUSED(wnd
),
1204 dc
.SetPen(*wxTRANSPARENT_PEN
);
1205 dc
.SetBrush(m_tab_ctrl_background_brush
);
1211 dc
.DrawRectangle(edge
.x
, edge
.y
, edge
.width
, edge
.height
);
1213 edge
.x
+= rect
.width
- 2;
1214 dc
.DrawRectangle(edge
.x
, edge
.y
, edge
.width
, edge
.height
);
1218 edge
.y
+= (rect
.height
- edge
.height
);
1219 dc
.DrawRectangle(edge
.x
, edge
.y
, edge
.width
, edge
.height
);
1223 wxRect
background(rect
);
1225 background
.width
-= 4;
1226 background
.height
-= 2;
1228 background
.height
/= 5;
1229 dc
.GradientFillLinear(background
, m_page_background_top_colour
,
1230 m_page_background_top_gradient_colour
, wxSOUTH
);
1232 background
.y
+= background
.height
;
1233 background
.height
= rect
.height
- 2 - background
.height
;
1234 dc
.GradientFillLinear(background
, m_page_background_colour
,
1235 m_page_background_gradient_colour
, wxSOUTH
);
1239 wxPoint border_points
[8];
1240 border_points
[0] = wxPoint(2, 0);
1241 border_points
[1] = wxPoint(1, 1);
1242 border_points
[2] = wxPoint(1, rect
.height
- 4);
1243 border_points
[3] = wxPoint(3, rect
.height
- 2);
1244 border_points
[4] = wxPoint(rect
.width
- 4, rect
.height
- 2);
1245 border_points
[5] = wxPoint(rect
.width
- 2, rect
.height
- 4);
1246 border_points
[6] = wxPoint(rect
.width
- 2, 1);
1247 border_points
[7] = wxPoint(rect
.width
- 4, -1);
1249 dc
.SetPen(m_page_border_pen
);
1250 dc
.DrawLines(sizeof(border_points
)/sizeof(wxPoint
), border_points
, rect
.x
, rect
.y
);
1254 void wxRibbonMSWArtProvider::DrawScrollButton(
1256 wxWindow
* WXUNUSED(wnd
),
1257 const wxRect
& rect_
,
1262 if((style
& wxRIBBON_SCROLL_BTN_FOR_MASK
) == wxRIBBON_SCROLL_BTN_FOR_PAGE
)
1264 // Page scroll buttons do not have the luxury of rendering on top of anything
1265 // else, and their size includes some padding, hence the background painting
1266 // and size adjustment.
1267 dc
.SetPen(*wxTRANSPARENT_PEN
);
1268 dc
.SetBrush(m_tab_ctrl_background_brush
);
1269 dc
.DrawRectangle(rect
);
1270 dc
.SetClippingRegion(rect
);
1271 switch(style
& wxRIBBON_SCROLL_BTN_DIRECTION_MASK
)
1273 case wxRIBBON_SCROLL_BTN_LEFT
:
1275 case wxRIBBON_SCROLL_BTN_RIGHT
:
1279 case wxRIBBON_SCROLL_BTN_UP
:
1285 case wxRIBBON_SCROLL_BTN_DOWN
:
1294 wxRect
background(rect
);
1297 background
.width
-= 2;
1298 background
.height
-= 2;
1300 if(style
& wxRIBBON_SCROLL_BTN_UP
)
1301 background
.height
/= 2;
1303 background
.height
/= 5;
1304 dc
.GradientFillLinear(background
, m_page_background_top_colour
,
1305 m_page_background_top_gradient_colour
, wxSOUTH
);
1307 background
.y
+= background
.height
;
1308 background
.height
= rect
.height
- 2 - background
.height
;
1309 dc
.GradientFillLinear(background
, m_page_background_colour
,
1310 m_page_background_gradient_colour
, wxSOUTH
);
1314 wxPoint border_points
[7];
1315 switch(style
& wxRIBBON_SCROLL_BTN_DIRECTION_MASK
)
1317 case wxRIBBON_SCROLL_BTN_LEFT
:
1318 border_points
[0] = wxPoint(2, 0);
1319 border_points
[1] = wxPoint(rect
.width
- 1, 0);
1320 border_points
[2] = wxPoint(rect
.width
- 1, rect
.height
- 1);
1321 border_points
[3] = wxPoint(2, rect
.height
- 1);
1322 border_points
[4] = wxPoint(0, rect
.height
- 3);
1323 border_points
[5] = wxPoint(0, 2);
1325 case wxRIBBON_SCROLL_BTN_RIGHT
:
1326 border_points
[0] = wxPoint(0, 0);
1327 border_points
[1] = wxPoint(rect
.width
- 3, 0);
1328 border_points
[2] = wxPoint(rect
.width
- 1, 2);
1329 border_points
[3] = wxPoint(rect
.width
- 1, rect
.height
- 3);
1330 border_points
[4] = wxPoint(rect
.width
- 3, rect
.height
- 1);
1331 border_points
[5] = wxPoint(0, rect
.height
- 1);
1333 case wxRIBBON_SCROLL_BTN_UP
:
1334 border_points
[0] = wxPoint(2, 0);
1335 border_points
[1] = wxPoint(rect
.width
- 3, 0);
1336 border_points
[2] = wxPoint(rect
.width
- 1, 2);
1337 border_points
[3] = wxPoint(rect
.width
- 1, rect
.height
- 1);
1338 border_points
[4] = wxPoint(0, rect
.height
- 1);
1339 border_points
[5] = wxPoint(0, 2);
1341 case wxRIBBON_SCROLL_BTN_DOWN
:
1342 border_points
[0] = wxPoint(0, 0);
1343 border_points
[1] = wxPoint(rect
.width
- 1, 0);
1344 border_points
[2] = wxPoint(rect
.width
- 1, rect
.height
- 3);
1345 border_points
[3] = wxPoint(rect
.width
- 3, rect
.height
- 1);
1346 border_points
[4] = wxPoint(2, rect
.height
- 1);
1347 border_points
[5] = wxPoint(0, rect
.height
- 3);
1350 border_points
[6] = border_points
[0];
1352 dc
.SetPen(m_page_border_pen
);
1353 dc
.DrawLines(sizeof(border_points
)/sizeof(wxPoint
), border_points
, rect
.x
, rect
.y
);
1357 // NB: Code for handling hovered/active state is temporary
1358 wxPoint arrow_points
[3];
1359 switch(style
& wxRIBBON_SCROLL_BTN_DIRECTION_MASK
)
1361 case wxRIBBON_SCROLL_BTN_LEFT
:
1362 arrow_points
[0] = wxPoint(rect
.width
/ 2 - 2, rect
.height
/ 2);
1363 if(style
& wxRIBBON_SCROLL_BTN_ACTIVE
)
1364 arrow_points
[0].y
+= 1;
1365 arrow_points
[1] = arrow_points
[0] + wxPoint(3, -3);
1366 arrow_points
[2] = arrow_points
[0] + wxPoint(3, 3);
1368 case wxRIBBON_SCROLL_BTN_RIGHT
:
1369 arrow_points
[0] = wxPoint(rect
.width
/ 2 + 2, rect
.height
/ 2);
1370 if(style
& wxRIBBON_SCROLL_BTN_ACTIVE
)
1371 arrow_points
[0].y
+= 1;
1372 arrow_points
[1] = arrow_points
[0] - wxPoint(3, 3);
1373 arrow_points
[2] = arrow_points
[0] - wxPoint(3, -3);
1375 case wxRIBBON_SCROLL_BTN_UP
:
1376 arrow_points
[0] = wxPoint(rect
.width
/ 2, rect
.height
/ 2 - 2);
1377 if(style
& wxRIBBON_SCROLL_BTN_ACTIVE
)
1378 arrow_points
[0].y
+= 1;
1379 arrow_points
[1] = arrow_points
[0] + wxPoint( 3, 3);
1380 arrow_points
[2] = arrow_points
[0] + wxPoint(-3, 3);
1382 case wxRIBBON_SCROLL_BTN_DOWN
:
1383 arrow_points
[0] = wxPoint(rect
.width
/ 2, rect
.height
/ 2 + 2);
1384 if(style
& wxRIBBON_SCROLL_BTN_ACTIVE
)
1385 arrow_points
[0].y
+= 1;
1386 arrow_points
[1] = arrow_points
[0] - wxPoint( 3, 3);
1387 arrow_points
[2] = arrow_points
[0] - wxPoint(-3, 3);
1391 dc
.SetPen(*wxTRANSPARENT_PEN
);
1392 wxBrush
B(style
& wxRIBBON_SCROLL_BTN_HOVERED
? m_tab_active_background_colour
: m_tab_label_colour
);
1394 dc
.DrawPolygon(sizeof(arrow_points
)/sizeof(wxPoint
), arrow_points
, rect
.x
, rect
.y
);
1398 void wxRibbonMSWArtProvider::DrawDropdownArrow(wxDC
& dc
, int x
, int y
, const wxColour
& colour
)
1400 wxPoint arrow_points
[3];
1401 wxBrush
brush(colour
);
1402 arrow_points
[0] = wxPoint(1, 2);
1403 arrow_points
[1] = arrow_points
[0] + wxPoint(-3, -3);
1404 arrow_points
[2] = arrow_points
[0] + wxPoint( 3, -3);
1405 dc
.SetPen(*wxTRANSPARENT_PEN
);
1407 dc
.DrawPolygon(sizeof(arrow_points
)/sizeof(wxPoint
), arrow_points
, x
, y
);
1410 void wxRibbonMSWArtProvider::RemovePanelPadding(wxRect
* rect
)
1412 if(m_flags
& wxRIBBON_BAR_FLOW_VERTICAL
)
1424 void wxRibbonMSWArtProvider::DrawPanelBackground(
1429 DrawPartialPageBackground(dc
, wnd
, rect
, false);
1431 wxRect
true_rect(rect
);
1432 RemovePanelPadding(&true_rect
);
1436 dc
.SetFont(m_panel_label_font
);
1437 dc
.SetPen(*wxTRANSPARENT_PEN
);
1438 if(wnd
->IsHovered())
1440 dc
.SetBrush(m_panel_hover_label_background_brush
);
1441 dc
.SetTextForeground(m_panel_hover_label_colour
);
1445 dc
.SetBrush(m_panel_label_background_brush
);
1446 dc
.SetTextForeground(m_panel_label_colour
);
1449 wxRect
label_rect(true_rect
);
1450 wxString label
= wnd
->GetLabel();
1451 bool clip_label
= false;
1452 wxSize
label_size(dc
.GetTextExtent(label
));
1454 label_rect
.SetX(label_rect
.GetX() + 1);
1455 label_rect
.SetWidth(label_rect
.GetWidth() - 2);
1456 label_rect
.SetHeight(label_size
.GetHeight() + 2);
1457 label_rect
.SetY(true_rect
.GetBottom() - label_rect
.GetHeight());
1458 label_height
= label_rect
.GetHeight();
1460 if(label_size
.GetWidth() > label_rect
.GetWidth())
1462 // Test if there is enough length for 3 letters and ...
1463 wxString new_label
= label
.Mid(0, 3) + wxT("...");
1464 label_size
= dc
.GetTextExtent(new_label
);
1465 if(label_size
.GetWidth() > label_rect
.GetWidth())
1467 // Not enough room for three characters and ...
1468 // Display the entire label and just crop it
1473 // Room for some characters and ...
1474 // Display as many characters as possible and append ...
1475 for(size_t len
= label
.Len() - 1; len
>= 3; --len
)
1477 new_label
= label
.Mid(0, len
) + wxT("...");
1478 label_size
= dc
.GetTextExtent(new_label
);
1479 if(label_size
.GetWidth() <= label_rect
.GetWidth())
1488 dc
.DrawRectangle(label_rect
.GetX(), label_rect
.GetY(), label_rect
.GetWidth(), label_rect
.GetHeight());
1491 wxDCClipper
clip(dc
, label_rect
);
1492 dc
.DrawText(label
, label_rect
.x
, label_rect
.y
+
1493 (label_rect
.GetHeight() - label_size
.GetHeight()) / 2);
1497 dc
.DrawText(label
, label_rect
.x
+
1498 (label_rect
.GetWidth() - label_size
.GetWidth()) / 2,
1500 (label_rect
.GetHeight() - label_size
.GetHeight()) / 2);
1504 if(wnd
->IsHovered())
1506 wxRect
client_rect(true_rect
);
1508 client_rect
.width
-= 2;
1510 client_rect
.height
-= 2 + label_height
;
1511 DrawPartialPageBackground(dc
, wnd
, client_rect
, true);
1514 DrawPanelBorder(dc
, true_rect
, m_panel_border_pen
, m_panel_border_gradient_pen
);
1517 void wxRibbonMSWArtProvider::DrawGalleryBackground(
1519 wxRibbonGallery
* wnd
,
1522 DrawPartialPageBackground(dc
, wnd
, rect
);
1524 if(wnd
->IsHovered())
1526 dc
.SetPen(*wxTRANSPARENT_PEN
);
1527 dc
.SetBrush(m_gallery_hover_background_brush
);
1528 if(m_flags
& wxRIBBON_BAR_FLOW_VERTICAL
)
1530 dc
.DrawRectangle(rect
.x
+ 1, rect
.y
+ 1, rect
.width
- 2,
1535 dc
.DrawRectangle(rect
.x
+ 1, rect
.y
+ 1, rect
.width
- 16,
1540 dc
.SetPen(m_gallery_border_pen
);
1542 dc
.DrawLine(rect
.x
+ 1, rect
.y
, rect
.x
+ rect
.width
- 1, rect
.y
);
1543 dc
.DrawLine(rect
.x
, rect
.y
+ 1, rect
.x
, rect
.y
+ rect
.height
- 1);
1544 dc
.DrawLine(rect
.x
+ 1, rect
.y
+ rect
.height
- 1, rect
.x
+ rect
.width
- 1,
1545 rect
.y
+ rect
.height
- 1);
1546 dc
.DrawLine(rect
.x
+ rect
.width
- 1, rect
.y
+ 1, rect
.x
+ rect
.width
- 1,
1547 rect
.y
+ rect
.height
- 1);
1549 DrawGalleryBackgroundCommon(dc
, wnd
, rect
);
1552 void wxRibbonMSWArtProvider::DrawGalleryBackgroundCommon(wxDC
& dc
,
1553 wxRibbonGallery
* wnd
,
1556 wxRect up_btn
, down_btn
, ext_btn
;
1558 if(m_flags
& wxRIBBON_BAR_FLOW_VERTICAL
)
1560 // Divider between items and buttons
1561 dc
.DrawLine(rect
.x
, rect
.y
+ rect
.height
- 15, rect
.x
+ rect
.width
,
1562 rect
.y
+ rect
.height
- 15);
1564 up_btn
= wxRect(rect
.x
, rect
.y
+ rect
.height
- 15, rect
.width
/ 3, 15);
1566 down_btn
= wxRect(up_btn
.GetRight() + 1, up_btn
.GetTop(),
1567 up_btn
.GetWidth(), up_btn
.GetHeight());
1568 dc
.DrawLine(down_btn
.GetLeft(), down_btn
.GetTop(), down_btn
.GetLeft(),
1569 down_btn
.GetBottom());
1571 ext_btn
= wxRect(down_btn
.GetRight() + 1, up_btn
.GetTop(), rect
.width
-
1572 up_btn
.GetWidth() - down_btn
.GetWidth() - 1, up_btn
.GetHeight());
1573 dc
.DrawLine(ext_btn
.GetLeft(), ext_btn
.GetTop(), ext_btn
.GetLeft(),
1574 ext_btn
.GetBottom());
1578 // Divider between items and buttons
1579 dc
.DrawLine(rect
.x
+ rect
.width
- 15, rect
.y
, rect
.x
+ rect
.width
- 15,
1580 rect
.y
+ rect
.height
);
1582 up_btn
= wxRect(rect
.x
+ rect
.width
- 15, rect
.y
, 15, rect
.height
/ 3);
1584 down_btn
= wxRect(up_btn
.GetLeft(), up_btn
.GetBottom() + 1,
1585 up_btn
.GetWidth(), up_btn
.GetHeight());
1586 dc
.DrawLine(down_btn
.GetLeft(), down_btn
.GetTop(), down_btn
.GetRight(),
1589 ext_btn
= wxRect(up_btn
.GetLeft(), down_btn
.GetBottom() + 1, up_btn
.GetWidth(),
1590 rect
.height
- up_btn
.GetHeight() - down_btn
.GetHeight() - 1);
1591 dc
.DrawLine(ext_btn
.GetLeft(), ext_btn
.GetTop(), ext_btn
.GetRight(),
1595 DrawGalleryButton(dc
, up_btn
, wnd
->GetUpButtonState(),
1596 m_gallery_up_bitmap
);
1597 DrawGalleryButton(dc
, down_btn
, wnd
->GetDownButtonState(),
1598 m_gallery_down_bitmap
);
1599 DrawGalleryButton(dc
, ext_btn
, wnd
->GetExtensionButtonState(),
1600 m_gallery_extension_bitmap
);
1603 void wxRibbonMSWArtProvider::DrawGalleryButton(wxDC
& dc
,
1605 wxRibbonGalleryButtonState state
,
1608 wxBitmap btn_bitmap
;
1609 wxBrush btn_top_brush
;
1610 wxColour btn_colour
;
1611 wxColour btn_grad_colour
;
1614 case wxRIBBON_GALLERY_BUTTON_NORMAL
:
1615 btn_top_brush
= m_gallery_button_background_top_brush
;
1616 btn_colour
= m_gallery_button_background_colour
;
1617 btn_grad_colour
= m_gallery_button_background_gradient_colour
;
1618 btn_bitmap
= bitmaps
[0];
1620 case wxRIBBON_GALLERY_BUTTON_HOVERED
:
1621 btn_top_brush
= m_gallery_button_hover_background_top_brush
;
1622 btn_colour
= m_gallery_button_hover_background_colour
;
1623 btn_grad_colour
= m_gallery_button_hover_background_gradient_colour
;
1624 btn_bitmap
= bitmaps
[1];
1626 case wxRIBBON_GALLERY_BUTTON_ACTIVE
:
1627 btn_top_brush
= m_gallery_button_active_background_top_brush
;
1628 btn_colour
= m_gallery_button_active_background_colour
;
1629 btn_grad_colour
= m_gallery_button_active_background_gradient_colour
;
1630 btn_bitmap
= bitmaps
[2];
1632 case wxRIBBON_GALLERY_BUTTON_DISABLED
:
1633 btn_top_brush
= m_gallery_button_disabled_background_top_brush
;
1634 btn_colour
= m_gallery_button_disabled_background_colour
;
1635 btn_grad_colour
= m_gallery_button_disabled_background_gradient_colour
;
1636 btn_bitmap
= bitmaps
[3];
1642 if(m_flags
& wxRIBBON_BAR_FLOW_VERTICAL
)
1653 dc
.SetPen(*wxTRANSPARENT_PEN
);
1654 dc
.SetBrush(btn_top_brush
);
1655 dc
.DrawRectangle(rect
.x
, rect
.y
, rect
.width
, rect
.height
/ 2);
1658 lower
.height
= (lower
.height
+ 1) / 2;
1659 lower
.y
+= rect
.height
- lower
.height
;
1660 dc
.GradientFillLinear(lower
, btn_colour
, btn_grad_colour
, wxSOUTH
);
1662 dc
.DrawBitmap(btn_bitmap
, rect
.x
+ rect
.width
/ 2 - 2, lower
.y
- 2, true);
1665 void wxRibbonMSWArtProvider::DrawGalleryItemBackground(
1667 wxRibbonGallery
* wnd
,
1669 wxRibbonGalleryItem
* item
)
1671 if(wnd
->GetHoveredItem() != item
&& wnd
->GetActiveItem() != item
&&
1672 wnd
->GetSelection() != item
)
1675 dc
.SetPen(m_gallery_item_border_pen
);
1676 dc
.DrawLine(rect
.x
+ 1, rect
.y
, rect
.x
+ rect
.width
- 1, rect
.y
);
1677 dc
.DrawLine(rect
.x
, rect
.y
+ 1, rect
.x
, rect
.y
+ rect
.height
- 1);
1678 dc
.DrawLine(rect
.x
+ 1, rect
.y
+ rect
.height
- 1, rect
.x
+ rect
.width
- 1,
1679 rect
.y
+ rect
.height
- 1);
1680 dc
.DrawLine(rect
.x
+ rect
.width
- 1, rect
.y
+ 1, rect
.x
+ rect
.width
- 1,
1681 rect
.y
+ rect
.height
- 1);
1685 wxColour bg_gradient_colour
;
1687 if(wnd
->GetActiveItem() == item
|| wnd
->GetSelection() == item
)
1689 top_brush
= m_gallery_button_active_background_top_brush
;
1690 bg_colour
= m_gallery_button_active_background_colour
;
1691 bg_gradient_colour
= m_gallery_button_active_background_gradient_colour
;
1695 top_brush
= m_gallery_button_hover_background_top_brush
;
1696 bg_colour
= m_gallery_button_hover_background_colour
;
1697 bg_gradient_colour
= m_gallery_button_hover_background_gradient_colour
;
1705 dc
.SetPen(*wxTRANSPARENT_PEN
);
1706 dc
.SetBrush(top_brush
);
1707 dc
.DrawRectangle(upper
.x
, upper
.y
, upper
.width
, upper
.height
);
1709 wxRect
lower(upper
);
1710 lower
.y
+= lower
.height
;
1711 lower
.height
= rect
.height
- 2 - lower
.height
;
1712 dc
.GradientFillLinear(lower
, bg_colour
, bg_gradient_colour
, wxSOUTH
);
1715 void wxRibbonMSWArtProvider::DrawPanelBorder(wxDC
& dc
, const wxRect
& rect
,
1716 wxPen
& primary_colour
,
1717 wxPen
& secondary_colour
)
1719 wxPoint border_points
[9];
1720 border_points
[0] = wxPoint(2, 0);
1721 border_points
[1] = wxPoint(rect
.width
- 3, 0);
1722 border_points
[2] = wxPoint(rect
.width
- 1, 2);
1723 border_points
[3] = wxPoint(rect
.width
- 1, rect
.height
- 3);
1724 border_points
[4] = wxPoint(rect
.width
- 3, rect
.height
- 1);
1725 border_points
[5] = wxPoint(2, rect
.height
- 1);
1726 border_points
[6] = wxPoint(0, rect
.height
- 3);
1727 border_points
[7] = wxPoint(0, 2);
1729 if(primary_colour
.GetColour() == secondary_colour
.GetColour())
1731 border_points
[8] = border_points
[0];
1732 dc
.SetPen(primary_colour
);
1733 dc
.DrawLines(sizeof(border_points
)/sizeof(wxPoint
), border_points
, rect
.x
, rect
.y
);
1737 dc
.SetPen(primary_colour
);
1738 dc
.DrawLines(3, border_points
, rect
.x
, rect
.y
);
1740 #define SingleLine(start, finish) \
1741 dc.DrawLine(start.x + rect.x, start.y + rect.y, finish.x + rect.x, finish.y + rect.y)
1743 SingleLine(border_points
[0], border_points
[7]);
1744 dc
.SetPen(secondary_colour
);
1745 dc
.DrawLines(3, border_points
+ 4, rect
.x
, rect
.y
);
1746 SingleLine(border_points
[4], border_points
[3]);
1750 border_points
[6] = border_points
[2];
1751 wxRibbonDrawParallelGradientLines(dc
, 2, border_points
+ 6, 0, 1,
1752 border_points
[3].y
- border_points
[2].y
+ 1, rect
.x
, rect
.y
,
1753 primary_colour
.GetColour(), secondary_colour
.GetColour());
1757 void wxRibbonMSWArtProvider::DrawMinimisedPanel(
1763 DrawPartialPageBackground(dc
, wnd
, rect
, false);
1765 wxRect
true_rect(rect
);
1766 RemovePanelPadding(&true_rect
);
1768 if(wnd
->GetExpandedPanel() != NULL
)
1770 wxRect
client_rect(true_rect
);
1772 client_rect
.width
-= 2;
1774 client_rect
.height
= (rect
.y
+ rect
.height
/ 5) - client_rect
.x
;
1775 dc
.GradientFillLinear(client_rect
,
1776 m_panel_active_background_top_colour
,
1777 m_panel_active_background_top_gradient_colour
, wxSOUTH
);
1779 client_rect
.y
+= client_rect
.height
;
1780 client_rect
.height
= (true_rect
.y
+ true_rect
.height
) - client_rect
.y
;
1781 dc
.GradientFillLinear(client_rect
,
1782 m_panel_active_background_colour
,
1783 m_panel_active_background_gradient_colour
, wxSOUTH
);
1785 else if(wnd
->IsHovered())
1787 wxRect
client_rect(true_rect
);
1789 client_rect
.width
-= 2;
1791 client_rect
.height
-= 2;
1792 DrawPartialPageBackground(dc
, wnd
, client_rect
, true);
1796 DrawMinimisedPanelCommon(dc
, wnd
, true_rect
, &preview
);
1798 dc
.SetBrush(m_panel_hover_label_background_brush
);
1799 dc
.SetPen(*wxTRANSPARENT_PEN
);
1800 dc
.DrawRectangle(preview
.x
+ 1, preview
.y
+ preview
.height
- 8,
1801 preview
.width
- 2, 7);
1803 int mid_pos
= rect
.y
+ rect
.height
/ 5 - preview
.y
;
1804 if(mid_pos
< 0 || mid_pos
>= preview
.height
)
1806 wxRect
full_rect(preview
);
1809 full_rect
.width
-= 2;
1810 full_rect
.height
-= 9;
1813 dc
.GradientFillLinear(full_rect
,
1814 m_page_hover_background_colour
,
1815 m_page_hover_background_gradient_colour
, wxSOUTH
);
1819 dc
.GradientFillLinear(full_rect
,
1820 m_page_hover_background_top_colour
,
1821 m_page_hover_background_top_gradient_colour
, wxSOUTH
);
1826 wxRect
top_rect(preview
);
1829 top_rect
.width
-= 2;
1830 top_rect
.height
= mid_pos
;
1831 dc
.GradientFillLinear(top_rect
,
1832 m_page_hover_background_top_colour
,
1833 m_page_hover_background_top_gradient_colour
, wxSOUTH
);
1835 wxRect
btm_rect(top_rect
);
1836 btm_rect
.y
= preview
.y
+ mid_pos
;
1837 btm_rect
.height
= preview
.y
+ preview
.height
- 7 - btm_rect
.y
;
1838 dc
.GradientFillLinear(btm_rect
,
1839 m_page_hover_background_colour
,
1840 m_page_hover_background_gradient_colour
, wxSOUTH
);
1845 dc
.DrawBitmap(bitmap
, preview
.x
+ (preview
.width
- bitmap
.GetWidth()) / 2,
1846 preview
.y
+ (preview
.height
- 7 - bitmap
.GetHeight()) / 2, true);
1849 DrawPanelBorder(dc
, preview
, m_panel_border_pen
, m_panel_border_gradient_pen
);
1851 DrawPanelBorder(dc
, true_rect
, m_panel_minimised_border_pen
,
1852 m_panel_minimised_border_gradient_pen
);
1855 void wxRibbonMSWArtProvider::DrawMinimisedPanelCommon(
1858 const wxRect
& true_rect
,
1859 wxRect
* preview_rect
)
1861 wxRect
preview(0, 0, 32, 32);
1862 if(m_flags
& wxRIBBON_BAR_FLOW_VERTICAL
)
1864 preview
.x
= true_rect
.x
+ 4;
1865 preview
.y
= true_rect
.y
+ (true_rect
.height
- preview
.height
) / 2;
1869 preview
.x
= true_rect
.x
+ (true_rect
.width
- preview
.width
) / 2;
1870 preview
.y
= true_rect
.y
+ 4;
1873 *preview_rect
= preview
;
1875 wxCoord label_width
, label_height
;
1876 dc
.SetFont(m_panel_label_font
);
1877 dc
.GetTextExtent(wnd
->GetLabel(), &label_width
, &label_height
);
1879 int xpos
= true_rect
.x
+ (true_rect
.width
- label_width
+ 1) / 2;
1880 int ypos
= preview
.y
+ preview
.height
+ 5;
1882 if(m_flags
& wxRIBBON_BAR_FLOW_VERTICAL
)
1884 xpos
= preview
.x
+ preview
.width
+ 5;
1885 ypos
= true_rect
.y
+ (true_rect
.height
- label_height
) / 2;
1888 dc
.SetTextForeground(m_panel_minimised_label_colour
);
1889 dc
.DrawText(wnd
->GetLabel(), xpos
, ypos
);
1892 wxPoint arrow_points
[3];
1893 if(m_flags
& wxRIBBON_BAR_FLOW_VERTICAL
)
1895 xpos
+= label_width
;
1896 arrow_points
[0] = wxPoint(xpos
+ 5, ypos
+ label_height
/ 2);
1897 arrow_points
[1] = arrow_points
[0] + wxPoint(-3, 3);
1898 arrow_points
[2] = arrow_points
[0] + wxPoint(-3, -3);
1902 ypos
+= label_height
;
1903 arrow_points
[0] = wxPoint(true_rect
.width
/ 2, ypos
+ 5);
1904 arrow_points
[1] = arrow_points
[0] + wxPoint(-3, -3);
1905 arrow_points
[2] = arrow_points
[0] + wxPoint( 3, -3);
1908 dc
.SetPen(*wxTRANSPARENT_PEN
);
1909 wxBrush
B(m_panel_minimised_label_colour
);
1911 dc
.DrawPolygon(sizeof(arrow_points
)/sizeof(wxPoint
), arrow_points
,
1912 true_rect
.x
, true_rect
.y
);
1915 void wxRibbonMSWArtProvider::DrawButtonBarBackground(
1920 DrawPartialPageBackground(dc
, wnd
, rect
, true);
1923 void wxRibbonMSWArtProvider::DrawPartialPageBackground(
1929 // Assume the window is a child of a ribbon page, and also check for a
1930 // hovered panel somewhere between the window and the page, as it causes
1931 // the background to change.
1932 wxPoint
offset(wnd
->GetPosition());
1933 wxRibbonPage
* page
= NULL
;
1934 wxWindow
* parent
= wnd
->GetParent();
1935 wxRibbonPanel
* panel
= NULL
;
1936 bool hovered
= false;
1938 panel
= wxDynamicCast(wnd
, wxRibbonPanel
);
1941 hovered
= allow_hovered
&& panel
->IsHovered();
1942 if(panel
->GetExpandedDummy() != NULL
)
1944 offset
= panel
->GetExpandedDummy()->GetPosition();
1945 parent
= panel
->GetExpandedDummy()->GetParent();
1948 for(; parent
; parent
= parent
->GetParent())
1952 panel
= wxDynamicCast(parent
, wxRibbonPanel
);
1955 hovered
= allow_hovered
&& panel
->IsHovered();
1956 if(panel
->GetExpandedDummy() != NULL
)
1958 parent
= panel
->GetExpandedDummy();
1962 page
= wxDynamicCast(parent
, wxRibbonPage
);
1967 offset
+= parent
->GetPosition();
1971 DrawPartialPageBackground(dc
, wnd
, rect
, page
, offset
, hovered
);
1975 // No page found - fallback to painting with a stock brush
1976 dc
.SetBrush(*wxWHITE_BRUSH
);
1977 dc
.SetPen(*wxTRANSPARENT_PEN
);
1978 dc
.DrawRectangle(rect
.x
, rect
.y
, rect
.width
, rect
.height
);
1981 void wxRibbonMSWArtProvider::DrawButtonBarButton(
1983 wxWindow
* WXUNUSED(wnd
),
1985 wxRibbonButtonKind kind
,
1987 const wxString
& label
,
1988 const wxBitmap
& bitmap_large
,
1989 const wxBitmap
& bitmap_small
)
1991 if(state
& (wxRIBBON_BUTTONBAR_BUTTON_HOVER_MASK
|
1992 wxRIBBON_BUTTONBAR_BUTTON_ACTIVE_MASK
))
1994 if(state
& wxRIBBON_BUTTONBAR_BUTTON_ACTIVE_MASK
)
1995 dc
.SetPen(m_button_bar_active_border_pen
);
1997 dc
.SetPen(m_button_bar_hover_border_pen
);
1999 wxRect
bg_rect(rect
);
2003 bg_rect
.height
-= 2;
2005 wxRect
bg_rect_top(bg_rect
);
2006 bg_rect_top
.height
/= 3;
2007 bg_rect
.y
+= bg_rect_top
.height
;
2008 bg_rect
.height
-= bg_rect_top
.height
;
2010 if(kind
== wxRIBBON_BUTTON_HYBRID
)
2012 switch(state
& wxRIBBON_BUTTONBAR_BUTTON_SIZE_MASK
)
2014 case wxRIBBON_BUTTONBAR_BUTTON_LARGE
:
2016 int iYBorder
= rect
.y
+ bitmap_large
.GetHeight() + 4;
2017 wxRect
partial_bg(rect
);
2018 if(state
& wxRIBBON_BUTTONBAR_BUTTON_NORMAL_HOVERED
)
2020 partial_bg
.SetBottom(iYBorder
- 1);
2024 partial_bg
.height
-= (iYBorder
- partial_bg
.y
+ 1);
2025 partial_bg
.y
= iYBorder
+ 1;
2027 dc
.DrawLine(rect
.x
, iYBorder
, rect
.x
+ rect
.width
, iYBorder
);
2028 bg_rect
.Intersect(partial_bg
);
2029 bg_rect_top
.Intersect(partial_bg
);
2032 case wxRIBBON_BUTTONBAR_BUTTON_MEDIUM
:
2034 int iArrowWidth
= 9;
2035 if(state
& wxRIBBON_BUTTONBAR_BUTTON_NORMAL_HOVERED
)
2037 bg_rect
.width
-= iArrowWidth
;
2038 bg_rect_top
.width
-= iArrowWidth
;
2039 dc
.DrawLine(bg_rect_top
.x
+ bg_rect_top
.width
,
2040 rect
.y
, bg_rect_top
.x
+ bg_rect_top
.width
,
2041 rect
.y
+ rect
.height
);
2046 bg_rect
.x
+= bg_rect
.width
- iArrowWidth
;
2047 bg_rect_top
.x
+= bg_rect_top
.width
- iArrowWidth
;
2048 bg_rect
.width
= iArrowWidth
;
2049 bg_rect_top
.width
= iArrowWidth
;
2050 dc
.DrawLine(bg_rect_top
.x
- 1, rect
.y
,
2051 bg_rect_top
.x
- 1, rect
.y
+ rect
.height
);
2055 case wxRIBBON_BUTTONBAR_BUTTON_SMALL
:
2060 if(state
& wxRIBBON_BUTTONBAR_BUTTON_ACTIVE_MASK
)
2062 dc
.GradientFillLinear(bg_rect_top
,
2063 m_button_bar_active_background_top_colour
,
2064 m_button_bar_active_background_top_gradient_colour
, wxSOUTH
);
2065 dc
.GradientFillLinear(bg_rect
,
2066 m_button_bar_active_background_colour
,
2067 m_button_bar_active_background_gradient_colour
, wxSOUTH
);
2071 dc
.GradientFillLinear(bg_rect_top
,
2072 m_button_bar_hover_background_top_colour
,
2073 m_button_bar_hover_background_top_gradient_colour
, wxSOUTH
);
2074 dc
.GradientFillLinear(bg_rect
,
2075 m_button_bar_hover_background_colour
,
2076 m_button_bar_hover_background_gradient_colour
, wxSOUTH
);
2079 wxPoint border_points
[9];
2080 border_points
[0] = wxPoint(2, 0);
2081 border_points
[1] = wxPoint(rect
.width
- 3, 0);
2082 border_points
[2] = wxPoint(rect
.width
- 1, 2);
2083 border_points
[3] = wxPoint(rect
.width
- 1, rect
.height
- 3);
2084 border_points
[4] = wxPoint(rect
.width
- 3, rect
.height
- 1);
2085 border_points
[5] = wxPoint(2, rect
.height
- 1);
2086 border_points
[6] = wxPoint(0, rect
.height
- 3);
2087 border_points
[7] = wxPoint(0, 2);
2088 border_points
[8] = border_points
[0];
2090 dc
.DrawLines(sizeof(border_points
)/sizeof(wxPoint
), border_points
,
2094 dc
.SetFont(m_button_bar_label_font
);
2095 dc
.SetTextForeground(m_button_bar_label_colour
);
2096 DrawButtonBarButtonForeground(dc
, rect
, kind
, state
, label
, bitmap_large
,
2100 void wxRibbonMSWArtProvider::DrawButtonBarButtonForeground(
2103 wxRibbonButtonKind kind
,
2105 const wxString
& label
,
2106 const wxBitmap
& bitmap_large
,
2107 const wxBitmap
& bitmap_small
)
2109 switch(state
& wxRIBBON_BUTTONBAR_BUTTON_SIZE_MASK
)
2111 case wxRIBBON_BUTTONBAR_BUTTON_LARGE
:
2113 const int padding
= 2;
2114 dc
.DrawBitmap(bitmap_large
,
2115 rect
.x
+ (rect
.width
- bitmap_large
.GetWidth()) / 2,
2116 rect
.y
+ padding
, true);
2117 int ypos
= rect
.y
+ padding
+ bitmap_large
.GetHeight() + padding
;
2118 int arrow_width
= kind
== wxRIBBON_BUTTON_NORMAL
? 0 : 8;
2119 wxCoord label_w
, label_h
;
2120 dc
.GetTextExtent(label
, &label_w
, &label_h
);
2121 if(label_w
+ 2 * padding
<= rect
.width
)
2123 dc
.DrawText(label
, rect
.x
+ (rect
.width
- label_w
) / 2, ypos
);
2124 if(arrow_width
!= 0)
2126 DrawDropdownArrow(dc
, rect
.x
+ rect
.width
/ 2,
2127 ypos
+ (label_h
* 3) / 2,
2128 m_button_bar_label_colour
);
2133 size_t breaki
= label
.Len();
2137 if(wxRibbonCanLabelBreakAtPosition(label
, breaki
))
2139 wxString label_top
= label
.Mid(0, breaki
);
2140 dc
.GetTextExtent(label_top
, &label_w
, &label_h
);
2141 if(label_w
+ 2 * padding
<= rect
.width
)
2143 dc
.DrawText(label_top
,
2144 rect
.x
+ (rect
.width
- label_w
) / 2, ypos
);
2146 wxString label_bottom
= label
.Mid(breaki
+ 1);
2147 dc
.GetTextExtent(label_bottom
, &label_w
, &label_h
);
2148 label_w
+= arrow_width
;
2149 int iX
= rect
.x
+ (rect
.width
- label_w
) / 2;
2150 dc
.DrawText(label_bottom
, iX
, ypos
);
2151 if(arrow_width
!= 0)
2153 DrawDropdownArrow(dc
,
2154 iX
+ 2 +label_w
- arrow_width
,
2155 ypos
+ label_h
/ 2 + 1,
2156 m_button_bar_label_colour
);
2161 } while(breaki
> 0);
2165 case wxRIBBON_BUTTONBAR_BUTTON_MEDIUM
:
2167 int x_cursor
= rect
.x
+ 2;
2168 dc
.DrawBitmap(bitmap_small
, x_cursor
,
2169 rect
.y
+ (rect
.height
- bitmap_small
.GetHeight())/2, true);
2170 x_cursor
+= bitmap_small
.GetWidth() + 2;
2171 wxCoord label_w
, label_h
;
2172 dc
.GetTextExtent(label
, &label_w
, &label_h
);
2173 dc
.DrawText(label
, x_cursor
,
2174 rect
.y
+ (rect
.height
- label_h
) / 2);
2175 x_cursor
+= label_w
+ 3;
2176 if(kind
!= wxRIBBON_BUTTON_NORMAL
)
2178 DrawDropdownArrow(dc
, x_cursor
, rect
.y
+ rect
.height
/ 2,
2179 m_button_bar_label_colour
);
2189 void wxRibbonMSWArtProvider::DrawToolBarBackground(
2194 DrawPartialPageBackground(dc
, wnd
, rect
);
2197 void wxRibbonMSWArtProvider::DrawToolGroupBackground(
2199 wxWindow
* WXUNUSED(wnd
),
2202 dc
.SetPen(m_toolbar_border_pen
);
2204 outline
[0] = wxPoint(2, 0);
2205 outline
[1] = wxPoint(rect
.width
- 3, 0);
2206 outline
[2] = wxPoint(rect
.width
- 1, 2);
2207 outline
[3] = wxPoint(rect
.width
- 1, rect
.height
- 3);
2208 outline
[4] = wxPoint(rect
.width
- 3, rect
.height
- 1);
2209 outline
[5] = wxPoint(2, rect
.height
- 1);
2210 outline
[6] = wxPoint(0, rect
.height
- 3);
2211 outline
[7] = wxPoint(0, 2);
2212 outline
[8] = outline
[0];
2214 dc
.DrawLines(sizeof(outline
)/sizeof(wxPoint
), outline
, rect
.x
, rect
.y
);
2217 void wxRibbonMSWArtProvider::DrawTool(
2219 wxWindow
* WXUNUSED(wnd
),
2221 const wxBitmap
& bitmap
,
2222 wxRibbonButtonKind kind
,
2225 wxRect
bg_rect(rect
);
2227 if((state
& wxRIBBON_TOOLBAR_TOOL_LAST
) == 0)
2229 bool is_split_hybrid
= (kind
== wxRIBBON_BUTTON_HYBRID
&& (state
&
2230 (wxRIBBON_TOOLBAR_TOOL_HOVER_MASK
| wxRIBBON_TOOLBAR_TOOL_ACTIVE_MASK
)));
2233 wxRect
bg_rect_top(bg_rect
);
2234 bg_rect_top
.height
= (bg_rect_top
.height
* 2) / 5;
2235 wxRect
bg_rect_btm(bg_rect
);
2236 bg_rect_btm
.y
+= bg_rect_top
.height
;
2237 bg_rect_btm
.height
-= bg_rect_top
.height
;
2238 wxColour bg_top_colour
= m_tool_background_top_colour
;
2239 wxColour bg_top_grad_colour
= m_tool_background_top_gradient_colour
;
2240 wxColour bg_colour
= m_tool_background_colour
;
2241 wxColour bg_grad_colour
= m_tool_background_gradient_colour
;
2242 if(state
& wxRIBBON_TOOLBAR_TOOL_ACTIVE_MASK
)
2244 bg_top_colour
= m_tool_active_background_top_colour
;
2245 bg_top_grad_colour
= m_tool_active_background_top_gradient_colour
;
2246 bg_colour
= m_tool_active_background_colour
;
2247 bg_grad_colour
= m_tool_active_background_gradient_colour
;
2249 else if(state
& wxRIBBON_TOOLBAR_TOOL_HOVER_MASK
)
2251 bg_top_colour
= m_tool_hover_background_top_colour
;
2252 bg_top_grad_colour
= m_tool_hover_background_top_gradient_colour
;
2253 bg_colour
= m_tool_hover_background_colour
;
2254 bg_grad_colour
= m_tool_hover_background_gradient_colour
;
2256 dc
.GradientFillLinear(bg_rect_top
, bg_top_colour
, bg_top_grad_colour
, wxSOUTH
);
2257 dc
.GradientFillLinear(bg_rect_btm
, bg_colour
, bg_grad_colour
, wxSOUTH
);
2260 wxRect
nonrect(bg_rect
);
2261 if(state
& (wxRIBBON_TOOLBAR_TOOL_DROPDOWN_HOVERED
|
2262 wxRIBBON_TOOLBAR_TOOL_DROPDOWN_ACTIVE
))
2268 nonrect
.x
+= nonrect
.width
- 8;
2271 wxBrush
B(m_tool_hover_background_top_colour
);
2272 dc
.SetPen(*wxTRANSPARENT_PEN
);
2274 dc
.DrawRectangle(nonrect
.x
, nonrect
.y
, nonrect
.width
, nonrect
.height
);
2278 dc
.SetPen(m_toolbar_border_pen
);
2279 if(state
& wxRIBBON_TOOLBAR_TOOL_FIRST
)
2281 dc
.DrawPoint(rect
.x
+ 1, rect
.y
+ 1);
2282 dc
.DrawPoint(rect
.x
+ 1, rect
.y
+ rect
.height
- 2);
2285 dc
.DrawLine(rect
.x
, rect
.y
+ 1, rect
.x
, rect
.y
+ rect
.height
- 1);
2287 if(state
& wxRIBBON_TOOLBAR_TOOL_LAST
)
2289 dc
.DrawPoint(rect
.x
+ rect
.width
- 2, rect
.y
+ 1);
2290 dc
.DrawPoint(rect
.x
+ rect
.width
- 2, rect
.y
+ rect
.height
- 2);
2294 int avail_width
= bg_rect
.GetWidth();
2295 if(kind
!= wxRIBBON_BUTTON_NORMAL
)
2300 dc
.DrawLine(rect
.x
+ avail_width
+ 1, rect
.y
,
2301 rect
.x
+ avail_width
+ 1, rect
.y
+ rect
.height
);
2303 dc
.DrawBitmap(m_toolbar_drop_bitmap
, bg_rect
.x
+ avail_width
+ 2,
2304 bg_rect
.y
+ (bg_rect
.height
/ 2) - 2, true);
2306 dc
.DrawBitmap(bitmap
, bg_rect
.x
+ (avail_width
- bitmap
.GetWidth()) / 2,
2307 bg_rect
.y
+ (bg_rect
.height
- bitmap
.GetHeight()) / 2, true);
2310 void wxRibbonMSWArtProvider::GetBarTabWidth(
2312 wxWindow
* WXUNUSED(wnd
),
2313 const wxString
& label
,
2314 const wxBitmap
& bitmap
,
2316 int* small_begin_need_separator
,
2317 int* small_must_have_separator
,
2322 if((m_flags
& wxRIBBON_BAR_SHOW_PAGE_LABELS
) && !label
.IsEmpty())
2324 dc
.SetFont(m_tab_label_font
);
2325 width
+= dc
.GetTextExtent(label
).GetWidth();
2326 min
+= wxMin(25, width
); // enough for a few chars
2329 // gap between label and bitmap
2334 if((m_flags
& wxRIBBON_BAR_SHOW_PAGE_ICONS
) && bitmap
.IsOk())
2336 width
+= bitmap
.GetWidth();
2337 min
+= bitmap
.GetWidth();
2342 *ideal
= width
+ 30;
2344 if(small_begin_need_separator
!= NULL
)
2346 *small_begin_need_separator
= width
+ 20;
2348 if(small_must_have_separator
!= NULL
)
2350 *small_must_have_separator
= width
+ 10;
2358 int wxRibbonMSWArtProvider::GetTabCtrlHeight(
2360 wxWindow
* WXUNUSED(wnd
),
2361 const wxRibbonPageTabInfoArray
& pages
)
2363 int text_height
= 0;
2364 int icon_height
= 0;
2366 if(pages
.GetCount() <= 1 && (m_flags
& wxRIBBON_BAR_ALWAYS_SHOW_TABS
) == 0)
2368 // To preserve space, a single tab need not be displayed. We still need
2369 // two pixels of border / padding though.
2373 if(m_flags
& wxRIBBON_BAR_SHOW_PAGE_LABELS
)
2375 dc
.SetFont(m_tab_label_font
);
2376 text_height
= dc
.GetTextExtent(wxT("ABCDEFXj")).GetHeight() + 10;
2378 if(m_flags
& wxRIBBON_BAR_SHOW_PAGE_ICONS
)
2380 size_t numpages
= pages
.GetCount();
2381 for(size_t i
= 0; i
< numpages
; ++i
)
2383 const wxRibbonPageTabInfo
& info
= pages
.Item(i
);
2384 if(info
.page
->GetIcon().IsOk())
2386 icon_height
= wxMax(icon_height
, info
.page
->GetIcon().GetHeight() + 4);
2391 return wxMax(text_height
, icon_height
);
2394 wxSize
wxRibbonMSWArtProvider::GetScrollButtonMinimumSize(
2396 wxWindow
* WXUNUSED(wnd
),
2397 long WXUNUSED(style
))
2399 return wxSize(12, 12);
2402 wxSize
wxRibbonMSWArtProvider::GetPanelSize(
2404 const wxRibbonPanel
* wnd
,
2406 wxPoint
* client_offset
)
2408 dc
.SetFont(m_panel_label_font
);
2409 wxSize label_size
= dc
.GetTextExtent(wnd
->GetLabel());
2411 client_size
.IncBy(0, label_size
.GetHeight());
2412 if(m_flags
& wxRIBBON_BAR_FLOW_VERTICAL
)
2413 client_size
.IncBy(4, 8);
2415 client_size
.IncBy(6, 6);
2417 if(client_offset
!= NULL
)
2419 if(m_flags
& wxRIBBON_BAR_FLOW_VERTICAL
)
2420 *client_offset
= wxPoint(2, 3);
2422 *client_offset
= wxPoint(3, 2);
2428 wxSize
wxRibbonMSWArtProvider::GetPanelClientSize(
2430 const wxRibbonPanel
* wnd
,
2432 wxPoint
* client_offset
)
2434 dc
.SetFont(m_panel_label_font
);
2435 wxSize label_size
= dc
.GetTextExtent(wnd
->GetLabel());
2437 size
.DecBy(0, label_size
.GetHeight());
2438 if(m_flags
& wxRIBBON_BAR_FLOW_VERTICAL
)
2443 if(client_offset
!= NULL
)
2445 if(m_flags
& wxRIBBON_BAR_FLOW_VERTICAL
)
2446 *client_offset
= wxPoint(2, 3);
2448 *client_offset
= wxPoint(3, 2);
2454 wxSize
wxRibbonMSWArtProvider::GetGallerySize(
2456 const wxRibbonGallery
* WXUNUSED(wnd
),
2459 client_size
.IncBy( 2, 1); // Left / top padding
2460 if(m_flags
& wxRIBBON_BAR_FLOW_VERTICAL
)
2461 client_size
.IncBy(1, 16); // Right / bottom padding
2463 client_size
.IncBy(16, 1); // Right / bottom padding
2467 wxSize
wxRibbonMSWArtProvider::GetGalleryClientSize(
2469 const wxRibbonGallery
* WXUNUSED(wnd
),
2471 wxPoint
* client_offset
,
2472 wxRect
* scroll_up_button
,
2473 wxRect
* scroll_down_button
,
2474 wxRect
* extension_button
)
2479 if(m_flags
& wxRIBBON_BAR_FLOW_VERTICAL
)
2481 // Flow is vertical - put buttons on bottom
2482 scroll_up
.y
= size
.GetHeight() - 15;
2483 scroll_up
.height
= 15;
2485 scroll_up
.width
= (size
.GetWidth() + 2) / 3;
2486 scroll_down
.y
= scroll_up
.y
;
2487 scroll_down
.height
= scroll_up
.height
;
2488 scroll_down
.x
= scroll_up
.x
+ scroll_up
.width
;
2489 scroll_down
.width
= scroll_up
.width
;
2490 extension
.y
= scroll_down
.y
;
2491 extension
.height
= scroll_down
.height
;
2492 extension
.x
= scroll_down
.x
+ scroll_down
.width
;
2493 extension
.width
= size
.GetWidth() - scroll_up
.width
- scroll_down
.width
;
2499 // Flow is horizontal - put buttons on right
2500 scroll_up
.x
= size
.GetWidth() - 15;
2501 scroll_up
.width
= 15;
2503 scroll_up
.height
= (size
.GetHeight() + 2) / 3;
2504 scroll_down
.x
= scroll_up
.x
;
2505 scroll_down
.width
= scroll_up
.width
;
2506 scroll_down
.y
= scroll_up
.y
+ scroll_up
.height
;
2507 scroll_down
.height
= scroll_up
.height
;
2508 extension
.x
= scroll_down
.x
;
2509 extension
.width
= scroll_down
.width
;
2510 extension
.y
= scroll_down
.y
+ scroll_down
.height
;
2511 extension
.height
= size
.GetHeight() - scroll_up
.height
- scroll_down
.height
;
2516 if(client_offset
!= NULL
)
2517 *client_offset
= wxPoint(2, 1);
2518 if(scroll_up_button
!= NULL
)
2519 *scroll_up_button
= scroll_up
;
2520 if(scroll_down_button
!= NULL
)
2521 *scroll_down_button
= scroll_down
;
2522 if(extension_button
!= NULL
)
2523 *extension_button
= extension
;
2528 wxRect
wxRibbonMSWArtProvider::GetPageBackgroundRedrawArea(
2530 const wxRibbonPage
* WXUNUSED(wnd
),
2531 wxSize page_old_size
,
2532 wxSize page_new_size
)
2534 wxRect new_rect
, old_rect
;
2536 if(page_new_size
.GetWidth() != page_old_size
.GetWidth())
2538 if(page_new_size
.GetHeight() != page_old_size
.GetHeight())
2540 // Width and height both changed - redraw everything
2541 return wxRect(page_new_size
);
2545 // Only width changed - redraw right hand side
2546 const int right_edge_width
= 4;
2548 new_rect
= wxRect(page_new_size
.GetWidth() - right_edge_width
, 0, right_edge_width
, page_new_size
.GetHeight());
2549 old_rect
= wxRect(page_old_size
.GetWidth() - right_edge_width
, 0, right_edge_width
, page_old_size
.GetHeight());
2554 if(page_new_size
.GetHeight() == page_old_size
.GetHeight())
2556 // Nothing changed (should never happen) - redraw nothing
2557 return wxRect(0, 0, 0, 0);
2561 // Height changed - need to redraw everything (as the background
2562 // gradient is done vertically).
2563 return page_new_size
;
2567 new_rect
.Union(old_rect
);
2568 new_rect
.Intersect(wxRect(page_new_size
));
2572 bool wxRibbonMSWArtProvider::GetButtonBarButtonSize(
2575 wxRibbonButtonKind kind
,
2576 wxRibbonButtonBarButtonState size
,
2577 const wxString
& label
,
2578 wxSize bitmap_size_large
,
2579 wxSize bitmap_size_small
,
2580 wxSize
* button_size
,
2581 wxRect
* normal_region
,
2582 wxRect
* dropdown_region
)
2584 const int drop_button_width
= 8;
2586 dc
.SetFont(m_button_bar_label_font
);
2587 switch(size
& wxRIBBON_BUTTONBAR_BUTTON_SIZE_MASK
)
2589 case wxRIBBON_BUTTONBAR_BUTTON_SMALL
:
2590 // Small bitmap, no label
2591 *button_size
= bitmap_size_small
+ wxSize(6, 4);
2594 case wxRIBBON_BUTTON_NORMAL
:
2595 *normal_region
= wxRect(*button_size
);
2596 *dropdown_region
= wxRect(0, 0, 0, 0);
2598 case wxRIBBON_BUTTON_DROPDOWN
:
2599 *button_size
+= wxSize(drop_button_width
, 0);
2600 *dropdown_region
= wxRect(*button_size
);
2601 *normal_region
= wxRect(0, 0, 0, 0);
2603 case wxRIBBON_BUTTON_HYBRID
:
2604 *normal_region
= wxRect(*button_size
);
2605 *dropdown_region
= wxRect(button_size
->GetWidth(), 0,
2606 drop_button_width
, button_size
->GetHeight());
2607 *button_size
+= wxSize(drop_button_width
, 0);
2611 case wxRIBBON_BUTTONBAR_BUTTON_MEDIUM
:
2612 // Small bitmap, with label to the right
2614 GetButtonBarButtonSize(dc
, wnd
, kind
, wxRIBBON_BUTTONBAR_BUTTON_SMALL
,
2615 label
, bitmap_size_large
, bitmap_size_small
, button_size
,
2616 normal_region
, dropdown_region
);
2617 int text_size
= dc
.GetTextExtent(label
).GetWidth();
2618 button_size
->SetWidth(button_size
->GetWidth() + text_size
);
2621 case wxRIBBON_BUTTON_DROPDOWN
:
2622 dropdown_region
->SetWidth(dropdown_region
->GetWidth() + text_size
);
2624 case wxRIBBON_BUTTON_HYBRID
:
2625 dropdown_region
->SetX(dropdown_region
->GetX() + text_size
);
2627 case wxRIBBON_BUTTON_NORMAL
:
2628 normal_region
->SetWidth(normal_region
->GetWidth() + text_size
);
2633 case wxRIBBON_BUTTONBAR_BUTTON_LARGE
:
2634 // Large bitmap, with label below (possibly split over 2 lines)
2636 wxSize
icon_size(bitmap_size_large
);
2637 icon_size
+= wxSize(4, 4);
2638 wxCoord label_height
;
2640 dc
.GetTextExtent(label
, &best_width
, &label_height
);
2641 int best_num_lines
= 1;
2642 int last_line_extra_width
= 0;
2643 if(kind
!= wxRIBBON_BUTTON_NORMAL
)
2645 last_line_extra_width
+= 8;
2646 best_num_lines
= 2; // label on top line, button below
2649 for(i
= 0; i
< label
.Len(); ++i
)
2651 if(wxRibbonCanLabelBreakAtPosition(label
, i
))
2654 dc
.GetTextExtent(label
.Mid(0, i
- 1)).GetWidth(),
2655 dc
.GetTextExtent(label
.Mid(i
+ 1)).GetWidth() + last_line_extra_width
);
2656 if(width
< best_width
)
2663 label_height
*= 2; // Assume two lines even when only one is used
2664 // (to give all buttons a consistent height)
2665 icon_size
.SetWidth(wxMax(icon_size
.GetWidth(), best_width
) + 6);
2666 icon_size
.SetHeight(icon_size
.GetHeight() + label_height
);
2667 *button_size
= icon_size
;
2670 case wxRIBBON_BUTTON_DROPDOWN
:
2671 *dropdown_region
= wxRect(icon_size
);
2673 case wxRIBBON_BUTTON_HYBRID
:
2674 *normal_region
= wxRect(icon_size
);
2675 normal_region
->height
-= 2 + label_height
;
2676 dropdown_region
->x
= 0;
2677 dropdown_region
->y
= normal_region
->height
;
2678 dropdown_region
->width
= icon_size
.GetWidth();
2679 dropdown_region
->height
= icon_size
.GetHeight() - normal_region
->height
;
2681 case wxRIBBON_BUTTON_NORMAL
:
2682 *normal_region
= wxRect(icon_size
);
2691 wxSize
wxRibbonMSWArtProvider::GetMinimisedPanelMinimumSize(
2693 const wxRibbonPanel
* wnd
,
2694 wxSize
* desired_bitmap_size
,
2695 wxDirection
* expanded_panel_direction
)
2697 if(desired_bitmap_size
!= NULL
)
2699 *desired_bitmap_size
= wxSize(16, 16);
2701 if(expanded_panel_direction
!= NULL
)
2703 if(m_flags
& wxRIBBON_BAR_FLOW_VERTICAL
)
2704 *expanded_panel_direction
= wxEAST
;
2706 *expanded_panel_direction
= wxSOUTH
;
2708 wxSize
base_size(42, 42);
2710 dc
.SetFont(m_panel_label_font
);
2711 wxSize
label_size(dc
.GetTextExtent(wnd
->GetLabel()));
2712 label_size
.IncBy(2, 2); // Allow for differences between this DC and a paint DC
2713 label_size
.IncBy(6, 0); // Padding
2714 label_size
.y
*= 2; // Second line for dropdown button
2716 if(m_flags
& wxRIBBON_BAR_FLOW_VERTICAL
)
2718 // Label alongside icon
2719 return wxSize(base_size
.x
+ label_size
.x
,
2720 wxMax(base_size
.y
, label_size
.y
));
2724 // Label beneath icon
2725 return wxSize(wxMax(base_size
.x
, label_size
.x
),
2726 base_size
.y
+ label_size
.y
);
2730 wxSize
wxRibbonMSWArtProvider::GetToolSize(
2732 wxWindow
* WXUNUSED(wnd
),
2734 wxRibbonButtonKind kind
,
2735 bool WXUNUSED(is_first
),
2737 wxRect
* dropdown_region
)
2739 wxSize
size(bitmap_size
);
2743 if(kind
!= wxRIBBON_BUTTON_NORMAL
)
2748 if(kind
== wxRIBBON_BUTTON_DROPDOWN
)
2749 *dropdown_region
= size
;
2751 *dropdown_region
= wxRect(size
.GetWidth() - 8, 0, 8, size
.GetHeight());
2757 *dropdown_region
= wxRect(0, 0, 0, 0);
2762 #endif // wxUSE_RIBBON