1 ///////////////////////////////////////////////////////////////////////////////
2 // Name: src/osx/carbon/renderer.cpp
3 // Purpose: implementation of wxRendererNative for Mac
4 // Author: Vadim Zeitlin
8 // Copyright: (c) 2003 Vadim Zeitlin <vadim@wxwindows.org>
9 // Licence: wxWindows licence
10 ///////////////////////////////////////////////////////////////////////////////
12 // for compilers that support precompilation, includes "wx.h".
13 #include "wx/wxprec.h"
15 #if wxOSX_USE_COCOA_OR_CARBON
22 #include "wx/string.h"
24 #include "wx/bitmap.h"
25 #include "wx/settings.h"
26 #include "wx/dcclient.h"
27 #include "wx/dcmemory.h"
28 #include "wx/toplevel.h"
31 #include "wx/renderer.h"
32 #include "wx/graphics.h"
33 #include "wx/dcgraph.h"
34 #include "wx/osx/private.h"
36 #ifdef wxHAS_DRAW_TITLE_BAR_BITMAP
38 #include "wx/mstream.h"
39 #endif // wxHAS_DRAW_TITLE_BAR_BITMAP
42 // check if we're having a CGContext we can draw into
43 inline bool wxHasCGContext(wxWindow
* WXUNUSED(win
), wxDC
& dc
)
45 wxGCDCImpl
* gcdc
= wxDynamicCast( dc
.GetImpl() , wxGCDCImpl
);
49 if ( gcdc
->GetGraphicsContext()->GetNativeContext() )
57 class WXDLLEXPORT wxRendererMac
: public wxDelegateRendererNative
60 // draw the header control button (used by wxListCtrl)
61 virtual int DrawHeaderButton( wxWindow
*win
,
65 wxHeaderSortIconType sortArrow
= wxHDR_SORT_ICON_NONE
,
66 wxHeaderButtonParams
* params
= NULL
);
68 virtual int GetHeaderButtonHeight(wxWindow
*win
);
70 virtual int GetHeaderButtonMargin(wxWindow
*win
);
72 // draw the expanded/collapsed icon for a tree control item
73 virtual void DrawTreeItemButton( wxWindow
*win
,
78 // draw a (vertical) sash
79 virtual void DrawSplitterSash( wxWindow
*win
,
86 virtual void DrawCheckBox(wxWindow
*win
,
91 virtual wxSize
GetCheckBoxSize(wxWindow
* win
);
93 virtual void DrawComboBoxDropButton(wxWindow
*win
,
98 virtual void DrawPushButton(wxWindow
*win
,
103 virtual void DrawItemSelectionRect(wxWindow
*win
,
108 virtual void DrawFocusRect(wxWindow
* win
, wxDC
& dc
, const wxRect
& rect
, int flags
= 0);
110 virtual void DrawChoice(wxWindow
* win
, wxDC
& dc
, const wxRect
& rect
, int flags
=0);
112 virtual void DrawComboBox(wxWindow
* win
, wxDC
& dc
, const wxRect
& rect
, int flags
=0);
114 virtual void DrawTextCtrl(wxWindow
* win
, wxDC
& dc
, const wxRect
& rect
, int flags
=0);
116 virtual void DrawRadioBitmap(wxWindow
* win
, wxDC
& dc
, const wxRect
& rect
, int flags
=0);
118 #ifdef wxHAS_DRAW_TITLE_BAR_BITMAP
119 virtual void DrawTitleBarBitmap(wxWindow
*win
,
122 wxTitleBarButton button
,
124 #endif // wxHAS_DRAW_TITLE_BAR_BITMAP
127 void DrawMacThemeButton(wxWindow
*win
,
135 wxBitmap m_bmpTreeExpanded
;
136 wxBitmap m_bmpTreeCollapsed
;
139 // ============================================================================
141 // ============================================================================
144 wxRendererNative
& wxRendererNative::GetDefault()
146 static wxRendererMac s_rendererMac
;
148 return s_rendererMac
;
151 int wxRendererMac::DrawHeaderButton( wxWindow
*win
,
155 wxHeaderSortIconType sortArrow
,
156 wxHeaderButtonParams
* params
)
158 const wxCoord x
= rect
.x
;
159 const wxCoord y
= rect
.y
;
160 const wxCoord w
= rect
.width
;
161 const wxCoord h
= rect
.height
;
163 dc
.SetBrush( *wxTRANSPARENT_BRUSH
);
165 HIRect headerRect
= CGRectMake( x
, y
, w
, h
);
166 if ( !wxHasCGContext(win
, dc
) )
168 win
->Refresh( &rect
);
172 CGContextRef cgContext
;
173 wxGCDCImpl
*impl
= (wxGCDCImpl
*) dc
.GetImpl();
175 cgContext
= (CGContextRef
) impl
->GetGraphicsContext()->GetNativeContext();
178 HIThemeButtonDrawInfo drawInfo
;
181 memset( &drawInfo
, 0, sizeof(drawInfo
) );
182 drawInfo
.version
= 0;
183 drawInfo
.kind
= kThemeListHeaderButton
;
184 drawInfo
.state
= (flags
& wxCONTROL_DISABLED
) ? kThemeStateInactive
: kThemeStateActive
;
185 drawInfo
.value
= (flags
& wxCONTROL_SELECTED
) ? kThemeButtonOn
: kThemeButtonOff
;
186 drawInfo
.adornment
= kThemeAdornmentNone
;
188 // The down arrow is drawn automatically, change it to an up arrow if needed.
189 if ( sortArrow
== wxHDR_SORT_ICON_UP
)
190 drawInfo
.adornment
= kThemeAdornmentHeaderButtonSortUp
;
192 HIThemeDrawButton( &headerRect
, &drawInfo
, cgContext
, kHIThemeOrientationNormal
, &labelRect
);
194 // If we don't want any arrows we need to draw over the one already there
195 if ( (flags
& wxCONTROL_SELECTED
) && (sortArrow
== wxHDR_SORT_ICON_NONE
) )
197 // clip to the header rectangle
198 CGContextSaveGState( cgContext
);
199 CGContextClipToRect( cgContext
, headerRect
);
200 // but draw bigger than that so the arrow will get clipped off
201 headerRect
.size
.width
+= 25;
202 HIThemeDrawButton( &headerRect
, &drawInfo
, cgContext
, kHIThemeOrientationNormal
, &labelRect
);
203 CGContextRestoreGState( cgContext
);
208 // Reserve room for the arrows before writing the label, and turn off the
209 // flags we've already handled
210 wxRect
newRect(rect
);
211 if ( (flags
& wxCONTROL_SELECTED
) && (sortArrow
!= wxHDR_SORT_ICON_NONE
) )
214 sortArrow
= wxHDR_SORT_ICON_NONE
;
216 flags
&= ~wxCONTROL_SELECTED
;
218 return DrawHeaderButtonContents(win
, dc
, newRect
, flags
, sortArrow
, params
);
222 int wxRendererMac::GetHeaderButtonHeight(wxWindow
* WXUNUSED(win
))
224 SInt32 standardHeight
;
227 errStatus
= GetThemeMetric( kThemeMetricListHeaderHeight
, &standardHeight
);
228 if (errStatus
== noErr
)
230 return standardHeight
;
235 int wxRendererMac::GetHeaderButtonMargin(wxWindow
*WXUNUSED(win
))
237 wxFAIL_MSG( "GetHeaderButtonMargin() not implemented" );
241 void wxRendererMac::DrawTreeItemButton( wxWindow
*win
,
246 // now the wxGCDC is using native transformations
247 const wxCoord x
= rect
.x
;
248 const wxCoord y
= rect
.y
;
249 const wxCoord w
= rect
.width
;
250 const wxCoord h
= rect
.height
;
252 dc
.SetBrush( *wxTRANSPARENT_BRUSH
);
254 HIRect headerRect
= CGRectMake( x
, y
, w
, h
);
255 if ( !wxHasCGContext(win
, dc
) )
257 win
->Refresh( &rect
);
261 CGContextRef cgContext
;
263 wxGCDCImpl
*impl
= (wxGCDCImpl
*) dc
.GetImpl();
264 cgContext
= (CGContextRef
) impl
->GetGraphicsContext()->GetNativeContext();
266 HIThemeButtonDrawInfo drawInfo
;
269 memset( &drawInfo
, 0, sizeof(drawInfo
) );
270 drawInfo
.version
= 0;
271 drawInfo
.kind
= kThemeDisclosureButton
;
272 drawInfo
.state
= (flags
& wxCONTROL_DISABLED
) ? kThemeStateInactive
: kThemeStateActive
;
273 // Apple mailing list posts say to use the arrow adornment constants, but those don't work.
274 // We need to set the value using the 'old' DrawThemeButton constants instead.
275 drawInfo
.value
= (flags
& wxCONTROL_EXPANDED
) ? kThemeDisclosureDown
: kThemeDisclosureRight
;
276 drawInfo
.adornment
= kThemeAdornmentNone
;
278 HIThemeDrawButton( &headerRect
, &drawInfo
, cgContext
, kHIThemeOrientationNormal
, &labelRect
);
282 void wxRendererMac::DrawSplitterSash( wxWindow
*win
,
286 wxOrientation orient
,
287 int WXUNUSED(flags
) )
289 bool hasMetal
= win
->MacGetTopLevelWindow()->GetExtraStyle() & wxFRAME_EX_METAL
;
291 GetThemeMetric( kThemeMetricSmallPaneSplitterHeight
, &height
);
293 if (orient
== wxVERTICAL
)
294 splitterRect
= CGRectMake( position
, 0, height
, size
.y
);
296 splitterRect
= CGRectMake( 0, position
, size
.x
, height
);
298 // under compositing we should only draw when called by the OS, otherwise just issue a redraw command
299 // strange redraw errors occur if we don't do this
301 if ( !wxHasCGContext(win
, dc
) )
303 wxRect
rect( (int) splitterRect
.origin
.x
, (int) splitterRect
.origin
.y
, (int) splitterRect
.size
.width
,
304 (int) splitterRect
.size
.height
);
305 win
->RefreshRect( rect
);
309 CGContextRef cgContext
;
310 wxGCDCImpl
*impl
= (wxGCDCImpl
*) dc
.GetImpl();
311 cgContext
= (CGContextRef
) impl
->GetGraphicsContext()->GetNativeContext();
313 HIThemeBackgroundDrawInfo bgdrawInfo
;
314 bgdrawInfo
.version
= 0;
315 bgdrawInfo
.state
= kThemeStateActive
;
316 bgdrawInfo
.kind
= hasMetal
? kThemeBackgroundMetal
: kThemeBackgroundPlacard
;
319 HIThemeDrawBackground(&splitterRect
, &bgdrawInfo
, cgContext
, kHIThemeOrientationNormal
);
322 CGContextSetFillColorWithColor(cgContext
,win
->GetBackgroundColour().GetCGColor());
323 CGContextFillRect(cgContext
,splitterRect
);
326 HIThemeSplitterDrawInfo drawInfo
;
327 drawInfo
.version
= 0;
328 drawInfo
.state
= kThemeStateActive
;
329 drawInfo
.adornment
= hasMetal
? kHIThemeSplitterAdornmentMetal
: kHIThemeSplitterAdornmentNone
;
330 HIThemeDrawPaneSplitter( &splitterRect
, &drawInfo
, cgContext
, kHIThemeOrientationNormal
);
335 wxRendererMac::DrawItemSelectionRect(wxWindow
* WXUNUSED(win
),
340 if ( !(flags
& wxCONTROL_SELECTED
) )
343 wxColour
col( wxMacCreateCGColorFromHITheme( (flags
& wxCONTROL_FOCUSED
) ?
344 kThemeBrushAlternatePrimaryHighlightColor
345 : kThemeBrushSecondaryHighlightColor
) );
346 wxBrush
selBrush( col
);
348 dc
.SetPen( *wxTRANSPARENT_PEN
);
349 dc
.SetBrush( selBrush
);
350 dc
.DrawRectangle( rect
);
355 wxRendererMac::DrawMacThemeButton(wxWindow
*win
,
362 // now the wxGCDC is using native transformations
363 const wxCoord x
= rect
.x
;
364 const wxCoord y
= rect
.y
;
365 const wxCoord w
= rect
.width
;
366 const wxCoord h
= rect
.height
;
368 dc
.SetBrush( *wxTRANSPARENT_BRUSH
);
370 HIRect headerRect
= CGRectMake( x
, y
, w
, h
);
371 if ( !wxHasCGContext(win
, dc
) )
373 win
->Refresh( &rect
);
377 wxGCDCImpl
*impl
= (wxGCDCImpl
*) dc
.GetImpl();
378 CGContextRef cgContext
;
379 cgContext
= (CGContextRef
) impl
->GetGraphicsContext()->GetNativeContext();
381 HIThemeButtonDrawInfo drawInfo
;
384 memset( &drawInfo
, 0, sizeof(drawInfo
) );
385 drawInfo
.version
= 0;
386 drawInfo
.kind
= kind
;
387 drawInfo
.state
= (flags
& wxCONTROL_DISABLED
) ? kThemeStateInactive
: kThemeStateActive
;
388 drawInfo
.value
= (flags
& wxCONTROL_SELECTED
) ? kThemeButtonOn
: kThemeButtonOff
;
389 if (flags
& wxCONTROL_UNDETERMINED
)
390 drawInfo
.value
= kThemeButtonMixed
;
391 drawInfo
.adornment
= adornment
;
392 if (flags
& wxCONTROL_FOCUSED
)
393 drawInfo
.adornment
|= kThemeAdornmentFocus
;
395 HIThemeDrawButton( &headerRect
, &drawInfo
, cgContext
, kHIThemeOrientationNormal
, &labelRect
);
400 wxRendererMac::DrawCheckBox(wxWindow
*win
,
405 if (flags
& wxCONTROL_CHECKED
)
406 flags
|= wxCONTROL_SELECTED
;
410 if (win
->GetWindowVariant() == wxWINDOW_VARIANT_SMALL
||
411 (win
->GetParent() && win
->GetParent()->GetWindowVariant() == wxWINDOW_VARIANT_SMALL
))
412 kind
= kThemeCheckBoxSmall
;
413 else if (win
->GetWindowVariant() == wxWINDOW_VARIANT_MINI
||
414 (win
->GetParent() && win
->GetParent()->GetWindowVariant() == wxWINDOW_VARIANT_MINI
))
415 kind
= kThemeCheckBoxMini
;
417 kind
= kThemeCheckBox
;
420 DrawMacThemeButton(win
, dc
, rect
, flags
,
421 kind
, kThemeAdornmentNone
);
424 wxSize
wxRendererMac::GetCheckBoxSize(wxWindow
* WXUNUSED(win
))
427 SInt32 width
, height
;
430 errStatus
= GetThemeMetric(kThemeMetricCheckBoxWidth
, &width
);
431 if (errStatus
== noErr
)
433 size
.SetWidth(width
);
436 errStatus
= GetThemeMetric(kThemeMetricCheckBoxHeight
, &height
);
437 if (errStatus
== noErr
)
439 size
.SetHeight(height
);
446 wxRendererMac::DrawComboBoxDropButton(wxWindow
*win
,
452 if (win
->GetWindowVariant() == wxWINDOW_VARIANT_SMALL
|| (win
->GetParent() && win
->GetParent()->GetWindowVariant() == wxWINDOW_VARIANT_SMALL
))
453 kind
= kThemeArrowButtonSmall
;
454 else if (win
->GetWindowVariant() == wxWINDOW_VARIANT_MINI
|| (win
->GetParent() && win
->GetParent()->GetWindowVariant() == wxWINDOW_VARIANT_MINI
))
455 kind
= kThemeArrowButtonMini
;
457 kind
= kThemeArrowButton
;
459 DrawMacThemeButton(win
, dc
, rect
, flags
,
460 kind
, kThemeAdornmentArrowDownArrow
);
464 wxRendererMac::DrawPushButton(wxWindow
*win
,
470 if (win
->GetWindowVariant() == wxWINDOW_VARIANT_SMALL
|| (win
->GetParent() && win
->GetParent()->GetWindowVariant() == wxWINDOW_VARIANT_SMALL
))
471 kind
= kThemeBevelButtonSmall
;
472 // There is no kThemeBevelButtonMini, but in this case, use Small
473 else if (win
->GetWindowVariant() == wxWINDOW_VARIANT_MINI
|| (win
->GetParent() && win
->GetParent()->GetWindowVariant() == wxWINDOW_VARIANT_MINI
))
474 kind
= kThemeBevelButtonSmall
;
476 kind
= kThemeBevelButton
;
478 DrawMacThemeButton(win
, dc
, rect
, flags
,
479 kind
, kThemeAdornmentNone
);
483 wxRendererMac::DrawFocusRect(wxWindow
* win
, wxDC
& dc
, const wxRect
& rect
, int flags
)
487 wxDelegateRendererNative::DrawFocusRect(win
, dc
, rect
, flags
);
491 CGRect cgrect
= CGRectMake( rect
.x
, rect
.y
, rect
.width
, rect
.height
) ;
493 HIThemeFrameDrawInfo info
;
495 memset( &info
, 0 , sizeof(info
) ) ;
499 info
.state
= kThemeStateActive
;
500 info
.isFocused
= true ;
502 CGContextRef cgContext
= (CGContextRef
) win
->MacGetCGContextRef() ;
503 wxASSERT( cgContext
) ;
505 HIThemeDrawFocusRect( &cgrect
, true , cgContext
, kHIThemeOrientationNormal
) ;
508 void wxRendererMac::DrawChoice(wxWindow
* win
, wxDC
& dc
,
509 const wxRect
& rect
, int flags
)
513 if (win
->GetWindowVariant() == wxWINDOW_VARIANT_SMALL
||
514 (win
->GetParent() && win
->GetParent()->GetWindowVariant() == wxWINDOW_VARIANT_SMALL
))
515 kind
= kThemePopupButtonSmall
;
516 else if (win
->GetWindowVariant() == wxWINDOW_VARIANT_MINI
||
517 (win
->GetParent() && win
->GetParent()->GetWindowVariant() == wxWINDOW_VARIANT_MINI
))
518 kind
= kThemePopupButtonMini
;
520 kind
= kThemePopupButton
;
522 DrawMacThemeButton(win
, dc
, rect
, flags
, kind
, kThemeAdornmentNone
);
526 void wxRendererMac::DrawComboBox(wxWindow
* win
, wxDC
& dc
,
527 const wxRect
& rect
, int flags
)
531 if (win
->GetWindowVariant() == wxWINDOW_VARIANT_SMALL
||
532 (win
->GetParent() && win
->GetParent()->GetWindowVariant() == wxWINDOW_VARIANT_SMALL
))
533 kind
= kThemeComboBoxSmall
;
534 else if (win
->GetWindowVariant() == wxWINDOW_VARIANT_MINI
||
535 (win
->GetParent() && win
->GetParent()->GetWindowVariant() == wxWINDOW_VARIANT_MINI
))
536 kind
= kThemeComboBoxMini
;
538 kind
= kThemeComboBox
;
540 DrawMacThemeButton(win
, dc
, rect
, flags
, kind
, kThemeAdornmentNone
);
543 void wxRendererMac::DrawRadioBitmap(wxWindow
* win
, wxDC
& dc
,
544 const wxRect
& rect
, int flags
)
548 if (win
->GetWindowVariant() == wxWINDOW_VARIANT_SMALL
||
549 (win
->GetParent() && win
->GetParent()->GetWindowVariant() == wxWINDOW_VARIANT_SMALL
))
550 kind
= kThemeRadioButtonSmall
;
551 else if (win
->GetWindowVariant() == wxWINDOW_VARIANT_MINI
||
552 (win
->GetParent() && win
->GetParent()->GetWindowVariant() == wxWINDOW_VARIANT_MINI
))
553 kind
= kThemeRadioButtonMini
;
555 kind
= kThemeRadioButton
;
557 if (flags
& wxCONTROL_CHECKED
)
558 flags
|= wxCONTROL_SELECTED
;
560 DrawMacThemeButton(win
, dc
, rect
, flags
,
561 kind
, kThemeAdornmentNone
);
564 void wxRendererMac::DrawTextCtrl(wxWindow
* win
, wxDC
& dc
,
565 const wxRect
& rect
, int flags
)
567 const wxCoord x
= rect
.x
;
568 const wxCoord y
= rect
.y
;
569 const wxCoord w
= rect
.width
;
570 const wxCoord h
= rect
.height
;
572 dc
.SetBrush( *wxWHITE_BRUSH
);
573 dc
.SetPen( *wxTRANSPARENT_PEN
);
574 dc
.DrawRectangle(rect
);
576 dc
.SetBrush( *wxTRANSPARENT_BRUSH
);
578 HIRect hiRect
= CGRectMake( x
, y
, w
, h
);
579 if ( !wxHasCGContext(win
, dc
) )
581 win
->Refresh( &rect
);
585 CGContextRef cgContext
;
587 cgContext
= (CGContextRef
) static_cast<wxGCDCImpl
*>(dc
.GetImpl())->GetGraphicsContext()->GetNativeContext();
590 HIThemeFrameDrawInfo drawInfo
;
592 memset( &drawInfo
, 0, sizeof(drawInfo
) );
593 drawInfo
.version
= 0;
594 drawInfo
.kind
= kHIThemeFrameTextFieldSquare
;
595 drawInfo
.state
= (flags
& wxCONTROL_DISABLED
) ? kThemeStateInactive
: kThemeStateActive
;
596 if (flags
& wxCONTROL_FOCUSED
)
597 drawInfo
.isFocused
= true;
599 HIThemeDrawFrame( &hiRect
, &drawInfo
, cgContext
, kHIThemeOrientationNormal
);
604 #ifdef wxHAS_DRAW_TITLE_BAR_BITMAP
606 void wxRendererMac::DrawTitleBarBitmap(wxWindow
*win
,
609 wxTitleBarButton button
,
612 // the files below were converted from the originals in art/osx/close*.png
613 // using misc/scripts/png2c.py script -- we must use PNG and not XPM for
614 // them because they use transparency and don't look right without it
616 /* close.png - 400 bytes */
617 static const unsigned char close_png
[] = {
618 0x89, 0x50, 0x4e, 0x47, 0x0d, 0x0a, 0x1a, 0x0a,
619 0x00, 0x00, 0x00, 0x0d, 0x49, 0x48, 0x44, 0x52,
620 0x00, 0x00, 0x00, 0x0e, 0x00, 0x00, 0x00, 0x0e,
621 0x08, 0x06, 0x00, 0x00, 0x00, 0x1f, 0x48, 0x2d,
622 0xd1, 0x00, 0x00, 0x00, 0x06, 0x62, 0x4b, 0x47,
623 0x44, 0x00, 0xff, 0x00, 0xff, 0x00, 0xff, 0xa0,
624 0xbd, 0xa7, 0x93, 0x00, 0x00, 0x00, 0x09, 0x70,
625 0x48, 0x59, 0x73, 0x00, 0x00, 0x0b, 0x12, 0x00,
626 0x00, 0x0b, 0x12, 0x01, 0xd2, 0xdd, 0x7e, 0xfc,
627 0x00, 0x00, 0x00, 0x09, 0x76, 0x70, 0x41, 0x67,
628 0x00, 0x00, 0x00, 0x0e, 0x00, 0x00, 0x00, 0x0e,
629 0x00, 0xb1, 0x5b, 0xf1, 0xf7, 0x00, 0x00, 0x00,
630 0xef, 0x49, 0x44, 0x41, 0x54, 0x28, 0xcf, 0xa5,
631 0xd2, 0x31, 0x4a, 0x03, 0x41, 0x18, 0xc5, 0xf1,
632 0xdf, 0xc6, 0x55, 0x02, 0xb2, 0x18, 0xb0, 0x33,
633 0x8d, 0xd8, 0x6e, 0x8a, 0x14, 0xa6, 0xb2, 0xc9,
634 0x21, 0x72, 0x0b, 0xdb, 0x5c, 0x45, 0x98, 0x3b,
635 0x24, 0xc7, 0x99, 0x6d, 0x2d, 0x04, 0xd3, 0x09,
636 0x42, 0x48, 0x65, 0x60, 0x6c, 0x76, 0x65, 0x1c,
637 0x14, 0x45, 0x5f, 0x35, 0xfc, 0xe7, 0x3d, 0xe6,
638 0x9b, 0x8f, 0x57, 0xf9, 0xac, 0x06, 0x97, 0x98,
639 0xe0, 0xbc, 0x67, 0x07, 0xbc, 0xe2, 0x05, 0xfb,
640 0xc1, 0x58, 0x65, 0xa1, 0x2b, 0x4c, 0xb3, 0x40,
641 0xa9, 0x03, 0x9e, 0xb1, 0x83, 0x93, 0x2c, 0x74,
642 0x83, 0xb1, 0xef, 0x75, 0x86, 0x0b, 0x1c, 0xb1,
643 0x1f, 0xf5, 0xe3, 0x4d, 0x51, 0x43, 0x08, 0xe1,
644 0xb6, 0x4c, 0x64, 0xac, 0xee, 0xbd, 0x0d, 0x5c,
645 0x63, 0x89, 0x65, 0x08, 0x61, 0x9d, 0x52, 0x4a,
646 0x31, 0xc6, 0xcd, 0xc0, 0x62, 0x8c, 0x9b, 0x94,
647 0x52, 0x0a, 0x21, 0xac, 0x07, 0xd6, 0x67, 0xcc,
648 0x33, 0xf0, 0x61, 0x8c, 0x31, 0x6e, 0xf2, 0x73,
649 0xee, 0xc1, 0xbc, 0xc2, 0x1d, 0x4e, 0xf3, 0xd1,
650 0x62, 0x8c, 0xf7, 0x6d, 0xdb, 0xae, 0xa0, 0xeb,
651 0xba, 0xed, 0x6c, 0x36, 0x7b, 0x28, 0xa6, 0x7f,
652 0x1b, 0xf9, 0xa3, 0xea, 0x7e, 0xcd, 0x93, 0xf2,
653 0xb5, 0xae, 0xeb, 0xb6, 0xd0, 0xb6, 0xed, 0x2a,
654 0xc6, 0xa8, 0x78, 0xf5, 0xf0, 0xaf, 0xe5, 0x34,
655 0x58, 0xe4, 0xe1, 0x62, 0x11, 0x25, 0x5b, 0xa0,
656 0x19, 0x9a, 0x33, 0x14, 0xa0, 0xfe, 0xe1, 0x6b,
657 0x47, 0x3c, 0x62, 0x37, 0x34, 0x67, 0xdf, 0xc3,
658 0x71, 0xdf, 0x90, 0xaf, 0x74, 0xc0, 0x93, 0xbe,
659 0x72, 0x55, 0x71, 0xf9, 0xeb, 0x92, 0xbf, 0x03,
660 0x70, 0x33, 0x76, 0x58, 0xe5, 0x41, 0xfb, 0x6d,
661 0x00, 0x00, 0x00, 0x20, 0x7a, 0x54, 0x58, 0x74,
662 0x74, 0x69, 0x66, 0x66, 0x3a, 0x72, 0x6f, 0x77,
663 0x73, 0x2d, 0x70, 0x65, 0x72, 0x2d, 0x73, 0x74,
664 0x72, 0x69, 0x70, 0x00, 0x00, 0x78, 0xda, 0x33,
665 0xb5, 0x30, 0x05, 0x00, 0x01, 0x47, 0x00, 0xa3,
666 0x38, 0xda, 0x77, 0x3b, 0x00, 0x00, 0x00, 0x00,
667 0x49, 0x45, 0x4e, 0x44, 0xae, 0x42, 0x60, 0x82
670 /* close_current.png - 421 bytes */
671 static const unsigned char close_current_png
[] = {
672 0x89, 0x50, 0x4e, 0x47, 0x0d, 0x0a, 0x1a, 0x0a,
673 0x00, 0x00, 0x00, 0x0d, 0x49, 0x48, 0x44, 0x52,
674 0x00, 0x00, 0x00, 0x0e, 0x00, 0x00, 0x00, 0x0e,
675 0x08, 0x06, 0x00, 0x00, 0x00, 0x1f, 0x48, 0x2d,
676 0xd1, 0x00, 0x00, 0x00, 0x06, 0x62, 0x4b, 0x47,
677 0x44, 0x00, 0xff, 0x00, 0xff, 0x00, 0xff, 0xa0,
678 0xbd, 0xa7, 0x93, 0x00, 0x00, 0x00, 0x09, 0x70,
679 0x48, 0x59, 0x73, 0x00, 0x00, 0x0b, 0x12, 0x00,
680 0x00, 0x0b, 0x12, 0x01, 0xd2, 0xdd, 0x7e, 0xfc,
681 0x00, 0x00, 0x00, 0x09, 0x76, 0x70, 0x41, 0x67,
682 0x00, 0x00, 0x00, 0x0e, 0x00, 0x00, 0x00, 0x0e,
683 0x00, 0xb1, 0x5b, 0xf1, 0xf7, 0x00, 0x00, 0x01,
684 0x04, 0x49, 0x44, 0x41, 0x54, 0x28, 0xcf, 0x9d,
685 0xd2, 0xbd, 0x4a, 0x43, 0x31, 0x00, 0xc5, 0xf1,
686 0xdf, 0x8d, 0x56, 0x44, 0x04, 0x45, 0xd0, 0xc5,
687 0x55, 0xdc, 0x0a, 0x8e, 0xed, 0xec, 0xe4, 0xec,
688 0x24, 0xd4, 0x67, 0x29, 0x59, 0xfa, 0x16, 0x9d,
689 0x7c, 0x07, 0x1d, 0x5c, 0xba, 0xa5, 0xa3, 0x28,
690 0x22, 0x94, 0xae, 0x2e, 0x1d, 0x4a, 0x5d, 0x55,
691 0xb8, 0x2e, 0x09, 0x5c, 0x4b, 0xfd, 0xa0, 0x67,
692 0x0a, 0x27, 0x39, 0xc9, 0x49, 0xf2, 0xaf, 0x7c,
693 0xd7, 0x01, 0x8e, 0x71, 0x84, 0xfd, 0xec, 0x2d,
694 0x30, 0xc3, 0x2b, 0xe6, 0x65, 0x61, 0xd5, 0x08,
695 0x9d, 0xe0, 0x14, 0x7b, 0x56, 0xeb, 0x0d, 0x13,
696 0x4c, 0x61, 0xa3, 0x11, 0x3a, 0xc3, 0x8e, 0x9f,
697 0xb5, 0x9d, 0x9b, 0xbc, 0x63, 0x1e, 0x72, 0xbd,
698 0x53, 0xb4, 0x20, 0xc6, 0xd8, 0x5e, 0x4e, 0x34,
699 0xbc, 0x56, 0x5e, 0x7b, 0x00, 0x6d, 0x5c, 0xe1,
700 0x2a, 0xc6, 0x38, 0xa8, 0xeb, 0xba, 0x4e, 0x29,
701 0xdd, 0x16, 0x2f, 0xa5, 0x74, 0x5b, 0xd7, 0x75,
702 0x1d, 0x63, 0x1c, 0x14, 0x0f, 0xed, 0x0a, 0xe7,
703 0xb9, 0x02, 0x48, 0x29, 0x5d, 0x77, 0x3a, 0x9d,
704 0x8b, 0xf1, 0x78, 0x7c, 0x07, 0x65, 0xdc, 0xed,
705 0x76, 0x6f, 0x1a, 0x25, 0x66, 0x15, 0x2e, 0xb1,
706 0xd5, 0xac, 0x56, 0xc2, 0xb0, 0x22, 0x04, 0xef,
707 0xc1, 0x9a, 0xda, 0xcc, 0xff, 0xf4, 0x6b, 0xd5,
708 0x94, 0x92, 0xa5, 0x53, 0x17, 0x6b, 0x3f, 0xce,
709 0x06, 0x3e, 0x71, 0x88, 0xed, 0xd1, 0x68, 0x34,
710 0x0b, 0x21, 0x4c, 0x7a, 0xbd, 0xde, 0x7d, 0xd9,
711 0x7a, 0x38, 0x1c, 0x3e, 0x86, 0x10, 0x26, 0xfd,
712 0x7e, 0xff, 0xa9, 0x01, 0xc2, 0x4b, 0x21, 0xa7,
713 0x00, 0xd0, 0xfa, 0xe3, 0x6a, 0x1f, 0x78, 0xc0,
714 0xb4, 0x90, 0x33, 0xcf, 0x44, 0xec, 0x66, 0x42,
715 0x56, 0xe9, 0x0d, 0xcf, 0x32, 0x72, 0xd5, 0xd2,
716 0xe4, 0xbf, 0x21, 0xff, 0x02, 0x4d, 0xb5, 0x74,
717 0x79, 0x60, 0x9f, 0x78, 0x78, 0x00, 0x00, 0x00,
718 0x20, 0x7a, 0x54, 0x58, 0x74, 0x74, 0x69, 0x66,
719 0x66, 0x3a, 0x72, 0x6f, 0x77, 0x73, 0x2d, 0x70,
720 0x65, 0x72, 0x2d, 0x73, 0x74, 0x72, 0x69, 0x70,
721 0x00, 0x00, 0x78, 0xda, 0x33, 0xb5, 0x30, 0x05,
722 0x00, 0x01, 0x47, 0x00, 0xa3, 0x38, 0xda, 0x77,
723 0x3b, 0x00, 0x00, 0x00, 0x00, 0x49, 0x45, 0x4e,
724 0x44, 0xae, 0x42, 0x60, 0x82};
726 /* close_pressed.png - 458 bytes */
727 static const unsigned char close_pressed_png
[] = {
728 0x89, 0x50, 0x4e, 0x47, 0x0d, 0x0a, 0x1a, 0x0a,
729 0x00, 0x00, 0x00, 0x0d, 0x49, 0x48, 0x44, 0x52,
730 0x00, 0x00, 0x00, 0x0e, 0x00, 0x00, 0x00, 0x0e,
731 0x08, 0x06, 0x00, 0x00, 0x00, 0x1f, 0x48, 0x2d,
732 0xd1, 0x00, 0x00, 0x00, 0x06, 0x62, 0x4b, 0x47,
733 0x44, 0x00, 0xff, 0x00, 0xff, 0x00, 0xff, 0xa0,
734 0xbd, 0xa7, 0x93, 0x00, 0x00, 0x00, 0x09, 0x70,
735 0x48, 0x59, 0x73, 0x00, 0x00, 0x0b, 0x12, 0x00,
736 0x00, 0x0b, 0x12, 0x01, 0xd2, 0xdd, 0x7e, 0xfc,
737 0x00, 0x00, 0x00, 0x09, 0x76, 0x70, 0x41, 0x67,
738 0x00, 0x00, 0x00, 0x0e, 0x00, 0x00, 0x00, 0x0e,
739 0x00, 0xb1, 0x5b, 0xf1, 0xf7, 0x00, 0x00, 0x01,
740 0x29, 0x49, 0x44, 0x41, 0x54, 0x28, 0xcf, 0x9d,
741 0x92, 0x31, 0x6a, 0xc3, 0x40, 0x14, 0x44, 0x9f,
742 0x2c, 0xe1, 0xc2, 0x10, 0x08, 0xc4, 0xe0, 0x22,
743 0x76, 0x21, 0x04, 0x29, 0x13, 0xf0, 0x05, 0x54,
744 0xa5, 0x8a, 0x0f, 0xb2, 0x8d, 0x0e, 0xa0, 0x23,
745 0xa8, 0x56, 0xa3, 0x03, 0xe8, 0x08, 0xba, 0x80,
746 0xba, 0xb0, 0x45, 0x0a, 0x97, 0x02, 0x23, 0x58,
747 0x83, 0x40, 0x60, 0x61, 0x08, 0x11, 0x04, 0x57,
748 0x69, 0xf6, 0xc3, 0x46, 0x38, 0x24, 0x64, 0xca,
749 0xd9, 0x19, 0xe6, 0xff, 0xfd, 0xe3, 0xf1, 0x1d,
750 0x2b, 0x20, 0x02, 0x36, 0xc0, 0xd2, 0x72, 0x27,
751 0xe0, 0x08, 0x1c, 0x80, 0x5e, 0x84, 0x9e, 0x63,
752 0x7a, 0x04, 0xb6, 0xc0, 0x1d, 0xd7, 0x31, 0x00,
753 0x6f, 0xc0, 0x1e, 0xc0, 0x77, 0x4c, 0x31, 0x70,
754 0xc3, 0xcf, 0x58, 0xd8, 0x49, 0x3e, 0x81, 0x7e,
755 0x66, 0xc7, 0xdb, 0x02, 0x73, 0x80, 0xdd, 0x6e,
756 0xb7, 0x9a, 0x3a, 0x1c, 0x6e, 0x6e, 0xb5, 0x2b,
757 0x1f, 0x78, 0x02, 0x1e, 0x44, 0x90, 0x65, 0xd9,
758 0x8b, 0xef, 0xfb, 0xef, 0x5a, 0xeb, 0x33, 0x40,
759 0x92, 0x24, 0x51, 0x9a, 0xa6, 0xcf, 0xc6, 0x98,
760 0xae, 0x69, 0x9a, 0xd1, 0x26, 0x8f, 0x81, 0x8d,
761 0x07, 0xa0, 0xaa, 0xaa, 0x3e, 0x0c, 0xc3, 0x5a,
762 0x29, 0x15, 0x0b, 0xa7, 0x94, 0x8a, 0x8b, 0xa2,
763 0xa8, 0xab, 0xaa, 0xea, 0x9d, 0x21, 0x36, 0x81,
764 0xf3, 0x7b, 0x00, 0xe4, 0x79, 0x7e, 0x10, 0x03,
765 0x40, 0x51, 0x14, 0xb5, 0x70, 0x0e, 0x96, 0x33,
766 0xfe, 0x89, 0xc0, 0xde, 0x69, 0x2d, 0x44, 0x92,
767 0x24, 0x91, 0x8c, 0xe7, 0x26, 0x4f, 0x52, 0x4f,
768 0x81, 0x3d, 0xee, 0x5a, 0x3e, 0x47, 0x4c, 0xae,
769 0x50, 0x29, 0x15, 0xb7, 0x6d, 0xfb, 0xe1, 0xec,
770 0x79, 0xf4, 0x81, 0x0b, 0x70, 0x0f, 0x2c, 0x9a,
771 0xa6, 0x19, 0x8d, 0x31, 0x5d, 0x59, 0x96, 0x47,
772 0x31, 0x69, 0xad, 0xcf, 0xc6, 0x98, 0xce, 0x31,
773 0x0d, 0x80, 0x96, 0xe6, 0x48, 0x01, 0xe6, 0xbf,
774 0xac, 0x76, 0x01, 0x6a, 0x60, 0x2f, 0xcd, 0xe9,
775 0x6d, 0x23, 0x6e, 0xed, 0x9d, 0xae, 0x61, 0x00,
776 0x5e, 0xb1, 0x95, 0xf3, 0x26, 0x8f, 0x7f, 0x2e,
777 0xf9, 0x17, 0x50, 0x59, 0x74, 0x13, 0x34, 0x41,
778 0x04, 0x5a, 0x00, 0x00, 0x00, 0x20, 0x7a, 0x54,
779 0x58, 0x74, 0x74, 0x69, 0x66, 0x66, 0x3a, 0x72,
780 0x6f, 0x77, 0x73, 0x2d, 0x70, 0x65, 0x72, 0x2d,
781 0x73, 0x74, 0x72, 0x69, 0x70, 0x00, 0x00, 0x78,
782 0xda, 0x33, 0xb5, 0x30, 0x05, 0x00, 0x01, 0x47,
783 0x00, 0xa3, 0x38, 0xda, 0x77, 0x3b, 0x00, 0x00,
784 0x00, 0x00, 0x49, 0x45, 0x4e, 0x44, 0xae, 0x42,
787 // currently we only support the close bitmap here
788 if ( button
!= wxTITLEBAR_BUTTON_CLOSE
)
790 m_rendererNative
.DrawTitleBarBitmap(win
, dc
, rect
, button
, flags
);
794 // choose the correct image depending on flags
798 if ( flags
& wxCONTROL_PRESSED
)
800 data
= close_pressed_png
;
801 len
= WXSIZEOF(close_pressed_png
);
803 else if ( flags
& wxCONTROL_CURRENT
)
805 data
= close_current_png
;
806 len
= WXSIZEOF(close_current_png
);
811 len
= WXSIZEOF(close_png
);
815 wxMemoryInputStream
mis(data
, len
);
816 wxImage
image(mis
, wxBITMAP_TYPE_PNG
);
818 wxASSERT_MSG( bmp
.IsOk(), "failed to load embedded PNG image?" );
820 // and draw it centering it in the provided rectangle: we don't scale the
821 // image because this is really not going to look good for such a small
823 dc
.DrawBitmap(bmp
, wxRect(bmp
.GetSize()).CenterIn(rect
).GetPosition());
826 #endif // wxHAS_DRAW_TITLE_BAR_BITMAP