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"
49 // -- wxAuiDefaultDockArt class implementation --
51 // wxAuiDefaultDockArt is an art provider class which does all of the drawing for
52 // wxAuiManager. This allows the library caller to customize the dock art
53 // (probably by deriving from this class), or to completely replace all drawing
54 // with custom dock art (probably by writing a new stand-alone class derived
55 // from the wxAuiDockArt base class). The active dock art class can be set via
56 // wxAuiManager::SetDockArt()
57 wxColor
wxAuiLightContrastColour(const wxColour
& c
)
61 // if the color is especially dark, then
62 // make the contrast even lighter
63 if (c
.Red() < 128 && c
.Green() < 128 && c
.Blue() < 128)
66 return c
.ChangeLightness(amount
);
69 // wxAuiBitmapFromBits() is a utility function that creates a
70 // masked bitmap from raw bits (XBM format)
71 wxBitmap
wxAuiBitmapFromBits(const unsigned char bits
[], int w
, int h
,
72 const wxColour
& color
)
74 wxImage img
= wxBitmap((const char*)bits
, w
, h
).ConvertToImage();
75 img
.Replace(0,0,0,123,123,123);
76 img
.Replace(255,255,255,color
.Red(),color
.Green(),color
.Blue());
77 img
.SetMaskColour(123,123,123);
82 static void DrawGradientRectangle(wxDC
& dc
,
84 const wxColour
& start_color
,
85 const wxColour
& end_color
,
88 int rd
, gd
, bd
, high
= 0;
89 rd
= end_color
.Red() - start_color
.Red();
90 gd
= end_color
.Green() - start_color
.Green();
91 bd
= end_color
.Blue() - start_color
.Blue();
93 if (direction
== wxAUI_GRADIENT_VERTICAL
)
94 high
= rect
.GetHeight()-1;
96 high
= rect
.GetWidth()-1;
98 for (int i
= 0; i
<= high
; ++i
)
103 r
= start_color
.Red() + (high
<= 0 ? 0 : (((i
*rd
*100)/high
)/100));
104 g
= start_color
.Green() + (high
<= 0 ? 0 : (((i
*gd
*100)/high
)/100));
105 b
= start_color
.Blue() + (high
<= 0 ? 0 : (((i
*bd
*100)/high
)/100));
107 wxPen
p(wxColor((unsigned char)r
,
112 if (direction
== wxAUI_GRADIENT_VERTICAL
)
113 dc
.DrawLine(rect
.x
, rect
.y
+i
, rect
.x
+rect
.width
, rect
.y
+i
);
115 dc
.DrawLine(rect
.x
+i
, rect
.y
, rect
.x
+i
, rect
.y
+rect
.height
);
119 wxString
wxAuiChopText(wxDC
& dc
, const wxString
& text
, int max_size
)
123 // first check if the text fits with no problems
124 dc
.GetTextExtent(text
, &x
, &y
);
128 size_t i
, len
= text
.Length();
129 size_t last_good_length
= 0;
130 for (i
= 0; i
< len
; ++i
)
132 wxString s
= text
.Left(i
);
135 dc
.GetTextExtent(s
, &x
, &y
);
139 last_good_length
= i
;
142 wxString ret
= text
.Left(last_good_length
);
147 wxAuiDefaultDockArt::wxAuiDefaultDockArt()
149 #if defined( __WXMAC__ ) && wxOSX_USE_COCOA_OR_CARBON
150 wxColor base_colour
= wxColour( wxMacCreateCGColorFromHITheme(kThemeBrushToolbarBackground
));
152 wxColor base_colour
= wxSystemSettings::GetColour(wxSYS_COLOUR_3DFACE
);
155 // the base_colour is too pale to use as our base colour,
156 // so darken it a bit --
157 if ((255-base_colour
.Red()) +
158 (255-base_colour
.Green()) +
159 (255-base_colour
.Blue()) < 60)
161 base_colour
= base_colour
.ChangeLightness(92);
164 m_base_colour
= base_colour
;
165 wxColor darker1_colour
= base_colour
.ChangeLightness(85);
166 wxColor darker2_colour
= base_colour
.ChangeLightness(75);
167 wxColor darker3_colour
= base_colour
.ChangeLightness(60);
168 //wxColor darker4_colour = base_colour.ChangeLightness(50);
169 wxColor darker5_colour
= base_colour
.ChangeLightness(40);
171 m_active_caption_colour
= wxSystemSettings::GetColour(wxSYS_COLOUR_HIGHLIGHT
);
172 m_active_caption_gradient_colour
= wxAuiLightContrastColour(wxSystemSettings::GetColour(wxSYS_COLOUR_HIGHLIGHT
));
173 m_active_caption_text_colour
= wxSystemSettings::GetColour(wxSYS_COLOUR_HIGHLIGHTTEXT
);
174 m_inactive_caption_colour
= darker1_colour
;
175 m_inactive_caption_gradient_colour
= base_colour
.ChangeLightness(97);
176 m_inactive_caption_text_colour
= *wxBLACK
;
178 m_sash_brush
= wxBrush(base_colour
);
179 m_background_brush
= wxBrush(base_colour
);
180 m_gripper_brush
= wxBrush(base_colour
);
182 m_border_pen
= wxPen(darker2_colour
);
183 m_gripper_pen1
= wxPen(darker5_colour
);
184 m_gripper_pen2
= wxPen(darker3_colour
);
185 m_gripper_pen3
= *wxWHITE_PEN
;
188 m_caption_font
= *wxSMALL_FONT
;
190 m_caption_font
= wxFont(8, wxDEFAULT
, wxNORMAL
, wxNORMAL
, FALSE
);
193 // default metric values
194 #if defined( __WXMAC__ ) && wxOSX_USE_COCOA_OR_CARBON
196 GetThemeMetric( kThemeMetricSmallPaneSplitterHeight
, &height
);
197 m_sash_size
= height
;
198 #elif defined(__WXGTK__)
199 m_sash_size
= wxRendererNative::Get().GetSplitterParams(NULL
).widthSash
;
207 m_gradient_type
= wxAUI_GRADIENT_VERTICAL
;
213 wxAuiDefaultDockArt::InitBitmaps ()
215 // some built in bitmaps
216 #if defined( __WXMAC__ )
217 static const unsigned char close_bits
[]={
218 0xFF, 0xFF, 0xFF, 0xFF, 0x0F, 0xFE, 0x03, 0xF8, 0x01, 0xF0, 0x19, 0xF3,
219 0xB8, 0xE3, 0xF0, 0xE1, 0xE0, 0xE0, 0xF0, 0xE1, 0xB8, 0xE3, 0x19, 0xF3,
220 0x01, 0xF0, 0x03, 0xF8, 0x0F, 0xFE, 0xFF, 0xFF };
221 #elif defined(__WXGTK__)
222 static const unsigned char close_bits
[]={
223 0xff, 0xff, 0xff, 0xff, 0x07, 0xf0, 0xfb, 0xef, 0xdb, 0xed, 0x8b, 0xe8,
224 0x1b, 0xec, 0x3b, 0xee, 0x1b, 0xec, 0x8b, 0xe8, 0xdb, 0xed, 0xfb, 0xef,
225 0x07, 0xf0, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff };
227 static const unsigned char close_bits
[]={
228 // reduced height, symmetric
229 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xcf, 0xf3, 0x9f, 0xf9,
230 0x3f, 0xfc, 0x7f, 0xfe, 0x3f, 0xfc, 0x9f, 0xf9, 0xcf, 0xf3, 0xff, 0xff,
231 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff };
233 // same height as maximize/restore
234 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xe7, 0xe7, 0xcf, 0xf3, 0x9f, 0xf9,
235 0x3f, 0xfc, 0x7f, 0xfe, 0x3f, 0xfc, 0x9f, 0xf9, 0xcf, 0xf3, 0xe7, 0xe7,
236 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff };
240 static const unsigned char maximize_bits
[] = {
241 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x07, 0xf0, 0xf7, 0xf7, 0x07, 0xf0,
242 0xf7, 0xf7, 0xf7, 0xf7, 0xf7, 0xf7, 0xf7, 0xf7, 0xf7, 0xf7, 0x07, 0xf0,
243 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff};
245 static const unsigned char restore_bits
[]={
246 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x1f, 0xf0, 0x1f, 0xf0, 0xdf, 0xf7,
247 0x07, 0xf4, 0x07, 0xf4, 0xf7, 0xf5, 0xf7, 0xf1, 0xf7, 0xfd, 0xf7, 0xfd,
248 0x07, 0xfc, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff};
250 static const unsigned char pin_bits
[]={
251 0xff,0xff,0xff,0xff,0xff,0xff,0x1f,0xfc,0xdf,0xfc,0xdf,0xfc,
252 0xdf,0xfc,0xdf,0xfc,0xdf,0xfc,0x0f,0xf8,0x7f,0xff,0x7f,0xff,
253 0x7f,0xff,0xff,0xff,0xff,0xff,0xff,0xff};
256 m_inactive_close_bitmap
= wxAuiBitmapFromBits(close_bits
, 16, 16, *wxWHITE
);
257 m_active_close_bitmap
= wxAuiBitmapFromBits(close_bits
, 16, 16, *wxWHITE
);
259 m_inactive_close_bitmap
= wxAuiBitmapFromBits(close_bits
, 16, 16, m_inactive_caption_text_colour
);
260 m_active_close_bitmap
= wxAuiBitmapFromBits(close_bits
, 16, 16, m_active_caption_text_colour
);
264 m_inactive_maximize_bitmap
= wxAuiBitmapFromBits(maximize_bits
, 16, 16, *wxWHITE
);
265 m_active_maximize_bitmap
= wxAuiBitmapFromBits(maximize_bits
, 16, 16, *wxWHITE
);
267 m_inactive_maximize_bitmap
= wxAuiBitmapFromBits(maximize_bits
, 16, 16, m_inactive_caption_text_colour
);
268 m_active_maximize_bitmap
= wxAuiBitmapFromBits(maximize_bits
, 16, 16, m_active_caption_text_colour
);
272 m_inactive_restore_bitmap
= wxAuiBitmapFromBits(restore_bits
, 16, 16, *wxWHITE
);
273 m_active_restore_bitmap
= wxAuiBitmapFromBits(restore_bits
, 16, 16, *wxWHITE
);
275 m_inactive_restore_bitmap
= wxAuiBitmapFromBits(restore_bits
, 16, 16, m_inactive_caption_text_colour
);
276 m_active_restore_bitmap
= wxAuiBitmapFromBits(restore_bits
, 16, 16, m_active_caption_text_colour
);
279 m_inactive_pin_bitmap
= wxAuiBitmapFromBits(pin_bits
, 16, 16, m_inactive_caption_text_colour
);
280 m_active_pin_bitmap
= wxAuiBitmapFromBits(pin_bits
, 16, 16, m_active_caption_text_colour
);
283 int wxAuiDefaultDockArt::GetMetric(int id
)
287 case wxAUI_DOCKART_SASH_SIZE
: return m_sash_size
;
288 case wxAUI_DOCKART_CAPTION_SIZE
: return m_caption_size
;
289 case wxAUI_DOCKART_GRIPPER_SIZE
: return m_gripper_size
;
290 case wxAUI_DOCKART_PANE_BORDER_SIZE
: return m_border_size
;
291 case wxAUI_DOCKART_PANE_BUTTON_SIZE
: return m_button_size
;
292 case wxAUI_DOCKART_GRADIENT_TYPE
: return m_gradient_type
;
293 default: wxFAIL_MSG(wxT("Invalid Metric Ordinal")); break;
299 void wxAuiDefaultDockArt::SetMetric(int id
, int new_val
)
303 case wxAUI_DOCKART_SASH_SIZE
: m_sash_size
= new_val
; break;
304 case wxAUI_DOCKART_CAPTION_SIZE
: m_caption_size
= new_val
; break;
305 case wxAUI_DOCKART_GRIPPER_SIZE
: m_gripper_size
= new_val
; break;
306 case wxAUI_DOCKART_PANE_BORDER_SIZE
: m_border_size
= new_val
; break;
307 case wxAUI_DOCKART_PANE_BUTTON_SIZE
: m_button_size
= new_val
; break;
308 case wxAUI_DOCKART_GRADIENT_TYPE
: m_gradient_type
= new_val
; break;
309 default: wxFAIL_MSG(wxT("Invalid Metric Ordinal")); break;
313 wxColour
wxAuiDefaultDockArt::GetColour(int id
)
317 case wxAUI_DOCKART_BACKGROUND_COLOUR
: return m_background_brush
.GetColour();
318 case wxAUI_DOCKART_SASH_COLOUR
: return m_sash_brush
.GetColour();
319 case wxAUI_DOCKART_INACTIVE_CAPTION_COLOUR
: return m_inactive_caption_colour
;
320 case wxAUI_DOCKART_INACTIVE_CAPTION_GRADIENT_COLOUR
: return m_inactive_caption_gradient_colour
;
321 case wxAUI_DOCKART_INACTIVE_CAPTION_TEXT_COLOUR
: return m_inactive_caption_text_colour
;
322 case wxAUI_DOCKART_ACTIVE_CAPTION_COLOUR
: return m_active_caption_colour
;
323 case wxAUI_DOCKART_ACTIVE_CAPTION_GRADIENT_COLOUR
: return m_active_caption_gradient_colour
;
324 case wxAUI_DOCKART_ACTIVE_CAPTION_TEXT_COLOUR
: return m_active_caption_text_colour
;
325 case wxAUI_DOCKART_BORDER_COLOUR
: return m_border_pen
.GetColour();
326 case wxAUI_DOCKART_GRIPPER_COLOUR
: return m_gripper_brush
.GetColour();
327 default: wxFAIL_MSG(wxT("Invalid Metric Ordinal")); break;
333 void wxAuiDefaultDockArt::SetColour(int id
, const wxColor
& colour
)
337 case wxAUI_DOCKART_BACKGROUND_COLOUR
: m_background_brush
.SetColour(colour
); break;
338 case wxAUI_DOCKART_SASH_COLOUR
: m_sash_brush
.SetColour(colour
); break;
339 case wxAUI_DOCKART_INACTIVE_CAPTION_COLOUR
: m_inactive_caption_colour
= colour
; break;
340 case wxAUI_DOCKART_INACTIVE_CAPTION_GRADIENT_COLOUR
: m_inactive_caption_gradient_colour
= colour
; break;
341 case wxAUI_DOCKART_INACTIVE_CAPTION_TEXT_COLOUR
: m_inactive_caption_text_colour
= colour
; break;
342 case wxAUI_DOCKART_ACTIVE_CAPTION_COLOUR
: m_active_caption_colour
= colour
; break;
343 case wxAUI_DOCKART_ACTIVE_CAPTION_GRADIENT_COLOUR
: m_active_caption_gradient_colour
= colour
; break;
344 case wxAUI_DOCKART_ACTIVE_CAPTION_TEXT_COLOUR
: m_active_caption_text_colour
= colour
; break;
345 case wxAUI_DOCKART_BORDER_COLOUR
: m_border_pen
.SetColour(colour
); break;
346 case wxAUI_DOCKART_GRIPPER_COLOUR
:
347 m_gripper_brush
.SetColour(colour
);
348 m_gripper_pen1
.SetColour(colour
.ChangeLightness(40));
349 m_gripper_pen2
.SetColour(colour
.ChangeLightness(60));
351 default: wxFAIL_MSG(wxT("Invalid Metric Ordinal")); break;
357 void wxAuiDefaultDockArt::SetFont(int id
, const wxFont
& font
)
359 if (id
== wxAUI_DOCKART_CAPTION_FONT
)
360 m_caption_font
= font
;
363 wxFont
wxAuiDefaultDockArt::GetFont(int id
)
365 if (id
== wxAUI_DOCKART_CAPTION_FONT
)
366 return m_caption_font
;
370 void wxAuiDefaultDockArt::DrawSash(wxDC
& dc
, wxWindow
*window
, int orientation
, const wxRect
& rect
)
372 #if defined( __WXMAC__ ) && wxOSX_USE_COCOA_OR_CARBON
374 wxUnusedVar(orientation
);
376 HIRect splitterRect
= CGRectMake( rect
.x
, rect
.y
, rect
.width
, rect
.height
);
377 CGContextRef cgContext
;
378 wxGCDCImpl
*impl
= (wxGCDCImpl
*) dc
.GetImpl();
379 cgContext
= (CGContextRef
) impl
->GetGraphicsContext()->GetNativeContext() ;
381 HIThemeSplitterDrawInfo drawInfo
;
382 drawInfo
.version
= 0 ;
383 drawInfo
.state
= kThemeStateActive
;
384 drawInfo
.adornment
= kHIThemeSplitterAdornmentNone
;
385 HIThemeDrawPaneSplitter( &splitterRect
, &drawInfo
, cgContext
, kHIThemeOrientationNormal
) ;
387 #elif defined(__WXGTK__)
388 // clear out the rectangle first
389 dc
.SetPen(*wxTRANSPARENT_PEN
);
390 dc
.SetBrush(m_sash_brush
);
391 dc
.DrawRectangle(rect
.x
, rect
.y
, rect
.width
, rect
.height
);
394 GdkRectangle gdk_rect
;
395 if (orientation
== wxVERTICAL
)
399 gdk_rect
.width
= m_sash_size
;
400 gdk_rect
.height
= rect
.height
;
406 gdk_rect
.width
= rect
.width
;
407 gdk_rect
.height
= m_sash_size
;
412 if (!window
->m_wxwindow
) return;
413 if (!GTK_WIDGET_DRAWABLE(window
->m_wxwindow
)) return;
417 window
->m_wxwindow
->style
,
418 window
->GTKGetDrawingWindow(),
419 // flags & wxCONTROL_CURRENT ? GTK_STATE_PRELIGHT : GTK_STATE_NORMAL,
422 NULL
/* no clipping */,
429 (orientation
== wxVERTICAL
) ? GTK_ORIENTATION_VERTICAL
: GTK_ORIENTATION_HORIZONTAL
434 wxUnusedVar(orientation
);
435 dc
.SetPen(*wxTRANSPARENT_PEN
);
436 dc
.SetBrush(m_sash_brush
);
437 dc
.DrawRectangle(rect
.x
, rect
.y
, rect
.width
, rect
.height
);
442 void wxAuiDefaultDockArt::DrawBackground(wxDC
& dc
, wxWindow
*WXUNUSED(window
), int, const wxRect
& rect
)
444 dc
.SetPen(*wxTRANSPARENT_PEN
);
446 // we have to clear first, otherwise we are drawing a light striped pattern
447 // over an already darker striped background
448 dc
.SetBrush(*wxWHITE_BRUSH
) ;
449 dc
.DrawRectangle(rect
.x
, rect
.y
, rect
.width
, rect
.height
);
451 dc
.SetBrush(m_background_brush
);
452 dc
.DrawRectangle(rect
.x
, rect
.y
, rect
.width
, rect
.height
);
455 void wxAuiDefaultDockArt::DrawBorder(wxDC
& dc
, wxWindow
*WXUNUSED(window
), const wxRect
& _rect
,
458 dc
.SetPen(m_border_pen
);
459 dc
.SetBrush(*wxTRANSPARENT_BRUSH
);
462 int i
, border_width
= GetMetric(wxAUI_DOCKART_PANE_BORDER_SIZE
);
464 if (pane
.IsToolbar())
466 for (i
= 0; i
< border_width
; ++i
)
468 dc
.SetPen(*wxWHITE_PEN
);
469 dc
.DrawLine(rect
.x
, rect
.y
, rect
.x
+rect
.width
, rect
.y
);
470 dc
.DrawLine(rect
.x
, rect
.y
, rect
.x
, rect
.y
+rect
.height
);
471 dc
.SetPen(m_border_pen
);
472 dc
.DrawLine(rect
.x
, rect
.y
+rect
.height
-1,
473 rect
.x
+rect
.width
, rect
.y
+rect
.height
-1);
474 dc
.DrawLine(rect
.x
+rect
.width
-1, rect
.y
,
475 rect
.x
+rect
.width
-1, rect
.y
+rect
.height
);
481 for (i
= 0; i
< border_width
; ++i
)
483 dc
.DrawRectangle(rect
.x
, rect
.y
, rect
.width
, rect
.height
);
490 void wxAuiDefaultDockArt::DrawCaptionBackground(wxDC
& dc
, const wxRect
& rect
, bool active
)
492 if (m_gradient_type
== wxAUI_GRADIENT_NONE
)
495 dc
.SetBrush(wxBrush(m_active_caption_colour
));
497 dc
.SetBrush(wxBrush(m_inactive_caption_colour
));
499 dc
.DrawRectangle(rect
.x
, rect
.y
, rect
.width
, rect
.height
);
505 // on mac the gradients are expected to become darker from the top
507 DrawGradientRectangle(dc
, rect
,
508 m_active_caption_colour
,
509 m_active_caption_gradient_colour
,
512 // on other platforms, active gradients become lighter at the top
513 DrawGradientRectangle(dc
, rect
,
514 m_active_caption_gradient_colour
,
515 m_active_caption_colour
,
522 // on mac the gradients are expected to become darker from the top
523 DrawGradientRectangle(dc
, rect
,
524 m_inactive_caption_gradient_colour
,
525 m_inactive_caption_colour
,
528 // on other platforms, inactive gradients become lighter at the bottom
529 DrawGradientRectangle(dc
, rect
,
530 m_inactive_caption_colour
,
531 m_inactive_caption_gradient_colour
,
539 void wxAuiDefaultDockArt::DrawCaption(wxDC
& dc
, wxWindow
*WXUNUSED(window
),
540 const wxString
& text
,
544 dc
.SetPen(*wxTRANSPARENT_PEN
);
545 dc
.SetFont(m_caption_font
);
547 DrawCaptionBackground(dc
, rect
,
548 (pane
.state
& wxAuiPaneInfo::optionActive
)?true:false);
550 int caption_offset
= 0;
551 if ( pane
.icon
.IsOk() )
553 DrawIcon(dc
, rect
, pane
);
555 caption_offset
+= pane
.icon
.GetWidth() + 3;
558 if (pane
.state
& wxAuiPaneInfo::optionActive
)
559 dc
.SetTextForeground(m_active_caption_text_colour
);
561 dc
.SetTextForeground(m_inactive_caption_text_colour
);
565 dc
.GetTextExtent(wxT("ABCDEFHXfgkj"), &w
, &h
);
567 wxRect clip_rect
= rect
;
568 clip_rect
.width
-= 3; // text offset
569 clip_rect
.width
-= 2; // button padding
570 if (pane
.HasCloseButton())
571 clip_rect
.width
-= m_button_size
;
572 if (pane
.HasPinButton())
573 clip_rect
.width
-= m_button_size
;
574 if (pane
.HasMaximizeButton())
575 clip_rect
.width
-= m_button_size
;
577 wxString draw_text
= wxAuiChopText(dc
, text
, clip_rect
.width
);
579 dc
.SetClippingRegion(clip_rect
);
580 dc
.DrawText(draw_text
, rect
.x
+3 + caption_offset
, rect
.y
+(rect
.height
/2)-(h
/2)-1);
581 dc
.DestroyClippingRegion();
585 wxAuiDefaultDockArt::DrawIcon(wxDC
& dc
, const wxRect
& rect
, wxAuiPaneInfo
& pane
)
587 // Draw the icon centered vertically
588 dc
.DrawBitmap(pane
.icon
,
589 rect
.x
+2, rect
.y
+(rect
.height
-pane
.icon
.GetHeight())/2,
593 void wxAuiDefaultDockArt::DrawGripper(wxDC
& dc
, wxWindow
*WXUNUSED(window
),
597 dc
.SetPen(*wxTRANSPARENT_PEN
);
598 dc
.SetBrush(m_gripper_brush
);
600 dc
.DrawRectangle(rect
.x
, rect
.y
, rect
.width
,rect
.height
);
602 if (!pane
.HasGripperTop())
607 dc
.SetPen(m_gripper_pen1
);
608 dc
.DrawPoint(rect
.x
+3, rect
.y
+y
);
609 dc
.SetPen(m_gripper_pen2
);
610 dc
.DrawPoint(rect
.x
+3, rect
.y
+y
+1);
611 dc
.DrawPoint(rect
.x
+4, rect
.y
+y
);
612 dc
.SetPen(m_gripper_pen3
);
613 dc
.DrawPoint(rect
.x
+5, rect
.y
+y
+1);
614 dc
.DrawPoint(rect
.x
+5, rect
.y
+y
+2);
615 dc
.DrawPoint(rect
.x
+4, rect
.y
+y
+2);
618 if (y
> rect
.GetHeight()-5)
627 dc
.SetPen(m_gripper_pen1
);
628 dc
.DrawPoint(rect
.x
+x
, rect
.y
+3);
629 dc
.SetPen(m_gripper_pen2
);
630 dc
.DrawPoint(rect
.x
+x
+1, rect
.y
+3);
631 dc
.DrawPoint(rect
.x
+x
, rect
.y
+4);
632 dc
.SetPen(m_gripper_pen3
);
633 dc
.DrawPoint(rect
.x
+x
+1, rect
.y
+5);
634 dc
.DrawPoint(rect
.x
+x
+2, rect
.y
+5);
635 dc
.DrawPoint(rect
.x
+x
+2, rect
.y
+4);
638 if (x
> rect
.GetWidth()-5)
644 void wxAuiDefaultDockArt::DrawPaneButton(wxDC
& dc
, wxWindow
*WXUNUSED(window
),
656 case wxAUI_BUTTON_CLOSE
:
657 if (pane
.state
& wxAuiPaneInfo::optionActive
)
658 bmp
= m_active_close_bitmap
;
660 bmp
= m_inactive_close_bitmap
;
662 case wxAUI_BUTTON_PIN
:
663 if (pane
.state
& wxAuiPaneInfo::optionActive
)
664 bmp
= m_active_pin_bitmap
;
666 bmp
= m_inactive_pin_bitmap
;
668 case wxAUI_BUTTON_MAXIMIZE_RESTORE
:
669 if (pane
.IsMaximized())
671 if (pane
.state
& wxAuiPaneInfo::optionActive
)
672 bmp
= m_active_restore_bitmap
;
674 bmp
= m_inactive_restore_bitmap
;
678 if (pane
.state
& wxAuiPaneInfo::optionActive
)
679 bmp
= m_active_maximize_bitmap
;
681 bmp
= m_inactive_maximize_bitmap
;
690 rect
.y
= rect
.y
+ (rect
.height
/2) - (bmp
.GetHeight()/2);
691 rect
.height
= old_y
+ rect
.height
- rect
.y
- 1;
694 if (button_state
== wxAUI_BUTTON_STATE_PRESSED
)
700 if (button_state
== wxAUI_BUTTON_STATE_HOVER
||
701 button_state
== wxAUI_BUTTON_STATE_PRESSED
)
703 if (pane
.state
& wxAuiPaneInfo::optionActive
)
705 dc
.SetBrush(wxBrush(m_active_caption_colour
.ChangeLightness(120)));
706 dc
.SetPen(wxPen(m_active_caption_colour
.ChangeLightness(70)));
710 dc
.SetBrush(wxBrush(m_inactive_caption_colour
.ChangeLightness(120)));
711 dc
.SetPen(wxPen(m_inactive_caption_colour
.ChangeLightness(70)));
714 // draw the background behind the button
715 dc
.DrawRectangle(rect
.x
, rect
.y
, 15, 15);
719 // draw the button itself
720 dc
.DrawBitmap(bmp
, rect
.x
, rect
.y
, true);