1 #include "artprovider.h"
2 #include <wx/dc.h>
3 #include <wx/settings.h>
4 #include <wx/image.h>
5 #include <wx/menu.h>
6 #include <wx/aui/framemanager.h>
7 #include <wx/aui/dockart.h>
8 #include <wx/aui/floatpane.h>
9 #include "auiutils.h"
10 #include "../uiutils.h"
11
SLArtProvider()12 SLArtProvider::SLArtProvider()
13 {
14 m_normal_font = *wxNORMAL_FONT;
15 m_selected_font = *wxNORMAL_FONT;
16 m_selected_font.SetWeight(wxBOLD);
17 m_measuring_font = m_selected_font;
18
19 m_fixed_tab_width = 100;
20 m_tab_ctrl_height = 0;
21
22 #if defined(__WXMAC__) && defined(__WXOSX_CARBON__)
23 wxBrush toolbarbrush;
24 toolbarbrush.MacSetTheme( kThemeBrushToolbarBackground );
25 wxColour base_colour = toolbarbrush.GetColour();
26 #else
27 wxColour base_colour = wxSystemSettings::GetColour(wxSYS_COLOUR_3DFACE);
28 #endif
29 m_active_colour = base_colour;
30
31 // the base_colour is too pale to use as our base colour,
32 // so darken it a bit --
33 if ((255-base_colour.Red()) +
34 (255-base_colour.Green()) +
35 (255-base_colour.Blue()) < 60)
36 {
37 base_colour = wxAuiStepColour(base_colour, 92);
38 }
39
40 m_base_colour = base_colour;
41 wxColour border_colour = wxAuiStepColour(base_colour, 75);
42
43 m_border_pen = wxPen(border_colour);
44 m_base_colour_pen = wxPen(m_base_colour);
45 m_base_colour_brush = wxBrush(m_base_colour);
46
47 m_active_close_bmp = wxAuiBitmapFromBits(close_bits, 16, 16, *wxBLACK);
48 m_disabled_close_bmp = wxAuiBitmapFromBits(close_bits, 16, 16, wxColour(128,128,128));
49
50 m_active_left_bmp = wxAuiBitmapFromBits(left_bits, 16, 16, *wxBLACK);
51 m_disabled_left_bmp = wxAuiBitmapFromBits(left_bits, 16, 16, wxColour(128,128,128));
52
53 m_active_right_bmp = wxAuiBitmapFromBits(right_bits, 16, 16, *wxBLACK);
54 m_disabled_right_bmp = wxAuiBitmapFromBits(right_bits, 16, 16, wxColour(128,128,128));
55
56 m_active_windowlist_bmp = wxAuiBitmapFromBits(list_bits, 16, 16, *wxBLACK);
57 m_disabled_windowlist_bmp = wxAuiBitmapFromBits(list_bits, 16, 16, wxColour(128,128,128));
58
59 m_flags = 0;
60 }
61
~SLArtProvider()62 SLArtProvider::~SLArtProvider()
63 {
64 }
65
Clone()66 wxAuiTabArt* SLArtProvider::Clone()
67 {
68 SLArtProvider* art = new SLArtProvider;
69 art->SetNormalFont(m_normal_font);
70 art->SetSelectedFont(m_selected_font);
71 art->SetMeasuringFont(m_measuring_font);
72
73 return art;
74 }
75
SetFlags(unsigned int flags)76 void SLArtProvider::SetFlags(unsigned int flags)
77 {
78 m_flags = flags;
79 }
80
SetSizingInfo(const wxSize & tab_ctrl_size,size_t tab_count)81 void SLArtProvider::SetSizingInfo(const wxSize& tab_ctrl_size,
82 size_t tab_count)
83 {
84 m_fixed_tab_width = 100;
85
86 int tot_width = (int)tab_ctrl_size.x - GetIndentSize() - 4;
87
88 if (m_flags & wxAUI_NB_CLOSE_BUTTON)
89 tot_width -= m_active_close_bmp.GetWidth();
90 if (m_flags & wxAUI_NB_WINDOWLIST_BUTTON)
91 tot_width -= m_active_windowlist_bmp.GetWidth();
92
93 if (tab_count > 0)
94 {
95 m_fixed_tab_width = tot_width/(int)tab_count;
96 }
97
98
99 if (m_fixed_tab_width < 100)
100 m_fixed_tab_width = 100;
101
102 if (m_fixed_tab_width > tot_width/2)
103 m_fixed_tab_width = tot_width/2;
104
105 if (m_fixed_tab_width > 220)
106 m_fixed_tab_width = 220;
107
108 m_tab_ctrl_height = tab_ctrl_size.y;
109 }
110
111
DrawBackground(wxDC & dc,wxWindow * WXUNUSED (wnd),const wxRect & rect)112 void SLArtProvider::DrawBackground(wxDC& dc,
113 wxWindow* WXUNUSED(wnd),
114 const wxRect& rect)
115 {
116 // draw background
117 wxColour top_color = wxAuiStepColour(m_base_colour, 90);
118 wxColour bottom_color = wxAuiStepColour(m_base_colour, 170);
119 wxRect r;
120
121 if (m_flags &wxAUI_NB_BOTTOM)
122 r = wxRect(rect.x, rect.y, rect.width+2, rect.height);
123 // TODO: else if (m_flags &wxAUI_NB_LEFT) {}
124 // TODO: else if (m_flags &wxAUI_NB_RIGHT) {}
125 else //for wxAUI_NB_TOP
126 r = wxRect(rect.x, rect.y, rect.width+2, rect.height-3);
127 dc.GradientFillLinear(r, top_color, bottom_color, wxSOUTH);
128
129 // draw base lines
130 dc.SetPen(m_border_pen);
131 int y = rect.GetHeight();
132 int w = rect.GetWidth();
133
134 if (m_flags &wxAUI_NB_BOTTOM)
135 {
136 dc.SetBrush(wxBrush(bottom_color));
137 dc.DrawRectangle(-1, 0, w+2, 4);
138 }
139 // TODO: else if (m_flags &wxAUI_NB_LEFT) {}
140 // TODO: else if (m_flags &wxAUI_NB_RIGHT) {}
141 else //for wxAUI_NB_TOP
142 {
143 dc.SetBrush(m_base_colour_brush);
144 dc.DrawRectangle(-1, y-4, w+2, 4);
145 }
146 }
147
148
149 // DrawTab() draws an individual tab.
150 //
151 // dc - output dc
152 // in_rect - rectangle the tab should be confined to
153 // caption - tab's caption
154 // active - whether or not the tab is active
155 // out_rect - actual output rectangle
156 // x_extent - the advance x; where the next tab should start
157
DrawTab(wxDC & dc,wxWindow * wnd,const wxAuiNotebookPage & page,const wxRect & in_rect,int close_button_state,wxRect * out_tab_rect,wxRect * out_button_rect,int * x_extent)158 void SLArtProvider::DrawTab(wxDC& dc,
159 wxWindow* wnd,
160 const wxAuiNotebookPage& page,
161 const wxRect& in_rect,
162 int close_button_state,
163 wxRect* out_tab_rect,
164 wxRect* out_button_rect,
165 int* x_extent)
166 {
167 wxCoord normal_textx, normal_texty;
168 wxCoord selected_textx, selected_texty;
169 wxCoord texty;
170
171 // if the caption is empty, measure some temporary text
172 wxString caption = page.caption;
173 if (caption.empty())
174 caption = wxT("Xj");
175
176 dc.SetFont(m_selected_font);
177 dc.GetTextExtent(caption, &selected_textx, &selected_texty);
178
179 dc.SetFont(m_normal_font);
180 dc.GetTextExtent(caption, &normal_textx, &normal_texty);
181
182 // figure out the size of the tab
183 wxSize tab_size = GetTabSize(dc,
184 wnd,
185 page.caption,
186 page.bitmap,
187 page.active,
188 close_button_state,
189 x_extent);
190
191 wxCoord tab_height = m_tab_ctrl_height - 3;
192 wxCoord tab_width = tab_size.x;
193 wxCoord tab_x = in_rect.x;
194 wxCoord tab_y = in_rect.y + in_rect.height - tab_height;
195
196
197 caption = page.caption;
198
199
200 // select pen, brush and font for the tab to be drawn
201
202 if (page.active)
203 {
204 dc.SetFont(m_selected_font);
205 texty = selected_texty;
206 }
207 else
208 {
209 dc.SetFont(m_normal_font);
210 texty = normal_texty;
211 }
212
213
214 // create points that will make the tab outline
215
216 int clip_width = tab_width;
217 if (tab_x + clip_width > in_rect.x + in_rect.width)
218 clip_width = (in_rect.x + in_rect.width) - tab_x;
219
220 /*
221 wxPoint clip_points[6];
222 clip_points[0] = wxPoint(tab_x, tab_y+tab_height-3);
223 clip_points[1] = wxPoint(tab_x, tab_y+2);
224 clip_points[2] = wxPoint(tab_x+2, tab_y);
225 clip_points[3] = wxPoint(tab_x+clip_width-1, tab_y);
226 clip_points[4] = wxPoint(tab_x+clip_width+1, tab_y+2);
227 clip_points[5] = wxPoint(tab_x+clip_width+1, tab_y+tab_height-3);
228
229 // FIXME: these ports don't provide wxRegion ctor from array of points
230 #if !defined(__WXDFB__) && !defined(__WXCOCOA__)
231 // set the clipping region for the tab --
232 wxRegion clipping_region(WXSIZEOF(clip_points), clip_points);
233 dc.SetClippingRegion(clipping_region);
234 #endif // !wxDFB && !wxCocoa
235 */
236 // since the above code above doesn't play well with WXDFB or WXCOCOA,
237 // we'll just use a rectangle for the clipping region for now --
238 dc.SetClippingRegion(tab_x, tab_y, clip_width+1, tab_height-3);
239
240
241 wxPoint border_points[6];
242 if (m_flags &wxAUI_NB_BOTTOM)
243 {
244 border_points[0] = wxPoint(tab_x, tab_y);
245 border_points[1] = wxPoint(tab_x, tab_y+tab_height-6);
246 border_points[2] = wxPoint(tab_x+2, tab_y+tab_height-4);
247 border_points[3] = wxPoint(tab_x+tab_width-2, tab_y+tab_height-4);
248 border_points[4] = wxPoint(tab_x+tab_width, tab_y+tab_height-6);
249 border_points[5] = wxPoint(tab_x+tab_width, tab_y);
250 }
251 else //if (m_flags & wxAUI_NB_TOP) {}
252 {
253 border_points[0] = wxPoint(tab_x, tab_y+tab_height-4);
254 border_points[1] = wxPoint(tab_x, tab_y+2);
255 border_points[2] = wxPoint(tab_x+2, tab_y);
256 border_points[3] = wxPoint(tab_x+tab_width-2, tab_y);
257 border_points[4] = wxPoint(tab_x+tab_width, tab_y+2);
258 border_points[5] = wxPoint(tab_x+tab_width, tab_y+tab_height-4);
259 }
260 // TODO: else if (m_flags &wxAUI_NB_LEFT) {}
261 // TODO: else if (m_flags &wxAUI_NB_RIGHT) {}
262
263 int drawn_tab_yoff = border_points[1].y;
264 int drawn_tab_height = border_points[0].y - border_points[1].y;
265
266
267 if (page.active)
268 {
269 // draw active tab
270
271 // draw base background color
272 wxRect r(tab_x, tab_y, tab_width, tab_height);
273 dc.SetPen(m_base_colour_pen);
274 dc.SetBrush(m_base_colour_brush);
275 dc.DrawRectangle(r.x+1, r.y+1, r.width-1, r.height-4);
276
277 // this white helps fill out the gradient at the top of the tab
278 dc.SetPen(*wxWHITE_PEN);
279 dc.SetBrush(*wxWHITE_BRUSH);
280 dc.DrawRectangle(r.x+2, r.y+1, r.width-3, r.height-4);
281
282 // these two points help the rounded corners appear more antialiased
283 dc.SetPen(m_base_colour_pen);
284 dc.DrawPoint(r.x+2, r.y+1);
285 dc.DrawPoint(r.x+r.width-2, r.y+1);
286
287 // set rectangle down a bit for gradient drawing
288 r.SetHeight(r.GetHeight()/2);
289 r.x += 2;
290 r.width -= 2;
291 r.y += r.height;
292 r.y -= 2;
293
294 // draw gradient background
295 wxColour top_color = *wxWHITE;
296 wxColour bottom_color = m_base_colour;
297 dc.GradientFillLinear(r, bottom_color, top_color, wxNORTH);
298 }
299 else
300 {
301 // draw inactive tab
302
303 wxRect r(tab_x, tab_y+1, tab_width, tab_height-3);
304
305 // start the gradent up a bit and leave the inside border inset
306 // by a pixel for a 3D look. Only the top half of the inactive
307 // tab will have a slight gradient
308 r.x += 3;
309 r.y++;
310 r.width -= 4;
311 r.height /= 2;
312 r.height--;
313
314 // -- draw top gradient fill for glossy look
315 wxColour top_color = m_base_colour;
316 wxColour bottom_color = wxAuiStepColour(top_color, 160);
317 dc.GradientFillLinear(r, bottom_color, top_color, wxNORTH);
318
319 r.y += r.height;
320 r.y--;
321
322 // -- draw bottom fill for glossy look
323 top_color = m_base_colour;
324 bottom_color = m_base_colour;
325 dc.GradientFillLinear(r, top_color, bottom_color, wxSOUTH);
326 }
327
328 // draw tab outline
329 dc.SetPen(m_border_pen);
330 dc.SetBrush(*wxTRANSPARENT_BRUSH);
331 dc.DrawPolygon(WXSIZEOF(border_points), border_points);
332
333 // there are two horizontal grey lines at the bottom of the tab control,
334 // this gets rid of the top one of those lines in the tab control
335 if (page.active)
336 {
337 if (m_flags &wxAUI_NB_BOTTOM)
338 dc.SetPen(wxPen(wxColour(wxAuiStepColour(m_base_colour, 170))));
339 // TODO: else if (m_flags &wxAUI_NB_LEFT) {}
340 // TODO: else if (m_flags &wxAUI_NB_RIGHT) {}
341 else //for wxAUI_NB_TOP
342 dc.SetPen(m_base_colour_pen);
343 dc.DrawLine(border_points[0].x+1,
344 border_points[0].y,
345 border_points[5].x,
346 border_points[5].y);
347 }
348
349
350 int close_button_width = 0;
351 if (close_button_state != wxAUI_BUTTON_STATE_HIDDEN)
352 {
353 close_button_width = m_active_close_bmp.GetWidth();
354 }
355
356
357 int bitmap_offset = 0;
358 int text_offset = tab_x + 8;
359 if (page.bitmap.IsOk())
360 {
361 bitmap_offset = tab_x + 8;
362
363 // draw bitmap
364 dc.DrawBitmap(page.bitmap,
365 bitmap_offset,
366 drawn_tab_yoff + (drawn_tab_height/2) - (page.bitmap.GetHeight()/2),
367 true);
368
369 text_offset = bitmap_offset + page.bitmap.GetWidth();
370 text_offset += 3; // bitmap padding
371 }
372
373
374 wxString draw_text = wxAuiChopText(dc,
375 caption,
376 tab_width - (text_offset-tab_x) - close_button_width);
377
378 // draw tab text
379 wxColour fg_color = dc.GetTextForeground( );
380 if (!page.active ) {
381
382 wxColour fg_color_new = fg_color;
383 if ( AreColoursSimilar( fg_color, dc.GetTextBackground() , 50 ) )
384 {
385 fg_color_new = wxColour( ( fg_color.Red() +125 ) % 255 , ( fg_color.Green() +125 ) % 255, ( fg_color.Blue() +125 ) % 255 );
386 }
387 dc.SetTextForeground( wxAuiLightContrastColour(fg_color_new) );
388 }
389
390 dc.DrawText(draw_text,
391 text_offset,
392 drawn_tab_yoff + (drawn_tab_height)/2 - (texty/2) - 1);
393 dc.SetTextForeground( (fg_color) );
394
395 // draw close button if necessary
396 if (close_button_state != wxAUI_BUTTON_STATE_HIDDEN)
397 {
398 wxBitmap bmp = m_disabled_close_bmp;
399
400 if (close_button_state == wxAUI_BUTTON_STATE_HOVER ||
401 close_button_state == wxAUI_BUTTON_STATE_PRESSED)
402 {
403 bmp = m_active_close_bmp;
404 }
405
406 wxRect rect(tab_x + tab_width - close_button_width - 1,
407 tab_y + (tab_height/2) - (bmp.GetHeight()/2),
408 close_button_width,
409 tab_height);
410 IndentPressedBitmap(&rect, close_button_state);
411 dc.DrawBitmap(bmp, rect.x, rect.y, true);
412
413 *out_button_rect = rect;
414 }
415
416 *out_tab_rect = wxRect(tab_x, tab_y, tab_width, tab_height);
417
418 #ifndef __WXMAC__
419 // draw focus rectangle
420 if (page.active && (wnd->FindFocus() == wnd))
421 {
422 wxRect focusRectText(text_offset, (drawn_tab_yoff + (drawn_tab_height)/2 - (texty/2) - 1),
423 selected_textx, selected_texty);
424
425 wxRect focusRect;
426 wxRect focusRectBitmap;
427
428 if (page.bitmap.IsOk())
429 focusRectBitmap = wxRect(bitmap_offset, drawn_tab_yoff + (drawn_tab_height/2) - (page.bitmap.GetHeight()/2),
430 page.bitmap.GetWidth(), page.bitmap.GetHeight());
431
432 if (page.bitmap.IsOk() && draw_text.IsEmpty())
433 focusRect = focusRectBitmap;
434 else if (!page.bitmap.IsOk() && !draw_text.IsEmpty())
435 focusRect = focusRectText;
436 else if (page.bitmap.IsOk() && !draw_text.IsEmpty())
437 focusRect = focusRectText.Union(focusRectBitmap);
438
439 focusRect.Inflate(2, 2);
440
441 DrawFocusRect(wnd, dc, focusRect, 0);
442 }
443 #endif
444
445 dc.DestroyClippingRegion();
446 }
447
GetIndentSize()448 int SLArtProvider::GetIndentSize()
449 {
450 return 5;
451 }
452
GetTabSize(wxDC & dc,wxWindow * WXUNUSED (wnd),const wxString & caption,const wxBitmap & bitmap,bool WXUNUSED (active),int close_button_state,int * x_extent)453 wxSize SLArtProvider::GetTabSize(wxDC& dc,
454 wxWindow* WXUNUSED(wnd),
455 const wxString& caption,
456 const wxBitmap& bitmap,
457 bool WXUNUSED(active),
458 int close_button_state,
459 int* x_extent)
460 {
461 wxCoord measured_textx, measured_texty, tmp;
462
463 dc.SetFont(m_measuring_font);
464 dc.GetTextExtent(caption, &measured_textx, &measured_texty);
465
466 dc.GetTextExtent(wxT("ABCDEFXj"), &tmp, &measured_texty);
467
468 // add padding around the text
469 wxCoord tab_width = measured_textx;
470 wxCoord tab_height = measured_texty;
471
472 // if the close button is showing, add space for it
473 if (close_button_state != wxAUI_BUTTON_STATE_HIDDEN)
474 tab_width += m_active_close_bmp.GetWidth() + 3;
475
476 // if there's a bitmap, add space for it
477 if (bitmap.IsOk())
478 {
479 tab_width += bitmap.GetWidth();
480 tab_width += 3; // right side bitmap padding
481 tab_height = wxMax(tab_height, bitmap.GetHeight());
482 }
483
484 // add padding
485 tab_width += 16;
486 tab_height += 10;
487
488 if (m_flags & wxAUI_NB_TAB_FIXED_WIDTH)
489 {
490 tab_width = m_fixed_tab_width;
491 }
492
493 *x_extent = tab_width;
494
495 return wxSize(tab_width, tab_height);
496 }
497
498
DrawButton(wxDC & dc,wxWindow * WXUNUSED (wnd),const wxRect & in_rect,int bitmap_id,int button_state,int orientation,wxRect * out_rect)499 void SLArtProvider::DrawButton(wxDC& dc,
500 wxWindow* WXUNUSED(wnd),
501 const wxRect& in_rect,
502 int bitmap_id,
503 int button_state,
504 int orientation,
505 wxRect* out_rect)
506 {
507 wxBitmap bmp;
508 wxRect rect;
509
510 switch (bitmap_id)
511 {
512 case wxAUI_BUTTON_CLOSE:
513 if (button_state & wxAUI_BUTTON_STATE_DISABLED)
514 bmp = m_disabled_close_bmp;
515 else
516 bmp = m_active_close_bmp;
517 break;
518 case wxAUI_BUTTON_LEFT:
519 if (button_state & wxAUI_BUTTON_STATE_DISABLED)
520 bmp = m_disabled_left_bmp;
521 else
522 bmp = m_active_left_bmp;
523 break;
524 case wxAUI_BUTTON_RIGHT:
525 if (button_state & wxAUI_BUTTON_STATE_DISABLED)
526 bmp = m_disabled_right_bmp;
527 else
528 bmp = m_active_right_bmp;
529 break;
530 case wxAUI_BUTTON_WINDOWLIST:
531 if (button_state & wxAUI_BUTTON_STATE_DISABLED)
532 bmp = m_disabled_windowlist_bmp;
533 else
534 bmp = m_active_windowlist_bmp;
535 break;
536 default: break;
537 }
538
539
540 if (!bmp.IsOk())
541 return;
542
543 rect = in_rect;
544
545 if (orientation == wxLEFT)
546 {
547 rect.SetX(in_rect.x);
548 rect.SetY(((in_rect.y + in_rect.height)/2) - (bmp.GetHeight()/2));
549 rect.SetWidth(bmp.GetWidth());
550 rect.SetHeight(bmp.GetHeight());
551 }
552 else
553 {
554 rect = wxRect(in_rect.x + in_rect.width - bmp.GetWidth(),
555 ((in_rect.y + in_rect.height)/2) - (bmp.GetHeight()/2),
556 bmp.GetWidth(), bmp.GetHeight());
557 }
558
559 IndentPressedBitmap(&rect, button_state);
560 dc.DrawBitmap(bmp, rect.x, rect.y, true);
561
562 *out_rect = rect;
563 }
564
565
ShowDropDown(wxWindow * wnd,const wxAuiNotebookPageArray & pages,int active_idx)566 int SLArtProvider::ShowDropDown(wxWindow* wnd,
567 const wxAuiNotebookPageArray& pages,
568 int active_idx)
569 {
570 wxMenu menuPopup;
571
572 size_t i, count = pages.GetCount();
573 for (i = 0; i < count; ++i)
574 {
575 const wxAuiNotebookPage& page = pages.Item(i);
576 wxString caption = page.caption;
577
578 // if there is no caption, make it a space. This will prevent
579 // an assert in the menu code.
580 if (caption.IsEmpty())
581 caption = wxT(" ");
582
583 menuPopup.AppendCheckItem(1000+i, caption);
584 }
585
586 if (active_idx != -1)
587 {
588 menuPopup.Check(1000+active_idx, true);
589 }
590
591 // find out where to put the popup menu of window items
592 wxPoint pt = ::wxGetMousePosition();
593 pt = wnd->ScreenToClient(pt);
594
595 // find out the screen coordinate at the bottom of the tab ctrl
596 wxRect cli_rect = wnd->GetClientRect();
597 pt.y = cli_rect.y + cli_rect.height;
598
599 wxAuiCommandCapture* cc = new wxAuiCommandCapture;
600 wnd->PushEventHandler(cc);
601 wnd->PopupMenu(&menuPopup, pt);
602 int command = cc->GetCommandId();
603 wnd->PopEventHandler(true);
604
605 if (command >= 1000)
606 return command-1000;
607
608 return -1;
609 }
610
GetBestTabCtrlSize(wxWindow * wnd,const wxAuiNotebookPageArray & pages,const wxSize & required_bmp_size)611 int SLArtProvider::GetBestTabCtrlSize(wxWindow* wnd,
612 const wxAuiNotebookPageArray& pages,
613 const wxSize& required_bmp_size)
614 {
615 wxClientDC dc(wnd);
616 dc.SetFont(m_measuring_font);
617
618 // sometimes a standard bitmap size needs to be enforced, especially
619 // if some tabs have bitmaps and others don't. This is important because
620 // it prevents the tab control from resizing when tabs are added.
621 wxBitmap measure_bmp;
622 if (required_bmp_size.IsFullySpecified())
623 {
624 measure_bmp.Create(required_bmp_size.x,
625 required_bmp_size.y);
626 }
627
628
629 int max_y = 0;
630 size_t i, page_count = pages.GetCount();
631 for (i = 0; i < page_count; ++i)
632 {
633 wxAuiNotebookPage& page = pages.Item(i);
634
635 wxBitmap bmp;
636 if (measure_bmp.IsOk())
637 bmp = measure_bmp;
638 else
639 bmp = page.bitmap;
640
641 // we don't use the caption text because we don't
642 // want tab heights to be different in the case
643 // of a very short piece of text on one tab and a very
644 // tall piece of text on another tab
645 int x_ext = 0;
646 wxSize s = GetTabSize(dc,
647 wnd,
648 wxT("ABCDEFGHIj"),
649 bmp,
650 true,
651 wxAUI_BUTTON_STATE_HIDDEN,
652 &x_ext);
653
654 max_y = wxMax(max_y, s.y);
655 }
656
657 return max_y+2;
658 }
659
SetNormalFont(const wxFont & font)660 void SLArtProvider::SetNormalFont(const wxFont& font)
661 {
662 m_normal_font = font;
663 }
664
SetSelectedFont(const wxFont & font)665 void SLArtProvider::SetSelectedFont(const wxFont& font)
666 {
667 m_selected_font = font;
668 }
669
SetMeasuringFont(const wxFont & font)670 void SLArtProvider::SetMeasuringFont(const wxFont& font)
671 {
672 m_measuring_font = font;
673 }
674
SetColour(const wxColour & colour)675 void SLArtProvider::SetColour(const wxColour& colour)
676 {
677 m_base_colour = colour;
678 #ifdef HAVE_WX29
679 m_border_pen = wxPen(m_base_colour.ChangeLightness(75));
680 #else
681 //!todo
682 m_border_pen = wxPen(m_base_colour);
683 #endif
684 m_base_colour_pen = wxPen(m_base_colour);
685 m_base_colour_brush = wxBrush(m_base_colour);
686
687 }
688
SetActiveColour(const wxColour & colour)689 void SLArtProvider::SetActiveColour(const wxColour& colour)
690 {
691 m_active_colour = colour;
692 }
693