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 #if TARGET_API_MAC_OSX
220 template<> inline EventParamType wxMacGetEventParamType
<HICommand
>() { return typeHICommand
; }
221 template<> inline EventParamType wxMacGetEventParamType
<HIPoint
>() { return typeHIPoint
; }
222 template<> inline EventParamType wxMacGetEventParamType
<HISize
>() { return typeHISize
; }
223 template<> inline EventParamType wxMacGetEventParamType
<HIRect
>() { return typeHIRect
; }
224 template<> inline EventParamType wxMacGetEventParamType
<void*>() { return typeVoidPtr
; }
226 template<> inline EventParamType wxMacGetEventParamType
<Collection
>() { return typeCollection
; }
227 template<> inline EventParamType wxMacGetEventParamType
<CGContextRef
>() { return typeCGContextRef
; }
230 template<> EventParamType wxMacGetEventParamType<GrafPtr>() { return typeGrafPtr ; }
231 template<> EventParamType wxMacGetEventParamType<OSStatus>() { return typeOSStatus ; }
232 template<> EventParamType wxMacGetEventParamType<CFIndex>() { return typeCFIndex ; }
233 template<> EventParamType wxMacGetEventParamType<GWorldPtr>() { return typeGWorldPtr ; }
236 class wxMacCarbonEvent
246 wxMacCarbonEvent( EventRef event
, bool release
= false )
249 m_release
= release
;
252 wxMacCarbonEvent(UInt32 inClassID
,UInt32 inKind
,EventTime inWhen
= 0 /*now*/,EventAttributes inAttributes
=kEventAttributeNone
)
255 verify_noerr( MacCreateEvent( NULL
, inClassID
, inKind
,inWhen
,inAttributes
,&m_eventRef
) ) ;
262 ReleaseEvent( m_eventRef
) ;
265 OSStatus
Create(UInt32 inClassID
,UInt32 inKind
,EventTime inWhen
= 0 /*now*/,EventAttributes inAttributes
=kEventAttributeNone
)
267 verify( (m_eventRef
== NULL
) || m_release
) ;
268 if ( m_eventRef
&& m_release
)
270 ReleaseEvent( m_eventRef
) ;
274 OSStatus err
= MacCreateEvent( NULL
, inClassID
, inKind
,inWhen
,inAttributes
,&m_eventRef
) ;
280 OSStatus
GetParameter( EventParamName inName
, EventParamType inDesiredType
, UInt32 inBufferSize
, void * outData
) ;
282 template <typename T
> OSStatus
GetParameter( EventParamName inName
, EventParamType type
, T
*data
)
284 return GetParameter( inName
, type
, sizeof( T
) , data
) ;
286 template <typename T
> OSStatus
GetParameter( EventParamName inName
, T
*data
)
288 return GetParameter
<T
>( inName
, wxMacGetEventParamType
<T
>() , data
) ;
291 template <typename T
> T
GetParameter( EventParamName inName
)
294 verify_noerr( GetParameter
<T
>( inName
, &value
) ) ;
297 template <typename T
> T
GetParameter( EventParamName inName
, EventParamType inDesiredType
)
300 verify_noerr( GetParameter
<T
>( inName
, inDesiredType
, &value
) ) ;
304 OSStatus
SetParameter( EventParamName inName
, EventParamType inType
, UInt32 inSize
, const void * inData
) ;
305 template <typename T
> OSStatus
SetParameter( EventParamName inName
, EventParamType inDesiredType
, const T
*data
)
307 return SetParameter( inName
, inDesiredType
, sizeof( T
) , data
) ;
309 template <typename T
> OSStatus
SetParameter( EventParamName inName
, EventParamType inDesiredType
, const T
& data
)
311 return SetParameter
<T
>( inName
, inDesiredType
, &data
) ;
313 template <typename T
> OSStatus
SetParameter( EventParamName inName
, const T
*data
)
315 return SetParameter
<T
>( inName
, wxMacGetEventParamType
<T
>() , data
) ;
317 template <typename T
> OSStatus
SetParameter( EventParamName inName
, const T
& data
)
319 return SetParameter
<T
>( inName
, wxMacGetEventParamType
<T
>() , &data
) ;
323 return ::GetEventClass( m_eventRef
) ;
327 return ::GetEventKind( m_eventRef
) ;
331 return ::GetEventTime( m_eventRef
) ;
335 return EventTimeToTicks( GetTime() ) ;
337 OSStatus
SetCurrentTime( )
339 return ::SetEventTime( m_eventRef
, GetCurrentEventTime() ) ;
341 OSStatus
SetTime( EventTime when
)
343 return ::SetEventTime( m_eventRef
, when
) ;
345 operator EventRef () { return m_eventRef
; }
347 bool IsValid() { return m_eventRef
!= 0 ; }
349 EventRef m_eventRef
;
354 // helper class for allocating and deallocating Universal Proc Ptrs
357 template <typename procType
, typename uppType
, uppType (*newUPP
)(procType
) , void (*disposeUPP
)(uppType
) > class wxMacUPP
360 wxMacUPP( procType proc
)
363 m_upp
= (*newUPP
)( NULL
) ;
368 disposeUPP( m_upp
) ;
370 operator uppType() { return m_upp
; }
375 typedef wxMacUPP
<NMProcPtr
,NMUPP
,NewNMUPP
,DisposeNMUPP
> wxMacNMUPP
;
377 template <typename refType
> class wxMacCFRefHolder
381 : m_ref(NULL
) , m_release(false)
385 wxMacCFRefHolder( refType ref
, bool release
= true )
386 : m_ref(ref
) , m_release(release
)
397 if ( m_release
&& m_ref
!= NULL
)
404 refType val
= m_ref
;
410 void Set( refType ref
, bool release
= true )
413 m_release
= release
;
417 operator refType () const { return m_ref
; }
423 DECLARE_NO_COPY_CLASS( wxMacCFRefHolder
)
428 GWorldPtr wxMacCreateGWorld( int width , int height , int depth ) ;
429 void wxMacDestroyGWorld( GWorldPtr gw ) ;
430 PicHandle wxMacCreatePict( GWorldPtr gw , GWorldPtr mask = NULL ) ;
431 CIconHandle wxMacCreateCIcon(GWorldPtr image , GWorldPtr mask , short dstDepth , short iconSize ) ;
432 void wxMacSetColorTableEntry( CTabHandle newColors , int index , int red , int green , int blue ) ;
433 CTabHandle wxMacCreateColorTable( int numColors ) ;
435 void wxMacCreateBitmapButton( ControlButtonContentInfo
*info
, const wxBitmap
& bitmap
, int forceType
= 0 ) ;
436 void wxMacReleaseBitmapButton( ControlButtonContentInfo
*info
) ;
438 #define MAC_WXCOLORREF(a) (*((RGBColor*)&(a)))
439 #define MAC_WXHBITMAP(a) (GWorldPtr(a))
440 #define MAC_WXHMETAFILE(a) (PicHandle(a))
441 #define MAC_WXHICON(a) (IconRef(a))
442 #define MAC_WXHCURSOR(a) (CursHandle(a))
443 #define MAC_WXHRGN(a) (RgnHandle(a))
444 #define MAC_WXHWND(a) (WindowPtr(a))
445 #define MAC_WXRECPTR(a) ((Rect*)a)
446 #define MAC_WXPOINTPTR(a) ((Point*)a)
447 #define MAC_WXHMENU(a) ((MenuHandle)a)
449 struct wxOpaqueWindowRef
451 wxOpaqueWindowRef( WindowRef ref
) { m_data
= ref
; }
452 operator WindowRef() { return m_data
; }
457 void wxMacRectToNative( const wxRect
*wx
, Rect
*n
) ;
458 void wxMacNativeToRect( const Rect
*n
, wxRect
* wx
) ;
459 void wxMacPointToNative( const wxPoint
* wx
, Point
*n
) ;
460 void wxMacNativeToPoint( const Point
*n
, wxPoint
* wx
) ;
462 wxWindow
* wxFindControlFromMacControl(ControlRef inControl
) ;
463 wxTopLevelWindowMac
* wxFindWinFromMacWindow( WindowRef inWindow
) ;
464 wxMenu
* wxFindMenuFromMacMenu(MenuRef inMenuRef
) ;
466 int wxMacCommandToId( UInt32 macCommandId
) ;
467 UInt32
wxIdToMacCommand( int wxId
) ;
468 wxMenu
* wxFindMenuFromMacCommand( const HICommand
&macCommandId
, wxMenuItem
* &item
) ;
470 extern wxWindow
* g_MacLastWindow
;
471 pascal OSStatus
wxMacTopLevelMouseEventHandler( EventHandlerCallRef handler
, EventRef event
, void *data
) ;
472 Rect
wxMacGetBoundsForControl( wxWindow
* window
, const wxPoint
& pos
, const wxSize
&size
, bool adjustForOrigin
= true ) ;
474 ControlActionUPP
GetwxMacLiveScrollbarActionProc() ;
479 wxMacControl( wxWindow
* peer
, bool isRootControl
= false ) ;
480 wxMacControl( wxWindow
* peer
, ControlRef control
) ;
481 wxMacControl( wxWindow
* peer
, WXWidget control
) ;
482 virtual ~wxMacControl() ;
486 virtual void Dispose() ;
488 bool Ok() const { return GetControlRef() != NULL
; }
490 virtual ControlRef
* GetControlRefAddr() { return &m_controlRef
; }
491 virtual ControlRef
GetControlRef() const { return m_controlRef
; }
493 virtual void SetReference( SInt32 data
) ;
495 void operator= (ControlRef c) { m_controlRef = c ; }
496 operator ControlRef () { return m_controlRef; }
497 operator ControlRef * () { return &m_controlRef; }
499 // accessing data and values
501 virtual OSStatus
SetData( ControlPartCode inPartCode
, ResType inTag
, Size inSize
, const void * inData
) ;
502 virtual OSStatus
GetData( ControlPartCode inPartCode
, ResType inTag
, Size inBufferSize
, void * inOutBuffer
, Size
* outActualSize
) const ;
503 virtual OSStatus
GetDataSize( ControlPartCode inPartCode
, ResType inTag
, Size
* outActualSize
) const ;
504 virtual OSStatus
SendEvent( EventRef ref
, OptionBits inOptions
= 0 ) ;
505 virtual OSStatus
SendHICommand( HICommand
&command
, OptionBits inOptions
= 0 ) ;
507 virtual OSStatus
SendHICommand( UInt32 commandID
, OptionBits inOptions
= 0 ) ;
509 virtual SInt32
GetValue() const ;
510 virtual SInt32
GetMaximum() const ;
511 virtual SInt32
GetMinimum() const ;
513 virtual void SetValue( SInt32 v
) ;
514 virtual void SetMinimum( SInt32 v
) ;
515 virtual void SetMaximum( SInt32 v
) ;
517 virtual void SetValueAndRange( SInt32 value
, SInt32 minimum
, SInt32 maximum
) ;
518 virtual void SetRange( SInt32 minimum
, SInt32 maximum
) ;
520 virtual OSStatus
SetFocus( ControlFocusPart focusPart
) ;
521 virtual bool HasFocus() const ;
522 virtual bool NeedsFocusRect() const ;
523 virtual void SetNeedsFocusRect( bool needs
) ;
527 Size
GetDataSize( ControlPartCode inPartCode
, ResType inTag
) const
530 verify_noerr( GetDataSize( inPartCode
, inTag
, &sz
) ) ;
533 template <typename T
> OSStatus
SetData( ControlPartCode inPartCode
, ResType inTag
, const T
*data
)
535 return SetData( inPartCode
, inTag
, sizeof( T
) , data
) ;
537 template <typename T
> OSStatus
SetData( ControlPartCode inPartCode
, ResType inTag
, const T
& data
)
539 return SetData( inPartCode
, inTag
, sizeof( T
) , &data
) ;
541 template <typename T
> OSStatus
GetData( ControlPartCode inPartCode
, ResType inTag
, T
*data
) const
544 return GetData( inPartCode
, inTag
, sizeof( T
) , data
, &dummy
) ;
546 template <typename T
> T
GetData( ControlPartCode inPartCode
, ResType inTag
) const
549 verify_noerr( GetData
<T
>( inPartCode
, inTag
, &value
) ) ;
553 // Flash the control for the specified amount of time
554 virtual void Flash( ControlPartCode part
, UInt32 ticks
= 8 ) ;
556 virtual void VisibilityChanged( bool shown
) ;
557 virtual void SuperChangedPosition() ;
560 virtual void SetFont( const wxFont
& font
, const wxColour
& foreground
, long windowStyle
) ;
561 virtual void SetBackground( const wxBrush
&brush
) ;
562 virtual ControlPartCode
HandleKey( SInt16 keyCode
, SInt16 charCode
, EventModifiers modifiers
) ;
563 void SetActionProc( ControlActionUPP actionProc
) ;
564 void SetViewSize( SInt32 viewSize
) ;
565 SInt32
GetViewSize() const ;
567 virtual bool IsVisible() const ;
568 virtual void SetVisibility( bool visible
, bool redraw
) ;
569 virtual bool IsEnabled() const ;
570 virtual bool IsActive() const ;
571 virtual void Enable( bool enable
) ;
573 // invalidates this control and all children
574 virtual void InvalidateWithChildren() ;
575 virtual void SetDrawingEnabled( bool enable
) ;
577 virtual bool GetNeedsDisplay() const ;
579 // where is in native window relative coordinates
580 virtual void SetNeedsDisplay( RgnHandle where
) ;
581 // where is in native window relative coordinates
582 virtual void SetNeedsDisplay( Rect
* where
= NULL
) ;
584 // if rect = NULL, entire view
585 virtual void ScrollRect( wxRect
*rect
, int dx
, int dy
) ;
587 // in native parent window relative coordinates
588 virtual void GetRect( Rect
*r
) ;
590 // in native parent window relative coordinates
591 virtual void SetRect( Rect
*r
) ;
593 virtual void GetRectInWindowCoords( Rect
*r
) ;
594 virtual void GetBestRect( Rect
*r
) ;
595 virtual void SetLabel( const wxString
&title
) ;
596 // converts from Toplevel-Content relative to local
597 static void Convert( wxPoint
*pt
, wxMacControl
*convert
, wxMacControl
*to
) ;
599 virtual void GetFeatures( UInt32
*features
) ;
600 virtual OSStatus
GetRegion( ControlPartCode partCode
, RgnHandle region
) ;
601 virtual OSStatus
SetZOrder( bool above
, wxMacControl
* other
) ;
602 // to be moved into a databrowser subclass
604 virtual OSStatus
SetSelectionFlags( DataBrowserSelectionFlags
) ;
605 virtual OSStatus
AddListViewColumn( DataBrowserListViewColumnDesc
*columnDesc
,
606 DataBrowserTableViewColumnIndex position
) ;
607 virtual OSStatus
AutoSizeListViewColumns() ;
608 virtual OSStatus
SetHasScrollBars( bool horiz
, bool vert
) ;
609 virtual OSStatus
SetTableViewHiliteStyle( DataBrowserTableViewHiliteStyle hiliteStyle
) ;
610 virtual OSStatus
SetListViewHeaderBtnHeight(UInt16 height
) ;
611 virtual OSStatus
SetCallbacks(const DataBrowserCallbacks
* callbacks
) ;
612 virtual OSStatus
UpdateItems( DataBrowserItemID container
, UInt32 numItems
,
613 const DataBrowserItemID
* items
,
614 DataBrowserPropertyID preSortProperty
,
615 DataBrowserPropertyID propertyID
) ;
616 virtual OSStatus
AddItems( DataBrowserItemID container
, UInt32 numItems
,
617 const DataBrowserItemID
* items
,
618 DataBrowserPropertyID preSortProperty
) ;
619 virtual OSStatus
RemoveItems( DataBrowserItemID container
, UInt32 numItems
,
620 const DataBrowserItemID
* items
,
621 DataBrowserPropertyID preSortProperty
) ;
622 virtual OSStatus
RevealItem( DataBrowserItemID item
,
623 DataBrowserPropertyID propertyID
,
624 DataBrowserRevealOptions options
) ;
625 virtual OSStatus
GetSelectionAnchor( DataBrowserItemID
* first
, DataBrowserItemID
* last
) ;
626 virtual bool IsItemSelected( DataBrowserItemID item
) ;
627 virtual OSStatus
SetSelectedItems(UInt32 numItems
,
628 const DataBrowserItemID
* items
,
629 DataBrowserSetOption operation
) ;
631 // to be moved into a tab control class
633 virtual OSStatus
SetTabEnabled( SInt16 tabNo
, bool enable
) ;
634 bool IsCompositing() { return m_isCompositing
; }
635 bool IsRootControl() { return m_isRootControl
; }
637 ControlRef m_controlRef
;
641 bool m_needsFocusRect
;
642 bool m_isCompositing
;
643 bool m_isRootControl
;
646 #if wxMAC_USE_CORE_GRAPHICS
648 class WXDLLEXPORT wxMacCGPath
: public wxGraphicPath
650 DECLARE_NO_COPY_CLASS(wxMacCGPath
)
655 // Starts a new subpath at
656 void MoveToPoint( wxCoord x1
, wxCoord y1
) ;
657 void AddLineToPoint( wxCoord x1
, wxCoord y1
) ;
658 void AddQuadCurveToPoint( wxCoord cx1
, wxCoord cy1
, wxCoord x1
, wxCoord y1
) ;
659 void AddRectangle( wxCoord x
, wxCoord y
, wxCoord w
, wxCoord h
) ;
660 void AddCircle( wxCoord x
, wxCoord y
, wxCoord r
) ;
662 // closes the current subpath
663 void CloseSubpath() ;
665 CGPathRef
GetPath() const ;
667 CGMutablePathRef m_path
;
670 class WXDLLEXPORT wxMacCGContext
: public wxGraphicContext
672 DECLARE_NO_COPY_CLASS(wxMacCGContext
)
675 wxMacCGContext( CGrafPtr port
) ;
676 wxMacCGContext( CGContextRef cgcontext
) ;
680 virtual void Clip( const wxRegion
®ion
) ;
681 virtual void StrokePath( const wxGraphicPath
*p
) ;
682 virtual void DrawPath( const wxGraphicPath
*p
, int fillStyle
= wxWINDING_RULE
) ;
683 virtual void FillPath( const wxGraphicPath
*p
, const wxColor
&fillColor
, int fillStyle
= wxWINDING_RULE
) ;
685 virtual wxGraphicPath
* CreatePath() ;
686 virtual void SetPen( const wxPen
&pen
) ;
687 virtual void SetBrush( const wxBrush
&brush
) ;
688 CGContextRef
GetNativeContext() ;
689 void SetNativeContext( CGContextRef cg
) ;
690 CGPathDrawingMode
GetDrawingMode() const { return m_mode
; }
692 CGContextRef m_cgContext
;
694 CGPathDrawingMode m_mode
;
699 #endif // wxMAC_USE_CORE_GRAPHICS
703 CGColorSpaceRef
wxMacGetGenericRGBColorSpace(void) ;
704 void wxMacMemoryBufferReleaseProc(void *info
, const void *data
, size_t size
) ;
708 class WXDLLEXPORT wxBitmapRefData
: public wxGDIRefData
710 DECLARE_NO_COPY_CLASS(wxBitmapRefData
)
712 friend class WXDLLEXPORT wxIcon
;
713 friend class WXDLLEXPORT wxCursor
;
715 wxBitmapRefData(int width
, int height
, int depth
);
720 bool Ok() const { return m_ok
; }
721 void SetOk( bool isOk
) { m_ok
= isOk
; }
723 void SetWidth( int width
) { m_width
= width
; }
724 void SetHeight( int height
) { m_height
= height
; }
725 void SetDepth( int depth
) { m_depth
= depth
; }
727 int GetWidth() const { return m_width
; }
728 int GetHeight() const { return m_height
; }
729 int GetDepth() const { return m_depth
; }
731 void *GetRawAccess() const ;
732 void *BeginRawAccess() ;
733 void EndRawAccess() ;
735 bool HasAlpha() const { return m_hasAlpha
; }
736 void UseAlpha( bool useAlpha
) ;
740 wxPalette m_bitmapPalette
;
741 #endif // wxUSE_PALETTE
743 wxMask
* m_bitmapMask
; // Optional mask
745 CGImageRef
CGImageCreate() const ;
748 // returns true if the bitmap has a size that
749 // can be natively transferred into a true icon
750 // if no is returned GetIconRef will still produce
751 // an icon but it will be generated via a PICT and
752 // rescaled to 16 x 16
753 bool HasNativeSize() ;
755 // caller should increase ref count if needed longer
756 // than the bitmap exists
757 IconRef
GetIconRef() ;
759 // returns a Pict from the bitmap content
760 PicHandle
GetPictHandle() ;
761 GWorldPtr
GetHBITMAP(GWorldPtr
* mask
= NULL
) const ;
762 void UpdateAlphaMask() const ;
765 bool Create(int width
, int height
, int depth
) ;
773 wxMemoryBuffer m_memBuf
;
774 int m_rawAccessCount
;
777 mutable CGImageRef m_cgImageRef
;
780 PicHandle m_pictHandle
;
782 GWorldPtr m_hMaskBitmap
;
783 wxMemoryBuffer m_maskMemBuf
;
784 int m_maskBytesPerRow
;
787 class WXDLLEXPORT wxIconRefData
: public wxGDIRefData
791 wxIconRefData( WXHICON
) ;
792 virtual ~wxIconRefData() { Free(); }
797 void SetWidth( int width
) { m_width
= width
; }
798 void SetHeight( int height
) { m_height
= height
; }
800 int GetWidth() const { return m_width
; }
801 int GetHeight() const { return m_height
; }
803 WXHICON
GetHICON() const { return (WXHICON
) m_iconRef
; }
812 ControlRef
wxMacFindControlUnderMouse( wxTopLevelWindowMac
* toplevelWindow
, const Point
& location
, WindowRef window
, ControlPartCode
*outPart
) ;
816 #define wxMAC_DEFINE_PROC_GETTER( UPP , x ) \
819 static UPP sHandler = NULL; \
820 if ( sHandler == NULL ) \
821 sHandler = New##UPP( x ); \
825 //---------------------------------------------------------------------------
826 // wxMac string conversions
827 //---------------------------------------------------------------------------
829 void wxMacSetupConverters() ;
830 void wxMacCleanupConverters() ;
832 void wxMacStringToPascal( const wxString
&from
, StringPtr to
) ;
833 wxString
wxMacMakeStringFromPascal( ConstStringPtr from
) ;
837 wxString
wxMacFSRefToPath( const FSRef
*fsRef
, CFStringRef additionalPathComponent
= NULL
) ;
838 OSStatus
wxMacPathToFSRef( const wxString
&path
, FSRef
*fsRef
) ;
839 wxString
wxMacHFSUniStrToString( ConstHFSUniStr255Param uniname
) ;