1 ///////////////////////////////////////////////////////////////////////////////
2 // Name: src/aui/dockart.cpp
3 // Purpose: wxaui: wx advanced user interface - docking window manager
4 // Author: Benjamin I. Williams
8 // Copyright: (C) Copyright 2005-2006, Kirix Corporation, All Rights Reserved
9 // Licence: wxWindows Library Licence, Version 3.1
10 ///////////////////////////////////////////////////////////////////////////////
12 // ============================================================================
14 // ============================================================================
16 // ----------------------------------------------------------------------------
18 // ----------------------------------------------------------------------------
20 #include "wx/wxprec.h"
28 #include "wx/aui/framemanager.h"
29 #include "wx/aui/dockart.h"
32 #include "wx/settings.h"
33 #include "wx/dcclient.h"
38 #include "wx/osx/private.h"
39 #include "wx/graphics.h"
40 #include "wx/dcgraph.h"
45 #include "wx/renderer.h"
46 #include "wx/gtk/private/gtk2-compat.h"
50 // -- wxAuiDefaultDockArt class implementation --
52 // wxAuiDefaultDockArt is an art provider class which does all of the drawing for
53 // wxAuiManager. This allows the library caller to customize the dock art
54 // (probably by deriving from this class), or to completely replace all drawing
55 // with custom dock art (probably by writing a new stand-alone class derived
56 // from the wxAuiDockArt base class). The active dock art class can be set via
57 // wxAuiManager::SetDockArt()
58 wxColor
wxAuiLightContrastColour(const wxColour
& c
)
62 // if the color is especially dark, then
63 // make the contrast even lighter
64 if (c
.Red() < 128 && c
.Green() < 128 && c
.Blue() < 128)
67 return c
.ChangeLightness(amount
);
70 // wxAuiBitmapFromBits() is a utility function that creates a
71 // masked bitmap from raw bits (XBM format)
72 wxBitmap
wxAuiBitmapFromBits(const unsigned char bits
[], int w
, int h
,
73 const wxColour
& color
)
75 wxImage img
= wxBitmap((const char*)bits
, w
, h
).ConvertToImage();
76 img
.Replace(0,0,0,123,123,123);
77 img
.Replace(255,255,255,color
.Red(),color
.Green(),color
.Blue());
78 img
.SetMaskColour(123,123,123);
83 static void DrawGradientRectangle(wxDC
& dc
,
85 const wxColour
& start_color
,
86 const wxColour
& end_color
,
89 int rd
, gd
, bd
, high
= 0;
90 rd
= end_color
.Red() - start_color
.Red();
91 gd
= end_color
.Green() - start_color
.Green();
92 bd
= end_color
.Blue() - start_color
.Blue();
94 if (direction
== wxAUI_GRADIENT_VERTICAL
)
95 high
= rect
.GetHeight()-1;
97 high
= rect
.GetWidth()-1;
99 for (int i
= 0; i
<= high
; ++i
)
104 r
= start_color
.Red() + (high
<= 0 ?
0 : (((i
*rd
*100)/high
)/100));
105 g
= start_color
.Green() + (high
<= 0 ?
0 : (((i
*gd
*100)/high
)/100));
106 b
= start_color
.Blue() + (high
<= 0 ?
0 : (((i
*bd
*100)/high
)/100));
108 wxPen
p(wxColor((unsigned char)r
,
113 if (direction
== wxAUI_GRADIENT_VERTICAL
)
114 dc
.DrawLine(rect
.x
, rect
.y
+i
, rect
.x
+rect
.width
, rect
.y
+i
);
116 dc
.DrawLine(rect
.x
+i
, rect
.y
, rect
.x
+i
, rect
.y
+rect
.height
);
120 wxString
wxAuiChopText(wxDC
& dc
, const wxString
& text
, int max_size
)
124 // first check if the text fits with no problems
125 dc
.GetTextExtent(text
, &x
, &y
);
129 size_t i
, len
= text
.Length();
130 size_t last_good_length
= 0;
131 for (i
= 0; i
< len
; ++i
)
133 wxString s
= text
.Left(i
);
136 dc
.GetTextExtent(s
, &x
, &y
);
140 last_good_length
= i
;
143 wxString ret
= text
.Left(last_good_length
);
148 wxAuiDefaultDockArt
::wxAuiDefaultDockArt()
150 #if defined( __WXMAC__ ) && wxOSX_USE_COCOA_OR_CARBON
151 wxColor base_colour
= wxColour( wxMacCreateCGColorFromHITheme(kThemeBrushToolbarBackground
));
153 wxColor base_colour
= wxSystemSettings
::GetColour(wxSYS_COLOUR_3DFACE
);
156 // the base_colour is too pale to use as our base colour,
157 // so darken it a bit --
158 if ((255-base_colour
.Red()) +
159 (255-base_colour
.Green()) +
160 (255-base_colour
.Blue()) < 60)
162 base_colour
= base_colour
.ChangeLightness(92);
165 m_base_colour
= base_colour
;
166 wxColor darker1_colour
= base_colour
.ChangeLightness(85);
167 wxColor darker2_colour
= base_colour
.ChangeLightness(75);
168 wxColor darker3_colour
= base_colour
.ChangeLightness(60);
169 //wxColor darker4_colour = base_colour.ChangeLightness(50);
170 wxColor darker5_colour
= base_colour
.ChangeLightness(40);
172 m_active_caption_colour
= wxSystemSettings
::GetColour(wxSYS_COLOUR_HIGHLIGHT
);
173 m_active_caption_gradient_colour
= wxAuiLightContrastColour(wxSystemSettings
::GetColour(wxSYS_COLOUR_HIGHLIGHT
));
174 m_active_caption_text_colour
= wxSystemSettings
::GetColour(wxSYS_COLOUR_HIGHLIGHTTEXT
);
175 m_inactive_caption_colour
= darker1_colour
;
176 m_inactive_caption_gradient_colour
= base_colour
.ChangeLightness(97);
177 m_inactive_caption_text_colour
= *wxBLACK
;
179 m_sash_brush
= wxBrush(base_colour
);
180 m_background_brush
= wxBrush(base_colour
);
181 m_gripper_brush
= wxBrush(base_colour
);
183 m_border_pen
= wxPen(darker2_colour
);
184 m_gripper_pen1
= wxPen(darker5_colour
);
185 m_gripper_pen2
= wxPen(darker3_colour
);
186 m_gripper_pen3
= *wxWHITE_PEN
;
189 m_caption_font
= *wxSMALL_FONT
;
191 m_caption_font
= wxFont(8, wxDEFAULT
, wxNORMAL
, wxNORMAL
, FALSE
);
194 // default metric values
195 #if defined( __WXMAC__ ) && wxOSX_USE_COCOA_OR_CARBON
197 GetThemeMetric( kThemeMetricSmallPaneSplitterHeight
, &height
);
198 m_sash_size
= height
;
199 #elif defined(__WXGTK__)
200 m_sash_size
= wxRendererNative
::Get().GetSplitterParams(NULL
).widthSash
;
208 m_gradient_type
= wxAUI_GRADIENT_VERTICAL
;
214 wxAuiDefaultDockArt
::InitBitmaps ()
216 // some built in bitmaps
217 #if defined( __WXMAC__ )
218 static const unsigned char close_bits
[]={
219 0xFF, 0xFF, 0xFF, 0xFF, 0x0F, 0xFE, 0x03, 0xF8, 0x01, 0xF0, 0x19, 0xF3,
220 0xB8, 0xE3, 0xF0, 0xE1, 0xE0, 0xE0, 0xF0, 0xE1, 0xB8, 0xE3, 0x19, 0xF3,
221 0x01, 0xF0, 0x03, 0xF8, 0x0F, 0xFE, 0xFF, 0xFF };
222 #elif defined(__WXGTK__)
223 static const unsigned char close_bits
[]={
224 0xff, 0xff, 0xff, 0xff, 0x07, 0xf0, 0xfb, 0xef, 0xdb, 0xed, 0x8b, 0xe8,
225 0x1b, 0xec, 0x3b, 0xee, 0x1b, 0xec, 0x8b, 0xe8, 0xdb, 0xed, 0xfb, 0xef,
226 0x07, 0xf0, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff };
228 static const unsigned char close_bits
[]={
229 // reduced height, symmetric
230 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xcf, 0xf3, 0x9f, 0xf9,
231 0x3f, 0xfc, 0x7f, 0xfe, 0x3f, 0xfc, 0x9f, 0xf9, 0xcf, 0xf3, 0xff, 0xff,
232 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff };
234 // same height as maximize/restore
235 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xe7, 0xe7, 0xcf, 0xf3, 0x9f, 0xf9,
236 0x3f, 0xfc, 0x7f, 0xfe, 0x3f, 0xfc, 0x9f, 0xf9, 0xcf, 0xf3, 0xe7, 0xe7,
237 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff };
241 static const unsigned char maximize_bits
[] = {
242 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x07, 0xf0, 0xf7, 0xf7, 0x07, 0xf0,
243 0xf7, 0xf7, 0xf7, 0xf7, 0xf7, 0xf7, 0xf7, 0xf7, 0xf7, 0xf7, 0x07, 0xf0,
244 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff};
246 static const unsigned char restore_bits
[]={
247 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x1f, 0xf0, 0x1f, 0xf0, 0xdf, 0xf7,
248 0x07, 0xf4, 0x07, 0xf4, 0xf7, 0xf5, 0xf7, 0xf1, 0xf7, 0xfd, 0xf7, 0xfd,
249 0x07, 0xfc, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff};
251 static const unsigned char pin_bits
[]={
252 0xff,0xff,0xff,0xff,0xff,0xff,0x1f,0xfc,0xdf,0xfc,0xdf,0xfc,
253 0xdf,0xfc,0xdf,0xfc,0xdf,0xfc,0x0f,0xf8,0x7f,0xff,0x7f,0xff,
254 0x7f,0xff,0xff,0xff,0xff,0xff,0xff,0xff};
257 m_inactive_close_bitmap
= wxAuiBitmapFromBits(close_bits
, 16, 16, *wxWHITE
);
258 m_active_close_bitmap
= wxAuiBitmapFromBits(close_bits
, 16, 16, *wxWHITE
);
260 m_inactive_close_bitmap
= wxAuiBitmapFromBits(close_bits
, 16, 16, m_inactive_caption_text_colour
);
261 m_active_close_bitmap
= wxAuiBitmapFromBits(close_bits
, 16, 16, m_active_caption_text_colour
);
265 m_inactive_maximize_bitmap
= wxAuiBitmapFromBits(maximize_bits
, 16, 16, *wxWHITE
);
266 m_active_maximize_bitmap
= wxAuiBitmapFromBits(maximize_bits
, 16, 16, *wxWHITE
);
268 m_inactive_maximize_bitmap
= wxAuiBitmapFromBits(maximize_bits
, 16, 16, m_inactive_caption_text_colour
);
269 m_active_maximize_bitmap
= wxAuiBitmapFromBits(maximize_bits
, 16, 16, m_active_caption_text_colour
);
273 m_inactive_restore_bitmap
= wxAuiBitmapFromBits(restore_bits
, 16, 16, *wxWHITE
);
274 m_active_restore_bitmap
= wxAuiBitmapFromBits(restore_bits
, 16, 16, *wxWHITE
);
276 m_inactive_restore_bitmap
= wxAuiBitmapFromBits(restore_bits
, 16, 16, m_inactive_caption_text_colour
);
277 m_active_restore_bitmap
= wxAuiBitmapFromBits(restore_bits
, 16, 16, m_active_caption_text_colour
);
280 m_inactive_pin_bitmap
= wxAuiBitmapFromBits(pin_bits
, 16, 16, m_inactive_caption_text_colour
);
281 m_active_pin_bitmap
= wxAuiBitmapFromBits(pin_bits
, 16, 16, m_active_caption_text_colour
);
284 int wxAuiDefaultDockArt
::GetMetric(int id
)
288 case wxAUI_DOCKART_SASH_SIZE
: return m_sash_size
;
289 case wxAUI_DOCKART_CAPTION_SIZE
: return m_caption_size
;
290 case wxAUI_DOCKART_GRIPPER_SIZE
: return m_gripper_size
;
291 case wxAUI_DOCKART_PANE_BORDER_SIZE
: return m_border_size
;
292 case wxAUI_DOCKART_PANE_BUTTON_SIZE
: return m_button_size
;
293 case wxAUI_DOCKART_GRADIENT_TYPE
: return m_gradient_type
;
294 default: wxFAIL_MSG(wxT("Invalid Metric Ordinal")); break;
300 void wxAuiDefaultDockArt
::SetMetric(int id
, int new_val
)
304 case wxAUI_DOCKART_SASH_SIZE
: m_sash_size
= new_val
; break;
305 case wxAUI_DOCKART_CAPTION_SIZE
: m_caption_size
= new_val
; break;
306 case wxAUI_DOCKART_GRIPPER_SIZE
: m_gripper_size
= new_val
; break;
307 case wxAUI_DOCKART_PANE_BORDER_SIZE
: m_border_size
= new_val
; break;
308 case wxAUI_DOCKART_PANE_BUTTON_SIZE
: m_button_size
= new_val
; break;
309 case wxAUI_DOCKART_GRADIENT_TYPE
: m_gradient_type
= new_val
; break;
310 default: wxFAIL_MSG(wxT("Invalid Metric Ordinal")); break;
314 wxColour wxAuiDefaultDockArt
::GetColour(int id
)
318 case wxAUI_DOCKART_BACKGROUND_COLOUR
: return m_background_brush
.GetColour();
319 case wxAUI_DOCKART_SASH_COLOUR
: return m_sash_brush
.GetColour();
320 case wxAUI_DOCKART_INACTIVE_CAPTION_COLOUR
: return m_inactive_caption_colour
;
321 case wxAUI_DOCKART_INACTIVE_CAPTION_GRADIENT_COLOUR
: return m_inactive_caption_gradient_colour
;
322 case wxAUI_DOCKART_INACTIVE_CAPTION_TEXT_COLOUR
: return m_inactive_caption_text_colour
;
323 case wxAUI_DOCKART_ACTIVE_CAPTION_COLOUR
: return m_active_caption_colour
;
324 case wxAUI_DOCKART_ACTIVE_CAPTION_GRADIENT_COLOUR
: return m_active_caption_gradient_colour
;
325 case wxAUI_DOCKART_ACTIVE_CAPTION_TEXT_COLOUR
: return m_active_caption_text_colour
;
326 case wxAUI_DOCKART_BORDER_COLOUR
: return m_border_pen
.GetColour();
327 case wxAUI_DOCKART_GRIPPER_COLOUR
: return m_gripper_brush
.GetColour();
328 default: wxFAIL_MSG(wxT("Invalid Metric Ordinal")); break;
334 void wxAuiDefaultDockArt
::SetColour(int id
, const wxColor
& colour
)
338 case wxAUI_DOCKART_BACKGROUND_COLOUR
: m_background_brush
.SetColour(colour
); break;
339 case wxAUI_DOCKART_SASH_COLOUR
: m_sash_brush
.SetColour(colour
); break;
340 case wxAUI_DOCKART_INACTIVE_CAPTION_COLOUR
: m_inactive_caption_colour
= colour
; break;
341 case wxAUI_DOCKART_INACTIVE_CAPTION_GRADIENT_COLOUR
: m_inactive_caption_gradient_colour
= colour
; break;
342 case wxAUI_DOCKART_INACTIVE_CAPTION_TEXT_COLOUR
: m_inactive_caption_text_colour
= colour
; break;
343 case wxAUI_DOCKART_ACTIVE_CAPTION_COLOUR
: m_active_caption_colour
= colour
; break;
344 case wxAUI_DOCKART_ACTIVE_CAPTION_GRADIENT_COLOUR
: m_active_caption_gradient_colour
= colour
; break;
345 case wxAUI_DOCKART_ACTIVE_CAPTION_TEXT_COLOUR
: m_active_caption_text_colour
= colour
; break;
346 case wxAUI_DOCKART_BORDER_COLOUR
: m_border_pen
.SetColour(colour
); break;
347 case wxAUI_DOCKART_GRIPPER_COLOUR
:
348 m_gripper_brush
.SetColour(colour
);
349 m_gripper_pen1
.SetColour(colour
.ChangeLightness(40));
350 m_gripper_pen2
.SetColour(colour
.ChangeLightness(60));
352 default: wxFAIL_MSG(wxT("Invalid Metric Ordinal")); break;
358 void wxAuiDefaultDockArt
::SetFont(int id
, const wxFont
& font
)
360 if (id
== wxAUI_DOCKART_CAPTION_FONT
)
361 m_caption_font
= font
;
364 wxFont wxAuiDefaultDockArt
::GetFont(int id
)
366 if (id
== wxAUI_DOCKART_CAPTION_FONT
)
367 return m_caption_font
;
371 void wxAuiDefaultDockArt
::DrawSash(wxDC
& dc
, wxWindow
*window
, int orientation
, const wxRect
& rect
)
373 #if defined( __WXMAC__ ) && wxOSX_USE_COCOA_OR_CARBON
375 wxUnusedVar(orientation
);
377 HIRect splitterRect
= CGRectMake( rect
.x
, rect
.y
, rect
.width
, rect
.height
);
378 CGContextRef cgContext
;
379 wxGCDCImpl
*impl
= (wxGCDCImpl
*) dc
.GetImpl();
380 cgContext
= (CGContextRef
) impl
->GetGraphicsContext()->GetNativeContext() ;
382 HIThemeSplitterDrawInfo drawInfo
;
383 drawInfo
.version
= 0 ;
384 drawInfo
.state
= kThemeStateActive
;
385 drawInfo
.adornment
= kHIThemeSplitterAdornmentNone
;
386 HIThemeDrawPaneSplitter( &splitterRect
, &drawInfo
, cgContext
, kHIThemeOrientationNormal
) ;
388 #elif defined(__WXGTK__)
389 // clear out the rectangle first
390 dc
.SetPen(*wxTRANSPARENT_PEN
);
391 dc
.SetBrush(m_sash_brush
);
392 dc
.DrawRectangle(rect
.x
, rect
.y
, rect
.width
, rect
.height
);
395 GdkRectangle gdk_rect
;
396 if (orientation
== wxVERTICAL
)
400 gdk_rect
.width
= m_sash_size
;
401 gdk_rect
.height
= rect
.height
;
407 gdk_rect
.width
= rect
.width
;
408 gdk_rect
.height
= m_sash_size
;
413 if (!window
->m_wxwindow
) return;
414 if (!gtk_widget_is_drawable(window
->m_wxwindow
)) return;
418 gtk_widget_get_style(window
->m_wxwindow
),
419 window
->GTKGetDrawingWindow(),
420 // flags & wxCONTROL_CURRENT ? GTK_STATE_PRELIGHT : GTK_STATE_NORMAL,
423 NULL
/* no clipping */,
430 (orientation
== wxVERTICAL
) ? GTK_ORIENTATION_VERTICAL
: GTK_ORIENTATION_HORIZONTAL
435 wxUnusedVar(orientation
);
436 dc
.SetPen(*wxTRANSPARENT_PEN
);
437 dc
.SetBrush(m_sash_brush
);
438 dc
.DrawRectangle(rect
.x
, rect
.y
, rect
.width
, rect
.height
);
443 void wxAuiDefaultDockArt
::DrawBackground(wxDC
& dc
, wxWindow
*WXUNUSED(window
), int, const wxRect
& rect
)
445 dc
.SetPen(*wxTRANSPARENT_PEN
);
447 // we have to clear first, otherwise we are drawing a light striped pattern
448 // over an already darker striped background
449 dc
.SetBrush(*wxWHITE_BRUSH
) ;
450 dc
.DrawRectangle(rect
.x
, rect
.y
, rect
.width
, rect
.height
);
452 dc
.SetBrush(m_background_brush
);
453 dc
.DrawRectangle(rect
.x
, rect
.y
, rect
.width
, rect
.height
);
456 void wxAuiDefaultDockArt
::DrawBorder(wxDC
& dc
, wxWindow
*WXUNUSED(window
), const wxRect
& _rect
,
459 dc
.SetPen(m_border_pen
);
460 dc
.SetBrush(*wxTRANSPARENT_BRUSH
);
463 int i
, border_width
= GetMetric(wxAUI_DOCKART_PANE_BORDER_SIZE
);
465 if (pane
.IsToolbar())
467 for (i
= 0; i
< border_width
; ++i
)
469 dc
.SetPen(*wxWHITE_PEN
);
470 dc
.DrawLine(rect
.x
, rect
.y
, rect
.x
+rect
.width
, rect
.y
);
471 dc
.DrawLine(rect
.x
, rect
.y
, rect
.x
, rect
.y
+rect
.height
);
472 dc
.SetPen(m_border_pen
);
473 dc
.DrawLine(rect
.x
, rect
.y
+rect
.height
-1,
474 rect
.x
+rect
.width
, rect
.y
+rect
.height
-1);
475 dc
.DrawLine(rect
.x
+rect
.width
-1, rect
.y
,
476 rect
.x
+rect
.width
-1, rect
.y
+rect
.height
);
482 for (i
= 0; i
< border_width
; ++i
)
484 dc
.DrawRectangle(rect
.x
, rect
.y
, rect
.width
, rect
.height
);
491 void wxAuiDefaultDockArt
::DrawCaptionBackground(wxDC
& dc
, const wxRect
& rect
, bool active
)
493 if (m_gradient_type
== wxAUI_GRADIENT_NONE
)
496 dc
.SetBrush(wxBrush(m_active_caption_colour
));
498 dc
.SetBrush(wxBrush(m_inactive_caption_colour
));
500 dc
.DrawRectangle(rect
.x
, rect
.y
, rect
.width
, rect
.height
);
506 // on mac the gradients are expected to become darker from the top
508 DrawGradientRectangle(dc
, rect
,
509 m_active_caption_colour
,
510 m_active_caption_gradient_colour
,
513 // on other platforms, active gradients become lighter at the top
514 DrawGradientRectangle(dc
, rect
,
515 m_active_caption_gradient_colour
,
516 m_active_caption_colour
,
523 // on mac the gradients are expected to become darker from the top
524 DrawGradientRectangle(dc
, rect
,
525 m_inactive_caption_gradient_colour
,
526 m_inactive_caption_colour
,
529 // on other platforms, inactive gradients become lighter at the bottom
530 DrawGradientRectangle(dc
, rect
,
531 m_inactive_caption_colour
,
532 m_inactive_caption_gradient_colour
,
540 void wxAuiDefaultDockArt
::DrawCaption(wxDC
& dc
, wxWindow
*WXUNUSED(window
),
541 const wxString
& text
,
545 dc
.SetPen(*wxTRANSPARENT_PEN
);
546 dc
.SetFont(m_caption_font
);
548 DrawCaptionBackground(dc
, rect
,
549 (pane
.state
& wxAuiPaneInfo
::optionActive
)?
true:false);
551 int caption_offset
= 0;
552 if ( pane
.icon
.IsOk() )
554 DrawIcon(dc
, rect
, pane
);
556 caption_offset
+= pane
.icon
.GetWidth() + 3;
559 if (pane
.state
& wxAuiPaneInfo
::optionActive
)
560 dc
.SetTextForeground(m_active_caption_text_colour
);
562 dc
.SetTextForeground(m_inactive_caption_text_colour
);
566 dc
.GetTextExtent(wxT("ABCDEFHXfgkj"), &w
, &h
);
568 wxRect clip_rect
= rect
;
569 clip_rect
.width
-= 3; // text offset
570 clip_rect
.width
-= 2; // button padding
571 if (pane
.HasCloseButton())
572 clip_rect
.width
-= m_button_size
;
573 if (pane
.HasPinButton())
574 clip_rect
.width
-= m_button_size
;
575 if (pane
.HasMaximizeButton())
576 clip_rect
.width
-= m_button_size
;
578 wxString draw_text
= wxAuiChopText(dc
, text
, clip_rect
.width
);
580 dc
.SetClippingRegion(clip_rect
);
581 dc
.DrawText(draw_text
, rect
.x
+3 + caption_offset
, rect
.y
+(rect
.height
/2)-(h
/2)-1);
582 dc
.DestroyClippingRegion();
586 wxAuiDefaultDockArt
::DrawIcon(wxDC
& dc
, const wxRect
& rect
, wxAuiPaneInfo
& pane
)
588 // Draw the icon centered vertically
589 dc
.DrawBitmap(pane
.icon
,
590 rect
.x
+2, rect
.y
+(rect
.height
-pane
.icon
.GetHeight())/2,
594 void wxAuiDefaultDockArt
::DrawGripper(wxDC
& dc
, wxWindow
*WXUNUSED(window
),
598 dc
.SetPen(*wxTRANSPARENT_PEN
);
599 dc
.SetBrush(m_gripper_brush
);
601 dc
.DrawRectangle(rect
.x
, rect
.y
, rect
.width
,rect
.height
);
603 if (!pane
.HasGripperTop())
608 dc
.SetPen(m_gripper_pen1
);
609 dc
.DrawPoint(rect
.x
+3, rect
.y
+y
);
610 dc
.SetPen(m_gripper_pen2
);
611 dc
.DrawPoint(rect
.x
+3, rect
.y
+y
+1);
612 dc
.DrawPoint(rect
.x
+4, rect
.y
+y
);
613 dc
.SetPen(m_gripper_pen3
);
614 dc
.DrawPoint(rect
.x
+5, rect
.y
+y
+1);
615 dc
.DrawPoint(rect
.x
+5, rect
.y
+y
+2);
616 dc
.DrawPoint(rect
.x
+4, rect
.y
+y
+2);
619 if (y
> rect
.GetHeight()-5)
628 dc
.SetPen(m_gripper_pen1
);
629 dc
.DrawPoint(rect
.x
+x
, rect
.y
+3);
630 dc
.SetPen(m_gripper_pen2
);
631 dc
.DrawPoint(rect
.x
+x
+1, rect
.y
+3);
632 dc
.DrawPoint(rect
.x
+x
, rect
.y
+4);
633 dc
.SetPen(m_gripper_pen3
);
634 dc
.DrawPoint(rect
.x
+x
+1, rect
.y
+5);
635 dc
.DrawPoint(rect
.x
+x
+2, rect
.y
+5);
636 dc
.DrawPoint(rect
.x
+x
+2, rect
.y
+4);
639 if (x
> rect
.GetWidth()-5)
645 void wxAuiDefaultDockArt
::DrawPaneButton(wxDC
& dc
, wxWindow
*WXUNUSED(window
),
657 case wxAUI_BUTTON_CLOSE
:
658 if (pane
.state
& wxAuiPaneInfo
::optionActive
)
659 bmp
= m_active_close_bitmap
;
661 bmp
= m_inactive_close_bitmap
;
663 case wxAUI_BUTTON_PIN
:
664 if (pane
.state
& wxAuiPaneInfo
::optionActive
)
665 bmp
= m_active_pin_bitmap
;
667 bmp
= m_inactive_pin_bitmap
;
669 case wxAUI_BUTTON_MAXIMIZE_RESTORE
:
670 if (pane
.IsMaximized())
672 if (pane
.state
& wxAuiPaneInfo
::optionActive
)
673 bmp
= m_active_restore_bitmap
;
675 bmp
= m_inactive_restore_bitmap
;
679 if (pane
.state
& wxAuiPaneInfo
::optionActive
)
680 bmp
= m_active_maximize_bitmap
;
682 bmp
= m_inactive_maximize_bitmap
;
691 rect
.y
= rect
.y
+ (rect
.height
/2) - (bmp
.GetHeight()/2);
692 rect
.height
= old_y
+ rect
.height
- rect
.y
- 1;
695 if (button_state
== wxAUI_BUTTON_STATE_PRESSED
)
701 if (button_state
== wxAUI_BUTTON_STATE_HOVER
||
702 button_state
== wxAUI_BUTTON_STATE_PRESSED
)
704 if (pane
.state
& wxAuiPaneInfo
::optionActive
)
706 dc
.SetBrush(wxBrush(m_active_caption_colour
.ChangeLightness(120)));
707 dc
.SetPen(wxPen(m_active_caption_colour
.ChangeLightness(70)));
711 dc
.SetBrush(wxBrush(m_inactive_caption_colour
.ChangeLightness(120)));
712 dc
.SetPen(wxPen(m_inactive_caption_colour
.ChangeLightness(70)));
715 // draw the background behind the button
716 dc
.DrawRectangle(rect
.x
, rect
.y
, 15, 15);
720 // draw the button itself
721 dc
.DrawBitmap(bmp
, rect
.x
, rect
.y
, true);