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"
47 #include "wx/gtk/private/gtk2-compat.h"
49 #define gtk_widget_is_drawable GTK_WIDGET_DRAWABLE
52 #include "wx/graphics.h"
57 // -- wxAuiDefaultDockArt class implementation --
59 // wxAuiDefaultDockArt is an art provider class which does all of the drawing for
60 // wxAuiManager. This allows the library caller to customize the dock art
61 // (probably by deriving from this class), or to completely replace all drawing
62 // with custom dock art (probably by writing a new stand-alone class derived
63 // from the wxAuiDockArt base class). The active dock art class can be set via
64 // wxAuiManager::SetDockArt()
65 wxColor
wxAuiLightContrastColour(const wxColour
& c
)
69 // if the color is especially dark, then
70 // make the contrast even lighter
71 if (c
.Red() < 128 && c
.Green() < 128 && c
.Blue() < 128)
74 return c
.ChangeLightness(amount
);
77 // wxAuiBitmapFromBits() is a utility function that creates a
78 // masked bitmap from raw bits (XBM format)
79 wxBitmap
wxAuiBitmapFromBits(const unsigned char bits
[], int w
, int h
,
80 const wxColour
& color
)
82 wxImage img
= wxBitmap((const char*)bits
, w
, h
).ConvertToImage();
83 img
.Replace(0,0,0,123,123,123);
84 img
.Replace(255,255,255,color
.Red(),color
.Green(),color
.Blue());
85 img
.SetMaskColour(123,123,123);
90 static void DrawGradientRectangle(wxDC
& dc
,
92 const wxColour
& start_color
,
93 const wxColour
& end_color
,
96 int rd
, gd
, bd
, high
= 0;
97 rd
= end_color
.Red() - start_color
.Red();
98 gd
= end_color
.Green() - start_color
.Green();
99 bd
= end_color
.Blue() - start_color
.Blue();
101 if (direction
== wxAUI_GRADIENT_VERTICAL
)
102 high
= rect
.GetHeight()-1;
104 high
= rect
.GetWidth()-1;
106 for (int i
= 0; i
<= high
; ++i
)
111 r
= start_color
.Red() + (high
<= 0 ? 0 : (((i
*rd
*100)/high
)/100));
112 g
= start_color
.Green() + (high
<= 0 ? 0 : (((i
*gd
*100)/high
)/100));
113 b
= start_color
.Blue() + (high
<= 0 ? 0 : (((i
*bd
*100)/high
)/100));
115 wxPen
p(wxColor((unsigned char)r
,
120 if (direction
== wxAUI_GRADIENT_VERTICAL
)
121 dc
.DrawLine(rect
.x
, rect
.y
+i
, rect
.x
+rect
.width
, rect
.y
+i
);
123 dc
.DrawLine(rect
.x
+i
, rect
.y
, rect
.x
+i
, rect
.y
+rect
.height
);
127 wxString
wxAuiChopText(wxDC
& dc
, const wxString
& text
, int max_size
)
131 // first check if the text fits with no problems
132 dc
.GetTextExtent(text
, &x
, &y
);
136 size_t i
, len
= text
.Length();
137 size_t last_good_length
= 0;
138 for (i
= 0; i
< len
; ++i
)
140 wxString s
= text
.Left(i
);
143 dc
.GetTextExtent(s
, &x
, &y
);
147 last_good_length
= i
;
150 wxString ret
= text
.Left(last_good_length
);
155 wxAuiDefaultDockArt::wxAuiDefaultDockArt()
157 #if defined( __WXMAC__ ) && wxOSX_USE_COCOA_OR_CARBON
158 wxColor baseColour
= wxColour( wxMacCreateCGColorFromHITheme(kThemeBrushToolbarBackground
));
160 wxColor baseColour
= wxSystemSettings::GetColour(wxSYS_COLOUR_3DFACE
);
163 // the baseColour is too pale to use as our base colour,
164 // so darken it a bit --
165 if ((255-baseColour
.Red()) +
166 (255-baseColour
.Green()) +
167 (255-baseColour
.Blue()) < 60)
169 baseColour
= baseColour
.ChangeLightness(92);
172 m_baseColour
= baseColour
;
173 wxColor darker1Colour
= baseColour
.ChangeLightness(85);
174 wxColor darker2Colour
= baseColour
.ChangeLightness(75);
175 wxColor darker3Colour
= baseColour
.ChangeLightness(60);
176 //wxColor darker4Colour = baseColour.ChangeLightness(50);
177 wxColor darker5Colour
= baseColour
.ChangeLightness(40);
179 m_activeCaptionColour
= wxSystemSettings::GetColour(wxSYS_COLOUR_HIGHLIGHT
);
180 m_activeCaptionGradientColour
= wxAuiLightContrastColour(wxSystemSettings::GetColour(wxSYS_COLOUR_HIGHLIGHT
));
181 m_activeCaptionTextColour
= wxSystemSettings::GetColour(wxSYS_COLOUR_HIGHLIGHTTEXT
);
182 m_inactiveCaptionColour
= darker1Colour
;
183 m_inactiveCaptionGradientColour
= baseColour
.ChangeLightness(97);
184 m_inactiveCaptionTextColour
= *wxBLACK
;
186 m_sashBrush
= wxBrush(baseColour
);
187 m_backgroundBrush
= wxBrush(baseColour
);
188 m_gripperBrush
= wxBrush(baseColour
);
190 m_borderPen
= wxPen(darker2Colour
);
191 m_gripperPen1
= wxPen(darker5Colour
);
192 m_gripperPen2
= wxPen(darker3Colour
);
193 m_gripperPen3
= *wxWHITE_PEN
;
196 m_captionFont
= *wxSMALL_FONT
;
198 m_captionFont
= wxFont(8, wxDEFAULT
, wxNORMAL
, wxNORMAL
, FALSE
);
201 // default metric values
202 #if defined( __WXMAC__ ) && wxOSX_USE_COCOA_OR_CARBON
204 GetThemeMetric( kThemeMetricSmallPaneSplitterHeight
, &height
);
206 #elif defined(__WXGTK__)
207 m_sashSize
= wxRendererNative::Get().GetSplitterParams(NULL
).widthSash
;
215 m_gradientType
= wxAUI_GRADIENT_VERTICAL
;
221 wxAuiDefaultDockArt::InitBitmaps ()
223 // some built in bitmaps
224 #if defined( __WXMAC__ )
225 static const unsigned char close_bits
[]={
226 0xFF, 0xFF, 0xFF, 0xFF, 0x0F, 0xFE, 0x03, 0xF8, 0x01, 0xF0, 0x19, 0xF3,
227 0xB8, 0xE3, 0xF0, 0xE1, 0xE0, 0xE0, 0xF0, 0xE1, 0xB8, 0xE3, 0x19, 0xF3,
228 0x01, 0xF0, 0x03, 0xF8, 0x0F, 0xFE, 0xFF, 0xFF };
229 #elif defined(__WXGTK__)
230 static const unsigned char close_bits
[]={
231 0xff, 0xff, 0xff, 0xff, 0x07, 0xf0, 0xfb, 0xef, 0xdb, 0xed, 0x8b, 0xe8,
232 0x1b, 0xec, 0x3b, 0xee, 0x1b, 0xec, 0x8b, 0xe8, 0xdb, 0xed, 0xfb, 0xef,
233 0x07, 0xf0, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff };
235 static const unsigned char close_bits
[]={
236 // reduced height, symmetric
237 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xcf, 0xf3, 0x9f, 0xf9,
238 0x3f, 0xfc, 0x7f, 0xfe, 0x3f, 0xfc, 0x9f, 0xf9, 0xcf, 0xf3, 0xff, 0xff,
239 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff };
241 // same height as maximize/restore
242 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xe7, 0xe7, 0xcf, 0xf3, 0x9f, 0xf9,
243 0x3f, 0xfc, 0x7f, 0xfe, 0x3f, 0xfc, 0x9f, 0xf9, 0xcf, 0xf3, 0xe7, 0xe7,
244 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff };
248 static const unsigned char maximize_bits
[] = {
249 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x07, 0xf0, 0xf7, 0xf7, 0x07, 0xf0,
250 0xf7, 0xf7, 0xf7, 0xf7, 0xf7, 0xf7, 0xf7, 0xf7, 0xf7, 0xf7, 0x07, 0xf0,
251 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff};
253 static const unsigned char restore_bits
[]={
254 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x1f, 0xf0, 0x1f, 0xf0, 0xdf, 0xf7,
255 0x07, 0xf4, 0x07, 0xf4, 0xf7, 0xf5, 0xf7, 0xf1, 0xf7, 0xfd, 0xf7, 0xfd,
256 0x07, 0xfc, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff};
258 static const unsigned char pin_bits
[]={
259 0xff,0xff,0xff,0xff,0xff,0xff,0x1f,0xfc,0xdf,0xfc,0xdf,0xfc,
260 0xdf,0xfc,0xdf,0xfc,0xdf,0xfc,0x0f,0xf8,0x7f,0xff,0x7f,0xff,
261 0x7f,0xff,0xff,0xff,0xff,0xff,0xff,0xff};
264 m_inactiveCloseBitmap
= wxAuiBitmapFromBits(close_bits
, 16, 16, *wxWHITE
);
265 m_activeCloseBitmap
= wxAuiBitmapFromBits(close_bits
, 16, 16, *wxWHITE
);
267 m_inactiveCloseBitmap
= wxAuiBitmapFromBits(close_bits
, 16, 16, m_inactiveCaptionTextColour
);
268 m_activeCloseBitmap
= wxAuiBitmapFromBits(close_bits
, 16, 16, m_activeCaptionTextColour
);
272 m_inactiveMaximizeBitmap
= wxAuiBitmapFromBits(maximize_bits
, 16, 16, *wxWHITE
);
273 m_activeMaximizeBitmap
= wxAuiBitmapFromBits(maximize_bits
, 16, 16, *wxWHITE
);
275 m_inactiveMaximizeBitmap
= wxAuiBitmapFromBits(maximize_bits
, 16, 16, m_inactiveCaptionTextColour
);
276 m_activeMaximizeBitmap
= wxAuiBitmapFromBits(maximize_bits
, 16, 16, m_activeCaptionTextColour
);
280 m_inactiveRestoreBitmap
= wxAuiBitmapFromBits(restore_bits
, 16, 16, *wxWHITE
);
281 m_activeRestoreBitmap
= wxAuiBitmapFromBits(restore_bits
, 16, 16, *wxWHITE
);
283 m_inactiveRestoreBitmap
= wxAuiBitmapFromBits(restore_bits
, 16, 16, m_inactiveCaptionTextColour
);
284 m_activeRestoreBitmap
= wxAuiBitmapFromBits(restore_bits
, 16, 16, m_activeCaptionTextColour
);
287 m_inactivePinBitmap
= wxAuiBitmapFromBits(pin_bits
, 16, 16, m_inactiveCaptionTextColour
);
288 m_activePinBitmap
= wxAuiBitmapFromBits(pin_bits
, 16, 16, m_activeCaptionTextColour
);
291 int wxAuiDefaultDockArt::GetMetric(int id
)
295 case wxAUI_DOCKART_SASH_SIZE
: return m_sashSize
;
296 case wxAUI_DOCKART_CAPTION_SIZE
: return m_captionSize
;
297 case wxAUI_DOCKART_GRIPPER_SIZE
: return m_gripperSize
;
298 case wxAUI_DOCKART_PANE_BORDER_SIZE
: return m_borderSize
;
299 case wxAUI_DOCKART_PANE_BUTTON_SIZE
: return m_buttonSize
;
300 case wxAUI_DOCKART_GRADIENT_TYPE
: return m_gradientType
;
301 default: wxFAIL_MSG(wxT("Invalid Metric Ordinal")); break;
307 void wxAuiDefaultDockArt::SetMetric(int id
, int new_val
)
311 case wxAUI_DOCKART_SASH_SIZE
: m_sashSize
= new_val
; break;
312 case wxAUI_DOCKART_CAPTION_SIZE
: m_captionSize
= new_val
; break;
313 case wxAUI_DOCKART_GRIPPER_SIZE
: m_gripperSize
= new_val
; break;
314 case wxAUI_DOCKART_PANE_BORDER_SIZE
: m_borderSize
= new_val
; break;
315 case wxAUI_DOCKART_PANE_BUTTON_SIZE
: m_buttonSize
= new_val
; break;
316 case wxAUI_DOCKART_GRADIENT_TYPE
: m_gradientType
= new_val
; break;
317 default: wxFAIL_MSG(wxT("Invalid Metric Ordinal")); break;
321 wxColour
wxAuiDefaultDockArt::GetColour(int id
)
325 case wxAUI_DOCKART_BACKGROUND_COLOUR
: return m_backgroundBrush
.GetColour();
326 case wxAUI_DOCKART_SASH_COLOUR
: return m_sashBrush
.GetColour();
327 case wxAUI_DOCKART_INACTIVE_CAPTION_COLOUR
: return m_inactiveCaptionColour
;
328 case wxAUI_DOCKART_INACTIVE_CAPTION_GRADIENT_COLOUR
: return m_inactiveCaptionGradientColour
;
329 case wxAUI_DOCKART_INACTIVE_CAPTION_TEXT_COLOUR
: return m_inactiveCaptionTextColour
;
330 case wxAUI_DOCKART_ACTIVE_CAPTION_COLOUR
: return m_activeCaptionColour
;
331 case wxAUI_DOCKART_ACTIVE_CAPTION_GRADIENT_COLOUR
: return m_activeCaptionGradientColour
;
332 case wxAUI_DOCKART_ACTIVE_CAPTION_TEXT_COLOUR
: return m_activeCaptionTextColour
;
333 case wxAUI_DOCKART_BORDER_COLOUR
: return m_borderPen
.GetColour();
334 case wxAUI_DOCKART_GRIPPER_COLOUR
: return m_gripperBrush
.GetColour();
335 default: wxFAIL_MSG(wxT("Invalid Metric Ordinal")); break;
341 void wxAuiDefaultDockArt::SetColour(int id
, const wxColor
& colour
)
345 case wxAUI_DOCKART_BACKGROUND_COLOUR
: m_backgroundBrush
.SetColour(colour
); break;
346 case wxAUI_DOCKART_SASH_COLOUR
: m_sashBrush
.SetColour(colour
); break;
347 case wxAUI_DOCKART_INACTIVE_CAPTION_COLOUR
: m_inactiveCaptionColour
= colour
; break;
348 case wxAUI_DOCKART_INACTIVE_CAPTION_GRADIENT_COLOUR
: m_inactiveCaptionGradientColour
= colour
; break;
349 case wxAUI_DOCKART_INACTIVE_CAPTION_TEXT_COLOUR
: m_inactiveCaptionTextColour
= colour
; break;
350 case wxAUI_DOCKART_ACTIVE_CAPTION_COLOUR
: m_activeCaptionColour
= colour
; break;
351 case wxAUI_DOCKART_ACTIVE_CAPTION_GRADIENT_COLOUR
: m_activeCaptionGradientColour
= colour
; break;
352 case wxAUI_DOCKART_ACTIVE_CAPTION_TEXT_COLOUR
: m_activeCaptionTextColour
= colour
; break;
353 case wxAUI_DOCKART_BORDER_COLOUR
: m_borderPen
.SetColour(colour
); break;
354 case wxAUI_DOCKART_GRIPPER_COLOUR
:
355 m_gripperBrush
.SetColour(colour
);
356 m_gripperPen1
.SetColour(colour
.ChangeLightness(40));
357 m_gripperPen2
.SetColour(colour
.ChangeLightness(60));
359 default: wxFAIL_MSG(wxT("Invalid Metric Ordinal")); break;
365 void wxAuiDefaultDockArt::SetFont(int id
, const wxFont
& font
)
367 if (id
== wxAUI_DOCKART_CAPTION_FONT
)
368 m_captionFont
= font
;
371 wxFont
wxAuiDefaultDockArt::GetFont(int id
)
373 if (id
== wxAUI_DOCKART_CAPTION_FONT
)
374 return m_captionFont
;
378 void wxAuiDefaultDockArt::DrawSash(wxDC
& dc
, wxWindow
*window
, int orientation
, const wxRect
& rect
)
380 #if defined( __WXMAC__ ) && wxOSX_USE_COCOA_OR_CARBON
382 wxUnusedVar(orientation
);
384 HIRect splitterRect
= CGRectMake( rect
.x
, rect
.y
, rect
.width
, rect
.height
);
385 CGContextRef cgContext
;
386 wxGCDCImpl
*impl
= (wxGCDCImpl
*) dc
.GetImpl();
387 cgContext
= (CGContextRef
) impl
->GetGraphicsContext()->GetNativeContext() ;
389 HIThemeSplitterDrawInfo drawInfo
;
390 drawInfo
.version
= 0 ;
391 drawInfo
.state
= kThemeStateActive
;
392 drawInfo
.adornment
= kHIThemeSplitterAdornmentNone
;
393 HIThemeDrawPaneSplitter( &splitterRect
, &drawInfo
, cgContext
, kHIThemeOrientationNormal
) ;
395 #elif defined(__WXGTK__)
396 // clear out the rectangle first
397 dc
.SetPen(*wxTRANSPARENT_PEN
);
398 dc
.SetBrush(m_sashBrush
);
399 dc
.DrawRectangle(rect
.x
, rect
.y
, rect
.width
, rect
.height
);
402 GdkRectangle gdk_rect
;
403 if (orientation
== wxVERTICAL
)
407 gdk_rect
.width
= m_sashSize
;
408 gdk_rect
.height
= rect
.height
;
414 gdk_rect
.width
= rect
.width
;
415 gdk_rect
.height
= m_sashSize
;
420 if (!window
->m_wxwindow
) return;
421 if (!gtk_widget_is_drawable(window
->m_wxwindow
)) return;
425 gtk_widget_get_style(window
->m_wxwindow
),
427 static_cast<cairo_t
*>(dc
.GetGraphicsContext()->GetNativeContext()),
429 window
->GTKGetDrawingWindow(),
431 // flags & wxCONTROL_CURRENT ? GTK_STATE_PRELIGHT : GTK_STATE_NORMAL,
435 NULL
/* no clipping */,
443 (orientation
== wxVERTICAL
) ? GTK_ORIENTATION_VERTICAL
: GTK_ORIENTATION_HORIZONTAL
448 wxUnusedVar(orientation
);
449 dc
.SetPen(*wxTRANSPARENT_PEN
);
450 dc
.SetBrush(m_sashBrush
);
451 dc
.DrawRectangle(rect
.x
, rect
.y
, rect
.width
, rect
.height
);
456 void wxAuiDefaultDockArt::DrawBackground(wxDC
& dc
, wxWindow
*WXUNUSED(window
), int, const wxRect
& rect
)
458 dc
.SetPen(*wxTRANSPARENT_PEN
);
460 // we have to clear first, otherwise we are drawing a light striped pattern
461 // over an already darker striped background
462 dc
.SetBrush(*wxWHITE_BRUSH
) ;
463 dc
.DrawRectangle(rect
.x
, rect
.y
, rect
.width
, rect
.height
);
465 dc
.SetBrush(m_backgroundBrush
);
466 dc
.DrawRectangle(rect
.x
, rect
.y
, rect
.width
, rect
.height
);
469 void wxAuiDefaultDockArt::DrawBorder(wxDC
& dc
, wxWindow
*WXUNUSED(window
), const wxRect
& _rect
,
472 dc
.SetPen(m_borderPen
);
473 dc
.SetBrush(*wxTRANSPARENT_BRUSH
);
476 int i
, border_width
= GetMetric(wxAUI_DOCKART_PANE_BORDER_SIZE
);
478 if (pane
.IsToolbar())
480 for (i
= 0; i
< border_width
; ++i
)
482 dc
.SetPen(*wxWHITE_PEN
);
483 dc
.DrawLine(rect
.x
, rect
.y
, rect
.x
+rect
.width
, rect
.y
);
484 dc
.DrawLine(rect
.x
, rect
.y
, rect
.x
, rect
.y
+rect
.height
);
485 dc
.SetPen(m_borderPen
);
486 dc
.DrawLine(rect
.x
, rect
.y
+rect
.height
-1,
487 rect
.x
+rect
.width
, rect
.y
+rect
.height
-1);
488 dc
.DrawLine(rect
.x
+rect
.width
-1, rect
.y
,
489 rect
.x
+rect
.width
-1, rect
.y
+rect
.height
);
495 for (i
= 0; i
< border_width
; ++i
)
497 dc
.DrawRectangle(rect
.x
, rect
.y
, rect
.width
, rect
.height
);
504 void wxAuiDefaultDockArt::DrawCaptionBackground(wxDC
& dc
, const wxRect
& rect
, bool active
)
506 if (m_gradientType
== wxAUI_GRADIENT_NONE
)
509 dc
.SetBrush(wxBrush(m_activeCaptionColour
));
511 dc
.SetBrush(wxBrush(m_inactiveCaptionColour
));
513 dc
.DrawRectangle(rect
.x
, rect
.y
, rect
.width
, rect
.height
);
519 // on mac the gradients are expected to become darker from the top
521 DrawGradientRectangle(dc
, rect
,
522 m_activeCaptionColour
,
523 m_activeCaptionGradientColour
,
526 // on other platforms, active gradients become lighter at the top
527 DrawGradientRectangle(dc
, rect
,
528 m_activeCaptionGradientColour
,
529 m_activeCaptionColour
,
536 // on mac the gradients are expected to become darker from the top
537 DrawGradientRectangle(dc
, rect
,
538 m_inactiveCaptionGradientColour
,
539 m_inactiveCaptionColour
,
542 // on other platforms, inactive gradients become lighter at the bottom
543 DrawGradientRectangle(dc
, rect
,
544 m_inactiveCaptionColour
,
545 m_inactiveCaptionGradientColour
,
553 void wxAuiDefaultDockArt::DrawCaption(wxDC
& dc
, wxWindow
*WXUNUSED(window
),
554 const wxString
& text
,
558 dc
.SetPen(*wxTRANSPARENT_PEN
);
559 dc
.SetFont(m_captionFont
);
561 DrawCaptionBackground(dc
, rect
,
562 (pane
.state
& wxAuiPaneInfo::optionActive
)?true:false);
564 int caption_offset
= 0;
565 if ( pane
.icon
.IsOk() )
567 DrawIcon(dc
, rect
, pane
);
569 caption_offset
+= pane
.icon
.GetWidth() + 3;
572 if (pane
.state
& wxAuiPaneInfo::optionActive
)
573 dc
.SetTextForeground(m_activeCaptionTextColour
);
575 dc
.SetTextForeground(m_inactiveCaptionTextColour
);
579 dc
.GetTextExtent(wxT("ABCDEFHXfgkj"), &w
, &h
);
581 wxRect clip_rect
= rect
;
582 clip_rect
.width
-= 3; // text offset
583 clip_rect
.width
-= 2; // button padding
584 if (pane
.HasCloseButton())
585 clip_rect
.width
-= m_buttonSize
;
586 if (pane
.HasPinButton())
587 clip_rect
.width
-= m_buttonSize
;
588 if (pane
.HasMaximizeButton())
589 clip_rect
.width
-= m_buttonSize
;
591 wxString draw_text
= wxAuiChopText(dc
, text
, clip_rect
.width
);
593 dc
.SetClippingRegion(clip_rect
);
594 dc
.DrawText(draw_text
, rect
.x
+3 + caption_offset
, rect
.y
+(rect
.height
/2)-(h
/2)-1);
595 dc
.DestroyClippingRegion();
599 wxAuiDefaultDockArt::DrawIcon(wxDC
& dc
, const wxRect
& rect
, wxAuiPaneInfo
& pane
)
601 // Draw the icon centered vertically
602 dc
.DrawBitmap(pane
.icon
,
603 rect
.x
+2, rect
.y
+(rect
.height
-pane
.icon
.GetHeight())/2,
607 void wxAuiDefaultDockArt::DrawGripper(wxDC
& dc
, wxWindow
*WXUNUSED(window
),
611 dc
.SetPen(*wxTRANSPARENT_PEN
);
612 dc
.SetBrush(m_gripperBrush
);
614 dc
.DrawRectangle(rect
.x
, rect
.y
, rect
.width
,rect
.height
);
616 if (!pane
.HasGripperTop())
621 dc
.SetPen(m_gripperPen1
);
622 dc
.DrawPoint(rect
.x
+3, rect
.y
+y
);
623 dc
.SetPen(m_gripperPen2
);
624 dc
.DrawPoint(rect
.x
+3, rect
.y
+y
+1);
625 dc
.DrawPoint(rect
.x
+4, rect
.y
+y
);
626 dc
.SetPen(m_gripperPen3
);
627 dc
.DrawPoint(rect
.x
+5, rect
.y
+y
+1);
628 dc
.DrawPoint(rect
.x
+5, rect
.y
+y
+2);
629 dc
.DrawPoint(rect
.x
+4, rect
.y
+y
+2);
632 if (y
> rect
.GetHeight()-5)
641 dc
.SetPen(m_gripperPen1
);
642 dc
.DrawPoint(rect
.x
+x
, rect
.y
+3);
643 dc
.SetPen(m_gripperPen2
);
644 dc
.DrawPoint(rect
.x
+x
+1, rect
.y
+3);
645 dc
.DrawPoint(rect
.x
+x
, rect
.y
+4);
646 dc
.SetPen(m_gripperPen3
);
647 dc
.DrawPoint(rect
.x
+x
+1, rect
.y
+5);
648 dc
.DrawPoint(rect
.x
+x
+2, rect
.y
+5);
649 dc
.DrawPoint(rect
.x
+x
+2, rect
.y
+4);
652 if (x
> rect
.GetWidth()-5)
658 void wxAuiDefaultDockArt::DrawPaneButton(wxDC
& dc
, wxWindow
*WXUNUSED(window
),
670 case wxAUI_BUTTON_CLOSE
:
671 if (pane
.state
& wxAuiPaneInfo::optionActive
)
672 bmp
= m_activeCloseBitmap
;
674 bmp
= m_inactiveCloseBitmap
;
676 case wxAUI_BUTTON_PIN
:
677 if (pane
.state
& wxAuiPaneInfo::optionActive
)
678 bmp
= m_activePinBitmap
;
680 bmp
= m_inactivePinBitmap
;
682 case wxAUI_BUTTON_MAXIMIZE_RESTORE
:
683 if (pane
.IsMaximized())
685 if (pane
.state
& wxAuiPaneInfo::optionActive
)
686 bmp
= m_activeRestoreBitmap
;
688 bmp
= m_inactiveRestoreBitmap
;
692 if (pane
.state
& wxAuiPaneInfo::optionActive
)
693 bmp
= m_activeMaximizeBitmap
;
695 bmp
= m_inactiveMaximizeBitmap
;
704 rect
.y
= rect
.y
+ (rect
.height
/2) - (bmp
.GetHeight()/2);
705 rect
.height
= old_y
+ rect
.height
- rect
.y
- 1;
708 if (button_state
== wxAUI_BUTTON_STATE_PRESSED
)
714 if (button_state
== wxAUI_BUTTON_STATE_HOVER
||
715 button_state
== wxAUI_BUTTON_STATE_PRESSED
)
717 if (pane
.state
& wxAuiPaneInfo::optionActive
)
719 dc
.SetBrush(wxBrush(m_activeCaptionColour
.ChangeLightness(120)));
720 dc
.SetPen(wxPen(m_activeCaptionColour
.ChangeLightness(70)));
724 dc
.SetBrush(wxBrush(m_inactiveCaptionColour
.ChangeLightness(120)));
725 dc
.SetPen(wxPen(m_inactiveCaptionColour
.ChangeLightness(70)));
728 // draw the background behind the button
729 dc
.DrawRectangle(rect
.x
, rect
.y
, 15, 15);
733 // draw the button itself
734 dc
.DrawBitmap(bmp
, rect
.x
, rect
.y
, true);