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/renderer.h"
48 // -- wxAuiDefaultDockArt class implementation --
50 // wxAuiDefaultDockArt is an art provider class which does all of the drawing for
51 // wxAuiManager. This allows the library caller to customize the dock art
52 // (probably by deriving from this class), or to completely replace all drawing
53 // with custom dock art (probably by writing a new stand-alone class derived
54 // from the wxAuiDockArt base class). The active dock art class can be set via
55 // wxAuiManager::SetDockArt()
58 // wxAuiBlendColour is used by wxAuiStepColour
59 double wxAuiBlendColour(double fg
, double bg
, double alpha
)
61 double result
= bg
+ (alpha
* (fg
- bg
));
69 // wxAuiStepColour() it a utility function that simply darkens
70 // or lightens a color, based on the specified percentage
71 // ialpha of 0 would be completely black, 100 completely white
72 // an ialpha of 100 returns the same colour
73 wxColor
wxAuiStepColour(const wxColor
& c
, int ialpha
)
78 double r
= c
.Red(), g
= c
.Green(), b
= c
.Blue();
81 // ialpha is 0..200 where 0 is completely black
82 // and 200 is completely white and 100 is the same
83 // convert that to normal alpha 0.0 - 1.0
84 ialpha
= wxMin(ialpha
, 200);
85 ialpha
= wxMax(ialpha
, 0);
86 double alpha
= ((double)(ialpha
- 100.0))/100.0;
92 alpha
= 1.0 - alpha
; // 0 = transparent fg; 1 = opaque fg
98 alpha
= 1.0 + alpha
; // 0 = transparent fg; 1 = opaque fg
101 r
= wxAuiBlendColour(r
, bg
, alpha
);
102 g
= wxAuiBlendColour(g
, bg
, alpha
);
103 b
= wxAuiBlendColour(b
, bg
, alpha
);
105 return wxColour((unsigned char)r
, (unsigned char)g
, (unsigned char)b
);
109 wxColor
wxAuiLightContrastColour(const wxColour
& c
)
113 // if the color is especially dark, then
114 // make the contrast even lighter
115 if (c
.Red() < 128 && c
.Green() < 128 && c
.Blue() < 128)
118 return wxAuiStepColour(c
, amount
);
121 // wxAuiBitmapFromBits() is a utility function that creates a
122 // masked bitmap from raw bits (XBM format)
123 wxBitmap
wxAuiBitmapFromBits(const unsigned char bits
[], int w
, int h
,
124 const wxColour
& color
)
126 wxImage img
= wxBitmap((const char*)bits
, w
, h
).ConvertToImage();
127 img
.Replace(0,0,0,123,123,123);
128 img
.Replace(255,255,255,color
.Red(),color
.Green(),color
.Blue());
129 img
.SetMaskColour(123,123,123);
130 return wxBitmap(img
);
134 static void DrawGradientRectangle(wxDC
& dc
,
136 const wxColour
& start_color
,
137 const wxColour
& end_color
,
140 int rd
, gd
, bd
, high
= 0;
141 rd
= end_color
.Red() - start_color
.Red();
142 gd
= end_color
.Green() - start_color
.Green();
143 bd
= end_color
.Blue() - start_color
.Blue();
145 if (direction
== wxAUI_GRADIENT_VERTICAL
)
146 high
= rect
.GetHeight()-1;
148 high
= rect
.GetWidth()-1;
150 for (int i
= 0; i
<= high
; ++i
)
155 r
= start_color
.Red() + (high
<= 0 ? 0 : (((i
*rd
*100)/high
)/100));
156 g
= start_color
.Green() + (high
<= 0 ? 0 : (((i
*gd
*100)/high
)/100));
157 b
= start_color
.Blue() + (high
<= 0 ? 0 : (((i
*bd
*100)/high
)/100));
159 wxPen
p(wxColor((unsigned char)r
,
164 if (direction
== wxAUI_GRADIENT_VERTICAL
)
165 dc
.DrawLine(rect
.x
, rect
.y
+i
, rect
.x
+rect
.width
, rect
.y
+i
);
167 dc
.DrawLine(rect
.x
+i
, rect
.y
, rect
.x
+i
, rect
.y
+rect
.height
);
171 wxString
wxAuiChopText(wxDC
& dc
, const wxString
& text
, int max_size
)
175 // first check if the text fits with no problems
176 dc
.GetTextExtent(text
, &x
, &y
);
180 size_t i
, len
= text
.Length();
181 size_t last_good_length
= 0;
182 for (i
= 0; i
< len
; ++i
)
184 wxString s
= text
.Left(i
);
187 dc
.GetTextExtent(s
, &x
, &y
);
191 last_good_length
= i
;
194 wxString ret
= text
.Left(last_good_length
);
199 wxAuiDefaultDockArt::wxAuiDefaultDockArt()
202 wxColor base_colour
= wxColour( wxMacCreateCGColorFromHITheme(kThemeBrushToolbarBackground
));
204 wxColor base_colour
= wxSystemSettings::GetColour(wxSYS_COLOUR_3DFACE
);
207 // the base_colour is too pale to use as our base colour,
208 // so darken it a bit --
209 if ((255-base_colour
.Red()) +
210 (255-base_colour
.Green()) +
211 (255-base_colour
.Blue()) < 60)
213 base_colour
= wxAuiStepColour(base_colour
, 92);
216 m_base_colour
= base_colour
;
217 wxColor darker1_colour
= wxAuiStepColour(base_colour
, 85);
218 wxColor darker2_colour
= wxAuiStepColour(base_colour
, 75);
219 wxColor darker3_colour
= wxAuiStepColour(base_colour
, 60);
220 //wxColor darker4_colour = wxAuiStepColour(base_colour, 50);
221 wxColor darker5_colour
= wxAuiStepColour(base_colour
, 40);
223 m_active_caption_colour
= wxSystemSettings::GetColour(wxSYS_COLOUR_HIGHLIGHT
);
224 m_active_caption_gradient_colour
= wxAuiLightContrastColour(wxSystemSettings::GetColour(wxSYS_COLOUR_HIGHLIGHT
));
225 m_active_caption_text_colour
= wxSystemSettings::GetColour(wxSYS_COLOUR_HIGHLIGHTTEXT
);
226 m_inactive_caption_colour
= darker1_colour
;
227 m_inactive_caption_gradient_colour
= wxAuiStepColour(base_colour
, 97);
228 m_inactive_caption_text_colour
= *wxBLACK
;
230 m_sash_brush
= wxBrush(base_colour
);
231 m_background_brush
= wxBrush(base_colour
);
232 m_gripper_brush
= wxBrush(base_colour
);
234 m_border_pen
= wxPen(darker2_colour
);
235 m_gripper_pen1
= wxPen(darker5_colour
);
236 m_gripper_pen2
= wxPen(darker3_colour
);
237 m_gripper_pen3
= *wxWHITE_PEN
;
240 m_caption_font
= *wxSMALL_FONT
;
242 m_caption_font
= wxFont(8, wxDEFAULT
, wxNORMAL
, wxNORMAL
, FALSE
);
245 // some built in bitmaps
246 #if defined( __WXMAC__ )
247 static unsigned char close_bits
[]={
248 0xFF, 0xFF, 0xFF, 0xFF, 0x0F, 0xFE, 0x03, 0xF8, 0x01, 0xF0, 0x19, 0xF3,
249 0xB8, 0xE3, 0xF0, 0xE1, 0xE0, 0xE0, 0xF0, 0xE1, 0xB8, 0xE3, 0x19, 0xF3,
250 0x01, 0xF0, 0x03, 0xF8, 0x0F, 0xFE, 0xFF, 0xFF };
251 #elif defined(__WXGTK__)
252 static unsigned char close_bits
[]={
253 0xff, 0xff, 0xff, 0xff, 0x07, 0xf0, 0xfb, 0xef, 0xdb, 0xed, 0x8b, 0xe8,
254 0x1b, 0xec, 0x3b, 0xee, 0x1b, 0xec, 0x8b, 0xe8, 0xdb, 0xed, 0xfb, 0xef,
255 0x07, 0xf0, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff };
257 static unsigned char close_bits
[]={
258 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xe7, 0xf3, 0xcf, 0xf9,
259 0x9f, 0xfc, 0x3f, 0xfe, 0x3f, 0xfe, 0x9f, 0xfc, 0xcf, 0xf9, 0xe7, 0xf3,
260 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff};
263 static unsigned char maximize_bits
[] = {
264 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x07, 0xf0, 0xf7, 0xf7, 0x07, 0xf0,
265 0xf7, 0xf7, 0xf7, 0xf7, 0xf7, 0xf7, 0xf7, 0xf7, 0xf7, 0xf7, 0x07, 0xf0,
266 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff};
268 static unsigned char restore_bits
[]={
269 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x1f, 0xf0, 0x1f, 0xf0, 0xdf, 0xf7,
270 0x07, 0xf4, 0x07, 0xf4, 0xf7, 0xf5, 0xf7, 0xf1, 0xf7, 0xfd, 0xf7, 0xfd,
271 0x07, 0xfc, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff};
273 static unsigned char pin_bits
[]={
274 0xff,0xff,0xff,0xff,0xff,0xff,0x1f,0xfc,0xdf,0xfc,0xdf,0xfc,
275 0xdf,0xfc,0xdf,0xfc,0xdf,0xfc,0x0f,0xf8,0x7f,0xff,0x7f,0xff,
276 0x7f,0xff,0xff,0xff,0xff,0xff,0xff,0xff};
279 m_inactive_close_bitmap
= wxAuiBitmapFromBits(close_bits
, 16, 16, *wxWHITE
);
280 m_active_close_bitmap
= wxAuiBitmapFromBits(close_bits
, 16, 16, *wxWHITE
);
282 m_inactive_close_bitmap
= wxAuiBitmapFromBits(close_bits
, 16, 16, m_inactive_caption_text_colour
);
283 m_active_close_bitmap
= wxAuiBitmapFromBits(close_bits
, 16, 16, m_active_caption_text_colour
);
287 m_inactive_maximize_bitmap
= wxAuiBitmapFromBits(maximize_bits
, 16, 16, *wxWHITE
);
288 m_active_maximize_bitmap
= wxAuiBitmapFromBits(maximize_bits
, 16, 16, *wxWHITE
);
290 m_inactive_maximize_bitmap
= wxAuiBitmapFromBits(maximize_bits
, 16, 16, m_inactive_caption_text_colour
);
291 m_active_maximize_bitmap
= wxAuiBitmapFromBits(maximize_bits
, 16, 16, m_active_caption_text_colour
);
295 m_inactive_restore_bitmap
= wxAuiBitmapFromBits(restore_bits
, 16, 16, *wxWHITE
);
296 m_active_restore_bitmap
= wxAuiBitmapFromBits(restore_bits
, 16, 16, *wxWHITE
);
298 m_inactive_restore_bitmap
= wxAuiBitmapFromBits(restore_bits
, 16, 16, m_inactive_caption_text_colour
);
299 m_active_restore_bitmap
= wxAuiBitmapFromBits(restore_bits
, 16, 16, m_active_caption_text_colour
);
302 m_inactive_pin_bitmap
= wxAuiBitmapFromBits(pin_bits
, 16, 16, m_inactive_caption_text_colour
);
303 m_active_pin_bitmap
= wxAuiBitmapFromBits(pin_bits
, 16, 16, m_active_caption_text_colour
);
305 // default metric values
306 #if defined(__WXMAC__)
308 GetThemeMetric( kThemeMetricSmallPaneSplitterHeight
, &height
);
309 m_sash_size
= height
;
310 #elif defined(__WXGTK__)
311 m_sash_size
= wxRendererNative::Get().GetSplitterParams(NULL
).widthSash
;
319 m_gradient_type
= wxAUI_GRADIENT_VERTICAL
;
322 int wxAuiDefaultDockArt::GetMetric(int id
)
326 case wxAUI_DOCKART_SASH_SIZE
: return m_sash_size
;
327 case wxAUI_DOCKART_CAPTION_SIZE
: return m_caption_size
;
328 case wxAUI_DOCKART_GRIPPER_SIZE
: return m_gripper_size
;
329 case wxAUI_DOCKART_PANE_BORDER_SIZE
: return m_border_size
;
330 case wxAUI_DOCKART_PANE_BUTTON_SIZE
: return m_button_size
;
331 case wxAUI_DOCKART_GRADIENT_TYPE
: return m_gradient_type
;
332 default: wxFAIL_MSG(wxT("Invalid Metric Ordinal")); break;
338 void wxAuiDefaultDockArt::SetMetric(int id
, int new_val
)
342 case wxAUI_DOCKART_SASH_SIZE
: m_sash_size
= new_val
; break;
343 case wxAUI_DOCKART_CAPTION_SIZE
: m_caption_size
= new_val
; break;
344 case wxAUI_DOCKART_GRIPPER_SIZE
: m_gripper_size
= new_val
; break;
345 case wxAUI_DOCKART_PANE_BORDER_SIZE
: m_border_size
= new_val
; break;
346 case wxAUI_DOCKART_PANE_BUTTON_SIZE
: m_button_size
= new_val
; break;
347 case wxAUI_DOCKART_GRADIENT_TYPE
: m_gradient_type
= new_val
; break;
348 default: wxFAIL_MSG(wxT("Invalid Metric Ordinal")); break;
352 wxColour
wxAuiDefaultDockArt::GetColour(int id
)
356 case wxAUI_DOCKART_BACKGROUND_COLOUR
: return m_background_brush
.GetColour();
357 case wxAUI_DOCKART_SASH_COLOUR
: return m_sash_brush
.GetColour();
358 case wxAUI_DOCKART_INACTIVE_CAPTION_COLOUR
: return m_inactive_caption_colour
;
359 case wxAUI_DOCKART_INACTIVE_CAPTION_GRADIENT_COLOUR
: return m_inactive_caption_gradient_colour
;
360 case wxAUI_DOCKART_INACTIVE_CAPTION_TEXT_COLOUR
: return m_inactive_caption_text_colour
;
361 case wxAUI_DOCKART_ACTIVE_CAPTION_COLOUR
: return m_active_caption_colour
;
362 case wxAUI_DOCKART_ACTIVE_CAPTION_GRADIENT_COLOUR
: return m_active_caption_gradient_colour
;
363 case wxAUI_DOCKART_ACTIVE_CAPTION_TEXT_COLOUR
: return m_active_caption_text_colour
;
364 case wxAUI_DOCKART_BORDER_COLOUR
: return m_border_pen
.GetColour();
365 case wxAUI_DOCKART_GRIPPER_COLOUR
: return m_gripper_brush
.GetColour();
366 default: wxFAIL_MSG(wxT("Invalid Metric Ordinal")); break;
372 void wxAuiDefaultDockArt::SetColour(int id
, const wxColor
& colour
)
376 case wxAUI_DOCKART_BACKGROUND_COLOUR
: m_background_brush
.SetColour(colour
); break;
377 case wxAUI_DOCKART_SASH_COLOUR
: m_sash_brush
.SetColour(colour
); break;
378 case wxAUI_DOCKART_INACTIVE_CAPTION_COLOUR
: m_inactive_caption_colour
= colour
; break;
379 case wxAUI_DOCKART_INACTIVE_CAPTION_GRADIENT_COLOUR
: m_inactive_caption_gradient_colour
= colour
; break;
380 case wxAUI_DOCKART_INACTIVE_CAPTION_TEXT_COLOUR
: m_inactive_caption_text_colour
= colour
; break;
381 case wxAUI_DOCKART_ACTIVE_CAPTION_COLOUR
: m_active_caption_colour
= colour
; break;
382 case wxAUI_DOCKART_ACTIVE_CAPTION_GRADIENT_COLOUR
: m_active_caption_gradient_colour
= colour
; break;
383 case wxAUI_DOCKART_ACTIVE_CAPTION_TEXT_COLOUR
: m_active_caption_text_colour
= colour
; break;
384 case wxAUI_DOCKART_BORDER_COLOUR
: m_border_pen
.SetColour(colour
); break;
385 case wxAUI_DOCKART_GRIPPER_COLOUR
:
386 m_gripper_brush
.SetColour(colour
);
387 m_gripper_pen1
.SetColour(wxAuiStepColour(colour
, 40));
388 m_gripper_pen2
.SetColour(wxAuiStepColour(colour
, 60));
390 default: wxFAIL_MSG(wxT("Invalid Metric Ordinal")); break;
394 void wxAuiDefaultDockArt::SetFont(int id
, const wxFont
& font
)
396 if (id
== wxAUI_DOCKART_CAPTION_FONT
)
397 m_caption_font
= font
;
400 wxFont
wxAuiDefaultDockArt::GetFont(int id
)
402 if (id
== wxAUI_DOCKART_CAPTION_FONT
)
403 return m_caption_font
;
407 void wxAuiDefaultDockArt::DrawSash(wxDC
& dc
, wxWindow
*window
, int orientation
, const wxRect
& rect
)
409 #if defined(__WXMAC__)
411 wxUnusedVar(orientation
);
413 HIRect splitterRect
= CGRectMake( rect
.x
, rect
.y
, rect
.width
, rect
.height
);
414 CGContextRef cgContext
;
415 cgContext
= (CGContextRef
) dc
.GetGraphicsContext()->GetNativeContext() ;
417 HIThemeSplitterDrawInfo drawInfo
;
418 drawInfo
.version
= 0 ;
419 drawInfo
.state
= kThemeStateActive
;
420 drawInfo
.adornment
= kHIThemeSplitterAdornmentNone
;
421 HIThemeDrawPaneSplitter( &splitterRect
, &drawInfo
, cgContext
, kHIThemeOrientationNormal
) ;
423 #elif defined(__WXGTK__)
424 // clear out the rectangle first
425 dc
.SetPen(*wxTRANSPARENT_PEN
);
426 dc
.SetBrush(m_sash_brush
);
427 dc
.DrawRectangle(rect
.x
, rect
.y
, rect
.width
, rect
.height
);
430 GdkRectangle gdk_rect
;
431 if (orientation
== wxVERTICAL
)
435 gdk_rect
.width
= m_sash_size
;
436 gdk_rect
.height
= rect
.height
;
442 gdk_rect
.width
= rect
.width
;
443 gdk_rect
.height
= m_sash_size
;
448 if (!window
->m_wxwindow
) return;
449 if (!GTK_WIDGET_DRAWABLE(window
->m_wxwindow
)) return;
453 window
->m_wxwindow
->style
,
454 window
->GTKGetDrawingWindow(),
455 // flags & wxCONTROL_CURRENT ? GTK_STATE_PRELIGHT : GTK_STATE_NORMAL,
458 NULL
/* no clipping */,
465 (orientation
== wxVERTICAL
) ? GTK_ORIENTATION_VERTICAL
: GTK_ORIENTATION_HORIZONTAL
470 wxUnusedVar(orientation
);
471 dc
.SetPen(*wxTRANSPARENT_PEN
);
472 dc
.SetBrush(m_sash_brush
);
473 dc
.DrawRectangle(rect
.x
, rect
.y
, rect
.width
, rect
.height
);
478 void wxAuiDefaultDockArt::DrawBackground(wxDC
& dc
, wxWindow
*WXUNUSED(window
), int, const wxRect
& rect
)
480 dc
.SetPen(*wxTRANSPARENT_PEN
);
482 // we have to clear first, otherwise we are drawing a light striped pattern
483 // over an already darker striped background
484 dc
.SetBrush(*wxWHITE_BRUSH
) ;
485 dc
.DrawRectangle(rect
.x
, rect
.y
, rect
.width
, rect
.height
);
487 dc
.SetBrush(m_background_brush
);
488 dc
.DrawRectangle(rect
.x
, rect
.y
, rect
.width
, rect
.height
);
491 void wxAuiDefaultDockArt::DrawBorder(wxDC
& dc
, wxWindow
*WXUNUSED(window
), const wxRect
& _rect
,
494 dc
.SetPen(m_border_pen
);
495 dc
.SetBrush(*wxTRANSPARENT_BRUSH
);
498 int i
, border_width
= GetMetric(wxAUI_DOCKART_PANE_BORDER_SIZE
);
500 if (pane
.IsToolbar())
502 for (i
= 0; i
< border_width
; ++i
)
504 dc
.SetPen(*wxWHITE_PEN
);
505 dc
.DrawLine(rect
.x
, rect
.y
, rect
.x
+rect
.width
, rect
.y
);
506 dc
.DrawLine(rect
.x
, rect
.y
, rect
.x
, rect
.y
+rect
.height
);
507 dc
.SetPen(m_border_pen
);
508 dc
.DrawLine(rect
.x
, rect
.y
+rect
.height
-1,
509 rect
.x
+rect
.width
, rect
.y
+rect
.height
-1);
510 dc
.DrawLine(rect
.x
+rect
.width
-1, rect
.y
,
511 rect
.x
+rect
.width
-1, rect
.y
+rect
.height
);
517 for (i
= 0; i
< border_width
; ++i
)
519 dc
.DrawRectangle(rect
.x
, rect
.y
, rect
.width
, rect
.height
);
526 void wxAuiDefaultDockArt::DrawCaptionBackground(wxDC
& dc
, const wxRect
& rect
, bool active
)
528 if (m_gradient_type
== wxAUI_GRADIENT_NONE
)
531 dc
.SetBrush(wxBrush(m_active_caption_colour
));
533 dc
.SetBrush(wxBrush(m_inactive_caption_colour
));
535 dc
.DrawRectangle(rect
.x
, rect
.y
, rect
.width
, rect
.height
);
541 // on mac the gradients are expected to become darker from the top
543 DrawGradientRectangle(dc
, rect
,
544 m_active_caption_colour
,
545 m_active_caption_gradient_colour
,
548 // on other platforms, active gradients become lighter at the top
549 DrawGradientRectangle(dc
, rect
,
550 m_active_caption_gradient_colour
,
551 m_active_caption_colour
,
558 // on mac the gradients are expected to become darker from the top
559 DrawGradientRectangle(dc
, rect
,
560 m_inactive_caption_gradient_colour
,
561 m_inactive_caption_colour
,
564 // on other platforms, inactive gradients become lighter at the bottom
565 DrawGradientRectangle(dc
, rect
,
566 m_inactive_caption_colour
,
567 m_inactive_caption_gradient_colour
,
575 void wxAuiDefaultDockArt::DrawCaption(wxDC
& dc
, wxWindow
*WXUNUSED(window
),
576 const wxString
& text
,
580 dc
.SetPen(*wxTRANSPARENT_PEN
);
581 dc
.SetFont(m_caption_font
);
583 DrawCaptionBackground(dc
, rect
,
584 (pane
.state
& wxAuiPaneInfo::optionActive
)?true:false);
586 if (pane
.state
& wxAuiPaneInfo::optionActive
)
587 dc
.SetTextForeground(m_active_caption_text_colour
);
589 dc
.SetTextForeground(m_inactive_caption_text_colour
);
593 dc
.GetTextExtent(wxT("ABCDEFHXfgkj"), &w
, &h
);
595 wxRect clip_rect
= rect
;
596 clip_rect
.width
-= 3; // text offset
597 clip_rect
.width
-= 2; // button padding
598 if (pane
.HasCloseButton())
599 clip_rect
.width
-= m_button_size
;
600 if (pane
.HasPinButton())
601 clip_rect
.width
-= m_button_size
;
602 if (pane
.HasMaximizeButton())
603 clip_rect
.width
-= m_button_size
;
605 wxString draw_text
= wxAuiChopText(dc
, text
, clip_rect
.width
);
607 dc
.SetClippingRegion(clip_rect
);
608 dc
.DrawText(draw_text
, rect
.x
+3, rect
.y
+(rect
.height
/2)-(h
/2)-1);
609 dc
.DestroyClippingRegion();
612 void wxAuiDefaultDockArt::DrawGripper(wxDC
& dc
, wxWindow
*WXUNUSED(window
),
616 dc
.SetPen(*wxTRANSPARENT_PEN
);
617 dc
.SetBrush(m_gripper_brush
);
619 dc
.DrawRectangle(rect
.x
, rect
.y
, rect
.width
,rect
.height
);
621 if (!pane
.HasGripperTop())
626 dc
.SetPen(m_gripper_pen1
);
627 dc
.DrawPoint(rect
.x
+3, rect
.y
+y
);
628 dc
.SetPen(m_gripper_pen2
);
629 dc
.DrawPoint(rect
.x
+3, rect
.y
+y
+1);
630 dc
.DrawPoint(rect
.x
+4, rect
.y
+y
);
631 dc
.SetPen(m_gripper_pen3
);
632 dc
.DrawPoint(rect
.x
+5, rect
.y
+y
+1);
633 dc
.DrawPoint(rect
.x
+5, rect
.y
+y
+2);
634 dc
.DrawPoint(rect
.x
+4, rect
.y
+y
+2);
637 if (y
> rect
.GetHeight()-5)
646 dc
.SetPen(m_gripper_pen1
);
647 dc
.DrawPoint(rect
.x
+x
, rect
.y
+3);
648 dc
.SetPen(m_gripper_pen2
);
649 dc
.DrawPoint(rect
.x
+x
+1, rect
.y
+3);
650 dc
.DrawPoint(rect
.x
+x
, rect
.y
+4);
651 dc
.SetPen(m_gripper_pen3
);
652 dc
.DrawPoint(rect
.x
+x
+1, rect
.y
+5);
653 dc
.DrawPoint(rect
.x
+x
+2, rect
.y
+5);
654 dc
.DrawPoint(rect
.x
+x
+2, rect
.y
+4);
657 if (x
> rect
.GetWidth()-5)
663 void wxAuiDefaultDockArt::DrawPaneButton(wxDC
& dc
, wxWindow
*WXUNUSED(window
),
675 case wxAUI_BUTTON_CLOSE
:
676 if (pane
.state
& wxAuiPaneInfo::optionActive
)
677 bmp
= m_active_close_bitmap
;
679 bmp
= m_inactive_close_bitmap
;
681 case wxAUI_BUTTON_PIN
:
682 if (pane
.state
& wxAuiPaneInfo::optionActive
)
683 bmp
= m_active_pin_bitmap
;
685 bmp
= m_inactive_pin_bitmap
;
687 case wxAUI_BUTTON_MAXIMIZE_RESTORE
:
688 if (pane
.IsMaximized())
690 if (pane
.state
& wxAuiPaneInfo::optionActive
)
691 bmp
= m_active_restore_bitmap
;
693 bmp
= m_inactive_restore_bitmap
;
697 if (pane
.state
& wxAuiPaneInfo::optionActive
)
698 bmp
= m_active_maximize_bitmap
;
700 bmp
= m_inactive_maximize_bitmap
;
709 rect
.y
= rect
.y
+ (rect
.height
/2) - (bmp
.GetHeight()/2);
710 rect
.height
= old_y
+ rect
.height
- rect
.y
- 1;
713 if (button_state
== wxAUI_BUTTON_STATE_PRESSED
)
719 if (button_state
== wxAUI_BUTTON_STATE_HOVER
||
720 button_state
== wxAUI_BUTTON_STATE_PRESSED
)
722 if (pane
.state
& wxAuiPaneInfo::optionActive
)
724 dc
.SetBrush(wxBrush(wxAuiStepColour(m_active_caption_colour
, 120)));
725 dc
.SetPen(wxPen(wxAuiStepColour(m_active_caption_colour
, 70)));
729 dc
.SetBrush(wxBrush(wxAuiStepColour(m_inactive_caption_colour
, 120)));
730 dc
.SetPen(wxPen(wxAuiStepColour(m_inactive_caption_colour
, 70)));
733 // draw the background behind the button
734 dc
.DrawRectangle(rect
.x
, rect
.y
, 15, 15);
738 // draw the button itself
739 dc
.DrawBitmap(bmp
, rect
.x
, rect
.y
, true);