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/ribbon/art.h"
22 #include "wx/ribbon/art_internal.h"
23 #include "wx/ribbon/bar.h"
24 #include "wx/ribbon/buttonbar.h"
25 #include "wx/ribbon/gallery.h"
26 #include "wx/ribbon/toolbar.h"
32 #include "wx/msw/private.h"
35 static const char* const gallery_up_xpm
[] = {
45 static const char* const gallery_down_xpm
[] = {
55 static const char* const gallery_left_xpm
[] = {
65 static const char* const gallery_right_xpm
[] = {
75 static const char* const gallery_extension_xpm
[] = {
85 wxRibbonMSWArtProvider::wxRibbonMSWArtProvider(bool set_colour_scheme
)
88 m_tab_label_font
= wxFont(8, wxDEFAULT
, wxNORMAL
, wxNORMAL
, FALSE
);
89 m_button_bar_label_font
= m_tab_label_font
;
90 m_panel_label_font
= m_tab_label_font
;
95 wxColour(194, 216, 241),
96 wxColour(255, 223, 114),
100 m_cached_tab_separator_visibility
= -10.0; // valid visibilities are in range [0, 1]
101 m_tab_separation_size
= 3;
102 m_page_border_left
= 2;
103 m_page_border_top
= 1;
104 m_page_border_right
= 2;
105 m_page_border_bottom
= 3;
106 m_panel_x_separation_size
= 1;
107 m_panel_y_separation_size
= 1;
108 m_tool_group_separation_size
= 3;
109 m_gallery_bitmap_padding_left_size
= 4;
110 m_gallery_bitmap_padding_right_size
= 4;
111 m_gallery_bitmap_padding_top_size
= 4;
112 m_gallery_bitmap_padding_bottom_size
= 4;
115 wxRibbonMSWArtProvider::~wxRibbonMSWArtProvider()
119 void wxRibbonMSWArtProvider::GetColourScheme(
122 wxColour
* tertiary
) const
125 *primary
= m_primary_scheme_colour
;
126 if(secondary
!= NULL
)
127 *secondary
= m_secondary_scheme_colour
;
129 *tertiary
= m_tertiary_scheme_colour
;
132 void wxRibbonMSWArtProvider::SetColourScheme(
133 const wxColour
& primary
,
134 const wxColour
& secondary
,
135 const wxColour
& tertiary
)
137 m_primary_scheme_colour
= primary
;
138 m_secondary_scheme_colour
= secondary
;
139 m_tertiary_scheme_colour
= tertiary
;
141 wxRibbonHSLColour
primary_hsl(primary
);
142 wxRibbonHSLColour
secondary_hsl(secondary
);
143 // tertiary not used for anything
145 // Map primary saturation from [0, 1] to [.25, .75]
146 primary_hsl
.saturation
= cos(primary_hsl
.saturation
* M_PI
) * -0.25 + 0.5;
148 // Map primary luminance from [0, 1] to [.23, .83]
149 primary_hsl
.luminance
= cos(primary_hsl
.luminance
* M_PI
) * -0.3 + 0.53;
151 // Map secondary saturation from [0, 1] to [0.16, 0.84]
152 secondary_hsl
.saturation
= cos(secondary_hsl
.saturation
* M_PI
) * -0.34 + 0.5;
154 // Map secondary luminance from [0, 1] to [0.1, 0.9]
155 secondary_hsl
.luminance
= cos(secondary_hsl
.luminance
* M_PI
) * -0.4 + 0.5;
157 #define LikePrimary(h, s, l) \
158 primary_hsl.ShiftHue(h ## f).Saturated(s ## f).Lighter(l ## f).ToRGB()
159 #define LikeSecondary(h, s, l) \
160 secondary_hsl.ShiftHue(h ## f).Saturated(s ## f).Lighter(l ## f).ToRGB()
162 m_page_border_pen
= LikePrimary(1.4, 0.00, -0.08);
164 m_page_background_top_colour
= LikePrimary(-0.1, -0.03, 0.12);
165 m_page_hover_background_top_colour
= LikePrimary(-2.8, 0.27, 0.17);
166 m_page_background_top_gradient_colour
= LikePrimary(0.1, -0.10, 0.08);
167 m_page_hover_background_top_gradient_colour
= LikePrimary(3.2, 0.16, 0.13);
168 m_page_background_colour
= LikePrimary(0.4, -0.09, 0.05);
169 m_page_hover_background_colour
= LikePrimary(0.1, 0.19, 0.10);
170 m_page_background_gradient_colour
= LikePrimary(-3.2, 0.27, 0.10);
171 m_page_hover_background_gradient_colour
= LikePrimary(1.8, 0.01, 0.15);
173 m_tab_active_background_colour
= LikePrimary(-0.1, -0.31, 0.16);
174 m_tab_active_background_gradient_colour
= LikePrimary(-0.1, -0.03, 0.12);
175 m_tab_separator_colour
= LikePrimary(0.9, 0.24, 0.05);
176 m_tab_ctrl_background_brush
= LikePrimary(1.0, 0.39, 0.07);
177 m_tab_hover_background_colour
= LikePrimary(1.3, 0.15, 0.10);
178 m_tab_hover_background_top_colour
= LikePrimary(1.4, 0.36, 0.08);
179 m_tab_border_pen
= LikePrimary(1.4, 0.03, -0.05);
180 m_tab_separator_gradient_colour
= LikePrimary(1.7, -0.15, -0.18);
181 m_tab_hover_background_top_gradient_colour
= LikePrimary(1.8, 0.34, 0.13);
182 m_tab_label_colour
= LikePrimary(4.3, 0.13, -0.49);
183 m_tab_hover_background_gradient_colour
= LikeSecondary(-1.5, -0.34, 0.01);
185 m_panel_minimised_border_gradient_pen
= LikePrimary(-6.9, -0.17, -0.09);
186 m_panel_minimised_border_pen
= LikePrimary(-5.3, -0.24, -0.06);
187 m_panel_border_gradient_pen
= LikePrimary(-5.2, -0.15, -0.06);
188 m_panel_border_pen
= LikePrimary(-2.8, -0.32, 0.02);
189 m_panel_label_background_brush
= LikePrimary(-1.5, 0.03, 0.05);
190 m_panel_active_background_gradient_colour
= LikePrimary(0.5, 0.34, 0.05);
191 m_panel_hover_label_background_brush
= LikePrimary(1.0, 0.30, 0.09);
192 m_panel_active_background_top_gradient_colour
= LikePrimary(1.4, -0.17, -0.13);
193 m_panel_active_background_colour
= LikePrimary(1.6, -0.18, -0.18);
194 m_panel_active_background_top_colour
= LikePrimary(1.7, -0.20, -0.03);
195 m_panel_label_colour
= LikePrimary(2.8, -0.14, -0.35);
196 m_panel_hover_label_colour
= m_panel_label_colour
;
197 m_panel_minimised_label_colour
= m_tab_label_colour
;
199 m_gallery_button_disabled_background_colour
= LikePrimary(-2.8, -0.46, 0.09);
200 m_gallery_button_disabled_background_top_brush
= LikePrimary(-2.8, -0.36, 0.15);
201 m_gallery_hover_background_brush
= LikePrimary(-0.8, 0.05, 0.15);
202 m_gallery_border_pen
= LikePrimary(0.7, -0.02, 0.03);
203 m_gallery_button_background_top_brush
= LikePrimary(0.8, 0.34, 0.13);
204 m_gallery_button_background_colour
= LikePrimary(1.3, 0.10, 0.08);
205 // SetColour used so that the relevant bitmaps are generated
206 SetColour(wxRIBBON_ART_GALLERY_BUTTON_FACE_COLOUR
, LikePrimary(1.4, -0.21, -0.23));
207 SetColour(wxRIBBON_ART_GALLERY_BUTTON_HOVER_FACE_COLOUR
, LikePrimary(1.5, -0.24, -0.29));
208 SetColour(wxRIBBON_ART_GALLERY_BUTTON_ACTIVE_FACE_COLOUR
, LikePrimary(1.5, -0.24, -0.29));
209 SetColour(wxRIBBON_ART_GALLERY_BUTTON_DISABLED_FACE_COLOUR
, LikePrimary(0.0, -1.0, 0.0));
210 m_gallery_button_disabled_background_gradient_colour
= LikePrimary(1.5, -0.43, 0.12);
211 m_gallery_button_background_gradient_colour
= LikePrimary(1.7, 0.11, 0.09);
212 m_gallery_item_border_pen
= LikeSecondary(-3.9, -0.16, -0.14);
213 m_gallery_button_hover_background_colour
= LikeSecondary(-0.9, 0.16, -0.07);
214 m_gallery_button_hover_background_gradient_colour
= LikeSecondary(0.1, 0.12, 0.03);
215 m_gallery_button_hover_background_top_brush
= LikeSecondary(4.3, 0.16, 0.17);
217 m_gallery_button_active_background_colour
= LikeSecondary(-9.9, 0.03, -0.22);
218 m_gallery_button_active_background_gradient_colour
= LikeSecondary(-9.5, 0.14, -0.11);
219 m_gallery_button_active_background_top_brush
= LikeSecondary(-9.0, 0.15, -0.08);
221 m_button_bar_label_colour
= m_tab_label_colour
;
222 m_button_bar_hover_border_pen
= LikeSecondary(-6.2, -0.47, -0.14);
223 m_button_bar_hover_background_gradient_colour
= LikeSecondary(-0.6, 0.16, 0.04);
224 m_button_bar_hover_background_colour
= LikeSecondary(-0.2, 0.16, -0.10);
225 m_button_bar_hover_background_top_gradient_colour
= LikeSecondary(0.2, 0.16, 0.03);
226 m_button_bar_hover_background_top_colour
= LikeSecondary(8.8, 0.16, 0.17);
227 m_button_bar_active_border_pen
= LikeSecondary(-6.2, -0.47, -0.25);
228 m_button_bar_active_background_top_colour
= LikeSecondary(-8.4, 0.08, 0.06);
229 m_button_bar_active_background_top_gradient_colour
= LikeSecondary(-9.7, 0.13, -0.07);
230 m_button_bar_active_background_colour
= LikeSecondary(-9.9, 0.14, -0.14);
231 m_button_bar_active_background_gradient_colour
= LikeSecondary(-8.7, 0.17, -0.03);
233 m_toolbar_border_pen
= LikePrimary(1.4, -0.21, -0.16);
234 SetColour(wxRIBBON_ART_TOOLBAR_FACE_COLOUR
, LikePrimary(1.4, -0.17, -0.22));
235 m_tool_background_top_colour
= LikePrimary(-1.9, -0.07, 0.06);
236 m_tool_background_top_gradient_colour
= LikePrimary(1.4, 0.12, 0.08);
237 m_tool_background_colour
= LikePrimary(1.4, -0.09, 0.03);
238 m_tool_background_gradient_colour
= LikePrimary(1.9, 0.11, 0.09);
239 m_tool_hover_background_top_colour
= LikeSecondary(3.4, 0.11, 0.16);
240 m_tool_hover_background_top_gradient_colour
= LikeSecondary(-1.4, 0.04, 0.08);
241 m_tool_hover_background_colour
= LikeSecondary(-1.8, 0.16, -0.12);
242 m_tool_hover_background_gradient_colour
= LikeSecondary(-2.6, 0.16, 0.05);
243 m_tool_active_background_top_colour
= LikeSecondary(-9.9, -0.12, -0.09);
244 m_tool_active_background_top_gradient_colour
= LikeSecondary(-8.5, 0.16, -0.12);
245 m_tool_active_background_colour
= LikeSecondary(-7.9, 0.16, -0.20);
246 m_tool_active_background_gradient_colour
= LikeSecondary(-6.6, 0.16, -0.10);
251 // Invalidate cached tab separator
252 m_cached_tab_separator_visibility
= -1.0;
255 wxRibbonArtProvider
* wxRibbonMSWArtProvider::Clone() const
257 wxRibbonMSWArtProvider
*copy
= new wxRibbonMSWArtProvider
;
262 void wxRibbonMSWArtProvider::CloneTo(wxRibbonMSWArtProvider
* copy
) const
264 for(int i
= 0; i
< 4; ++i
)
266 copy
->m_gallery_up_bitmap
[i
] = m_gallery_up_bitmap
[i
];
267 copy
->m_gallery_down_bitmap
[i
] = m_gallery_down_bitmap
[i
];
268 copy
->m_gallery_extension_bitmap
[i
] = m_gallery_extension_bitmap
[i
];
270 copy
->m_toolbar_drop_bitmap
= m_toolbar_drop_bitmap
;
272 copy
->m_primary_scheme_colour
= m_primary_scheme_colour
;
273 copy
->m_secondary_scheme_colour
= m_secondary_scheme_colour
;
274 copy
->m_tertiary_scheme_colour
= m_tertiary_scheme_colour
;
276 copy
->m_button_bar_label_colour
= m_button_bar_label_colour
;
277 copy
->m_tab_label_colour
= m_tab_label_colour
;
278 copy
->m_tab_separator_colour
= m_tab_separator_colour
;
279 copy
->m_tab_separator_gradient_colour
= m_tab_separator_gradient_colour
;
280 copy
->m_tab_active_background_colour
= m_tab_hover_background_colour
;
281 copy
->m_tab_active_background_gradient_colour
= m_tab_hover_background_gradient_colour
;
282 copy
->m_tab_hover_background_colour
= m_tab_hover_background_colour
;
283 copy
->m_tab_hover_background_gradient_colour
= m_tab_hover_background_gradient_colour
;
284 copy
->m_tab_hover_background_top_colour
= m_tab_hover_background_top_colour
;
285 copy
->m_tab_hover_background_top_gradient_colour
= m_tab_hover_background_top_gradient_colour
;
286 copy
->m_panel_label_colour
= m_panel_label_colour
;
287 copy
->m_panel_hover_label_colour
= m_panel_hover_label_colour
;
288 copy
->m_panel_minimised_label_colour
= m_panel_minimised_label_colour
;
289 copy
->m_panel_active_background_colour
= m_panel_active_background_colour
;
290 copy
->m_panel_active_background_gradient_colour
= m_panel_active_background_gradient_colour
;
291 copy
->m_panel_active_background_top_colour
= m_panel_active_background_top_colour
;
292 copy
->m_panel_active_background_top_gradient_colour
= m_panel_active_background_top_gradient_colour
;
293 copy
->m_page_background_colour
= m_page_background_colour
;
294 copy
->m_page_background_gradient_colour
= m_page_background_gradient_colour
;
295 copy
->m_page_background_top_colour
= m_page_background_top_colour
;
296 copy
->m_page_background_top_gradient_colour
= m_page_background_top_gradient_colour
;
297 copy
->m_page_hover_background_colour
= m_page_hover_background_colour
;
298 copy
->m_page_hover_background_gradient_colour
= m_page_hover_background_gradient_colour
;
299 copy
->m_page_hover_background_top_colour
= m_page_hover_background_top_colour
;
300 copy
->m_page_hover_background_top_gradient_colour
= m_page_hover_background_top_gradient_colour
;
301 copy
->m_button_bar_hover_background_colour
= m_button_bar_hover_background_colour
;
302 copy
->m_button_bar_hover_background_gradient_colour
= m_button_bar_hover_background_gradient_colour
;
303 copy
->m_button_bar_hover_background_top_colour
= m_button_bar_hover_background_top_colour
;
304 copy
->m_button_bar_hover_background_top_gradient_colour
= m_button_bar_hover_background_top_gradient_colour
;
305 copy
->m_button_bar_active_background_colour
= m_button_bar_active_background_colour
;
306 copy
->m_button_bar_active_background_gradient_colour
= m_button_bar_active_background_gradient_colour
;
307 copy
->m_button_bar_active_background_top_colour
= m_button_bar_active_background_top_colour
;
308 copy
->m_button_bar_active_background_top_gradient_colour
= m_button_bar_active_background_top_gradient_colour
;
309 copy
->m_gallery_button_background_colour
= m_gallery_button_background_colour
;
310 copy
->m_gallery_button_background_gradient_colour
= m_gallery_button_background_gradient_colour
;
311 copy
->m_gallery_button_hover_background_colour
= m_gallery_button_hover_background_colour
;
312 copy
->m_gallery_button_hover_background_gradient_colour
= m_gallery_button_hover_background_gradient_colour
;
313 copy
->m_gallery_button_active_background_colour
= m_gallery_button_active_background_colour
;
314 copy
->m_gallery_button_active_background_gradient_colour
= m_gallery_button_active_background_gradient_colour
;
315 copy
->m_gallery_button_disabled_background_colour
= m_gallery_button_disabled_background_colour
;
316 copy
->m_gallery_button_disabled_background_gradient_colour
= m_gallery_button_disabled_background_gradient_colour
;
317 copy
->m_gallery_button_face_colour
= m_gallery_button_face_colour
;
318 copy
->m_gallery_button_hover_face_colour
= m_gallery_button_hover_face_colour
;
319 copy
->m_gallery_button_active_face_colour
= m_gallery_button_active_face_colour
;
320 copy
->m_gallery_button_disabled_face_colour
= m_gallery_button_disabled_face_colour
;
322 copy
->m_tab_ctrl_background_brush
= m_tab_ctrl_background_brush
;
323 copy
->m_panel_label_background_brush
= m_panel_label_background_brush
;
324 copy
->m_panel_hover_label_background_brush
= m_panel_hover_label_background_brush
;
325 copy
->m_gallery_hover_background_brush
= m_gallery_hover_background_brush
;
326 copy
->m_gallery_button_background_top_brush
= m_gallery_button_background_top_brush
;
327 copy
->m_gallery_button_hover_background_top_brush
= m_gallery_button_hover_background_top_brush
;
328 copy
->m_gallery_button_active_background_top_brush
= m_gallery_button_active_background_top_brush
;
329 copy
->m_gallery_button_disabled_background_top_brush
= m_gallery_button_disabled_background_top_brush
;
331 copy
->m_tab_label_font
= m_tab_label_font
;
332 copy
->m_button_bar_label_font
= m_button_bar_label_font
;
333 copy
->m_panel_label_font
= m_panel_label_font
;
335 copy
->m_page_border_pen
= m_page_border_pen
;
336 copy
->m_panel_border_pen
= m_panel_border_pen
;
337 copy
->m_panel_border_gradient_pen
= m_panel_border_gradient_pen
;
338 copy
->m_panel_minimised_border_pen
= m_panel_minimised_border_pen
;
339 copy
->m_panel_minimised_border_gradient_pen
= m_panel_minimised_border_gradient_pen
;
340 copy
->m_tab_border_pen
= m_tab_border_pen
;
341 copy
->m_gallery_border_pen
= m_gallery_border_pen
;
342 copy
->m_button_bar_hover_border_pen
= m_button_bar_hover_border_pen
;
343 copy
->m_button_bar_active_border_pen
= m_button_bar_active_border_pen
;
344 copy
->m_gallery_item_border_pen
= m_gallery_item_border_pen
;
345 copy
->m_toolbar_border_pen
= m_toolbar_border_pen
;
347 copy
->m_flags
= m_flags
;
348 copy
->m_tab_separation_size
= m_tab_separation_size
;
349 copy
->m_page_border_left
= m_page_border_left
;
350 copy
->m_page_border_top
= m_page_border_top
;
351 copy
->m_page_border_right
= m_page_border_right
;
352 copy
->m_page_border_bottom
= m_page_border_bottom
;
353 copy
->m_panel_x_separation_size
= m_panel_x_separation_size
;
354 copy
->m_panel_y_separation_size
= m_panel_y_separation_size
;
355 copy
->m_gallery_bitmap_padding_left_size
= m_gallery_bitmap_padding_left_size
;
356 copy
->m_gallery_bitmap_padding_right_size
= m_gallery_bitmap_padding_right_size
;
357 copy
->m_gallery_bitmap_padding_top_size
= m_gallery_bitmap_padding_top_size
;
358 copy
->m_gallery_bitmap_padding_bottom_size
= m_gallery_bitmap_padding_bottom_size
;
361 long wxRibbonMSWArtProvider::GetFlags() const
366 void wxRibbonMSWArtProvider::SetFlags(long flags
)
368 if((flags
^ m_flags
) & wxRIBBON_BAR_FLOW_VERTICAL
)
370 if(flags
& wxRIBBON_BAR_FLOW_VERTICAL
)
372 m_page_border_left
++;
373 m_page_border_right
++;
375 m_page_border_bottom
--;
379 m_page_border_left
--;
380 m_page_border_right
--;
382 m_page_border_bottom
++;
387 // Need to reload some bitmaps when flags change
388 #define Reload(setting) SetColour(setting, GetColour(setting))
389 Reload(wxRIBBON_ART_GALLERY_BUTTON_FACE_COLOUR
);
390 Reload(wxRIBBON_ART_GALLERY_BUTTON_HOVER_FACE_COLOUR
);
391 Reload(wxRIBBON_ART_GALLERY_BUTTON_ACTIVE_FACE_COLOUR
);
392 Reload(wxRIBBON_ART_GALLERY_BUTTON_DISABLED_FACE_COLOUR
);
396 int wxRibbonMSWArtProvider::GetMetric(int id
) const
400 case wxRIBBON_ART_TAB_SEPARATION_SIZE
:
401 return m_tab_separation_size
;
402 case wxRIBBON_ART_PAGE_BORDER_LEFT_SIZE
:
403 return m_page_border_left
;
404 case wxRIBBON_ART_PAGE_BORDER_TOP_SIZE
:
405 return m_page_border_top
;
406 case wxRIBBON_ART_PAGE_BORDER_RIGHT_SIZE
:
407 return m_page_border_right
;
408 case wxRIBBON_ART_PAGE_BORDER_BOTTOM_SIZE
:
409 return m_page_border_bottom
;
410 case wxRIBBON_ART_PANEL_X_SEPARATION_SIZE
:
411 return m_panel_x_separation_size
;
412 case wxRIBBON_ART_PANEL_Y_SEPARATION_SIZE
:
413 return m_panel_y_separation_size
;
414 case wxRIBBON_ART_TOOL_GROUP_SEPARATION_SIZE
:
415 return m_tool_group_separation_size
;
416 case wxRIBBON_ART_GALLERY_BITMAP_PADDING_LEFT_SIZE
:
417 return m_gallery_bitmap_padding_left_size
;
418 case wxRIBBON_ART_GALLERY_BITMAP_PADDING_RIGHT_SIZE
:
419 return m_gallery_bitmap_padding_right_size
;
420 case wxRIBBON_ART_GALLERY_BITMAP_PADDING_TOP_SIZE
:
421 return m_gallery_bitmap_padding_top_size
;
422 case wxRIBBON_ART_GALLERY_BITMAP_PADDING_BOTTOM_SIZE
:
423 return m_gallery_bitmap_padding_bottom_size
;
425 wxFAIL_MSG(wxT("Invalid Metric Ordinal"));
432 void wxRibbonMSWArtProvider::SetMetric(int id
, int new_val
)
436 case wxRIBBON_ART_TAB_SEPARATION_SIZE
:
437 m_tab_separation_size
= new_val
;
439 case wxRIBBON_ART_PAGE_BORDER_LEFT_SIZE
:
440 m_page_border_left
= new_val
;
442 case wxRIBBON_ART_PAGE_BORDER_TOP_SIZE
:
443 m_page_border_top
= new_val
;
445 case wxRIBBON_ART_PAGE_BORDER_RIGHT_SIZE
:
446 m_page_border_right
= new_val
;
448 case wxRIBBON_ART_PAGE_BORDER_BOTTOM_SIZE
:
449 m_page_border_bottom
= new_val
;
451 case wxRIBBON_ART_PANEL_X_SEPARATION_SIZE
:
452 m_panel_x_separation_size
= new_val
;
454 case wxRIBBON_ART_PANEL_Y_SEPARATION_SIZE
:
455 m_panel_y_separation_size
= new_val
;
457 case wxRIBBON_ART_TOOL_GROUP_SEPARATION_SIZE
:
458 m_tool_group_separation_size
= new_val
;
460 case wxRIBBON_ART_GALLERY_BITMAP_PADDING_LEFT_SIZE
:
461 m_gallery_bitmap_padding_left_size
= new_val
;
463 case wxRIBBON_ART_GALLERY_BITMAP_PADDING_RIGHT_SIZE
:
464 m_gallery_bitmap_padding_right_size
= new_val
;
466 case wxRIBBON_ART_GALLERY_BITMAP_PADDING_TOP_SIZE
:
467 m_gallery_bitmap_padding_top_size
= new_val
;
469 case wxRIBBON_ART_GALLERY_BITMAP_PADDING_BOTTOM_SIZE
:
470 m_gallery_bitmap_padding_bottom_size
= new_val
;
473 wxFAIL_MSG(wxT("Invalid Metric Ordinal"));
478 void wxRibbonMSWArtProvider::SetFont(int id
, const wxFont
& font
)
482 case wxRIBBON_ART_TAB_LABEL_FONT
:
483 m_tab_label_font
= font
;
485 case wxRIBBON_ART_BUTTON_BAR_LABEL_FONT
:
486 m_button_bar_label_font
= font
;
488 case wxRIBBON_ART_PANEL_LABEL_FONT
:
489 m_panel_label_font
= font
;
492 wxFAIL_MSG(wxT("Invalid Metric Ordinal"));
497 wxFont
wxRibbonMSWArtProvider::GetFont(int id
) const
501 case wxRIBBON_ART_TAB_LABEL_FONT
:
502 return m_tab_label_font
;
503 case wxRIBBON_ART_BUTTON_BAR_LABEL_FONT
:
504 return m_button_bar_label_font
;
505 case wxRIBBON_ART_PANEL_LABEL_FONT
:
506 return m_panel_label_font
;
508 wxFAIL_MSG(wxT("Invalid Metric Ordinal"));
515 wxColour
wxRibbonMSWArtProvider::GetColour(int id
) const
519 case wxRIBBON_ART_BUTTON_BAR_LABEL_COLOUR
:
520 return m_button_bar_label_colour
;
521 case wxRIBBON_ART_BUTTON_BAR_HOVER_BORDER_COLOUR
:
522 return m_button_bar_hover_border_pen
.GetColour();
523 case wxRIBBON_ART_BUTTON_BAR_HOVER_BACKGROUND_TOP_COLOUR
:
524 return m_button_bar_hover_background_top_colour
;
525 case wxRIBBON_ART_BUTTON_BAR_HOVER_BACKGROUND_TOP_GRADIENT_COLOUR
:
526 return m_button_bar_hover_background_top_gradient_colour
;
527 case wxRIBBON_ART_BUTTON_BAR_HOVER_BACKGROUND_COLOUR
:
528 return m_button_bar_hover_background_colour
;
529 case wxRIBBON_ART_BUTTON_BAR_HOVER_BACKGROUND_GRADIENT_COLOUR
:
530 return m_button_bar_hover_background_gradient_colour
;
531 case wxRIBBON_ART_BUTTON_BAR_ACTIVE_BORDER_COLOUR
:
532 return m_button_bar_active_border_pen
.GetColour();
533 case wxRIBBON_ART_BUTTON_BAR_ACTIVE_BACKGROUND_TOP_COLOUR
:
534 return m_button_bar_active_background_top_colour
;
535 case wxRIBBON_ART_BUTTON_BAR_ACTIVE_BACKGROUND_TOP_GRADIENT_COLOUR
:
536 return m_button_bar_active_background_top_gradient_colour
;
537 case wxRIBBON_ART_BUTTON_BAR_ACTIVE_BACKGROUND_COLOUR
:
538 return m_button_bar_active_background_colour
;
539 case wxRIBBON_ART_BUTTON_BAR_ACTIVE_BACKGROUND_GRADIENT_COLOUR
:
540 return m_button_bar_active_background_gradient_colour
;
541 case wxRIBBON_ART_GALLERY_BORDER_COLOUR
:
542 return m_gallery_border_pen
.GetColour();
543 case wxRIBBON_ART_GALLERY_HOVER_BACKGROUND_COLOUR
:
544 return m_gallery_hover_background_brush
.GetColour();
545 case wxRIBBON_ART_GALLERY_BUTTON_BACKGROUND_COLOUR
:
546 return m_gallery_button_background_colour
;
547 case wxRIBBON_ART_GALLERY_BUTTON_BACKGROUND_GRADIENT_COLOUR
:
548 return m_gallery_button_background_gradient_colour
;
549 case wxRIBBON_ART_GALLERY_BUTTON_BACKGROUND_TOP_COLOUR
:
550 return m_gallery_button_background_top_brush
.GetColour();
551 case wxRIBBON_ART_GALLERY_BUTTON_FACE_COLOUR
:
552 return m_gallery_button_face_colour
;
553 case wxRIBBON_ART_GALLERY_BUTTON_HOVER_BACKGROUND_COLOUR
:
554 return m_gallery_button_hover_background_colour
;
555 case wxRIBBON_ART_GALLERY_BUTTON_HOVER_BACKGROUND_GRADIENT_COLOUR
:
556 return m_gallery_button_hover_background_gradient_colour
;
557 case wxRIBBON_ART_GALLERY_BUTTON_HOVER_BACKGROUND_TOP_COLOUR
:
558 return m_gallery_button_hover_background_top_brush
.GetColour();
559 case wxRIBBON_ART_GALLERY_BUTTON_HOVER_FACE_COLOUR
:
560 return m_gallery_button_face_colour
;
561 case wxRIBBON_ART_GALLERY_BUTTON_ACTIVE_BACKGROUND_COLOUR
:
562 return m_gallery_button_active_background_colour
;
563 case wxRIBBON_ART_GALLERY_BUTTON_ACTIVE_BACKGROUND_GRADIENT_COLOUR
:
564 return m_gallery_button_active_background_gradient_colour
;
565 case wxRIBBON_ART_GALLERY_BUTTON_ACTIVE_BACKGROUND_TOP_COLOUR
:
566 return m_gallery_button_background_top_brush
.GetColour();
567 case wxRIBBON_ART_GALLERY_BUTTON_ACTIVE_FACE_COLOUR
:
568 return m_gallery_button_active_face_colour
;
569 case wxRIBBON_ART_GALLERY_BUTTON_DISABLED_BACKGROUND_COLOUR
:
570 return m_gallery_button_disabled_background_colour
;
571 case wxRIBBON_ART_GALLERY_BUTTON_DISABLED_BACKGROUND_GRADIENT_COLOUR
:
572 return m_gallery_button_disabled_background_gradient_colour
;
573 case wxRIBBON_ART_GALLERY_BUTTON_DISABLED_BACKGROUND_TOP_COLOUR
:
574 return m_gallery_button_disabled_background_top_brush
.GetColour();
575 case wxRIBBON_ART_GALLERY_BUTTON_DISABLED_FACE_COLOUR
:
576 return m_gallery_button_disabled_face_colour
;
577 case wxRIBBON_ART_GALLERY_ITEM_BORDER_COLOUR
:
578 return m_gallery_item_border_pen
.GetColour();
579 case wxRIBBON_ART_TAB_CTRL_BACKGROUND_COLOUR
:
580 case wxRIBBON_ART_TAB_CTRL_BACKGROUND_GRADIENT_COLOUR
:
581 return m_tab_ctrl_background_brush
.GetColour();
582 case wxRIBBON_ART_TAB_LABEL_COLOUR
:
583 return m_tab_label_colour
;
584 case wxRIBBON_ART_TAB_SEPARATOR_COLOUR
:
585 return m_tab_separator_colour
;
586 case wxRIBBON_ART_TAB_SEPARATOR_GRADIENT_COLOUR
:
587 return m_tab_separator_gradient_colour
;
588 case wxRIBBON_ART_TAB_ACTIVE_BACKGROUND_TOP_COLOUR
:
589 case wxRIBBON_ART_TAB_ACTIVE_BACKGROUND_TOP_GRADIENT_COLOUR
:
590 return wxColour(0, 0, 0);
591 case wxRIBBON_ART_TAB_ACTIVE_BACKGROUND_COLOUR
:
592 return m_tab_active_background_colour
;
593 case wxRIBBON_ART_TAB_ACTIVE_BACKGROUND_GRADIENT_COLOUR
:
594 return m_tab_active_background_gradient_colour
;
595 case wxRIBBON_ART_TAB_HOVER_BACKGROUND_TOP_COLOUR
:
596 return m_tab_hover_background_top_colour
;
597 case wxRIBBON_ART_TAB_HOVER_BACKGROUND_TOP_GRADIENT_COLOUR
:
598 return m_tab_hover_background_top_gradient_colour
;
599 case wxRIBBON_ART_TAB_HOVER_BACKGROUND_COLOUR
:
600 return m_tab_hover_background_colour
;
601 case wxRIBBON_ART_TAB_HOVER_BACKGROUND_GRADIENT_COLOUR
:
602 return m_tab_hover_background_gradient_colour
;
603 case wxRIBBON_ART_TAB_BORDER_COLOUR
:
604 return m_tab_border_pen
.GetColour();
605 case wxRIBBON_ART_PANEL_BORDER_COLOUR
:
606 return m_panel_border_pen
.GetColour();
607 case wxRIBBON_ART_PANEL_BORDER_GRADIENT_COLOUR
:
608 return m_panel_border_gradient_pen
.GetColour();
609 case wxRIBBON_ART_PANEL_MINIMISED_BORDER_COLOUR
:
610 return m_panel_minimised_border_pen
.GetColour();
611 case wxRIBBON_ART_PANEL_MINIMISED_BORDER_GRADIENT_COLOUR
:
612 return m_panel_minimised_border_gradient_pen
.GetColour();
613 case wxRIBBON_ART_PANEL_LABEL_BACKGROUND_COLOUR
:
614 case wxRIBBON_ART_PANEL_LABEL_BACKGROUND_GRADIENT_COLOUR
:
615 return m_panel_label_background_brush
.GetColour();
616 case wxRIBBON_ART_PANEL_LABEL_COLOUR
:
617 return m_panel_label_colour
;
618 case wxRIBBON_ART_PANEL_MINIMISED_LABEL_COLOUR
:
619 return m_panel_minimised_label_colour
;
620 case wxRIBBON_ART_PANEL_HOVER_LABEL_BACKGROUND_COLOUR
:
621 case wxRIBBON_ART_PANEL_HOVER_LABEL_BACKGROUND_GRADIENT_COLOUR
:
622 return m_panel_hover_label_background_brush
.GetColour();
623 case wxRIBBON_ART_PANEL_HOVER_LABEL_COLOUR
:
624 return m_panel_hover_label_colour
;
625 case wxRIBBON_ART_PANEL_ACTIVE_BACKGROUND_TOP_COLOUR
:
626 return m_panel_active_background_top_colour
;
627 case wxRIBBON_ART_PANEL_ACTIVE_BACKGROUND_TOP_GRADIENT_COLOUR
:
628 return m_panel_active_background_top_gradient_colour
;
629 case wxRIBBON_ART_PANEL_ACTIVE_BACKGROUND_COLOUR
:
630 return m_panel_active_background_colour
;
631 case wxRIBBON_ART_PANEL_ACTIVE_BACKGROUND_GRADIENT_COLOUR
:
632 return m_panel_active_background_gradient_colour
;
633 case wxRIBBON_ART_PAGE_BORDER_COLOUR
:
634 return m_page_border_pen
.GetColour();
635 case wxRIBBON_ART_PAGE_BACKGROUND_TOP_COLOUR
:
636 return m_page_background_top_colour
;
637 case wxRIBBON_ART_PAGE_BACKGROUND_TOP_GRADIENT_COLOUR
:
638 return m_page_background_top_gradient_colour
;
639 case wxRIBBON_ART_PAGE_BACKGROUND_COLOUR
:
640 return m_page_background_colour
;
641 case wxRIBBON_ART_PAGE_BACKGROUND_GRADIENT_COLOUR
:
642 return m_page_background_gradient_colour
;
643 case wxRIBBON_ART_PAGE_HOVER_BACKGROUND_TOP_COLOUR
:
644 return m_page_hover_background_top_colour
;
645 case wxRIBBON_ART_PAGE_HOVER_BACKGROUND_TOP_GRADIENT_COLOUR
:
646 return m_page_hover_background_top_gradient_colour
;
647 case wxRIBBON_ART_PAGE_HOVER_BACKGROUND_COLOUR
:
648 return m_page_hover_background_colour
;
649 case wxRIBBON_ART_PAGE_HOVER_BACKGROUND_GRADIENT_COLOUR
:
650 return m_page_hover_background_gradient_colour
;
651 case wxRIBBON_ART_TOOLBAR_BORDER_COLOUR
:
652 case wxRIBBON_ART_TOOLBAR_HOVER_BORDER_COLOUR
:
653 return m_toolbar_border_pen
.GetColour();
654 case wxRIBBON_ART_TOOLBAR_FACE_COLOUR
:
655 return m_tool_face_colour
;
657 wxFAIL_MSG(wxT("Invalid Metric Ordinal"));
664 void wxRibbonMSWArtProvider::SetColour(int id
, const wxColor
& colour
)
668 case wxRIBBON_ART_BUTTON_BAR_LABEL_COLOUR
:
669 m_button_bar_label_colour
= colour
;
671 case wxRIBBON_ART_BUTTON_BAR_HOVER_BORDER_COLOUR
:
672 m_button_bar_hover_border_pen
.SetColour(colour
);
674 case wxRIBBON_ART_BUTTON_BAR_HOVER_BACKGROUND_TOP_COLOUR
:
675 m_button_bar_hover_background_top_colour
= colour
;
677 case wxRIBBON_ART_BUTTON_BAR_HOVER_BACKGROUND_TOP_GRADIENT_COLOUR
:
678 m_button_bar_hover_background_top_gradient_colour
= colour
;
680 case wxRIBBON_ART_BUTTON_BAR_HOVER_BACKGROUND_COLOUR
:
681 m_button_bar_hover_background_colour
= colour
;
683 case wxRIBBON_ART_BUTTON_BAR_HOVER_BACKGROUND_GRADIENT_COLOUR
:
684 m_button_bar_hover_background_gradient_colour
= colour
;
686 case wxRIBBON_ART_BUTTON_BAR_ACTIVE_BORDER_COLOUR
:
687 m_button_bar_active_border_pen
.SetColour(colour
);
689 case wxRIBBON_ART_BUTTON_BAR_ACTIVE_BACKGROUND_TOP_COLOUR
:
690 m_button_bar_active_background_top_colour
= colour
;
692 case wxRIBBON_ART_BUTTON_BAR_ACTIVE_BACKGROUND_TOP_GRADIENT_COLOUR
:
693 m_button_bar_active_background_top_gradient_colour
= colour
;
695 case wxRIBBON_ART_BUTTON_BAR_ACTIVE_BACKGROUND_COLOUR
:
696 m_button_bar_active_background_colour
= colour
;
698 case wxRIBBON_ART_BUTTON_BAR_ACTIVE_BACKGROUND_GRADIENT_COLOUR
:
699 m_button_bar_active_background_gradient_colour
= colour
;
701 case wxRIBBON_ART_GALLERY_BORDER_COLOUR
:
702 m_gallery_border_pen
.SetColour(colour
);
704 case wxRIBBON_ART_GALLERY_HOVER_BACKGROUND_COLOUR
:
705 m_gallery_hover_background_brush
.SetColour(colour
);
707 case wxRIBBON_ART_GALLERY_BUTTON_BACKGROUND_COLOUR
:
708 m_gallery_button_background_colour
= colour
;
710 case wxRIBBON_ART_GALLERY_BUTTON_BACKGROUND_GRADIENT_COLOUR
:
711 m_gallery_button_background_gradient_colour
= colour
;
713 case wxRIBBON_ART_GALLERY_BUTTON_BACKGROUND_TOP_COLOUR
:
714 m_gallery_button_background_top_brush
.SetColour(colour
);
716 case wxRIBBON_ART_GALLERY_BUTTON_FACE_COLOUR
:
717 m_gallery_button_face_colour
= colour
;
718 if(m_flags
& wxRIBBON_BAR_FLOW_VERTICAL
)
720 m_gallery_up_bitmap
[0] = wxRibbonLoadPixmap(gallery_left_xpm
, colour
);
721 m_gallery_down_bitmap
[0] = wxRibbonLoadPixmap(gallery_right_xpm
, colour
);
725 m_gallery_up_bitmap
[0] = wxRibbonLoadPixmap(gallery_up_xpm
, colour
);
726 m_gallery_down_bitmap
[0] = wxRibbonLoadPixmap(gallery_down_xpm
, colour
);
728 m_gallery_extension_bitmap
[0] = wxRibbonLoadPixmap(gallery_extension_xpm
, colour
);
730 case wxRIBBON_ART_GALLERY_BUTTON_HOVER_BACKGROUND_COLOUR
:
731 m_gallery_button_hover_background_colour
= colour
;
733 case wxRIBBON_ART_GALLERY_BUTTON_HOVER_BACKGROUND_GRADIENT_COLOUR
:
734 m_gallery_button_hover_background_gradient_colour
= colour
;
736 case wxRIBBON_ART_GALLERY_BUTTON_HOVER_BACKGROUND_TOP_COLOUR
:
737 m_gallery_button_hover_background_top_brush
.SetColour(colour
);
739 case wxRIBBON_ART_GALLERY_BUTTON_HOVER_FACE_COLOUR
:
740 m_gallery_button_hover_face_colour
= colour
;
741 if(m_flags
& wxRIBBON_BAR_FLOW_VERTICAL
)
743 m_gallery_up_bitmap
[1] = wxRibbonLoadPixmap(gallery_left_xpm
, colour
);
744 m_gallery_down_bitmap
[1] = wxRibbonLoadPixmap(gallery_right_xpm
, colour
);
748 m_gallery_up_bitmap
[1] = wxRibbonLoadPixmap(gallery_up_xpm
, colour
);
749 m_gallery_down_bitmap
[1] = wxRibbonLoadPixmap(gallery_down_xpm
, colour
);
751 m_gallery_extension_bitmap
[1] = wxRibbonLoadPixmap(gallery_extension_xpm
, colour
);
753 case wxRIBBON_ART_GALLERY_BUTTON_ACTIVE_BACKGROUND_COLOUR
:
754 m_gallery_button_active_background_colour
= colour
;
756 case wxRIBBON_ART_GALLERY_BUTTON_ACTIVE_BACKGROUND_GRADIENT_COLOUR
:
757 m_gallery_button_active_background_gradient_colour
= colour
;
759 case wxRIBBON_ART_GALLERY_BUTTON_ACTIVE_BACKGROUND_TOP_COLOUR
:
760 m_gallery_button_background_top_brush
.SetColour(colour
);
762 case wxRIBBON_ART_GALLERY_BUTTON_ACTIVE_FACE_COLOUR
:
763 m_gallery_button_active_face_colour
= colour
;
764 if(m_flags
& wxRIBBON_BAR_FLOW_VERTICAL
)
766 m_gallery_up_bitmap
[2] = wxRibbonLoadPixmap(gallery_left_xpm
, colour
);
767 m_gallery_down_bitmap
[2] = wxRibbonLoadPixmap(gallery_right_xpm
, colour
);
771 m_gallery_up_bitmap
[2] = wxRibbonLoadPixmap(gallery_up_xpm
, colour
);
772 m_gallery_down_bitmap
[2] = wxRibbonLoadPixmap(gallery_down_xpm
, colour
);
774 m_gallery_extension_bitmap
[2] = wxRibbonLoadPixmap(gallery_extension_xpm
, colour
);
776 case wxRIBBON_ART_GALLERY_BUTTON_DISABLED_BACKGROUND_COLOUR
:
777 m_gallery_button_disabled_background_colour
= colour
;
779 case wxRIBBON_ART_GALLERY_BUTTON_DISABLED_BACKGROUND_GRADIENT_COLOUR
:
780 m_gallery_button_disabled_background_gradient_colour
= colour
;
782 case wxRIBBON_ART_GALLERY_BUTTON_DISABLED_BACKGROUND_TOP_COLOUR
:
783 m_gallery_button_disabled_background_top_brush
.SetColour(colour
);
785 case wxRIBBON_ART_GALLERY_BUTTON_DISABLED_FACE_COLOUR
:
786 m_gallery_button_disabled_face_colour
= colour
;
787 if(m_flags
& wxRIBBON_BAR_FLOW_VERTICAL
)
789 m_gallery_up_bitmap
[3] = wxRibbonLoadPixmap(gallery_left_xpm
, colour
);
790 m_gallery_down_bitmap
[3] = wxRibbonLoadPixmap(gallery_right_xpm
, colour
);
794 m_gallery_up_bitmap
[3] = wxRibbonLoadPixmap(gallery_up_xpm
, colour
);
795 m_gallery_down_bitmap
[3] = wxRibbonLoadPixmap(gallery_down_xpm
, colour
);
797 m_gallery_extension_bitmap
[3] = wxRibbonLoadPixmap(gallery_extension_xpm
, colour
);
799 case wxRIBBON_ART_GALLERY_ITEM_BORDER_COLOUR
:
800 m_gallery_item_border_pen
.SetColour(colour
);
802 case wxRIBBON_ART_TAB_CTRL_BACKGROUND_COLOUR
:
803 case wxRIBBON_ART_TAB_CTRL_BACKGROUND_GRADIENT_COLOUR
:
804 m_tab_ctrl_background_brush
.SetColour(colour
);
805 m_cached_tab_separator_visibility
= -1.0;
807 case wxRIBBON_ART_TAB_LABEL_COLOUR
:
808 m_tab_label_colour
= colour
;
810 case wxRIBBON_ART_TAB_SEPARATOR_COLOUR
:
811 m_tab_separator_colour
= colour
;
812 m_cached_tab_separator_visibility
= -1.0;
814 case wxRIBBON_ART_TAB_SEPARATOR_GRADIENT_COLOUR
:
815 m_tab_separator_gradient_colour
= colour
;
816 m_cached_tab_separator_visibility
= -1.0;
818 case wxRIBBON_ART_TAB_ACTIVE_BACKGROUND_TOP_COLOUR
:
819 case wxRIBBON_ART_TAB_ACTIVE_BACKGROUND_TOP_GRADIENT_COLOUR
:
821 case wxRIBBON_ART_TAB_ACTIVE_BACKGROUND_COLOUR
:
822 m_tab_active_background_colour
= colour
;
824 case wxRIBBON_ART_TAB_ACTIVE_BACKGROUND_GRADIENT_COLOUR
:
825 m_tab_active_background_gradient_colour
= colour
;
827 case wxRIBBON_ART_TAB_HOVER_BACKGROUND_TOP_COLOUR
:
828 m_tab_hover_background_top_colour
= colour
;
830 case wxRIBBON_ART_TAB_HOVER_BACKGROUND_TOP_GRADIENT_COLOUR
:
831 m_tab_hover_background_top_gradient_colour
= colour
;
833 case wxRIBBON_ART_TAB_HOVER_BACKGROUND_COLOUR
:
834 m_tab_hover_background_colour
= colour
;
836 case wxRIBBON_ART_TAB_HOVER_BACKGROUND_GRADIENT_COLOUR
:
837 m_tab_hover_background_gradient_colour
= colour
;
839 case wxRIBBON_ART_TAB_BORDER_COLOUR
:
840 m_tab_border_pen
.SetColour(colour
);
842 case wxRIBBON_ART_PANEL_BORDER_COLOUR
:
843 m_panel_border_pen
.SetColour(colour
);
845 case wxRIBBON_ART_PANEL_BORDER_GRADIENT_COLOUR
:
846 m_panel_border_gradient_pen
.SetColour(colour
);
848 case wxRIBBON_ART_PANEL_MINIMISED_BORDER_COLOUR
:
849 m_panel_minimised_border_pen
.SetColour(colour
);
851 case wxRIBBON_ART_PANEL_MINIMISED_BORDER_GRADIENT_COLOUR
:
852 m_panel_minimised_border_gradient_pen
.SetColour(colour
);
854 case wxRIBBON_ART_PANEL_LABEL_BACKGROUND_COLOUR
:
855 case wxRIBBON_ART_PANEL_LABEL_BACKGROUND_GRADIENT_COLOUR
:
856 m_panel_label_background_brush
.SetColour(colour
);
858 case wxRIBBON_ART_PANEL_LABEL_COLOUR
:
859 m_panel_label_colour
= colour
;
861 case wxRIBBON_ART_PANEL_HOVER_LABEL_BACKGROUND_COLOUR
:
862 case wxRIBBON_ART_PANEL_HOVER_LABEL_BACKGROUND_GRADIENT_COLOUR
:
863 m_panel_hover_label_background_brush
.SetColour(colour
);
865 case wxRIBBON_ART_PANEL_HOVER_LABEL_COLOUR
:
866 m_panel_hover_label_colour
= colour
;
868 case wxRIBBON_ART_PANEL_MINIMISED_LABEL_COLOUR
:
869 m_panel_minimised_label_colour
= colour
;
871 case wxRIBBON_ART_PANEL_ACTIVE_BACKGROUND_TOP_COLOUR
:
872 m_panel_active_background_top_colour
= colour
;
874 case wxRIBBON_ART_PANEL_ACTIVE_BACKGROUND_TOP_GRADIENT_COLOUR
:
875 m_panel_active_background_top_gradient_colour
= colour
;
877 case wxRIBBON_ART_PANEL_ACTIVE_BACKGROUND_COLOUR
:
878 m_panel_active_background_colour
= colour
;
880 case wxRIBBON_ART_PANEL_ACTIVE_BACKGROUND_GRADIENT_COLOUR
:
881 m_panel_active_background_gradient_colour
= colour
;
883 case wxRIBBON_ART_PAGE_BORDER_COLOUR
:
884 m_page_border_pen
.SetColour(colour
);
886 case wxRIBBON_ART_PAGE_BACKGROUND_TOP_COLOUR
:
887 m_page_background_top_colour
= colour
;
889 case wxRIBBON_ART_PAGE_BACKGROUND_TOP_GRADIENT_COLOUR
:
890 m_page_background_top_gradient_colour
= colour
;
892 case wxRIBBON_ART_PAGE_BACKGROUND_COLOUR
:
893 m_page_background_colour
= colour
;
895 case wxRIBBON_ART_PAGE_BACKGROUND_GRADIENT_COLOUR
:
896 m_page_background_gradient_colour
= colour
;
898 case wxRIBBON_ART_PAGE_HOVER_BACKGROUND_TOP_COLOUR
:
899 m_page_hover_background_top_colour
= colour
;
901 case wxRIBBON_ART_PAGE_HOVER_BACKGROUND_TOP_GRADIENT_COLOUR
:
902 m_page_hover_background_top_gradient_colour
= colour
;
904 case wxRIBBON_ART_PAGE_HOVER_BACKGROUND_COLOUR
:
905 m_page_hover_background_colour
= colour
;
907 case wxRIBBON_ART_PAGE_HOVER_BACKGROUND_GRADIENT_COLOUR
:
908 m_page_hover_background_gradient_colour
= colour
;
910 case wxRIBBON_ART_TOOLBAR_BORDER_COLOUR
:
911 case wxRIBBON_ART_TOOLBAR_HOVER_BORDER_COLOUR
:
912 m_toolbar_border_pen
.SetColour(colour
);
914 case wxRIBBON_ART_TOOLBAR_FACE_COLOUR
:
915 m_tool_face_colour
= colour
;
916 m_toolbar_drop_bitmap
= wxRibbonLoadPixmap(gallery_down_xpm
, colour
);
919 wxFAIL_MSG(wxT("Invalid Metric Ordinal"));
924 void wxRibbonMSWArtProvider::DrawTabCtrlBackground(
926 wxWindow
* WXUNUSED(wnd
),
929 dc
.SetPen(*wxTRANSPARENT_PEN
);
930 dc
.SetBrush(m_tab_ctrl_background_brush
);
931 dc
.DrawRectangle(rect
.x
, rect
.y
, rect
.width
, rect
.height
);
933 dc
.SetPen(m_page_border_pen
);
936 dc
.DrawLine(rect
.x
+ 3, rect
.y
+ rect
.height
- 1, rect
.x
+ rect
.width
- 3, rect
.y
+ rect
.height
- 1);
940 dc
.DrawLine(rect
.x
, rect
.y
+ rect
.height
- 1, rect
.x
+ rect
.width
, rect
.y
+ rect
.height
- 1);
944 void wxRibbonMSWArtProvider::DrawTab(
946 wxWindow
* WXUNUSED(wnd
),
947 const wxRibbonPageTabInfo
& tab
)
949 if(tab
.rect
.height
<= 2)
952 if(tab
.active
|| tab
.hovered
)
956 wxRect
background(tab
.rect
);
960 background
.width
-= 4;
961 background
.height
-= 2;
963 dc
.GradientFillLinear(background
, m_tab_active_background_colour
,
964 m_tab_active_background_gradient_colour
, wxSOUTH
);
966 // TODO: active and hovered
970 wxRect
background(tab
.rect
);
974 background
.width
-= 4;
975 background
.height
-= 3;
976 int h
= background
.height
;
977 background
.height
/= 2;
978 dc
.GradientFillLinear(background
,
979 m_tab_hover_background_top_colour
,
980 m_tab_hover_background_top_gradient_colour
, wxSOUTH
);
982 background
.y
+= background
.height
;
983 background
.height
= h
- background
.height
;
984 dc
.GradientFillLinear(background
, m_tab_hover_background_colour
,
985 m_tab_hover_background_gradient_colour
, wxSOUTH
);
988 wxPoint border_points
[6];
989 border_points
[0] = wxPoint(1, tab
.rect
.height
- 2);
990 border_points
[1] = wxPoint(1, 3);
991 border_points
[2] = wxPoint(3, 1);
992 border_points
[3] = wxPoint(tab
.rect
.width
- 4, 1);
993 border_points
[4] = wxPoint(tab
.rect
.width
- 2, 3);
994 border_points
[5] = wxPoint(tab
.rect
.width
- 2, tab
.rect
.height
- 1);
996 dc
.SetPen(m_tab_border_pen
);
997 dc
.DrawLines(sizeof(border_points
)/sizeof(wxPoint
), border_points
, tab
.rect
.x
, tab
.rect
.y
);
1001 // Give the tab a curved outward border at the bottom
1002 dc
.DrawPoint(tab
.rect
.x
, tab
.rect
.y
+ tab
.rect
.height
- 2);
1003 dc
.DrawPoint(tab
.rect
.x
+ tab
.rect
.width
- 1, tab
.rect
.y
+ tab
.rect
.height
- 2);
1005 wxPen
p(m_tab_active_background_gradient_colour
);
1008 // Technically the first two points are the wrong colour, but they're near enough
1009 dc
.DrawPoint(tab
.rect
.x
+ 1, tab
.rect
.y
+ tab
.rect
.height
- 2);
1010 dc
.DrawPoint(tab
.rect
.x
+ tab
.rect
.width
- 2, tab
.rect
.y
+ tab
.rect
.height
- 2);
1011 dc
.DrawPoint(tab
.rect
.x
+ 1, tab
.rect
.y
+ tab
.rect
.height
- 1);
1012 dc
.DrawPoint(tab
.rect
.x
, tab
.rect
.y
+ tab
.rect
.height
- 1);
1013 dc
.DrawPoint(tab
.rect
.x
+ tab
.rect
.width
- 2, tab
.rect
.y
+ tab
.rect
.height
- 1);
1014 dc
.DrawPoint(tab
.rect
.x
+ tab
.rect
.width
- 1, tab
.rect
.y
+ tab
.rect
.height
- 1);
1018 if(m_flags
& wxRIBBON_BAR_SHOW_PAGE_ICONS
)
1020 wxBitmap icon
= tab
.page
->GetIcon();
1021 int x
= tab
.rect
.x
+ 4;
1022 if((m_flags
& wxRIBBON_BAR_SHOW_PAGE_LABELS
) == 0)
1023 x
= tab
.rect
.x
+ (tab
.rect
.width
- icon
.GetWidth()) / 2;
1024 dc
.DrawBitmap(icon
, x
, tab
.rect
.y
+ 1 + (tab
.rect
.height
- 1 -
1025 icon
.GetHeight()) / 2, true);
1027 if(m_flags
& wxRIBBON_BAR_SHOW_PAGE_LABELS
)
1029 wxString label
= tab
.page
->GetLabel();
1030 if(!label
.IsEmpty())
1032 dc
.SetFont(m_tab_label_font
);
1033 dc
.SetTextForeground(m_tab_label_colour
);
1034 dc
.SetBackgroundMode(wxTRANSPARENT
);
1038 dc
.GetTextExtent(label
, &text_width
, &text_height
);
1039 int width
= tab
.rect
.width
- 5;
1040 int x
= tab
.rect
.x
+ 3;
1041 if(m_flags
& wxRIBBON_BAR_SHOW_PAGE_ICONS
)
1043 x
+= 3 + tab
.page
->GetIcon().GetWidth();
1044 width
-= 3 + tab
.page
->GetIcon().GetWidth();
1046 int y
= tab
.rect
.y
+ (tab
.rect
.height
- text_height
) / 2;
1048 if(width
<= text_width
)
1050 dc
.SetClippingRegion(x
, tab
.rect
.y
, width
, tab
.rect
.height
);
1051 dc
.DrawText(label
, x
, y
);
1055 dc
.DrawText(label
, x
+ (width
- text_width
) / 2 + 1, y
);
1061 void wxRibbonMSWArtProvider::DrawTabSeparator(
1067 if(visibility
<= 0.0)
1071 if(visibility
> 1.0)
1076 // The tab separator is relatively expensive to draw (for its size), and is
1077 // usually drawn multiple times sequentially (in different positions), so it
1078 // makes sense to draw it once and cache it.
1079 if(!m_cached_tab_separator
.IsOk() || m_cached_tab_separator
.GetSize() != rect
.GetSize() || visibility
!= m_cached_tab_separator_visibility
)
1081 wxRect
size(rect
.GetSize());
1082 ReallyDrawTabSeparator(wnd
, size
, visibility
);
1084 dc
.DrawBitmap(m_cached_tab_separator
, rect
.x
, rect
.y
, false);
1087 void wxRibbonMSWArtProvider::ReallyDrawTabSeparator(wxWindow
* wnd
, const wxRect
& rect
, double visibility
)
1089 if(!m_cached_tab_separator
.IsOk() || m_cached_tab_separator
.GetSize() != rect
.GetSize())
1091 m_cached_tab_separator
= wxBitmap(rect
.GetSize());
1094 wxMemoryDC
dc(m_cached_tab_separator
);
1095 DrawTabCtrlBackground(dc
, wnd
, rect
);
1097 wxCoord x
= rect
.x
+ rect
.width
/ 2;
1098 double h
= (double)(rect
.height
- 1);
1100 double r1
= m_tab_ctrl_background_brush
.GetColour().Red() * (1.0 - visibility
) + 0.5;
1101 double g1
= m_tab_ctrl_background_brush
.GetColour().Green() * (1.0 - visibility
) + 0.5;
1102 double b1
= m_tab_ctrl_background_brush
.GetColour().Blue() * (1.0 - visibility
) + 0.5;
1103 double r2
= m_tab_separator_colour
.Red();
1104 double g2
= m_tab_separator_colour
.Green();
1105 double b2
= m_tab_separator_colour
.Blue();
1106 double r3
= m_tab_separator_gradient_colour
.Red();
1107 double g3
= m_tab_separator_gradient_colour
.Green();
1108 double b3
= m_tab_separator_gradient_colour
.Blue();
1110 for(int i
= 0; i
< rect
.height
- 1; ++i
)
1112 double p
= ((double)i
)/h
;
1114 double r
= (p
* r3
+ (1.0 - p
) * r2
) * visibility
+ r1
;
1115 double g
= (p
* g3
+ (1.0 - p
) * g2
) * visibility
+ g1
;
1116 double b
= (p
* b3
+ (1.0 - p
) * b2
) * visibility
+ b1
;
1118 wxPen
P(wxColour((unsigned char)r
, (unsigned char)g
, (unsigned char)b
));
1120 dc
.DrawPoint(x
, rect
.y
+ i
);
1123 m_cached_tab_separator_visibility
= visibility
;
1126 void wxRibbonMSWArtProvider::DrawPartialPageBackground(wxDC
& dc
,
1127 wxWindow
* WXUNUSED(wnd
), const wxRect
& rect
, wxRibbonPage
* page
,
1128 wxPoint offset
, bool hovered
)
1130 wxRect
background(page
->GetSize());
1131 page
->AdjustRectToIncludeScrollButtons(&background
);
1132 background
.height
-= 2;
1133 // Page background isn't dependant upon the width of the page
1134 // (at least not the part of it intended to be painted by this
1135 // function). Set to wider than the page itself for when externally
1136 // expanded panels need a background - the expanded panel can be wider
1139 background
.width
= INT_MAX
;
1141 // upper_rect, lower_rect, paint_rect are all in page co-ordinates
1142 wxRect
upper_rect(background
);
1143 upper_rect
.height
/= 5;
1145 wxRect
lower_rect(background
);
1146 lower_rect
.y
+= upper_rect
.height
;
1147 lower_rect
.height
-= upper_rect
.height
;
1149 wxRect
paint_rect(rect
);
1150 paint_rect
.x
+= offset
.x
;
1151 paint_rect
.y
+= offset
.y
;
1153 wxColour bg_top
, bg_top_grad
, bg_btm
, bg_btm_grad
;
1156 bg_top
= m_page_hover_background_top_colour
;
1157 bg_top_grad
= m_page_hover_background_top_gradient_colour
;
1158 bg_btm
= m_page_hover_background_colour
;
1159 bg_btm_grad
= m_page_hover_background_gradient_colour
;
1163 bg_top
= m_page_background_top_colour
;
1164 bg_top_grad
= m_page_background_top_gradient_colour
;
1165 bg_btm
= m_page_background_colour
;
1166 bg_btm_grad
= m_page_background_gradient_colour
;
1169 if(paint_rect
.Intersects(upper_rect
))
1171 wxRect
rect(upper_rect
);
1172 rect
.Intersect(paint_rect
);
1175 wxColour
starting_colour(wxRibbonInterpolateColour(bg_top
, bg_top_grad
,
1176 paint_rect
.y
, upper_rect
.y
, upper_rect
.y
+ upper_rect
.height
));
1177 wxColour
ending_colour(wxRibbonInterpolateColour(bg_top
, bg_top_grad
,
1178 paint_rect
.y
+ paint_rect
.height
, upper_rect
.y
,
1179 upper_rect
.y
+ upper_rect
.height
));
1180 dc
.GradientFillLinear(rect
, starting_colour
, ending_colour
, wxSOUTH
);
1183 if(paint_rect
.Intersects(lower_rect
))
1185 wxRect
rect(lower_rect
);
1186 rect
.Intersect(paint_rect
);
1189 wxColour
starting_colour(wxRibbonInterpolateColour(bg_btm
, bg_btm_grad
,
1190 paint_rect
.y
, lower_rect
.y
, lower_rect
.y
+ lower_rect
.height
));
1191 wxColour
ending_colour(wxRibbonInterpolateColour(bg_btm
, bg_btm_grad
,
1192 paint_rect
.y
+ paint_rect
.height
,
1193 lower_rect
.y
, lower_rect
.y
+ lower_rect
.height
));
1194 dc
.GradientFillLinear(rect
, starting_colour
, ending_colour
, wxSOUTH
);
1198 void wxRibbonMSWArtProvider::DrawPageBackground(
1200 wxWindow
* WXUNUSED(wnd
),
1203 dc
.SetPen(*wxTRANSPARENT_PEN
);
1204 dc
.SetBrush(m_tab_ctrl_background_brush
);
1210 dc
.DrawRectangle(edge
.x
, edge
.y
, edge
.width
, edge
.height
);
1212 edge
.x
+= rect
.width
- 2;
1213 dc
.DrawRectangle(edge
.x
, edge
.y
, edge
.width
, edge
.height
);
1217 edge
.y
+= (rect
.height
- edge
.height
);
1218 dc
.DrawRectangle(edge
.x
, edge
.y
, edge
.width
, edge
.height
);
1222 wxRect
background(rect
);
1224 background
.width
-= 4;
1225 background
.height
-= 2;
1227 background
.height
/= 5;
1228 dc
.GradientFillLinear(background
, m_page_background_top_colour
,
1229 m_page_background_top_gradient_colour
, wxSOUTH
);
1231 background
.y
+= background
.height
;
1232 background
.height
= rect
.height
- 2 - background
.height
;
1233 dc
.GradientFillLinear(background
, m_page_background_colour
,
1234 m_page_background_gradient_colour
, wxSOUTH
);
1238 wxPoint border_points
[8];
1239 border_points
[0] = wxPoint(2, 0);
1240 border_points
[1] = wxPoint(1, 1);
1241 border_points
[2] = wxPoint(1, rect
.height
- 4);
1242 border_points
[3] = wxPoint(3, rect
.height
- 2);
1243 border_points
[4] = wxPoint(rect
.width
- 4, rect
.height
- 2);
1244 border_points
[5] = wxPoint(rect
.width
- 2, rect
.height
- 4);
1245 border_points
[6] = wxPoint(rect
.width
- 2, 1);
1246 border_points
[7] = wxPoint(rect
.width
- 4, -1);
1248 dc
.SetPen(m_page_border_pen
);
1249 dc
.DrawLines(sizeof(border_points
)/sizeof(wxPoint
), border_points
, rect
.x
, rect
.y
);
1253 void wxRibbonMSWArtProvider::DrawScrollButton(
1255 wxWindow
* WXUNUSED(wnd
),
1256 const wxRect
& rect_
,
1261 if((style
& wxRIBBON_SCROLL_BTN_FOR_MASK
) == wxRIBBON_SCROLL_BTN_FOR_PAGE
)
1263 // Page scroll buttons do not have the luxury of rendering on top of anything
1264 // else, and their size includes some padding, hence the background painting
1265 // and size adjustment.
1266 dc
.SetPen(*wxTRANSPARENT_PEN
);
1267 dc
.SetBrush(m_tab_ctrl_background_brush
);
1268 dc
.DrawRectangle(rect
);
1269 dc
.SetClippingRegion(rect
);
1270 switch(style
& wxRIBBON_SCROLL_BTN_DIRECTION_MASK
)
1272 case wxRIBBON_SCROLL_BTN_LEFT
:
1274 case wxRIBBON_SCROLL_BTN_RIGHT
:
1278 case wxRIBBON_SCROLL_BTN_UP
:
1284 case wxRIBBON_SCROLL_BTN_DOWN
:
1293 wxRect
background(rect
);
1296 background
.width
-= 2;
1297 background
.height
-= 2;
1299 if(style
& wxRIBBON_SCROLL_BTN_UP
)
1300 background
.height
/= 2;
1302 background
.height
/= 5;
1303 dc
.GradientFillLinear(background
, m_page_background_top_colour
,
1304 m_page_background_top_gradient_colour
, wxSOUTH
);
1306 background
.y
+= background
.height
;
1307 background
.height
= rect
.height
- 2 - background
.height
;
1308 dc
.GradientFillLinear(background
, m_page_background_colour
,
1309 m_page_background_gradient_colour
, wxSOUTH
);
1313 wxPoint border_points
[7];
1314 switch(style
& wxRIBBON_SCROLL_BTN_DIRECTION_MASK
)
1316 case wxRIBBON_SCROLL_BTN_LEFT
:
1317 border_points
[0] = wxPoint(2, 0);
1318 border_points
[1] = wxPoint(rect
.width
- 1, 0);
1319 border_points
[2] = wxPoint(rect
.width
- 1, rect
.height
- 1);
1320 border_points
[3] = wxPoint(2, rect
.height
- 1);
1321 border_points
[4] = wxPoint(0, rect
.height
- 3);
1322 border_points
[5] = wxPoint(0, 2);
1324 case wxRIBBON_SCROLL_BTN_RIGHT
:
1325 border_points
[0] = wxPoint(0, 0);
1326 border_points
[1] = wxPoint(rect
.width
- 3, 0);
1327 border_points
[2] = wxPoint(rect
.width
- 1, 2);
1328 border_points
[3] = wxPoint(rect
.width
- 1, rect
.height
- 3);
1329 border_points
[4] = wxPoint(rect
.width
- 3, rect
.height
- 1);
1330 border_points
[5] = wxPoint(0, rect
.height
- 1);
1332 case wxRIBBON_SCROLL_BTN_UP
:
1333 border_points
[0] = wxPoint(2, 0);
1334 border_points
[1] = wxPoint(rect
.width
- 3, 0);
1335 border_points
[2] = wxPoint(rect
.width
- 1, 2);
1336 border_points
[3] = wxPoint(rect
.width
- 1, rect
.height
- 1);
1337 border_points
[4] = wxPoint(0, rect
.height
- 1);
1338 border_points
[5] = wxPoint(0, 2);
1340 case wxRIBBON_SCROLL_BTN_DOWN
:
1341 border_points
[0] = wxPoint(0, 0);
1342 border_points
[1] = wxPoint(rect
.width
- 1, 0);
1343 border_points
[2] = wxPoint(rect
.width
- 1, rect
.height
- 3);
1344 border_points
[3] = wxPoint(rect
.width
- 3, rect
.height
- 1);
1345 border_points
[4] = wxPoint(2, rect
.height
- 1);
1346 border_points
[5] = wxPoint(0, rect
.height
- 3);
1349 border_points
[6] = border_points
[0];
1351 dc
.SetPen(m_page_border_pen
);
1352 dc
.DrawLines(sizeof(border_points
)/sizeof(wxPoint
), border_points
, rect
.x
, rect
.y
);
1356 // NB: Code for handling hovered/active state is temporary
1357 wxPoint arrow_points
[3];
1358 switch(style
& wxRIBBON_SCROLL_BTN_DIRECTION_MASK
)
1360 case wxRIBBON_SCROLL_BTN_LEFT
:
1361 arrow_points
[0] = wxPoint(rect
.width
/ 2 - 2, rect
.height
/ 2);
1362 if(style
& wxRIBBON_SCROLL_BTN_ACTIVE
)
1363 arrow_points
[0].y
+= 1;
1364 arrow_points
[1] = arrow_points
[0] + wxPoint(3, -3);
1365 arrow_points
[2] = arrow_points
[0] + wxPoint(3, 3);
1367 case wxRIBBON_SCROLL_BTN_RIGHT
:
1368 arrow_points
[0] = wxPoint(rect
.width
/ 2 + 2, rect
.height
/ 2);
1369 if(style
& wxRIBBON_SCROLL_BTN_ACTIVE
)
1370 arrow_points
[0].y
+= 1;
1371 arrow_points
[1] = arrow_points
[0] - wxPoint(3, 3);
1372 arrow_points
[2] = arrow_points
[0] - wxPoint(3, -3);
1374 case wxRIBBON_SCROLL_BTN_UP
:
1375 arrow_points
[0] = wxPoint(rect
.width
/ 2, rect
.height
/ 2 - 2);
1376 if(style
& wxRIBBON_SCROLL_BTN_ACTIVE
)
1377 arrow_points
[0].y
+= 1;
1378 arrow_points
[1] = arrow_points
[0] + wxPoint( 3, 3);
1379 arrow_points
[2] = arrow_points
[0] + wxPoint(-3, 3);
1381 case wxRIBBON_SCROLL_BTN_DOWN
:
1382 arrow_points
[0] = wxPoint(rect
.width
/ 2, rect
.height
/ 2 + 2);
1383 if(style
& wxRIBBON_SCROLL_BTN_ACTIVE
)
1384 arrow_points
[0].y
+= 1;
1385 arrow_points
[1] = arrow_points
[0] - wxPoint( 3, 3);
1386 arrow_points
[2] = arrow_points
[0] - wxPoint(-3, 3);
1390 dc
.SetPen(*wxTRANSPARENT_PEN
);
1391 wxBrush
B(style
& wxRIBBON_SCROLL_BTN_HOVERED
? m_tab_active_background_colour
: m_tab_label_colour
);
1393 dc
.DrawPolygon(sizeof(arrow_points
)/sizeof(wxPoint
), arrow_points
, rect
.x
, rect
.y
);
1397 void wxRibbonMSWArtProvider::DrawDropdownArrow(wxDC
& dc
, int x
, int y
, const wxColour
& colour
)
1399 wxPoint arrow_points
[3];
1400 wxBrush
brush(colour
);
1401 arrow_points
[0] = wxPoint(1, 2);
1402 arrow_points
[1] = arrow_points
[0] + wxPoint(-3, -3);
1403 arrow_points
[2] = arrow_points
[0] + wxPoint( 3, -3);
1404 dc
.SetPen(*wxTRANSPARENT_PEN
);
1406 dc
.DrawPolygon(sizeof(arrow_points
)/sizeof(wxPoint
), arrow_points
, x
, y
);
1409 void wxRibbonMSWArtProvider::RemovePanelPadding(wxRect
* rect
)
1411 if(m_flags
& wxRIBBON_BAR_FLOW_VERTICAL
)
1423 void wxRibbonMSWArtProvider::DrawPanelBackground(
1428 DrawPartialPageBackground(dc
, wnd
, rect
, false);
1430 wxRect
true_rect(rect
);
1431 RemovePanelPadding(&true_rect
);
1435 dc
.SetFont(m_panel_label_font
);
1436 dc
.SetPen(*wxTRANSPARENT_PEN
);
1437 if(wnd
->IsHovered())
1439 dc
.SetBrush(m_panel_hover_label_background_brush
);
1440 dc
.SetTextForeground(m_panel_hover_label_colour
);
1444 dc
.SetBrush(m_panel_label_background_brush
);
1445 dc
.SetTextForeground(m_panel_label_colour
);
1448 wxRect
label_rect(true_rect
);
1449 wxString label
= wnd
->GetLabel();
1450 bool clip_label
= false;
1451 wxSize
label_size(dc
.GetTextExtent(label
));
1453 label_rect
.SetX(label_rect
.GetX() + 1);
1454 label_rect
.SetWidth(label_rect
.GetWidth() - 2);
1455 label_rect
.SetHeight(label_size
.GetHeight() + 2);
1456 label_rect
.SetY(true_rect
.GetBottom() - label_rect
.GetHeight());
1457 label_height
= label_rect
.GetHeight();
1459 if(label_size
.GetWidth() > label_rect
.GetWidth())
1461 // Test if there is enough length for 3 letters and ...
1462 wxString new_label
= label
.Mid(0, 3) + wxT("...");
1463 label_size
= dc
.GetTextExtent(new_label
);
1464 if(label_size
.GetWidth() > label_rect
.GetWidth())
1466 // Not enough room for three characters and ...
1467 // Display the entire label and just crop it
1472 // Room for some characters and ...
1473 // Display as many characters as possible and append ...
1474 for(size_t len
= label
.Len() - 1; len
>= 3; --len
)
1476 new_label
= label
.Mid(0, len
) + wxT("...");
1477 label_size
= dc
.GetTextExtent(new_label
);
1478 if(label_size
.GetWidth() <= label_rect
.GetWidth())
1487 dc
.DrawRectangle(label_rect
.GetX(), label_rect
.GetY(), label_rect
.GetWidth(), label_rect
.GetHeight());
1490 wxDCClipper
clip(dc
, label_rect
);
1491 dc
.DrawText(label
, label_rect
.x
, label_rect
.y
+
1492 (label_rect
.GetHeight() - label_size
.GetHeight()) / 2);
1496 dc
.DrawText(label
, label_rect
.x
+
1497 (label_rect
.GetWidth() - label_size
.GetWidth()) / 2,
1499 (label_rect
.GetHeight() - label_size
.GetHeight()) / 2);
1503 if(wnd
->IsHovered())
1505 wxRect
client_rect(true_rect
);
1507 client_rect
.width
-= 2;
1509 client_rect
.height
-= 2 + label_height
;
1510 DrawPartialPageBackground(dc
, wnd
, client_rect
, true);
1513 DrawPanelBorder(dc
, true_rect
, m_panel_border_pen
, m_panel_border_gradient_pen
);
1516 void wxRibbonMSWArtProvider::DrawGalleryBackground(
1518 wxRibbonGallery
* wnd
,
1521 DrawPartialPageBackground(dc
, wnd
, rect
);
1523 if(wnd
->IsHovered())
1525 dc
.SetPen(*wxTRANSPARENT_PEN
);
1526 dc
.SetBrush(m_gallery_hover_background_brush
);
1527 if(m_flags
& wxRIBBON_BAR_FLOW_VERTICAL
)
1529 dc
.DrawRectangle(rect
.x
+ 1, rect
.y
+ 1, rect
.width
- 2,
1534 dc
.DrawRectangle(rect
.x
+ 1, rect
.y
+ 1, rect
.width
- 16,
1539 dc
.SetPen(m_gallery_border_pen
);
1541 dc
.DrawLine(rect
.x
+ 1, rect
.y
, rect
.x
+ rect
.width
- 1, rect
.y
);
1542 dc
.DrawLine(rect
.x
, rect
.y
+ 1, rect
.x
, rect
.y
+ rect
.height
- 1);
1543 dc
.DrawLine(rect
.x
+ 1, rect
.y
+ rect
.height
- 1, rect
.x
+ rect
.width
- 1,
1544 rect
.y
+ rect
.height
- 1);
1545 dc
.DrawLine(rect
.x
+ rect
.width
- 1, rect
.y
+ 1, rect
.x
+ rect
.width
- 1,
1546 rect
.y
+ rect
.height
- 1);
1548 DrawGalleryBackgroundCommon(dc
, wnd
, rect
);
1551 void wxRibbonMSWArtProvider::DrawGalleryBackgroundCommon(wxDC
& dc
,
1552 wxRibbonGallery
* wnd
,
1555 wxRect up_btn
, down_btn
, ext_btn
;
1557 if(m_flags
& wxRIBBON_BAR_FLOW_VERTICAL
)
1559 // Divider between items and buttons
1560 dc
.DrawLine(rect
.x
, rect
.y
+ rect
.height
- 15, rect
.x
+ rect
.width
,
1561 rect
.y
+ rect
.height
- 15);
1563 up_btn
= wxRect(rect
.x
, rect
.y
+ rect
.height
- 15, rect
.width
/ 3, 15);
1565 down_btn
= wxRect(up_btn
.GetRight() + 1, up_btn
.GetTop(),
1566 up_btn
.GetWidth(), up_btn
.GetHeight());
1567 dc
.DrawLine(down_btn
.GetLeft(), down_btn
.GetTop(), down_btn
.GetLeft(),
1568 down_btn
.GetBottom());
1570 ext_btn
= wxRect(down_btn
.GetRight() + 1, up_btn
.GetTop(), rect
.width
-
1571 up_btn
.GetWidth() - down_btn
.GetWidth() - 1, up_btn
.GetHeight());
1572 dc
.DrawLine(ext_btn
.GetLeft(), ext_btn
.GetTop(), ext_btn
.GetLeft(),
1573 ext_btn
.GetBottom());
1577 // Divider between items and buttons
1578 dc
.DrawLine(rect
.x
+ rect
.width
- 15, rect
.y
, rect
.x
+ rect
.width
- 15,
1579 rect
.y
+ rect
.height
);
1581 up_btn
= wxRect(rect
.x
+ rect
.width
- 15, rect
.y
, 15, rect
.height
/ 3);
1583 down_btn
= wxRect(up_btn
.GetLeft(), up_btn
.GetBottom() + 1,
1584 up_btn
.GetWidth(), up_btn
.GetHeight());
1585 dc
.DrawLine(down_btn
.GetLeft(), down_btn
.GetTop(), down_btn
.GetRight(),
1588 ext_btn
= wxRect(up_btn
.GetLeft(), down_btn
.GetBottom() + 1, up_btn
.GetWidth(),
1589 rect
.height
- up_btn
.GetHeight() - down_btn
.GetHeight() - 1);
1590 dc
.DrawLine(ext_btn
.GetLeft(), ext_btn
.GetTop(), ext_btn
.GetRight(),
1594 DrawGalleryButton(dc
, up_btn
, wnd
->GetUpButtonState(),
1595 m_gallery_up_bitmap
);
1596 DrawGalleryButton(dc
, down_btn
, wnd
->GetDownButtonState(),
1597 m_gallery_down_bitmap
);
1598 DrawGalleryButton(dc
, ext_btn
, wnd
->GetExtensionButtonState(),
1599 m_gallery_extension_bitmap
);
1602 void wxRibbonMSWArtProvider::DrawGalleryButton(wxDC
& dc
,
1604 wxRibbonGalleryButtonState state
,
1607 wxBitmap btn_bitmap
;
1608 wxBrush btn_top_brush
;
1609 wxColour btn_colour
;
1610 wxColour btn_grad_colour
;
1613 case wxRIBBON_GALLERY_BUTTON_NORMAL
:
1614 btn_top_brush
= m_gallery_button_background_top_brush
;
1615 btn_colour
= m_gallery_button_background_colour
;
1616 btn_grad_colour
= m_gallery_button_background_gradient_colour
;
1617 btn_bitmap
= bitmaps
[0];
1619 case wxRIBBON_GALLERY_BUTTON_HOVERED
:
1620 btn_top_brush
= m_gallery_button_hover_background_top_brush
;
1621 btn_colour
= m_gallery_button_hover_background_colour
;
1622 btn_grad_colour
= m_gallery_button_hover_background_gradient_colour
;
1623 btn_bitmap
= bitmaps
[1];
1625 case wxRIBBON_GALLERY_BUTTON_ACTIVE
:
1626 btn_top_brush
= m_gallery_button_active_background_top_brush
;
1627 btn_colour
= m_gallery_button_active_background_colour
;
1628 btn_grad_colour
= m_gallery_button_active_background_gradient_colour
;
1629 btn_bitmap
= bitmaps
[2];
1631 case wxRIBBON_GALLERY_BUTTON_DISABLED
:
1632 btn_top_brush
= m_gallery_button_disabled_background_top_brush
;
1633 btn_colour
= m_gallery_button_disabled_background_colour
;
1634 btn_grad_colour
= m_gallery_button_disabled_background_gradient_colour
;
1635 btn_bitmap
= bitmaps
[3];
1641 if(m_flags
& wxRIBBON_BAR_FLOW_VERTICAL
)
1652 dc
.SetPen(*wxTRANSPARENT_PEN
);
1653 dc
.SetBrush(btn_top_brush
);
1654 dc
.DrawRectangle(rect
.x
, rect
.y
, rect
.width
, rect
.height
/ 2);
1657 lower
.height
= (lower
.height
+ 1) / 2;
1658 lower
.y
+= rect
.height
- lower
.height
;
1659 dc
.GradientFillLinear(lower
, btn_colour
, btn_grad_colour
, wxSOUTH
);
1661 dc
.DrawBitmap(btn_bitmap
, rect
.x
+ rect
.width
/ 2 - 2, lower
.y
- 2, true);
1664 void wxRibbonMSWArtProvider::DrawGalleryItemBackground(
1666 wxRibbonGallery
* wnd
,
1668 wxRibbonGalleryItem
* item
)
1670 if(wnd
->GetHoveredItem() != item
&& wnd
->GetActiveItem() != item
&&
1671 wnd
->GetSelection() != item
)
1674 dc
.SetPen(m_gallery_item_border_pen
);
1675 dc
.DrawLine(rect
.x
+ 1, rect
.y
, rect
.x
+ rect
.width
- 1, rect
.y
);
1676 dc
.DrawLine(rect
.x
, rect
.y
+ 1, rect
.x
, rect
.y
+ rect
.height
- 1);
1677 dc
.DrawLine(rect
.x
+ 1, rect
.y
+ rect
.height
- 1, rect
.x
+ rect
.width
- 1,
1678 rect
.y
+ rect
.height
- 1);
1679 dc
.DrawLine(rect
.x
+ rect
.width
- 1, rect
.y
+ 1, rect
.x
+ rect
.width
- 1,
1680 rect
.y
+ rect
.height
- 1);
1684 wxColour bg_gradient_colour
;
1686 if(wnd
->GetActiveItem() == item
|| wnd
->GetSelection() == item
)
1688 top_brush
= m_gallery_button_active_background_top_brush
;
1689 bg_colour
= m_gallery_button_active_background_colour
;
1690 bg_gradient_colour
= m_gallery_button_active_background_gradient_colour
;
1694 top_brush
= m_gallery_button_hover_background_top_brush
;
1695 bg_colour
= m_gallery_button_hover_background_colour
;
1696 bg_gradient_colour
= m_gallery_button_hover_background_gradient_colour
;
1704 dc
.SetPen(*wxTRANSPARENT_PEN
);
1705 dc
.SetBrush(top_brush
);
1706 dc
.DrawRectangle(upper
.x
, upper
.y
, upper
.width
, upper
.height
);
1708 wxRect
lower(upper
);
1709 lower
.y
+= lower
.height
;
1710 lower
.height
= rect
.height
- 2 - lower
.height
;
1711 dc
.GradientFillLinear(lower
, bg_colour
, bg_gradient_colour
, wxSOUTH
);
1714 void wxRibbonMSWArtProvider::DrawPanelBorder(wxDC
& dc
, const wxRect
& rect
,
1715 wxPen
& primary_colour
,
1716 wxPen
& secondary_colour
)
1718 wxPoint border_points
[9];
1719 border_points
[0] = wxPoint(2, 0);
1720 border_points
[1] = wxPoint(rect
.width
- 3, 0);
1721 border_points
[2] = wxPoint(rect
.width
- 1, 2);
1722 border_points
[3] = wxPoint(rect
.width
- 1, rect
.height
- 3);
1723 border_points
[4] = wxPoint(rect
.width
- 3, rect
.height
- 1);
1724 border_points
[5] = wxPoint(2, rect
.height
- 1);
1725 border_points
[6] = wxPoint(0, rect
.height
- 3);
1726 border_points
[7] = wxPoint(0, 2);
1728 if(primary_colour
.GetColour() == secondary_colour
.GetColour())
1730 border_points
[8] = border_points
[0];
1731 dc
.SetPen(primary_colour
);
1732 dc
.DrawLines(sizeof(border_points
)/sizeof(wxPoint
), border_points
, rect
.x
, rect
.y
);
1736 dc
.SetPen(primary_colour
);
1737 dc
.DrawLines(3, border_points
, rect
.x
, rect
.y
);
1739 #define SingleLine(start, finish) \
1740 dc.DrawLine(start.x + rect.x, start.y + rect.y, finish.x + rect.x, finish.y + rect.y)
1742 SingleLine(border_points
[0], border_points
[7]);
1743 dc
.SetPen(secondary_colour
);
1744 dc
.DrawLines(3, border_points
+ 4, rect
.x
, rect
.y
);
1745 SingleLine(border_points
[4], border_points
[3]);
1749 border_points
[6] = border_points
[2];
1750 wxRibbonDrawParallelGradientLines(dc
, 2, border_points
+ 6, 0, 1,
1751 border_points
[3].y
- border_points
[2].y
+ 1, rect
.x
, rect
.y
,
1752 primary_colour
.GetColour(), secondary_colour
.GetColour());
1756 void wxRibbonMSWArtProvider::DrawMinimisedPanel(
1762 DrawPartialPageBackground(dc
, wnd
, rect
, false);
1764 wxRect
true_rect(rect
);
1765 RemovePanelPadding(&true_rect
);
1767 if(wnd
->GetExpandedPanel() != NULL
)
1769 wxRect
client_rect(true_rect
);
1771 client_rect
.width
-= 2;
1773 client_rect
.height
= (rect
.y
+ rect
.height
/ 5) - client_rect
.x
;
1774 dc
.GradientFillLinear(client_rect
,
1775 m_panel_active_background_top_colour
,
1776 m_panel_active_background_top_gradient_colour
, wxSOUTH
);
1778 client_rect
.y
+= client_rect
.height
;
1779 client_rect
.height
= (true_rect
.y
+ true_rect
.height
) - client_rect
.y
;
1780 dc
.GradientFillLinear(client_rect
,
1781 m_panel_active_background_colour
,
1782 m_panel_active_background_gradient_colour
, wxSOUTH
);
1784 else if(wnd
->IsHovered())
1786 wxRect
client_rect(true_rect
);
1788 client_rect
.width
-= 2;
1790 client_rect
.height
-= 2;
1791 DrawPartialPageBackground(dc
, wnd
, client_rect
, true);
1795 DrawMinimisedPanelCommon(dc
, wnd
, true_rect
, &preview
);
1797 dc
.SetBrush(m_panel_hover_label_background_brush
);
1798 dc
.SetPen(*wxTRANSPARENT_PEN
);
1799 dc
.DrawRectangle(preview
.x
+ 1, preview
.y
+ preview
.height
- 8,
1800 preview
.width
- 2, 7);
1802 int mid_pos
= rect
.y
+ rect
.height
/ 5 - preview
.y
;
1803 if(mid_pos
< 0 || mid_pos
>= preview
.height
)
1805 wxRect
full_rect(preview
);
1808 full_rect
.width
-= 2;
1809 full_rect
.height
-= 9;
1812 dc
.GradientFillLinear(full_rect
,
1813 m_page_hover_background_colour
,
1814 m_page_hover_background_gradient_colour
, wxSOUTH
);
1818 dc
.GradientFillLinear(full_rect
,
1819 m_page_hover_background_top_colour
,
1820 m_page_hover_background_top_gradient_colour
, wxSOUTH
);
1825 wxRect
top_rect(preview
);
1828 top_rect
.width
-= 2;
1829 top_rect
.height
= mid_pos
;
1830 dc
.GradientFillLinear(top_rect
,
1831 m_page_hover_background_top_colour
,
1832 m_page_hover_background_top_gradient_colour
, wxSOUTH
);
1834 wxRect
btm_rect(top_rect
);
1835 btm_rect
.y
= preview
.y
+ mid_pos
;
1836 btm_rect
.height
= preview
.y
+ preview
.height
- 7 - btm_rect
.y
;
1837 dc
.GradientFillLinear(btm_rect
,
1838 m_page_hover_background_colour
,
1839 m_page_hover_background_gradient_colour
, wxSOUTH
);
1844 dc
.DrawBitmap(bitmap
, preview
.x
+ (preview
.width
- bitmap
.GetWidth()) / 2,
1845 preview
.y
+ (preview
.height
- 7 - bitmap
.GetHeight()) / 2, true);
1848 DrawPanelBorder(dc
, preview
, m_panel_border_pen
, m_panel_border_gradient_pen
);
1850 DrawPanelBorder(dc
, true_rect
, m_panel_minimised_border_pen
,
1851 m_panel_minimised_border_gradient_pen
);
1854 void wxRibbonMSWArtProvider::DrawMinimisedPanelCommon(
1857 const wxRect
& true_rect
,
1858 wxRect
* preview_rect
)
1860 wxRect
preview(0, 0, 32, 32);
1861 if(m_flags
& wxRIBBON_BAR_FLOW_VERTICAL
)
1863 preview
.x
= true_rect
.x
+ 4;
1864 preview
.y
= true_rect
.y
+ (true_rect
.height
- preview
.height
) / 2;
1868 preview
.x
= true_rect
.x
+ (true_rect
.width
- preview
.width
) / 2;
1869 preview
.y
= true_rect
.y
+ 4;
1872 *preview_rect
= preview
;
1874 wxCoord label_width
, label_height
;
1875 dc
.SetFont(m_panel_label_font
);
1876 dc
.GetTextExtent(wnd
->GetLabel(), &label_width
, &label_height
);
1878 int xpos
= true_rect
.x
+ (true_rect
.width
- label_width
+ 1) / 2;
1879 int ypos
= preview
.y
+ preview
.height
+ 5;
1881 if(m_flags
& wxRIBBON_BAR_FLOW_VERTICAL
)
1883 xpos
= preview
.x
+ preview
.width
+ 5;
1884 ypos
= true_rect
.y
+ (true_rect
.height
- label_height
) / 2;
1887 dc
.SetTextForeground(m_panel_minimised_label_colour
);
1888 dc
.DrawText(wnd
->GetLabel(), xpos
, ypos
);
1891 wxPoint arrow_points
[3];
1892 if(m_flags
& wxRIBBON_BAR_FLOW_VERTICAL
)
1894 xpos
+= label_width
;
1895 arrow_points
[0] = wxPoint(xpos
+ 5, ypos
+ label_height
/ 2);
1896 arrow_points
[1] = arrow_points
[0] + wxPoint(-3, 3);
1897 arrow_points
[2] = arrow_points
[0] + wxPoint(-3, -3);
1901 ypos
+= label_height
;
1902 arrow_points
[0] = wxPoint(true_rect
.width
/ 2, ypos
+ 5);
1903 arrow_points
[1] = arrow_points
[0] + wxPoint(-3, -3);
1904 arrow_points
[2] = arrow_points
[0] + wxPoint( 3, -3);
1907 dc
.SetPen(*wxTRANSPARENT_PEN
);
1908 wxBrush
B(m_panel_minimised_label_colour
);
1910 dc
.DrawPolygon(sizeof(arrow_points
)/sizeof(wxPoint
), arrow_points
,
1911 true_rect
.x
, true_rect
.y
);
1914 void wxRibbonMSWArtProvider::DrawButtonBarBackground(
1919 DrawPartialPageBackground(dc
, wnd
, rect
, true);
1922 void wxRibbonMSWArtProvider::DrawPartialPageBackground(
1928 // Assume the window is a child of a ribbon page, and also check for a
1929 // hovered panel somewhere between the window and the page, as it causes
1930 // the background to change.
1931 wxPoint
offset(wnd
->GetPosition());
1932 wxRibbonPage
* page
= NULL
;
1933 wxWindow
* parent
= wnd
->GetParent();
1934 wxRibbonPanel
* panel
= NULL
;
1935 bool hovered
= false;
1937 panel
= wxDynamicCast(wnd
, wxRibbonPanel
);
1940 hovered
= allow_hovered
&& panel
->IsHovered();
1941 if(panel
->GetExpandedDummy() != NULL
)
1943 offset
= panel
->GetExpandedDummy()->GetPosition();
1944 parent
= panel
->GetExpandedDummy()->GetParent();
1947 for(; parent
; parent
= parent
->GetParent())
1951 panel
= wxDynamicCast(parent
, wxRibbonPanel
);
1954 hovered
= allow_hovered
&& panel
->IsHovered();
1955 if(panel
->GetExpandedDummy() != NULL
)
1957 parent
= panel
->GetExpandedDummy();
1961 page
= wxDynamicCast(parent
, wxRibbonPage
);
1966 offset
+= parent
->GetPosition();
1970 DrawPartialPageBackground(dc
, wnd
, rect
, page
, offset
, hovered
);
1974 // No page found - fallback to painting with a stock brush
1975 dc
.SetBrush(*wxWHITE_BRUSH
);
1976 dc
.SetPen(*wxTRANSPARENT_PEN
);
1977 dc
.DrawRectangle(rect
.x
, rect
.y
, rect
.width
, rect
.height
);
1980 void wxRibbonMSWArtProvider::DrawButtonBarButton(
1982 wxWindow
* WXUNUSED(wnd
),
1984 wxRibbonButtonKind kind
,
1986 const wxString
& label
,
1987 const wxBitmap
& bitmap_large
,
1988 const wxBitmap
& bitmap_small
)
1990 if(state
& (wxRIBBON_BUTTONBAR_BUTTON_HOVER_MASK
|
1991 wxRIBBON_BUTTONBAR_BUTTON_ACTIVE_MASK
))
1993 if(state
& wxRIBBON_BUTTONBAR_BUTTON_ACTIVE_MASK
)
1994 dc
.SetPen(m_button_bar_active_border_pen
);
1996 dc
.SetPen(m_button_bar_hover_border_pen
);
1998 wxRect
bg_rect(rect
);
2002 bg_rect
.height
-= 2;
2004 wxRect
bg_rect_top(bg_rect
);
2005 bg_rect_top
.height
/= 3;
2006 bg_rect
.y
+= bg_rect_top
.height
;
2007 bg_rect
.height
-= bg_rect_top
.height
;
2009 if(kind
== wxRIBBON_BUTTON_HYBRID
)
2011 switch(state
& wxRIBBON_BUTTONBAR_BUTTON_SIZE_MASK
)
2013 case wxRIBBON_BUTTONBAR_BUTTON_LARGE
:
2015 int iYBorder
= rect
.y
+ bitmap_large
.GetHeight() + 4;
2016 wxRect
partial_bg(rect
);
2017 if(state
& wxRIBBON_BUTTONBAR_BUTTON_NORMAL_HOVERED
)
2019 partial_bg
.SetBottom(iYBorder
- 1);
2023 partial_bg
.height
-= (iYBorder
- partial_bg
.y
+ 1);
2024 partial_bg
.y
= iYBorder
+ 1;
2026 dc
.DrawLine(rect
.x
, iYBorder
, rect
.x
+ rect
.width
, iYBorder
);
2027 bg_rect
.Intersect(partial_bg
);
2028 bg_rect_top
.Intersect(partial_bg
);
2031 case wxRIBBON_BUTTONBAR_BUTTON_MEDIUM
:
2033 int iArrowWidth
= 9;
2034 if(state
& wxRIBBON_BUTTONBAR_BUTTON_NORMAL_HOVERED
)
2036 bg_rect
.width
-= iArrowWidth
;
2037 bg_rect_top
.width
-= iArrowWidth
;
2038 dc
.DrawLine(bg_rect_top
.x
+ bg_rect_top
.width
,
2039 rect
.y
, bg_rect_top
.x
+ bg_rect_top
.width
,
2040 rect
.y
+ rect
.height
);
2045 bg_rect
.x
+= bg_rect
.width
- iArrowWidth
;
2046 bg_rect_top
.x
+= bg_rect_top
.width
- iArrowWidth
;
2047 bg_rect
.width
= iArrowWidth
;
2048 bg_rect_top
.width
= iArrowWidth
;
2049 dc
.DrawLine(bg_rect_top
.x
- 1, rect
.y
,
2050 bg_rect_top
.x
- 1, rect
.y
+ rect
.height
);
2054 case wxRIBBON_BUTTONBAR_BUTTON_SMALL
:
2059 if(state
& wxRIBBON_BUTTONBAR_BUTTON_ACTIVE_MASK
)
2061 dc
.GradientFillLinear(bg_rect_top
,
2062 m_button_bar_active_background_top_colour
,
2063 m_button_bar_active_background_top_gradient_colour
, wxSOUTH
);
2064 dc
.GradientFillLinear(bg_rect
,
2065 m_button_bar_active_background_colour
,
2066 m_button_bar_active_background_gradient_colour
, wxSOUTH
);
2070 dc
.GradientFillLinear(bg_rect_top
,
2071 m_button_bar_hover_background_top_colour
,
2072 m_button_bar_hover_background_top_gradient_colour
, wxSOUTH
);
2073 dc
.GradientFillLinear(bg_rect
,
2074 m_button_bar_hover_background_colour
,
2075 m_button_bar_hover_background_gradient_colour
, wxSOUTH
);
2078 wxPoint border_points
[9];
2079 border_points
[0] = wxPoint(2, 0);
2080 border_points
[1] = wxPoint(rect
.width
- 3, 0);
2081 border_points
[2] = wxPoint(rect
.width
- 1, 2);
2082 border_points
[3] = wxPoint(rect
.width
- 1, rect
.height
- 3);
2083 border_points
[4] = wxPoint(rect
.width
- 3, rect
.height
- 1);
2084 border_points
[5] = wxPoint(2, rect
.height
- 1);
2085 border_points
[6] = wxPoint(0, rect
.height
- 3);
2086 border_points
[7] = wxPoint(0, 2);
2087 border_points
[8] = border_points
[0];
2089 dc
.DrawLines(sizeof(border_points
)/sizeof(wxPoint
), border_points
,
2093 dc
.SetFont(m_button_bar_label_font
);
2094 dc
.SetTextForeground(m_button_bar_label_colour
);
2095 DrawButtonBarButtonForeground(dc
, rect
, kind
, state
, label
, bitmap_large
,
2099 void wxRibbonMSWArtProvider::DrawButtonBarButtonForeground(
2102 wxRibbonButtonKind kind
,
2104 const wxString
& label
,
2105 const wxBitmap
& bitmap_large
,
2106 const wxBitmap
& bitmap_small
)
2108 switch(state
& wxRIBBON_BUTTONBAR_BUTTON_SIZE_MASK
)
2110 case wxRIBBON_BUTTONBAR_BUTTON_LARGE
:
2112 const int padding
= 2;
2113 dc
.DrawBitmap(bitmap_large
,
2114 rect
.x
+ (rect
.width
- bitmap_large
.GetWidth()) / 2,
2115 rect
.y
+ padding
, true);
2116 int ypos
= rect
.y
+ padding
+ bitmap_large
.GetHeight() + padding
;
2117 int arrow_width
= kind
== wxRIBBON_BUTTON_NORMAL
? 0 : 8;
2118 wxCoord label_w
, label_h
;
2119 dc
.GetTextExtent(label
, &label_w
, &label_h
);
2120 if(label_w
+ 2 * padding
<= rect
.width
)
2122 dc
.DrawText(label
, rect
.x
+ (rect
.width
- label_w
) / 2, ypos
);
2123 if(arrow_width
!= 0)
2125 DrawDropdownArrow(dc
, rect
.x
+ rect
.width
/ 2,
2126 ypos
+ (label_h
* 3) / 2,
2127 m_button_bar_label_colour
);
2132 size_t breaki
= label
.Len();
2136 if(wxRibbonCanLabelBreakAtPosition(label
, breaki
))
2138 wxString label_top
= label
.Mid(0, breaki
);
2139 dc
.GetTextExtent(label_top
, &label_w
, &label_h
);
2140 if(label_w
+ 2 * padding
<= rect
.width
)
2142 dc
.DrawText(label_top
,
2143 rect
.x
+ (rect
.width
- label_w
) / 2, ypos
);
2145 wxString label_bottom
= label
.Mid(breaki
+ 1);
2146 dc
.GetTextExtent(label_bottom
, &label_w
, &label_h
);
2147 label_w
+= arrow_width
;
2148 int iX
= rect
.x
+ (rect
.width
- label_w
) / 2;
2149 dc
.DrawText(label_bottom
, iX
, ypos
);
2150 if(arrow_width
!= 0)
2152 DrawDropdownArrow(dc
,
2153 iX
+ 2 +label_w
- arrow_width
,
2154 ypos
+ label_h
/ 2 + 1,
2155 m_button_bar_label_colour
);
2160 } while(breaki
> 0);
2164 case wxRIBBON_BUTTONBAR_BUTTON_MEDIUM
:
2166 int x_cursor
= rect
.x
+ 2;
2167 dc
.DrawBitmap(bitmap_small
, x_cursor
,
2168 rect
.y
+ (rect
.height
- bitmap_small
.GetHeight())/2, true);
2169 x_cursor
+= bitmap_small
.GetWidth() + 2;
2170 wxCoord label_w
, label_h
;
2171 dc
.GetTextExtent(label
, &label_w
, &label_h
);
2172 dc
.DrawText(label
, x_cursor
,
2173 rect
.y
+ (rect
.height
- label_h
) / 2);
2174 x_cursor
+= label_w
+ 3;
2175 if(kind
!= wxRIBBON_BUTTON_NORMAL
)
2177 DrawDropdownArrow(dc
, x_cursor
, rect
.y
+ rect
.height
/ 2,
2178 m_button_bar_label_colour
);
2188 void wxRibbonMSWArtProvider::DrawToolBarBackground(
2193 DrawPartialPageBackground(dc
, wnd
, rect
);
2196 void wxRibbonMSWArtProvider::DrawToolGroupBackground(
2198 wxWindow
* WXUNUSED(wnd
),
2201 dc
.SetPen(m_toolbar_border_pen
);
2203 outline
[0] = wxPoint(2, 0);
2204 outline
[1] = wxPoint(rect
.width
- 3, 0);
2205 outline
[2] = wxPoint(rect
.width
- 1, 2);
2206 outline
[3] = wxPoint(rect
.width
- 1, rect
.height
- 3);
2207 outline
[4] = wxPoint(rect
.width
- 3, rect
.height
- 1);
2208 outline
[5] = wxPoint(2, rect
.height
- 1);
2209 outline
[6] = wxPoint(0, rect
.height
- 3);
2210 outline
[7] = wxPoint(0, 2);
2211 outline
[8] = outline
[0];
2213 dc
.DrawLines(sizeof(outline
)/sizeof(wxPoint
), outline
, rect
.x
, rect
.y
);
2216 void wxRibbonMSWArtProvider::DrawTool(
2218 wxWindow
* WXUNUSED(wnd
),
2220 const wxBitmap
& bitmap
,
2221 wxRibbonButtonKind kind
,
2224 wxRect
bg_rect(rect
);
2226 if((state
& wxRIBBON_TOOLBAR_TOOL_LAST
) == 0)
2228 bool is_split_hybrid
= (kind
== wxRIBBON_BUTTON_HYBRID
&& (state
&
2229 (wxRIBBON_TOOLBAR_TOOL_HOVER_MASK
| wxRIBBON_TOOLBAR_TOOL_ACTIVE_MASK
)));
2232 wxRect
bg_rect_top(bg_rect
);
2233 bg_rect_top
.height
= (bg_rect_top
.height
* 2) / 5;
2234 wxRect
bg_rect_btm(bg_rect
);
2235 bg_rect_btm
.y
+= bg_rect_top
.height
;
2236 bg_rect_btm
.height
-= bg_rect_top
.height
;
2237 wxColour bg_top_colour
= m_tool_background_top_colour
;
2238 wxColour bg_top_grad_colour
= m_tool_background_top_gradient_colour
;
2239 wxColour bg_colour
= m_tool_background_colour
;
2240 wxColour bg_grad_colour
= m_tool_background_gradient_colour
;
2241 if(state
& wxRIBBON_TOOLBAR_TOOL_ACTIVE_MASK
)
2243 bg_top_colour
= m_tool_active_background_top_colour
;
2244 bg_top_grad_colour
= m_tool_active_background_top_gradient_colour
;
2245 bg_colour
= m_tool_active_background_colour
;
2246 bg_grad_colour
= m_tool_active_background_gradient_colour
;
2248 else if(state
& wxRIBBON_TOOLBAR_TOOL_HOVER_MASK
)
2250 bg_top_colour
= m_tool_hover_background_top_colour
;
2251 bg_top_grad_colour
= m_tool_hover_background_top_gradient_colour
;
2252 bg_colour
= m_tool_hover_background_colour
;
2253 bg_grad_colour
= m_tool_hover_background_gradient_colour
;
2255 dc
.GradientFillLinear(bg_rect_top
, bg_top_colour
, bg_top_grad_colour
, wxSOUTH
);
2256 dc
.GradientFillLinear(bg_rect_btm
, bg_colour
, bg_grad_colour
, wxSOUTH
);
2259 wxRect
nonrect(bg_rect
);
2260 if(state
& (wxRIBBON_TOOLBAR_TOOL_DROPDOWN_HOVERED
|
2261 wxRIBBON_TOOLBAR_TOOL_DROPDOWN_ACTIVE
))
2267 nonrect
.x
+= nonrect
.width
- 8;
2270 wxBrush
B(m_tool_hover_background_top_colour
);
2271 dc
.SetPen(*wxTRANSPARENT_PEN
);
2273 dc
.DrawRectangle(nonrect
.x
, nonrect
.y
, nonrect
.width
, nonrect
.height
);
2277 dc
.SetPen(m_toolbar_border_pen
);
2278 if(state
& wxRIBBON_TOOLBAR_TOOL_FIRST
)
2280 dc
.DrawPoint(rect
.x
+ 1, rect
.y
+ 1);
2281 dc
.DrawPoint(rect
.x
+ 1, rect
.y
+ rect
.height
- 2);
2284 dc
.DrawLine(rect
.x
, rect
.y
+ 1, rect
.x
, rect
.y
+ rect
.height
- 1);
2286 if(state
& wxRIBBON_TOOLBAR_TOOL_LAST
)
2288 dc
.DrawPoint(rect
.x
+ rect
.width
- 2, rect
.y
+ 1);
2289 dc
.DrawPoint(rect
.x
+ rect
.width
- 2, rect
.y
+ rect
.height
- 2);
2293 int avail_width
= bg_rect
.GetWidth();
2294 if(kind
!= wxRIBBON_BUTTON_NORMAL
)
2299 dc
.DrawLine(rect
.x
+ avail_width
+ 1, rect
.y
,
2300 rect
.x
+ avail_width
+ 1, rect
.y
+ rect
.height
);
2302 dc
.DrawBitmap(m_toolbar_drop_bitmap
, bg_rect
.x
+ avail_width
+ 2,
2303 bg_rect
.y
+ (bg_rect
.height
/ 2) - 2, true);
2305 dc
.DrawBitmap(bitmap
, bg_rect
.x
+ (avail_width
- bitmap
.GetWidth()) / 2,
2306 bg_rect
.y
+ (bg_rect
.height
- bitmap
.GetHeight()) / 2, true);
2309 void wxRibbonMSWArtProvider::GetBarTabWidth(
2311 wxWindow
* WXUNUSED(wnd
),
2312 const wxString
& label
,
2313 const wxBitmap
& bitmap
,
2315 int* small_begin_need_separator
,
2316 int* small_must_have_separator
,
2321 if((m_flags
& wxRIBBON_BAR_SHOW_PAGE_LABELS
) && !label
.IsEmpty())
2323 dc
.SetFont(m_tab_label_font
);
2324 width
+= dc
.GetTextExtent(label
).GetWidth();
2325 min
+= wxMin(25, width
); // enough for a few chars
2328 // gap between label and bitmap
2333 if((m_flags
& wxRIBBON_BAR_SHOW_PAGE_ICONS
) && bitmap
.IsOk())
2335 width
+= bitmap
.GetWidth();
2336 min
+= bitmap
.GetWidth();
2341 *ideal
= width
+ 30;
2343 if(small_begin_need_separator
!= NULL
)
2345 *small_begin_need_separator
= width
+ 20;
2347 if(small_must_have_separator
!= NULL
)
2349 *small_must_have_separator
= width
+ 10;
2357 int wxRibbonMSWArtProvider::GetTabCtrlHeight(
2359 wxWindow
* WXUNUSED(wnd
),
2360 const wxRibbonPageTabInfoArray
& pages
)
2362 int text_height
= 0;
2363 int icon_height
= 0;
2365 if(pages
.GetCount() <= 1 && (m_flags
& wxRIBBON_BAR_ALWAYS_SHOW_TABS
) == 0)
2367 // To preserve space, a single tab need not be displayed. We still need
2368 // two pixels of border / padding though.
2372 if(m_flags
& wxRIBBON_BAR_SHOW_PAGE_LABELS
)
2374 dc
.SetFont(m_tab_label_font
);
2375 text_height
= dc
.GetTextExtent(wxT("ABCDEFXj")).GetHeight() + 10;
2377 if(m_flags
& wxRIBBON_BAR_SHOW_PAGE_ICONS
)
2379 size_t numpages
= pages
.GetCount();
2380 for(size_t i
= 0; i
< numpages
; ++i
)
2382 const wxRibbonPageTabInfo
& info
= pages
.Item(i
);
2383 if(info
.page
->GetIcon().IsOk())
2385 icon_height
= wxMax(icon_height
, info
.page
->GetIcon().GetHeight() + 4);
2390 return wxMax(text_height
, icon_height
);
2393 wxSize
wxRibbonMSWArtProvider::GetScrollButtonMinimumSize(
2395 wxWindow
* WXUNUSED(wnd
),
2396 long WXUNUSED(style
))
2398 return wxSize(12, 12);
2401 wxSize
wxRibbonMSWArtProvider::GetPanelSize(
2403 const wxRibbonPanel
* wnd
,
2405 wxPoint
* client_offset
)
2407 dc
.SetFont(m_panel_label_font
);
2408 wxSize label_size
= dc
.GetTextExtent(wnd
->GetLabel());
2410 client_size
.IncBy(0, label_size
.GetHeight());
2411 if(m_flags
& wxRIBBON_BAR_FLOW_VERTICAL
)
2412 client_size
.IncBy(4, 8);
2414 client_size
.IncBy(6, 6);
2416 if(client_offset
!= NULL
)
2418 if(m_flags
& wxRIBBON_BAR_FLOW_VERTICAL
)
2419 *client_offset
= wxPoint(2, 3);
2421 *client_offset
= wxPoint(3, 2);
2427 wxSize
wxRibbonMSWArtProvider::GetPanelClientSize(
2429 const wxRibbonPanel
* wnd
,
2431 wxPoint
* client_offset
)
2433 dc
.SetFont(m_panel_label_font
);
2434 wxSize label_size
= dc
.GetTextExtent(wnd
->GetLabel());
2436 size
.DecBy(0, label_size
.GetHeight());
2437 if(m_flags
& wxRIBBON_BAR_FLOW_VERTICAL
)
2442 if(client_offset
!= NULL
)
2444 if(m_flags
& wxRIBBON_BAR_FLOW_VERTICAL
)
2445 *client_offset
= wxPoint(2, 3);
2447 *client_offset
= wxPoint(3, 2);
2453 wxSize
wxRibbonMSWArtProvider::GetGallerySize(
2455 const wxRibbonGallery
* WXUNUSED(wnd
),
2458 client_size
.IncBy( 2, 1); // Left / top padding
2459 if(m_flags
& wxRIBBON_BAR_FLOW_VERTICAL
)
2460 client_size
.IncBy(1, 16); // Right / bottom padding
2462 client_size
.IncBy(16, 1); // Right / bottom padding
2466 wxSize
wxRibbonMSWArtProvider::GetGalleryClientSize(
2468 const wxRibbonGallery
* WXUNUSED(wnd
),
2470 wxPoint
* client_offset
,
2471 wxRect
* scroll_up_button
,
2472 wxRect
* scroll_down_button
,
2473 wxRect
* extension_button
)
2478 if(m_flags
& wxRIBBON_BAR_FLOW_VERTICAL
)
2480 // Flow is vertical - put buttons on bottom
2481 scroll_up
.y
= size
.GetHeight() - 15;
2482 scroll_up
.height
= 15;
2484 scroll_up
.width
= (size
.GetWidth() + 2) / 3;
2485 scroll_down
.y
= scroll_up
.y
;
2486 scroll_down
.height
= scroll_up
.height
;
2487 scroll_down
.x
= scroll_up
.x
+ scroll_up
.width
;
2488 scroll_down
.width
= scroll_up
.width
;
2489 extension
.y
= scroll_down
.y
;
2490 extension
.height
= scroll_down
.height
;
2491 extension
.x
= scroll_down
.x
+ scroll_down
.width
;
2492 extension
.width
= size
.GetWidth() - scroll_up
.width
- scroll_down
.width
;
2498 // Flow is horizontal - put buttons on right
2499 scroll_up
.x
= size
.GetWidth() - 15;
2500 scroll_up
.width
= 15;
2502 scroll_up
.height
= (size
.GetHeight() + 2) / 3;
2503 scroll_down
.x
= scroll_up
.x
;
2504 scroll_down
.width
= scroll_up
.width
;
2505 scroll_down
.y
= scroll_up
.y
+ scroll_up
.height
;
2506 scroll_down
.height
= scroll_up
.height
;
2507 extension
.x
= scroll_down
.x
;
2508 extension
.width
= scroll_down
.width
;
2509 extension
.y
= scroll_down
.y
+ scroll_down
.height
;
2510 extension
.height
= size
.GetHeight() - scroll_up
.height
- scroll_down
.height
;
2515 if(client_offset
!= NULL
)
2516 *client_offset
= wxPoint(2, 1);
2517 if(scroll_up_button
!= NULL
)
2518 *scroll_up_button
= scroll_up
;
2519 if(scroll_down_button
!= NULL
)
2520 *scroll_down_button
= scroll_down
;
2521 if(extension_button
!= NULL
)
2522 *extension_button
= extension
;
2527 wxRect
wxRibbonMSWArtProvider::GetPageBackgroundRedrawArea(
2529 const wxRibbonPage
* WXUNUSED(wnd
),
2530 wxSize page_old_size
,
2531 wxSize page_new_size
)
2533 wxRect new_rect
, old_rect
;
2535 if(page_new_size
.GetWidth() != page_old_size
.GetWidth())
2537 if(page_new_size
.GetHeight() != page_old_size
.GetHeight())
2539 // Width and height both changed - redraw everything
2540 return wxRect(page_new_size
);
2544 // Only width changed - redraw right hand side
2545 const int right_edge_width
= 4;
2547 new_rect
= wxRect(page_new_size
.GetWidth() - right_edge_width
, 0, right_edge_width
, page_new_size
.GetHeight());
2548 old_rect
= wxRect(page_old_size
.GetWidth() - right_edge_width
, 0, right_edge_width
, page_old_size
.GetHeight());
2553 if(page_new_size
.GetHeight() == page_old_size
.GetHeight())
2555 // Nothing changed (should never happen) - redraw nothing
2556 return wxRect(0, 0, 0, 0);
2560 // Height changed - need to redraw everything (as the background
2561 // gradient is done vertically).
2562 return page_new_size
;
2566 new_rect
.Union(old_rect
);
2567 new_rect
.Intersect(wxRect(page_new_size
));
2571 bool wxRibbonMSWArtProvider::GetButtonBarButtonSize(
2574 wxRibbonButtonKind kind
,
2575 wxRibbonButtonBarButtonState size
,
2576 const wxString
& label
,
2577 wxSize bitmap_size_large
,
2578 wxSize bitmap_size_small
,
2579 wxSize
* button_size
,
2580 wxRect
* normal_region
,
2581 wxRect
* dropdown_region
)
2583 const int drop_button_width
= 8;
2585 dc
.SetFont(m_button_bar_label_font
);
2586 switch(size
& wxRIBBON_BUTTONBAR_BUTTON_SIZE_MASK
)
2588 case wxRIBBON_BUTTONBAR_BUTTON_SMALL
:
2589 // Small bitmap, no label
2590 *button_size
= bitmap_size_small
+ wxSize(6, 4);
2593 case wxRIBBON_BUTTON_NORMAL
:
2594 *normal_region
= wxRect(*button_size
);
2595 *dropdown_region
= wxRect(0, 0, 0, 0);
2597 case wxRIBBON_BUTTON_DROPDOWN
:
2598 *button_size
+= wxSize(drop_button_width
, 0);
2599 *dropdown_region
= wxRect(*button_size
);
2600 *normal_region
= wxRect(0, 0, 0, 0);
2602 case wxRIBBON_BUTTON_HYBRID
:
2603 *normal_region
= wxRect(*button_size
);
2604 *dropdown_region
= wxRect(button_size
->GetWidth(), 0,
2605 drop_button_width
, button_size
->GetHeight());
2606 *button_size
+= wxSize(drop_button_width
, 0);
2610 case wxRIBBON_BUTTONBAR_BUTTON_MEDIUM
:
2611 // Small bitmap, with label to the right
2613 GetButtonBarButtonSize(dc
, wnd
, kind
, wxRIBBON_BUTTONBAR_BUTTON_SMALL
,
2614 label
, bitmap_size_large
, bitmap_size_small
, button_size
,
2615 normal_region
, dropdown_region
);
2616 int text_size
= dc
.GetTextExtent(label
).GetWidth();
2617 button_size
->SetWidth(button_size
->GetWidth() + text_size
);
2620 case wxRIBBON_BUTTON_DROPDOWN
:
2621 dropdown_region
->SetWidth(dropdown_region
->GetWidth() + text_size
);
2623 case wxRIBBON_BUTTON_HYBRID
:
2624 dropdown_region
->SetX(dropdown_region
->GetX() + text_size
);
2626 case wxRIBBON_BUTTON_NORMAL
:
2627 normal_region
->SetWidth(normal_region
->GetWidth() + text_size
);
2632 case wxRIBBON_BUTTONBAR_BUTTON_LARGE
:
2633 // Large bitmap, with label below (possibly split over 2 lines)
2635 wxSize
icon_size(bitmap_size_large
);
2636 icon_size
+= wxSize(4, 4);
2637 wxCoord label_height
;
2639 dc
.GetTextExtent(label
, &best_width
, &label_height
);
2640 int best_num_lines
= 1;
2641 int last_line_extra_width
= 0;
2642 if(kind
!= wxRIBBON_BUTTON_NORMAL
)
2644 last_line_extra_width
+= 8;
2645 best_num_lines
= 2; // label on top line, button below
2648 for(i
= 0; i
< label
.Len(); ++i
)
2650 if(wxRibbonCanLabelBreakAtPosition(label
, i
))
2653 dc
.GetTextExtent(label
.Mid(0, i
- 1)).GetWidth(),
2654 dc
.GetTextExtent(label
.Mid(i
+ 1)).GetWidth() + last_line_extra_width
);
2655 if(width
< best_width
)
2662 label_height
*= 2; // Assume two lines even when only one is used
2663 // (to give all buttons a consistent height)
2664 icon_size
.SetWidth(wxMax(icon_size
.GetWidth(), best_width
) + 6);
2665 icon_size
.SetHeight(icon_size
.GetHeight() + label_height
);
2666 *button_size
= icon_size
;
2669 case wxRIBBON_BUTTON_DROPDOWN
:
2670 *dropdown_region
= wxRect(icon_size
);
2672 case wxRIBBON_BUTTON_HYBRID
:
2673 *normal_region
= wxRect(icon_size
);
2674 normal_region
->height
-= 2 + label_height
;
2675 dropdown_region
->x
= 0;
2676 dropdown_region
->y
= normal_region
->height
;
2677 dropdown_region
->width
= icon_size
.GetWidth();
2678 dropdown_region
->height
= icon_size
.GetHeight() - normal_region
->height
;
2680 case wxRIBBON_BUTTON_NORMAL
:
2681 *normal_region
= wxRect(icon_size
);
2690 wxSize
wxRibbonMSWArtProvider::GetMinimisedPanelMinimumSize(
2692 const wxRibbonPanel
* wnd
,
2693 wxSize
* desired_bitmap_size
,
2694 wxDirection
* expanded_panel_direction
)
2696 if(desired_bitmap_size
!= NULL
)
2698 *desired_bitmap_size
= wxSize(16, 16);
2700 if(expanded_panel_direction
!= NULL
)
2702 if(m_flags
& wxRIBBON_BAR_FLOW_VERTICAL
)
2703 *expanded_panel_direction
= wxEAST
;
2705 *expanded_panel_direction
= wxSOUTH
;
2707 wxSize
base_size(42, 42);
2709 dc
.SetFont(m_panel_label_font
);
2710 wxSize
label_size(dc
.GetTextExtent(wnd
->GetLabel()));
2711 label_size
.IncBy(2, 2); // Allow for differences between this DC and a paint DC
2712 label_size
.IncBy(6, 0); // Padding
2713 label_size
.y
*= 2; // Second line for dropdown button
2715 if(m_flags
& wxRIBBON_BAR_FLOW_VERTICAL
)
2717 // Label alongside icon
2718 return wxSize(base_size
.x
+ label_size
.x
,
2719 wxMax(base_size
.y
, label_size
.y
));
2723 // Label beneath icon
2724 return wxSize(wxMax(base_size
.x
, label_size
.x
),
2725 base_size
.y
+ label_size
.y
);
2729 wxSize
wxRibbonMSWArtProvider::GetToolSize(
2731 wxWindow
* WXUNUSED(wnd
),
2733 wxRibbonButtonKind kind
,
2734 bool WXUNUSED(is_first
),
2736 wxRect
* dropdown_region
)
2738 wxSize
size(bitmap_size
);
2742 if(kind
!= wxRIBBON_BUTTON_NORMAL
)
2747 if(kind
== wxRIBBON_BUTTON_DROPDOWN
)
2748 *dropdown_region
= size
;
2750 *dropdown_region
= wxRect(size
.GetWidth() - 8, 0, 8, size
.GetHeight());
2756 *dropdown_region
= wxRect(0, 0, 0, 0);
2761 #endif // wxUSE_RIBBON