1 ///////////////////////////////////////////////////////////////////////////////
2 // Name: src/aui/dockart.cpp
3 // Purpose: wxaui: wx advanced user interface - docking window manager
4 // Author: Benjamin I. Williams
7 // Copyright: (C) Copyright 2005-2006, Kirix Corporation, All Rights Reserved
8 // Licence: wxWindows Library Licence, Version 3.1
9 ///////////////////////////////////////////////////////////////////////////////
11 // ============================================================================
13 // ============================================================================
15 // ----------------------------------------------------------------------------
17 // ----------------------------------------------------------------------------
19 #include "wx/wxprec.h"
27 #include "wx/aui/framemanager.h"
28 #include "wx/aui/dockart.h"
29 #include "wx/aui/auibook.h"
30 #include "wx/aui/tabart.h"
33 #include "wx/settings.h"
34 #include "wx/dcclient.h"
39 #include "wx/osx/private.h"
40 #include "wx/graphics.h"
41 #include "wx/dcgraph.h"
46 #include "wx/renderer.h"
48 #include "wx/gtk/private/gtk2-compat.h"
50 #define gtk_widget_is_drawable GTK_WIDGET_DRAWABLE
53 #include "wx/graphics.h"
58 // -- wxAuiDefaultDockArt class implementation --
60 // wxAuiDefaultDockArt is an art provider class which does all of the drawing for
61 // wxAuiManager. This allows the library caller to customize the dock art
62 // (probably by deriving from this class), or to completely replace all drawing
63 // with custom dock art (probably by writing a new stand-alone class derived
64 // from the wxAuiDockArt base class). The active dock art class can be set via
65 // wxAuiManager::SetDockArt()
66 wxColor
wxAuiLightContrastColour(const wxColour
& c
)
70 // if the color is especially dark, then
71 // make the contrast even lighter
72 if (c
.Red() < 128 && c
.Green() < 128 && c
.Blue() < 128)
75 return c
.ChangeLightness(amount
);
78 // wxAuiBitmapFromBits() is a utility function that creates a
79 // masked bitmap from raw bits (XBM format)
80 wxBitmap
wxAuiBitmapFromBits(const unsigned char bits
[], int w
, int h
,
81 const wxColour
& color
)
83 wxImage img
= wxBitmap((const char*)bits
, w
, h
).ConvertToImage();
84 img
.Replace(0,0,0,123,123,123);
85 img
.Replace(255,255,255,color
.Red(),color
.Green(),color
.Blue());
86 img
.SetMaskColour(123,123,123);
91 static void DrawGradientRectangle(wxDC
& dc
,
93 const wxColour
& start_color
,
94 const wxColour
& end_color
,
97 int rd
, gd
, bd
, high
= 0;
98 rd
= end_color
.Red() - start_color
.Red();
99 gd
= end_color
.Green() - start_color
.Green();
100 bd
= end_color
.Blue() - start_color
.Blue();
102 if (direction
== wxAUI_GRADIENT_VERTICAL
)
103 high
= rect
.GetHeight()-1;
105 high
= rect
.GetWidth()-1;
107 for (int i
= 0; i
<= high
; ++i
)
112 r
= start_color
.Red() + (high
<= 0 ? 0 : (((i
*rd
*100)/high
)/100));
113 g
= start_color
.Green() + (high
<= 0 ? 0 : (((i
*gd
*100)/high
)/100));
114 b
= start_color
.Blue() + (high
<= 0 ? 0 : (((i
*bd
*100)/high
)/100));
116 wxPen
p(wxColor((unsigned char)r
,
121 if (direction
== wxAUI_GRADIENT_VERTICAL
)
122 dc
.DrawLine(rect
.x
, rect
.y
+i
, rect
.x
+rect
.width
, rect
.y
+i
);
124 dc
.DrawLine(rect
.x
+i
, rect
.y
, rect
.x
+i
, rect
.y
+rect
.height
);
128 wxString
wxAuiChopText(wxDC
& dc
, const wxString
& text
, int max_size
)
132 // first check if the text fits with no problems
133 dc
.GetTextExtent(text
, &x
, &y
);
137 size_t i
, len
= text
.Length();
138 size_t last_good_length
= 0;
139 for (i
= 0; i
< len
; ++i
)
141 wxString s
= text
.Left(i
);
144 dc
.GetTextExtent(s
, &x
, &y
);
148 last_good_length
= i
;
151 wxString ret
= text
.Left(last_good_length
);
156 wxAuiDefaultDockArt::wxAuiDefaultDockArt()
158 #if defined( __WXMAC__ ) && wxOSX_USE_COCOA_OR_CARBON
159 wxColor baseColour
= wxColour( wxMacCreateCGColorFromHITheme(kThemeBrushToolbarBackground
));
161 wxColor baseColour
= wxSystemSettings::GetColour(wxSYS_COLOUR_3DFACE
);
164 // the baseColour is too pale to use as our base colour,
165 // so darken it a bit --
166 if ((255-baseColour
.Red()) +
167 (255-baseColour
.Green()) +
168 (255-baseColour
.Blue()) < 60)
170 baseColour
= baseColour
.ChangeLightness(92);
173 m_baseColour
= baseColour
;
174 wxColor darker1Colour
= baseColour
.ChangeLightness(85);
175 wxColor darker2Colour
= baseColour
.ChangeLightness(75);
176 wxColor darker3Colour
= baseColour
.ChangeLightness(60);
177 //wxColor darker4Colour = baseColour.ChangeLightness(50);
178 wxColor darker5Colour
= baseColour
.ChangeLightness(40);
180 m_activeCaptionColour
= wxSystemSettings::GetColour(wxSYS_COLOUR_HIGHLIGHT
);
181 m_activeCaptionGradientColour
= wxAuiLightContrastColour(wxSystemSettings::GetColour(wxSYS_COLOUR_HIGHLIGHT
));
182 m_activeCaptionTextColour
= wxSystemSettings::GetColour(wxSYS_COLOUR_HIGHLIGHTTEXT
);
183 m_inactiveCaptionColour
= darker1Colour
;
184 m_inactiveCaptionGradientColour
= baseColour
.ChangeLightness(97);
185 m_inactiveCaptionTextColour
= *wxBLACK
;
187 m_sashBrush
= wxBrush(baseColour
);
188 m_backgroundBrush
= wxBrush(baseColour
);
189 m_gripperBrush
= wxBrush(baseColour
);
191 m_borderPen
= wxPen(darker2Colour
);
192 m_gripperPen1
= wxPen(darker5Colour
);
193 m_gripperPen2
= wxPen(darker3Colour
);
194 m_gripperPen3
= *wxWHITE_PEN
;
197 m_captionFont
= *wxSMALL_FONT
;
199 m_captionFont
= wxFont(8, wxDEFAULT
, wxNORMAL
, wxNORMAL
, FALSE
);
202 // default metric values
203 #if defined( __WXMAC__ ) && wxOSX_USE_COCOA_OR_CARBON
205 GetThemeMetric( kThemeMetricSmallPaneSplitterHeight
, &height
);
207 #elif defined(__WXGTK__)
208 m_sashSize
= wxRendererNative::Get().GetSplitterParams(NULL
).widthSash
;
216 m_gradientType
= wxAUI_GRADIENT_VERTICAL
;
222 wxAuiDefaultDockArt::InitBitmaps ()
224 // some built in bitmaps
225 #if defined( __WXMAC__ )
226 static const unsigned char close_bits
[]={
227 0xFF, 0xFF, 0xFF, 0xFF, 0x0F, 0xFE, 0x03, 0xF8, 0x01, 0xF0, 0x19, 0xF3,
228 0xB8, 0xE3, 0xF0, 0xE1, 0xE0, 0xE0, 0xF0, 0xE1, 0xB8, 0xE3, 0x19, 0xF3,
229 0x01, 0xF0, 0x03, 0xF8, 0x0F, 0xFE, 0xFF, 0xFF };
230 #elif defined(__WXGTK__)
231 static const unsigned char close_bits
[]={
232 0xff, 0xff, 0xff, 0xff, 0x07, 0xf0, 0xfb, 0xef, 0xdb, 0xed, 0x8b, 0xe8,
233 0x1b, 0xec, 0x3b, 0xee, 0x1b, 0xec, 0x8b, 0xe8, 0xdb, 0xed, 0xfb, 0xef,
234 0x07, 0xf0, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff };
236 static const unsigned char close_bits
[]={
237 // reduced height, symmetric
238 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xcf, 0xf3, 0x9f, 0xf9,
239 0x3f, 0xfc, 0x7f, 0xfe, 0x3f, 0xfc, 0x9f, 0xf9, 0xcf, 0xf3, 0xff, 0xff,
240 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff };
242 // same height as maximize/restore
243 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xe7, 0xe7, 0xcf, 0xf3, 0x9f, 0xf9,
244 0x3f, 0xfc, 0x7f, 0xfe, 0x3f, 0xfc, 0x9f, 0xf9, 0xcf, 0xf3, 0xe7, 0xe7,
245 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff };
249 static const unsigned char maximize_bits
[] = {
250 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x07, 0xf0, 0xf7, 0xf7, 0x07, 0xf0,
251 0xf7, 0xf7, 0xf7, 0xf7, 0xf7, 0xf7, 0xf7, 0xf7, 0xf7, 0xf7, 0x07, 0xf0,
252 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff};
254 static const unsigned char restore_bits
[]={
255 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x1f, 0xf0, 0x1f, 0xf0, 0xdf, 0xf7,
256 0x07, 0xf4, 0x07, 0xf4, 0xf7, 0xf5, 0xf7, 0xf1, 0xf7, 0xfd, 0xf7, 0xfd,
257 0x07, 0xfc, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff};
259 static const unsigned char pin_bits
[]={
260 0xff,0xff,0xff,0xff,0xff,0xff,0x1f,0xfc,0xdf,0xfc,0xdf,0xfc,
261 0xdf,0xfc,0xdf,0xfc,0xdf,0xfc,0x0f,0xf8,0x7f,0xff,0x7f,0xff,
262 0x7f,0xff,0xff,0xff,0xff,0xff,0xff,0xff};
265 m_inactiveCloseBitmap
= wxAuiBitmapFromBits(close_bits
, 16, 16, *wxWHITE
);
266 m_activeCloseBitmap
= wxAuiBitmapFromBits(close_bits
, 16, 16, *wxWHITE
);
268 m_inactiveCloseBitmap
= wxAuiBitmapFromBits(close_bits
, 16, 16, m_inactiveCaptionTextColour
);
269 m_activeCloseBitmap
= wxAuiBitmapFromBits(close_bits
, 16, 16, m_activeCaptionTextColour
);
273 m_inactiveMaximizeBitmap
= wxAuiBitmapFromBits(maximize_bits
, 16, 16, *wxWHITE
);
274 m_activeMaximizeBitmap
= wxAuiBitmapFromBits(maximize_bits
, 16, 16, *wxWHITE
);
276 m_inactiveMaximizeBitmap
= wxAuiBitmapFromBits(maximize_bits
, 16, 16, m_inactiveCaptionTextColour
);
277 m_activeMaximizeBitmap
= wxAuiBitmapFromBits(maximize_bits
, 16, 16, m_activeCaptionTextColour
);
281 m_inactiveRestoreBitmap
= wxAuiBitmapFromBits(restore_bits
, 16, 16, *wxWHITE
);
282 m_activeRestoreBitmap
= wxAuiBitmapFromBits(restore_bits
, 16, 16, *wxWHITE
);
284 m_inactiveRestoreBitmap
= wxAuiBitmapFromBits(restore_bits
, 16, 16, m_inactiveCaptionTextColour
);
285 m_activeRestoreBitmap
= wxAuiBitmapFromBits(restore_bits
, 16, 16, m_activeCaptionTextColour
);
288 m_inactivePinBitmap
= wxAuiBitmapFromBits(pin_bits
, 16, 16, m_inactiveCaptionTextColour
);
289 m_activePinBitmap
= wxAuiBitmapFromBits(pin_bits
, 16, 16, m_activeCaptionTextColour
);
292 int wxAuiDefaultDockArt::GetMetric(int id
)
296 case wxAUI_DOCKART_SASH_SIZE
: return m_sashSize
;
297 case wxAUI_DOCKART_CAPTION_SIZE
: return m_captionSize
;
298 case wxAUI_DOCKART_GRIPPER_SIZE
: return m_gripperSize
;
299 case wxAUI_DOCKART_PANE_BORDER_SIZE
: return m_borderSize
;
300 case wxAUI_DOCKART_PANE_BUTTON_SIZE
: return m_buttonSize
;
301 case wxAUI_DOCKART_GRADIENT_TYPE
: return m_gradientType
;
302 default: wxFAIL_MSG(wxT("Invalid Metric Ordinal")); break;
308 void wxAuiDefaultDockArt::SetMetric(int id
, int new_val
)
312 case wxAUI_DOCKART_SASH_SIZE
: m_sashSize
= new_val
; break;
313 case wxAUI_DOCKART_CAPTION_SIZE
: m_captionSize
= new_val
; break;
314 case wxAUI_DOCKART_GRIPPER_SIZE
: m_gripperSize
= new_val
; break;
315 case wxAUI_DOCKART_PANE_BORDER_SIZE
: m_borderSize
= new_val
; break;
316 case wxAUI_DOCKART_PANE_BUTTON_SIZE
: m_buttonSize
= new_val
; break;
317 case wxAUI_DOCKART_GRADIENT_TYPE
: m_gradientType
= new_val
; break;
318 default: wxFAIL_MSG(wxT("Invalid Metric Ordinal")); break;
322 wxColour
wxAuiDefaultDockArt::GetColour(int id
)
326 case wxAUI_DOCKART_BACKGROUND_COLOUR
: return m_backgroundBrush
.GetColour();
327 case wxAUI_DOCKART_SASH_COLOUR
: return m_sashBrush
.GetColour();
328 case wxAUI_DOCKART_INACTIVE_CAPTION_COLOUR
: return m_inactiveCaptionColour
;
329 case wxAUI_DOCKART_INACTIVE_CAPTION_GRADIENT_COLOUR
: return m_inactiveCaptionGradientColour
;
330 case wxAUI_DOCKART_INACTIVE_CAPTION_TEXT_COLOUR
: return m_inactiveCaptionTextColour
;
331 case wxAUI_DOCKART_ACTIVE_CAPTION_COLOUR
: return m_activeCaptionColour
;
332 case wxAUI_DOCKART_ACTIVE_CAPTION_GRADIENT_COLOUR
: return m_activeCaptionGradientColour
;
333 case wxAUI_DOCKART_ACTIVE_CAPTION_TEXT_COLOUR
: return m_activeCaptionTextColour
;
334 case wxAUI_DOCKART_BORDER_COLOUR
: return m_borderPen
.GetColour();
335 case wxAUI_DOCKART_GRIPPER_COLOUR
: return m_gripperBrush
.GetColour();
336 default: wxFAIL_MSG(wxT("Invalid Metric Ordinal")); break;
342 void wxAuiDefaultDockArt::SetColour(int id
, const wxColor
& colour
)
346 case wxAUI_DOCKART_BACKGROUND_COLOUR
: m_backgroundBrush
.SetColour(colour
); break;
347 case wxAUI_DOCKART_SASH_COLOUR
: m_sashBrush
.SetColour(colour
); break;
348 case wxAUI_DOCKART_INACTIVE_CAPTION_COLOUR
: m_inactiveCaptionColour
= colour
; break;
349 case wxAUI_DOCKART_INACTIVE_CAPTION_GRADIENT_COLOUR
: m_inactiveCaptionGradientColour
= colour
; break;
350 case wxAUI_DOCKART_INACTIVE_CAPTION_TEXT_COLOUR
: m_inactiveCaptionTextColour
= colour
; break;
351 case wxAUI_DOCKART_ACTIVE_CAPTION_COLOUR
: m_activeCaptionColour
= colour
; break;
352 case wxAUI_DOCKART_ACTIVE_CAPTION_GRADIENT_COLOUR
: m_activeCaptionGradientColour
= colour
; break;
353 case wxAUI_DOCKART_ACTIVE_CAPTION_TEXT_COLOUR
: m_activeCaptionTextColour
= colour
; break;
354 case wxAUI_DOCKART_BORDER_COLOUR
: m_borderPen
.SetColour(colour
); break;
355 case wxAUI_DOCKART_GRIPPER_COLOUR
:
356 m_gripperBrush
.SetColour(colour
);
357 m_gripperPen1
.SetColour(colour
.ChangeLightness(40));
358 m_gripperPen2
.SetColour(colour
.ChangeLightness(60));
360 default: wxFAIL_MSG(wxT("Invalid Metric Ordinal")); break;
366 void wxAuiDefaultDockArt::SetFont(int id
, const wxFont
& font
)
368 if (id
== wxAUI_DOCKART_CAPTION_FONT
)
369 m_captionFont
= font
;
372 wxFont
wxAuiDefaultDockArt::GetFont(int id
)
374 if (id
== wxAUI_DOCKART_CAPTION_FONT
)
375 return m_captionFont
;
379 void wxAuiDefaultDockArt::DrawSash(wxDC
& dc
, wxWindow
*window
, int orientation
, const wxRect
& rect
)
381 #if defined( __WXMAC__ ) && wxOSX_USE_COCOA_OR_CARBON
383 wxUnusedVar(orientation
);
385 HIRect splitterRect
= CGRectMake( rect
.x
, rect
.y
, rect
.width
, rect
.height
);
386 CGContextRef cgContext
;
387 wxGCDCImpl
*impl
= (wxGCDCImpl
*) dc
.GetImpl();
388 cgContext
= (CGContextRef
) impl
->GetGraphicsContext()->GetNativeContext() ;
390 HIThemeSplitterDrawInfo drawInfo
;
391 drawInfo
.version
= 0 ;
392 drawInfo
.state
= kThemeStateActive
;
393 drawInfo
.adornment
= kHIThemeSplitterAdornmentNone
;
394 HIThemeDrawPaneSplitter( &splitterRect
, &drawInfo
, cgContext
, kHIThemeOrientationNormal
) ;
396 #elif defined(__WXGTK__)
397 // clear out the rectangle first
398 dc
.SetPen(*wxTRANSPARENT_PEN
);
399 dc
.SetBrush(m_sashBrush
);
400 dc
.DrawRectangle(rect
.x
, rect
.y
, rect
.width
, rect
.height
);
403 GdkRectangle gdk_rect
;
404 if (orientation
== wxVERTICAL
)
408 gdk_rect
.width
= m_sashSize
;
409 gdk_rect
.height
= rect
.height
;
415 gdk_rect
.width
= rect
.width
;
416 gdk_rect
.height
= m_sashSize
;
421 if (!window
->m_wxwindow
) return;
422 if (!gtk_widget_is_drawable(window
->m_wxwindow
)) return;
426 gtk_widget_get_style(window
->m_wxwindow
),
428 static_cast<cairo_t
*>(dc
.GetGraphicsContext()->GetNativeContext()),
430 window
->GTKGetDrawingWindow(),
432 // flags & wxCONTROL_CURRENT ? GTK_STATE_PRELIGHT : GTK_STATE_NORMAL,
436 NULL
/* no clipping */,
444 (orientation
== wxVERTICAL
) ? GTK_ORIENTATION_VERTICAL
: GTK_ORIENTATION_HORIZONTAL
449 wxUnusedVar(orientation
);
450 dc
.SetPen(*wxTRANSPARENT_PEN
);
451 dc
.SetBrush(m_sashBrush
);
452 dc
.DrawRectangle(rect
.x
, rect
.y
, rect
.width
, rect
.height
);
457 void wxAuiDefaultDockArt::DrawBackground(wxDC
& dc
, wxWindow
*WXUNUSED(window
), int, const wxRect
& rect
)
459 dc
.SetPen(*wxTRANSPARENT_PEN
);
461 // we have to clear first, otherwise we are drawing a light striped pattern
462 // over an already darker striped background
463 dc
.SetBrush(*wxWHITE_BRUSH
) ;
464 dc
.DrawRectangle(rect
.x
, rect
.y
, rect
.width
, rect
.height
);
466 dc
.SetBrush(m_backgroundBrush
);
467 dc
.DrawRectangle(rect
.x
, rect
.y
, rect
.width
, rect
.height
);
470 void wxAuiDefaultDockArt::DrawBorder(wxDC
& dc
, wxWindow
* window
, const wxRect
& _rect
,
473 dc
.SetPen(m_borderPen
);
474 dc
.SetBrush(*wxTRANSPARENT_BRUSH
);
477 int i
, border_width
= GetMetric(wxAUI_DOCKART_PANE_BORDER_SIZE
);
479 if (pane
.IsToolbar())
481 for (i
= 0; i
< border_width
; ++i
)
483 dc
.SetPen(*wxWHITE_PEN
);
484 dc
.DrawLine(rect
.x
, rect
.y
, rect
.x
+rect
.width
, rect
.y
);
485 dc
.DrawLine(rect
.x
, rect
.y
, rect
.x
, rect
.y
+rect
.height
);
486 dc
.SetPen(m_borderPen
);
487 dc
.DrawLine(rect
.x
, rect
.y
+rect
.height
-1,
488 rect
.x
+rect
.width
, rect
.y
+rect
.height
-1);
489 dc
.DrawLine(rect
.x
+rect
.width
-1, rect
.y
,
490 rect
.x
+rect
.width
-1, rect
.y
+rect
.height
);
496 // notebooks draw the border themselves, so they can use native rendering (e.g. tabartgtk)
497 wxAuiTabArt
* art
= 0;
498 wxAuiNotebook
* nb
= wxDynamicCast(window
, wxAuiNotebook
);
500 art
= nb
->GetArtProvider();
503 art
->DrawBorder(dc
, window
, rect
);
506 for (i
= 0; i
< border_width
; ++i
)
508 dc
.DrawRectangle(rect
.x
, rect
.y
, rect
.width
, rect
.height
);
516 void wxAuiDefaultDockArt::DrawCaptionBackground(wxDC
& dc
, const wxRect
& rect
, bool active
)
518 if (m_gradientType
== wxAUI_GRADIENT_NONE
)
521 dc
.SetBrush(wxBrush(m_activeCaptionColour
));
523 dc
.SetBrush(wxBrush(m_inactiveCaptionColour
));
525 dc
.DrawRectangle(rect
.x
, rect
.y
, rect
.width
, rect
.height
);
531 // on mac the gradients are expected to become darker from the top
533 DrawGradientRectangle(dc
, rect
,
534 m_activeCaptionColour
,
535 m_activeCaptionGradientColour
,
538 // on other platforms, active gradients become lighter at the top
539 DrawGradientRectangle(dc
, rect
,
540 m_activeCaptionGradientColour
,
541 m_activeCaptionColour
,
548 // on mac the gradients are expected to become darker from the top
549 DrawGradientRectangle(dc
, rect
,
550 m_inactiveCaptionGradientColour
,
551 m_inactiveCaptionColour
,
554 // on other platforms, inactive gradients become lighter at the bottom
555 DrawGradientRectangle(dc
, rect
,
556 m_inactiveCaptionColour
,
557 m_inactiveCaptionGradientColour
,
565 void wxAuiDefaultDockArt::DrawCaption(wxDC
& dc
, wxWindow
*WXUNUSED(window
),
566 const wxString
& text
,
570 dc
.SetPen(*wxTRANSPARENT_PEN
);
571 dc
.SetFont(m_captionFont
);
573 DrawCaptionBackground(dc
, rect
,
574 (pane
.state
& wxAuiPaneInfo::optionActive
)?true:false);
576 int caption_offset
= 0;
577 if ( pane
.icon
.IsOk() )
579 DrawIcon(dc
, rect
, pane
);
581 caption_offset
+= pane
.icon
.GetWidth() + 3;
584 if (pane
.state
& wxAuiPaneInfo::optionActive
)
585 dc
.SetTextForeground(m_activeCaptionTextColour
);
587 dc
.SetTextForeground(m_inactiveCaptionTextColour
);
591 dc
.GetTextExtent(wxT("ABCDEFHXfgkj"), &w
, &h
);
593 wxRect clip_rect
= rect
;
594 clip_rect
.width
-= 3; // text offset
595 clip_rect
.width
-= 2; // button padding
596 if (pane
.HasCloseButton())
597 clip_rect
.width
-= m_buttonSize
;
598 if (pane
.HasPinButton())
599 clip_rect
.width
-= m_buttonSize
;
600 if (pane
.HasMaximizeButton())
601 clip_rect
.width
-= m_buttonSize
;
603 wxString draw_text
= wxAuiChopText(dc
, text
, clip_rect
.width
);
605 dc
.SetClippingRegion(clip_rect
);
606 dc
.DrawText(draw_text
, rect
.x
+3 + caption_offset
, rect
.y
+(rect
.height
/2)-(h
/2)-1);
607 dc
.DestroyClippingRegion();
611 wxAuiDefaultDockArt::DrawIcon(wxDC
& dc
, const wxRect
& rect
, wxAuiPaneInfo
& pane
)
613 // Draw the icon centered vertically
614 dc
.DrawBitmap(pane
.icon
,
615 rect
.x
+2, rect
.y
+(rect
.height
-pane
.icon
.GetHeight())/2,
619 void wxAuiDefaultDockArt::DrawGripper(wxDC
& dc
, wxWindow
*WXUNUSED(window
),
623 dc
.SetPen(*wxTRANSPARENT_PEN
);
624 dc
.SetBrush(m_gripperBrush
);
626 dc
.DrawRectangle(rect
.x
, rect
.y
, rect
.width
,rect
.height
);
628 if (!pane
.HasGripperTop())
633 dc
.SetPen(m_gripperPen1
);
634 dc
.DrawPoint(rect
.x
+3, rect
.y
+y
);
635 dc
.SetPen(m_gripperPen2
);
636 dc
.DrawPoint(rect
.x
+3, rect
.y
+y
+1);
637 dc
.DrawPoint(rect
.x
+4, rect
.y
+y
);
638 dc
.SetPen(m_gripperPen3
);
639 dc
.DrawPoint(rect
.x
+5, rect
.y
+y
+1);
640 dc
.DrawPoint(rect
.x
+5, rect
.y
+y
+2);
641 dc
.DrawPoint(rect
.x
+4, rect
.y
+y
+2);
644 if (y
> rect
.GetHeight()-5)
653 dc
.SetPen(m_gripperPen1
);
654 dc
.DrawPoint(rect
.x
+x
, rect
.y
+3);
655 dc
.SetPen(m_gripperPen2
);
656 dc
.DrawPoint(rect
.x
+x
+1, rect
.y
+3);
657 dc
.DrawPoint(rect
.x
+x
, rect
.y
+4);
658 dc
.SetPen(m_gripperPen3
);
659 dc
.DrawPoint(rect
.x
+x
+1, rect
.y
+5);
660 dc
.DrawPoint(rect
.x
+x
+2, rect
.y
+5);
661 dc
.DrawPoint(rect
.x
+x
+2, rect
.y
+4);
664 if (x
> rect
.GetWidth()-5)
670 void wxAuiDefaultDockArt::DrawPaneButton(wxDC
& dc
, wxWindow
*WXUNUSED(window
),
682 case wxAUI_BUTTON_CLOSE
:
683 if (pane
.state
& wxAuiPaneInfo::optionActive
)
684 bmp
= m_activeCloseBitmap
;
686 bmp
= m_inactiveCloseBitmap
;
688 case wxAUI_BUTTON_PIN
:
689 if (pane
.state
& wxAuiPaneInfo::optionActive
)
690 bmp
= m_activePinBitmap
;
692 bmp
= m_inactivePinBitmap
;
694 case wxAUI_BUTTON_MAXIMIZE_RESTORE
:
695 if (pane
.IsMaximized())
697 if (pane
.state
& wxAuiPaneInfo::optionActive
)
698 bmp
= m_activeRestoreBitmap
;
700 bmp
= m_inactiveRestoreBitmap
;
704 if (pane
.state
& wxAuiPaneInfo::optionActive
)
705 bmp
= m_activeMaximizeBitmap
;
707 bmp
= m_inactiveMaximizeBitmap
;
716 rect
.y
= rect
.y
+ (rect
.height
/2) - (bmp
.GetHeight()/2);
717 rect
.height
= old_y
+ rect
.height
- rect
.y
- 1;
720 if (button_state
== wxAUI_BUTTON_STATE_PRESSED
)
726 if (button_state
== wxAUI_BUTTON_STATE_HOVER
||
727 button_state
== wxAUI_BUTTON_STATE_PRESSED
)
729 if (pane
.state
& wxAuiPaneInfo::optionActive
)
731 dc
.SetBrush(wxBrush(m_activeCaptionColour
.ChangeLightness(120)));
732 dc
.SetPen(wxPen(m_activeCaptionColour
.ChangeLightness(70)));
736 dc
.SetBrush(wxBrush(m_inactiveCaptionColour
.ChangeLightness(120)));
737 dc
.SetPen(wxPen(m_inactiveCaptionColour
.ChangeLightness(70)));
740 // draw the background behind the button
741 dc
.DrawRectangle(rect
.x
, rect
.y
, 15, 15);
745 // draw the button itself
746 dc
.DrawBitmap(bmp
, rect
.x
, rect
.y
, true);