]> git.saurik.com Git - wxWidgets.git/blob - src/aui/dockart.cpp
Fix default value for wxFontPickerCtrl's initial font parameter
[wxWidgets.git] / src / aui / dockart.cpp
1 ///////////////////////////////////////////////////////////////////////////////
2 // Name: src/aui/dockart.cpp
3 // Purpose: wxaui: wx advanced user interface - docking window manager
4 // Author: Benjamin I. Williams
5 // Modified by:
6 // Created: 2005-05-17
7 // RCS-ID: $Id$
8 // Copyright: (C) Copyright 2005-2006, Kirix Corporation, All Rights Reserved
9 // Licence: wxWindows Library Licence, Version 3.1
10 ///////////////////////////////////////////////////////////////////////////////
11
12 // ============================================================================
13 // declarations
14 // ============================================================================
15
16 // ----------------------------------------------------------------------------
17 // headers
18 // ----------------------------------------------------------------------------
19
20 #include "wx/wxprec.h"
21
22 #ifdef __BORLANDC__
23 #pragma hdrstop
24 #endif
25
26 #if wxUSE_AUI
27
28 #include "wx/aui/framemanager.h"
29 #include "wx/aui/dockart.h"
30
31 #ifndef WX_PRECOMP
32 #include "wx/settings.h"
33 #include "wx/dcclient.h"
34 #include "wx/image.h"
35 #endif
36
37 #ifdef __WXMAC__
38 #include "wx/mac/private.h"
39 #include "wx/graphics.h"
40 #endif
41
42 #ifdef __WXGTK__
43 #include <gtk/gtk.h>
44 #include "wx/gtk/win_gtk.h"
45 #include "wx/renderer.h"
46 #endif
47
48
49 // -- wxAuiDefaultDockArt class implementation --
50
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()
57
58
59 // StepColour() it a utility function that simply darkens
60 // or lightens a color, based on the specified percentage
61 static wxColor StepColour(const wxColor& c, int percent)
62 {
63 int r = c.Red(), g = c.Green(), b = c.Blue();
64 return wxColour((unsigned char)wxMin((r*percent)/100,255),
65 (unsigned char)wxMin((g*percent)/100,255),
66 (unsigned char)wxMin((b*percent)/100,255));
67 }
68
69 static wxColor LightContrastColour(const wxColour& c)
70 {
71 int amount = 120;
72
73 // if the color is especially dark, then
74 // make the contrast even lighter
75 if (c.Red() < 128 && c.Green() < 128 && c.Blue() < 128)
76 amount = 160;
77
78 return StepColour(c, amount);
79 }
80
81 // BitmapFromBits() is a utility function that creates a
82 // masked bitmap from raw bits (XBM format)
83 static wxBitmap BitmapFromBits(const unsigned char bits[], int w, int h,
84 const wxColour& color)
85 {
86 wxImage img = wxBitmap((const char*)bits, w, h).ConvertToImage();
87 img.Replace(0,0,0,123,123,123);
88 img.Replace(255,255,255,color.Red(),color.Green(),color.Blue());
89 img.SetMaskColour(123,123,123);
90 return wxBitmap(img);
91 }
92
93
94 static void DrawGradientRectangle(wxDC& dc,
95 const wxRect& rect,
96 const wxColour& start_color,
97 const wxColour& end_color,
98 int direction)
99 {
100 int rd, gd, bd, high = 0;
101 rd = end_color.Red() - start_color.Red();
102 gd = end_color.Green() - start_color.Green();
103 bd = end_color.Blue() - start_color.Blue();
104
105 if (direction == wxAUI_GRADIENT_VERTICAL)
106 high = rect.GetHeight()-1;
107 else
108 high = rect.GetWidth()-1;
109
110 for (int i = 0; i <= high; ++i)
111 {
112 int r = start_color.Red() + ((i*rd*100)/high)/100;
113 int g = start_color.Green() + ((i*gd*100)/high)/100;
114 int b = start_color.Blue() + ((i*bd*100)/high)/100;
115
116 wxPen p(wxColor((unsigned char)r,
117 (unsigned char)g,
118 (unsigned char)b));
119 dc.SetPen(p);
120
121 if (direction == wxAUI_GRADIENT_VERTICAL)
122 dc.DrawLine(rect.x, rect.y+i, rect.x+rect.width, rect.y+i);
123 else
124 dc.DrawLine(rect.x+i, rect.y, rect.x+i, rect.y+rect.height);
125 }
126
127 }
128
129 wxAuiDefaultDockArt::wxAuiDefaultDockArt()
130 {
131 #ifdef __WXMAC__
132 wxBrush toolbarbrush;
133 toolbarbrush.MacSetTheme( kThemeBrushToolbarBackground );
134 wxColor base_color = toolbarbrush.GetColour();
135 #else
136 wxColor base_color = wxSystemSettings::GetColour(wxSYS_COLOUR_3DFACE);
137 #endif
138
139 wxColor darker1_color = StepColour(base_color, 85);
140 wxColor darker2_color = StepColour(base_color, 70);
141 wxColor darker3_color = StepColour(base_color, 60);
142 wxColor darker4_color = StepColour(base_color, 50);
143 wxColor darker5_color = StepColour(base_color, 40);
144
145 m_active_caption_colour = LightContrastColour(wxSystemSettings::GetColour(wxSYS_COLOUR_HIGHLIGHT));
146 m_active_caption_gradient_colour = wxSystemSettings::GetColour(wxSYS_COLOUR_HIGHLIGHT);
147 m_active_caption_text_colour = wxSystemSettings::GetColour(wxSYS_COLOUR_HIGHLIGHTTEXT);
148 m_inactive_caption_colour = StepColour(darker1_color, 80);
149 m_inactive_caption_gradient_colour = darker1_color;
150 m_inactive_caption_text_colour = *wxBLACK;
151
152 #ifdef __WXMAC__
153 m_sash_brush = toolbarbrush;
154 m_background_brush = toolbarbrush;
155 m_gripper_brush = toolbarbrush;
156 #else
157 m_sash_brush = wxBrush(base_color);
158 m_background_brush = wxBrush(base_color);
159 m_gripper_brush = wxBrush(base_color);
160 #endif
161 m_border_pen = wxPen(darker2_color);
162 m_gripper_pen1 = wxPen(darker5_color);
163 m_gripper_pen2 = wxPen(darker3_color);
164 m_gripper_pen3 = *wxWHITE_PEN;
165
166 #ifdef __WXMAC__
167 m_caption_font = *wxSMALL_FONT;
168 #else
169 m_caption_font = wxFont(8, wxDEFAULT, wxNORMAL, wxNORMAL, FALSE);
170 #endif
171
172 // some built in bitmaps
173 #if defined( __WXMAC__ )
174 static unsigned char close_bits[]={
175 0xFF, 0xFF, 0xFF, 0xFF, 0x0F, 0xFE, 0x03, 0xF8, 0x01, 0xF0, 0x19, 0xF3,
176 0xB8, 0xE3, 0xF0, 0xE1, 0xE0, 0xE0, 0xF0, 0xE1, 0xB8, 0xE3, 0x19, 0xF3,
177 0x01, 0xF0, 0x03, 0xF8, 0x0F, 0xFE, 0xFF, 0xFF };
178 #elif defined( __WXGTK__)
179 static unsigned char close_bits[]={
180 0xff, 0xff, 0xff, 0xff, 0x07, 0xf0, 0xfb, 0xef, 0xdb, 0xed, 0x8b, 0xe8,
181 0x1b, 0xec, 0x3b, 0xee, 0x1b, 0xec, 0x8b, 0xe8, 0xdb, 0xed, 0xfb, 0xef,
182 0x07, 0xf0, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff };
183 #else
184 static unsigned char close_bits[]={
185 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xef,0xfb,0xcf,0xf9,
186 0x9f,0xfc,0x3f,0xfe,0x3f,0xfe,0x9f,0xfc,0xcf,0xf9,0xef,0xfb,
187 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff};
188 #endif
189
190 static unsigned char maximize_bits[] = {
191 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x07, 0xf0, 0xf7, 0xf7, 0x07, 0xf0,
192 0xf7, 0xf7, 0xf7, 0xf7, 0xf7, 0xf7, 0xf7, 0xf7, 0xf7, 0xf7, 0x07, 0xf0,
193 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff};
194
195 static unsigned char restore_bits[]={
196 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x1f, 0xf0, 0x1f, 0xf0, 0xdf, 0xf7,
197 0x07, 0xf4, 0x07, 0xf4, 0xf7, 0xf5, 0xf7, 0xf1, 0xf7, 0xfd, 0xf7, 0xfd,
198 0x07, 0xfc, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff};
199
200 static unsigned char pin_bits[]={
201 0xff,0xff,0xff,0xff,0xff,0xff,0x1f,0xfc,0xdf,0xfc,0xdf,0xfc,
202 0xdf,0xfc,0xdf,0xfc,0xdf,0xfc,0x0f,0xf8,0x7f,0xff,0x7f,0xff,
203 0x7f,0xff,0xff,0xff,0xff,0xff,0xff,0xff};
204
205 #ifdef __WXMAC__
206 m_inactive_close_bitmap = BitmapFromBits(close_bits, 16, 16, *wxWHITE);
207 m_active_close_bitmap = BitmapFromBits(close_bits, 16, 16, *wxWHITE );
208 #else
209 m_inactive_close_bitmap = BitmapFromBits(close_bits, 16, 16, m_inactive_caption_text_colour);
210 m_active_close_bitmap = BitmapFromBits(close_bits, 16, 16, m_active_caption_text_colour);
211 #endif
212
213 #ifdef __WXMAC__
214 m_inactive_maximize_bitmap = BitmapFromBits(maximize_bits, 16, 16, *wxWHITE);
215 m_active_maximize_bitmap = BitmapFromBits(maximize_bits, 16, 16, *wxWHITE );
216 #else
217 m_inactive_maximize_bitmap = BitmapFromBits(maximize_bits, 16, 16, m_inactive_caption_text_colour);
218 m_active_maximize_bitmap = BitmapFromBits(maximize_bits, 16, 16, m_active_caption_text_colour);
219 #endif
220
221 #ifdef __WXMAC__
222 m_inactive_restore_bitmap = BitmapFromBits(restore_bits, 16, 16, *wxWHITE);
223 m_active_restore_bitmap = BitmapFromBits(restore_bits, 16, 16, *wxWHITE );
224 #else
225 m_inactive_restore_bitmap = BitmapFromBits(restore_bits, 16, 16, m_inactive_caption_text_colour);
226 m_active_restore_bitmap = BitmapFromBits(restore_bits, 16, 16, m_active_caption_text_colour);
227 #endif
228
229 m_inactive_pin_bitmap = BitmapFromBits(pin_bits, 16, 16, m_inactive_caption_text_colour);
230 m_active_pin_bitmap = BitmapFromBits(pin_bits, 16, 16, m_active_caption_text_colour);
231
232 // default metric values
233 #if defined(__WXMAC__)
234 SInt32 height;
235 GetThemeMetric( kThemeMetricSmallPaneSplitterHeight , &height );
236 m_sash_size = height;
237 #elif defined(__WXGTK__)
238 m_sash_size = wxRendererNative::Get().GetSplitterParams(NULL).widthSash;
239 #else
240 m_sash_size = 4;
241 #endif
242 m_caption_size = 17;
243 m_border_size = 1;
244 m_button_size = 14;
245 m_gripper_size = 9;
246 m_gradient_type = wxAUI_GRADIENT_VERTICAL;
247 }
248
249 int wxAuiDefaultDockArt::GetMetric(int id)
250 {
251 switch (id)
252 {
253 case wxAUI_ART_SASH_SIZE: return m_sash_size;
254 case wxAUI_ART_CAPTION_SIZE: return m_caption_size;
255 case wxAUI_ART_GRIPPER_SIZE: return m_gripper_size;
256 case wxAUI_ART_PANE_BORDER_SIZE: return m_border_size;
257 case wxAUI_ART_PANE_BUTTON_SIZE: return m_button_size;
258 case wxAUI_ART_GRADIENT_TYPE: return m_gradient_type;
259 default: wxFAIL_MSG(wxT("Invalid Metric Ordinal")); break;
260 }
261
262 return 0;
263 }
264
265 void wxAuiDefaultDockArt::SetMetric(int id, int new_val)
266 {
267 switch (id)
268 {
269 case wxAUI_ART_SASH_SIZE: m_sash_size = new_val; break;
270 case wxAUI_ART_CAPTION_SIZE: m_caption_size = new_val; break;
271 case wxAUI_ART_GRIPPER_SIZE: m_gripper_size = new_val; break;
272 case wxAUI_ART_PANE_BORDER_SIZE: m_border_size = new_val; break;
273 case wxAUI_ART_PANE_BUTTON_SIZE: m_button_size = new_val; break;
274 case wxAUI_ART_GRADIENT_TYPE: m_gradient_type = new_val; break;
275 default: wxFAIL_MSG(wxT("Invalid Metric Ordinal")); break;
276 }
277 }
278
279 wxColour wxAuiDefaultDockArt::GetColour(int id)
280 {
281 switch (id)
282 {
283 case wxAUI_ART_BACKGROUND_COLOUR: return m_background_brush.GetColour();
284 case wxAUI_ART_SASH_COLOUR: return m_sash_brush.GetColour();
285 case wxAUI_ART_INACTIVE_CAPTION_COLOUR: return m_inactive_caption_colour;
286 case wxAUI_ART_INACTIVE_CAPTION_GRADIENT_COLOUR: return m_inactive_caption_gradient_colour;
287 case wxAUI_ART_INACTIVE_CAPTION_TEXT_COLOUR: return m_inactive_caption_text_colour;
288 case wxAUI_ART_ACTIVE_CAPTION_COLOUR: return m_active_caption_colour;
289 case wxAUI_ART_ACTIVE_CAPTION_GRADIENT_COLOUR: return m_active_caption_gradient_colour;
290 case wxAUI_ART_ACTIVE_CAPTION_TEXT_COLOUR: return m_active_caption_text_colour;
291 case wxAUI_ART_BORDER_COLOUR: return m_border_pen.GetColour();
292 case wxAUI_ART_GRIPPER_COLOUR: return m_gripper_brush.GetColour();
293 default: wxFAIL_MSG(wxT("Invalid Metric Ordinal")); break;
294 }
295
296 return wxColour();
297 }
298
299 void wxAuiDefaultDockArt::SetColour(int id, const wxColor& colour)
300 {
301 switch (id)
302 {
303 case wxAUI_ART_BACKGROUND_COLOUR: m_background_brush.SetColour(colour); break;
304 case wxAUI_ART_SASH_COLOUR: m_sash_brush.SetColour(colour); break;
305 case wxAUI_ART_INACTIVE_CAPTION_COLOUR: m_inactive_caption_colour = colour; break;
306 case wxAUI_ART_INACTIVE_CAPTION_GRADIENT_COLOUR: m_inactive_caption_gradient_colour = colour; break;
307 case wxAUI_ART_INACTIVE_CAPTION_TEXT_COLOUR: m_inactive_caption_text_colour = colour; break;
308 case wxAUI_ART_ACTIVE_CAPTION_COLOUR: m_active_caption_colour = colour; break;
309 case wxAUI_ART_ACTIVE_CAPTION_GRADIENT_COLOUR: m_active_caption_gradient_colour = colour; break;
310 case wxAUI_ART_ACTIVE_CAPTION_TEXT_COLOUR: m_active_caption_text_colour = colour; break;
311 case wxAUI_ART_BORDER_COLOUR: m_border_pen.SetColour(colour); break;
312 case wxAUI_ART_GRIPPER_COLOUR:
313 m_gripper_brush.SetColour(colour);
314 m_gripper_pen1.SetColour(StepColour(colour, 40));
315 m_gripper_pen2.SetColour(StepColour(colour, 60));
316 break;
317 default: wxFAIL_MSG(wxT("Invalid Metric Ordinal")); break;
318 }
319 }
320
321 void wxAuiDefaultDockArt::SetFont(int id, const wxFont& font)
322 {
323 if (id == wxAUI_ART_CAPTION_FONT)
324 m_caption_font = font;
325 }
326
327 wxFont wxAuiDefaultDockArt::GetFont(int id)
328 {
329 if (id == wxAUI_ART_CAPTION_FONT)
330 return m_caption_font;
331 return wxNullFont;
332 }
333
334 void wxAuiDefaultDockArt::DrawSash(wxDC& dc, wxWindow *window, int orientation, const wxRect& rect)
335 {
336 #if defined(__WXMAC__)
337 HIRect splitterRect = CGRectMake( rect.x , rect.y , rect.width , rect.height );
338 CGContextRef cgContext ;
339 #if wxMAC_USE_CORE_GRAPHICS
340 cgContext = (CGContextRef) dc.GetGraphicsContext()->GetNativeContext() ;
341 #else
342 Rect bounds ;
343 GetPortBounds( (CGrafPtr) dc.m_macPort , &bounds ) ;
344 QDBeginCGContext( (CGrafPtr) dc.m_macPort , &cgContext ) ;
345 CGContextTranslateCTM( cgContext , 0 , bounds.bottom - bounds.top ) ;
346 CGContextScaleCTM( cgContext , 1 , -1 ) ;
347 #endif
348
349 HIThemeSplitterDrawInfo drawInfo ;
350 drawInfo.version = 0 ;
351 drawInfo.state = kThemeStateActive ;
352 drawInfo.adornment = kHIThemeSplitterAdornmentNone ;
353 HIThemeDrawPaneSplitter( &splitterRect , &drawInfo , cgContext , kHIThemeOrientationNormal ) ;
354
355 #if wxMAC_USE_CORE_GRAPHICS
356 #else
357 QDEndCGContext( (CGrafPtr) dc.m_macPort , &cgContext ) ;
358 #endif
359
360 #elif defined(__WXGTK__)
361
362 GdkRectangle gdk_rect;
363 if (orientation == wxVERTICAL )
364 {
365 gdk_rect.x = rect.x;
366 gdk_rect.y = rect.y;
367 gdk_rect.width = m_sash_size;
368 gdk_rect.height = rect.height;
369 }
370 else
371 {
372 gdk_rect.x = rect.x;
373 gdk_rect.y = rect.y;
374 gdk_rect.width = rect.width;
375 gdk_rect.height = m_sash_size;
376 }
377
378 if (!window) return;
379 if (!window->m_wxwindow) return;
380 if (!GTK_PIZZA(window->m_wxwindow)->bin_window) return;
381
382 gtk_paint_handle
383 (
384 window->m_wxwindow->style,
385 GTK_PIZZA(window->m_wxwindow)->bin_window,
386 // flags & wxCONTROL_CURRENT ? GTK_STATE_PRELIGHT : GTK_STATE_NORMAL,
387 GTK_STATE_NORMAL,
388 GTK_SHADOW_NONE,
389 NULL /* no clipping */,
390 window->m_wxwindow,
391 "paned",
392 rect.x,
393 rect.y,
394 rect.width,
395 rect.height,
396 (orientation == wxVERTICAL) ? GTK_ORIENTATION_VERTICAL : GTK_ORIENTATION_HORIZONTAL
397 );
398
399 #else
400 wxUnusedVar(window);
401 wxUnusedVar(orientation);
402 dc.SetPen(*wxTRANSPARENT_PEN);
403 dc.SetBrush(m_sash_brush);
404 dc.DrawRectangle(rect.x, rect.y, rect.width, rect.height);
405 #endif
406 }
407
408
409 void wxAuiDefaultDockArt::DrawBackground(wxDC& dc, wxWindow *WXUNUSED(window), int, const wxRect& rect)
410 {
411 dc.SetPen(*wxTRANSPARENT_PEN);
412 #ifdef __WXMAC__
413 // we have to clear first, otherwise we are drawing a light striped pattern
414 // over an already darker striped background
415 dc.SetBrush(*wxWHITE_BRUSH) ;
416 dc.DrawRectangle(rect.x, rect.y, rect.width, rect.height);
417 #endif
418 dc.SetBrush(m_background_brush);
419 dc.DrawRectangle(rect.x, rect.y, rect.width, rect.height);
420 }
421
422 void wxAuiDefaultDockArt::DrawBorder(wxDC& dc, wxWindow *WXUNUSED(window), const wxRect& _rect,
423 wxAuiPaneInfo& pane)
424 {
425 dc.SetPen(m_border_pen);
426 dc.SetBrush(*wxTRANSPARENT_BRUSH);
427
428 wxRect rect = _rect;
429 int i, border_width = GetMetric(wxAUI_ART_PANE_BORDER_SIZE);
430
431 if (pane.IsToolbar())
432 {
433 for (i = 0; i < border_width; ++i)
434 {
435 dc.SetPen(*wxWHITE_PEN);
436 dc.DrawLine(rect.x, rect.y, rect.x+rect.width, rect.y);
437 dc.DrawLine(rect.x, rect.y, rect.x, rect.y+rect.height);
438 dc.SetPen(m_border_pen);
439 dc.DrawLine(rect.x, rect.y+rect.height-1,
440 rect.x+rect.width, rect.y+rect.height-1);
441 dc.DrawLine(rect.x+rect.width-1, rect.y,
442 rect.x+rect.width-1, rect.y+rect.height);
443 rect.Deflate(1);
444 }
445 }
446 else
447 {
448 for (i = 0; i < border_width; ++i)
449 {
450 dc.DrawRectangle(rect.x, rect.y, rect.width, rect.height);
451 rect.Deflate(1);
452 }
453 }
454 }
455
456
457 void wxAuiDefaultDockArt::DrawCaptionBackground(wxDC& dc, const wxRect& rect, bool active)
458 {
459 if (m_gradient_type == wxAUI_GRADIENT_NONE)
460 {
461 if (active)
462 dc.SetBrush(wxBrush(m_active_caption_colour));
463 else
464 dc.SetBrush(wxBrush(m_inactive_caption_colour));
465
466 dc.DrawRectangle(rect.x, rect.y, rect.width, rect.height);
467 }
468 else
469 {
470 if (active)
471 {
472 // on mac the gradients are expected to become darker from the top
473 #ifdef __WXMAC__
474 DrawGradientRectangle(dc, rect,
475 m_active_caption_gradient_colour,
476 m_active_caption_colour,
477 m_gradient_type);
478 #else
479 DrawGradientRectangle(dc, rect,
480 m_active_caption_colour,
481 m_active_caption_gradient_colour,
482 m_gradient_type);
483 #endif
484 }
485 else
486 {
487 // on mac the gradients are expected to become darker from the top
488 #ifdef __WXMAC__
489 DrawGradientRectangle(dc, rect,
490 m_inactive_caption_gradient_colour,
491 m_inactive_caption_colour,
492 m_gradient_type);
493 #else
494 DrawGradientRectangle(dc, rect,
495 m_inactive_caption_colour,
496 m_inactive_caption_gradient_colour,
497 m_gradient_type);
498 #endif
499 }
500 }
501 }
502
503
504 void wxAuiDefaultDockArt::DrawCaption(wxDC& dc, wxWindow *WXUNUSED(window),
505 const wxString& text,
506 const wxRect& rect,
507 wxAuiPaneInfo& pane)
508 {
509 dc.SetPen(*wxTRANSPARENT_PEN);
510 dc.SetFont(m_caption_font);
511
512 DrawCaptionBackground(dc, rect,
513 (pane.state & wxAuiPaneInfo::optionActive)?true:false);
514
515 if (pane.state & wxAuiPaneInfo::optionActive)
516 dc.SetTextForeground(m_active_caption_text_colour);
517 else
518 dc.SetTextForeground(m_inactive_caption_text_colour);
519
520
521 wxCoord w,h;
522 dc.GetTextExtent(wxT("ABCDEFHXfgkj"), &w, &h);
523
524 dc.SetClippingRegion(rect);
525 dc.DrawText(text, rect.x+3, rect.y+(rect.height/2)-(h/2)-1);
526 dc.DestroyClippingRegion();
527 }
528
529 void wxAuiDefaultDockArt::DrawGripper(wxDC& dc, wxWindow *WXUNUSED(window),
530 const wxRect& rect,
531 wxAuiPaneInfo& pane)
532 {
533 dc.SetPen(*wxTRANSPARENT_PEN);
534 dc.SetBrush(m_gripper_brush);
535
536 dc.DrawRectangle(rect.x, rect.y, rect.width,rect.height);
537
538 if (!pane.HasGripperTop())
539 {
540 int y = 5;
541 while (1)
542 {
543 dc.SetPen(m_gripper_pen1);
544 dc.DrawPoint(rect.x+3, rect.y+y);
545 dc.SetPen(m_gripper_pen2);
546 dc.DrawPoint(rect.x+3, rect.y+y+1);
547 dc.DrawPoint(rect.x+4, rect.y+y);
548 dc.SetPen(m_gripper_pen3);
549 dc.DrawPoint(rect.x+5, rect.y+y+1);
550 dc.DrawPoint(rect.x+5, rect.y+y+2);
551 dc.DrawPoint(rect.x+4, rect.y+y+2);
552
553 y += 4;
554 if (y > rect.GetHeight()-5)
555 break;
556 }
557 }
558 else
559 {
560 int x = 5;
561 while (1)
562 {
563 dc.SetPen(m_gripper_pen1);
564 dc.DrawPoint(rect.x+x, rect.y+3);
565 dc.SetPen(m_gripper_pen2);
566 dc.DrawPoint(rect.x+x+1, rect.y+3);
567 dc.DrawPoint(rect.x+x, rect.y+4);
568 dc.SetPen(m_gripper_pen3);
569 dc.DrawPoint(rect.x+x+1, rect.y+5);
570 dc.DrawPoint(rect.x+x+2, rect.y+5);
571 dc.DrawPoint(rect.x+x+2, rect.y+4);
572
573 x += 4;
574 if (x > rect.GetWidth()-5)
575 break;
576 }
577 }
578 }
579
580 void wxAuiDefaultDockArt::DrawPaneButton(wxDC& dc, wxWindow *WXUNUSED(window),
581 int button,
582 int button_state,
583 const wxRect& _rect,
584 wxAuiPaneInfo& pane)
585 {
586 wxRect rect = _rect;
587
588 if (button_state == wxAUI_BUTTON_STATE_PRESSED)
589 {
590 rect.x++;
591 rect.y++;
592 }
593
594 if (button_state == wxAUI_BUTTON_STATE_HOVER ||
595 button_state == wxAUI_BUTTON_STATE_PRESSED)
596 {
597 if (pane.state & wxAuiPaneInfo::optionActive)
598 {
599 dc.SetBrush(wxBrush(StepColour(m_active_caption_colour, 120)));
600 dc.SetPen(wxPen(StepColour(m_active_caption_colour, 70)));
601 }
602 else
603 {
604 dc.SetBrush(wxBrush(StepColour(m_inactive_caption_colour, 120)));
605 dc.SetPen(wxPen(StepColour(m_inactive_caption_colour, 70)));
606 }
607
608 // draw the background behind the button
609 dc.DrawRectangle(rect.x, rect.y, 15, 15);
610 }
611
612 wxBitmap bmp;
613 switch (button)
614 {
615 default:
616 case wxAUI_BUTTON_MAXIMIZE_RESTORE:
617 if (pane.IsMaximized()) {
618 if (pane.state & wxAuiPaneInfo::optionActive)
619 bmp = m_active_restore_bitmap;
620 else
621 bmp = m_inactive_restore_bitmap;
622 } else {
623 if (pane.state & wxAuiPaneInfo::optionActive)
624 bmp = m_active_maximize_bitmap;
625 else
626 bmp = m_inactive_maximize_bitmap;
627 }
628 break;
629 case wxAUI_BUTTON_CLOSE:
630 if (pane.state & wxAuiPaneInfo::optionActive)
631 bmp = m_active_close_bitmap;
632 else
633 bmp = m_inactive_close_bitmap;
634 break;
635 case wxAUI_BUTTON_PIN:
636 if (pane.state & wxAuiPaneInfo::optionActive)
637 bmp = m_active_pin_bitmap;
638 else
639 bmp = m_inactive_pin_bitmap;
640 break;
641 }
642
643 // draw the button itself
644 dc.DrawBitmap(bmp, rect.x, rect.y, true);
645 }
646
647
648 #endif // wxUSE_AUI