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"
41 // for themeing support
42 #include <Carbon/Carbon.h>
47 #include "wx/renderer.h"
51 // -- wxAuiDefaultDockArt class implementation --
53 // wxAuiDefaultDockArt is an art provider class which does all of the drawing for
54 // wxAuiManager. This allows the library caller to customize the dock art
55 // (probably by deriving from this class), or to completely replace all drawing
56 // with custom dock art (probably by writing a new stand-alone class derived
57 // from the wxAuiDockArt base class). The active dock art class can be set via
58 // wxAuiManager::SetDockArt()
61 // wxAuiBlendColour is used by wxAuiStepColour
62 unsigned char wxAuiBlendColour(unsigned char fg
, unsigned char bg
, double alpha
)
64 double result
= bg
+ (alpha
* (fg
- bg
));
69 return (unsigned char)result
;
72 // wxAuiStepColour() it a utility function that simply darkens
73 // or lightens a color, based on the specified percentage
74 // ialpha of 0 would be completely black, 100 completely white
75 // an ialpha of 100 returns the same colour
76 wxColor
wxAuiStepColour(const wxColor
& c
, int ialpha
)
81 unsigned char r
= c
.Red(),
86 // ialpha is 0..200 where 0 is completely black
87 // and 200 is completely white and 100 is the same
88 // convert that to normal alpha 0.0 - 1.0
89 ialpha
= wxMin(ialpha
, 200);
90 ialpha
= wxMax(ialpha
, 0);
91 double alpha
= ((double)(ialpha
- 100.0))/100.0;
97 alpha
= 1.0 - alpha
; // 0 = transparent fg; 1 = opaque fg
103 alpha
= 1.0 + alpha
; // 0 = transparent fg; 1 = opaque fg
106 r
= wxAuiBlendColour(r
, bg
, alpha
);
107 g
= wxAuiBlendColour(g
, bg
, alpha
);
108 b
= wxAuiBlendColour(b
, bg
, alpha
);
110 return wxColour(r
, g
, b
);
114 wxColor
wxAuiLightContrastColour(const wxColour
& c
)
118 // if the color is especially dark, then
119 // make the contrast even lighter
120 if (c
.Red() < 128 && c
.Green() < 128 && c
.Blue() < 128)
123 return wxAuiStepColour(c
, amount
);
126 // wxAuiBitmapFromBits() is a utility function that creates a
127 // masked bitmap from raw bits (XBM format)
128 wxBitmap
wxAuiBitmapFromBits(const unsigned char bits
[], int w
, int h
,
129 const wxColour
& color
)
131 wxImage img
= wxBitmap((const char*)bits
, w
, h
).ConvertToImage();
132 img
.Replace(0,0,0,123,123,123);
133 img
.Replace(255,255,255,color
.Red(),color
.Green(),color
.Blue());
134 img
.SetMaskColour(123,123,123);
135 return wxBitmap(img
);
139 static void DrawGradientRectangle(wxDC
& dc
,
141 const wxColour
& start_color
,
142 const wxColour
& end_color
,
145 int rd
, gd
, bd
, high
= 0;
146 rd
= end_color
.Red() - start_color
.Red();
147 gd
= end_color
.Green() - start_color
.Green();
148 bd
= end_color
.Blue() - start_color
.Blue();
150 if (direction
== wxAUI_GRADIENT_VERTICAL
)
151 high
= rect
.GetHeight()-1;
153 high
= rect
.GetWidth()-1;
155 for (int i
= 0; i
<= high
; ++i
)
160 r
= start_color
.Red() + (high
<= 0 ? 0 : (((i
*rd
*100)/high
)/100));
161 g
= start_color
.Green() + (high
<= 0 ? 0 : (((i
*gd
*100)/high
)/100));
162 b
= start_color
.Blue() + (high
<= 0 ? 0 : (((i
*bd
*100)/high
)/100));
164 wxPen
p(wxColor((unsigned char)r
,
169 if (direction
== wxAUI_GRADIENT_VERTICAL
)
170 dc
.DrawLine(rect
.x
, rect
.y
+i
, rect
.x
+rect
.width
, rect
.y
+i
);
172 dc
.DrawLine(rect
.x
+i
, rect
.y
, rect
.x
+i
, rect
.y
+rect
.height
);
176 wxString
wxAuiChopText(wxDC
& dc
, const wxString
& text
, int max_size
)
180 // first check if the text fits with no problems
181 dc
.GetTextExtent(text
, &x
, &y
);
185 size_t i
, len
= text
.Length();
186 size_t last_good_length
= 0;
187 for (i
= 0; i
< len
; ++i
)
189 wxString s
= text
.Left(i
);
192 dc
.GetTextExtent(s
, &x
, &y
);
196 last_good_length
= i
;
199 wxString ret
= text
.Left(last_good_length
);
204 wxAuiDefaultDockArt::wxAuiDefaultDockArt()
206 #if defined( __WXMAC__ ) && wxOSX_USE_COCOA_OR_CARBON
207 wxColor base_colour
= wxColour( wxMacCreateCGColorFromHITheme(kThemeBrushToolbarBackground
));
209 wxColor base_colour
= wxSystemSettings::GetColour(wxSYS_COLOUR_3DFACE
);
212 // the base_colour is too pale to use as our base colour,
213 // so darken it a bit --
214 if ((255-base_colour
.Red()) +
215 (255-base_colour
.Green()) +
216 (255-base_colour
.Blue()) < 60)
218 base_colour
= wxAuiStepColour(base_colour
, 92);
221 m_base_colour
= base_colour
;
222 wxColor darker1_colour
= wxAuiStepColour(base_colour
, 85);
223 wxColor darker2_colour
= wxAuiStepColour(base_colour
, 75);
224 wxColor darker3_colour
= wxAuiStepColour(base_colour
, 60);
225 //wxColor darker4_colour = wxAuiStepColour(base_colour, 50);
226 wxColor darker5_colour
= wxAuiStepColour(base_colour
, 40);
228 m_active_caption_colour
= wxSystemSettings::GetColour(wxSYS_COLOUR_HIGHLIGHT
);
229 m_active_caption_gradient_colour
= wxAuiLightContrastColour(wxSystemSettings::GetColour(wxSYS_COLOUR_HIGHLIGHT
));
230 m_active_caption_text_colour
= wxSystemSettings::GetColour(wxSYS_COLOUR_HIGHLIGHTTEXT
);
231 m_inactive_caption_colour
= darker1_colour
;
232 m_inactive_caption_gradient_colour
= wxAuiStepColour(base_colour
, 97);
233 m_inactive_caption_text_colour
= *wxBLACK
;
235 m_sash_brush
= wxBrush(base_colour
);
236 m_background_brush
= wxBrush(base_colour
);
237 m_gripper_brush
= wxBrush(base_colour
);
239 m_border_pen
= wxPen(darker2_colour
);
240 m_gripper_pen1
= wxPen(darker5_colour
);
241 m_gripper_pen2
= wxPen(darker3_colour
);
242 m_gripper_pen3
= *wxWHITE_PEN
;
245 m_caption_font
= *wxSMALL_FONT
;
247 m_caption_font
= wxFont(8, wxDEFAULT
, wxNORMAL
, wxNORMAL
, FALSE
);
250 // some built in bitmaps
251 #if defined( __WXMAC__ )
252 static unsigned char close_bits
[]={
253 0xFF, 0xFF, 0xFF, 0xFF, 0x0F, 0xFE, 0x03, 0xF8, 0x01, 0xF0, 0x19, 0xF3,
254 0xB8, 0xE3, 0xF0, 0xE1, 0xE0, 0xE0, 0xF0, 0xE1, 0xB8, 0xE3, 0x19, 0xF3,
255 0x01, 0xF0, 0x03, 0xF8, 0x0F, 0xFE, 0xFF, 0xFF };
256 #elif defined(__WXGTK__)
257 static unsigned char close_bits
[]={
258 0xff, 0xff, 0xff, 0xff, 0x07, 0xf0, 0xfb, 0xef, 0xdb, 0xed, 0x8b, 0xe8,
259 0x1b, 0xec, 0x3b, 0xee, 0x1b, 0xec, 0x8b, 0xe8, 0xdb, 0xed, 0xfb, 0xef,
260 0x07, 0xf0, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff };
262 static unsigned char close_bits
[]={
263 // reduced height, symmetric
264 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xcf, 0xf3, 0x9f, 0xf9,
265 0x3f, 0xfc, 0x7f, 0xfe, 0x3f, 0xfc, 0x9f, 0xf9, 0xcf, 0xf3, 0xff, 0xff,
266 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff };
268 // same height as maximize/restore
269 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xe7, 0xe7, 0xcf, 0xf3, 0x9f, 0xf9,
270 0x3f, 0xfc, 0x7f, 0xfe, 0x3f, 0xfc, 0x9f, 0xf9, 0xcf, 0xf3, 0xe7, 0xe7,
271 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff };
275 static unsigned char maximize_bits
[] = {
276 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x07, 0xf0, 0xf7, 0xf7, 0x07, 0xf0,
277 0xf7, 0xf7, 0xf7, 0xf7, 0xf7, 0xf7, 0xf7, 0xf7, 0xf7, 0xf7, 0x07, 0xf0,
278 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff};
280 static unsigned char restore_bits
[]={
281 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x1f, 0xf0, 0x1f, 0xf0, 0xdf, 0xf7,
282 0x07, 0xf4, 0x07, 0xf4, 0xf7, 0xf5, 0xf7, 0xf1, 0xf7, 0xfd, 0xf7, 0xfd,
283 0x07, 0xfc, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff};
285 static unsigned char pin_bits
[]={
286 0xff,0xff,0xff,0xff,0xff,0xff,0x1f,0xfc,0xdf,0xfc,0xdf,0xfc,
287 0xdf,0xfc,0xdf,0xfc,0xdf,0xfc,0x0f,0xf8,0x7f,0xff,0x7f,0xff,
288 0x7f,0xff,0xff,0xff,0xff,0xff,0xff,0xff};
291 m_inactive_close_bitmap
= wxAuiBitmapFromBits(close_bits
, 16, 16, *wxWHITE
);
292 m_active_close_bitmap
= wxAuiBitmapFromBits(close_bits
, 16, 16, *wxWHITE
);
294 m_inactive_close_bitmap
= wxAuiBitmapFromBits(close_bits
, 16, 16, m_inactive_caption_text_colour
);
295 m_active_close_bitmap
= wxAuiBitmapFromBits(close_bits
, 16, 16, m_active_caption_text_colour
);
299 m_inactive_maximize_bitmap
= wxAuiBitmapFromBits(maximize_bits
, 16, 16, *wxWHITE
);
300 m_active_maximize_bitmap
= wxAuiBitmapFromBits(maximize_bits
, 16, 16, *wxWHITE
);
302 m_inactive_maximize_bitmap
= wxAuiBitmapFromBits(maximize_bits
, 16, 16, m_inactive_caption_text_colour
);
303 m_active_maximize_bitmap
= wxAuiBitmapFromBits(maximize_bits
, 16, 16, m_active_caption_text_colour
);
307 m_inactive_restore_bitmap
= wxAuiBitmapFromBits(restore_bits
, 16, 16, *wxWHITE
);
308 m_active_restore_bitmap
= wxAuiBitmapFromBits(restore_bits
, 16, 16, *wxWHITE
);
310 m_inactive_restore_bitmap
= wxAuiBitmapFromBits(restore_bits
, 16, 16, m_inactive_caption_text_colour
);
311 m_active_restore_bitmap
= wxAuiBitmapFromBits(restore_bits
, 16, 16, m_active_caption_text_colour
);
314 m_inactive_pin_bitmap
= wxAuiBitmapFromBits(pin_bits
, 16, 16, m_inactive_caption_text_colour
);
315 m_active_pin_bitmap
= wxAuiBitmapFromBits(pin_bits
, 16, 16, m_active_caption_text_colour
);
317 // default metric values
318 #if defined( __WXMAC__ ) && wxOSX_USE_COCOA_OR_CARBON
320 GetThemeMetric( kThemeMetricSmallPaneSplitterHeight
, &height
);
321 m_sash_size
= height
;
322 #elif defined(__WXGTK__)
323 m_sash_size
= wxRendererNative::Get().GetSplitterParams(NULL
).widthSash
;
331 m_gradient_type
= wxAUI_GRADIENT_VERTICAL
;
334 int wxAuiDefaultDockArt::GetMetric(int id
)
338 case wxAUI_DOCKART_SASH_SIZE
: return m_sash_size
;
339 case wxAUI_DOCKART_CAPTION_SIZE
: return m_caption_size
;
340 case wxAUI_DOCKART_GRIPPER_SIZE
: return m_gripper_size
;
341 case wxAUI_DOCKART_PANE_BORDER_SIZE
: return m_border_size
;
342 case wxAUI_DOCKART_PANE_BUTTON_SIZE
: return m_button_size
;
343 case wxAUI_DOCKART_GRADIENT_TYPE
: return m_gradient_type
;
344 default: wxFAIL_MSG(wxT("Invalid Metric Ordinal")); break;
350 void wxAuiDefaultDockArt::SetMetric(int id
, int new_val
)
354 case wxAUI_DOCKART_SASH_SIZE
: m_sash_size
= new_val
; break;
355 case wxAUI_DOCKART_CAPTION_SIZE
: m_caption_size
= new_val
; break;
356 case wxAUI_DOCKART_GRIPPER_SIZE
: m_gripper_size
= new_val
; break;
357 case wxAUI_DOCKART_PANE_BORDER_SIZE
: m_border_size
= new_val
; break;
358 case wxAUI_DOCKART_PANE_BUTTON_SIZE
: m_button_size
= new_val
; break;
359 case wxAUI_DOCKART_GRADIENT_TYPE
: m_gradient_type
= new_val
; break;
360 default: wxFAIL_MSG(wxT("Invalid Metric Ordinal")); break;
364 wxColour
wxAuiDefaultDockArt::GetColour(int id
)
368 case wxAUI_DOCKART_BACKGROUND_COLOUR
: return m_background_brush
.GetColour();
369 case wxAUI_DOCKART_SASH_COLOUR
: return m_sash_brush
.GetColour();
370 case wxAUI_DOCKART_INACTIVE_CAPTION_COLOUR
: return m_inactive_caption_colour
;
371 case wxAUI_DOCKART_INACTIVE_CAPTION_GRADIENT_COLOUR
: return m_inactive_caption_gradient_colour
;
372 case wxAUI_DOCKART_INACTIVE_CAPTION_TEXT_COLOUR
: return m_inactive_caption_text_colour
;
373 case wxAUI_DOCKART_ACTIVE_CAPTION_COLOUR
: return m_active_caption_colour
;
374 case wxAUI_DOCKART_ACTIVE_CAPTION_GRADIENT_COLOUR
: return m_active_caption_gradient_colour
;
375 case wxAUI_DOCKART_ACTIVE_CAPTION_TEXT_COLOUR
: return m_active_caption_text_colour
;
376 case wxAUI_DOCKART_BORDER_COLOUR
: return m_border_pen
.GetColour();
377 case wxAUI_DOCKART_GRIPPER_COLOUR
: return m_gripper_brush
.GetColour();
378 default: wxFAIL_MSG(wxT("Invalid Metric Ordinal")); break;
384 void wxAuiDefaultDockArt::SetColour(int id
, const wxColor
& colour
)
388 case wxAUI_DOCKART_BACKGROUND_COLOUR
: m_background_brush
.SetColour(colour
); break;
389 case wxAUI_DOCKART_SASH_COLOUR
: m_sash_brush
.SetColour(colour
); break;
390 case wxAUI_DOCKART_INACTIVE_CAPTION_COLOUR
: m_inactive_caption_colour
= colour
; break;
391 case wxAUI_DOCKART_INACTIVE_CAPTION_GRADIENT_COLOUR
: m_inactive_caption_gradient_colour
= colour
; break;
392 case wxAUI_DOCKART_INACTIVE_CAPTION_TEXT_COLOUR
: m_inactive_caption_text_colour
= colour
; break;
393 case wxAUI_DOCKART_ACTIVE_CAPTION_COLOUR
: m_active_caption_colour
= colour
; break;
394 case wxAUI_DOCKART_ACTIVE_CAPTION_GRADIENT_COLOUR
: m_active_caption_gradient_colour
= colour
; break;
395 case wxAUI_DOCKART_ACTIVE_CAPTION_TEXT_COLOUR
: m_active_caption_text_colour
= colour
; break;
396 case wxAUI_DOCKART_BORDER_COLOUR
: m_border_pen
.SetColour(colour
); break;
397 case wxAUI_DOCKART_GRIPPER_COLOUR
:
398 m_gripper_brush
.SetColour(colour
);
399 m_gripper_pen1
.SetColour(wxAuiStepColour(colour
, 40));
400 m_gripper_pen2
.SetColour(wxAuiStepColour(colour
, 60));
402 default: wxFAIL_MSG(wxT("Invalid Metric Ordinal")); break;
406 void wxAuiDefaultDockArt::SetFont(int id
, const wxFont
& font
)
408 if (id
== wxAUI_DOCKART_CAPTION_FONT
)
409 m_caption_font
= font
;
412 wxFont
wxAuiDefaultDockArt::GetFont(int id
)
414 if (id
== wxAUI_DOCKART_CAPTION_FONT
)
415 return m_caption_font
;
419 void wxAuiDefaultDockArt::DrawSash(wxDC
& dc
, wxWindow
*window
, int orientation
, const wxRect
& rect
)
421 #if defined( __WXMAC__ ) && wxOSX_USE_COCOA_OR_CARBON
423 wxUnusedVar(orientation
);
425 HIRect splitterRect
= CGRectMake( rect
.x
, rect
.y
, rect
.width
, rect
.height
);
426 CGContextRef cgContext
;
427 wxGCDCImpl
*impl
= (wxGCDCImpl
*) dc
.GetImpl();
428 cgContext
= (CGContextRef
) impl
->GetGraphicsContext()->GetNativeContext() ;
430 HIThemeSplitterDrawInfo drawInfo
;
431 drawInfo
.version
= 0 ;
432 drawInfo
.state
= kThemeStateActive
;
433 drawInfo
.adornment
= kHIThemeSplitterAdornmentNone
;
434 HIThemeDrawPaneSplitter( &splitterRect
, &drawInfo
, cgContext
, kHIThemeOrientationNormal
) ;
436 #elif defined(__WXGTK__)
437 // clear out the rectangle first
438 dc
.SetPen(*wxTRANSPARENT_PEN
);
439 dc
.SetBrush(m_sash_brush
);
440 dc
.DrawRectangle(rect
.x
, rect
.y
, rect
.width
, rect
.height
);
443 GdkRectangle gdk_rect
;
444 if (orientation
== wxVERTICAL
)
448 gdk_rect
.width
= m_sash_size
;
449 gdk_rect
.height
= rect
.height
;
455 gdk_rect
.width
= rect
.width
;
456 gdk_rect
.height
= m_sash_size
;
461 if (!window
->m_wxwindow
) return;
462 if (!GTK_WIDGET_DRAWABLE(window
->m_wxwindow
)) return;
466 window
->m_wxwindow
->style
,
467 window
->GTKGetDrawingWindow(),
468 // flags & wxCONTROL_CURRENT ? GTK_STATE_PRELIGHT : GTK_STATE_NORMAL,
471 NULL
/* no clipping */,
478 (orientation
== wxVERTICAL
) ? GTK_ORIENTATION_VERTICAL
: GTK_ORIENTATION_HORIZONTAL
483 wxUnusedVar(orientation
);
484 dc
.SetPen(*wxTRANSPARENT_PEN
);
485 dc
.SetBrush(m_sash_brush
);
486 dc
.DrawRectangle(rect
.x
, rect
.y
, rect
.width
, rect
.height
);
491 void wxAuiDefaultDockArt::DrawBackground(wxDC
& dc
, wxWindow
*WXUNUSED(window
), int, const wxRect
& rect
)
493 dc
.SetPen(*wxTRANSPARENT_PEN
);
495 // we have to clear first, otherwise we are drawing a light striped pattern
496 // over an already darker striped background
497 dc
.SetBrush(*wxWHITE_BRUSH
) ;
498 dc
.DrawRectangle(rect
.x
, rect
.y
, rect
.width
, rect
.height
);
500 dc
.SetBrush(m_background_brush
);
501 dc
.DrawRectangle(rect
.x
, rect
.y
, rect
.width
, rect
.height
);
504 void wxAuiDefaultDockArt::DrawBorder(wxDC
& dc
, wxWindow
*WXUNUSED(window
), const wxRect
& _rect
,
507 dc
.SetPen(m_border_pen
);
508 dc
.SetBrush(*wxTRANSPARENT_BRUSH
);
511 int i
, border_width
= GetMetric(wxAUI_DOCKART_PANE_BORDER_SIZE
);
513 if (pane
.IsToolbar())
515 for (i
= 0; i
< border_width
; ++i
)
517 dc
.SetPen(*wxWHITE_PEN
);
518 dc
.DrawLine(rect
.x
, rect
.y
, rect
.x
+rect
.width
, rect
.y
);
519 dc
.DrawLine(rect
.x
, rect
.y
, rect
.x
, rect
.y
+rect
.height
);
520 dc
.SetPen(m_border_pen
);
521 dc
.DrawLine(rect
.x
, rect
.y
+rect
.height
-1,
522 rect
.x
+rect
.width
, rect
.y
+rect
.height
-1);
523 dc
.DrawLine(rect
.x
+rect
.width
-1, rect
.y
,
524 rect
.x
+rect
.width
-1, rect
.y
+rect
.height
);
530 for (i
= 0; i
< border_width
; ++i
)
532 dc
.DrawRectangle(rect
.x
, rect
.y
, rect
.width
, rect
.height
);
539 void wxAuiDefaultDockArt::DrawCaptionBackground(wxDC
& dc
, const wxRect
& rect
, bool active
)
541 if (m_gradient_type
== wxAUI_GRADIENT_NONE
)
544 dc
.SetBrush(wxBrush(m_active_caption_colour
));
546 dc
.SetBrush(wxBrush(m_inactive_caption_colour
));
548 dc
.DrawRectangle(rect
.x
, rect
.y
, rect
.width
, rect
.height
);
554 // on mac the gradients are expected to become darker from the top
556 DrawGradientRectangle(dc
, rect
,
557 m_active_caption_colour
,
558 m_active_caption_gradient_colour
,
561 // on other platforms, active gradients become lighter at the top
562 DrawGradientRectangle(dc
, rect
,
563 m_active_caption_gradient_colour
,
564 m_active_caption_colour
,
571 // on mac the gradients are expected to become darker from the top
572 DrawGradientRectangle(dc
, rect
,
573 m_inactive_caption_gradient_colour
,
574 m_inactive_caption_colour
,
577 // on other platforms, inactive gradients become lighter at the bottom
578 DrawGradientRectangle(dc
, rect
,
579 m_inactive_caption_colour
,
580 m_inactive_caption_gradient_colour
,
588 void wxAuiDefaultDockArt::DrawCaption(wxDC
& dc
, wxWindow
*WXUNUSED(window
),
589 const wxString
& text
,
593 dc
.SetPen(*wxTRANSPARENT_PEN
);
594 dc
.SetFont(m_caption_font
);
596 DrawCaptionBackground(dc
, rect
,
597 (pane
.state
& wxAuiPaneInfo::optionActive
)?true:false);
599 if (pane
.state
& wxAuiPaneInfo::optionActive
)
600 dc
.SetTextForeground(m_active_caption_text_colour
);
602 dc
.SetTextForeground(m_inactive_caption_text_colour
);
606 dc
.GetTextExtent(wxT("ABCDEFHXfgkj"), &w
, &h
);
608 wxRect clip_rect
= rect
;
609 clip_rect
.width
-= 3; // text offset
610 clip_rect
.width
-= 2; // button padding
611 if (pane
.HasCloseButton())
612 clip_rect
.width
-= m_button_size
;
613 if (pane
.HasPinButton())
614 clip_rect
.width
-= m_button_size
;
615 if (pane
.HasMaximizeButton())
616 clip_rect
.width
-= m_button_size
;
618 wxString draw_text
= wxAuiChopText(dc
, text
, clip_rect
.width
);
620 dc
.SetClippingRegion(clip_rect
);
621 dc
.DrawText(draw_text
, rect
.x
+3, rect
.y
+(rect
.height
/2)-(h
/2)-1);
622 dc
.DestroyClippingRegion();
625 void wxAuiDefaultDockArt::DrawGripper(wxDC
& dc
, wxWindow
*WXUNUSED(window
),
629 dc
.SetPen(*wxTRANSPARENT_PEN
);
630 dc
.SetBrush(m_gripper_brush
);
632 dc
.DrawRectangle(rect
.x
, rect
.y
, rect
.width
,rect
.height
);
634 if (!pane
.HasGripperTop())
639 dc
.SetPen(m_gripper_pen1
);
640 dc
.DrawPoint(rect
.x
+3, rect
.y
+y
);
641 dc
.SetPen(m_gripper_pen2
);
642 dc
.DrawPoint(rect
.x
+3, rect
.y
+y
+1);
643 dc
.DrawPoint(rect
.x
+4, rect
.y
+y
);
644 dc
.SetPen(m_gripper_pen3
);
645 dc
.DrawPoint(rect
.x
+5, rect
.y
+y
+1);
646 dc
.DrawPoint(rect
.x
+5, rect
.y
+y
+2);
647 dc
.DrawPoint(rect
.x
+4, rect
.y
+y
+2);
650 if (y
> rect
.GetHeight()-5)
659 dc
.SetPen(m_gripper_pen1
);
660 dc
.DrawPoint(rect
.x
+x
, rect
.y
+3);
661 dc
.SetPen(m_gripper_pen2
);
662 dc
.DrawPoint(rect
.x
+x
+1, rect
.y
+3);
663 dc
.DrawPoint(rect
.x
+x
, rect
.y
+4);
664 dc
.SetPen(m_gripper_pen3
);
665 dc
.DrawPoint(rect
.x
+x
+1, rect
.y
+5);
666 dc
.DrawPoint(rect
.x
+x
+2, rect
.y
+5);
667 dc
.DrawPoint(rect
.x
+x
+2, rect
.y
+4);
670 if (x
> rect
.GetWidth()-5)
676 void wxAuiDefaultDockArt::DrawPaneButton(wxDC
& dc
, wxWindow
*WXUNUSED(window
),
688 case wxAUI_BUTTON_CLOSE
:
689 if (pane
.state
& wxAuiPaneInfo::optionActive
)
690 bmp
= m_active_close_bitmap
;
692 bmp
= m_inactive_close_bitmap
;
694 case wxAUI_BUTTON_PIN
:
695 if (pane
.state
& wxAuiPaneInfo::optionActive
)
696 bmp
= m_active_pin_bitmap
;
698 bmp
= m_inactive_pin_bitmap
;
700 case wxAUI_BUTTON_MAXIMIZE_RESTORE
:
701 if (pane
.IsMaximized())
703 if (pane
.state
& wxAuiPaneInfo::optionActive
)
704 bmp
= m_active_restore_bitmap
;
706 bmp
= m_inactive_restore_bitmap
;
710 if (pane
.state
& wxAuiPaneInfo::optionActive
)
711 bmp
= m_active_maximize_bitmap
;
713 bmp
= m_inactive_maximize_bitmap
;
722 rect
.y
= rect
.y
+ (rect
.height
/2) - (bmp
.GetHeight()/2);
723 rect
.height
= old_y
+ rect
.height
- rect
.y
- 1;
726 if (button_state
== wxAUI_BUTTON_STATE_PRESSED
)
732 if (button_state
== wxAUI_BUTTON_STATE_HOVER
||
733 button_state
== wxAUI_BUTTON_STATE_PRESSED
)
735 if (pane
.state
& wxAuiPaneInfo::optionActive
)
737 dc
.SetBrush(wxBrush(wxAuiStepColour(m_active_caption_colour
, 120)));
738 dc
.SetPen(wxPen(wxAuiStepColour(m_active_caption_colour
, 70)));
742 dc
.SetBrush(wxBrush(wxAuiStepColour(m_inactive_caption_colour
, 120)));
743 dc
.SetPen(wxPen(wxAuiStepColour(m_inactive_caption_colour
, 70)));
746 // draw the background behind the button
747 dc
.DrawRectangle(rect
.x
, rect
.y
, 15, 15);
751 // draw the button itself
752 dc
.DrawBitmap(bmp
, rect
.x
, rect
.y
, true);