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/mac/private.h"
39 #include "wx/graphics.h"
44 #include "wx/gtk/win_gtk.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()
59 // wxAuiBlendColour is used by wxAuiStepColour
60 double wxAuiBlendColour(double fg
, double bg
, double alpha
)
62 double result
= bg
+ (alpha
* (fg
- bg
));
70 // wxAuiStepColour() it a utility function that simply darkens
71 // or lightens a color, based on the specified percentage
72 // ialpha of 0 would be completely black, 100 completely white
73 // an ialpha of 100 returns the same colour
74 wxColor
wxAuiStepColour(const wxColor
& c
, int ialpha
)
79 double r
= c
.Red(), g
= c
.Green(), b
= c
.Blue();
82 // ialpha is 0..200 where 0 is completely black
83 // and 200 is completely white and 100 is the same
84 // convert that to normal alpha 0.0 - 1.0
85 ialpha
= wxMin(ialpha
, 200);
86 ialpha
= wxMax(ialpha
, 0);
87 double alpha
= ((double)(ialpha
- 100.0))/100.0;
93 alpha
= 1.0 - alpha
; // 0 = transparent fg; 1 = opaque fg
99 alpha
= 1.0 + alpha
; // 0 = transparent fg; 1 = opaque fg
102 r
= wxAuiBlendColour(r
, bg
, alpha
);
103 g
= wxAuiBlendColour(g
, bg
, alpha
);
104 b
= wxAuiBlendColour(b
, bg
, alpha
);
106 return wxColour((unsigned char)r
, (unsigned char)g
, (unsigned char)b
);
110 wxColor
wxAuiLightContrastColour(const wxColour
& c
)
114 // if the color is especially dark, then
115 // make the contrast even lighter
116 if (c
.Red() < 128 && c
.Green() < 128 && c
.Blue() < 128)
119 return wxAuiStepColour(c
, amount
);
122 // wxAuiBitmapFromBits() is a utility function that creates a
123 // masked bitmap from raw bits (XBM format)
124 wxBitmap
wxAuiBitmapFromBits(const unsigned char bits
[], int w
, int h
,
125 const wxColour
& color
)
127 wxImage img
= wxBitmap((const char*)bits
, w
, h
).ConvertToImage();
128 img
.Replace(0,0,0,123,123,123);
129 img
.Replace(255,255,255,color
.Red(),color
.Green(),color
.Blue());
130 img
.SetMaskColour(123,123,123);
131 return wxBitmap(img
);
135 static void DrawGradientRectangle(wxDC
& dc
,
137 const wxColour
& start_color
,
138 const wxColour
& end_color
,
141 int rd
, gd
, bd
, high
= 0;
142 rd
= end_color
.Red() - start_color
.Red();
143 gd
= end_color
.Green() - start_color
.Green();
144 bd
= end_color
.Blue() - start_color
.Blue();
146 if (direction
== wxAUI_GRADIENT_VERTICAL
)
147 high
= rect
.GetHeight()-1;
149 high
= rect
.GetWidth()-1;
151 for (int i
= 0; i
<= high
; ++i
)
156 r
= start_color
.Red() + (high
<= 0 ? 0 : (((i
*rd
*100)/high
)/100));
157 g
= start_color
.Green() + (high
<= 0 ? 0 : (((i
*gd
*100)/high
)/100));
158 b
= start_color
.Blue() + (high
<= 0 ? 0 : (((i
*bd
*100)/high
)/100));
160 wxPen
p(wxColor((unsigned char)r
,
165 if (direction
== wxAUI_GRADIENT_VERTICAL
)
166 dc
.DrawLine(rect
.x
, rect
.y
+i
, rect
.x
+rect
.width
, rect
.y
+i
);
168 dc
.DrawLine(rect
.x
+i
, rect
.y
, rect
.x
+i
, rect
.y
+rect
.height
);
172 wxString
wxAuiChopText(wxDC
& dc
, const wxString
& text
, int max_size
)
176 // first check if the text fits with no problems
177 dc
.GetTextExtent(text
, &x
, &y
);
181 size_t i
, len
= text
.Length();
182 size_t last_good_length
= 0;
183 for (i
= 0; i
< len
; ++i
)
185 wxString s
= text
.Left(i
);
188 dc
.GetTextExtent(s
, &x
, &y
);
192 last_good_length
= i
;
195 wxString ret
= text
.Left(last_good_length
);
200 wxAuiDefaultDockArt::wxAuiDefaultDockArt()
203 wxBrush toolbarbrush
;
204 toolbarbrush
.MacSetTheme( kThemeBrushToolbarBackground
);
205 wxColor base_colour
= toolbarbrush
.GetColour();
207 wxColor base_colour
= wxSystemSettings::GetColour(wxSYS_COLOUR_3DFACE
);
210 // the base_colour is too pale to use as our base colour,
211 // so darken it a bit --
212 if ((255-base_colour
.Red()) +
213 (255-base_colour
.Green()) +
214 (255-base_colour
.Blue()) < 60)
216 base_colour
= wxAuiStepColour(base_colour
, 92);
219 m_base_colour
= base_colour
;
220 wxColor darker1_colour
= wxAuiStepColour(base_colour
, 85);
221 wxColor darker2_colour
= wxAuiStepColour(base_colour
, 75);
222 wxColor darker3_colour
= wxAuiStepColour(base_colour
, 60);
223 //wxColor darker4_colour = wxAuiStepColour(base_colour, 50);
224 wxColor darker5_colour
= wxAuiStepColour(base_colour
, 40);
226 m_active_caption_colour
= wxSystemSettings::GetColour(wxSYS_COLOUR_HIGHLIGHT
);
227 m_active_caption_gradient_colour
= wxAuiLightContrastColour(wxSystemSettings::GetColour(wxSYS_COLOUR_HIGHLIGHT
));
228 m_active_caption_text_colour
= wxSystemSettings::GetColour(wxSYS_COLOUR_HIGHLIGHTTEXT
);
229 m_inactive_caption_colour
= darker1_colour
;
230 m_inactive_caption_gradient_colour
= wxAuiStepColour(base_colour
, 97);
231 m_inactive_caption_text_colour
= *wxBLACK
;
234 m_sash_brush
= toolbarbrush
;
235 m_background_brush
= toolbarbrush
;
236 m_gripper_brush
= toolbarbrush
;
238 m_sash_brush
= wxBrush(base_colour
);
239 m_background_brush
= wxBrush(base_colour
);
240 m_gripper_brush
= wxBrush(base_colour
);
242 m_border_pen
= wxPen(darker2_colour
);
243 m_gripper_pen1
= wxPen(darker5_colour
);
244 m_gripper_pen2
= wxPen(darker3_colour
);
245 m_gripper_pen3
= *wxWHITE_PEN
;
248 m_caption_font
= *wxSMALL_FONT
;
250 m_caption_font
= wxFont(8, wxDEFAULT
, wxNORMAL
, wxNORMAL
, FALSE
);
253 // some built in bitmaps
254 #if defined( __WXMAC__ )
255 static unsigned char close_bits
[]={
256 0xFF, 0xFF, 0xFF, 0xFF, 0x0F, 0xFE, 0x03, 0xF8, 0x01, 0xF0, 0x19, 0xF3,
257 0xB8, 0xE3, 0xF0, 0xE1, 0xE0, 0xE0, 0xF0, 0xE1, 0xB8, 0xE3, 0x19, 0xF3,
258 0x01, 0xF0, 0x03, 0xF8, 0x0F, 0xFE, 0xFF, 0xFF };
259 #elif defined(__WXGTK__)
260 static unsigned char close_bits
[]={
261 0xff, 0xff, 0xff, 0xff, 0x07, 0xf0, 0xfb, 0xef, 0xdb, 0xed, 0x8b, 0xe8,
262 0x1b, 0xec, 0x3b, 0xee, 0x1b, 0xec, 0x8b, 0xe8, 0xdb, 0xed, 0xfb, 0xef,
263 0x07, 0xf0, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff };
265 static unsigned char close_bits
[]={
266 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xe7, 0xf3, 0xcf, 0xf9,
267 0x9f, 0xfc, 0x3f, 0xfe, 0x3f, 0xfe, 0x9f, 0xfc, 0xcf, 0xf9, 0xe7, 0xf3,
268 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff};
271 static unsigned char maximize_bits
[] = {
272 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x07, 0xf0, 0xf7, 0xf7, 0x07, 0xf0,
273 0xf7, 0xf7, 0xf7, 0xf7, 0xf7, 0xf7, 0xf7, 0xf7, 0xf7, 0xf7, 0x07, 0xf0,
274 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff};
276 static unsigned char restore_bits
[]={
277 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x1f, 0xf0, 0x1f, 0xf0, 0xdf, 0xf7,
278 0x07, 0xf4, 0x07, 0xf4, 0xf7, 0xf5, 0xf7, 0xf1, 0xf7, 0xfd, 0xf7, 0xfd,
279 0x07, 0xfc, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff};
281 static unsigned char pin_bits
[]={
282 0xff,0xff,0xff,0xff,0xff,0xff,0x1f,0xfc,0xdf,0xfc,0xdf,0xfc,
283 0xdf,0xfc,0xdf,0xfc,0xdf,0xfc,0x0f,0xf8,0x7f,0xff,0x7f,0xff,
284 0x7f,0xff,0xff,0xff,0xff,0xff,0xff,0xff};
287 m_inactive_close_bitmap
= wxAuiBitmapFromBits(close_bits
, 16, 16, *wxWHITE
);
288 m_active_close_bitmap
= wxAuiBitmapFromBits(close_bits
, 16, 16, *wxWHITE
);
290 m_inactive_close_bitmap
= wxAuiBitmapFromBits(close_bits
, 16, 16, m_inactive_caption_text_colour
);
291 m_active_close_bitmap
= wxAuiBitmapFromBits(close_bits
, 16, 16, m_active_caption_text_colour
);
295 m_inactive_maximize_bitmap
= wxAuiBitmapFromBits(maximize_bits
, 16, 16, *wxWHITE
);
296 m_active_maximize_bitmap
= wxAuiBitmapFromBits(maximize_bits
, 16, 16, *wxWHITE
);
298 m_inactive_maximize_bitmap
= wxAuiBitmapFromBits(maximize_bits
, 16, 16, m_inactive_caption_text_colour
);
299 m_active_maximize_bitmap
= wxAuiBitmapFromBits(maximize_bits
, 16, 16, m_active_caption_text_colour
);
303 m_inactive_restore_bitmap
= wxAuiBitmapFromBits(restore_bits
, 16, 16, *wxWHITE
);
304 m_active_restore_bitmap
= wxAuiBitmapFromBits(restore_bits
, 16, 16, *wxWHITE
);
306 m_inactive_restore_bitmap
= wxAuiBitmapFromBits(restore_bits
, 16, 16, m_inactive_caption_text_colour
);
307 m_active_restore_bitmap
= wxAuiBitmapFromBits(restore_bits
, 16, 16, m_active_caption_text_colour
);
310 m_inactive_pin_bitmap
= wxAuiBitmapFromBits(pin_bits
, 16, 16, m_inactive_caption_text_colour
);
311 m_active_pin_bitmap
= wxAuiBitmapFromBits(pin_bits
, 16, 16, m_active_caption_text_colour
);
313 // default metric values
314 #if defined(__WXMAC__)
316 GetThemeMetric( kThemeMetricSmallPaneSplitterHeight
, &height
);
317 m_sash_size
= height
;
318 #elif defined(__WXGTK__)
319 m_sash_size
= wxRendererNative::Get().GetSplitterParams(NULL
).widthSash
;
327 m_gradient_type
= wxAUI_GRADIENT_VERTICAL
;
330 int wxAuiDefaultDockArt::GetMetric(int id
)
334 case wxAUI_DOCKART_SASH_SIZE
: return m_sash_size
;
335 case wxAUI_DOCKART_CAPTION_SIZE
: return m_caption_size
;
336 case wxAUI_DOCKART_GRIPPER_SIZE
: return m_gripper_size
;
337 case wxAUI_DOCKART_PANE_BORDER_SIZE
: return m_border_size
;
338 case wxAUI_DOCKART_PANE_BUTTON_SIZE
: return m_button_size
;
339 case wxAUI_DOCKART_GRADIENT_TYPE
: return m_gradient_type
;
340 default: wxFAIL_MSG(wxT("Invalid Metric Ordinal")); break;
346 void wxAuiDefaultDockArt::SetMetric(int id
, int new_val
)
350 case wxAUI_DOCKART_SASH_SIZE
: m_sash_size
= new_val
; break;
351 case wxAUI_DOCKART_CAPTION_SIZE
: m_caption_size
= new_val
; break;
352 case wxAUI_DOCKART_GRIPPER_SIZE
: m_gripper_size
= new_val
; break;
353 case wxAUI_DOCKART_PANE_BORDER_SIZE
: m_border_size
= new_val
; break;
354 case wxAUI_DOCKART_PANE_BUTTON_SIZE
: m_button_size
= new_val
; break;
355 case wxAUI_DOCKART_GRADIENT_TYPE
: m_gradient_type
= new_val
; break;
356 default: wxFAIL_MSG(wxT("Invalid Metric Ordinal")); break;
360 wxColour
wxAuiDefaultDockArt::GetColour(int id
)
364 case wxAUI_DOCKART_BACKGROUND_COLOUR
: return m_background_brush
.GetColour();
365 case wxAUI_DOCKART_SASH_COLOUR
: return m_sash_brush
.GetColour();
366 case wxAUI_DOCKART_INACTIVE_CAPTION_COLOUR
: return m_inactive_caption_colour
;
367 case wxAUI_DOCKART_INACTIVE_CAPTION_GRADIENT_COLOUR
: return m_inactive_caption_gradient_colour
;
368 case wxAUI_DOCKART_INACTIVE_CAPTION_TEXT_COLOUR
: return m_inactive_caption_text_colour
;
369 case wxAUI_DOCKART_ACTIVE_CAPTION_COLOUR
: return m_active_caption_colour
;
370 case wxAUI_DOCKART_ACTIVE_CAPTION_GRADIENT_COLOUR
: return m_active_caption_gradient_colour
;
371 case wxAUI_DOCKART_ACTIVE_CAPTION_TEXT_COLOUR
: return m_active_caption_text_colour
;
372 case wxAUI_DOCKART_BORDER_COLOUR
: return m_border_pen
.GetColour();
373 case wxAUI_DOCKART_GRIPPER_COLOUR
: return m_gripper_brush
.GetColour();
374 default: wxFAIL_MSG(wxT("Invalid Metric Ordinal")); break;
380 void wxAuiDefaultDockArt::SetColour(int id
, const wxColor
& colour
)
384 case wxAUI_DOCKART_BACKGROUND_COLOUR
: m_background_brush
.SetColour(colour
); break;
385 case wxAUI_DOCKART_SASH_COLOUR
: m_sash_brush
.SetColour(colour
); break;
386 case wxAUI_DOCKART_INACTIVE_CAPTION_COLOUR
: m_inactive_caption_colour
= colour
; break;
387 case wxAUI_DOCKART_INACTIVE_CAPTION_GRADIENT_COLOUR
: m_inactive_caption_gradient_colour
= colour
; break;
388 case wxAUI_DOCKART_INACTIVE_CAPTION_TEXT_COLOUR
: m_inactive_caption_text_colour
= colour
; break;
389 case wxAUI_DOCKART_ACTIVE_CAPTION_COLOUR
: m_active_caption_colour
= colour
; break;
390 case wxAUI_DOCKART_ACTIVE_CAPTION_GRADIENT_COLOUR
: m_active_caption_gradient_colour
= colour
; break;
391 case wxAUI_DOCKART_ACTIVE_CAPTION_TEXT_COLOUR
: m_active_caption_text_colour
= colour
; break;
392 case wxAUI_DOCKART_BORDER_COLOUR
: m_border_pen
.SetColour(colour
); break;
393 case wxAUI_DOCKART_GRIPPER_COLOUR
:
394 m_gripper_brush
.SetColour(colour
);
395 m_gripper_pen1
.SetColour(wxAuiStepColour(colour
, 40));
396 m_gripper_pen2
.SetColour(wxAuiStepColour(colour
, 60));
398 default: wxFAIL_MSG(wxT("Invalid Metric Ordinal")); break;
402 void wxAuiDefaultDockArt::SetFont(int id
, const wxFont
& font
)
404 if (id
== wxAUI_DOCKART_CAPTION_FONT
)
405 m_caption_font
= font
;
408 wxFont
wxAuiDefaultDockArt::GetFont(int id
)
410 if (id
== wxAUI_DOCKART_CAPTION_FONT
)
411 return m_caption_font
;
415 void wxAuiDefaultDockArt::DrawSash(wxDC
& dc
, wxWindow
*window
, int orientation
, const wxRect
& rect
)
417 #if defined(__WXMAC__)
419 wxUnusedVar(orientation
);
421 HIRect splitterRect
= CGRectMake( rect
.x
, rect
.y
, rect
.width
, rect
.height
);
422 CGContextRef cgContext
;
423 #if wxMAC_USE_CORE_GRAPHICS
424 cgContext
= (CGContextRef
) dc
.GetGraphicsContext()->GetNativeContext() ;
427 GetPortBounds( (CGrafPtr
) dc
.m_macPort
, &bounds
) ;
428 QDBeginCGContext( (CGrafPtr
) dc
.m_macPort
, &cgContext
) ;
429 CGContextTranslateCTM( cgContext
, 0 , bounds
.bottom
- bounds
.top
) ;
430 CGContextScaleCTM( cgContext
, 1 , -1 ) ;
433 HIThemeSplitterDrawInfo drawInfo
;
434 drawInfo
.version
= 0 ;
435 drawInfo
.state
= kThemeStateActive
;
436 drawInfo
.adornment
= kHIThemeSplitterAdornmentNone
;
437 HIThemeDrawPaneSplitter( &splitterRect
, &drawInfo
, cgContext
, kHIThemeOrientationNormal
) ;
439 #if wxMAC_USE_CORE_GRAPHICS
441 QDEndCGContext( (CGrafPtr
) dc
.m_macPort
, &cgContext
) ;
444 #elif defined(__WXGTK__)
445 // clear out the rectangle first
446 dc
.SetPen(*wxTRANSPARENT_PEN
);
447 dc
.SetBrush(m_sash_brush
);
448 dc
.DrawRectangle(rect
.x
, rect
.y
, rect
.width
, rect
.height
);
451 GdkRectangle gdk_rect
;
452 if (orientation
== wxVERTICAL
)
456 gdk_rect
.width
= m_sash_size
;
457 gdk_rect
.height
= rect
.height
;
463 gdk_rect
.width
= rect
.width
;
464 gdk_rect
.height
= m_sash_size
;
469 if (!window
->m_wxwindow
) return;
470 if (!GTK_PIZZA(window
->m_wxwindow
)->bin_window
) return;
474 window
->m_wxwindow
->style
,
475 GTK_PIZZA(window
->m_wxwindow
)->bin_window
,
476 // flags & wxCONTROL_CURRENT ? GTK_STATE_PRELIGHT : GTK_STATE_NORMAL,
479 NULL
/* no clipping */,
486 (orientation
== wxVERTICAL
) ? GTK_ORIENTATION_VERTICAL
: GTK_ORIENTATION_HORIZONTAL
491 wxUnusedVar(orientation
);
492 dc
.SetPen(*wxTRANSPARENT_PEN
);
493 dc
.SetBrush(m_sash_brush
);
494 dc
.DrawRectangle(rect
.x
, rect
.y
, rect
.width
, rect
.height
);
499 void wxAuiDefaultDockArt::DrawBackground(wxDC
& dc
, wxWindow
*WXUNUSED(window
), int, const wxRect
& rect
)
501 dc
.SetPen(*wxTRANSPARENT_PEN
);
503 // we have to clear first, otherwise we are drawing a light striped pattern
504 // over an already darker striped background
505 dc
.SetBrush(*wxWHITE_BRUSH
) ;
506 dc
.DrawRectangle(rect
.x
, rect
.y
, rect
.width
, rect
.height
);
508 dc
.SetBrush(m_background_brush
);
509 dc
.DrawRectangle(rect
.x
, rect
.y
, rect
.width
, rect
.height
);
512 void wxAuiDefaultDockArt::DrawBorder(wxDC
& dc
, wxWindow
*WXUNUSED(window
), const wxRect
& _rect
,
515 dc
.SetPen(m_border_pen
);
516 dc
.SetBrush(*wxTRANSPARENT_BRUSH
);
519 int i
, border_width
= GetMetric(wxAUI_DOCKART_PANE_BORDER_SIZE
);
521 if (pane
.IsToolbar())
523 for (i
= 0; i
< border_width
; ++i
)
525 dc
.SetPen(*wxWHITE_PEN
);
526 dc
.DrawLine(rect
.x
, rect
.y
, rect
.x
+rect
.width
, rect
.y
);
527 dc
.DrawLine(rect
.x
, rect
.y
, rect
.x
, rect
.y
+rect
.height
);
528 dc
.SetPen(m_border_pen
);
529 dc
.DrawLine(rect
.x
, rect
.y
+rect
.height
-1,
530 rect
.x
+rect
.width
, rect
.y
+rect
.height
-1);
531 dc
.DrawLine(rect
.x
+rect
.width
-1, rect
.y
,
532 rect
.x
+rect
.width
-1, rect
.y
+rect
.height
);
538 for (i
= 0; i
< border_width
; ++i
)
540 dc
.DrawRectangle(rect
.x
, rect
.y
, rect
.width
, rect
.height
);
547 void wxAuiDefaultDockArt::DrawCaptionBackground(wxDC
& dc
, const wxRect
& rect
, bool active
)
549 if (m_gradient_type
== wxAUI_GRADIENT_NONE
)
552 dc
.SetBrush(wxBrush(m_active_caption_colour
));
554 dc
.SetBrush(wxBrush(m_inactive_caption_colour
));
556 dc
.DrawRectangle(rect
.x
, rect
.y
, rect
.width
, rect
.height
);
562 // on mac the gradients are expected to become darker from the top
564 DrawGradientRectangle(dc
, rect
,
565 m_active_caption_colour
,
566 m_active_caption_gradient_colour
,
569 // on other platforms, active gradients become lighter at the top
570 DrawGradientRectangle(dc
, rect
,
571 m_active_caption_gradient_colour
,
572 m_active_caption_colour
,
579 // on mac the gradients are expected to become darker from the top
580 DrawGradientRectangle(dc
, rect
,
581 m_inactive_caption_gradient_colour
,
582 m_inactive_caption_colour
,
585 // on other platforms, inactive gradients become lighter at the bottom
586 DrawGradientRectangle(dc
, rect
,
587 m_inactive_caption_colour
,
588 m_inactive_caption_gradient_colour
,
596 void wxAuiDefaultDockArt::DrawCaption(wxDC
& dc
, wxWindow
*WXUNUSED(window
),
597 const wxString
& text
,
601 dc
.SetPen(*wxTRANSPARENT_PEN
);
602 dc
.SetFont(m_caption_font
);
604 DrawCaptionBackground(dc
, rect
,
605 (pane
.state
& wxAuiPaneInfo::optionActive
)?true:false);
607 if (pane
.state
& wxAuiPaneInfo::optionActive
)
608 dc
.SetTextForeground(m_active_caption_text_colour
);
610 dc
.SetTextForeground(m_inactive_caption_text_colour
);
614 dc
.GetTextExtent(wxT("ABCDEFHXfgkj"), &w
, &h
);
616 wxRect clip_rect
= rect
;
617 clip_rect
.width
-= 3; // text offset
618 clip_rect
.width
-= 2; // button padding
619 if (pane
.HasCloseButton())
620 clip_rect
.width
-= m_button_size
;
621 if (pane
.HasPinButton())
622 clip_rect
.width
-= m_button_size
;
623 if (pane
.HasMaximizeButton())
624 clip_rect
.width
-= m_button_size
;
626 wxString draw_text
= wxAuiChopText(dc
, text
, clip_rect
.width
);
628 dc
.SetClippingRegion(clip_rect
);
629 dc
.DrawText(draw_text
, rect
.x
+3, rect
.y
+(rect
.height
/2)-(h
/2)-1);
630 dc
.DestroyClippingRegion();
633 void wxAuiDefaultDockArt::DrawGripper(wxDC
& dc
, wxWindow
*WXUNUSED(window
),
637 dc
.SetPen(*wxTRANSPARENT_PEN
);
638 dc
.SetBrush(m_gripper_brush
);
640 dc
.DrawRectangle(rect
.x
, rect
.y
, rect
.width
,rect
.height
);
642 if (!pane
.HasGripperTop())
647 dc
.SetPen(m_gripper_pen1
);
648 dc
.DrawPoint(rect
.x
+3, rect
.y
+y
);
649 dc
.SetPen(m_gripper_pen2
);
650 dc
.DrawPoint(rect
.x
+3, rect
.y
+y
+1);
651 dc
.DrawPoint(rect
.x
+4, rect
.y
+y
);
652 dc
.SetPen(m_gripper_pen3
);
653 dc
.DrawPoint(rect
.x
+5, rect
.y
+y
+1);
654 dc
.DrawPoint(rect
.x
+5, rect
.y
+y
+2);
655 dc
.DrawPoint(rect
.x
+4, rect
.y
+y
+2);
658 if (y
> rect
.GetHeight()-5)
667 dc
.SetPen(m_gripper_pen1
);
668 dc
.DrawPoint(rect
.x
+x
, rect
.y
+3);
669 dc
.SetPen(m_gripper_pen2
);
670 dc
.DrawPoint(rect
.x
+x
+1, rect
.y
+3);
671 dc
.DrawPoint(rect
.x
+x
, rect
.y
+4);
672 dc
.SetPen(m_gripper_pen3
);
673 dc
.DrawPoint(rect
.x
+x
+1, rect
.y
+5);
674 dc
.DrawPoint(rect
.x
+x
+2, rect
.y
+5);
675 dc
.DrawPoint(rect
.x
+x
+2, rect
.y
+4);
678 if (x
> rect
.GetWidth()-5)
684 void wxAuiDefaultDockArt::DrawPaneButton(wxDC
& dc
, wxWindow
*WXUNUSED(window
),
696 case wxAUI_BUTTON_CLOSE
:
697 if (pane
.state
& wxAuiPaneInfo::optionActive
)
698 bmp
= m_active_close_bitmap
;
700 bmp
= m_inactive_close_bitmap
;
702 case wxAUI_BUTTON_PIN
:
703 if (pane
.state
& wxAuiPaneInfo::optionActive
)
704 bmp
= m_active_pin_bitmap
;
706 bmp
= m_inactive_pin_bitmap
;
708 case wxAUI_BUTTON_MAXIMIZE_RESTORE
:
709 if (pane
.IsMaximized())
711 if (pane
.state
& wxAuiPaneInfo::optionActive
)
712 bmp
= m_active_restore_bitmap
;
714 bmp
= m_inactive_restore_bitmap
;
718 if (pane
.state
& wxAuiPaneInfo::optionActive
)
719 bmp
= m_active_maximize_bitmap
;
721 bmp
= m_inactive_maximize_bitmap
;
730 rect
.y
= rect
.y
+ (rect
.height
/2) - (bmp
.GetHeight()/2);
731 rect
.height
= old_y
+ rect
.height
- rect
.y
- 1;
734 if (button_state
== wxAUI_BUTTON_STATE_PRESSED
)
740 if (button_state
== wxAUI_BUTTON_STATE_HOVER
||
741 button_state
== wxAUI_BUTTON_STATE_PRESSED
)
743 if (pane
.state
& wxAuiPaneInfo::optionActive
)
745 dc
.SetBrush(wxBrush(wxAuiStepColour(m_active_caption_colour
, 120)));
746 dc
.SetPen(wxPen(wxAuiStepColour(m_active_caption_colour
, 70)));
750 dc
.SetBrush(wxBrush(wxAuiStepColour(m_inactive_caption_colour
, 120)));
751 dc
.SetPen(wxPen(wxAuiStepColour(m_inactive_caption_colour
, 70)));
754 // draw the background behind the button
755 dc
.DrawRectangle(rect
.x
, rect
.y
, 15, 15);
759 // draw the button itself
760 dc
.DrawBitmap(bmp
, rect
.x
, rect
.y
, true);