1 /////////////////////////////////////////////////////////////////////////////
2 // Name: wx/mac/carbon/private.h
3 // Purpose: Private declarations: as this header is only included by
4 // wxWidgets itself, it may contain identifiers which don't start
6 // Author: Stefan Csomor
10 // Copyright: (c) Stefan Csomor
11 // Licence: wxWindows licence
12 /////////////////////////////////////////////////////////////////////////////
14 #ifndef _WX_PRIVATE_H_
15 #define _WX_PRIVATE_H_
21 # include <Carbon/Carbon.h>
23 # include <Debugging.h>
24 # include <Quickdraw.h>
25 # include <Appearance.h>
27 # include <Controls.h>
28 # include <ControlDefinitions.h>
32 # include <CoreServices.h>
35 #if UNIVERSAL_INTERFACES_VERSION < 0x0342
36 #error "please update to Apple's lastest universal headers from http://developer.apple.com/sdk/"
39 #ifndef MAC_OS_X_VERSION_10_3
40 #define MAC_OS_X_VERSION_10_3 1030
43 #ifndef MAC_OS_X_VERSION_10_4
44 #define MAC_OS_X_VERSION_10_4 1040
47 #ifdef __WXMAC_CARBON__
48 #include "wx/mac/corefoundation/cfstring.h"
52 // as macro in FixMath.h for 10.3
53 inline Fixed
IntToFixed( int inInt
)
55 return (((SInt32
) inInt
) << 16);
58 inline int FixedToInt( Fixed inFixed
)
60 return (((SInt32
) inFixed
) >> 16);
67 #include "wx/window.h"
68 #include "wx/toplevel.h"
70 class wxMacPortStateHelper
72 DECLARE_NO_COPY_CLASS(wxMacPortStateHelper
)
75 wxMacPortStateHelper( GrafPtr newport
) ;
76 wxMacPortStateHelper() ;
77 ~wxMacPortStateHelper() ;
79 void Setup( GrafPtr newport
) ;
81 bool IsCleared() { return m_clip
== NULL
; }
82 GrafPtr
GetCurrentPort() { return m_currentPort
; }
85 GrafPtr m_currentPort
;
88 ThemeDrawingState m_drawingState
;
95 class WXDLLEXPORT wxMacPortSaver
97 DECLARE_NO_COPY_CLASS(wxMacPortSaver
)
100 wxMacPortSaver( GrafPtr port
)
102 ::GetPort( &m_port
) ;
107 ::SetPort( m_port
) ;
113 class WXDLLEXPORT wxMacPortSetter
115 DECLARE_NO_COPY_CLASS(wxMacPortSetter
)
118 wxMacPortSetter( const wxDC
* dc
) ;
121 wxMacPortStateHelper m_ph
;
126 Clips to the visible region of a control within the current port
129 class WXDLLEXPORT wxMacWindowClipper
: public wxMacPortSaver
131 DECLARE_NO_COPY_CLASS(wxMacWindowClipper
)
134 wxMacWindowClipper( const wxWindow
* win
) ;
135 ~wxMacWindowClipper() ;
138 RgnHandle m_formerClip
;
139 RgnHandle m_newClip
;
142 class WXDLLEXPORT wxMacWindowStateSaver
: public wxMacWindowClipper
144 DECLARE_NO_COPY_CLASS(wxMacWindowStateSaver
)
147 wxMacWindowStateSaver( const wxWindow
* win
) ;
148 ~wxMacWindowStateSaver() ;
151 ThemeDrawingState m_themeDrawingState
;
154 #if wxMAC_USE_CORE_GRAPHICS
155 class WXDLLEXPORT wxMacCGContextStateSaver
157 DECLARE_NO_COPY_CLASS(wxMacCGContextStateSaver
)
160 wxMacCGContextStateSaver( CGContextRef cg
)
163 CGContextSaveGState( cg
) ;
165 ~wxMacCGContextStateSaver()
167 CGContextRestoreGState( m_cg
) ;
175 class wxMacDrawingHelper
177 DECLARE_NO_COPY_CLASS(wxMacDrawingHelper)
180 wxMacDrawingHelper( wxWindowMac * theWindow , bool clientArea = false ) ;
181 ~wxMacDrawingHelper() ;
182 bool Ok() { return m_ok ; }
183 void LocalToWindow( Rect *rect) { OffsetRect( rect , m_origin.h , m_origin.v ) ; }
184 void LocalToWindow( Point *pt ) { AddPt( m_origin , pt ) ; }
185 void LocalToWindow( RgnHandle rgn ) { OffsetRgn( rgn , m_origin.h , m_origin.v ) ; }
186 const Point& GetOrigin() { return m_origin ; }
189 GrafPtr m_formerPort ;
190 GrafPtr m_currentPort ;
191 PenState m_savedPenState ;
197 bool wxMacConvertEventToRecord( EventRef event
, EventRecord
*rec
) ;
202 WXDLLEXPORT wxString
wxMacFSSpec2MacFilename( const FSSpec
*spec
) ;
203 WXDLLEXPORT
void wxMacFilename2FSSpec( const wxString
&path
, FSSpec
*spec
) ;
206 WXDLLEXPORT wxString
wxMacFindFolder(short vRefNum
,
208 Boolean createFolder
);
210 template<typename T
> EventParamType
wxMacGetEventParamType() { wxFAIL_MSG( wxT("Unknown Param Type") ) ; return 0 ; }
211 template<> inline EventParamType wxMacGetEventParamType
<RgnHandle
>() { return typeQDRgnHandle
; }
212 template<> inline EventParamType wxMacGetEventParamType
<ControlRef
>() { return typeControlRef
; }
213 template<> inline EventParamType wxMacGetEventParamType
<WindowRef
>() { return typeWindowRef
; }
214 template<> inline EventParamType wxMacGetEventParamType
<MenuRef
>() { return typeMenuRef
; }
215 template<> inline EventParamType wxMacGetEventParamType
<EventRef
>() { return typeEventRef
; }
216 template<> inline EventParamType wxMacGetEventParamType
<Point
>() { return typeQDPoint
; }
217 template<> inline EventParamType wxMacGetEventParamType
<Rect
>() { return typeQDRectangle
; }
218 template<> inline EventParamType wxMacGetEventParamType
<Boolean
>() { return typeBoolean
; }
219 template<> inline EventParamType wxMacGetEventParamType
<SInt16
>() { return typeSInt16
; }
220 template<> inline EventParamType wxMacGetEventParamType
<SInt32
>() { return typeSInt32
; }
221 template<> inline EventParamType wxMacGetEventParamType
<UInt32
>() { return typeUInt32
; }
222 template<> inline EventParamType wxMacGetEventParamType
<RGBColor
>() { return typeRGBColor
; }
223 #if TARGET_API_MAC_OSX
224 template<> inline EventParamType wxMacGetEventParamType
<HICommand
>() { return typeHICommand
; }
225 template<> inline EventParamType wxMacGetEventParamType
<HIPoint
>() { return typeHIPoint
; }
226 template<> inline EventParamType wxMacGetEventParamType
<HISize
>() { return typeHISize
; }
227 template<> inline EventParamType wxMacGetEventParamType
<HIRect
>() { return typeHIRect
; }
228 template<> inline EventParamType wxMacGetEventParamType
<void*>() { return typeVoidPtr
; }
230 template<> inline EventParamType wxMacGetEventParamType
<CFDictionaryRef
>() { return typeCFDictionaryRef
; }
231 template<> inline EventParamType wxMacGetEventParamType
<Collection
>() { return typeCollection
; }
232 template<> inline EventParamType wxMacGetEventParamType
<CGContextRef
>() { return typeCGContextRef
; }
235 template<> EventParamType wxMacGetEventParamType<GrafPtr>() { return typeGrafPtr ; }
236 template<> EventParamType wxMacGetEventParamType<OSStatus>() { return typeOSStatus ; }
237 template<> EventParamType wxMacGetEventParamType<CFIndex>() { return typeCFIndex ; }
238 template<> EventParamType wxMacGetEventParamType<GWorldPtr>() { return typeGWorldPtr ; }
241 class wxMacCarbonEvent
251 wxMacCarbonEvent( EventRef event
, bool release
= false )
254 m_release
= release
;
257 wxMacCarbonEvent(UInt32 inClassID
,UInt32 inKind
,EventTime inWhen
= 0 /*now*/,EventAttributes inAttributes
=kEventAttributeNone
)
260 verify_noerr( MacCreateEvent( NULL
, inClassID
, inKind
,inWhen
,inAttributes
,&m_eventRef
) ) ;
267 ReleaseEvent( m_eventRef
) ;
270 OSStatus
Create(UInt32 inClassID
,UInt32 inKind
,EventTime inWhen
= 0 /*now*/,EventAttributes inAttributes
=kEventAttributeNone
)
272 verify( (m_eventRef
== NULL
) || m_release
) ;
273 if ( m_eventRef
&& m_release
)
275 ReleaseEvent( m_eventRef
) ;
279 OSStatus err
= MacCreateEvent( NULL
, inClassID
, inKind
,inWhen
,inAttributes
,&m_eventRef
) ;
285 OSStatus
GetParameter( EventParamName inName
, EventParamType inDesiredType
, UInt32 inBufferSize
, void * outData
) ;
287 template <typename T
> OSStatus
GetParameter( EventParamName inName
, EventParamType type
, T
*data
)
289 return GetParameter( inName
, type
, sizeof( T
) , data
) ;
291 template <typename T
> OSStatus
GetParameter( EventParamName inName
, T
*data
)
293 return GetParameter
<T
>( inName
, wxMacGetEventParamType
<T
>() , data
) ;
296 template <typename T
> T
GetParameter( EventParamName inName
)
299 verify_noerr( GetParameter
<T
>( inName
, &value
) ) ;
302 template <typename T
> T
GetParameter( EventParamName inName
, EventParamType inDesiredType
)
305 verify_noerr( GetParameter
<T
>( inName
, inDesiredType
, &value
) ) ;
309 OSStatus
SetParameter( EventParamName inName
, EventParamType inType
, UInt32 inSize
, const void * inData
) ;
310 template <typename T
> OSStatus
SetParameter( EventParamName inName
, EventParamType inDesiredType
, const T
*data
)
312 return SetParameter( inName
, inDesiredType
, sizeof( T
) , data
) ;
314 template <typename T
> OSStatus
SetParameter( EventParamName inName
, EventParamType inDesiredType
, const T
& data
)
316 return SetParameter
<T
>( inName
, inDesiredType
, &data
) ;
318 template <typename T
> OSStatus
SetParameter( EventParamName inName
, const T
*data
)
320 return SetParameter
<T
>( inName
, wxMacGetEventParamType
<T
>() , data
) ;
322 template <typename T
> OSStatus
SetParameter( EventParamName inName
, const T
& data
)
324 return SetParameter
<T
>( inName
, wxMacGetEventParamType
<T
>() , &data
) ;
328 return ::GetEventClass( m_eventRef
) ;
332 return ::GetEventKind( m_eventRef
) ;
336 return ::GetEventTime( m_eventRef
) ;
340 return EventTimeToTicks( GetTime() ) ;
342 OSStatus
SetCurrentTime( )
344 return ::SetEventTime( m_eventRef
, GetCurrentEventTime() ) ;
346 OSStatus
SetTime( EventTime when
)
348 return ::SetEventTime( m_eventRef
, when
) ;
350 operator EventRef () { return m_eventRef
; }
352 bool IsValid() { return m_eventRef
!= 0 ; }
354 EventRef m_eventRef
;
359 // helper class for allocating and deallocating Universal Proc Ptrs
362 template <typename procType
, typename uppType
, uppType (*newUPP
)(procType
) , void (*disposeUPP
)(uppType
) > class wxMacUPP
365 wxMacUPP( procType proc
)
368 m_upp
= (*newUPP
)( NULL
) ;
373 disposeUPP( m_upp
) ;
375 operator uppType() { return m_upp
; }
380 typedef wxMacUPP
<NMProcPtr
,NMUPP
,NewNMUPP
,DisposeNMUPP
> wxMacNMUPP
;
382 template <typename refType
> class wxMacCFRefHolder
386 : m_ref(NULL
) , m_release(false)
390 wxMacCFRefHolder( refType ref
, bool release
= true )
391 : m_ref(ref
) , m_release(release
)
402 if ( m_release
&& m_ref
!= NULL
)
409 refType val
= m_ref
;
415 void Set( refType ref
, bool release
= true )
418 m_release
= release
;
422 operator refType () const { return m_ref
; }
428 DECLARE_NO_COPY_CLASS( wxMacCFRefHolder
)
433 GWorldPtr wxMacCreateGWorld( int width , int height , int depth ) ;
434 void wxMacDestroyGWorld( GWorldPtr gw ) ;
435 PicHandle wxMacCreatePict( GWorldPtr gw , GWorldPtr mask = NULL ) ;
436 CIconHandle wxMacCreateCIcon(GWorldPtr image , GWorldPtr mask , short dstDepth , short iconSize ) ;
437 void wxMacSetColorTableEntry( CTabHandle newColors , int index , int red , int green , int blue ) ;
438 CTabHandle wxMacCreateColorTable( int numColors ) ;
440 void wxMacCreateBitmapButton( ControlButtonContentInfo
*info
, const wxBitmap
& bitmap
, int forceType
= 0 ) ;
441 void wxMacReleaseBitmapButton( ControlButtonContentInfo
*info
) ;
443 #define MAC_WXCOLORREF(a) (*((RGBColor*)&(a)))
444 #define MAC_WXHBITMAP(a) (GWorldPtr(a))
445 #define MAC_WXHMETAFILE(a) (PicHandle(a))
446 #define MAC_WXHICON(a) (IconRef(a))
447 #define MAC_WXHCURSOR(a) (CursHandle(a))
448 #define MAC_WXHRGN(a) (RgnHandle(a))
449 #define MAC_WXHWND(a) (WindowPtr(a))
450 #define MAC_WXRECPTR(a) ((Rect*)a)
451 #define MAC_WXPOINTPTR(a) ((Point*)a)
452 #define MAC_WXHMENU(a) ((MenuHandle)a)
454 struct wxOpaqueWindowRef
456 wxOpaqueWindowRef( WindowRef ref
) { m_data
= ref
; }
457 operator WindowRef() { return m_data
; }
462 void wxMacRectToNative( const wxRect
*wx
, Rect
*n
) ;
463 void wxMacNativeToRect( const Rect
*n
, wxRect
* wx
) ;
464 void wxMacPointToNative( const wxPoint
* wx
, Point
*n
) ;
465 void wxMacNativeToPoint( const Point
*n
, wxPoint
* wx
) ;
467 wxWindow
* wxFindControlFromMacControl(ControlRef inControl
) ;
468 wxTopLevelWindowMac
* wxFindWinFromMacWindow( WindowRef inWindow
) ;
469 wxMenu
* wxFindMenuFromMacMenu(MenuRef inMenuRef
) ;
471 int wxMacCommandToId( UInt32 macCommandId
) ;
472 UInt32
wxIdToMacCommand( int wxId
) ;
473 wxMenu
* wxFindMenuFromMacCommand( const HICommand
&macCommandId
, wxMenuItem
* &item
) ;
475 extern wxWindow
* g_MacLastWindow
;
476 pascal OSStatus
wxMacTopLevelMouseEventHandler( EventHandlerCallRef handler
, EventRef event
, void *data
) ;
477 Rect
wxMacGetBoundsForControl( wxWindow
* window
, const wxPoint
& pos
, const wxSize
&size
, bool adjustForOrigin
= true ) ;
479 ControlActionUPP
GetwxMacLiveScrollbarActionProc() ;
484 wxMacControl( wxWindow
* peer
, bool isRootControl
= false ) ;
485 wxMacControl( wxWindow
* peer
, ControlRef control
) ;
486 wxMacControl( wxWindow
* peer
, WXWidget control
) ;
487 virtual ~wxMacControl() ;
491 virtual void Dispose() ;
493 bool Ok() const { return GetControlRef() != NULL
; }
495 virtual ControlRef
* GetControlRefAddr() { return &m_controlRef
; }
496 virtual ControlRef
GetControlRef() const { return m_controlRef
; }
498 virtual void SetReference( SInt32 data
) ;
500 void operator= (ControlRef c) { m_controlRef = c ; }
501 operator ControlRef () { return m_controlRef; }
502 operator ControlRef * () { return &m_controlRef; }
504 // accessing data and values
506 virtual OSStatus
SetData( ControlPartCode inPartCode
, ResType inTag
, Size inSize
, const void * inData
) ;
507 virtual OSStatus
GetData( ControlPartCode inPartCode
, ResType inTag
, Size inBufferSize
, void * inOutBuffer
, Size
* outActualSize
) const ;
508 virtual OSStatus
GetDataSize( ControlPartCode inPartCode
, ResType inTag
, Size
* outActualSize
) const ;
509 virtual OSStatus
SendEvent( EventRef ref
, OptionBits inOptions
= 0 ) ;
510 virtual OSStatus
SendHICommand( HICommand
&command
, OptionBits inOptions
= 0 ) ;
512 virtual OSStatus
SendHICommand( UInt32 commandID
, OptionBits inOptions
= 0 ) ;
514 virtual SInt32
GetValue() const ;
515 virtual SInt32
GetMaximum() const ;
516 virtual SInt32
GetMinimum() const ;
518 virtual void SetValue( SInt32 v
) ;
519 virtual void SetMinimum( SInt32 v
) ;
520 virtual void SetMaximum( SInt32 v
) ;
522 virtual void SetValueAndRange( SInt32 value
, SInt32 minimum
, SInt32 maximum
) ;
523 virtual void SetRange( SInt32 minimum
, SInt32 maximum
) ;
525 virtual OSStatus
SetFocus( ControlFocusPart focusPart
) ;
526 virtual bool HasFocus() const ;
527 virtual bool NeedsFocusRect() const ;
528 virtual void SetNeedsFocusRect( bool needs
) ;
532 Size
GetDataSize( ControlPartCode inPartCode
, ResType inTag
) const
535 verify_noerr( GetDataSize( inPartCode
, inTag
, &sz
) ) ;
538 template <typename T
> OSStatus
SetData( ControlPartCode inPartCode
, ResType inTag
, const T
*data
)
540 return SetData( inPartCode
, inTag
, sizeof( T
) , data
) ;
542 template <typename T
> OSStatus
SetData( ControlPartCode inPartCode
, ResType inTag
, const T
& data
)
544 return SetData( inPartCode
, inTag
, sizeof( T
) , &data
) ;
546 template <typename T
> OSStatus
SetData( ResType inTag
, const T
*data
)
548 return SetData( kControlEntireControl
, inTag
, sizeof( T
) , data
) ;
550 template <typename T
> OSStatus
SetData( ResType inTag
, const T
& data
)
552 return SetData( kControlEntireControl
, inTag
, sizeof( T
) , &data
) ;
554 template <typename T
> OSStatus
GetData( ControlPartCode inPartCode
, ResType inTag
, T
*data
) const
557 return GetData( inPartCode
, inTag
, sizeof( T
) , data
, &dummy
) ;
559 template <typename T
> T
GetData( ControlPartCode inPartCode
, ResType inTag
) const
562 verify_noerr( GetData
<T
>( inPartCode
, inTag
, &value
) ) ;
565 template <typename T
> OSStatus
GetData( ResType inTag
, T
*data
) const
568 return GetData( kControlEntireControl
, inTag
, sizeof( T
) , data
, &dummy
) ;
570 template <typename T
> T
GetData( ResType inTag
) const
573 verify_noerr( GetData
<T
>( kControlEntireControl
, inTag
, &value
) ) ;
577 // Flash the control for the specified amount of time
578 virtual void Flash( ControlPartCode part
, UInt32 ticks
= 8 ) ;
580 virtual void VisibilityChanged( bool shown
) ;
581 virtual void SuperChangedPosition() ;
584 virtual void SetFont( const wxFont
& font
, const wxColour
& foreground
, long windowStyle
) ;
585 virtual void SetBackground( const wxBrush
&brush
) ;
586 virtual ControlPartCode
HandleKey( SInt16 keyCode
, SInt16 charCode
, EventModifiers modifiers
) ;
587 void SetActionProc( ControlActionUPP actionProc
) ;
588 void SetViewSize( SInt32 viewSize
) ;
589 SInt32
GetViewSize() const ;
591 virtual bool IsVisible() const ;
592 virtual void SetVisibility( bool visible
, bool redraw
) ;
593 virtual bool IsEnabled() const ;
594 virtual bool IsActive() const ;
595 virtual void Enable( bool enable
) ;
597 // invalidates this control and all children
598 virtual void InvalidateWithChildren() ;
599 virtual void SetDrawingEnabled( bool enable
) ;
601 virtual bool GetNeedsDisplay() const ;
603 // where is in native window relative coordinates
604 virtual void SetNeedsDisplay( RgnHandle where
) ;
605 // where is in native window relative coordinates
606 virtual void SetNeedsDisplay( Rect
* where
= NULL
) ;
608 // if rect = NULL, entire view
609 virtual void ScrollRect( wxRect
*rect
, int dx
, int dy
) ;
611 // in native parent window relative coordinates
612 virtual void GetRect( Rect
*r
) ;
614 // in native parent window relative coordinates
615 virtual void SetRect( Rect
*r
) ;
617 virtual void GetRectInWindowCoords( Rect
*r
) ;
618 virtual void GetBestRect( Rect
*r
) ;
619 virtual void SetLabel( const wxString
&title
) ;
620 // converts from Toplevel-Content relative to local
621 static void Convert( wxPoint
*pt
, wxMacControl
*convert
, wxMacControl
*to
) ;
623 virtual void GetFeatures( UInt32
*features
) ;
624 virtual OSStatus
GetRegion( ControlPartCode partCode
, RgnHandle region
) ;
625 virtual OSStatus
SetZOrder( bool above
, wxMacControl
* other
) ;
626 // to be moved into a databrowser subclass
628 virtual OSStatus
SetSelectionFlags( DataBrowserSelectionFlags
) ;
629 virtual OSStatus
AddListViewColumn( DataBrowserListViewColumnDesc
*columnDesc
,
630 DataBrowserTableViewColumnIndex position
) ;
631 virtual OSStatus
AutoSizeListViewColumns() ;
632 virtual OSStatus
SetHasScrollBars( bool horiz
, bool vert
) ;
633 virtual OSStatus
SetTableViewHiliteStyle( DataBrowserTableViewHiliteStyle hiliteStyle
) ;
634 virtual OSStatus
SetListViewHeaderBtnHeight(UInt16 height
) ;
635 virtual OSStatus
SetCallbacks(const DataBrowserCallbacks
* callbacks
) ;
636 virtual OSStatus
UpdateItems( DataBrowserItemID container
, UInt32 numItems
,
637 const DataBrowserItemID
* items
,
638 DataBrowserPropertyID preSortProperty
,
639 DataBrowserPropertyID propertyID
) ;
640 virtual OSStatus
AddItems( DataBrowserItemID container
, UInt32 numItems
,
641 const DataBrowserItemID
* items
,
642 DataBrowserPropertyID preSortProperty
) ;
643 virtual OSStatus
RemoveItems( DataBrowserItemID container
, UInt32 numItems
,
644 const DataBrowserItemID
* items
,
645 DataBrowserPropertyID preSortProperty
) ;
646 virtual OSStatus
RevealItem( DataBrowserItemID item
,
647 DataBrowserPropertyID propertyID
,
648 DataBrowserRevealOptions options
) ;
649 virtual OSStatus
GetSelectionAnchor( DataBrowserItemID
* first
, DataBrowserItemID
* last
) ;
650 virtual bool IsItemSelected( DataBrowserItemID item
) ;
651 virtual OSStatus
SetSelectedItems(UInt32 numItems
,
652 const DataBrowserItemID
* items
,
653 DataBrowserSetOption operation
) ;
655 // to be moved into a tab control class
657 virtual OSStatus
SetTabEnabled( SInt16 tabNo
, bool enable
) ;
658 bool IsCompositing() { return m_isCompositing
; }
659 bool IsRootControl() { return m_isRootControl
; }
661 ControlRef m_controlRef
;
665 bool m_needsFocusRect
;
666 bool m_isCompositing
;
667 bool m_isRootControl
;
670 #if wxMAC_USE_CORE_GRAPHICS
672 class WXDLLEXPORT wxMacCGPath
: public wxGraphicPath
674 DECLARE_NO_COPY_CLASS(wxMacCGPath
)
679 // Starts a new subpath at
680 void MoveToPoint( wxCoord x1
, wxCoord y1
) ;
681 void AddLineToPoint( wxCoord x1
, wxCoord y1
) ;
682 void AddQuadCurveToPoint( wxCoord cx1
, wxCoord cy1
, wxCoord x1
, wxCoord y1
) ;
683 void AddRectangle( wxCoord x
, wxCoord y
, wxCoord w
, wxCoord h
) ;
684 void AddCircle( wxCoord x
, wxCoord y
, wxCoord r
) ;
686 // closes the current subpath
687 void CloseSubpath() ;
689 CGPathRef
GetPath() const ;
691 CGMutablePathRef m_path
;
694 class WXDLLEXPORT wxMacCGContext
: public wxGraphicContext
696 DECLARE_NO_COPY_CLASS(wxMacCGContext
)
699 wxMacCGContext( CGrafPtr port
) ;
700 wxMacCGContext( CGContextRef cgcontext
) ;
704 virtual void Clip( const wxRegion
®ion
) ;
705 virtual void StrokePath( const wxGraphicPath
*p
) ;
706 virtual void DrawPath( const wxGraphicPath
*p
, int fillStyle
= wxWINDING_RULE
) ;
707 virtual void FillPath( const wxGraphicPath
*p
, const wxColor
&fillColor
, int fillStyle
= wxWINDING_RULE
) ;
709 virtual wxGraphicPath
* CreatePath() ;
710 virtual void SetPen( const wxPen
&pen
) ;
711 virtual void SetBrush( const wxBrush
&brush
) ;
712 CGContextRef
GetNativeContext() ;
713 void SetNativeContext( CGContextRef cg
) ;
714 CGPathDrawingMode
GetDrawingMode() const { return m_mode
; }
716 CGContextRef m_cgContext
;
718 CGPathDrawingMode m_mode
;
723 #endif // wxMAC_USE_CORE_GRAPHICS
727 CGColorSpaceRef
wxMacGetGenericRGBColorSpace(void) ;
728 void wxMacMemoryBufferReleaseProc(void *info
, const void *data
, size_t size
) ;
732 class WXDLLEXPORT wxBitmapRefData
: public wxGDIRefData
734 DECLARE_NO_COPY_CLASS(wxBitmapRefData
)
736 friend class WXDLLEXPORT wxIcon
;
737 friend class WXDLLEXPORT wxCursor
;
739 wxBitmapRefData(int width
, int height
, int depth
);
744 bool Ok() const { return m_ok
; }
745 void SetOk( bool isOk
) { m_ok
= isOk
; }
747 void SetWidth( int width
) { m_width
= width
; }
748 void SetHeight( int height
) { m_height
= height
; }
749 void SetDepth( int depth
) { m_depth
= depth
; }
751 int GetWidth() const { return m_width
; }
752 int GetHeight() const { return m_height
; }
753 int GetDepth() const { return m_depth
; }
755 void *GetRawAccess() const ;
756 void *BeginRawAccess() ;
757 void EndRawAccess() ;
759 bool HasAlpha() const { return m_hasAlpha
; }
760 void UseAlpha( bool useAlpha
) ;
764 wxPalette m_bitmapPalette
;
765 #endif // wxUSE_PALETTE
767 wxMask
* m_bitmapMask
; // Optional mask
769 CGImageRef
CGImageCreate() const ;
772 // returns true if the bitmap has a size that
773 // can be natively transferred into a true icon
774 // if no is returned GetIconRef will still produce
775 // an icon but it will be generated via a PICT and
776 // rescaled to 16 x 16
777 bool HasNativeSize() ;
779 // caller should increase ref count if needed longer
780 // than the bitmap exists
781 IconRef
GetIconRef() ;
783 // returns a Pict from the bitmap content
784 PicHandle
GetPictHandle() ;
785 GWorldPtr
GetHBITMAP(GWorldPtr
* mask
= NULL
) const ;
786 void UpdateAlphaMask() const ;
789 bool Create(int width
, int height
, int depth
) ;
797 wxMemoryBuffer m_memBuf
;
798 int m_rawAccessCount
;
801 mutable CGImageRef m_cgImageRef
;
804 PicHandle m_pictHandle
;
806 GWorldPtr m_hMaskBitmap
;
807 wxMemoryBuffer m_maskMemBuf
;
808 int m_maskBytesPerRow
;
811 class WXDLLEXPORT wxIconRefData
: public wxGDIRefData
815 wxIconRefData( WXHICON
) ;
816 virtual ~wxIconRefData() { Free(); }
821 void SetWidth( int width
) { m_width
= width
; }
822 void SetHeight( int height
) { m_height
= height
; }
824 int GetWidth() const { return m_width
; }
825 int GetHeight() const { return m_height
; }
827 WXHICON
GetHICON() const { return (WXHICON
) m_iconRef
; }
836 ControlRef
wxMacFindControlUnderMouse( wxTopLevelWindowMac
* toplevelWindow
, const Point
& location
, WindowRef window
, ControlPartCode
*outPart
) ;
839 inline Rect
* wxMacGetPictureBounds( PicHandle pict
, Rect
* rect
)
841 *rect
= (**pict
).picFrame
;
845 inline Rect
* wxMacGetPictureBounds( PicHandle pict
, Rect
* rect
)
847 return QDGetPictureBounds( pict
, rect
) ;
853 #define wxMAC_DEFINE_PROC_GETTER( UPP , x ) \
856 static UPP sHandler = NULL; \
857 if ( sHandler == NULL ) \
858 sHandler = New##UPP( x ); \
862 //---------------------------------------------------------------------------
863 // wxMac string conversions
864 //---------------------------------------------------------------------------
866 void wxMacSetupConverters() ;
867 void wxMacCleanupConverters() ;
869 void wxMacStringToPascal( const wxString
&from
, StringPtr to
) ;
870 wxString
wxMacMakeStringFromPascal( ConstStringPtr from
) ;
874 wxString
wxMacFSRefToPath( const FSRef
*fsRef
, CFStringRef additionalPathComponent
= NULL
) ;
875 OSStatus
wxMacPathToFSRef( const wxString
&path
, FSRef
*fsRef
) ;
876 wxString
wxMacHFSUniStrToString( ConstHFSUniStr255Param uniname
) ;