1 ///////////////////////////////////////////////////////////////////////////////
2 // Name: src/ribbon/art_aui.cpp
3 // Purpose: AUI 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"
29 #include "wx/settings.h"
33 #include "wx/msw/private.h"
34 #elif defined(__WXMAC__)
35 #include "wx/osx/private.h"
38 wxRibbonAUIArtProvider::wxRibbonAUIArtProvider()
39 : wxRibbonMSWArtProvider(false)
41 #if defined( __WXMAC__ ) && wxOSX_USE_COCOA_OR_CARBON
42 wxColor base_colour
= wxColour( wxMacCreateCGColorFromHITheme(kThemeBrushToolbarBackground
));
44 wxColor base_colour
= wxSystemSettings::GetColour(wxSYS_COLOUR_3DFACE
);
47 SetColourScheme(base_colour
,
48 wxSystemSettings::GetColour(wxSYS_COLOUR_HIGHLIGHT
),
49 wxSystemSettings::GetColour(wxSYS_COLOUR_HIGHLIGHTTEXT
));
51 m_tab_active_label_font
= m_tab_label_font
;
52 m_tab_active_label_font
.SetWeight(wxFONTWEIGHT_BOLD
);
54 m_page_border_left
= 1;
55 m_page_border_right
= 1;
56 m_page_border_top
= 1;
57 m_page_border_bottom
= 2;
58 m_tab_separation_size
= 0;
60 m_gallery_bitmap_padding_left_size
= 3;
61 m_gallery_bitmap_padding_right_size
= 3;
62 m_gallery_bitmap_padding_top_size
= 3;
63 m_gallery_bitmap_padding_bottom_size
= 3;
66 wxRibbonAUIArtProvider::~wxRibbonAUIArtProvider()
70 wxRibbonArtProvider
* wxRibbonAUIArtProvider::Clone() const
72 wxRibbonAUIArtProvider
*copy
= new wxRibbonAUIArtProvider();
75 copy
->m_tab_ctrl_background_colour
= m_tab_ctrl_background_colour
;
76 copy
->m_tab_ctrl_background_gradient_colour
= m_tab_ctrl_background_gradient_colour
;
77 copy
->m_panel_label_background_colour
= m_panel_label_background_colour
;
78 copy
->m_panel_label_background_gradient_colour
= m_panel_label_background_gradient_colour
;
79 copy
->m_panel_hover_label_background_colour
= m_panel_hover_label_background_colour
;
80 copy
->m_panel_hover_label_background_gradient_colour
= m_panel_hover_label_background_gradient_colour
;
82 copy
->m_background_brush
= m_background_brush
;
83 copy
->m_tab_active_top_background_brush
= m_tab_active_top_background_brush
;
84 copy
->m_tab_hover_background_brush
= m_tab_hover_background_brush
;
85 copy
->m_button_bar_hover_background_brush
= m_button_bar_hover_background_brush
;
86 copy
->m_button_bar_active_background_brush
= m_button_bar_active_background_brush
;
87 copy
->m_gallery_button_active_background_brush
= m_gallery_button_active_background_brush
;
88 copy
->m_gallery_button_hover_background_brush
= m_gallery_button_hover_background_brush
;
89 copy
->m_gallery_button_disabled_background_brush
= m_gallery_button_disabled_background_brush
;
91 copy
->m_toolbar_hover_borden_pen
= m_toolbar_hover_borden_pen
;
92 copy
->m_tool_hover_background_brush
= m_tool_hover_background_brush
;
93 copy
->m_tool_active_background_brush
= m_tool_active_background_brush
;
98 void wxRibbonAUIArtProvider::SetFont(int id
, const wxFont
& font
)
100 wxRibbonMSWArtProvider::SetFont(id
, font
);
101 if(id
== wxRIBBON_ART_TAB_LABEL_FONT
)
103 m_tab_active_label_font
= m_tab_label_font
;
104 m_tab_active_label_font
.SetWeight(wxFONTWEIGHT_BOLD
);
108 wxColour
wxRibbonAUIArtProvider::GetColour(int id
) const
112 case wxRIBBON_ART_PAGE_BACKGROUND_COLOUR
:
113 case wxRIBBON_ART_PAGE_BACKGROUND_GRADIENT_COLOUR
:
114 return m_background_brush
.GetColour();
115 case wxRIBBON_ART_TAB_CTRL_BACKGROUND_COLOUR
:
116 return m_tab_ctrl_background_colour
;
117 case wxRIBBON_ART_TAB_CTRL_BACKGROUND_GRADIENT_COLOUR
:
118 return m_tab_ctrl_background_gradient_colour
;
119 case wxRIBBON_ART_TAB_ACTIVE_BACKGROUND_TOP_COLOUR
:
120 case wxRIBBON_ART_TAB_ACTIVE_BACKGROUND_TOP_GRADIENT_COLOUR
:
121 return m_tab_active_top_background_brush
.GetColour();
122 case wxRIBBON_ART_TAB_HOVER_BACKGROUND_COLOUR
:
123 case wxRIBBON_ART_TAB_HOVER_BACKGROUND_GRADIENT_COLOUR
:
124 return m_tab_hover_background_brush
.GetColour();
125 case wxRIBBON_ART_PANEL_LABEL_BACKGROUND_COLOUR
:
126 return m_panel_label_background_colour
;
127 case wxRIBBON_ART_PANEL_LABEL_BACKGROUND_GRADIENT_COLOUR
:
128 return m_panel_label_background_gradient_colour
;
129 case wxRIBBON_ART_PANEL_HOVER_LABEL_BACKGROUND_COLOUR
:
130 return m_panel_hover_label_background_colour
;
131 case wxRIBBON_ART_PANEL_HOVER_LABEL_BACKGROUND_GRADIENT_COLOUR
:
132 return m_panel_hover_label_background_gradient_colour
;
133 case wxRIBBON_ART_BUTTON_BAR_HOVER_BACKGROUND_COLOUR
:
134 case wxRIBBON_ART_BUTTON_BAR_HOVER_BACKGROUND_GRADIENT_COLOUR
:
135 return m_button_bar_hover_background_brush
.GetColour();
136 case wxRIBBON_ART_GALLERY_BUTTON_HOVER_BACKGROUND_COLOUR
:
137 case wxRIBBON_ART_GALLERY_BUTTON_HOVER_BACKGROUND_GRADIENT_COLOUR
:
138 return m_gallery_button_hover_background_brush
.GetColour();
139 case wxRIBBON_ART_GALLERY_BUTTON_ACTIVE_BACKGROUND_COLOUR
:
140 case wxRIBBON_ART_GALLERY_BUTTON_ACTIVE_BACKGROUND_GRADIENT_COLOUR
:
141 return m_gallery_button_active_background_brush
.GetColour();
142 case wxRIBBON_ART_GALLERY_BUTTON_DISABLED_BACKGROUND_COLOUR
:
143 case wxRIBBON_ART_GALLERY_BUTTON_DISABLED_BACKGROUND_GRADIENT_COLOUR
:
144 return m_gallery_button_disabled_background_brush
.GetColour();
146 return wxRibbonMSWArtProvider::GetColour(id
);
150 void wxRibbonAUIArtProvider::SetColour(int id
, const wxColor
& colour
)
154 case wxRIBBON_ART_PAGE_BACKGROUND_COLOUR
:
155 case wxRIBBON_ART_PAGE_BACKGROUND_GRADIENT_COLOUR
:
156 m_background_brush
.SetColour(colour
);
158 case wxRIBBON_ART_TAB_CTRL_BACKGROUND_COLOUR
:
159 m_tab_ctrl_background_colour
= colour
;
161 case wxRIBBON_ART_TAB_CTRL_BACKGROUND_GRADIENT_COLOUR
:
162 m_tab_ctrl_background_gradient_colour
= colour
;
164 case wxRIBBON_ART_TAB_ACTIVE_BACKGROUND_TOP_COLOUR
:
165 case wxRIBBON_ART_TAB_ACTIVE_BACKGROUND_TOP_GRADIENT_COLOUR
:
166 m_tab_active_top_background_brush
.SetColour(colour
);
168 case wxRIBBON_ART_TAB_HOVER_BACKGROUND_COLOUR
:
169 case wxRIBBON_ART_TAB_HOVER_BACKGROUND_GRADIENT_COLOUR
:
170 m_tab_hover_background_brush
.SetColour(colour
);
172 case wxRIBBON_ART_PANEL_LABEL_BACKGROUND_COLOUR
:
173 m_panel_label_background_colour
= colour
;
175 case wxRIBBON_ART_PANEL_LABEL_BACKGROUND_GRADIENT_COLOUR
:
176 m_panel_label_background_gradient_colour
= colour
;
178 case wxRIBBON_ART_BUTTON_BAR_HOVER_BACKGROUND_COLOUR
:
179 case wxRIBBON_ART_BUTTON_BAR_HOVER_BACKGROUND_GRADIENT_COLOUR
:
180 m_button_bar_hover_background_brush
.SetColour(colour
);
182 case wxRIBBON_ART_GALLERY_BUTTON_HOVER_BACKGROUND_COLOUR
:
183 case wxRIBBON_ART_GALLERY_BUTTON_HOVER_BACKGROUND_GRADIENT_COLOUR
:
184 m_gallery_button_hover_background_brush
.SetColour(colour
);
186 case wxRIBBON_ART_GALLERY_BUTTON_ACTIVE_BACKGROUND_COLOUR
:
187 case wxRIBBON_ART_GALLERY_BUTTON_ACTIVE_BACKGROUND_GRADIENT_COLOUR
:
188 m_gallery_button_active_background_brush
.SetColour(colour
);
190 case wxRIBBON_ART_GALLERY_BUTTON_DISABLED_BACKGROUND_COLOUR
:
191 case wxRIBBON_ART_GALLERY_BUTTON_DISABLED_BACKGROUND_GRADIENT_COLOUR
:
192 m_gallery_button_disabled_background_brush
.SetColour(colour
);
195 wxRibbonMSWArtProvider::SetColour(id
, colour
);
200 void wxRibbonAUIArtProvider::SetColourScheme(
201 const wxColour
& primary
,
202 const wxColour
& secondary
,
203 const wxColour
& tertiary
)
205 wxRibbonHSLColour
primary_hsl(primary
);
206 wxRibbonHSLColour
secondary_hsl(secondary
);
207 wxRibbonHSLColour
tertiary_hsl(tertiary
);
209 // Map primary & secondary luminance from [0, 1] to [0.15, 0.85]
210 primary_hsl
.luminance
= cos(primary_hsl
.luminance
* M_PI
) * -0.35 + 0.5;
211 secondary_hsl
.luminance
= cos(secondary_hsl
.luminance
* M_PI
) * -0.35 + 0.5;
213 // TODO: Remove next line once this provider stops piggybacking MSW
214 wxRibbonMSWArtProvider::SetColourScheme(primary
, secondary
, tertiary
);
216 #define LikePrimary(luminance) \
217 wxRibbonShiftLuminance(primary_hsl, luminance ## f).ToRGB()
218 #define LikeSecondary(luminance) \
219 wxRibbonShiftLuminance(secondary_hsl, luminance ## f).ToRGB()
221 m_tab_ctrl_background_colour
= LikePrimary(0.9);
222 m_tab_ctrl_background_gradient_colour
= LikePrimary(1.7);
223 m_tab_border_pen
= LikePrimary(0.75);
224 m_tab_label_colour
= LikePrimary(0.1);
225 m_tab_hover_background_top_colour
= primary_hsl
.ToRGB();
226 m_tab_hover_background_top_gradient_colour
= LikePrimary(1.6);
227 m_tab_hover_background_brush
= m_tab_hover_background_top_colour
;
228 m_tab_active_background_colour
= m_tab_ctrl_background_gradient_colour
;
229 m_tab_active_background_gradient_colour
= primary_hsl
.ToRGB();
230 m_tab_active_top_background_brush
= m_tab_active_background_colour
;
231 m_panel_label_colour
= m_tab_label_colour
;
232 m_panel_minimised_label_colour
= m_panel_label_colour
;
233 m_panel_hover_label_colour
= tertiary_hsl
.ToRGB();
234 m_page_border_pen
= m_tab_border_pen
;
235 m_panel_border_pen
= m_tab_border_pen
;
236 m_background_brush
= primary_hsl
.ToRGB();
237 m_page_hover_background_colour
= LikePrimary(1.5);
238 m_page_hover_background_gradient_colour
= LikePrimary(0.9);
239 m_panel_label_background_colour
= LikePrimary(0.85);
240 m_panel_label_background_gradient_colour
= LikePrimary(0.97);
241 m_panel_hover_label_background_gradient_colour
= secondary_hsl
.ToRGB();
242 m_panel_hover_label_background_colour
= secondary_hsl
.Lighter(0.2f
).ToRGB();
243 m_button_bar_hover_border_pen
= secondary_hsl
.ToRGB();
244 m_button_bar_hover_background_brush
= LikeSecondary(1.7);
245 m_button_bar_active_background_brush
= LikeSecondary(1.4);
246 m_button_bar_label_colour
= m_tab_label_colour
;
247 m_button_bar_label_disabled_colour
= m_tab_label_colour
;
248 m_gallery_border_pen
= m_tab_border_pen
;
249 m_gallery_item_border_pen
= m_button_bar_hover_border_pen
;
250 m_gallery_hover_background_brush
= LikePrimary(1.2);
251 m_gallery_button_background_colour
= m_page_hover_background_colour
;
252 m_gallery_button_background_gradient_colour
= m_page_hover_background_gradient_colour
;
253 m_gallery_button_hover_background_brush
= m_button_bar_hover_background_brush
;
254 m_gallery_button_active_background_brush
= m_button_bar_active_background_brush
;
255 m_gallery_button_disabled_background_brush
= primary_hsl
.Desaturated(0.15f
).ToRGB();
256 SetColour(wxRIBBON_ART_GALLERY_BUTTON_FACE_COLOUR
, LikePrimary(0.1));
257 SetColour(wxRIBBON_ART_GALLERY_BUTTON_DISABLED_FACE_COLOUR
, wxColour(128, 128, 128));
258 SetColour(wxRIBBON_ART_GALLERY_BUTTON_ACTIVE_FACE_COLOUR
, LikeSecondary(0.1));
259 SetColour(wxRIBBON_ART_GALLERY_BUTTON_HOVER_FACE_COLOUR
, LikeSecondary(0.1));
260 m_toolbar_border_pen
= m_tab_border_pen
;
261 SetColour(wxRIBBON_ART_TOOLBAR_FACE_COLOUR
, LikePrimary(0.1));
262 m_tool_background_colour
= m_page_hover_background_colour
;
263 m_tool_background_gradient_colour
= m_page_hover_background_gradient_colour
;
264 m_toolbar_hover_borden_pen
= m_button_bar_hover_border_pen
;
265 m_tool_hover_background_brush
= m_button_bar_hover_background_brush
;
266 m_tool_active_background_brush
= m_button_bar_active_background_brush
;
272 void wxRibbonAUIArtProvider::DrawTabCtrlBackground(
274 wxWindow
* WXUNUSED(wnd
),
277 wxRect
gradient_rect(rect
);
278 gradient_rect
.height
--;
279 dc
.GradientFillLinear(gradient_rect
, m_tab_ctrl_background_colour
,
280 m_tab_ctrl_background_gradient_colour
, wxSOUTH
);
281 dc
.SetPen(m_tab_border_pen
);
282 dc
.DrawLine(rect
.x
, rect
.GetBottom(), rect
.GetRight()+1, rect
.GetBottom());
285 int wxRibbonAUIArtProvider::GetTabCtrlHeight(
287 wxWindow
* WXUNUSED(wnd
),
288 const wxRibbonPageTabInfoArray
& pages
)
293 if(pages
.GetCount() <= 1 && (m_flags
& wxRIBBON_BAR_ALWAYS_SHOW_TABS
) == 0)
295 // To preserve space, a single tab need not be displayed. We still need
296 // one pixel of border though.
300 if(m_flags
& wxRIBBON_BAR_SHOW_PAGE_LABELS
)
302 dc
.SetFont(m_tab_active_label_font
);
303 text_height
= dc
.GetTextExtent(wxT("ABCDEFXj")).GetHeight();
305 if(m_flags
& wxRIBBON_BAR_SHOW_PAGE_ICONS
)
307 size_t numpages
= pages
.GetCount();
308 for(size_t i
= 0; i
< numpages
; ++i
)
310 const wxRibbonPageTabInfo
& info
= pages
.Item(i
);
311 if(info
.page
->GetIcon().IsOk())
313 icon_height
= wxMax(icon_height
, info
.page
->GetIcon().GetHeight());
318 return wxMax(text_height
, icon_height
) + 10;
321 void wxRibbonAUIArtProvider::DrawTab(wxDC
& dc
,
322 wxWindow
* WXUNUSED(wnd
),
323 const wxRibbonPageTabInfo
& tab
)
325 if(tab
.rect
.height
<= 1)
328 dc
.SetFont(m_tab_label_font
);
329 dc
.SetPen(*wxTRANSPARENT_PEN
);
330 if(tab
.active
|| tab
.hovered
|| tab
.highlight
)
334 dc
.SetFont(m_tab_active_label_font
);
335 dc
.SetBrush(m_background_brush
);
336 dc
.DrawRectangle(tab
.rect
.x
, tab
.rect
.y
+ tab
.rect
.height
- 1,
337 tab
.rect
.width
- 1, 1);
339 wxRect
grad_rect(tab
.rect
);
340 grad_rect
.height
-= 4;
341 grad_rect
.width
-= 1;
342 grad_rect
.height
/= 2;
343 grad_rect
.y
= grad_rect
.y
+ tab
.rect
.height
- grad_rect
.height
- 1;
344 dc
.SetBrush(m_tab_active_top_background_brush
);
345 dc
.DrawRectangle(tab
.rect
.x
, tab
.rect
.y
+ 3, tab
.rect
.width
- 1,
346 grad_rect
.y
- tab
.rect
.y
- 3);
349 wxColour
top_colour((m_tab_active_background_colour
.Red() + m_tab_hover_background_top_colour
.Red())/2,
350 (m_tab_active_background_colour
.Green() + m_tab_hover_background_top_colour
.Green())/2,
351 (m_tab_active_background_colour
.Blue() + m_tab_hover_background_top_colour
.Blue())/2);
353 wxColour
bottom_colour((m_tab_active_background_gradient_colour
.Red() + m_tab_hover_background_top_gradient_colour
.Red())/2,
354 (m_tab_active_background_gradient_colour
.Green() + m_tab_hover_background_top_gradient_colour
.Green())/2,
355 (m_tab_active_background_gradient_colour
.Blue() + m_tab_hover_background_top_gradient_colour
.Blue())/2);
357 dc
.GradientFillLinear(grad_rect
, top_colour
,
358 bottom_colour
, wxSOUTH
);
362 dc
.GradientFillLinear(grad_rect
, m_tab_active_background_colour
,
363 m_tab_active_background_gradient_colour
, wxSOUTH
);
368 wxRect
btm_rect(tab
.rect
);
369 btm_rect
.height
-= 4;
371 btm_rect
.height
/= 2;
372 btm_rect
.y
= btm_rect
.y
+ tab
.rect
.height
- btm_rect
.height
- 1;
373 dc
.SetBrush(m_tab_hover_background_brush
);
374 dc
.DrawRectangle(btm_rect
.x
, btm_rect
.y
, btm_rect
.width
,
376 wxRect
grad_rect(tab
.rect
);
377 grad_rect
.width
-= 1;
379 grad_rect
.height
= btm_rect
.y
- grad_rect
.y
;
380 dc
.GradientFillLinear(grad_rect
, m_tab_hover_background_top_colour
,
381 m_tab_hover_background_top_gradient_colour
, wxSOUTH
);
384 wxPoint border_points
[5];
385 border_points
[0] = wxPoint(0, 3);
386 border_points
[1] = wxPoint(1, 2);
387 border_points
[2] = wxPoint(tab
.rect
.width
- 3, 2);
388 border_points
[3] = wxPoint(tab
.rect
.width
- 1, 4);
389 border_points
[4] = wxPoint(tab
.rect
.width
- 1, tab
.rect
.height
- 1);
391 dc
.SetPen(m_tab_border_pen
);
392 dc
.DrawLines(sizeof(border_points
)/sizeof(wxPoint
), border_points
, tab
.rect
.x
, tab
.rect
.y
);
395 dc
.GetClippingBox(old_clip
);
396 bool is_first_tab
= false;
397 wxRibbonBar
* bar
= wxDynamicCast(tab
.page
->GetParent(), wxRibbonBar
);
398 if(bar
&& bar
->GetPage(0) == tab
.page
)
402 if(m_flags
& wxRIBBON_BAR_SHOW_PAGE_ICONS
)
404 icon
= tab
.page
->GetIcon();
405 if((m_flags
& wxRIBBON_BAR_SHOW_PAGE_LABELS
) == 0)
409 int x
= tab
.rect
.x
+ (tab
.rect
.width
- icon
.GetWidth()) / 2;
410 dc
.DrawBitmap(icon
, x
, tab
.rect
.y
+ 1 + (tab
.rect
.height
- 1 -
411 icon
.GetHeight()) / 2, true);
415 if(m_flags
& wxRIBBON_BAR_SHOW_PAGE_LABELS
)
417 wxString label
= tab
.page
->GetLabel();
420 dc
.SetTextForeground(m_tab_label_colour
);
421 dc
.SetBackgroundMode(wxTRANSPARENT
);
425 offset
+= icon
.GetWidth() + 2;
428 dc
.GetTextExtent(label
, &text_width
, &text_height
);
429 int x
= (tab
.rect
.width
- 2 - text_width
- offset
) / 2;
434 int width
= tab
.rect
.width
- x
- 2;
435 x
+= tab
.rect
.x
+ offset
;
436 int y
= tab
.rect
.y
+ (tab
.rect
.height
- text_height
) / 2;
439 dc
.DrawBitmap(icon
, x
- offset
, tab
.rect
.y
+ (tab
.rect
.height
-
440 icon
.GetHeight()) / 2, true);
442 dc
.SetClippingRegion(x
, tab
.rect
.y
, width
, tab
.rect
.height
);
443 dc
.DrawText(label
, x
, y
);
447 // Draw the left hand edge of the tab only for the first tab (subsequent
448 // tabs use the right edge of the prior tab as their left edge). As this is
449 // outside the rectangle for the tab, only draw it if the leftmost part of
450 // the tab is within the clip rectangle (the clip region has to be cleared
451 // to draw outside the tab).
452 if(is_first_tab
&& old_clip
.x
<= tab
.rect
.x
453 && tab
.rect
.x
< old_clip
.x
+ old_clip
.width
)
455 dc
.DestroyClippingRegion();
456 dc
.DrawLine(tab
.rect
.x
- 1, tab
.rect
.y
+ 4, tab
.rect
.x
- 1,
457 tab
.rect
.y
+ tab
.rect
.height
- 1);
461 void wxRibbonAUIArtProvider::GetBarTabWidth(
463 wxWindow
* WXUNUSED(wnd
),
464 const wxString
& label
,
465 const wxBitmap
& bitmap
,
467 int* small_begin_need_separator
,
468 int* small_must_have_separator
,
473 if((m_flags
& wxRIBBON_BAR_SHOW_PAGE_LABELS
) && !label
.IsEmpty())
475 dc
.SetFont(m_tab_active_label_font
);
476 width
+= dc
.GetTextExtent(label
).GetWidth();
477 min
+= wxMin(30, width
); // enough for a few chars
480 // gap between label and bitmap
485 if((m_flags
& wxRIBBON_BAR_SHOW_PAGE_ICONS
) && bitmap
.IsOk())
487 width
+= bitmap
.GetWidth();
488 min
+= bitmap
.GetWidth();
495 if(small_begin_need_separator
!= NULL
)
497 *small_begin_need_separator
= min
;
499 if(small_must_have_separator
!= NULL
)
501 *small_must_have_separator
= min
;
509 void wxRibbonAUIArtProvider::DrawTabSeparator(
511 wxWindow
* WXUNUSED(wnd
),
512 const wxRect
& WXUNUSED(rect
),
513 double WXUNUSED(visibility
))
515 // No explicit separators between tabs
518 void wxRibbonAUIArtProvider::DrawPageBackground(
520 wxWindow
* WXUNUSED(wnd
),
523 dc
.SetPen(*wxTRANSPARENT_PEN
);
524 dc
.SetBrush(m_background_brush
);
525 dc
.DrawRectangle(rect
.x
+ 1, rect
.y
, rect
.width
- 2, rect
.height
- 1);
527 dc
.SetPen(m_page_border_pen
);
528 dc
.DrawLine(rect
.x
, rect
.y
, rect
.x
, rect
.y
+ rect
.height
);
529 dc
.DrawLine(rect
.GetRight(), rect
.y
, rect
.GetRight(), rect
.y
+rect
.height
);
530 dc
.DrawLine(rect
.x
, rect
.GetBottom(), rect
.GetRight()+1, rect
.GetBottom());
533 wxSize
wxRibbonAUIArtProvider::GetScrollButtonMinimumSize(
535 wxWindow
* WXUNUSED(wnd
),
536 long WXUNUSED(style
))
538 return wxSize(11, 11);
541 void wxRibbonAUIArtProvider::DrawScrollButton(
543 wxWindow
* WXUNUSED(wnd
),
547 wxRect
true_rect(rect
);
548 wxPoint arrow_points
[3];
550 if((style
& wxRIBBON_SCROLL_BTN_FOR_MASK
) == wxRIBBON_SCROLL_BTN_FOR_TABS
)
553 true_rect
.height
-= 2;
554 dc
.SetPen(m_tab_border_pen
);
558 dc
.SetPen(*wxTRANSPARENT_PEN
);
559 dc
.SetBrush(m_background_brush
);
560 dc
.DrawRectangle(rect
.x
, rect
.y
, rect
.width
, rect
.height
);
561 dc
.SetPen(m_page_border_pen
);
564 switch(style
& wxRIBBON_SCROLL_BTN_DIRECTION_MASK
)
566 case wxRIBBON_SCROLL_BTN_LEFT
:
567 dc
.DrawLine(true_rect
.GetRight(), true_rect
.y
, true_rect
.GetRight(),
568 true_rect
.y
+ true_rect
.height
);
569 arrow_points
[0] = wxPoint(rect
.width
/ 2 - 2, rect
.height
/ 2);
570 arrow_points
[1] = arrow_points
[0] + wxPoint(5, -5);
571 arrow_points
[2] = arrow_points
[0] + wxPoint(5, 5);
573 case wxRIBBON_SCROLL_BTN_RIGHT
:
574 dc
.DrawLine(true_rect
.x
, true_rect
.y
, true_rect
.x
,
575 true_rect
.y
+ true_rect
.height
);
576 arrow_points
[0] = wxPoint(rect
.width
/ 2 + 3, rect
.height
/ 2);
577 arrow_points
[1] = arrow_points
[0] - wxPoint(5, -5);
578 arrow_points
[2] = arrow_points
[0] - wxPoint(5, 5);
580 case wxRIBBON_SCROLL_BTN_DOWN
:
581 dc
.DrawLine(true_rect
.x
, true_rect
.y
, true_rect
.x
+ true_rect
.width
,
583 arrow_points
[0] = wxPoint(rect
.width
/ 2, rect
.height
/ 2 + 3);
584 arrow_points
[1] = arrow_points
[0] - wxPoint( 5, 5);
585 arrow_points
[2] = arrow_points
[0] - wxPoint(-5, 5);
587 case wxRIBBON_SCROLL_BTN_UP
:
588 dc
.DrawLine(true_rect
.x
, true_rect
.GetBottom(),
589 true_rect
.x
+ true_rect
.width
, true_rect
.GetBottom());
590 arrow_points
[0] = wxPoint(rect
.width
/ 2, rect
.height
/ 2 - 2);
591 arrow_points
[1] = arrow_points
[0] + wxPoint( 5, 5);
592 arrow_points
[2] = arrow_points
[0] + wxPoint(-5, 5);
600 if(style
& wxRIBBON_SCROLL_BTN_ACTIVE
)
606 dc
.SetPen(*wxTRANSPARENT_PEN
);
607 wxBrush
B(m_tab_label_colour
);
609 dc
.DrawPolygon(sizeof(arrow_points
)/sizeof(wxPoint
), arrow_points
, x
, y
);
612 wxSize
wxRibbonAUIArtProvider::GetPanelSize(
614 const wxRibbonPanel
* wnd
,
616 wxPoint
* client_offset
)
618 dc
.SetFont(m_panel_label_font
);
619 wxSize label_size
= dc
.GetTextExtent(wnd
->GetLabel());
620 int label_height
= label_size
.GetHeight() + 5;
621 if(m_flags
& wxRIBBON_BAR_FLOW_VERTICAL
)
623 client_size
.IncBy(4, label_height
+ 6);
625 *client_offset
= wxPoint(2, label_height
+ 3);
629 client_size
.IncBy(6, label_height
+ 4);
631 *client_offset
= wxPoint(3, label_height
+ 2);
636 wxSize
wxRibbonAUIArtProvider::GetPanelClientSize(
638 const wxRibbonPanel
* wnd
,
640 wxPoint
* client_offset
)
642 dc
.SetFont(m_panel_label_font
);
643 wxSize label_size
= dc
.GetTextExtent(wnd
->GetLabel());
644 int label_height
= label_size
.GetHeight() + 5;
645 if(m_flags
& wxRIBBON_BAR_FLOW_VERTICAL
)
647 size
.DecBy(4, label_height
+ 6);
649 *client_offset
= wxPoint(2, label_height
+ 3);
653 size
.DecBy(6, label_height
+ 4);
655 *client_offset
= wxPoint(3, label_height
+ 2);
657 if (size
.x
< 0) size
.x
= 0;
658 if (size
.y
< 0) size
.y
= 0;
662 wxRect
wxRibbonAUIArtProvider::GetPanelExtButtonArea(wxDC
& dc
,
663 const wxRibbonPanel
* wnd
,
666 wxRect
true_rect(rect
);
667 RemovePanelPadding(&true_rect
);
670 true_rect
.width
-= 2;
673 dc
.SetFont(m_panel_label_font
);
674 wxSize label_size
= dc
.GetTextExtent(wnd
->GetLabel());
675 int label_height
= label_size
.GetHeight() + 5;
676 wxRect
label_rect(true_rect
);
677 label_rect
.height
= label_height
- 1;
679 rect
= wxRect(label_rect
.GetRight()-13, label_rect
.GetBottom()-13, 13, 13);
683 void wxRibbonAUIArtProvider::DrawPanelBackground(
688 dc
.SetPen(*wxTRANSPARENT_PEN
);
689 dc
.SetBrush(m_background_brush
);
690 dc
.DrawRectangle(rect
.x
, rect
.y
, rect
.width
, rect
.height
);
692 wxRect
true_rect(rect
);
693 RemovePanelPadding(&true_rect
);
695 dc
.SetPen(m_panel_border_pen
);
696 dc
.SetBrush(*wxTRANSPARENT_BRUSH
);
697 dc
.DrawRectangle(true_rect
.x
, true_rect
.y
, true_rect
.width
, true_rect
.height
);
700 true_rect
.width
-= 2;
703 dc
.SetFont(m_panel_label_font
);
704 wxSize label_size
= dc
.GetTextExtent(wnd
->GetLabel());
705 int label_height
= label_size
.GetHeight() + 5;
706 wxRect
label_rect(true_rect
);
707 label_rect
.height
= label_height
- 1;
708 dc
.DrawLine(label_rect
.x
, label_rect
.y
+ label_rect
.height
,
709 label_rect
.x
+ label_rect
.width
, label_rect
.y
+ label_rect
.height
);
711 wxColour label_bg_colour
= m_panel_label_background_colour
;
712 wxColour label_bg_grad_colour
= m_panel_label_background_gradient_colour
;
715 label_bg_colour
= m_panel_hover_label_background_colour
;
716 label_bg_grad_colour
= m_panel_hover_label_background_gradient_colour
;
717 dc
.SetTextForeground(m_panel_hover_label_colour
);
721 dc
.SetTextForeground(m_panel_label_colour
);
723 dc
.GradientFillLinear(label_rect
,
725 label_bg_grad_colour
, label_bg_colour
, wxSOUTH
);
727 label_bg_colour
, label_bg_grad_colour
, wxSOUTH
);
729 dc
.SetFont(m_panel_label_font
);
730 dc
.DrawText(wnd
->GetLabel(), label_rect
.x
+ 3, label_rect
.y
+ 2);
734 wxRect
gradient_rect(true_rect
);
735 gradient_rect
.y
+= label_rect
.height
+ 1;
736 gradient_rect
.height
= true_rect
.height
- label_rect
.height
- 3;
738 wxColour colour
= m_page_hover_background_gradient_colour
;
739 wxColour gradient
= m_page_hover_background_colour
;
741 wxColour colour
= m_page_hover_background_colour
;
742 wxColour gradient
= m_page_hover_background_gradient_colour
;
744 dc
.GradientFillLinear(gradient_rect
, colour
, gradient
, wxSOUTH
);
747 if(wnd
->HasExtButton())
749 if(wnd
->IsExtButtonHovered())
751 dc
.SetPen(m_panel_hover_button_border_pen
);
752 dc
.SetBrush(m_panel_hover_button_background_brush
);
753 dc
.DrawRoundedRectangle(label_rect
.GetRight() - 13, label_rect
.GetBottom() - 13, 13, 13, 1.0);
754 dc
.DrawBitmap(m_panel_extension_bitmap
[1], label_rect
.GetRight() - 10, label_rect
.GetBottom() - 10, true);
757 dc
.DrawBitmap(m_panel_extension_bitmap
[0], label_rect
.GetRight() - 10, label_rect
.GetBottom() - 10, true);
761 void wxRibbonAUIArtProvider::DrawMinimisedPanel(
767 dc
.SetPen(*wxTRANSPARENT_PEN
);
768 dc
.SetBrush(m_background_brush
);
769 dc
.DrawRectangle(rect
.x
, rect
.y
, rect
.width
, rect
.height
);
771 wxRect
true_rect(rect
);
772 RemovePanelPadding(&true_rect
);
774 dc
.SetPen(m_panel_border_pen
);
775 dc
.SetBrush(*wxTRANSPARENT_BRUSH
);
776 dc
.DrawRectangle(true_rect
.x
, true_rect
.y
, true_rect
.width
, true_rect
.height
);
777 true_rect
.Deflate(1);
779 if(wnd
->IsHovered() || wnd
->GetExpandedPanel())
781 wxColour colour
= m_page_hover_background_colour
;
782 wxColour gradient
= m_page_hover_background_gradient_colour
;
784 if(!wnd
->GetExpandedPanel())
786 if(wnd
->GetExpandedPanel())
789 wxColour temp
= colour
;
793 dc
.GradientFillLinear(true_rect
, colour
, gradient
, wxSOUTH
);
797 DrawMinimisedPanelCommon(dc
, wnd
, true_rect
, &preview
);
799 dc
.SetPen(m_panel_border_pen
);
800 dc
.SetBrush(*wxTRANSPARENT_BRUSH
);
801 dc
.DrawRectangle(preview
.x
, preview
.y
, preview
.width
, preview
.height
);
803 wxRect
preview_caption_rect(preview
);
804 preview_caption_rect
.height
= 7;
805 preview
.y
+= preview_caption_rect
.height
;
806 preview
.height
-= preview_caption_rect
.height
;
808 dc
.GradientFillLinear(preview_caption_rect
,
809 m_panel_hover_label_background_gradient_colour
,
810 m_panel_hover_label_background_colour
, wxSOUTH
);
811 dc
.GradientFillLinear(preview
,
812 m_page_hover_background_gradient_colour
,
813 m_page_hover_background_colour
, wxSOUTH
);
815 dc
.GradientFillLinear(preview_caption_rect
,
816 m_panel_hover_label_background_colour
,
817 m_panel_hover_label_background_gradient_colour
, wxSOUTH
);
818 dc
.GradientFillLinear(preview
,
819 m_page_hover_background_colour
,
820 m_page_hover_background_gradient_colour
, wxSOUTH
);
825 dc
.DrawBitmap(bitmap
, preview
.x
+ (preview
.width
- bitmap
.GetWidth()) / 2,
826 preview
.y
+ (preview
.height
- bitmap
.GetHeight()) / 2, true);
830 void wxRibbonAUIArtProvider::DrawPartialPanelBackground(wxDC
& dc
,
831 wxWindow
* wnd
, const wxRect
& rect
)
833 dc
.SetPen(*wxTRANSPARENT_PEN
);
834 dc
.SetBrush(m_background_brush
);
835 dc
.DrawRectangle(rect
.x
, rect
.y
, rect
.width
, rect
.height
);
837 wxPoint
offset(wnd
->GetPosition());
838 wxWindow
* parent
= wnd
->GetParent();
839 wxRibbonPanel
* panel
= NULL
;
841 for(; parent
; parent
= parent
->GetParent())
843 panel
= wxDynamicCast(parent
, wxRibbonPanel
);
846 if(!panel
->IsHovered())
850 offset
+= parent
->GetPosition();
855 wxRect
background(panel
->GetSize());
856 RemovePanelPadding(&background
);
858 background
.width
-= 2;
859 dc
.SetFont(m_panel_label_font
);
860 int caption_height
= dc
.GetTextExtent(panel
->GetLabel()).GetHeight() + 7;
861 background
.y
+= caption_height
- 1;
862 background
.height
-= caption_height
;
864 wxRect
paint_rect(rect
);
865 paint_rect
.x
+= offset
.x
;
866 paint_rect
.y
+= offset
.y
;
868 wxColour bg_clr
, bg_grad_clr
;
870 bg_grad_clr
= m_page_hover_background_colour
;
871 bg_clr
= m_page_hover_background_gradient_colour
;
873 bg_clr
= m_page_hover_background_colour
;
874 bg_grad_clr
= m_page_hover_background_gradient_colour
;
877 paint_rect
.Intersect(background
);
878 if(!paint_rect
.IsEmpty())
880 wxColour
starting_colour(wxRibbonInterpolateColour(bg_clr
, bg_grad_clr
,
881 paint_rect
.y
, background
.y
, background
.y
+ background
.height
));
882 wxColour
ending_colour(wxRibbonInterpolateColour(bg_clr
, bg_grad_clr
,
883 paint_rect
.y
+ paint_rect
.height
, background
.y
,
884 background
.y
+ background
.height
));
885 paint_rect
.x
-= offset
.x
;
886 paint_rect
.y
-= offset
.y
;
887 dc
.GradientFillLinear(paint_rect
, starting_colour
, ending_colour
892 void wxRibbonAUIArtProvider::DrawGalleryBackground(
894 wxRibbonGallery
* wnd
,
897 DrawPartialPanelBackground(dc
, wnd
, rect
);
901 dc
.SetPen(*wxTRANSPARENT_PEN
);
902 dc
.SetBrush(m_gallery_hover_background_brush
);
903 if(m_flags
& wxRIBBON_BAR_FLOW_VERTICAL
)
905 dc
.DrawRectangle(rect
.x
+ 1, rect
.y
+ 1, rect
.width
- 2,
910 dc
.DrawRectangle(rect
.x
+ 1, rect
.y
+ 1, rect
.width
- 16,
915 dc
.SetPen(m_gallery_border_pen
);
916 dc
.SetBrush(*wxTRANSPARENT_BRUSH
);
917 dc
.DrawRectangle(rect
.x
, rect
.y
, rect
.width
, rect
.height
);
919 DrawGalleryBackgroundCommon(dc
, wnd
, rect
);
922 void wxRibbonAUIArtProvider::DrawGalleryButton(wxDC
& dc
, wxRect rect
,
923 wxRibbonGalleryButtonState state
, wxBitmap
* bitmaps
)
925 int extra_height
= 0;
927 wxRect
reduced_rect(rect
);
928 reduced_rect
.Deflate(1);
929 if(m_flags
& wxRIBBON_BAR_FLOW_VERTICAL
)
931 reduced_rect
.width
++;
936 reduced_rect
.height
++;
943 case wxRIBBON_GALLERY_BUTTON_NORMAL
:
944 dc
.GradientFillLinear(reduced_rect
,
945 m_gallery_button_background_colour
,
946 m_gallery_button_background_gradient_colour
, wxSOUTH
);
947 btn_bitmap
= bitmaps
[0];
949 case wxRIBBON_GALLERY_BUTTON_HOVERED
:
950 dc
.SetPen(m_gallery_item_border_pen
);
951 dc
.SetBrush(m_gallery_button_hover_background_brush
);
952 dc
.DrawRectangle(rect
.x
, rect
.y
, rect
.width
+ extra_width
,
953 rect
.height
+ extra_height
);
954 btn_bitmap
= bitmaps
[1];
956 case wxRIBBON_GALLERY_BUTTON_ACTIVE
:
957 dc
.SetPen(m_gallery_item_border_pen
);
958 dc
.SetBrush(m_gallery_button_active_background_brush
);
959 dc
.DrawRectangle(rect
.x
, rect
.y
, rect
.width
+ extra_width
,
960 rect
.height
+ extra_height
);
961 btn_bitmap
= bitmaps
[2];
963 case wxRIBBON_GALLERY_BUTTON_DISABLED
:
964 dc
.SetPen(*wxTRANSPARENT_PEN
);
965 dc
.SetBrush(m_gallery_button_disabled_background_brush
);
966 dc
.DrawRectangle(reduced_rect
.x
, reduced_rect
.y
, reduced_rect
.width
,
967 reduced_rect
.height
);
968 btn_bitmap
= bitmaps
[3];
972 dc
.DrawBitmap(btn_bitmap
, reduced_rect
.x
+ reduced_rect
.width
/ 2 - 2,
973 (rect
.y
+ rect
.height
/ 2) - 2, true);
976 void wxRibbonAUIArtProvider::DrawGalleryItemBackground(
978 wxRibbonGallery
* wnd
,
980 wxRibbonGalleryItem
* item
)
982 if(wnd
->GetHoveredItem() != item
&& wnd
->GetActiveItem() != item
&&
983 wnd
->GetSelection() != item
)
986 dc
.SetPen(m_gallery_item_border_pen
);
987 if(wnd
->GetActiveItem() == item
|| wnd
->GetSelection() == item
)
988 dc
.SetBrush(m_gallery_button_active_background_brush
);
990 dc
.SetBrush(m_gallery_button_hover_background_brush
);
992 dc
.DrawRectangle(rect
.x
, rect
.y
, rect
.width
, rect
.height
);
995 void wxRibbonAUIArtProvider::DrawButtonBarBackground(
1000 DrawPartialPanelBackground(dc
, wnd
, rect
);
1003 void wxRibbonAUIArtProvider::DrawButtonBarButton(
1005 wxWindow
* WXUNUSED(wnd
),
1007 wxRibbonButtonKind kind
,
1009 const wxString
& label
,
1010 const wxBitmap
& bitmap_large
,
1011 const wxBitmap
& bitmap_small
)
1013 if(kind
== wxRIBBON_BUTTON_TOGGLE
)
1015 kind
= wxRIBBON_BUTTON_NORMAL
;
1016 if(state
& wxRIBBON_BUTTONBAR_BUTTON_TOGGLED
)
1017 state
^= wxRIBBON_BUTTONBAR_BUTTON_ACTIVE_MASK
;
1020 if(state
& (wxRIBBON_BUTTONBAR_BUTTON_HOVER_MASK
1021 | wxRIBBON_BUTTONBAR_BUTTON_ACTIVE_MASK
))
1023 dc
.SetPen(m_button_bar_hover_border_pen
);
1025 wxRect
bg_rect(rect
);
1028 if(kind
== wxRIBBON_BUTTON_HYBRID
)
1030 switch(state
& wxRIBBON_BUTTONBAR_BUTTON_SIZE_MASK
)
1032 case wxRIBBON_BUTTONBAR_BUTTON_LARGE
:
1034 int iYBorder
= rect
.y
+ bitmap_large
.GetHeight() + 4;
1035 wxRect
partial_bg(rect
);
1036 if(state
& wxRIBBON_BUTTONBAR_BUTTON_NORMAL_HOVERED
)
1038 partial_bg
.SetBottom(iYBorder
- 1);
1042 partial_bg
.height
-= (iYBorder
- partial_bg
.y
+ 1);
1043 partial_bg
.y
= iYBorder
+ 1;
1045 dc
.DrawLine(rect
.x
, iYBorder
, rect
.x
+ rect
.width
, iYBorder
);
1046 bg_rect
.Intersect(partial_bg
);
1049 case wxRIBBON_BUTTONBAR_BUTTON_MEDIUM
:
1051 int iArrowWidth
= 9;
1052 if(state
& wxRIBBON_BUTTONBAR_BUTTON_NORMAL_HOVERED
)
1054 bg_rect
.width
-= iArrowWidth
;
1055 dc
.DrawLine(bg_rect
.x
+ bg_rect
.width
,
1056 rect
.y
, bg_rect
.x
+ bg_rect
.width
,
1057 rect
.y
+ rect
.height
);
1062 bg_rect
.x
+= bg_rect
.width
- iArrowWidth
;
1063 bg_rect
.width
= iArrowWidth
;
1064 dc
.DrawLine(bg_rect
.x
- 1, rect
.y
,
1065 bg_rect
.x
- 1, rect
.y
+ rect
.height
);
1069 case wxRIBBON_BUTTONBAR_BUTTON_SMALL
:
1074 dc
.SetBrush(*wxTRANSPARENT_BRUSH
);
1075 dc
.DrawRectangle(rect
.x
, rect
.y
, rect
.width
, rect
.height
);
1077 dc
.SetPen(*wxTRANSPARENT_PEN
);
1078 if(state
& wxRIBBON_BUTTONBAR_BUTTON_ACTIVE_MASK
)
1079 dc
.SetBrush(m_button_bar_active_background_brush
);
1081 dc
.SetBrush(m_button_bar_hover_background_brush
);
1082 dc
.DrawRectangle(bg_rect
.x
, bg_rect
.y
, bg_rect
.width
, bg_rect
.height
);
1085 dc
.SetFont(m_button_bar_label_font
);
1086 dc
.SetTextForeground(state
& wxRIBBON_BUTTONBAR_BUTTON_DISABLED
1087 ? m_button_bar_label_disabled_colour
1088 : m_button_bar_label_colour
);
1089 DrawButtonBarButtonForeground(dc
, rect
, kind
, state
, label
, bitmap_large
,
1093 void wxRibbonAUIArtProvider::DrawToolBarBackground(
1098 DrawPartialPanelBackground(dc
, wnd
, rect
);
1101 void wxRibbonAUIArtProvider::DrawToolGroupBackground(
1103 wxWindow
* WXUNUSED(wnd
),
1106 dc
.SetPen(m_toolbar_border_pen
);
1107 dc
.SetBrush(*wxTRANSPARENT_BRUSH
);
1108 dc
.DrawRectangle(rect
.x
, rect
.y
, rect
.width
, rect
.height
);
1109 wxRect
bg_rect(rect
);
1111 dc
.GradientFillLinear(bg_rect
, m_tool_background_colour
,
1112 m_tool_background_gradient_colour
, wxSOUTH
);
1115 void wxRibbonAUIArtProvider::DrawTool(
1117 wxWindow
* WXUNUSED(wnd
),
1119 const wxBitmap
& bitmap
,
1120 wxRibbonButtonKind kind
,
1123 if(kind
== wxRIBBON_BUTTON_TOGGLE
)
1125 if(state
& wxRIBBON_TOOLBAR_TOOL_TOGGLED
)
1126 state
^= wxRIBBON_TOOLBAR_TOOL_ACTIVE_MASK
;
1129 wxRect
bg_rect(rect
);
1131 if((state
& wxRIBBON_TOOLBAR_TOOL_LAST
) == 0)
1133 bool is_custom_bg
= (state
& (wxRIBBON_TOOLBAR_TOOL_HOVER_MASK
|
1134 wxRIBBON_TOOLBAR_TOOL_ACTIVE_MASK
)) != 0;
1135 bool is_split_hybrid
= kind
== wxRIBBON_BUTTON_HYBRID
&& is_custom_bg
;
1140 dc
.SetPen(*wxTRANSPARENT_PEN
);
1141 dc
.SetBrush(m_tool_hover_background_brush
);
1142 dc
.DrawRectangle(bg_rect
.x
, bg_rect
.y
, bg_rect
.width
, bg_rect
.height
);
1143 if(state
& wxRIBBON_TOOLBAR_TOOL_ACTIVE_MASK
)
1145 wxRect
active_rect(bg_rect
);
1146 if(kind
== wxRIBBON_BUTTON_HYBRID
)
1148 active_rect
.width
-= 8;
1149 if(state
& wxRIBBON_TOOLBAR_TOOL_DROPDOWN_ACTIVE
)
1151 active_rect
.x
+= active_rect
.width
;
1152 active_rect
.width
= 8;
1155 dc
.SetBrush(m_tool_active_background_brush
);
1156 dc
.DrawRectangle(active_rect
.x
, active_rect
.y
, active_rect
.width
,
1157 active_rect
.height
);
1163 dc
.SetPen(m_toolbar_hover_borden_pen
);
1165 dc
.SetPen(m_toolbar_border_pen
);
1166 if((state
& wxRIBBON_TOOLBAR_TOOL_FIRST
) == 0)
1169 if(!dc
.GetPixel(rect
.x
, rect
.y
+ 1, &existing
) ||
1170 existing
!= m_toolbar_hover_borden_pen
.GetColour())
1172 dc
.DrawLine(rect
.x
, rect
.y
+ 1, rect
.x
, rect
.y
+ rect
.height
- 1);
1177 wxRect
border_rect(bg_rect
);
1178 border_rect
.Inflate(1);
1179 dc
.SetBrush(*wxTRANSPARENT_BRUSH
);
1180 dc
.DrawRectangle(border_rect
.x
, border_rect
.y
, border_rect
.width
,
1181 border_rect
.height
);
1185 int avail_width
= bg_rect
.GetWidth();
1186 if(kind
& wxRIBBON_BUTTON_DROPDOWN
)
1191 dc
.DrawLine(rect
.x
+ avail_width
+ 1, rect
.y
,
1192 rect
.x
+ avail_width
+ 1, rect
.y
+ rect
.height
);
1194 dc
.DrawBitmap(m_toolbar_drop_bitmap
, bg_rect
.x
+ avail_width
+ 2,
1195 bg_rect
.y
+ (bg_rect
.height
/ 2) - 2, true);
1197 dc
.DrawBitmap(bitmap
, bg_rect
.x
+ (avail_width
- bitmap
.GetWidth()) / 2,
1198 bg_rect
.y
+ (bg_rect
.height
- bitmap
.GetHeight()) / 2, true);
1201 #endif // wxUSE_RIBBON