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"
20 #include "wx/ribbon/art.h"
21 #include "wx/ribbon/art_internal.h"
22 #include "wx/ribbon/bar.h"
23 #include "wx/ribbon/buttonbar.h"
24 #include "wx/ribbon/gallery.h"
25 #include "wx/ribbon/toolbar.h"
28 #include "wx/dcmemory.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
= *wxNORMAL_FONT
;
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 bool primary_is_gray
= false;
147 static const double gray_saturation_threshold
= 0.01;
148 if(primary_hsl
.saturation
<= gray_saturation_threshold
)
149 primary_is_gray
= true;
152 primary_hsl
.saturation
= cos(primary_hsl
.saturation
* M_PI
)
156 // Map primary luminance from [0, 1] to [.23, .83]
157 primary_hsl
.luminance
= cos(primary_hsl
.luminance
* M_PI
) * -0.3 + 0.53;
159 // Map secondary saturation from [0, 1] to [0.16, 0.84]
160 bool secondary_is_gray
= false;
161 if(secondary_hsl
.saturation
<= gray_saturation_threshold
)
162 secondary_is_gray
= true;
165 secondary_hsl
.saturation
= cos(secondary_hsl
.saturation
* M_PI
)
169 // Map secondary luminance from [0, 1] to [0.1, 0.9]
170 secondary_hsl
.luminance
= cos(secondary_hsl
.luminance
* M_PI
) * -0.4 + 0.5;
172 #define LikePrimary(h, s, l) \
173 primary_hsl.ShiftHue(h ## f).Saturated(primary_is_gray ? 0 : s ## f) \
174 .Lighter(l ## f).ToRGB()
175 #define LikeSecondary(h, s, l) \
176 secondary_hsl.ShiftHue(h ## f).Saturated(secondary_is_gray ? 0 : s ## f) \
177 .Lighter(l ## f).ToRGB()
179 m_page_border_pen
= LikePrimary(1.4, 0.00, -0.08);
181 m_page_background_top_colour
= LikePrimary(-0.1, -0.03, 0.12);
182 m_page_hover_background_top_colour
= LikePrimary(-2.8, 0.27, 0.17);
183 m_page_background_top_gradient_colour
= LikePrimary(0.1, -0.10, 0.08);
184 m_page_hover_background_top_gradient_colour
= LikePrimary(3.2, 0.16, 0.13);
185 m_page_background_colour
= LikePrimary(0.4, -0.09, 0.05);
186 m_page_hover_background_colour
= LikePrimary(0.1, 0.19, 0.10);
187 m_page_background_gradient_colour
= LikePrimary(-3.2, 0.27, 0.10);
188 m_page_hover_background_gradient_colour
= LikePrimary(1.8, 0.01, 0.15);
190 m_tab_active_background_colour
= LikePrimary(-0.1, -0.31, 0.16);
191 m_tab_active_background_gradient_colour
= LikePrimary(-0.1, -0.03, 0.12);
192 m_tab_separator_colour
= LikePrimary(0.9, 0.24, 0.05);
193 m_tab_ctrl_background_brush
= LikePrimary(1.0, 0.39, 0.07);
194 m_tab_hover_background_colour
= LikePrimary(1.3, 0.15, 0.10);
195 m_tab_hover_background_top_colour
= LikePrimary(1.4, 0.36, 0.08);
196 m_tab_border_pen
= LikePrimary(1.4, 0.03, -0.05);
197 m_tab_separator_gradient_colour
= LikePrimary(1.7, -0.15, -0.18);
198 m_tab_hover_background_top_gradient_colour
= LikePrimary(1.8, 0.34, 0.13);
199 m_tab_label_colour
= LikePrimary(4.3, 0.13, -0.49);
200 m_tab_hover_background_gradient_colour
= LikeSecondary(-1.5, -0.34, 0.01);
202 m_panel_minimised_border_gradient_pen
= LikePrimary(-6.9, -0.17, -0.09);
203 m_panel_minimised_border_pen
= LikePrimary(-5.3, -0.24, -0.06);
204 m_panel_border_gradient_pen
= LikePrimary(-5.2, -0.15, -0.06);
205 m_panel_border_pen
= LikePrimary(-2.8, -0.32, 0.02);
206 m_panel_label_background_brush
= LikePrimary(-1.5, 0.03, 0.05);
207 m_panel_active_background_gradient_colour
= LikePrimary(0.5, 0.34, 0.05);
208 m_panel_hover_label_background_brush
= LikePrimary(1.0, 0.30, 0.09);
209 m_panel_active_background_top_gradient_colour
= LikePrimary(1.4, -0.17, -0.13);
210 m_panel_active_background_colour
= LikePrimary(1.6, -0.18, -0.18);
211 m_panel_active_background_top_colour
= LikePrimary(1.7, -0.20, -0.03);
212 m_panel_label_colour
= LikePrimary(2.8, -0.14, -0.35);
213 m_panel_hover_label_colour
= m_panel_label_colour
;
214 m_panel_minimised_label_colour
= m_tab_label_colour
;
216 m_gallery_button_disabled_background_colour
= LikePrimary(-2.8, -0.46, 0.09);
217 m_gallery_button_disabled_background_top_brush
= LikePrimary(-2.8, -0.36, 0.15);
218 m_gallery_hover_background_brush
= LikePrimary(-0.8, 0.05, 0.15);
219 m_gallery_border_pen
= LikePrimary(0.7, -0.02, 0.03);
220 m_gallery_button_background_top_brush
= LikePrimary(0.8, 0.34, 0.13);
221 m_gallery_button_background_colour
= LikePrimary(1.3, 0.10, 0.08);
222 // SetColour used so that the relevant bitmaps are generated
223 SetColour(wxRIBBON_ART_GALLERY_BUTTON_FACE_COLOUR
, LikePrimary(1.4, -0.21, -0.23));
224 SetColour(wxRIBBON_ART_GALLERY_BUTTON_HOVER_FACE_COLOUR
, LikePrimary(1.5, -0.24, -0.29));
225 SetColour(wxRIBBON_ART_GALLERY_BUTTON_ACTIVE_FACE_COLOUR
, LikePrimary(1.5, -0.24, -0.29));
226 SetColour(wxRIBBON_ART_GALLERY_BUTTON_DISABLED_FACE_COLOUR
, LikePrimary(0.0, -1.0, 0.0));
227 m_gallery_button_disabled_background_gradient_colour
= LikePrimary(1.5, -0.43, 0.12);
228 m_gallery_button_background_gradient_colour
= LikePrimary(1.7, 0.11, 0.09);
229 m_gallery_item_border_pen
= LikeSecondary(-3.9, -0.16, -0.14);
230 m_gallery_button_hover_background_colour
= LikeSecondary(-0.9, 0.16, -0.07);
231 m_gallery_button_hover_background_gradient_colour
= LikeSecondary(0.1, 0.12, 0.03);
232 m_gallery_button_hover_background_top_brush
= LikeSecondary(4.3, 0.16, 0.17);
234 m_gallery_button_active_background_colour
= LikeSecondary(-9.9, 0.03, -0.22);
235 m_gallery_button_active_background_gradient_colour
= LikeSecondary(-9.5, 0.14, -0.11);
236 m_gallery_button_active_background_top_brush
= LikeSecondary(-9.0, 0.15, -0.08);
238 m_button_bar_label_colour
= m_tab_label_colour
;
239 m_button_bar_hover_border_pen
= LikeSecondary(-6.2, -0.47, -0.14);
240 m_button_bar_hover_background_gradient_colour
= LikeSecondary(-0.6, 0.16, 0.04);
241 m_button_bar_hover_background_colour
= LikeSecondary(-0.2, 0.16, -0.10);
242 m_button_bar_hover_background_top_gradient_colour
= LikeSecondary(0.2, 0.16, 0.03);
243 m_button_bar_hover_background_top_colour
= LikeSecondary(8.8, 0.16, 0.17);
244 m_button_bar_active_border_pen
= LikeSecondary(-6.2, -0.47, -0.25);
245 m_button_bar_active_background_top_colour
= LikeSecondary(-8.4, 0.08, 0.06);
246 m_button_bar_active_background_top_gradient_colour
= LikeSecondary(-9.7, 0.13, -0.07);
247 m_button_bar_active_background_colour
= LikeSecondary(-9.9, 0.14, -0.14);
248 m_button_bar_active_background_gradient_colour
= LikeSecondary(-8.7, 0.17, -0.03);
250 m_toolbar_border_pen
= LikePrimary(1.4, -0.21, -0.16);
251 SetColour(wxRIBBON_ART_TOOLBAR_FACE_COLOUR
, LikePrimary(1.4, -0.17, -0.22));
252 m_tool_background_top_colour
= LikePrimary(-1.9, -0.07, 0.06);
253 m_tool_background_top_gradient_colour
= LikePrimary(1.4, 0.12, 0.08);
254 m_tool_background_colour
= LikePrimary(1.4, -0.09, 0.03);
255 m_tool_background_gradient_colour
= LikePrimary(1.9, 0.11, 0.09);
256 m_tool_hover_background_top_colour
= LikeSecondary(3.4, 0.11, 0.16);
257 m_tool_hover_background_top_gradient_colour
= LikeSecondary(-1.4, 0.04, 0.08);
258 m_tool_hover_background_colour
= LikeSecondary(-1.8, 0.16, -0.12);
259 m_tool_hover_background_gradient_colour
= LikeSecondary(-2.6, 0.16, 0.05);
260 m_tool_active_background_top_colour
= LikeSecondary(-9.9, -0.12, -0.09);
261 m_tool_active_background_top_gradient_colour
= LikeSecondary(-8.5, 0.16, -0.12);
262 m_tool_active_background_colour
= LikeSecondary(-7.9, 0.16, -0.20);
263 m_tool_active_background_gradient_colour
= LikeSecondary(-6.6, 0.16, -0.10);
268 // Invalidate cached tab separator
269 m_cached_tab_separator_visibility
= -1.0;
272 wxRibbonArtProvider
* wxRibbonMSWArtProvider::Clone() const
274 wxRibbonMSWArtProvider
*copy
= new wxRibbonMSWArtProvider
;
279 void wxRibbonMSWArtProvider::CloneTo(wxRibbonMSWArtProvider
* copy
) const
281 for(int i
= 0; i
< 4; ++i
)
283 copy
->m_gallery_up_bitmap
[i
] = m_gallery_up_bitmap
[i
];
284 copy
->m_gallery_down_bitmap
[i
] = m_gallery_down_bitmap
[i
];
285 copy
->m_gallery_extension_bitmap
[i
] = m_gallery_extension_bitmap
[i
];
287 copy
->m_toolbar_drop_bitmap
= m_toolbar_drop_bitmap
;
289 copy
->m_primary_scheme_colour
= m_primary_scheme_colour
;
290 copy
->m_secondary_scheme_colour
= m_secondary_scheme_colour
;
291 copy
->m_tertiary_scheme_colour
= m_tertiary_scheme_colour
;
293 copy
->m_button_bar_label_colour
= m_button_bar_label_colour
;
294 copy
->m_tab_label_colour
= m_tab_label_colour
;
295 copy
->m_tab_separator_colour
= m_tab_separator_colour
;
296 copy
->m_tab_separator_gradient_colour
= m_tab_separator_gradient_colour
;
297 copy
->m_tab_active_background_colour
= m_tab_hover_background_colour
;
298 copy
->m_tab_active_background_gradient_colour
= m_tab_hover_background_gradient_colour
;
299 copy
->m_tab_hover_background_colour
= m_tab_hover_background_colour
;
300 copy
->m_tab_hover_background_gradient_colour
= m_tab_hover_background_gradient_colour
;
301 copy
->m_tab_hover_background_top_colour
= m_tab_hover_background_top_colour
;
302 copy
->m_tab_hover_background_top_gradient_colour
= m_tab_hover_background_top_gradient_colour
;
303 copy
->m_panel_label_colour
= m_panel_label_colour
;
304 copy
->m_panel_hover_label_colour
= m_panel_hover_label_colour
;
305 copy
->m_panel_minimised_label_colour
= m_panel_minimised_label_colour
;
306 copy
->m_panel_active_background_colour
= m_panel_active_background_colour
;
307 copy
->m_panel_active_background_gradient_colour
= m_panel_active_background_gradient_colour
;
308 copy
->m_panel_active_background_top_colour
= m_panel_active_background_top_colour
;
309 copy
->m_panel_active_background_top_gradient_colour
= m_panel_active_background_top_gradient_colour
;
310 copy
->m_page_background_colour
= m_page_background_colour
;
311 copy
->m_page_background_gradient_colour
= m_page_background_gradient_colour
;
312 copy
->m_page_background_top_colour
= m_page_background_top_colour
;
313 copy
->m_page_background_top_gradient_colour
= m_page_background_top_gradient_colour
;
314 copy
->m_page_hover_background_colour
= m_page_hover_background_colour
;
315 copy
->m_page_hover_background_gradient_colour
= m_page_hover_background_gradient_colour
;
316 copy
->m_page_hover_background_top_colour
= m_page_hover_background_top_colour
;
317 copy
->m_page_hover_background_top_gradient_colour
= m_page_hover_background_top_gradient_colour
;
318 copy
->m_button_bar_hover_background_colour
= m_button_bar_hover_background_colour
;
319 copy
->m_button_bar_hover_background_gradient_colour
= m_button_bar_hover_background_gradient_colour
;
320 copy
->m_button_bar_hover_background_top_colour
= m_button_bar_hover_background_top_colour
;
321 copy
->m_button_bar_hover_background_top_gradient_colour
= m_button_bar_hover_background_top_gradient_colour
;
322 copy
->m_button_bar_active_background_colour
= m_button_bar_active_background_colour
;
323 copy
->m_button_bar_active_background_gradient_colour
= m_button_bar_active_background_gradient_colour
;
324 copy
->m_button_bar_active_background_top_colour
= m_button_bar_active_background_top_colour
;
325 copy
->m_button_bar_active_background_top_gradient_colour
= m_button_bar_active_background_top_gradient_colour
;
326 copy
->m_gallery_button_background_colour
= m_gallery_button_background_colour
;
327 copy
->m_gallery_button_background_gradient_colour
= m_gallery_button_background_gradient_colour
;
328 copy
->m_gallery_button_hover_background_colour
= m_gallery_button_hover_background_colour
;
329 copy
->m_gallery_button_hover_background_gradient_colour
= m_gallery_button_hover_background_gradient_colour
;
330 copy
->m_gallery_button_active_background_colour
= m_gallery_button_active_background_colour
;
331 copy
->m_gallery_button_active_background_gradient_colour
= m_gallery_button_active_background_gradient_colour
;
332 copy
->m_gallery_button_disabled_background_colour
= m_gallery_button_disabled_background_colour
;
333 copy
->m_gallery_button_disabled_background_gradient_colour
= m_gallery_button_disabled_background_gradient_colour
;
334 copy
->m_gallery_button_face_colour
= m_gallery_button_face_colour
;
335 copy
->m_gallery_button_hover_face_colour
= m_gallery_button_hover_face_colour
;
336 copy
->m_gallery_button_active_face_colour
= m_gallery_button_active_face_colour
;
337 copy
->m_gallery_button_disabled_face_colour
= m_gallery_button_disabled_face_colour
;
339 copy
->m_tab_ctrl_background_brush
= m_tab_ctrl_background_brush
;
340 copy
->m_panel_label_background_brush
= m_panel_label_background_brush
;
341 copy
->m_panel_hover_label_background_brush
= m_panel_hover_label_background_brush
;
342 copy
->m_gallery_hover_background_brush
= m_gallery_hover_background_brush
;
343 copy
->m_gallery_button_background_top_brush
= m_gallery_button_background_top_brush
;
344 copy
->m_gallery_button_hover_background_top_brush
= m_gallery_button_hover_background_top_brush
;
345 copy
->m_gallery_button_active_background_top_brush
= m_gallery_button_active_background_top_brush
;
346 copy
->m_gallery_button_disabled_background_top_brush
= m_gallery_button_disabled_background_top_brush
;
348 copy
->m_tab_label_font
= m_tab_label_font
;
349 copy
->m_button_bar_label_font
= m_button_bar_label_font
;
350 copy
->m_panel_label_font
= m_panel_label_font
;
352 copy
->m_page_border_pen
= m_page_border_pen
;
353 copy
->m_panel_border_pen
= m_panel_border_pen
;
354 copy
->m_panel_border_gradient_pen
= m_panel_border_gradient_pen
;
355 copy
->m_panel_minimised_border_pen
= m_panel_minimised_border_pen
;
356 copy
->m_panel_minimised_border_gradient_pen
= m_panel_minimised_border_gradient_pen
;
357 copy
->m_tab_border_pen
= m_tab_border_pen
;
358 copy
->m_gallery_border_pen
= m_gallery_border_pen
;
359 copy
->m_button_bar_hover_border_pen
= m_button_bar_hover_border_pen
;
360 copy
->m_button_bar_active_border_pen
= m_button_bar_active_border_pen
;
361 copy
->m_gallery_item_border_pen
= m_gallery_item_border_pen
;
362 copy
->m_toolbar_border_pen
= m_toolbar_border_pen
;
364 copy
->m_flags
= m_flags
;
365 copy
->m_tab_separation_size
= m_tab_separation_size
;
366 copy
->m_page_border_left
= m_page_border_left
;
367 copy
->m_page_border_top
= m_page_border_top
;
368 copy
->m_page_border_right
= m_page_border_right
;
369 copy
->m_page_border_bottom
= m_page_border_bottom
;
370 copy
->m_panel_x_separation_size
= m_panel_x_separation_size
;
371 copy
->m_panel_y_separation_size
= m_panel_y_separation_size
;
372 copy
->m_gallery_bitmap_padding_left_size
= m_gallery_bitmap_padding_left_size
;
373 copy
->m_gallery_bitmap_padding_right_size
= m_gallery_bitmap_padding_right_size
;
374 copy
->m_gallery_bitmap_padding_top_size
= m_gallery_bitmap_padding_top_size
;
375 copy
->m_gallery_bitmap_padding_bottom_size
= m_gallery_bitmap_padding_bottom_size
;
378 long wxRibbonMSWArtProvider::GetFlags() const
383 void wxRibbonMSWArtProvider::SetFlags(long flags
)
385 if((flags
^ m_flags
) & wxRIBBON_BAR_FLOW_VERTICAL
)
387 if(flags
& wxRIBBON_BAR_FLOW_VERTICAL
)
389 m_page_border_left
++;
390 m_page_border_right
++;
392 m_page_border_bottom
--;
396 m_page_border_left
--;
397 m_page_border_right
--;
399 m_page_border_bottom
++;
404 // Need to reload some bitmaps when flags change
405 #define Reload(setting) SetColour(setting, GetColour(setting))
406 Reload(wxRIBBON_ART_GALLERY_BUTTON_FACE_COLOUR
);
407 Reload(wxRIBBON_ART_GALLERY_BUTTON_HOVER_FACE_COLOUR
);
408 Reload(wxRIBBON_ART_GALLERY_BUTTON_ACTIVE_FACE_COLOUR
);
409 Reload(wxRIBBON_ART_GALLERY_BUTTON_DISABLED_FACE_COLOUR
);
413 int wxRibbonMSWArtProvider::GetMetric(int id
) const
417 case wxRIBBON_ART_TAB_SEPARATION_SIZE
:
418 return m_tab_separation_size
;
419 case wxRIBBON_ART_PAGE_BORDER_LEFT_SIZE
:
420 return m_page_border_left
;
421 case wxRIBBON_ART_PAGE_BORDER_TOP_SIZE
:
422 return m_page_border_top
;
423 case wxRIBBON_ART_PAGE_BORDER_RIGHT_SIZE
:
424 return m_page_border_right
;
425 case wxRIBBON_ART_PAGE_BORDER_BOTTOM_SIZE
:
426 return m_page_border_bottom
;
427 case wxRIBBON_ART_PANEL_X_SEPARATION_SIZE
:
428 return m_panel_x_separation_size
;
429 case wxRIBBON_ART_PANEL_Y_SEPARATION_SIZE
:
430 return m_panel_y_separation_size
;
431 case wxRIBBON_ART_TOOL_GROUP_SEPARATION_SIZE
:
432 return m_tool_group_separation_size
;
433 case wxRIBBON_ART_GALLERY_BITMAP_PADDING_LEFT_SIZE
:
434 return m_gallery_bitmap_padding_left_size
;
435 case wxRIBBON_ART_GALLERY_BITMAP_PADDING_RIGHT_SIZE
:
436 return m_gallery_bitmap_padding_right_size
;
437 case wxRIBBON_ART_GALLERY_BITMAP_PADDING_TOP_SIZE
:
438 return m_gallery_bitmap_padding_top_size
;
439 case wxRIBBON_ART_GALLERY_BITMAP_PADDING_BOTTOM_SIZE
:
440 return m_gallery_bitmap_padding_bottom_size
;
442 wxFAIL_MSG(wxT("Invalid Metric Ordinal"));
449 void wxRibbonMSWArtProvider::SetMetric(int id
, int new_val
)
453 case wxRIBBON_ART_TAB_SEPARATION_SIZE
:
454 m_tab_separation_size
= new_val
;
456 case wxRIBBON_ART_PAGE_BORDER_LEFT_SIZE
:
457 m_page_border_left
= new_val
;
459 case wxRIBBON_ART_PAGE_BORDER_TOP_SIZE
:
460 m_page_border_top
= new_val
;
462 case wxRIBBON_ART_PAGE_BORDER_RIGHT_SIZE
:
463 m_page_border_right
= new_val
;
465 case wxRIBBON_ART_PAGE_BORDER_BOTTOM_SIZE
:
466 m_page_border_bottom
= new_val
;
468 case wxRIBBON_ART_PANEL_X_SEPARATION_SIZE
:
469 m_panel_x_separation_size
= new_val
;
471 case wxRIBBON_ART_PANEL_Y_SEPARATION_SIZE
:
472 m_panel_y_separation_size
= new_val
;
474 case wxRIBBON_ART_TOOL_GROUP_SEPARATION_SIZE
:
475 m_tool_group_separation_size
= new_val
;
477 case wxRIBBON_ART_GALLERY_BITMAP_PADDING_LEFT_SIZE
:
478 m_gallery_bitmap_padding_left_size
= new_val
;
480 case wxRIBBON_ART_GALLERY_BITMAP_PADDING_RIGHT_SIZE
:
481 m_gallery_bitmap_padding_right_size
= new_val
;
483 case wxRIBBON_ART_GALLERY_BITMAP_PADDING_TOP_SIZE
:
484 m_gallery_bitmap_padding_top_size
= new_val
;
486 case wxRIBBON_ART_GALLERY_BITMAP_PADDING_BOTTOM_SIZE
:
487 m_gallery_bitmap_padding_bottom_size
= new_val
;
490 wxFAIL_MSG(wxT("Invalid Metric Ordinal"));
495 void wxRibbonMSWArtProvider::SetFont(int id
, const wxFont
& font
)
499 case wxRIBBON_ART_TAB_LABEL_FONT
:
500 m_tab_label_font
= font
;
502 case wxRIBBON_ART_BUTTON_BAR_LABEL_FONT
:
503 m_button_bar_label_font
= font
;
505 case wxRIBBON_ART_PANEL_LABEL_FONT
:
506 m_panel_label_font
= font
;
509 wxFAIL_MSG(wxT("Invalid Metric Ordinal"));
514 wxFont
wxRibbonMSWArtProvider::GetFont(int id
) const
518 case wxRIBBON_ART_TAB_LABEL_FONT
:
519 return m_tab_label_font
;
520 case wxRIBBON_ART_BUTTON_BAR_LABEL_FONT
:
521 return m_button_bar_label_font
;
522 case wxRIBBON_ART_PANEL_LABEL_FONT
:
523 return m_panel_label_font
;
525 wxFAIL_MSG(wxT("Invalid Metric Ordinal"));
532 wxColour
wxRibbonMSWArtProvider::GetColour(int id
) const
536 case wxRIBBON_ART_BUTTON_BAR_LABEL_COLOUR
:
537 return m_button_bar_label_colour
;
538 case wxRIBBON_ART_BUTTON_BAR_HOVER_BORDER_COLOUR
:
539 return m_button_bar_hover_border_pen
.GetColour();
540 case wxRIBBON_ART_BUTTON_BAR_HOVER_BACKGROUND_TOP_COLOUR
:
541 return m_button_bar_hover_background_top_colour
;
542 case wxRIBBON_ART_BUTTON_BAR_HOVER_BACKGROUND_TOP_GRADIENT_COLOUR
:
543 return m_button_bar_hover_background_top_gradient_colour
;
544 case wxRIBBON_ART_BUTTON_BAR_HOVER_BACKGROUND_COLOUR
:
545 return m_button_bar_hover_background_colour
;
546 case wxRIBBON_ART_BUTTON_BAR_HOVER_BACKGROUND_GRADIENT_COLOUR
:
547 return m_button_bar_hover_background_gradient_colour
;
548 case wxRIBBON_ART_BUTTON_BAR_ACTIVE_BORDER_COLOUR
:
549 return m_button_bar_active_border_pen
.GetColour();
550 case wxRIBBON_ART_BUTTON_BAR_ACTIVE_BACKGROUND_TOP_COLOUR
:
551 return m_button_bar_active_background_top_colour
;
552 case wxRIBBON_ART_BUTTON_BAR_ACTIVE_BACKGROUND_TOP_GRADIENT_COLOUR
:
553 return m_button_bar_active_background_top_gradient_colour
;
554 case wxRIBBON_ART_BUTTON_BAR_ACTIVE_BACKGROUND_COLOUR
:
555 return m_button_bar_active_background_colour
;
556 case wxRIBBON_ART_BUTTON_BAR_ACTIVE_BACKGROUND_GRADIENT_COLOUR
:
557 return m_button_bar_active_background_gradient_colour
;
558 case wxRIBBON_ART_GALLERY_BORDER_COLOUR
:
559 return m_gallery_border_pen
.GetColour();
560 case wxRIBBON_ART_GALLERY_HOVER_BACKGROUND_COLOUR
:
561 return m_gallery_hover_background_brush
.GetColour();
562 case wxRIBBON_ART_GALLERY_BUTTON_BACKGROUND_COLOUR
:
563 return m_gallery_button_background_colour
;
564 case wxRIBBON_ART_GALLERY_BUTTON_BACKGROUND_GRADIENT_COLOUR
:
565 return m_gallery_button_background_gradient_colour
;
566 case wxRIBBON_ART_GALLERY_BUTTON_BACKGROUND_TOP_COLOUR
:
567 return m_gallery_button_background_top_brush
.GetColour();
568 case wxRIBBON_ART_GALLERY_BUTTON_FACE_COLOUR
:
569 return m_gallery_button_face_colour
;
570 case wxRIBBON_ART_GALLERY_BUTTON_HOVER_BACKGROUND_COLOUR
:
571 return m_gallery_button_hover_background_colour
;
572 case wxRIBBON_ART_GALLERY_BUTTON_HOVER_BACKGROUND_GRADIENT_COLOUR
:
573 return m_gallery_button_hover_background_gradient_colour
;
574 case wxRIBBON_ART_GALLERY_BUTTON_HOVER_BACKGROUND_TOP_COLOUR
:
575 return m_gallery_button_hover_background_top_brush
.GetColour();
576 case wxRIBBON_ART_GALLERY_BUTTON_HOVER_FACE_COLOUR
:
577 return m_gallery_button_face_colour
;
578 case wxRIBBON_ART_GALLERY_BUTTON_ACTIVE_BACKGROUND_COLOUR
:
579 return m_gallery_button_active_background_colour
;
580 case wxRIBBON_ART_GALLERY_BUTTON_ACTIVE_BACKGROUND_GRADIENT_COLOUR
:
581 return m_gallery_button_active_background_gradient_colour
;
582 case wxRIBBON_ART_GALLERY_BUTTON_ACTIVE_BACKGROUND_TOP_COLOUR
:
583 return m_gallery_button_background_top_brush
.GetColour();
584 case wxRIBBON_ART_GALLERY_BUTTON_ACTIVE_FACE_COLOUR
:
585 return m_gallery_button_active_face_colour
;
586 case wxRIBBON_ART_GALLERY_BUTTON_DISABLED_BACKGROUND_COLOUR
:
587 return m_gallery_button_disabled_background_colour
;
588 case wxRIBBON_ART_GALLERY_BUTTON_DISABLED_BACKGROUND_GRADIENT_COLOUR
:
589 return m_gallery_button_disabled_background_gradient_colour
;
590 case wxRIBBON_ART_GALLERY_BUTTON_DISABLED_BACKGROUND_TOP_COLOUR
:
591 return m_gallery_button_disabled_background_top_brush
.GetColour();
592 case wxRIBBON_ART_GALLERY_BUTTON_DISABLED_FACE_COLOUR
:
593 return m_gallery_button_disabled_face_colour
;
594 case wxRIBBON_ART_GALLERY_ITEM_BORDER_COLOUR
:
595 return m_gallery_item_border_pen
.GetColour();
596 case wxRIBBON_ART_TAB_CTRL_BACKGROUND_COLOUR
:
597 case wxRIBBON_ART_TAB_CTRL_BACKGROUND_GRADIENT_COLOUR
:
598 return m_tab_ctrl_background_brush
.GetColour();
599 case wxRIBBON_ART_TAB_LABEL_COLOUR
:
600 return m_tab_label_colour
;
601 case wxRIBBON_ART_TAB_SEPARATOR_COLOUR
:
602 return m_tab_separator_colour
;
603 case wxRIBBON_ART_TAB_SEPARATOR_GRADIENT_COLOUR
:
604 return m_tab_separator_gradient_colour
;
605 case wxRIBBON_ART_TAB_ACTIVE_BACKGROUND_TOP_COLOUR
:
606 case wxRIBBON_ART_TAB_ACTIVE_BACKGROUND_TOP_GRADIENT_COLOUR
:
607 return wxColour(0, 0, 0);
608 case wxRIBBON_ART_TAB_ACTIVE_BACKGROUND_COLOUR
:
609 return m_tab_active_background_colour
;
610 case wxRIBBON_ART_TAB_ACTIVE_BACKGROUND_GRADIENT_COLOUR
:
611 return m_tab_active_background_gradient_colour
;
612 case wxRIBBON_ART_TAB_HOVER_BACKGROUND_TOP_COLOUR
:
613 return m_tab_hover_background_top_colour
;
614 case wxRIBBON_ART_TAB_HOVER_BACKGROUND_TOP_GRADIENT_COLOUR
:
615 return m_tab_hover_background_top_gradient_colour
;
616 case wxRIBBON_ART_TAB_HOVER_BACKGROUND_COLOUR
:
617 return m_tab_hover_background_colour
;
618 case wxRIBBON_ART_TAB_HOVER_BACKGROUND_GRADIENT_COLOUR
:
619 return m_tab_hover_background_gradient_colour
;
620 case wxRIBBON_ART_TAB_BORDER_COLOUR
:
621 return m_tab_border_pen
.GetColour();
622 case wxRIBBON_ART_PANEL_BORDER_COLOUR
:
623 return m_panel_border_pen
.GetColour();
624 case wxRIBBON_ART_PANEL_BORDER_GRADIENT_COLOUR
:
625 return m_panel_border_gradient_pen
.GetColour();
626 case wxRIBBON_ART_PANEL_MINIMISED_BORDER_COLOUR
:
627 return m_panel_minimised_border_pen
.GetColour();
628 case wxRIBBON_ART_PANEL_MINIMISED_BORDER_GRADIENT_COLOUR
:
629 return m_panel_minimised_border_gradient_pen
.GetColour();
630 case wxRIBBON_ART_PANEL_LABEL_BACKGROUND_COLOUR
:
631 case wxRIBBON_ART_PANEL_LABEL_BACKGROUND_GRADIENT_COLOUR
:
632 return m_panel_label_background_brush
.GetColour();
633 case wxRIBBON_ART_PANEL_LABEL_COLOUR
:
634 return m_panel_label_colour
;
635 case wxRIBBON_ART_PANEL_MINIMISED_LABEL_COLOUR
:
636 return m_panel_minimised_label_colour
;
637 case wxRIBBON_ART_PANEL_HOVER_LABEL_BACKGROUND_COLOUR
:
638 case wxRIBBON_ART_PANEL_HOVER_LABEL_BACKGROUND_GRADIENT_COLOUR
:
639 return m_panel_hover_label_background_brush
.GetColour();
640 case wxRIBBON_ART_PANEL_HOVER_LABEL_COLOUR
:
641 return m_panel_hover_label_colour
;
642 case wxRIBBON_ART_PANEL_ACTIVE_BACKGROUND_TOP_COLOUR
:
643 return m_panel_active_background_top_colour
;
644 case wxRIBBON_ART_PANEL_ACTIVE_BACKGROUND_TOP_GRADIENT_COLOUR
:
645 return m_panel_active_background_top_gradient_colour
;
646 case wxRIBBON_ART_PANEL_ACTIVE_BACKGROUND_COLOUR
:
647 return m_panel_active_background_colour
;
648 case wxRIBBON_ART_PANEL_ACTIVE_BACKGROUND_GRADIENT_COLOUR
:
649 return m_panel_active_background_gradient_colour
;
650 case wxRIBBON_ART_PAGE_BORDER_COLOUR
:
651 return m_page_border_pen
.GetColour();
652 case wxRIBBON_ART_PAGE_BACKGROUND_TOP_COLOUR
:
653 return m_page_background_top_colour
;
654 case wxRIBBON_ART_PAGE_BACKGROUND_TOP_GRADIENT_COLOUR
:
655 return m_page_background_top_gradient_colour
;
656 case wxRIBBON_ART_PAGE_BACKGROUND_COLOUR
:
657 return m_page_background_colour
;
658 case wxRIBBON_ART_PAGE_BACKGROUND_GRADIENT_COLOUR
:
659 return m_page_background_gradient_colour
;
660 case wxRIBBON_ART_PAGE_HOVER_BACKGROUND_TOP_COLOUR
:
661 return m_page_hover_background_top_colour
;
662 case wxRIBBON_ART_PAGE_HOVER_BACKGROUND_TOP_GRADIENT_COLOUR
:
663 return m_page_hover_background_top_gradient_colour
;
664 case wxRIBBON_ART_PAGE_HOVER_BACKGROUND_COLOUR
:
665 return m_page_hover_background_colour
;
666 case wxRIBBON_ART_PAGE_HOVER_BACKGROUND_GRADIENT_COLOUR
:
667 return m_page_hover_background_gradient_colour
;
668 case wxRIBBON_ART_TOOLBAR_BORDER_COLOUR
:
669 case wxRIBBON_ART_TOOLBAR_HOVER_BORDER_COLOUR
:
670 return m_toolbar_border_pen
.GetColour();
671 case wxRIBBON_ART_TOOLBAR_FACE_COLOUR
:
672 return m_tool_face_colour
;
674 wxFAIL_MSG(wxT("Invalid Metric Ordinal"));
681 void wxRibbonMSWArtProvider::SetColour(int id
, const wxColor
& colour
)
685 case wxRIBBON_ART_BUTTON_BAR_LABEL_COLOUR
:
686 m_button_bar_label_colour
= colour
;
688 case wxRIBBON_ART_BUTTON_BAR_HOVER_BORDER_COLOUR
:
689 m_button_bar_hover_border_pen
.SetColour(colour
);
691 case wxRIBBON_ART_BUTTON_BAR_HOVER_BACKGROUND_TOP_COLOUR
:
692 m_button_bar_hover_background_top_colour
= colour
;
694 case wxRIBBON_ART_BUTTON_BAR_HOVER_BACKGROUND_TOP_GRADIENT_COLOUR
:
695 m_button_bar_hover_background_top_gradient_colour
= colour
;
697 case wxRIBBON_ART_BUTTON_BAR_HOVER_BACKGROUND_COLOUR
:
698 m_button_bar_hover_background_colour
= colour
;
700 case wxRIBBON_ART_BUTTON_BAR_HOVER_BACKGROUND_GRADIENT_COLOUR
:
701 m_button_bar_hover_background_gradient_colour
= colour
;
703 case wxRIBBON_ART_BUTTON_BAR_ACTIVE_BORDER_COLOUR
:
704 m_button_bar_active_border_pen
.SetColour(colour
);
706 case wxRIBBON_ART_BUTTON_BAR_ACTIVE_BACKGROUND_TOP_COLOUR
:
707 m_button_bar_active_background_top_colour
= colour
;
709 case wxRIBBON_ART_BUTTON_BAR_ACTIVE_BACKGROUND_TOP_GRADIENT_COLOUR
:
710 m_button_bar_active_background_top_gradient_colour
= colour
;
712 case wxRIBBON_ART_BUTTON_BAR_ACTIVE_BACKGROUND_COLOUR
:
713 m_button_bar_active_background_colour
= colour
;
715 case wxRIBBON_ART_BUTTON_BAR_ACTIVE_BACKGROUND_GRADIENT_COLOUR
:
716 m_button_bar_active_background_gradient_colour
= colour
;
718 case wxRIBBON_ART_GALLERY_BORDER_COLOUR
:
719 m_gallery_border_pen
.SetColour(colour
);
721 case wxRIBBON_ART_GALLERY_HOVER_BACKGROUND_COLOUR
:
722 m_gallery_hover_background_brush
.SetColour(colour
);
724 case wxRIBBON_ART_GALLERY_BUTTON_BACKGROUND_COLOUR
:
725 m_gallery_button_background_colour
= colour
;
727 case wxRIBBON_ART_GALLERY_BUTTON_BACKGROUND_GRADIENT_COLOUR
:
728 m_gallery_button_background_gradient_colour
= colour
;
730 case wxRIBBON_ART_GALLERY_BUTTON_BACKGROUND_TOP_COLOUR
:
731 m_gallery_button_background_top_brush
.SetColour(colour
);
733 case wxRIBBON_ART_GALLERY_BUTTON_FACE_COLOUR
:
734 m_gallery_button_face_colour
= colour
;
735 if(m_flags
& wxRIBBON_BAR_FLOW_VERTICAL
)
737 m_gallery_up_bitmap
[0] = wxRibbonLoadPixmap(gallery_left_xpm
, colour
);
738 m_gallery_down_bitmap
[0] = wxRibbonLoadPixmap(gallery_right_xpm
, colour
);
742 m_gallery_up_bitmap
[0] = wxRibbonLoadPixmap(gallery_up_xpm
, colour
);
743 m_gallery_down_bitmap
[0] = wxRibbonLoadPixmap(gallery_down_xpm
, colour
);
745 m_gallery_extension_bitmap
[0] = wxRibbonLoadPixmap(gallery_extension_xpm
, colour
);
747 case wxRIBBON_ART_GALLERY_BUTTON_HOVER_BACKGROUND_COLOUR
:
748 m_gallery_button_hover_background_colour
= colour
;
750 case wxRIBBON_ART_GALLERY_BUTTON_HOVER_BACKGROUND_GRADIENT_COLOUR
:
751 m_gallery_button_hover_background_gradient_colour
= colour
;
753 case wxRIBBON_ART_GALLERY_BUTTON_HOVER_BACKGROUND_TOP_COLOUR
:
754 m_gallery_button_hover_background_top_brush
.SetColour(colour
);
756 case wxRIBBON_ART_GALLERY_BUTTON_HOVER_FACE_COLOUR
:
757 m_gallery_button_hover_face_colour
= colour
;
758 if(m_flags
& wxRIBBON_BAR_FLOW_VERTICAL
)
760 m_gallery_up_bitmap
[1] = wxRibbonLoadPixmap(gallery_left_xpm
, colour
);
761 m_gallery_down_bitmap
[1] = wxRibbonLoadPixmap(gallery_right_xpm
, colour
);
765 m_gallery_up_bitmap
[1] = wxRibbonLoadPixmap(gallery_up_xpm
, colour
);
766 m_gallery_down_bitmap
[1] = wxRibbonLoadPixmap(gallery_down_xpm
, colour
);
768 m_gallery_extension_bitmap
[1] = wxRibbonLoadPixmap(gallery_extension_xpm
, colour
);
770 case wxRIBBON_ART_GALLERY_BUTTON_ACTIVE_BACKGROUND_COLOUR
:
771 m_gallery_button_active_background_colour
= colour
;
773 case wxRIBBON_ART_GALLERY_BUTTON_ACTIVE_BACKGROUND_GRADIENT_COLOUR
:
774 m_gallery_button_active_background_gradient_colour
= colour
;
776 case wxRIBBON_ART_GALLERY_BUTTON_ACTIVE_BACKGROUND_TOP_COLOUR
:
777 m_gallery_button_background_top_brush
.SetColour(colour
);
779 case wxRIBBON_ART_GALLERY_BUTTON_ACTIVE_FACE_COLOUR
:
780 m_gallery_button_active_face_colour
= colour
;
781 if(m_flags
& wxRIBBON_BAR_FLOW_VERTICAL
)
783 m_gallery_up_bitmap
[2] = wxRibbonLoadPixmap(gallery_left_xpm
, colour
);
784 m_gallery_down_bitmap
[2] = wxRibbonLoadPixmap(gallery_right_xpm
, colour
);
788 m_gallery_up_bitmap
[2] = wxRibbonLoadPixmap(gallery_up_xpm
, colour
);
789 m_gallery_down_bitmap
[2] = wxRibbonLoadPixmap(gallery_down_xpm
, colour
);
791 m_gallery_extension_bitmap
[2] = wxRibbonLoadPixmap(gallery_extension_xpm
, colour
);
793 case wxRIBBON_ART_GALLERY_BUTTON_DISABLED_BACKGROUND_COLOUR
:
794 m_gallery_button_disabled_background_colour
= colour
;
796 case wxRIBBON_ART_GALLERY_BUTTON_DISABLED_BACKGROUND_GRADIENT_COLOUR
:
797 m_gallery_button_disabled_background_gradient_colour
= colour
;
799 case wxRIBBON_ART_GALLERY_BUTTON_DISABLED_BACKGROUND_TOP_COLOUR
:
800 m_gallery_button_disabled_background_top_brush
.SetColour(colour
);
802 case wxRIBBON_ART_GALLERY_BUTTON_DISABLED_FACE_COLOUR
:
803 m_gallery_button_disabled_face_colour
= colour
;
804 if(m_flags
& wxRIBBON_BAR_FLOW_VERTICAL
)
806 m_gallery_up_bitmap
[3] = wxRibbonLoadPixmap(gallery_left_xpm
, colour
);
807 m_gallery_down_bitmap
[3] = wxRibbonLoadPixmap(gallery_right_xpm
, colour
);
811 m_gallery_up_bitmap
[3] = wxRibbonLoadPixmap(gallery_up_xpm
, colour
);
812 m_gallery_down_bitmap
[3] = wxRibbonLoadPixmap(gallery_down_xpm
, colour
);
814 m_gallery_extension_bitmap
[3] = wxRibbonLoadPixmap(gallery_extension_xpm
, colour
);
816 case wxRIBBON_ART_GALLERY_ITEM_BORDER_COLOUR
:
817 m_gallery_item_border_pen
.SetColour(colour
);
819 case wxRIBBON_ART_TAB_CTRL_BACKGROUND_COLOUR
:
820 case wxRIBBON_ART_TAB_CTRL_BACKGROUND_GRADIENT_COLOUR
:
821 m_tab_ctrl_background_brush
.SetColour(colour
);
822 m_cached_tab_separator_visibility
= -1.0;
824 case wxRIBBON_ART_TAB_LABEL_COLOUR
:
825 m_tab_label_colour
= colour
;
827 case wxRIBBON_ART_TAB_SEPARATOR_COLOUR
:
828 m_tab_separator_colour
= colour
;
829 m_cached_tab_separator_visibility
= -1.0;
831 case wxRIBBON_ART_TAB_SEPARATOR_GRADIENT_COLOUR
:
832 m_tab_separator_gradient_colour
= colour
;
833 m_cached_tab_separator_visibility
= -1.0;
835 case wxRIBBON_ART_TAB_ACTIVE_BACKGROUND_TOP_COLOUR
:
836 case wxRIBBON_ART_TAB_ACTIVE_BACKGROUND_TOP_GRADIENT_COLOUR
:
838 case wxRIBBON_ART_TAB_ACTIVE_BACKGROUND_COLOUR
:
839 m_tab_active_background_colour
= colour
;
841 case wxRIBBON_ART_TAB_ACTIVE_BACKGROUND_GRADIENT_COLOUR
:
842 m_tab_active_background_gradient_colour
= colour
;
844 case wxRIBBON_ART_TAB_HOVER_BACKGROUND_TOP_COLOUR
:
845 m_tab_hover_background_top_colour
= colour
;
847 case wxRIBBON_ART_TAB_HOVER_BACKGROUND_TOP_GRADIENT_COLOUR
:
848 m_tab_hover_background_top_gradient_colour
= colour
;
850 case wxRIBBON_ART_TAB_HOVER_BACKGROUND_COLOUR
:
851 m_tab_hover_background_colour
= colour
;
853 case wxRIBBON_ART_TAB_HOVER_BACKGROUND_GRADIENT_COLOUR
:
854 m_tab_hover_background_gradient_colour
= colour
;
856 case wxRIBBON_ART_TAB_BORDER_COLOUR
:
857 m_tab_border_pen
.SetColour(colour
);
859 case wxRIBBON_ART_PANEL_BORDER_COLOUR
:
860 m_panel_border_pen
.SetColour(colour
);
862 case wxRIBBON_ART_PANEL_BORDER_GRADIENT_COLOUR
:
863 m_panel_border_gradient_pen
.SetColour(colour
);
865 case wxRIBBON_ART_PANEL_MINIMISED_BORDER_COLOUR
:
866 m_panel_minimised_border_pen
.SetColour(colour
);
868 case wxRIBBON_ART_PANEL_MINIMISED_BORDER_GRADIENT_COLOUR
:
869 m_panel_minimised_border_gradient_pen
.SetColour(colour
);
871 case wxRIBBON_ART_PANEL_LABEL_BACKGROUND_COLOUR
:
872 case wxRIBBON_ART_PANEL_LABEL_BACKGROUND_GRADIENT_COLOUR
:
873 m_panel_label_background_brush
.SetColour(colour
);
875 case wxRIBBON_ART_PANEL_LABEL_COLOUR
:
876 m_panel_label_colour
= colour
;
878 case wxRIBBON_ART_PANEL_HOVER_LABEL_BACKGROUND_COLOUR
:
879 case wxRIBBON_ART_PANEL_HOVER_LABEL_BACKGROUND_GRADIENT_COLOUR
:
880 m_panel_hover_label_background_brush
.SetColour(colour
);
882 case wxRIBBON_ART_PANEL_HOVER_LABEL_COLOUR
:
883 m_panel_hover_label_colour
= colour
;
885 case wxRIBBON_ART_PANEL_MINIMISED_LABEL_COLOUR
:
886 m_panel_minimised_label_colour
= colour
;
888 case wxRIBBON_ART_PANEL_ACTIVE_BACKGROUND_TOP_COLOUR
:
889 m_panel_active_background_top_colour
= colour
;
891 case wxRIBBON_ART_PANEL_ACTIVE_BACKGROUND_TOP_GRADIENT_COLOUR
:
892 m_panel_active_background_top_gradient_colour
= colour
;
894 case wxRIBBON_ART_PANEL_ACTIVE_BACKGROUND_COLOUR
:
895 m_panel_active_background_colour
= colour
;
897 case wxRIBBON_ART_PANEL_ACTIVE_BACKGROUND_GRADIENT_COLOUR
:
898 m_panel_active_background_gradient_colour
= colour
;
900 case wxRIBBON_ART_PAGE_BORDER_COLOUR
:
901 m_page_border_pen
.SetColour(colour
);
903 case wxRIBBON_ART_PAGE_BACKGROUND_TOP_COLOUR
:
904 m_page_background_top_colour
= colour
;
906 case wxRIBBON_ART_PAGE_BACKGROUND_TOP_GRADIENT_COLOUR
:
907 m_page_background_top_gradient_colour
= colour
;
909 case wxRIBBON_ART_PAGE_BACKGROUND_COLOUR
:
910 m_page_background_colour
= colour
;
912 case wxRIBBON_ART_PAGE_BACKGROUND_GRADIENT_COLOUR
:
913 m_page_background_gradient_colour
= colour
;
915 case wxRIBBON_ART_PAGE_HOVER_BACKGROUND_TOP_COLOUR
:
916 m_page_hover_background_top_colour
= colour
;
918 case wxRIBBON_ART_PAGE_HOVER_BACKGROUND_TOP_GRADIENT_COLOUR
:
919 m_page_hover_background_top_gradient_colour
= colour
;
921 case wxRIBBON_ART_PAGE_HOVER_BACKGROUND_COLOUR
:
922 m_page_hover_background_colour
= colour
;
924 case wxRIBBON_ART_PAGE_HOVER_BACKGROUND_GRADIENT_COLOUR
:
925 m_page_hover_background_gradient_colour
= colour
;
927 case wxRIBBON_ART_TOOLBAR_BORDER_COLOUR
:
928 case wxRIBBON_ART_TOOLBAR_HOVER_BORDER_COLOUR
:
929 m_toolbar_border_pen
.SetColour(colour
);
931 case wxRIBBON_ART_TOOLBAR_FACE_COLOUR
:
932 m_tool_face_colour
= colour
;
933 m_toolbar_drop_bitmap
= wxRibbonLoadPixmap(gallery_down_xpm
, colour
);
936 wxFAIL_MSG(wxT("Invalid Metric Ordinal"));
941 void wxRibbonMSWArtProvider::DrawTabCtrlBackground(
943 wxWindow
* WXUNUSED(wnd
),
946 dc
.SetPen(*wxTRANSPARENT_PEN
);
947 dc
.SetBrush(m_tab_ctrl_background_brush
);
948 dc
.DrawRectangle(rect
.x
, rect
.y
, rect
.width
, rect
.height
);
950 dc
.SetPen(m_page_border_pen
);
953 dc
.DrawLine(rect
.x
+ 3, rect
.y
+ rect
.height
- 1, rect
.x
+ rect
.width
- 3, rect
.y
+ rect
.height
- 1);
957 dc
.DrawLine(rect
.x
, rect
.y
+ rect
.height
- 1, rect
.x
+ rect
.width
, rect
.y
+ rect
.height
- 1);
961 void wxRibbonMSWArtProvider::DrawTab(
963 wxWindow
* WXUNUSED(wnd
),
964 const wxRibbonPageTabInfo
& tab
)
966 if(tab
.rect
.height
<= 2)
969 if(tab
.active
|| tab
.hovered
)
973 wxRect
background(tab
.rect
);
977 background
.width
-= 4;
978 background
.height
-= 2;
980 dc
.GradientFillLinear(background
, m_tab_active_background_colour
,
981 m_tab_active_background_gradient_colour
, wxSOUTH
);
983 // TODO: active and hovered
987 wxRect
background(tab
.rect
);
991 background
.width
-= 4;
992 background
.height
-= 3;
993 int h
= background
.height
;
994 background
.height
/= 2;
995 dc
.GradientFillLinear(background
,
996 m_tab_hover_background_top_colour
,
997 m_tab_hover_background_top_gradient_colour
, wxSOUTH
);
999 background
.y
+= background
.height
;
1000 background
.height
= h
- background
.height
;
1001 dc
.GradientFillLinear(background
, m_tab_hover_background_colour
,
1002 m_tab_hover_background_gradient_colour
, wxSOUTH
);
1005 wxPoint border_points
[6];
1006 border_points
[0] = wxPoint(1, tab
.rect
.height
- 2);
1007 border_points
[1] = wxPoint(1, 3);
1008 border_points
[2] = wxPoint(3, 1);
1009 border_points
[3] = wxPoint(tab
.rect
.width
- 4, 1);
1010 border_points
[4] = wxPoint(tab
.rect
.width
- 2, 3);
1011 border_points
[5] = wxPoint(tab
.rect
.width
- 2, tab
.rect
.height
- 1);
1013 dc
.SetPen(m_tab_border_pen
);
1014 dc
.DrawLines(sizeof(border_points
)/sizeof(wxPoint
), border_points
, tab
.rect
.x
, tab
.rect
.y
);
1018 // Give the tab a curved outward border at the bottom
1019 dc
.DrawPoint(tab
.rect
.x
, tab
.rect
.y
+ tab
.rect
.height
- 2);
1020 dc
.DrawPoint(tab
.rect
.x
+ tab
.rect
.width
- 1, tab
.rect
.y
+ tab
.rect
.height
- 2);
1022 wxPen
p(m_tab_active_background_gradient_colour
);
1025 // Technically the first two points are the wrong colour, but they're near enough
1026 dc
.DrawPoint(tab
.rect
.x
+ 1, tab
.rect
.y
+ tab
.rect
.height
- 2);
1027 dc
.DrawPoint(tab
.rect
.x
+ tab
.rect
.width
- 2, tab
.rect
.y
+ tab
.rect
.height
- 2);
1028 dc
.DrawPoint(tab
.rect
.x
+ 1, tab
.rect
.y
+ tab
.rect
.height
- 1);
1029 dc
.DrawPoint(tab
.rect
.x
, tab
.rect
.y
+ tab
.rect
.height
- 1);
1030 dc
.DrawPoint(tab
.rect
.x
+ tab
.rect
.width
- 2, tab
.rect
.y
+ tab
.rect
.height
- 1);
1031 dc
.DrawPoint(tab
.rect
.x
+ tab
.rect
.width
- 1, tab
.rect
.y
+ tab
.rect
.height
- 1);
1035 if(m_flags
& wxRIBBON_BAR_SHOW_PAGE_ICONS
)
1037 wxBitmap icon
= tab
.page
->GetIcon();
1040 int x
= tab
.rect
.x
+ 4;
1041 if((m_flags
& wxRIBBON_BAR_SHOW_PAGE_LABELS
) == 0)
1042 x
= tab
.rect
.x
+ (tab
.rect
.width
- icon
.GetWidth()) / 2;
1043 dc
.DrawBitmap(icon
, x
, tab
.rect
.y
+ 1 + (tab
.rect
.height
- 1 -
1044 icon
.GetHeight()) / 2, true);
1047 if(m_flags
& wxRIBBON_BAR_SHOW_PAGE_LABELS
)
1049 wxString label
= tab
.page
->GetLabel();
1050 if(!label
.IsEmpty())
1052 dc
.SetFont(m_tab_label_font
);
1053 dc
.SetTextForeground(m_tab_label_colour
);
1054 dc
.SetBackgroundMode(wxTRANSPARENT
);
1058 dc
.GetTextExtent(label
, &text_width
, &text_height
);
1059 int width
= tab
.rect
.width
- 5;
1060 int x
= tab
.rect
.x
+ 3;
1061 if(m_flags
& wxRIBBON_BAR_SHOW_PAGE_ICONS
)
1063 x
+= 3 + tab
.page
->GetIcon().GetWidth();
1064 width
-= 3 + tab
.page
->GetIcon().GetWidth();
1066 int y
= tab
.rect
.y
+ (tab
.rect
.height
- text_height
) / 2;
1068 if(width
<= text_width
)
1070 dc
.SetClippingRegion(x
, tab
.rect
.y
, width
, tab
.rect
.height
);
1071 dc
.DrawText(label
, x
, y
);
1075 dc
.DrawText(label
, x
+ (width
- text_width
) / 2 + 1, y
);
1081 void wxRibbonMSWArtProvider::DrawTabSeparator(
1087 if(visibility
<= 0.0)
1091 if(visibility
> 1.0)
1096 // The tab separator is relatively expensive to draw (for its size), and is
1097 // usually drawn multiple times sequentially (in different positions), so it
1098 // makes sense to draw it once and cache it.
1099 if(!m_cached_tab_separator
.IsOk() || m_cached_tab_separator
.GetSize() != rect
.GetSize() || visibility
!= m_cached_tab_separator_visibility
)
1101 wxRect
size(rect
.GetSize());
1102 ReallyDrawTabSeparator(wnd
, size
, visibility
);
1104 dc
.DrawBitmap(m_cached_tab_separator
, rect
.x
, rect
.y
, false);
1107 void wxRibbonMSWArtProvider::ReallyDrawTabSeparator(wxWindow
* wnd
, const wxRect
& rect
, double visibility
)
1109 if(!m_cached_tab_separator
.IsOk() || m_cached_tab_separator
.GetSize() != rect
.GetSize())
1111 m_cached_tab_separator
= wxBitmap(rect
.GetSize());
1114 wxMemoryDC
dc(m_cached_tab_separator
);
1115 DrawTabCtrlBackground(dc
, wnd
, rect
);
1117 wxCoord x
= rect
.x
+ rect
.width
/ 2;
1118 double h
= (double)(rect
.height
- 1);
1120 double r1
= m_tab_ctrl_background_brush
.GetColour().Red() * (1.0 - visibility
) + 0.5;
1121 double g1
= m_tab_ctrl_background_brush
.GetColour().Green() * (1.0 - visibility
) + 0.5;
1122 double b1
= m_tab_ctrl_background_brush
.GetColour().Blue() * (1.0 - visibility
) + 0.5;
1123 double r2
= m_tab_separator_colour
.Red();
1124 double g2
= m_tab_separator_colour
.Green();
1125 double b2
= m_tab_separator_colour
.Blue();
1126 double r3
= m_tab_separator_gradient_colour
.Red();
1127 double g3
= m_tab_separator_gradient_colour
.Green();
1128 double b3
= m_tab_separator_gradient_colour
.Blue();
1130 for(int i
= 0; i
< rect
.height
- 1; ++i
)
1132 double p
= ((double)i
)/h
;
1134 double r
= (p
* r3
+ (1.0 - p
) * r2
) * visibility
+ r1
;
1135 double g
= (p
* g3
+ (1.0 - p
) * g2
) * visibility
+ g1
;
1136 double b
= (p
* b3
+ (1.0 - p
) * b2
) * visibility
+ b1
;
1138 wxPen
P(wxColour((unsigned char)r
, (unsigned char)g
, (unsigned char)b
));
1140 dc
.DrawPoint(x
, rect
.y
+ i
);
1143 m_cached_tab_separator_visibility
= visibility
;
1146 void wxRibbonMSWArtProvider::DrawPartialPageBackground(wxDC
& dc
,
1147 wxWindow
* wnd
, const wxRect
& rect
, wxRibbonPage
* page
,
1148 wxPoint offset
, bool hovered
)
1151 // Expanded panels need a background - the expanded panel at
1152 // best size may have a greater Y dimension higher than when
1153 // on the bar if it has a sizer. AUI art provider does not need this
1154 // because it paints the panel without reference to its parent's size.
1155 // Expanded panels use a wxFrame as parent (not a wxRibbonPage).
1157 if(wnd
->GetSizer() && wnd
->GetParent() != page
)
1159 background
= wnd
->GetParent()->GetSize();
1160 offset
= wxPoint(0,0);
1164 background
= page
->GetSize();
1165 page
->AdjustRectToIncludeScrollButtons(&background
);
1166 background
.height
-= 2;
1168 // Page background isn't dependant upon the width of the page
1169 // (at least not the part of it intended to be painted by this
1170 // function). Set to wider than the page itself for when externally
1171 // expanded panels need a background - the expanded panel can be wider
1174 background
.width
= INT_MAX
;
1176 // upper_rect, lower_rect, paint_rect are all in page co-ordinates
1177 wxRect
upper_rect(background
);
1178 upper_rect
.height
/= 5;
1180 wxRect
lower_rect(background
);
1181 lower_rect
.y
+= upper_rect
.height
;
1182 lower_rect
.height
-= upper_rect
.height
;
1184 wxRect
paint_rect(rect
);
1185 paint_rect
.x
+= offset
.x
;
1186 paint_rect
.y
+= offset
.y
;
1188 wxColour bg_top
, bg_top_grad
, bg_btm
, bg_btm_grad
;
1191 bg_top
= m_page_hover_background_top_colour
;
1192 bg_top_grad
= m_page_hover_background_top_gradient_colour
;
1193 bg_btm
= m_page_hover_background_colour
;
1194 bg_btm_grad
= m_page_hover_background_gradient_colour
;
1198 bg_top
= m_page_background_top_colour
;
1199 bg_top_grad
= m_page_background_top_gradient_colour
;
1200 bg_btm
= m_page_background_colour
;
1201 bg_btm_grad
= m_page_background_gradient_colour
;
1204 if(paint_rect
.Intersects(upper_rect
))
1206 wxRect
rect(upper_rect
);
1207 rect
.Intersect(paint_rect
);
1210 wxColour
starting_colour(wxRibbonInterpolateColour(bg_top
, bg_top_grad
,
1211 paint_rect
.y
, upper_rect
.y
, upper_rect
.y
+ upper_rect
.height
));
1212 wxColour
ending_colour(wxRibbonInterpolateColour(bg_top
, bg_top_grad
,
1213 paint_rect
.y
+ paint_rect
.height
, upper_rect
.y
,
1214 upper_rect
.y
+ upper_rect
.height
));
1215 dc
.GradientFillLinear(rect
, starting_colour
, ending_colour
, wxSOUTH
);
1218 if(paint_rect
.Intersects(lower_rect
))
1220 wxRect
rect(lower_rect
);
1221 rect
.Intersect(paint_rect
);
1224 wxColour
starting_colour(wxRibbonInterpolateColour(bg_btm
, bg_btm_grad
,
1225 paint_rect
.y
, lower_rect
.y
, lower_rect
.y
+ lower_rect
.height
));
1226 wxColour
ending_colour(wxRibbonInterpolateColour(bg_btm
, bg_btm_grad
,
1227 paint_rect
.y
+ paint_rect
.height
,
1228 lower_rect
.y
, lower_rect
.y
+ lower_rect
.height
));
1229 dc
.GradientFillLinear(rect
, starting_colour
, ending_colour
, wxSOUTH
);
1233 void wxRibbonMSWArtProvider::DrawPageBackground(
1235 wxWindow
* WXUNUSED(wnd
),
1238 dc
.SetPen(*wxTRANSPARENT_PEN
);
1239 dc
.SetBrush(m_tab_ctrl_background_brush
);
1245 dc
.DrawRectangle(edge
.x
, edge
.y
, edge
.width
, edge
.height
);
1247 edge
.x
+= rect
.width
- 2;
1248 dc
.DrawRectangle(edge
.x
, edge
.y
, edge
.width
, edge
.height
);
1252 edge
.y
+= (rect
.height
- edge
.height
);
1253 dc
.DrawRectangle(edge
.x
, edge
.y
, edge
.width
, edge
.height
);
1257 wxRect
background(rect
);
1259 background
.width
-= 4;
1260 background
.height
-= 2;
1262 background
.height
/= 5;
1263 dc
.GradientFillLinear(background
, m_page_background_top_colour
,
1264 m_page_background_top_gradient_colour
, wxSOUTH
);
1266 background
.y
+= background
.height
;
1267 background
.height
= rect
.height
- 2 - background
.height
;
1268 dc
.GradientFillLinear(background
, m_page_background_colour
,
1269 m_page_background_gradient_colour
, wxSOUTH
);
1273 wxPoint border_points
[8];
1274 border_points
[0] = wxPoint(2, 0);
1275 border_points
[1] = wxPoint(1, 1);
1276 border_points
[2] = wxPoint(1, rect
.height
- 4);
1277 border_points
[3] = wxPoint(3, rect
.height
- 2);
1278 border_points
[4] = wxPoint(rect
.width
- 4, rect
.height
- 2);
1279 border_points
[5] = wxPoint(rect
.width
- 2, rect
.height
- 4);
1280 border_points
[6] = wxPoint(rect
.width
- 2, 1);
1281 border_points
[7] = wxPoint(rect
.width
- 4, -1);
1283 dc
.SetPen(m_page_border_pen
);
1284 dc
.DrawLines(sizeof(border_points
)/sizeof(wxPoint
), border_points
, rect
.x
, rect
.y
);
1288 void wxRibbonMSWArtProvider::DrawScrollButton(
1290 wxWindow
* WXUNUSED(wnd
),
1291 const wxRect
& rect_
,
1296 if((style
& wxRIBBON_SCROLL_BTN_FOR_MASK
) == wxRIBBON_SCROLL_BTN_FOR_PAGE
)
1298 // Page scroll buttons do not have the luxury of rendering on top of anything
1299 // else, and their size includes some padding, hence the background painting
1300 // and size adjustment.
1301 dc
.SetPen(*wxTRANSPARENT_PEN
);
1302 dc
.SetBrush(m_tab_ctrl_background_brush
);
1303 dc
.DrawRectangle(rect
);
1304 dc
.SetClippingRegion(rect
);
1305 switch(style
& wxRIBBON_SCROLL_BTN_DIRECTION_MASK
)
1307 case wxRIBBON_SCROLL_BTN_LEFT
:
1309 case wxRIBBON_SCROLL_BTN_RIGHT
:
1313 case wxRIBBON_SCROLL_BTN_UP
:
1319 case wxRIBBON_SCROLL_BTN_DOWN
:
1328 wxRect
background(rect
);
1331 background
.width
-= 2;
1332 background
.height
-= 2;
1334 if(style
& wxRIBBON_SCROLL_BTN_UP
)
1335 background
.height
/= 2;
1337 background
.height
/= 5;
1338 dc
.GradientFillLinear(background
, m_page_background_top_colour
,
1339 m_page_background_top_gradient_colour
, wxSOUTH
);
1341 background
.y
+= background
.height
;
1342 background
.height
= rect
.height
- 2 - background
.height
;
1343 dc
.GradientFillLinear(background
, m_page_background_colour
,
1344 m_page_background_gradient_colour
, wxSOUTH
);
1348 wxPoint border_points
[7];
1349 switch(style
& wxRIBBON_SCROLL_BTN_DIRECTION_MASK
)
1351 case wxRIBBON_SCROLL_BTN_LEFT
:
1352 border_points
[0] = wxPoint(2, 0);
1353 border_points
[1] = wxPoint(rect
.width
- 1, 0);
1354 border_points
[2] = wxPoint(rect
.width
- 1, rect
.height
- 1);
1355 border_points
[3] = wxPoint(2, rect
.height
- 1);
1356 border_points
[4] = wxPoint(0, rect
.height
- 3);
1357 border_points
[5] = wxPoint(0, 2);
1359 case wxRIBBON_SCROLL_BTN_RIGHT
:
1360 border_points
[0] = wxPoint(0, 0);
1361 border_points
[1] = wxPoint(rect
.width
- 3, 0);
1362 border_points
[2] = wxPoint(rect
.width
- 1, 2);
1363 border_points
[3] = wxPoint(rect
.width
- 1, rect
.height
- 3);
1364 border_points
[4] = wxPoint(rect
.width
- 3, rect
.height
- 1);
1365 border_points
[5] = wxPoint(0, rect
.height
- 1);
1367 case wxRIBBON_SCROLL_BTN_UP
:
1368 border_points
[0] = wxPoint(2, 0);
1369 border_points
[1] = wxPoint(rect
.width
- 3, 0);
1370 border_points
[2] = wxPoint(rect
.width
- 1, 2);
1371 border_points
[3] = wxPoint(rect
.width
- 1, rect
.height
- 1);
1372 border_points
[4] = wxPoint(0, rect
.height
- 1);
1373 border_points
[5] = wxPoint(0, 2);
1375 case wxRIBBON_SCROLL_BTN_DOWN
:
1376 border_points
[0] = wxPoint(0, 0);
1377 border_points
[1] = wxPoint(rect
.width
- 1, 0);
1378 border_points
[2] = wxPoint(rect
.width
- 1, rect
.height
- 3);
1379 border_points
[3] = wxPoint(rect
.width
- 3, rect
.height
- 1);
1380 border_points
[4] = wxPoint(2, rect
.height
- 1);
1381 border_points
[5] = wxPoint(0, rect
.height
- 3);
1384 border_points
[6] = border_points
[0];
1386 dc
.SetPen(m_page_border_pen
);
1387 dc
.DrawLines(sizeof(border_points
)/sizeof(wxPoint
), border_points
, rect
.x
, rect
.y
);
1391 // NB: Code for handling hovered/active state is temporary
1392 wxPoint arrow_points
[3];
1393 switch(style
& wxRIBBON_SCROLL_BTN_DIRECTION_MASK
)
1395 case wxRIBBON_SCROLL_BTN_LEFT
:
1396 arrow_points
[0] = wxPoint(rect
.width
/ 2 - 2, rect
.height
/ 2);
1397 if(style
& wxRIBBON_SCROLL_BTN_ACTIVE
)
1398 arrow_points
[0].y
+= 1;
1399 arrow_points
[1] = arrow_points
[0] + wxPoint(3, -3);
1400 arrow_points
[2] = arrow_points
[0] + wxPoint(3, 3);
1402 case wxRIBBON_SCROLL_BTN_RIGHT
:
1403 arrow_points
[0] = wxPoint(rect
.width
/ 2 + 2, rect
.height
/ 2);
1404 if(style
& wxRIBBON_SCROLL_BTN_ACTIVE
)
1405 arrow_points
[0].y
+= 1;
1406 arrow_points
[1] = arrow_points
[0] - wxPoint(3, 3);
1407 arrow_points
[2] = arrow_points
[0] - wxPoint(3, -3);
1409 case wxRIBBON_SCROLL_BTN_UP
:
1410 arrow_points
[0] = wxPoint(rect
.width
/ 2, rect
.height
/ 2 - 2);
1411 if(style
& wxRIBBON_SCROLL_BTN_ACTIVE
)
1412 arrow_points
[0].y
+= 1;
1413 arrow_points
[1] = arrow_points
[0] + wxPoint( 3, 3);
1414 arrow_points
[2] = arrow_points
[0] + wxPoint(-3, 3);
1416 case wxRIBBON_SCROLL_BTN_DOWN
:
1417 arrow_points
[0] = wxPoint(rect
.width
/ 2, rect
.height
/ 2 + 2);
1418 if(style
& wxRIBBON_SCROLL_BTN_ACTIVE
)
1419 arrow_points
[0].y
+= 1;
1420 arrow_points
[1] = arrow_points
[0] - wxPoint( 3, 3);
1421 arrow_points
[2] = arrow_points
[0] - wxPoint(-3, 3);
1425 dc
.SetPen(*wxTRANSPARENT_PEN
);
1426 wxBrush
B(style
& wxRIBBON_SCROLL_BTN_HOVERED
? m_tab_active_background_colour
: m_tab_label_colour
);
1428 dc
.DrawPolygon(sizeof(arrow_points
)/sizeof(wxPoint
), arrow_points
, rect
.x
, rect
.y
);
1432 void wxRibbonMSWArtProvider::DrawDropdownArrow(wxDC
& dc
, int x
, int y
, const wxColour
& colour
)
1434 wxPoint arrow_points
[3];
1435 wxBrush
brush(colour
);
1436 arrow_points
[0] = wxPoint(1, 2);
1437 arrow_points
[1] = arrow_points
[0] + wxPoint(-3, -3);
1438 arrow_points
[2] = arrow_points
[0] + wxPoint( 3, -3);
1439 dc
.SetPen(*wxTRANSPARENT_PEN
);
1441 dc
.DrawPolygon(sizeof(arrow_points
)/sizeof(wxPoint
), arrow_points
, x
, y
);
1444 void wxRibbonMSWArtProvider::RemovePanelPadding(wxRect
* rect
)
1446 if(m_flags
& wxRIBBON_BAR_FLOW_VERTICAL
)
1458 void wxRibbonMSWArtProvider::DrawPanelBackground(
1463 DrawPartialPageBackground(dc
, wnd
, rect
, false);
1465 wxRect
true_rect(rect
);
1466 RemovePanelPadding(&true_rect
);
1470 dc
.SetFont(m_panel_label_font
);
1471 dc
.SetPen(*wxTRANSPARENT_PEN
);
1472 if(wnd
->IsHovered())
1474 dc
.SetBrush(m_panel_hover_label_background_brush
);
1475 dc
.SetTextForeground(m_panel_hover_label_colour
);
1479 dc
.SetBrush(m_panel_label_background_brush
);
1480 dc
.SetTextForeground(m_panel_label_colour
);
1483 wxRect
label_rect(true_rect
);
1484 wxString label
= wnd
->GetLabel();
1485 bool clip_label
= false;
1486 wxSize
label_size(dc
.GetTextExtent(label
));
1488 label_rect
.SetX(label_rect
.GetX() + 1);
1489 label_rect
.SetWidth(label_rect
.GetWidth() - 2);
1490 label_rect
.SetHeight(label_size
.GetHeight() + 2);
1491 label_rect
.SetY(true_rect
.GetBottom() - label_rect
.GetHeight());
1492 label_height
= label_rect
.GetHeight();
1494 if(label_size
.GetWidth() > label_rect
.GetWidth())
1496 // Test if there is enough length for 3 letters and ...
1497 wxString new_label
= label
.Mid(0, 3) + wxT("...");
1498 label_size
= dc
.GetTextExtent(new_label
);
1499 if(label_size
.GetWidth() > label_rect
.GetWidth())
1501 // Not enough room for three characters and ...
1502 // Display the entire label and just crop it
1507 // Room for some characters and ...
1508 // Display as many characters as possible and append ...
1509 for(size_t len
= label
.Len() - 1; len
>= 3; --len
)
1511 new_label
= label
.Mid(0, len
) + wxT("...");
1512 label_size
= dc
.GetTextExtent(new_label
);
1513 if(label_size
.GetWidth() <= label_rect
.GetWidth())
1522 dc
.DrawRectangle(label_rect
.GetX(), label_rect
.GetY(), label_rect
.GetWidth(), label_rect
.GetHeight());
1525 wxDCClipper
clip(dc
, label_rect
);
1526 dc
.DrawText(label
, label_rect
.x
, label_rect
.y
+
1527 (label_rect
.GetHeight() - label_size
.GetHeight()) / 2);
1531 dc
.DrawText(label
, label_rect
.x
+
1532 (label_rect
.GetWidth() - label_size
.GetWidth()) / 2,
1534 (label_rect
.GetHeight() - label_size
.GetHeight()) / 2);
1538 if(wnd
->IsHovered())
1540 wxRect
client_rect(true_rect
);
1542 client_rect
.width
-= 2;
1544 client_rect
.height
-= 2 + label_height
;
1545 DrawPartialPageBackground(dc
, wnd
, client_rect
, true);
1548 DrawPanelBorder(dc
, true_rect
, m_panel_border_pen
, m_panel_border_gradient_pen
);
1551 void wxRibbonMSWArtProvider::DrawGalleryBackground(
1553 wxRibbonGallery
* wnd
,
1556 DrawPartialPageBackground(dc
, wnd
, rect
);
1558 if(wnd
->IsHovered())
1560 dc
.SetPen(*wxTRANSPARENT_PEN
);
1561 dc
.SetBrush(m_gallery_hover_background_brush
);
1562 if(m_flags
& wxRIBBON_BAR_FLOW_VERTICAL
)
1564 dc
.DrawRectangle(rect
.x
+ 1, rect
.y
+ 1, rect
.width
- 2,
1569 dc
.DrawRectangle(rect
.x
+ 1, rect
.y
+ 1, rect
.width
- 16,
1574 dc
.SetPen(m_gallery_border_pen
);
1576 dc
.DrawLine(rect
.x
+ 1, rect
.y
, rect
.x
+ rect
.width
- 1, rect
.y
);
1577 dc
.DrawLine(rect
.x
, rect
.y
+ 1, rect
.x
, rect
.y
+ rect
.height
- 1);
1578 dc
.DrawLine(rect
.x
+ 1, rect
.y
+ rect
.height
- 1, rect
.x
+ rect
.width
- 1,
1579 rect
.y
+ rect
.height
- 1);
1580 dc
.DrawLine(rect
.x
+ rect
.width
- 1, rect
.y
+ 1, rect
.x
+ rect
.width
- 1,
1581 rect
.y
+ rect
.height
- 1);
1583 DrawGalleryBackgroundCommon(dc
, wnd
, rect
);
1586 void wxRibbonMSWArtProvider::DrawGalleryBackgroundCommon(wxDC
& dc
,
1587 wxRibbonGallery
* wnd
,
1590 wxRect up_btn
, down_btn
, ext_btn
;
1592 if(m_flags
& wxRIBBON_BAR_FLOW_VERTICAL
)
1594 // Divider between items and buttons
1595 dc
.DrawLine(rect
.x
, rect
.y
+ rect
.height
- 15, rect
.x
+ rect
.width
,
1596 rect
.y
+ rect
.height
- 15);
1598 up_btn
= wxRect(rect
.x
, rect
.y
+ rect
.height
- 15, rect
.width
/ 3, 15);
1600 down_btn
= wxRect(up_btn
.GetRight() + 1, up_btn
.GetTop(),
1601 up_btn
.GetWidth(), up_btn
.GetHeight());
1602 dc
.DrawLine(down_btn
.GetLeft(), down_btn
.GetTop(), down_btn
.GetLeft(),
1603 down_btn
.GetBottom());
1605 ext_btn
= wxRect(down_btn
.GetRight() + 1, up_btn
.GetTop(), rect
.width
-
1606 up_btn
.GetWidth() - down_btn
.GetWidth() - 1, up_btn
.GetHeight());
1607 dc
.DrawLine(ext_btn
.GetLeft(), ext_btn
.GetTop(), ext_btn
.GetLeft(),
1608 ext_btn
.GetBottom());
1612 // Divider between items and buttons
1613 dc
.DrawLine(rect
.x
+ rect
.width
- 15, rect
.y
, rect
.x
+ rect
.width
- 15,
1614 rect
.y
+ rect
.height
);
1616 up_btn
= wxRect(rect
.x
+ rect
.width
- 15, rect
.y
, 15, rect
.height
/ 3);
1618 down_btn
= wxRect(up_btn
.GetLeft(), up_btn
.GetBottom() + 1,
1619 up_btn
.GetWidth(), up_btn
.GetHeight());
1620 dc
.DrawLine(down_btn
.GetLeft(), down_btn
.GetTop(), down_btn
.GetRight(),
1623 ext_btn
= wxRect(up_btn
.GetLeft(), down_btn
.GetBottom() + 1, up_btn
.GetWidth(),
1624 rect
.height
- up_btn
.GetHeight() - down_btn
.GetHeight() - 1);
1625 dc
.DrawLine(ext_btn
.GetLeft(), ext_btn
.GetTop(), ext_btn
.GetRight(),
1629 DrawGalleryButton(dc
, up_btn
, wnd
->GetUpButtonState(),
1630 m_gallery_up_bitmap
);
1631 DrawGalleryButton(dc
, down_btn
, wnd
->GetDownButtonState(),
1632 m_gallery_down_bitmap
);
1633 DrawGalleryButton(dc
, ext_btn
, wnd
->GetExtensionButtonState(),
1634 m_gallery_extension_bitmap
);
1637 void wxRibbonMSWArtProvider::DrawGalleryButton(wxDC
& dc
,
1639 wxRibbonGalleryButtonState state
,
1642 wxBitmap btn_bitmap
;
1643 wxBrush btn_top_brush
;
1644 wxColour btn_colour
;
1645 wxColour btn_grad_colour
;
1648 case wxRIBBON_GALLERY_BUTTON_NORMAL
:
1649 btn_top_brush
= m_gallery_button_background_top_brush
;
1650 btn_colour
= m_gallery_button_background_colour
;
1651 btn_grad_colour
= m_gallery_button_background_gradient_colour
;
1652 btn_bitmap
= bitmaps
[0];
1654 case wxRIBBON_GALLERY_BUTTON_HOVERED
:
1655 btn_top_brush
= m_gallery_button_hover_background_top_brush
;
1656 btn_colour
= m_gallery_button_hover_background_colour
;
1657 btn_grad_colour
= m_gallery_button_hover_background_gradient_colour
;
1658 btn_bitmap
= bitmaps
[1];
1660 case wxRIBBON_GALLERY_BUTTON_ACTIVE
:
1661 btn_top_brush
= m_gallery_button_active_background_top_brush
;
1662 btn_colour
= m_gallery_button_active_background_colour
;
1663 btn_grad_colour
= m_gallery_button_active_background_gradient_colour
;
1664 btn_bitmap
= bitmaps
[2];
1666 case wxRIBBON_GALLERY_BUTTON_DISABLED
:
1667 btn_top_brush
= m_gallery_button_disabled_background_top_brush
;
1668 btn_colour
= m_gallery_button_disabled_background_colour
;
1669 btn_grad_colour
= m_gallery_button_disabled_background_gradient_colour
;
1670 btn_bitmap
= bitmaps
[3];
1676 if(m_flags
& wxRIBBON_BAR_FLOW_VERTICAL
)
1687 dc
.SetPen(*wxTRANSPARENT_PEN
);
1688 dc
.SetBrush(btn_top_brush
);
1689 dc
.DrawRectangle(rect
.x
, rect
.y
, rect
.width
, rect
.height
/ 2);
1692 lower
.height
= (lower
.height
+ 1) / 2;
1693 lower
.y
+= rect
.height
- lower
.height
;
1694 dc
.GradientFillLinear(lower
, btn_colour
, btn_grad_colour
, wxSOUTH
);
1696 dc
.DrawBitmap(btn_bitmap
, rect
.x
+ rect
.width
/ 2 - 2, lower
.y
- 2, true);
1699 void wxRibbonMSWArtProvider::DrawGalleryItemBackground(
1701 wxRibbonGallery
* wnd
,
1703 wxRibbonGalleryItem
* item
)
1705 if(wnd
->GetHoveredItem() != item
&& wnd
->GetActiveItem() != item
&&
1706 wnd
->GetSelection() != item
)
1709 dc
.SetPen(m_gallery_item_border_pen
);
1710 dc
.DrawLine(rect
.x
+ 1, rect
.y
, rect
.x
+ rect
.width
- 1, rect
.y
);
1711 dc
.DrawLine(rect
.x
, rect
.y
+ 1, rect
.x
, rect
.y
+ rect
.height
- 1);
1712 dc
.DrawLine(rect
.x
+ 1, rect
.y
+ rect
.height
- 1, rect
.x
+ rect
.width
- 1,
1713 rect
.y
+ rect
.height
- 1);
1714 dc
.DrawLine(rect
.x
+ rect
.width
- 1, rect
.y
+ 1, rect
.x
+ rect
.width
- 1,
1715 rect
.y
+ rect
.height
- 1);
1719 wxColour bg_gradient_colour
;
1721 if(wnd
->GetActiveItem() == item
|| wnd
->GetSelection() == item
)
1723 top_brush
= m_gallery_button_active_background_top_brush
;
1724 bg_colour
= m_gallery_button_active_background_colour
;
1725 bg_gradient_colour
= m_gallery_button_active_background_gradient_colour
;
1729 top_brush
= m_gallery_button_hover_background_top_brush
;
1730 bg_colour
= m_gallery_button_hover_background_colour
;
1731 bg_gradient_colour
= m_gallery_button_hover_background_gradient_colour
;
1739 dc
.SetPen(*wxTRANSPARENT_PEN
);
1740 dc
.SetBrush(top_brush
);
1741 dc
.DrawRectangle(upper
.x
, upper
.y
, upper
.width
, upper
.height
);
1743 wxRect
lower(upper
);
1744 lower
.y
+= lower
.height
;
1745 lower
.height
= rect
.height
- 2 - lower
.height
;
1746 dc
.GradientFillLinear(lower
, bg_colour
, bg_gradient_colour
, wxSOUTH
);
1749 void wxRibbonMSWArtProvider::DrawPanelBorder(wxDC
& dc
, const wxRect
& rect
,
1750 wxPen
& primary_colour
,
1751 wxPen
& secondary_colour
)
1753 wxPoint border_points
[9];
1754 border_points
[0] = wxPoint(2, 0);
1755 border_points
[1] = wxPoint(rect
.width
- 3, 0);
1756 border_points
[2] = wxPoint(rect
.width
- 1, 2);
1757 border_points
[3] = wxPoint(rect
.width
- 1, rect
.height
- 3);
1758 border_points
[4] = wxPoint(rect
.width
- 3, rect
.height
- 1);
1759 border_points
[5] = wxPoint(2, rect
.height
- 1);
1760 border_points
[6] = wxPoint(0, rect
.height
- 3);
1761 border_points
[7] = wxPoint(0, 2);
1763 if(primary_colour
.GetColour() == secondary_colour
.GetColour())
1765 border_points
[8] = border_points
[0];
1766 dc
.SetPen(primary_colour
);
1767 dc
.DrawLines(sizeof(border_points
)/sizeof(wxPoint
), border_points
, rect
.x
, rect
.y
);
1771 dc
.SetPen(primary_colour
);
1772 dc
.DrawLines(3, border_points
, rect
.x
, rect
.y
);
1774 #define SingleLine(start, finish) \
1775 dc.DrawLine(start.x + rect.x, start.y + rect.y, finish.x + rect.x, finish.y + rect.y)
1777 SingleLine(border_points
[0], border_points
[7]);
1778 dc
.SetPen(secondary_colour
);
1779 dc
.DrawLines(3, border_points
+ 4, rect
.x
, rect
.y
);
1780 SingleLine(border_points
[4], border_points
[3]);
1784 border_points
[6] = border_points
[2];
1785 wxRibbonDrawParallelGradientLines(dc
, 2, border_points
+ 6, 0, 1,
1786 border_points
[3].y
- border_points
[2].y
+ 1, rect
.x
, rect
.y
,
1787 primary_colour
.GetColour(), secondary_colour
.GetColour());
1791 void wxRibbonMSWArtProvider::DrawMinimisedPanel(
1797 DrawPartialPageBackground(dc
, wnd
, rect
, false);
1799 wxRect
true_rect(rect
);
1800 RemovePanelPadding(&true_rect
);
1802 if(wnd
->GetExpandedPanel() != NULL
)
1804 wxRect
client_rect(true_rect
);
1806 client_rect
.width
-= 2;
1808 client_rect
.height
= (rect
.y
+ rect
.height
/ 5) - client_rect
.x
;
1809 dc
.GradientFillLinear(client_rect
,
1810 m_panel_active_background_top_colour
,
1811 m_panel_active_background_top_gradient_colour
, wxSOUTH
);
1813 client_rect
.y
+= client_rect
.height
;
1814 client_rect
.height
= (true_rect
.y
+ true_rect
.height
) - client_rect
.y
;
1815 dc
.GradientFillLinear(client_rect
,
1816 m_panel_active_background_colour
,
1817 m_panel_active_background_gradient_colour
, wxSOUTH
);
1819 else if(wnd
->IsHovered())
1821 wxRect
client_rect(true_rect
);
1823 client_rect
.width
-= 2;
1825 client_rect
.height
-= 2;
1826 DrawPartialPageBackground(dc
, wnd
, client_rect
, true);
1830 DrawMinimisedPanelCommon(dc
, wnd
, true_rect
, &preview
);
1832 dc
.SetBrush(m_panel_hover_label_background_brush
);
1833 dc
.SetPen(*wxTRANSPARENT_PEN
);
1834 dc
.DrawRectangle(preview
.x
+ 1, preview
.y
+ preview
.height
- 8,
1835 preview
.width
- 2, 7);
1837 int mid_pos
= rect
.y
+ rect
.height
/ 5 - preview
.y
;
1838 if(mid_pos
< 0 || mid_pos
>= preview
.height
)
1840 wxRect
full_rect(preview
);
1843 full_rect
.width
-= 2;
1844 full_rect
.height
-= 9;
1847 dc
.GradientFillLinear(full_rect
,
1848 m_page_hover_background_colour
,
1849 m_page_hover_background_gradient_colour
, wxSOUTH
);
1853 dc
.GradientFillLinear(full_rect
,
1854 m_page_hover_background_top_colour
,
1855 m_page_hover_background_top_gradient_colour
, wxSOUTH
);
1860 wxRect
top_rect(preview
);
1863 top_rect
.width
-= 2;
1864 top_rect
.height
= mid_pos
;
1865 dc
.GradientFillLinear(top_rect
,
1866 m_page_hover_background_top_colour
,
1867 m_page_hover_background_top_gradient_colour
, wxSOUTH
);
1869 wxRect
btm_rect(top_rect
);
1870 btm_rect
.y
= preview
.y
+ mid_pos
;
1871 btm_rect
.height
= preview
.y
+ preview
.height
- 7 - btm_rect
.y
;
1872 dc
.GradientFillLinear(btm_rect
,
1873 m_page_hover_background_colour
,
1874 m_page_hover_background_gradient_colour
, wxSOUTH
);
1879 dc
.DrawBitmap(bitmap
, preview
.x
+ (preview
.width
- bitmap
.GetWidth()) / 2,
1880 preview
.y
+ (preview
.height
- 7 - bitmap
.GetHeight()) / 2, true);
1883 DrawPanelBorder(dc
, preview
, m_panel_border_pen
, m_panel_border_gradient_pen
);
1885 DrawPanelBorder(dc
, true_rect
, m_panel_minimised_border_pen
,
1886 m_panel_minimised_border_gradient_pen
);
1889 void wxRibbonMSWArtProvider::DrawMinimisedPanelCommon(
1892 const wxRect
& true_rect
,
1893 wxRect
* preview_rect
)
1895 wxRect
preview(0, 0, 32, 32);
1896 if(m_flags
& wxRIBBON_BAR_FLOW_VERTICAL
)
1898 preview
.x
= true_rect
.x
+ 4;
1899 preview
.y
= true_rect
.y
+ (true_rect
.height
- preview
.height
) / 2;
1903 preview
.x
= true_rect
.x
+ (true_rect
.width
- preview
.width
) / 2;
1904 preview
.y
= true_rect
.y
+ 4;
1907 *preview_rect
= preview
;
1909 wxCoord label_width
, label_height
;
1910 dc
.SetFont(m_panel_label_font
);
1911 dc
.GetTextExtent(wnd
->GetLabel(), &label_width
, &label_height
);
1913 int xpos
= true_rect
.x
+ (true_rect
.width
- label_width
+ 1) / 2;
1914 int ypos
= preview
.y
+ preview
.height
+ 5;
1916 if(m_flags
& wxRIBBON_BAR_FLOW_VERTICAL
)
1918 xpos
= preview
.x
+ preview
.width
+ 5;
1919 ypos
= true_rect
.y
+ (true_rect
.height
- label_height
) / 2;
1922 dc
.SetTextForeground(m_panel_minimised_label_colour
);
1923 dc
.DrawText(wnd
->GetLabel(), xpos
, ypos
);
1926 wxPoint arrow_points
[3];
1927 if(m_flags
& wxRIBBON_BAR_FLOW_VERTICAL
)
1929 xpos
+= label_width
;
1930 arrow_points
[0] = wxPoint(xpos
+ 5, ypos
+ label_height
/ 2);
1931 arrow_points
[1] = arrow_points
[0] + wxPoint(-3, 3);
1932 arrow_points
[2] = arrow_points
[0] + wxPoint(-3, -3);
1936 ypos
+= label_height
;
1937 arrow_points
[0] = wxPoint(true_rect
.width
/ 2, ypos
+ 5);
1938 arrow_points
[1] = arrow_points
[0] + wxPoint(-3, -3);
1939 arrow_points
[2] = arrow_points
[0] + wxPoint( 3, -3);
1942 dc
.SetPen(*wxTRANSPARENT_PEN
);
1943 wxBrush
B(m_panel_minimised_label_colour
);
1945 dc
.DrawPolygon(sizeof(arrow_points
)/sizeof(wxPoint
), arrow_points
,
1946 true_rect
.x
, true_rect
.y
);
1949 void wxRibbonMSWArtProvider::DrawButtonBarBackground(
1954 DrawPartialPageBackground(dc
, wnd
, rect
, true);
1957 void wxRibbonMSWArtProvider::DrawPartialPageBackground(
1963 // Assume the window is a child of a ribbon page, and also check for a
1964 // hovered panel somewhere between the window and the page, as it causes
1965 // the background to change.
1966 wxPoint
offset(wnd
->GetPosition());
1967 wxRibbonPage
* page
= NULL
;
1968 wxWindow
* parent
= wnd
->GetParent();
1969 wxRibbonPanel
* panel
= wxDynamicCast(wnd
, wxRibbonPanel
);
1970 bool hovered
= false;
1974 hovered
= allow_hovered
&& panel
->IsHovered();
1975 if(panel
->GetExpandedDummy() != NULL
)
1977 offset
= panel
->GetExpandedDummy()->GetPosition();
1978 parent
= panel
->GetExpandedDummy()->GetParent();
1981 for(; parent
; parent
= parent
->GetParent())
1985 panel
= wxDynamicCast(parent
, wxRibbonPanel
);
1988 hovered
= allow_hovered
&& panel
->IsHovered();
1989 if(panel
->GetExpandedDummy() != NULL
)
1991 parent
= panel
->GetExpandedDummy();
1995 page
= wxDynamicCast(parent
, wxRibbonPage
);
2000 offset
+= parent
->GetPosition();
2004 DrawPartialPageBackground(dc
, wnd
, rect
, page
, offset
, hovered
);
2008 // No page found - fallback to painting with a stock brush
2009 dc
.SetBrush(*wxWHITE_BRUSH
);
2010 dc
.SetPen(*wxTRANSPARENT_PEN
);
2011 dc
.DrawRectangle(rect
.x
, rect
.y
, rect
.width
, rect
.height
);
2014 void wxRibbonMSWArtProvider::DrawButtonBarButton(
2016 wxWindow
* WXUNUSED(wnd
),
2018 wxRibbonButtonKind kind
,
2020 const wxString
& label
,
2021 const wxBitmap
& bitmap_large
,
2022 const wxBitmap
& bitmap_small
)
2024 if(kind
== wxRIBBON_BUTTON_TOGGLE
)
2026 kind
= wxRIBBON_BUTTON_NORMAL
;
2027 if(state
& wxRIBBON_BUTTONBAR_BUTTON_TOGGLED
)
2028 state
^= wxRIBBON_BUTTONBAR_BUTTON_ACTIVE_MASK
;
2031 if(state
& (wxRIBBON_BUTTONBAR_BUTTON_HOVER_MASK
|
2032 wxRIBBON_BUTTONBAR_BUTTON_ACTIVE_MASK
))
2034 if(state
& wxRIBBON_BUTTONBAR_BUTTON_ACTIVE_MASK
)
2035 dc
.SetPen(m_button_bar_active_border_pen
);
2037 dc
.SetPen(m_button_bar_hover_border_pen
);
2039 wxRect
bg_rect(rect
);
2043 bg_rect
.height
-= 2;
2045 wxRect
bg_rect_top(bg_rect
);
2046 bg_rect_top
.height
/= 3;
2047 bg_rect
.y
+= bg_rect_top
.height
;
2048 bg_rect
.height
-= bg_rect_top
.height
;
2050 if(kind
== wxRIBBON_BUTTON_HYBRID
)
2052 switch(state
& wxRIBBON_BUTTONBAR_BUTTON_SIZE_MASK
)
2054 case wxRIBBON_BUTTONBAR_BUTTON_LARGE
:
2056 int iYBorder
= rect
.y
+ bitmap_large
.GetHeight() + 4;
2057 wxRect
partial_bg(rect
);
2058 if(state
& wxRIBBON_BUTTONBAR_BUTTON_NORMAL_HOVERED
)
2060 partial_bg
.SetBottom(iYBorder
- 1);
2064 partial_bg
.height
-= (iYBorder
- partial_bg
.y
+ 1);
2065 partial_bg
.y
= iYBorder
+ 1;
2067 dc
.DrawLine(rect
.x
, iYBorder
, rect
.x
+ rect
.width
, iYBorder
);
2068 bg_rect
.Intersect(partial_bg
);
2069 bg_rect_top
.Intersect(partial_bg
);
2072 case wxRIBBON_BUTTONBAR_BUTTON_MEDIUM
:
2074 int iArrowWidth
= 9;
2075 if(state
& wxRIBBON_BUTTONBAR_BUTTON_NORMAL_HOVERED
)
2077 bg_rect
.width
-= iArrowWidth
;
2078 bg_rect_top
.width
-= iArrowWidth
;
2079 dc
.DrawLine(bg_rect_top
.x
+ bg_rect_top
.width
,
2080 rect
.y
, bg_rect_top
.x
+ bg_rect_top
.width
,
2081 rect
.y
+ rect
.height
);
2086 bg_rect
.x
+= bg_rect
.width
- iArrowWidth
;
2087 bg_rect_top
.x
+= bg_rect_top
.width
- iArrowWidth
;
2088 bg_rect
.width
= iArrowWidth
;
2089 bg_rect_top
.width
= iArrowWidth
;
2090 dc
.DrawLine(bg_rect_top
.x
- 1, rect
.y
,
2091 bg_rect_top
.x
- 1, rect
.y
+ rect
.height
);
2095 case wxRIBBON_BUTTONBAR_BUTTON_SMALL
:
2100 if(state
& wxRIBBON_BUTTONBAR_BUTTON_ACTIVE_MASK
)
2102 dc
.GradientFillLinear(bg_rect_top
,
2103 m_button_bar_active_background_top_colour
,
2104 m_button_bar_active_background_top_gradient_colour
, wxSOUTH
);
2105 dc
.GradientFillLinear(bg_rect
,
2106 m_button_bar_active_background_colour
,
2107 m_button_bar_active_background_gradient_colour
, wxSOUTH
);
2111 dc
.GradientFillLinear(bg_rect_top
,
2112 m_button_bar_hover_background_top_colour
,
2113 m_button_bar_hover_background_top_gradient_colour
, wxSOUTH
);
2114 dc
.GradientFillLinear(bg_rect
,
2115 m_button_bar_hover_background_colour
,
2116 m_button_bar_hover_background_gradient_colour
, wxSOUTH
);
2119 wxPoint border_points
[9];
2120 border_points
[0] = wxPoint(2, 0);
2121 border_points
[1] = wxPoint(rect
.width
- 3, 0);
2122 border_points
[2] = wxPoint(rect
.width
- 1, 2);
2123 border_points
[3] = wxPoint(rect
.width
- 1, rect
.height
- 3);
2124 border_points
[4] = wxPoint(rect
.width
- 3, rect
.height
- 1);
2125 border_points
[5] = wxPoint(2, rect
.height
- 1);
2126 border_points
[6] = wxPoint(0, rect
.height
- 3);
2127 border_points
[7] = wxPoint(0, 2);
2128 border_points
[8] = border_points
[0];
2130 dc
.DrawLines(sizeof(border_points
)/sizeof(wxPoint
), border_points
,
2134 dc
.SetFont(m_button_bar_label_font
);
2135 dc
.SetTextForeground(m_button_bar_label_colour
);
2136 DrawButtonBarButtonForeground(dc
, rect
, kind
, state
, label
, bitmap_large
,
2140 void wxRibbonMSWArtProvider::DrawButtonBarButtonForeground(
2143 wxRibbonButtonKind kind
,
2145 const wxString
& label
,
2146 const wxBitmap
& bitmap_large
,
2147 const wxBitmap
& bitmap_small
)
2149 switch(state
& wxRIBBON_BUTTONBAR_BUTTON_SIZE_MASK
)
2151 case wxRIBBON_BUTTONBAR_BUTTON_LARGE
:
2153 const int padding
= 2;
2154 dc
.DrawBitmap(bitmap_large
,
2155 rect
.x
+ (rect
.width
- bitmap_large
.GetWidth()) / 2,
2156 rect
.y
+ padding
, true);
2157 int ypos
= rect
.y
+ padding
+ bitmap_large
.GetHeight() + padding
;
2158 int arrow_width
= kind
== wxRIBBON_BUTTON_NORMAL
? 0 : 8;
2159 wxCoord label_w
, label_h
;
2160 dc
.GetTextExtent(label
, &label_w
, &label_h
);
2161 if(label_w
+ 2 * padding
<= rect
.width
)
2163 dc
.DrawText(label
, rect
.x
+ (rect
.width
- label_w
) / 2, ypos
);
2164 if(arrow_width
!= 0)
2166 DrawDropdownArrow(dc
, rect
.x
+ rect
.width
/ 2,
2167 ypos
+ (label_h
* 3) / 2,
2168 m_button_bar_label_colour
);
2173 size_t breaki
= label
.Len();
2177 if(wxRibbonCanLabelBreakAtPosition(label
, breaki
))
2179 wxString label_top
= label
.Mid(0, breaki
);
2180 dc
.GetTextExtent(label_top
, &label_w
, &label_h
);
2181 if(label_w
+ 2 * padding
<= rect
.width
)
2183 dc
.DrawText(label_top
,
2184 rect
.x
+ (rect
.width
- label_w
) / 2, ypos
);
2186 wxString label_bottom
= label
.Mid(breaki
+ 1);
2187 dc
.GetTextExtent(label_bottom
, &label_w
, &label_h
);
2188 label_w
+= arrow_width
;
2189 int iX
= rect
.x
+ (rect
.width
- label_w
) / 2;
2190 dc
.DrawText(label_bottom
, iX
, ypos
);
2191 if(arrow_width
!= 0)
2193 DrawDropdownArrow(dc
,
2194 iX
+ 2 +label_w
- arrow_width
,
2195 ypos
+ label_h
/ 2 + 1,
2196 m_button_bar_label_colour
);
2201 } while(breaki
> 0);
2205 case wxRIBBON_BUTTONBAR_BUTTON_MEDIUM
:
2207 int x_cursor
= rect
.x
+ 2;
2208 dc
.DrawBitmap(bitmap_small
, x_cursor
,
2209 rect
.y
+ (rect
.height
- bitmap_small
.GetHeight())/2, true);
2210 x_cursor
+= bitmap_small
.GetWidth() + 2;
2211 wxCoord label_w
, label_h
;
2212 dc
.GetTextExtent(label
, &label_w
, &label_h
);
2213 dc
.DrawText(label
, x_cursor
,
2214 rect
.y
+ (rect
.height
- label_h
) / 2);
2215 x_cursor
+= label_w
+ 3;
2216 if(kind
!= wxRIBBON_BUTTON_NORMAL
)
2218 DrawDropdownArrow(dc
, x_cursor
, rect
.y
+ rect
.height
/ 2,
2219 m_button_bar_label_colour
);
2229 void wxRibbonMSWArtProvider::DrawToolBarBackground(
2234 DrawPartialPageBackground(dc
, wnd
, rect
);
2237 void wxRibbonMSWArtProvider::DrawToolGroupBackground(
2239 wxWindow
* WXUNUSED(wnd
),
2242 dc
.SetPen(m_toolbar_border_pen
);
2244 outline
[0] = wxPoint(2, 0);
2245 outline
[1] = wxPoint(rect
.width
- 3, 0);
2246 outline
[2] = wxPoint(rect
.width
- 1, 2);
2247 outline
[3] = wxPoint(rect
.width
- 1, rect
.height
- 3);
2248 outline
[4] = wxPoint(rect
.width
- 3, rect
.height
- 1);
2249 outline
[5] = wxPoint(2, rect
.height
- 1);
2250 outline
[6] = wxPoint(0, rect
.height
- 3);
2251 outline
[7] = wxPoint(0, 2);
2252 outline
[8] = outline
[0];
2254 dc
.DrawLines(sizeof(outline
)/sizeof(wxPoint
), outline
, rect
.x
, rect
.y
);
2257 void wxRibbonMSWArtProvider::DrawTool(
2259 wxWindow
* WXUNUSED(wnd
),
2261 const wxBitmap
& bitmap
,
2262 wxRibbonButtonKind kind
,
2265 if(kind
== wxRIBBON_BUTTON_TOGGLE
)
2267 if(state
& wxRIBBON_TOOLBAR_TOOL_TOGGLED
)
2268 state
^= wxRIBBON_TOOLBAR_TOOL_ACTIVE_MASK
;
2271 wxRect
bg_rect(rect
);
2273 if((state
& wxRIBBON_TOOLBAR_TOOL_LAST
) == 0)
2275 bool is_split_hybrid
= (kind
== wxRIBBON_BUTTON_HYBRID
&& (state
&
2276 (wxRIBBON_TOOLBAR_TOOL_HOVER_MASK
| wxRIBBON_TOOLBAR_TOOL_ACTIVE_MASK
)));
2279 wxRect
bg_rect_top(bg_rect
);
2280 bg_rect_top
.height
= (bg_rect_top
.height
* 2) / 5;
2281 wxRect
bg_rect_btm(bg_rect
);
2282 bg_rect_btm
.y
+= bg_rect_top
.height
;
2283 bg_rect_btm
.height
-= bg_rect_top
.height
;
2284 wxColour bg_top_colour
= m_tool_background_top_colour
;
2285 wxColour bg_top_grad_colour
= m_tool_background_top_gradient_colour
;
2286 wxColour bg_colour
= m_tool_background_colour
;
2287 wxColour bg_grad_colour
= m_tool_background_gradient_colour
;
2288 if(state
& wxRIBBON_TOOLBAR_TOOL_ACTIVE_MASK
)
2290 bg_top_colour
= m_tool_active_background_top_colour
;
2291 bg_top_grad_colour
= m_tool_active_background_top_gradient_colour
;
2292 bg_colour
= m_tool_active_background_colour
;
2293 bg_grad_colour
= m_tool_active_background_gradient_colour
;
2295 else if(state
& wxRIBBON_TOOLBAR_TOOL_HOVER_MASK
)
2297 bg_top_colour
= m_tool_hover_background_top_colour
;
2298 bg_top_grad_colour
= m_tool_hover_background_top_gradient_colour
;
2299 bg_colour
= m_tool_hover_background_colour
;
2300 bg_grad_colour
= m_tool_hover_background_gradient_colour
;
2302 dc
.GradientFillLinear(bg_rect_top
, bg_top_colour
, bg_top_grad_colour
, wxSOUTH
);
2303 dc
.GradientFillLinear(bg_rect_btm
, bg_colour
, bg_grad_colour
, wxSOUTH
);
2306 wxRect
nonrect(bg_rect
);
2307 if(state
& (wxRIBBON_TOOLBAR_TOOL_DROPDOWN_HOVERED
|
2308 wxRIBBON_TOOLBAR_TOOL_DROPDOWN_ACTIVE
))
2314 nonrect
.x
+= nonrect
.width
- 8;
2317 wxBrush
B(m_tool_hover_background_top_colour
);
2318 dc
.SetPen(*wxTRANSPARENT_PEN
);
2320 dc
.DrawRectangle(nonrect
.x
, nonrect
.y
, nonrect
.width
, nonrect
.height
);
2324 dc
.SetPen(m_toolbar_border_pen
);
2325 if(state
& wxRIBBON_TOOLBAR_TOOL_FIRST
)
2327 dc
.DrawPoint(rect
.x
+ 1, rect
.y
+ 1);
2328 dc
.DrawPoint(rect
.x
+ 1, rect
.y
+ rect
.height
- 2);
2331 dc
.DrawLine(rect
.x
, rect
.y
+ 1, rect
.x
, rect
.y
+ rect
.height
- 1);
2333 if(state
& wxRIBBON_TOOLBAR_TOOL_LAST
)
2335 dc
.DrawPoint(rect
.x
+ rect
.width
- 2, rect
.y
+ 1);
2336 dc
.DrawPoint(rect
.x
+ rect
.width
- 2, rect
.y
+ rect
.height
- 2);
2340 int avail_width
= bg_rect
.GetWidth();
2341 if(kind
& wxRIBBON_BUTTON_DROPDOWN
)
2346 dc
.DrawLine(rect
.x
+ avail_width
+ 1, rect
.y
,
2347 rect
.x
+ avail_width
+ 1, rect
.y
+ rect
.height
);
2349 dc
.DrawBitmap(m_toolbar_drop_bitmap
, bg_rect
.x
+ avail_width
+ 2,
2350 bg_rect
.y
+ (bg_rect
.height
/ 2) - 2, true);
2352 dc
.DrawBitmap(bitmap
, bg_rect
.x
+ (avail_width
- bitmap
.GetWidth()) / 2,
2353 bg_rect
.y
+ (bg_rect
.height
- bitmap
.GetHeight()) / 2, true);
2356 void wxRibbonMSWArtProvider::GetBarTabWidth(
2358 wxWindow
* WXUNUSED(wnd
),
2359 const wxString
& label
,
2360 const wxBitmap
& bitmap
,
2362 int* small_begin_need_separator
,
2363 int* small_must_have_separator
,
2368 if((m_flags
& wxRIBBON_BAR_SHOW_PAGE_LABELS
) && !label
.IsEmpty())
2370 dc
.SetFont(m_tab_label_font
);
2371 width
+= dc
.GetTextExtent(label
).GetWidth();
2372 min
+= wxMin(25, width
); // enough for a few chars
2375 // gap between label and bitmap
2380 if((m_flags
& wxRIBBON_BAR_SHOW_PAGE_ICONS
) && bitmap
.IsOk())
2382 width
+= bitmap
.GetWidth();
2383 min
+= bitmap
.GetWidth();
2388 *ideal
= width
+ 30;
2390 if(small_begin_need_separator
!= NULL
)
2392 *small_begin_need_separator
= width
+ 20;
2394 if(small_must_have_separator
!= NULL
)
2396 *small_must_have_separator
= width
+ 10;
2404 int wxRibbonMSWArtProvider::GetTabCtrlHeight(
2406 wxWindow
* WXUNUSED(wnd
),
2407 const wxRibbonPageTabInfoArray
& pages
)
2409 int text_height
= 0;
2410 int icon_height
= 0;
2412 if(pages
.GetCount() <= 1 && (m_flags
& wxRIBBON_BAR_ALWAYS_SHOW_TABS
) == 0)
2414 // To preserve space, a single tab need not be displayed. We still need
2415 // two pixels of border / padding though.
2419 if(m_flags
& wxRIBBON_BAR_SHOW_PAGE_LABELS
)
2421 dc
.SetFont(m_tab_label_font
);
2422 text_height
= dc
.GetTextExtent(wxT("ABCDEFXj")).GetHeight() + 10;
2424 if(m_flags
& wxRIBBON_BAR_SHOW_PAGE_ICONS
)
2426 size_t numpages
= pages
.GetCount();
2427 for(size_t i
= 0; i
< numpages
; ++i
)
2429 const wxRibbonPageTabInfo
& info
= pages
.Item(i
);
2430 if(info
.page
->GetIcon().IsOk())
2432 icon_height
= wxMax(icon_height
, info
.page
->GetIcon().GetHeight() + 4);
2437 return wxMax(text_height
, icon_height
);
2440 wxSize
wxRibbonMSWArtProvider::GetScrollButtonMinimumSize(
2442 wxWindow
* WXUNUSED(wnd
),
2443 long WXUNUSED(style
))
2445 return wxSize(12, 12);
2448 wxSize
wxRibbonMSWArtProvider::GetPanelSize(
2450 const wxRibbonPanel
* wnd
,
2452 wxPoint
* client_offset
)
2454 dc
.SetFont(m_panel_label_font
);
2455 wxSize label_size
= dc
.GetTextExtent(wnd
->GetLabel());
2457 client_size
.IncBy(0, label_size
.GetHeight());
2458 if(m_flags
& wxRIBBON_BAR_FLOW_VERTICAL
)
2459 client_size
.IncBy(4, 8);
2461 client_size
.IncBy(6, 6);
2463 if(client_offset
!= NULL
)
2465 if(m_flags
& wxRIBBON_BAR_FLOW_VERTICAL
)
2466 *client_offset
= wxPoint(2, 3);
2468 *client_offset
= wxPoint(3, 2);
2474 wxSize
wxRibbonMSWArtProvider::GetPanelClientSize(
2476 const wxRibbonPanel
* wnd
,
2478 wxPoint
* client_offset
)
2480 dc
.SetFont(m_panel_label_font
);
2481 wxSize label_size
= dc
.GetTextExtent(wnd
->GetLabel());
2483 size
.DecBy(0, label_size
.GetHeight());
2484 if(m_flags
& wxRIBBON_BAR_FLOW_VERTICAL
)
2489 if(client_offset
!= NULL
)
2491 if(m_flags
& wxRIBBON_BAR_FLOW_VERTICAL
)
2492 *client_offset
= wxPoint(2, 3);
2494 *client_offset
= wxPoint(3, 2);
2496 if (size
.x
< 0) size
.x
= 0;
2497 if (size
.y
< 0) size
.y
= 0;
2502 wxSize
wxRibbonMSWArtProvider::GetGallerySize(
2504 const wxRibbonGallery
* WXUNUSED(wnd
),
2507 client_size
.IncBy( 2, 1); // Left / top padding
2508 if(m_flags
& wxRIBBON_BAR_FLOW_VERTICAL
)
2509 client_size
.IncBy(1, 16); // Right / bottom padding
2511 client_size
.IncBy(16, 1); // Right / bottom padding
2515 wxSize
wxRibbonMSWArtProvider::GetGalleryClientSize(
2517 const wxRibbonGallery
* WXUNUSED(wnd
),
2519 wxPoint
* client_offset
,
2520 wxRect
* scroll_up_button
,
2521 wxRect
* scroll_down_button
,
2522 wxRect
* extension_button
)
2527 if(m_flags
& wxRIBBON_BAR_FLOW_VERTICAL
)
2529 // Flow is vertical - put buttons on bottom
2530 scroll_up
.y
= size
.GetHeight() - 15;
2531 scroll_up
.height
= 15;
2533 scroll_up
.width
= (size
.GetWidth() + 2) / 3;
2534 scroll_down
.y
= scroll_up
.y
;
2535 scroll_down
.height
= scroll_up
.height
;
2536 scroll_down
.x
= scroll_up
.x
+ scroll_up
.width
;
2537 scroll_down
.width
= scroll_up
.width
;
2538 extension
.y
= scroll_down
.y
;
2539 extension
.height
= scroll_down
.height
;
2540 extension
.x
= scroll_down
.x
+ scroll_down
.width
;
2541 extension
.width
= size
.GetWidth() - scroll_up
.width
- scroll_down
.width
;
2547 // Flow is horizontal - put buttons on right
2548 scroll_up
.x
= size
.GetWidth() - 15;
2549 scroll_up
.width
= 15;
2551 scroll_up
.height
= (size
.GetHeight() + 2) / 3;
2552 scroll_down
.x
= scroll_up
.x
;
2553 scroll_down
.width
= scroll_up
.width
;
2554 scroll_down
.y
= scroll_up
.y
+ scroll_up
.height
;
2555 scroll_down
.height
= scroll_up
.height
;
2556 extension
.x
= scroll_down
.x
;
2557 extension
.width
= scroll_down
.width
;
2558 extension
.y
= scroll_down
.y
+ scroll_down
.height
;
2559 extension
.height
= size
.GetHeight() - scroll_up
.height
- scroll_down
.height
;
2564 if(client_offset
!= NULL
)
2565 *client_offset
= wxPoint(2, 1);
2566 if(scroll_up_button
!= NULL
)
2567 *scroll_up_button
= scroll_up
;
2568 if(scroll_down_button
!= NULL
)
2569 *scroll_down_button
= scroll_down
;
2570 if(extension_button
!= NULL
)
2571 *extension_button
= extension
;
2576 wxRect
wxRibbonMSWArtProvider::GetPageBackgroundRedrawArea(
2578 const wxRibbonPage
* WXUNUSED(wnd
),
2579 wxSize page_old_size
,
2580 wxSize page_new_size
)
2582 wxRect new_rect
, old_rect
;
2584 if(page_new_size
.GetWidth() != page_old_size
.GetWidth())
2586 if(page_new_size
.GetHeight() != page_old_size
.GetHeight())
2588 // Width and height both changed - redraw everything
2589 return wxRect(page_new_size
);
2593 // Only width changed - redraw right hand side
2594 const int right_edge_width
= 4;
2596 new_rect
= wxRect(page_new_size
.GetWidth() - right_edge_width
, 0, right_edge_width
, page_new_size
.GetHeight());
2597 old_rect
= wxRect(page_old_size
.GetWidth() - right_edge_width
, 0, right_edge_width
, page_old_size
.GetHeight());
2602 if(page_new_size
.GetHeight() == page_old_size
.GetHeight())
2604 // Nothing changed (should never happen) - redraw nothing
2605 return wxRect(0, 0, 0, 0);
2609 // Height changed - need to redraw everything (as the background
2610 // gradient is done vertically).
2611 return page_new_size
;
2615 new_rect
.Union(old_rect
);
2616 new_rect
.Intersect(wxRect(page_new_size
));
2620 bool wxRibbonMSWArtProvider::GetButtonBarButtonSize(
2623 wxRibbonButtonKind kind
,
2624 wxRibbonButtonBarButtonState size
,
2625 const wxString
& label
,
2626 wxSize bitmap_size_large
,
2627 wxSize bitmap_size_small
,
2628 wxSize
* button_size
,
2629 wxRect
* normal_region
,
2630 wxRect
* dropdown_region
)
2632 const int drop_button_width
= 8;
2634 dc
.SetFont(m_button_bar_label_font
);
2635 switch(size
& wxRIBBON_BUTTONBAR_BUTTON_SIZE_MASK
)
2637 case wxRIBBON_BUTTONBAR_BUTTON_SMALL
:
2638 // Small bitmap, no label
2639 *button_size
= bitmap_size_small
+ wxSize(6, 4);
2642 case wxRIBBON_BUTTON_NORMAL
:
2643 case wxRIBBON_BUTTON_TOGGLE
:
2644 *normal_region
= wxRect(*button_size
);
2645 *dropdown_region
= wxRect(0, 0, 0, 0);
2647 case wxRIBBON_BUTTON_DROPDOWN
:
2648 *button_size
+= wxSize(drop_button_width
, 0);
2649 *dropdown_region
= wxRect(*button_size
);
2650 *normal_region
= wxRect(0, 0, 0, 0);
2652 case wxRIBBON_BUTTON_HYBRID
:
2653 *normal_region
= wxRect(*button_size
);
2654 *dropdown_region
= wxRect(button_size
->GetWidth(), 0,
2655 drop_button_width
, button_size
->GetHeight());
2656 *button_size
+= wxSize(drop_button_width
, 0);
2660 case wxRIBBON_BUTTONBAR_BUTTON_MEDIUM
:
2661 // Small bitmap, with label to the right
2663 GetButtonBarButtonSize(dc
, wnd
, kind
, wxRIBBON_BUTTONBAR_BUTTON_SMALL
,
2664 label
, bitmap_size_large
, bitmap_size_small
, button_size
,
2665 normal_region
, dropdown_region
);
2666 int text_size
= dc
.GetTextExtent(label
).GetWidth();
2667 button_size
->SetWidth(button_size
->GetWidth() + text_size
);
2670 case wxRIBBON_BUTTON_DROPDOWN
:
2671 dropdown_region
->SetWidth(dropdown_region
->GetWidth() + text_size
);
2673 case wxRIBBON_BUTTON_HYBRID
:
2674 dropdown_region
->SetX(dropdown_region
->GetX() + text_size
);
2676 case wxRIBBON_BUTTON_NORMAL
:
2677 case wxRIBBON_BUTTON_TOGGLE
:
2678 normal_region
->SetWidth(normal_region
->GetWidth() + text_size
);
2683 case wxRIBBON_BUTTONBAR_BUTTON_LARGE
:
2684 // Large bitmap, with label below (possibly split over 2 lines)
2686 wxSize
icon_size(bitmap_size_large
);
2687 icon_size
+= wxSize(4, 4);
2688 wxCoord label_height
;
2690 dc
.GetTextExtent(label
, &best_width
, &label_height
);
2691 int last_line_extra_width
= 0;
2692 if(kind
!= wxRIBBON_BUTTON_NORMAL
&& kind
!= wxRIBBON_BUTTON_TOGGLE
)
2694 last_line_extra_width
+= 8;
2697 for(i
= 0; i
< label
.Len(); ++i
)
2699 if(wxRibbonCanLabelBreakAtPosition(label
, i
))
2702 dc
.GetTextExtent(label
.Mid(0, i
- 1)).GetWidth(),
2703 dc
.GetTextExtent(label
.Mid(i
+ 1)).GetWidth() + last_line_extra_width
);
2704 if(width
< best_width
)
2710 label_height
*= 2; // Assume two lines even when only one is used
2711 // (to give all buttons a consistent height)
2712 icon_size
.SetWidth(wxMax(icon_size
.GetWidth(), best_width
) + 6);
2713 icon_size
.SetHeight(icon_size
.GetHeight() + label_height
);
2714 *button_size
= icon_size
;
2717 case wxRIBBON_BUTTON_DROPDOWN
:
2718 *dropdown_region
= wxRect(icon_size
);
2720 case wxRIBBON_BUTTON_HYBRID
:
2721 *normal_region
= wxRect(icon_size
);
2722 normal_region
->height
-= 2 + label_height
;
2723 dropdown_region
->x
= 0;
2724 dropdown_region
->y
= normal_region
->height
;
2725 dropdown_region
->width
= icon_size
.GetWidth();
2726 dropdown_region
->height
= icon_size
.GetHeight() - normal_region
->height
;
2728 case wxRIBBON_BUTTON_NORMAL
:
2729 case wxRIBBON_BUTTON_TOGGLE
:
2730 *normal_region
= wxRect(icon_size
);
2739 wxSize
wxRibbonMSWArtProvider::GetMinimisedPanelMinimumSize(
2741 const wxRibbonPanel
* wnd
,
2742 wxSize
* desired_bitmap_size
,
2743 wxDirection
* expanded_panel_direction
)
2745 if(desired_bitmap_size
!= NULL
)
2747 *desired_bitmap_size
= wxSize(16, 16);
2749 if(expanded_panel_direction
!= NULL
)
2751 if(m_flags
& wxRIBBON_BAR_FLOW_VERTICAL
)
2752 *expanded_panel_direction
= wxEAST
;
2754 *expanded_panel_direction
= wxSOUTH
;
2756 wxSize
base_size(42, 42);
2758 dc
.SetFont(m_panel_label_font
);
2759 wxSize
label_size(dc
.GetTextExtent(wnd
->GetLabel()));
2760 label_size
.IncBy(2, 2); // Allow for differences between this DC and a paint DC
2761 label_size
.IncBy(6, 0); // Padding
2762 label_size
.y
*= 2; // Second line for dropdown button
2764 if(m_flags
& wxRIBBON_BAR_FLOW_VERTICAL
)
2766 // Label alongside icon
2767 return wxSize(base_size
.x
+ label_size
.x
,
2768 wxMax(base_size
.y
, label_size
.y
));
2772 // Label beneath icon
2773 return wxSize(wxMax(base_size
.x
, label_size
.x
),
2774 base_size
.y
+ label_size
.y
);
2778 wxSize
wxRibbonMSWArtProvider::GetToolSize(
2780 wxWindow
* WXUNUSED(wnd
),
2782 wxRibbonButtonKind kind
,
2783 bool WXUNUSED(is_first
),
2785 wxRect
* dropdown_region
)
2787 wxSize
size(bitmap_size
);
2791 if(kind
& wxRIBBON_BUTTON_DROPDOWN
)
2796 if(kind
== wxRIBBON_BUTTON_DROPDOWN
)
2797 *dropdown_region
= size
;
2799 *dropdown_region
= wxRect(size
.GetWidth() - 8, 0, 8, size
.GetHeight());
2805 *dropdown_region
= wxRect(0, 0, 0, 0);
2810 #endif // wxUSE_RIBBON