]> git.saurik.com Git - wxWidgets.git/blame - src/osx/carbon/renderer.cpp
Spell contributor name correctly.
[wxWidgets.git] / src / osx / carbon / renderer.cpp
CommitLineData
489468fe 1///////////////////////////////////////////////////////////////////////////////
524c47aa 2// Name: src/osx/carbon/renderer.cpp
489468fe
SC
3// Purpose: implementation of wxRendererNative for Mac
4// Author: Vadim Zeitlin
5// Modified by:
6// Created: 20.07.2003
7// RCS-ID: $Id$
8// Copyright: (c) 2003 Vadim Zeitlin <vadim@wxwindows.org>
9// License: wxWindows licence
10///////////////////////////////////////////////////////////////////////////////
11
12// for compilers that support precompilation, includes "wx.h".
13#include "wx/wxprec.h"
14
15#ifdef __BORLANDC__
16 #pragma hdrstop
17#endif
18
19#ifndef WX_PRECOMP
20 #include "wx/string.h"
21 #include "wx/dc.h"
22 #include "wx/bitmap.h"
23 #include "wx/settings.h"
24 #include "wx/dcclient.h"
25 #include "wx/toplevel.h"
26#endif
27
28#include "wx/renderer.h"
29#include "wx/graphics.h"
524c47aa 30#include "wx/dcgraph.h"
b2680ced 31#include "wx/osx/private.h"
489468fe 32
ec20a753
VZ
33#ifdef wxHAS_DRAW_TITLE_BAR_BITMAP
34 #include "wx/image.h"
35 #include "wx/mstream.h"
36#endif // wxHAS_DRAW_TITLE_BAR_BITMAP
37
e4131985
KO
38// check if we're currently in a paint event
39inline bool wxInPaintEvent(wxWindow* win, wxDC& dc)
40{
de0d2095 41 wxUnusedVar(dc);
e4131985
KO
42 return ( win->MacGetCGContextRef() != NULL );
43}
44
45
46
489468fe
SC
47class WXDLLEXPORT wxRendererMac : public wxDelegateRendererNative
48{
49public:
50 // draw the header control button (used by wxListCtrl)
51 virtual int DrawHeaderButton( wxWindow *win,
52 wxDC& dc,
53 const wxRect& rect,
54 int flags = 0,
55 wxHeaderSortIconType sortArrow = wxHDR_SORT_ICON_NONE,
56 wxHeaderButtonParams* params = NULL );
57
58 virtual int GetHeaderButtonHeight(wxWindow *win);
59
60 // draw the expanded/collapsed icon for a tree control item
61 virtual void DrawTreeItemButton( wxWindow *win,
62 wxDC& dc,
63 const wxRect& rect,
64 int flags = 0 );
65
66 // draw a (vertical) sash
67 virtual void DrawSplitterSash( wxWindow *win,
68 wxDC& dc,
69 const wxSize& size,
70 wxCoord position,
71 wxOrientation orient,
72 int flags = 0 );
73
74 virtual void DrawCheckBox(wxWindow *win,
75 wxDC& dc,
76 const wxRect& rect,
77 int flags = 0);
78
191e43fd 79 virtual wxSize GetCheckBoxSize(wxWindow* win);
e8759560 80
489468fe
SC
81 virtual void DrawComboBoxDropButton(wxWindow *win,
82 wxDC& dc,
83 const wxRect& rect,
84 int flags = 0);
85
86 virtual void DrawPushButton(wxWindow *win,
87 wxDC& dc,
88 const wxRect& rect,
89 int flags = 0);
90
91 virtual void DrawItemSelectionRect(wxWindow *win,
92 wxDC& dc,
93 const wxRect& rect,
94 int flags = 0);
95
96 virtual void DrawFocusRect(wxWindow* win, wxDC& dc, const wxRect& rect, int flags = 0);
97
e4131985
KO
98 virtual void DrawChoice(wxWindow* win, wxDC& dc, const wxRect& rect, int flags=0);
99
100 virtual void DrawComboBox(wxWindow* win, wxDC& dc, const wxRect& rect, int flags=0);
101
102 virtual void DrawTextCtrl(wxWindow* win, wxDC& dc, const wxRect& rect, int flags=0);
103
6e6b532c 104 virtual void DrawRadioBitmap(wxWindow* win, wxDC& dc, const wxRect& rect, int flags=0);
e4131985 105
ec20a753
VZ
106#ifdef wxHAS_DRAW_TITLE_BAR_BITMAP
107 virtual void DrawTitleBarBitmap(wxWindow *win,
108 wxDC& dc,
109 const wxRect& rect,
110 wxTitleBarButton button,
111 int flags = 0);
112#endif // wxHAS_DRAW_TITLE_BAR_BITMAP
113
489468fe
SC
114private:
115 void DrawMacThemeButton(wxWindow *win,
116 wxDC& dc,
117 const wxRect& rect,
118 int flags,
119 int kind,
120 int adornment);
121
122 // the tree buttons
123 wxBitmap m_bmpTreeExpanded;
124 wxBitmap m_bmpTreeCollapsed;
125};
126
127// ============================================================================
128// implementation
129// ============================================================================
130
131// static
132wxRendererNative& wxRendererNative::GetDefault()
133{
134 static wxRendererMac s_rendererMac;
135
136 return s_rendererMac;
137}
138
139int wxRendererMac::DrawHeaderButton( wxWindow *win,
140 wxDC& dc,
141 const wxRect& rect,
142 int flags,
143 wxHeaderSortIconType sortArrow,
144 wxHeaderButtonParams* params )
145{
146 const wxCoord x = rect.x;
147 const wxCoord y = rect.y;
148 const wxCoord w = rect.width;
149 const wxCoord h = rect.height;
150
151 dc.SetBrush( *wxTRANSPARENT_BRUSH );
152
153 HIRect headerRect = CGRectMake( x, y, w, h );
e4131985 154 if ( !wxInPaintEvent(win, dc) )
489468fe
SC
155 {
156 win->Refresh( &rect );
157 }
158 else
159 {
160 CGContextRef cgContext;
161 wxGCDCImpl *impl = (wxGCDCImpl*) dc.GetImpl();
162
163 cgContext = (CGContextRef) impl->GetGraphicsContext()->GetNativeContext();
164
165 {
166 HIThemeButtonDrawInfo drawInfo;
167 HIRect labelRect;
168
169 memset( &drawInfo, 0, sizeof(drawInfo) );
170 drawInfo.version = 0;
171 drawInfo.kind = kThemeListHeaderButton;
172 drawInfo.state = (flags & wxCONTROL_DISABLED) ? kThemeStateInactive : kThemeStateActive;
173 drawInfo.value = (flags & wxCONTROL_SELECTED) ? kThemeButtonOn : kThemeButtonOff;
174 drawInfo.adornment = kThemeAdornmentNone;
175
176 // The down arrow is drawn automatically, change it to an up arrow if needed.
177 if ( sortArrow == wxHDR_SORT_ICON_UP )
178 drawInfo.adornment = kThemeAdornmentHeaderButtonSortUp;
179
180 HIThemeDrawButton( &headerRect, &drawInfo, cgContext, kHIThemeOrientationNormal, &labelRect );
181
182 // If we don't want any arrows we need to draw over the one already there
183 if ( (flags & wxCONTROL_SELECTED) && (sortArrow == wxHDR_SORT_ICON_NONE) )
184 {
185 // clip to the header rectangle
186 CGContextSaveGState( cgContext );
187 CGContextClipToRect( cgContext, headerRect );
188 // but draw bigger than that so the arrow will get clipped off
189 headerRect.size.width += 25;
190 HIThemeDrawButton( &headerRect, &drawInfo, cgContext, kHIThemeOrientationNormal, &labelRect );
191 CGContextRestoreGState( cgContext );
192 }
193 }
194 }
195
196 // Reserve room for the arrows before writing the label, and turn off the
197 // flags we've already handled
198 wxRect newRect(rect);
199 if ( (flags & wxCONTROL_SELECTED) && (sortArrow != wxHDR_SORT_ICON_NONE) )
200 {
201 newRect.width -= 12;
202 sortArrow = wxHDR_SORT_ICON_NONE;
203 }
204 flags &= ~wxCONTROL_SELECTED;
205
206 return DrawHeaderButtonContents(win, dc, newRect, flags, sortArrow, params);
207}
208
209
210int wxRendererMac::GetHeaderButtonHeight(wxWindow* WXUNUSED(win))
211{
212 SInt32 standardHeight;
213 OSStatus errStatus;
214
215 errStatus = GetThemeMetric( kThemeMetricListHeaderHeight, &standardHeight );
216 if (errStatus == noErr)
217 {
218 return standardHeight;
219 }
220 return -1;
221}
222
223void wxRendererMac::DrawTreeItemButton( wxWindow *win,
224 wxDC& dc,
225 const wxRect& rect,
226 int flags )
227{
228 // now the wxGCDC is using native transformations
229 const wxCoord x = rect.x;
230 const wxCoord y = rect.y;
231 const wxCoord w = rect.width;
232 const wxCoord h = rect.height;
233
234 dc.SetBrush( *wxTRANSPARENT_BRUSH );
235
236 HIRect headerRect = CGRectMake( x, y, w, h );
e4131985 237 if ( !wxInPaintEvent(win, dc) )
489468fe
SC
238 {
239 win->Refresh( &rect );
240 }
241 else
242 {
243 CGContextRef cgContext;
244
245 wxGCDCImpl *impl = (wxGCDCImpl*) dc.GetImpl();
246 cgContext = (CGContextRef) impl->GetGraphicsContext()->GetNativeContext();
247
248 HIThemeButtonDrawInfo drawInfo;
249 HIRect labelRect;
250
251 memset( &drawInfo, 0, sizeof(drawInfo) );
252 drawInfo.version = 0;
253 drawInfo.kind = kThemeDisclosureButton;
254 drawInfo.state = (flags & wxCONTROL_DISABLED) ? kThemeStateInactive : kThemeStateActive;
255 // Apple mailing list posts say to use the arrow adornment constants, but those don't work.
256 // We need to set the value using the 'old' DrawThemeButton constants instead.
257 drawInfo.value = (flags & wxCONTROL_EXPANDED) ? kThemeDisclosureDown : kThemeDisclosureRight;
258 drawInfo.adornment = kThemeAdornmentNone;
259
260 HIThemeDrawButton( &headerRect, &drawInfo, cgContext, kHIThemeOrientationNormal, &labelRect );
261 }
262}
263
264void wxRendererMac::DrawSplitterSash( wxWindow *win,
265 wxDC& dc,
266 const wxSize& size,
267 wxCoord position,
268 wxOrientation orient,
269 int WXUNUSED(flags) )
270{
b2680ced 271 bool hasMetal = win->MacGetTopLevelWindow()->GetExtraStyle() & wxFRAME_EX_METAL;
489468fe
SC
272 SInt32 height;
273 GetThemeMetric( kThemeMetricSmallPaneSplitterHeight, &height );
274 HIRect splitterRect;
275 if (orient == wxVERTICAL)
276 splitterRect = CGRectMake( position, 0, height, size.y );
277 else
278 splitterRect = CGRectMake( 0, position, size.x, height );
279
280 // under compositing we should only draw when called by the OS, otherwise just issue a redraw command
281 // strange redraw errors occur if we don't do this
282
e4131985 283 if ( !wxInPaintEvent(win, dc) )
489468fe
SC
284 {
285 wxRect rect( (int) splitterRect.origin.x, (int) splitterRect.origin.y, (int) splitterRect.size.width,
286 (int) splitterRect.size.height );
d67e4ac4
SC
287 win->RefreshRect( rect );
288 }
489468fe
SC
289 else
290 {
291 CGContextRef cgContext;
292 wxGCDCImpl *impl = (wxGCDCImpl*) dc.GetImpl();
293 cgContext = (CGContextRef) impl->GetGraphicsContext()->GetNativeContext();
294
d67e4ac4
SC
295 HIThemeBackgroundDrawInfo bgdrawInfo;
296 bgdrawInfo.version = 0;
297 bgdrawInfo.state = kThemeStateActive;
298 bgdrawInfo.kind = hasMetal ? kThemeBackgroundMetal : kThemeBackgroundPlacard;
299
300 if ( hasMetal )
301 HIThemeDrawBackground(&splitterRect, &bgdrawInfo, cgContext, kHIThemeOrientationNormal);
302 else
303 {
304 CGContextSetFillColorWithColor(cgContext,win->GetBackgroundColour().GetCGColor());
305 CGContextFillRect(cgContext,splitterRect);
306 }
307
489468fe
SC
308 HIThemeSplitterDrawInfo drawInfo;
309 drawInfo.version = 0;
310 drawInfo.state = kThemeStateActive;
311 drawInfo.adornment = hasMetal ? kHIThemeSplitterAdornmentMetal : kHIThemeSplitterAdornmentNone;
312 HIThemeDrawPaneSplitter( &splitterRect, &drawInfo, cgContext, kHIThemeOrientationNormal );
313 }
314}
315
316void
317wxRendererMac::DrawItemSelectionRect(wxWindow * WXUNUSED(win),
318 wxDC& dc,
319 const wxRect& rect,
320 int flags)
321{
322 if ( !(flags & wxCONTROL_SELECTED) )
323 return;
324
325 wxColour col( wxMacCreateCGColorFromHITheme( (flags & wxCONTROL_FOCUSED) ?
326 kThemeBrushAlternatePrimaryHighlightColor
327 : kThemeBrushSecondaryHighlightColor ) );
328 wxBrush selBrush( col );
329
330 dc.SetPen( *wxTRANSPARENT_PEN );
331 dc.SetBrush( selBrush );
332 dc.DrawRectangle( rect );
333}
334
335
336void
337wxRendererMac::DrawMacThemeButton(wxWindow *win,
338 wxDC& dc,
339 const wxRect& rect,
340 int flags,
341 int kind,
342 int adornment)
343{
344 // now the wxGCDC is using native transformations
345 const wxCoord x = rect.x;
346 const wxCoord y = rect.y;
347 const wxCoord w = rect.width;
348 const wxCoord h = rect.height;
349
350 dc.SetBrush( *wxTRANSPARENT_BRUSH );
351
352 HIRect headerRect = CGRectMake( x, y, w, h );
e4131985 353 if ( !wxInPaintEvent(win, dc) )
489468fe
SC
354 {
355 win->Refresh( &rect );
356 }
357 else
358 {
359 wxGCDCImpl *impl = (wxGCDCImpl*) dc.GetImpl();
360 CGContextRef cgContext;
361 cgContext = (CGContextRef) impl->GetGraphicsContext()->GetNativeContext();
362
363 HIThemeButtonDrawInfo drawInfo;
364 HIRect labelRect;
365
366 memset( &drawInfo, 0, sizeof(drawInfo) );
367 drawInfo.version = 0;
368 drawInfo.kind = kind;
369 drawInfo.state = (flags & wxCONTROL_DISABLED) ? kThemeStateInactive : kThemeStateActive;
370 drawInfo.value = (flags & wxCONTROL_SELECTED) ? kThemeButtonOn : kThemeButtonOff;
371 if (flags & wxCONTROL_UNDETERMINED)
372 drawInfo.value = kThemeButtonMixed;
373 drawInfo.adornment = adornment;
e4131985
KO
374 if (flags & wxCONTROL_FOCUSED)
375 drawInfo.adornment |= kThemeAdornmentFocus;
99c4be68 376
489468fe
SC
377 HIThemeDrawButton( &headerRect, &drawInfo, cgContext, kHIThemeOrientationNormal, &labelRect );
378 }
379}
380
381void
382wxRendererMac::DrawCheckBox(wxWindow *win,
383 wxDC& dc,
384 const wxRect& rect,
385 int flags)
386{
387 if (flags & wxCONTROL_CHECKED)
388 flags |= wxCONTROL_SELECTED;
389
e4131985 390 int kind;
99c4be68 391
e4131985
KO
392 if (win->GetWindowVariant() == wxWINDOW_VARIANT_SMALL ||
393 (win->GetParent() && win->GetParent()->GetWindowVariant() == wxWINDOW_VARIANT_SMALL))
394 kind = kThemeCheckBoxSmall;
395 else if (win->GetWindowVariant() == wxWINDOW_VARIANT_MINI ||
396 (win->GetParent() && win->GetParent()->GetWindowVariant() == wxWINDOW_VARIANT_MINI))
397 kind = kThemeCheckBoxMini;
398 else
399 kind = kThemeCheckBox;
400
401
489468fe 402 DrawMacThemeButton(win, dc, rect, flags,
e4131985 403 kind, kThemeAdornmentNone);
489468fe
SC
404}
405
191e43fd 406wxSize wxRendererMac::GetCheckBoxSize(wxWindow* WXUNUSED(win))
e8759560
VZ
407{
408 wxSize size;
409 SInt32 width, height;
410 OSStatus errStatus;
411
412 errStatus = GetThemeMetric(kThemeMetricCheckBoxWidth, &width);
413 if (errStatus == noErr)
414 {
415 size.SetWidth(width);
416 }
417
418 errStatus = GetThemeMetric(kThemeMetricCheckBoxHeight, &height);
419 if (errStatus == noErr)
420 {
421 size.SetHeight(height);
422 }
423
424 return size;
425}
426
489468fe
SC
427void
428wxRendererMac::DrawComboBoxDropButton(wxWindow *win,
429 wxDC& dc,
430 const wxRect& rect,
431 int flags)
432{
433 int kind;
434 if (win->GetWindowVariant() == wxWINDOW_VARIANT_SMALL || (win->GetParent() && win->GetParent()->GetWindowVariant() == wxWINDOW_VARIANT_SMALL))
435 kind = kThemeArrowButtonSmall;
436 else if (win->GetWindowVariant() == wxWINDOW_VARIANT_MINI || (win->GetParent() && win->GetParent()->GetWindowVariant() == wxWINDOW_VARIANT_MINI))
437 kind = kThemeArrowButtonMini;
438 else
439 kind = kThemeArrowButton;
440
441 DrawMacThemeButton(win, dc, rect, flags,
442 kind, kThemeAdornmentArrowDownArrow);
443}
444
445void
446wxRendererMac::DrawPushButton(wxWindow *win,
447 wxDC& dc,
448 const wxRect& rect,
449 int flags)
450{
451 int kind;
452 if (win->GetWindowVariant() == wxWINDOW_VARIANT_SMALL || (win->GetParent() && win->GetParent()->GetWindowVariant() == wxWINDOW_VARIANT_SMALL))
453 kind = kThemeBevelButtonSmall;
454 // There is no kThemeBevelButtonMini, but in this case, use Small
455 else if (win->GetWindowVariant() == wxWINDOW_VARIANT_MINI || (win->GetParent() && win->GetParent()->GetWindowVariant() == wxWINDOW_VARIANT_MINI))
456 kind = kThemeBevelButtonSmall;
457 else
458 kind = kThemeBevelButton;
459
460 DrawMacThemeButton(win, dc, rect, flags,
461 kind, kThemeAdornmentNone);
462}
463
464void
465wxRendererMac::DrawFocusRect(wxWindow* win, wxDC& dc, const wxRect& rect, int flags)
466{
467 if (!win)
468 {
469 wxDelegateRendererNative::DrawFocusRect(win, dc, rect, flags);
470 return;
471 }
472
473 CGRect cgrect = CGRectMake( rect.x , rect.y , rect.width, rect.height ) ;
474
475 HIThemeFrameDrawInfo info ;
e4131985 476
489468fe
SC
477 memset( &info, 0 , sizeof(info) ) ;
478
479 info.version = 0 ;
480 info.kind = 0 ;
481 info.state = kThemeStateActive;
482 info.isFocused = true ;
483
484 CGContextRef cgContext = (CGContextRef) win->MacGetCGContextRef() ;
485 wxASSERT( cgContext ) ;
486
487 HIThemeDrawFocusRect( &cgrect , true , cgContext , kHIThemeOrientationNormal ) ;
488}
e4131985
KO
489
490void wxRendererMac::DrawChoice(wxWindow* win, wxDC& dc,
491 const wxRect& rect, int flags)
492{
493 int kind;
99c4be68 494
e4131985
KO
495 if (win->GetWindowVariant() == wxWINDOW_VARIANT_SMALL ||
496 (win->GetParent() && win->GetParent()->GetWindowVariant() == wxWINDOW_VARIANT_SMALL))
497 kind = kThemePopupButtonSmall;
498 else if (win->GetWindowVariant() == wxWINDOW_VARIANT_MINI ||
499 (win->GetParent() && win->GetParent()->GetWindowVariant() == wxWINDOW_VARIANT_MINI))
500 kind = kThemePopupButtonMini;
501 else
502 kind = kThemePopupButton;
503
504 DrawMacThemeButton(win, dc, rect, flags, kind, kThemeAdornmentNone);
505}
506
507
508void wxRendererMac::DrawComboBox(wxWindow* win, wxDC& dc,
509 const wxRect& rect, int flags)
510{
511 int kind;
99c4be68 512
e4131985
KO
513 if (win->GetWindowVariant() == wxWINDOW_VARIANT_SMALL ||
514 (win->GetParent() && win->GetParent()->GetWindowVariant() == wxWINDOW_VARIANT_SMALL))
515 kind = kThemeComboBoxSmall;
516 else if (win->GetWindowVariant() == wxWINDOW_VARIANT_MINI ||
517 (win->GetParent() && win->GetParent()->GetWindowVariant() == wxWINDOW_VARIANT_MINI))
518 kind = kThemeComboBoxMini;
519 else
520 kind = kThemeComboBox;
521
522 DrawMacThemeButton(win, dc, rect, flags, kind, kThemeAdornmentNone);
523}
524
6e6b532c 525void wxRendererMac::DrawRadioBitmap(wxWindow* win, wxDC& dc,
e4131985
KO
526 const wxRect& rect, int flags)
527{
528 int kind;
99c4be68 529
e4131985
KO
530 if (win->GetWindowVariant() == wxWINDOW_VARIANT_SMALL ||
531 (win->GetParent() && win->GetParent()->GetWindowVariant() == wxWINDOW_VARIANT_SMALL))
532 kind = kThemeRadioButtonSmall;
533 else if (win->GetWindowVariant() == wxWINDOW_VARIANT_MINI ||
534 (win->GetParent() && win->GetParent()->GetWindowVariant() == wxWINDOW_VARIANT_MINI))
535 kind = kThemeRadioButtonMini;
536 else
537 kind = kThemeRadioButton;
538
539 if (flags & wxCONTROL_CHECKED)
540 flags |= wxCONTROL_SELECTED;
541
542 DrawMacThemeButton(win, dc, rect, flags,
543 kind, kThemeAdornmentNone);
544}
545
546void wxRendererMac::DrawTextCtrl(wxWindow* win, wxDC& dc,
547 const wxRect& rect, int flags)
548{
549 const wxCoord x = rect.x;
550 const wxCoord y = rect.y;
551 const wxCoord w = rect.width;
552 const wxCoord h = rect.height;
553
554 dc.SetBrush( *wxWHITE_BRUSH );
555 dc.SetPen( *wxTRANSPARENT_PEN );
556 dc.DrawRectangle(rect);
99c4be68 557
e4131985
KO
558 dc.SetBrush( *wxTRANSPARENT_BRUSH );
559
560 HIRect hiRect = CGRectMake( x, y, w, h );
561 if ( !wxInPaintEvent(win, dc) )
562 {
953e84dd 563 win->Refresh( &rect );
e4131985
KO
564 }
565 else
566 {
567 CGContextRef cgContext;
568
569 cgContext = (CGContextRef) static_cast<wxGCDCImpl*>(dc.GetImpl())->GetGraphicsContext()->GetNativeContext();
570
571 {
572 HIThemeFrameDrawInfo drawInfo;
573
574 memset( &drawInfo, 0, sizeof(drawInfo) );
575 drawInfo.version = 0;
576 drawInfo.kind = kHIThemeFrameTextFieldSquare;
577 drawInfo.state = (flags & wxCONTROL_DISABLED) ? kThemeStateInactive : kThemeStateActive;
578 if (flags & wxCONTROL_FOCUSED)
579 drawInfo.isFocused = true;
580
581 HIThemeDrawFrame( &hiRect, &drawInfo, cgContext, kHIThemeOrientationNormal);
582 }
583 }
584}
585
ec20a753
VZ
586#ifdef wxHAS_DRAW_TITLE_BAR_BITMAP
587
588void wxRendererMac::DrawTitleBarBitmap(wxWindow *win,
589 wxDC& dc,
590 const wxRect& rect,
591 wxTitleBarButton button,
592 int flags)
593{
594 // the files below were converted from the originals in art/osx/close*.png
595 // using misc/scripts/png2c.py script -- we must use PNG and not XPM for
596 // them because they use transparency and don't look right without it
597
598 /* close.png - 400 bytes */
599 static const unsigned char close_png[] = {
600 0x89, 0x50, 0x4e, 0x47, 0x0d, 0x0a, 0x1a, 0x0a,
601 0x00, 0x00, 0x00, 0x0d, 0x49, 0x48, 0x44, 0x52,
602 0x00, 0x00, 0x00, 0x0e, 0x00, 0x00, 0x00, 0x0e,
603 0x08, 0x06, 0x00, 0x00, 0x00, 0x1f, 0x48, 0x2d,
604 0xd1, 0x00, 0x00, 0x00, 0x06, 0x62, 0x4b, 0x47,
605 0x44, 0x00, 0xff, 0x00, 0xff, 0x00, 0xff, 0xa0,
606 0xbd, 0xa7, 0x93, 0x00, 0x00, 0x00, 0x09, 0x70,
607 0x48, 0x59, 0x73, 0x00, 0x00, 0x0b, 0x12, 0x00,
608 0x00, 0x0b, 0x12, 0x01, 0xd2, 0xdd, 0x7e, 0xfc,
609 0x00, 0x00, 0x00, 0x09, 0x76, 0x70, 0x41, 0x67,
610 0x00, 0x00, 0x00, 0x0e, 0x00, 0x00, 0x00, 0x0e,
611 0x00, 0xb1, 0x5b, 0xf1, 0xf7, 0x00, 0x00, 0x00,
612 0xef, 0x49, 0x44, 0x41, 0x54, 0x28, 0xcf, 0xa5,
613 0xd2, 0x31, 0x4a, 0x03, 0x41, 0x18, 0xc5, 0xf1,
614 0xdf, 0xc6, 0x55, 0x02, 0xb2, 0x18, 0xb0, 0x33,
615 0x8d, 0xd8, 0x6e, 0x8a, 0x14, 0xa6, 0xb2, 0xc9,
616 0x21, 0x72, 0x0b, 0xdb, 0x5c, 0x45, 0x98, 0x3b,
617 0x24, 0xc7, 0x99, 0x6d, 0x2d, 0x04, 0xd3, 0x09,
618 0x42, 0x48, 0x65, 0x60, 0x6c, 0x76, 0x65, 0x1c,
619 0x14, 0x45, 0x5f, 0x35, 0xfc, 0xe7, 0x3d, 0xe6,
620 0x9b, 0x8f, 0x57, 0xf9, 0xac, 0x06, 0x97, 0x98,
621 0xe0, 0xbc, 0x67, 0x07, 0xbc, 0xe2, 0x05, 0xfb,
622 0xc1, 0x58, 0x65, 0xa1, 0x2b, 0x4c, 0xb3, 0x40,
623 0xa9, 0x03, 0x9e, 0xb1, 0x83, 0x93, 0x2c, 0x74,
624 0x83, 0xb1, 0xef, 0x75, 0x86, 0x0b, 0x1c, 0xb1,
625 0x1f, 0xf5, 0xe3, 0x4d, 0x51, 0x43, 0x08, 0xe1,
626 0xb6, 0x4c, 0x64, 0xac, 0xee, 0xbd, 0x0d, 0x5c,
627 0x63, 0x89, 0x65, 0x08, 0x61, 0x9d, 0x52, 0x4a,
628 0x31, 0xc6, 0xcd, 0xc0, 0x62, 0x8c, 0x9b, 0x94,
629 0x52, 0x0a, 0x21, 0xac, 0x07, 0xd6, 0x67, 0xcc,
630 0x33, 0xf0, 0x61, 0x8c, 0x31, 0x6e, 0xf2, 0x73,
631 0xee, 0xc1, 0xbc, 0xc2, 0x1d, 0x4e, 0xf3, 0xd1,
632 0x62, 0x8c, 0xf7, 0x6d, 0xdb, 0xae, 0xa0, 0xeb,
633 0xba, 0xed, 0x6c, 0x36, 0x7b, 0x28, 0xa6, 0x7f,
634 0x1b, 0xf9, 0xa3, 0xea, 0x7e, 0xcd, 0x93, 0xf2,
635 0xb5, 0xae, 0xeb, 0xb6, 0xd0, 0xb6, 0xed, 0x2a,
636 0xc6, 0xa8, 0x78, 0xf5, 0xf0, 0xaf, 0xe5, 0x34,
637 0x58, 0xe4, 0xe1, 0x62, 0x11, 0x25, 0x5b, 0xa0,
638 0x19, 0x9a, 0x33, 0x14, 0xa0, 0xfe, 0xe1, 0x6b,
639 0x47, 0x3c, 0x62, 0x37, 0x34, 0x67, 0xdf, 0xc3,
640 0x71, 0xdf, 0x90, 0xaf, 0x74, 0xc0, 0x93, 0xbe,
641 0x72, 0x55, 0x71, 0xf9, 0xeb, 0x92, 0xbf, 0x03,
642 0x70, 0x33, 0x76, 0x58, 0xe5, 0x41, 0xfb, 0x6d,
643 0x00, 0x00, 0x00, 0x20, 0x7a, 0x54, 0x58, 0x74,
644 0x74, 0x69, 0x66, 0x66, 0x3a, 0x72, 0x6f, 0x77,
645 0x73, 0x2d, 0x70, 0x65, 0x72, 0x2d, 0x73, 0x74,
646 0x72, 0x69, 0x70, 0x00, 0x00, 0x78, 0xda, 0x33,
647 0xb5, 0x30, 0x05, 0x00, 0x01, 0x47, 0x00, 0xa3,
648 0x38, 0xda, 0x77, 0x3b, 0x00, 0x00, 0x00, 0x00,
649 0x49, 0x45, 0x4e, 0x44, 0xae, 0x42, 0x60, 0x82
650 };
651
652 /* close_current.png - 421 bytes */
653 static const unsigned char close_current_png[] = {
654 0x89, 0x50, 0x4e, 0x47, 0x0d, 0x0a, 0x1a, 0x0a,
655 0x00, 0x00, 0x00, 0x0d, 0x49, 0x48, 0x44, 0x52,
656 0x00, 0x00, 0x00, 0x0e, 0x00, 0x00, 0x00, 0x0e,
657 0x08, 0x06, 0x00, 0x00, 0x00, 0x1f, 0x48, 0x2d,
658 0xd1, 0x00, 0x00, 0x00, 0x06, 0x62, 0x4b, 0x47,
659 0x44, 0x00, 0xff, 0x00, 0xff, 0x00, 0xff, 0xa0,
660 0xbd, 0xa7, 0x93, 0x00, 0x00, 0x00, 0x09, 0x70,
661 0x48, 0x59, 0x73, 0x00, 0x00, 0x0b, 0x12, 0x00,
662 0x00, 0x0b, 0x12, 0x01, 0xd2, 0xdd, 0x7e, 0xfc,
663 0x00, 0x00, 0x00, 0x09, 0x76, 0x70, 0x41, 0x67,
664 0x00, 0x00, 0x00, 0x0e, 0x00, 0x00, 0x00, 0x0e,
665 0x00, 0xb1, 0x5b, 0xf1, 0xf7, 0x00, 0x00, 0x01,
666 0x04, 0x49, 0x44, 0x41, 0x54, 0x28, 0xcf, 0x9d,
667 0xd2, 0xbd, 0x4a, 0x43, 0x31, 0x00, 0xc5, 0xf1,
668 0xdf, 0x8d, 0x56, 0x44, 0x04, 0x45, 0xd0, 0xc5,
669 0x55, 0xdc, 0x0a, 0x8e, 0xed, 0xec, 0xe4, 0xec,
670 0x24, 0xd4, 0x67, 0x29, 0x59, 0xfa, 0x16, 0x9d,
671 0x7c, 0x07, 0x1d, 0x5c, 0xba, 0xa5, 0xa3, 0x28,
672 0x22, 0x94, 0xae, 0x2e, 0x1d, 0x4a, 0x5d, 0x55,
673 0xb8, 0x2e, 0x09, 0x5c, 0x4b, 0xfd, 0xa0, 0x67,
674 0x0a, 0x27, 0x39, 0xc9, 0x49, 0xf2, 0xaf, 0x7c,
675 0xd7, 0x01, 0x8e, 0x71, 0x84, 0xfd, 0xec, 0x2d,
676 0x30, 0xc3, 0x2b, 0xe6, 0x65, 0x61, 0xd5, 0x08,
677 0x9d, 0xe0, 0x14, 0x7b, 0x56, 0xeb, 0x0d, 0x13,
678 0x4c, 0x61, 0xa3, 0x11, 0x3a, 0xc3, 0x8e, 0x9f,
679 0xb5, 0x9d, 0x9b, 0xbc, 0x63, 0x1e, 0x72, 0xbd,
680 0x53, 0xb4, 0x20, 0xc6, 0xd8, 0x5e, 0x4e, 0x34,
681 0xbc, 0x56, 0x5e, 0x7b, 0x00, 0x6d, 0x5c, 0xe1,
682 0x2a, 0xc6, 0x38, 0xa8, 0xeb, 0xba, 0x4e, 0x29,
683 0xdd, 0x16, 0x2f, 0xa5, 0x74, 0x5b, 0xd7, 0x75,
684 0x1d, 0x63, 0x1c, 0x14, 0x0f, 0xed, 0x0a, 0xe7,
685 0xb9, 0x02, 0x48, 0x29, 0x5d, 0x77, 0x3a, 0x9d,
686 0x8b, 0xf1, 0x78, 0x7c, 0x07, 0x65, 0xdc, 0xed,
687 0x76, 0x6f, 0x1a, 0x25, 0x66, 0x15, 0x2e, 0xb1,
688 0xd5, 0xac, 0x56, 0xc2, 0xb0, 0x22, 0x04, 0xef,
689 0xc1, 0x9a, 0xda, 0xcc, 0xff, 0xf4, 0x6b, 0xd5,
690 0x94, 0x92, 0xa5, 0x53, 0x17, 0x6b, 0x3f, 0xce,
691 0x06, 0x3e, 0x71, 0x88, 0xed, 0xd1, 0x68, 0x34,
692 0x0b, 0x21, 0x4c, 0x7a, 0xbd, 0xde, 0x7d, 0xd9,
693 0x7a, 0x38, 0x1c, 0x3e, 0x86, 0x10, 0x26, 0xfd,
694 0x7e, 0xff, 0xa9, 0x01, 0xc2, 0x4b, 0x21, 0xa7,
695 0x00, 0xd0, 0xfa, 0xe3, 0x6a, 0x1f, 0x78, 0xc0,
696 0xb4, 0x90, 0x33, 0xcf, 0x44, 0xec, 0x66, 0x42,
697 0x56, 0xe9, 0x0d, 0xcf, 0x32, 0x72, 0xd5, 0xd2,
698 0xe4, 0xbf, 0x21, 0xff, 0x02, 0x4d, 0xb5, 0x74,
699 0x79, 0x60, 0x9f, 0x78, 0x78, 0x00, 0x00, 0x00,
700 0x20, 0x7a, 0x54, 0x58, 0x74, 0x74, 0x69, 0x66,
701 0x66, 0x3a, 0x72, 0x6f, 0x77, 0x73, 0x2d, 0x70,
702 0x65, 0x72, 0x2d, 0x73, 0x74, 0x72, 0x69, 0x70,
703 0x00, 0x00, 0x78, 0xda, 0x33, 0xb5, 0x30, 0x05,
704 0x00, 0x01, 0x47, 0x00, 0xa3, 0x38, 0xda, 0x77,
705 0x3b, 0x00, 0x00, 0x00, 0x00, 0x49, 0x45, 0x4e,
706 0x44, 0xae, 0x42, 0x60, 0x82};
707
708 /* close_pressed.png - 458 bytes */
709 static const unsigned char close_pressed_png[] = {
710 0x89, 0x50, 0x4e, 0x47, 0x0d, 0x0a, 0x1a, 0x0a,
711 0x00, 0x00, 0x00, 0x0d, 0x49, 0x48, 0x44, 0x52,
712 0x00, 0x00, 0x00, 0x0e, 0x00, 0x00, 0x00, 0x0e,
713 0x08, 0x06, 0x00, 0x00, 0x00, 0x1f, 0x48, 0x2d,
714 0xd1, 0x00, 0x00, 0x00, 0x06, 0x62, 0x4b, 0x47,
715 0x44, 0x00, 0xff, 0x00, 0xff, 0x00, 0xff, 0xa0,
716 0xbd, 0xa7, 0x93, 0x00, 0x00, 0x00, 0x09, 0x70,
717 0x48, 0x59, 0x73, 0x00, 0x00, 0x0b, 0x12, 0x00,
718 0x00, 0x0b, 0x12, 0x01, 0xd2, 0xdd, 0x7e, 0xfc,
719 0x00, 0x00, 0x00, 0x09, 0x76, 0x70, 0x41, 0x67,
720 0x00, 0x00, 0x00, 0x0e, 0x00, 0x00, 0x00, 0x0e,
721 0x00, 0xb1, 0x5b, 0xf1, 0xf7, 0x00, 0x00, 0x01,
722 0x29, 0x49, 0x44, 0x41, 0x54, 0x28, 0xcf, 0x9d,
723 0x92, 0x31, 0x6a, 0xc3, 0x40, 0x14, 0x44, 0x9f,
724 0x2c, 0xe1, 0xc2, 0x10, 0x08, 0xc4, 0xe0, 0x22,
725 0x76, 0x21, 0x04, 0x29, 0x13, 0xf0, 0x05, 0x54,
726 0xa5, 0x8a, 0x0f, 0xb2, 0x8d, 0x0e, 0xa0, 0x23,
727 0xa8, 0x56, 0xa3, 0x03, 0xe8, 0x08, 0xba, 0x80,
728 0xba, 0xb0, 0x45, 0x0a, 0x97, 0x02, 0x23, 0x58,
729 0x83, 0x40, 0x60, 0x61, 0x08, 0x11, 0x04, 0x57,
730 0x69, 0xf6, 0xc3, 0x46, 0x38, 0x24, 0x64, 0xca,
731 0xd9, 0x19, 0xe6, 0xff, 0xfd, 0xe3, 0xf1, 0x1d,
732 0x2b, 0x20, 0x02, 0x36, 0xc0, 0xd2, 0x72, 0x27,
733 0xe0, 0x08, 0x1c, 0x80, 0x5e, 0x84, 0x9e, 0x63,
734 0x7a, 0x04, 0xb6, 0xc0, 0x1d, 0xd7, 0x31, 0x00,
735 0x6f, 0xc0, 0x1e, 0xc0, 0x77, 0x4c, 0x31, 0x70,
736 0xc3, 0xcf, 0x58, 0xd8, 0x49, 0x3e, 0x81, 0x7e,
737 0x66, 0xc7, 0xdb, 0x02, 0x73, 0x80, 0xdd, 0x6e,
738 0xb7, 0x9a, 0x3a, 0x1c, 0x6e, 0x6e, 0xb5, 0x2b,
739 0x1f, 0x78, 0x02, 0x1e, 0x44, 0x90, 0x65, 0xd9,
740 0x8b, 0xef, 0xfb, 0xef, 0x5a, 0xeb, 0x33, 0x40,
741 0x92, 0x24, 0x51, 0x9a, 0xa6, 0xcf, 0xc6, 0x98,
742 0xae, 0x69, 0x9a, 0xd1, 0x26, 0x8f, 0x81, 0x8d,
743 0x07, 0xa0, 0xaa, 0xaa, 0x3e, 0x0c, 0xc3, 0x5a,
744 0x29, 0x15, 0x0b, 0xa7, 0x94, 0x8a, 0x8b, 0xa2,
745 0xa8, 0xab, 0xaa, 0xea, 0x9d, 0x21, 0x36, 0x81,
746 0xf3, 0x7b, 0x00, 0xe4, 0x79, 0x7e, 0x10, 0x03,
747 0x40, 0x51, 0x14, 0xb5, 0x70, 0x0e, 0x96, 0x33,
748 0xfe, 0x89, 0xc0, 0xde, 0x69, 0x2d, 0x44, 0x92,
749 0x24, 0x91, 0x8c, 0xe7, 0x26, 0x4f, 0x52, 0x4f,
750 0x81, 0x3d, 0xee, 0x5a, 0x3e, 0x47, 0x4c, 0xae,
751 0x50, 0x29, 0x15, 0xb7, 0x6d, 0xfb, 0xe1, 0xec,
752 0x79, 0xf4, 0x81, 0x0b, 0x70, 0x0f, 0x2c, 0x9a,
753 0xa6, 0x19, 0x8d, 0x31, 0x5d, 0x59, 0x96, 0x47,
754 0x31, 0x69, 0xad, 0xcf, 0xc6, 0x98, 0xce, 0x31,
755 0x0d, 0x80, 0x96, 0xe6, 0x48, 0x01, 0xe6, 0xbf,
756 0xac, 0x76, 0x01, 0x6a, 0x60, 0x2f, 0xcd, 0xe9,
757 0x6d, 0x23, 0x6e, 0xed, 0x9d, 0xae, 0x61, 0x00,
758 0x5e, 0xb1, 0x95, 0xf3, 0x26, 0x8f, 0x7f, 0x2e,
759 0xf9, 0x17, 0x50, 0x59, 0x74, 0x13, 0x34, 0x41,
760 0x04, 0x5a, 0x00, 0x00, 0x00, 0x20, 0x7a, 0x54,
761 0x58, 0x74, 0x74, 0x69, 0x66, 0x66, 0x3a, 0x72,
762 0x6f, 0x77, 0x73, 0x2d, 0x70, 0x65, 0x72, 0x2d,
763 0x73, 0x74, 0x72, 0x69, 0x70, 0x00, 0x00, 0x78,
764 0xda, 0x33, 0xb5, 0x30, 0x05, 0x00, 0x01, 0x47,
765 0x00, 0xa3, 0x38, 0xda, 0x77, 0x3b, 0x00, 0x00,
766 0x00, 0x00, 0x49, 0x45, 0x4e, 0x44, 0xae, 0x42,
767 0x60, 0x82};
768
769 // currently we only support the close bitmap here
770 if ( button != wxTITLEBAR_BUTTON_CLOSE )
771 {
772 m_rendererNative.DrawTitleBarBitmap(win, dc, rect, button, flags);
773 return;
774 }
775
776 // choose the correct image depending on flags
777 const void *data;
778 size_t len;
779
780 if ( flags & wxCONTROL_PRESSED )
781 {
782 data = close_pressed_png;
783 len = WXSIZEOF(close_pressed_png);
784 }
785 else if ( flags & wxCONTROL_CURRENT )
786 {
787 data = close_current_png;
788 len = WXSIZEOF(close_current_png);
789 }
790 else
791 {
792 data = close_png;
793 len = WXSIZEOF(close_png);
794 }
795
796 // load it
797 wxMemoryInputStream mis(data, len);
798 wxImage image(mis, wxBITMAP_TYPE_PNG);
799 wxBitmap bmp(image);
800 wxASSERT_MSG( bmp.IsOk(), "failed to load embedded PNG image?" );
801
802 // and draw it centering it in the provided rectangle: we don't scale the
803 // image because this is really not going to look good for such a small
804 // (14*14) bitmap
805 dc.DrawBitmap(bmp, wxRect(bmp.GetSize()).CenterIn(rect).GetPosition());
806}
807
808#endif // wxHAS_DRAW_TITLE_BAR_BITMAP