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
);
106 class WXDLLEXPORT wxMacPortSetter
108 DECLARE_NO_COPY_CLASS(wxMacPortSetter
)
111 wxMacPortSetter( const wxDC
* dc
) ;
114 wxMacPortStateHelper m_ph
;
119 Clips to the visible region of a control within the current port
122 class WXDLLEXPORT wxMacWindowClipper
: public wxMacPortSaver
124 DECLARE_NO_COPY_CLASS(wxMacWindowClipper
)
127 wxMacWindowClipper( const wxWindow
* win
) ;
128 ~wxMacWindowClipper() ;
131 RgnHandle m_formerClip
;
132 RgnHandle m_newClip
;
135 class WXDLLEXPORT wxMacWindowStateSaver
: public wxMacWindowClipper
137 DECLARE_NO_COPY_CLASS(wxMacWindowStateSaver
)
140 wxMacWindowStateSaver( const wxWindow
* win
) ;
141 ~wxMacWindowStateSaver() ;
144 ThemeDrawingState m_themeDrawingState
;
147 #if wxMAC_USE_CORE_GRAPHICS
148 class WXDLLEXPORT wxMacCGContextStateSaver
150 DECLARE_NO_COPY_CLASS(wxMacCGContextStateSaver
)
153 wxMacCGContextStateSaver( CGContextRef cg
)
156 CGContextSaveGState( cg
) ;
158 ~wxMacCGContextStateSaver()
160 CGContextRestoreGState( m_cg
) ;
168 class wxMacDrawingHelper
170 DECLARE_NO_COPY_CLASS(wxMacDrawingHelper)
173 wxMacDrawingHelper( wxWindowMac * theWindow , bool clientArea = false ) ;
174 ~wxMacDrawingHelper() ;
175 bool Ok() { return m_ok ; }
176 void LocalToWindow( Rect *rect) { OffsetRect( rect , m_origin.h , m_origin.v ) ; }
177 void LocalToWindow( Point *pt ) { AddPt( m_origin , pt ) ; }
178 void LocalToWindow( RgnHandle rgn ) { OffsetRgn( rgn , m_origin.h , m_origin.v ) ; }
179 const Point& GetOrigin() { return m_origin ; }
182 GrafPtr m_formerPort ;
183 GrafPtr m_currentPort ;
184 PenState m_savedPenState ;
190 bool wxMacConvertEventToRecord( EventRef event
, EventRecord
*rec
) ;
195 WXDLLEXPORT wxString
wxMacFSSpec2MacFilename( const FSSpec
*spec
) ;
196 WXDLLEXPORT
void wxMacFilename2FSSpec( const wxString
&path
, FSSpec
*spec
) ;
199 WXDLLEXPORT wxString
wxMacFindFolderNoSeparator(short vRefNum
,
201 Boolean createFolder
);
202 WXDLLEXPORT wxString
wxMacFindFolder(short vRefNum
,
204 Boolean createFolder
);
206 template<typename T
> EventParamType
wxMacGetEventParamType() { wxFAIL_MSG( wxT("Unknown Param Type") ) ; return 0 ; }
207 template<> inline EventParamType wxMacGetEventParamType
<RgnHandle
>() { return typeQDRgnHandle
; }
208 template<> inline EventParamType wxMacGetEventParamType
<ControlRef
>() { return typeControlRef
; }
209 template<> inline EventParamType wxMacGetEventParamType
<WindowRef
>() { return typeWindowRef
; }
210 template<> inline EventParamType wxMacGetEventParamType
<MenuRef
>() { return typeMenuRef
; }
211 template<> inline EventParamType wxMacGetEventParamType
<EventRef
>() { return typeEventRef
; }
212 template<> inline EventParamType wxMacGetEventParamType
<Point
>() { return typeQDPoint
; }
213 template<> inline EventParamType wxMacGetEventParamType
<Rect
>() { return typeQDRectangle
; }
214 template<> inline EventParamType wxMacGetEventParamType
<Boolean
>() { return typeBoolean
; }
215 template<> inline EventParamType wxMacGetEventParamType
<SInt16
>() { return typeSInt16
; }
216 template<> inline EventParamType wxMacGetEventParamType
<SInt32
>() { return typeSInt32
; }
217 template<> inline EventParamType wxMacGetEventParamType
<UInt32
>() { return typeUInt32
; }
218 template<> inline EventParamType wxMacGetEventParamType
<RGBColor
>() { return typeRGBColor
; }
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 #if TARGET_API_MAC_OSX && ( MAC_OS_X_VERSION_MAX_ALLOWED > MAC_OS_X_VERSION_10_2 )
227 template<> inline EventParamType wxMacGetEventParamType
<CFDictionaryRef
>() { return typeCFDictionaryRef
; }
229 template<> inline EventParamType wxMacGetEventParamType
<Collection
>() { return typeCollection
; }
230 template<> inline EventParamType wxMacGetEventParamType
<CGContextRef
>() { return typeCGContextRef
; }
233 template<> EventParamType wxMacGetEventParamType<GrafPtr>() { return typeGrafPtr ; }
234 template<> EventParamType wxMacGetEventParamType<OSStatus>() { return typeOSStatus ; }
235 template<> EventParamType wxMacGetEventParamType<CFIndex>() { return typeCFIndex ; }
236 template<> EventParamType wxMacGetEventParamType<GWorldPtr>() { return typeGWorldPtr ; }
239 class wxMacCarbonEvent
249 wxMacCarbonEvent( EventRef event
, bool release
= false )
252 m_release
= release
;
255 wxMacCarbonEvent(UInt32 inClassID
,UInt32 inKind
,EventTime inWhen
= 0 /*now*/,EventAttributes inAttributes
=kEventAttributeNone
)
258 verify_noerr( MacCreateEvent( NULL
, inClassID
, inKind
,inWhen
,inAttributes
,&m_eventRef
) ) ;
265 ReleaseEvent( m_eventRef
) ;
268 OSStatus
Create(UInt32 inClassID
,UInt32 inKind
,EventTime inWhen
= 0 /*now*/,EventAttributes inAttributes
=kEventAttributeNone
)
270 verify( (m_eventRef
== NULL
) || m_release
) ;
271 if ( m_eventRef
&& m_release
)
273 ReleaseEvent( m_eventRef
) ;
277 OSStatus err
= MacCreateEvent( NULL
, inClassID
, inKind
,inWhen
,inAttributes
,&m_eventRef
) ;
283 OSStatus
GetParameter( EventParamName inName
, EventParamType inDesiredType
, UInt32 inBufferSize
, void * outData
) ;
285 template <typename T
> OSStatus
GetParameter( EventParamName inName
, EventParamType type
, T
*data
)
287 return GetParameter( inName
, type
, sizeof( T
) , data
) ;
289 template <typename T
> OSStatus
GetParameter( EventParamName inName
, T
*data
)
291 return GetParameter
<T
>( inName
, wxMacGetEventParamType
<T
>() , data
) ;
294 template <typename T
> T
GetParameter( EventParamName inName
)
297 verify_noerr( GetParameter
<T
>( inName
, &value
) ) ;
300 template <typename T
> T
GetParameter( EventParamName inName
, EventParamType inDesiredType
)
303 verify_noerr( GetParameter
<T
>( inName
, inDesiredType
, &value
) ) ;
307 OSStatus
SetParameter( EventParamName inName
, EventParamType inType
, UInt32 inSize
, const void * inData
) ;
308 template <typename T
> OSStatus
SetParameter( EventParamName inName
, EventParamType inDesiredType
, const T
*data
)
310 return SetParameter( inName
, inDesiredType
, sizeof( T
) , data
) ;
312 template <typename T
> OSStatus
SetParameter( EventParamName inName
, EventParamType inDesiredType
, const T
& data
)
314 return SetParameter
<T
>( inName
, inDesiredType
, &data
) ;
316 template <typename T
> OSStatus
SetParameter( EventParamName inName
, const T
*data
)
318 return SetParameter
<T
>( inName
, wxMacGetEventParamType
<T
>() , data
) ;
320 template <typename T
> OSStatus
SetParameter( EventParamName inName
, const T
& data
)
322 return SetParameter
<T
>( inName
, wxMacGetEventParamType
<T
>() , &data
) ;
326 return ::GetEventClass( m_eventRef
) ;
330 return ::GetEventKind( m_eventRef
) ;
334 return ::GetEventTime( m_eventRef
) ;
338 return EventTimeToTicks( GetTime() ) ;
340 OSStatus
SetCurrentTime( )
342 return ::SetEventTime( m_eventRef
, GetCurrentEventTime() ) ;
344 OSStatus
SetTime( EventTime when
)
346 return ::SetEventTime( m_eventRef
, when
) ;
348 operator EventRef () { return m_eventRef
; }
350 bool IsValid() { return m_eventRef
!= 0 ; }
352 EventRef m_eventRef
;
357 // helper class for allocating and deallocating Universal Proc Ptrs
360 template <typename procType
, typename uppType
, uppType (*newUPP
)(procType
) , void (*disposeUPP
)(uppType
) > class wxMacUPP
363 wxMacUPP( procType proc
)
366 m_upp
= (*newUPP
)( NULL
) ;
371 disposeUPP( m_upp
) ;
373 operator uppType() { return m_upp
; }
378 typedef wxMacUPP
<NMProcPtr
,NMUPP
,NewNMUPP
,DisposeNMUPP
> wxMacNMUPP
;
380 template <typename refType
> class wxMacCFRefHolder
384 : m_ref(NULL
) , m_release(false)
388 wxMacCFRefHolder( refType ref
, bool release
= true )
389 : m_ref(ref
) , m_release(release
)
400 if ( m_release
&& m_ref
!= NULL
)
407 refType val
= m_ref
;
413 void Set( refType ref
, bool release
= true )
416 m_release
= release
;
420 operator refType () const { return m_ref
; }
426 DECLARE_NO_COPY_CLASS( wxMacCFRefHolder
)
431 GWorldPtr wxMacCreateGWorld( int width , int height , int depth ) ;
432 void wxMacDestroyGWorld( GWorldPtr gw ) ;
433 PicHandle wxMacCreatePict( GWorldPtr gw , GWorldPtr mask = NULL ) ;
434 CIconHandle wxMacCreateCIcon(GWorldPtr image , GWorldPtr mask , short dstDepth , short iconSize ) ;
435 void wxMacSetColorTableEntry( CTabHandle newColors , int index , int red , int green , int blue ) ;
436 CTabHandle wxMacCreateColorTable( int numColors ) ;
438 void wxMacCreateBitmapButton( ControlButtonContentInfo
*info
, const wxBitmap
& bitmap
, int forceType
= 0 ) ;
439 void wxMacReleaseBitmapButton( ControlButtonContentInfo
*info
) ;
441 #define MAC_WXCOLORREF(a) (*((RGBColor*)&(a)))
442 #define MAC_WXHBITMAP(a) (GWorldPtr(a))
443 #define MAC_WXHMETAFILE(a) (PicHandle(a))
444 #define MAC_WXHICON(a) (IconRef(a))
445 #define MAC_WXHCURSOR(a) (CursHandle(a))
446 #define MAC_WXHRGN(a) (RgnHandle(a))
447 #define MAC_WXHWND(a) (WindowPtr(a))
448 #define MAC_WXRECPTR(a) ((Rect*)a)
449 #define MAC_WXPOINTPTR(a) ((Point*)a)
450 #define MAC_WXHMENU(a) ((MenuHandle)a)
452 struct wxOpaqueWindowRef
454 wxOpaqueWindowRef( WindowRef ref
) { m_data
= ref
; }
455 operator WindowRef() { return m_data
; }
460 void wxMacRectToNative( const wxRect
*wx
, Rect
*n
) ;
461 void wxMacNativeToRect( const Rect
*n
, wxRect
* wx
) ;
462 void wxMacPointToNative( const wxPoint
* wx
, Point
*n
) ;
463 void wxMacNativeToPoint( const Point
*n
, wxPoint
* wx
) ;
465 wxWindow
* wxFindControlFromMacControl(ControlRef inControl
) ;
466 wxTopLevelWindowMac
* wxFindWinFromMacWindow( WindowRef inWindow
) ;
467 wxMenu
* wxFindMenuFromMacMenu(MenuRef inMenuRef
) ;
469 int wxMacCommandToId( UInt32 macCommandId
) ;
470 UInt32
wxIdToMacCommand( int wxId
) ;
471 wxMenu
* wxFindMenuFromMacCommand( const HICommand
&macCommandId
, wxMenuItem
* &item
) ;
473 extern wxWindow
* g_MacLastWindow
;
474 pascal OSStatus
wxMacTopLevelMouseEventHandler( EventHandlerCallRef handler
, EventRef event
, void *data
) ;
475 Rect
wxMacGetBoundsForControl( wxWindow
* window
, const wxPoint
& pos
, const wxSize
&size
, bool adjustForOrigin
= true ) ;
477 ControlActionUPP
GetwxMacLiveScrollbarActionProc() ;
482 wxMacControl( wxWindow
* peer
, bool isRootControl
= false ) ;
483 wxMacControl( wxWindow
* peer
, ControlRef control
) ;
484 wxMacControl( wxWindow
* peer
, WXWidget control
) ;
485 virtual ~wxMacControl() ;
489 virtual void Dispose() ;
491 bool Ok() const { return GetControlRef() != NULL
; }
493 virtual ControlRef
* GetControlRefAddr() { return &m_controlRef
; }
494 virtual ControlRef
GetControlRef() const { return m_controlRef
; }
496 virtual void SetReference( SInt32 data
) ;
498 void operator= (ControlRef c) { m_controlRef = c ; }
499 operator ControlRef () { return m_controlRef; }
500 operator ControlRef * () { return &m_controlRef; }
502 // accessing data and values
504 virtual OSStatus
SetData( ControlPartCode inPartCode
, ResType inTag
, Size inSize
, const void * inData
) ;
505 virtual OSStatus
GetData( ControlPartCode inPartCode
, ResType inTag
, Size inBufferSize
, void * inOutBuffer
, Size
* outActualSize
) const ;
506 virtual OSStatus
GetDataSize( ControlPartCode inPartCode
, ResType inTag
, Size
* outActualSize
) const ;
507 virtual OSStatus
SendEvent( EventRef ref
, OptionBits inOptions
= 0 ) ;
508 virtual OSStatus
SendHICommand( HICommand
&command
, OptionBits inOptions
= 0 ) ;
510 virtual OSStatus
SendHICommand( UInt32 commandID
, OptionBits inOptions
= 0 ) ;
512 virtual SInt32
GetValue() const ;
513 virtual SInt32
GetMaximum() const ;
514 virtual SInt32
GetMinimum() const ;
516 virtual void SetValue( SInt32 v
) ;
517 virtual void SetMinimum( SInt32 v
) ;
518 virtual void SetMaximum( SInt32 v
) ;
520 virtual void SetValueAndRange( SInt32 value
, SInt32 minimum
, SInt32 maximum
) ;
521 virtual void SetRange( SInt32 minimum
, SInt32 maximum
) ;
523 virtual OSStatus
SetFocus( ControlFocusPart focusPart
) ;
524 virtual bool HasFocus() const ;
525 virtual bool NeedsFocusRect() const ;
526 virtual void SetNeedsFocusRect( bool needs
) ;
530 Size
GetDataSize( ControlPartCode inPartCode
, ResType inTag
) const
533 verify_noerr( GetDataSize( inPartCode
, inTag
, &sz
) ) ;
536 template <typename T
> OSStatus
SetData( ControlPartCode inPartCode
, ResType inTag
, const T
*data
)
538 return SetData( inPartCode
, inTag
, sizeof( T
) , data
) ;
540 template <typename T
> OSStatus
SetData( ControlPartCode inPartCode
, ResType inTag
, const T
& data
)
542 return SetData( inPartCode
, inTag
, sizeof( T
) , &data
) ;
544 template <typename T
> OSStatus
SetData( ResType inTag
, const T
*data
)
546 return SetData( kControlEntireControl
, inTag
, sizeof( T
) , data
) ;
548 template <typename T
> OSStatus
SetData( ResType inTag
, const T
& data
)
550 return SetData( kControlEntireControl
, inTag
, sizeof( T
) , &data
) ;
552 template <typename T
> OSStatus
GetData( ControlPartCode inPartCode
, ResType inTag
, T
*data
) const
555 return GetData( inPartCode
, inTag
, sizeof( T
) , data
, &dummy
) ;
557 template <typename T
> T
GetData( ControlPartCode inPartCode
, ResType inTag
) const
560 verify_noerr( GetData
<T
>( inPartCode
, inTag
, &value
) ) ;
563 template <typename T
> OSStatus
GetData( ResType inTag
, T
*data
) const
566 return GetData( kControlEntireControl
, inTag
, sizeof( T
) , data
, &dummy
) ;
568 template <typename T
> T
GetData( ResType inTag
) const
571 verify_noerr( GetData
<T
>( kControlEntireControl
, inTag
, &value
) ) ;
575 // Flash the control for the specified amount of time
576 virtual void Flash( ControlPartCode part
, UInt32 ticks
= 8 ) ;
578 virtual void VisibilityChanged( bool shown
) ;
579 virtual void SuperChangedPosition() ;
582 virtual void SetFont( const wxFont
& font
, const wxColour
& foreground
, long windowStyle
) ;
583 virtual void SetBackground( const wxBrush
&brush
) ;
584 virtual ControlPartCode
HandleKey( SInt16 keyCode
, SInt16 charCode
, EventModifiers modifiers
) ;
585 void SetActionProc( ControlActionUPP actionProc
) ;
586 void SetViewSize( SInt32 viewSize
) ;
587 SInt32
GetViewSize() const ;
589 virtual bool IsVisible() const ;
590 virtual void SetVisibility( bool visible
, bool redraw
) ;
591 virtual bool IsEnabled() const ;
592 virtual bool IsActive() const ;
593 virtual void Enable( bool enable
) ;
595 // invalidates this control and all children
596 virtual void InvalidateWithChildren() ;
597 virtual void SetDrawingEnabled( bool enable
) ;
599 virtual bool GetNeedsDisplay() const ;
601 // where is in native window relative coordinates
602 virtual void SetNeedsDisplay( RgnHandle where
) ;
603 // where is in native window relative coordinates
604 virtual void SetNeedsDisplay( Rect
* where
= NULL
) ;
606 // if rect = NULL, entire view
607 virtual void ScrollRect( wxRect
*rect
, int dx
, int dy
) ;
609 // in native parent window relative coordinates
610 virtual void GetRect( Rect
*r
) ;
612 // in native parent window relative coordinates
613 virtual void SetRect( Rect
*r
) ;
615 virtual void GetRectInWindowCoords( Rect
*r
) ;
616 virtual void GetBestRect( Rect
*r
) ;
617 virtual void SetLabel( const wxString
&title
) ;
618 // converts from Toplevel-Content relative to local
619 static void Convert( wxPoint
*pt
, wxMacControl
*convert
, wxMacControl
*to
) ;
621 virtual void GetFeatures( UInt32
*features
) ;
622 virtual OSStatus
GetRegion( ControlPartCode partCode
, RgnHandle region
) ;
623 virtual OSStatus
SetZOrder( bool above
, wxMacControl
* other
) ;
625 bool IsCompositing() { return m_isCompositing
; }
626 bool IsRootControl() { return m_isRootControl
; }
628 // to be moved into a tab control class
630 virtual OSStatus
SetTabEnabled( SInt16 tabNo
, bool enable
) ;
632 ControlRef m_controlRef
;
636 bool m_needsFocusRect
;
637 bool m_isCompositing
;
638 bool m_isRootControl
;
641 #if wxMAC_USE_CORE_GRAPHICS
643 class WXDLLEXPORT wxMacCGPath
: public wxGraphicPath
645 DECLARE_NO_COPY_CLASS(wxMacCGPath
)
650 // Starts a new subpath at
651 void MoveToPoint( wxCoord x1
, wxCoord y1
) ;
652 void AddLineToPoint( wxCoord x1
, wxCoord y1
) ;
653 void AddQuadCurveToPoint( wxCoord cx1
, wxCoord cy1
, wxCoord x1
, wxCoord y1
) ;
654 void AddRectangle( wxCoord x
, wxCoord y
, wxCoord w
, wxCoord h
) ;
655 void AddCircle( wxCoord x
, wxCoord y
, wxCoord r
) ;
657 // closes the current subpath
658 void CloseSubpath() ;
660 CGPathRef
GetPath() const ;
662 CGMutablePathRef m_path
;
665 class WXDLLEXPORT wxMacCGContext
: public wxGraphicContext
667 DECLARE_NO_COPY_CLASS(wxMacCGContext
)
670 wxMacCGContext( CGrafPtr port
) ;
671 wxMacCGContext( CGContextRef cgcontext
) ;
675 virtual void Clip( const wxRegion
®ion
) ;
676 virtual void StrokePath( const wxGraphicPath
*p
) ;
677 virtual void DrawPath( const wxGraphicPath
*p
, int fillStyle
= wxWINDING_RULE
) ;
678 virtual void FillPath( const wxGraphicPath
*p
, const wxColor
&fillColor
, int fillStyle
= wxWINDING_RULE
) ;
680 virtual wxGraphicPath
* CreatePath() ;
681 virtual void SetPen( const wxPen
&pen
) ;
682 virtual void SetBrush( const wxBrush
&brush
) ;
683 CGContextRef
GetNativeContext() ;
684 void SetNativeContext( CGContextRef cg
) ;
685 CGPathDrawingMode
GetDrawingMode() const { return m_mode
; }
687 CGContextRef m_cgContext
;
689 CGPathDrawingMode m_mode
;
694 #endif // wxMAC_USE_CORE_GRAPHICS
698 CGColorSpaceRef
wxMacGetGenericRGBColorSpace(void) ;
699 void wxMacMemoryBufferReleaseProc(void *info
, const void *data
, size_t size
) ;
703 class WXDLLEXPORT wxBitmapRefData
: public wxGDIRefData
705 DECLARE_NO_COPY_CLASS(wxBitmapRefData
)
707 friend class WXDLLEXPORT wxIcon
;
708 friend class WXDLLEXPORT wxCursor
;
710 wxBitmapRefData(int width
, int height
, int depth
);
715 bool Ok() const { return m_ok
; }
716 void SetOk( bool isOk
) { m_ok
= isOk
; }
718 void SetWidth( int width
) { m_width
= width
; }
719 void SetHeight( int height
) { m_height
= height
; }
720 void SetDepth( int depth
) { m_depth
= depth
; }
722 int GetWidth() const { return m_width
; }
723 int GetHeight() const { return m_height
; }
724 int GetDepth() const { return m_depth
; }
726 void *GetRawAccess() const ;
727 void *BeginRawAccess() ;
728 void EndRawAccess() ;
730 bool HasAlpha() const { return m_hasAlpha
; }
731 void UseAlpha( bool useAlpha
) ;
735 wxPalette m_bitmapPalette
;
736 #endif // wxUSE_PALETTE
738 wxMask
* m_bitmapMask
; // Optional mask
740 CGImageRef
CGImageCreate() const ;
743 // returns true if the bitmap has a size that
744 // can be natively transferred into a true icon
745 // if no is returned GetIconRef will still produce
746 // an icon but it will be generated via a PICT and
747 // rescaled to 16 x 16
748 bool HasNativeSize() ;
750 // caller should increase ref count if needed longer
751 // than the bitmap exists
752 IconRef
GetIconRef() ;
754 // returns a Pict from the bitmap content
755 PicHandle
GetPictHandle() ;
756 GWorldPtr
GetHBITMAP(GWorldPtr
* mask
= NULL
) const ;
757 void UpdateAlphaMask() const ;
760 bool Create(int width
, int height
, int depth
) ;
768 wxMemoryBuffer m_memBuf
;
769 int m_rawAccessCount
;
772 mutable CGImageRef m_cgImageRef
;
775 PicHandle m_pictHandle
;
777 GWorldPtr m_hMaskBitmap
;
778 wxMemoryBuffer m_maskMemBuf
;
779 int m_maskBytesPerRow
;
782 class WXDLLEXPORT wxIconRefData
: public wxGDIRefData
786 wxIconRefData( WXHICON
) ;
787 virtual ~wxIconRefData() { Free(); }
792 void SetWidth( int width
) { m_width
= width
; }
793 void SetHeight( int height
) { m_height
= height
; }
795 int GetWidth() const { return m_width
; }
796 int GetHeight() const { return m_height
; }
798 WXHICON
GetHICON() const { return (WXHICON
) m_iconRef
; }
807 ControlRef
wxMacFindControlUnderMouse( wxTopLevelWindowMac
* toplevelWindow
, const Point
& location
, WindowRef window
, ControlPartCode
*outPart
) ;
809 #ifdef WORDS_BIGENDIAN
810 inline Rect
* wxMacGetPictureBounds( PicHandle pict
, Rect
* rect
)
812 *rect
= (**pict
).picFrame
;
816 inline Rect
* wxMacGetPictureBounds( PicHandle pict
, Rect
* rect
)
818 return QDGetPictureBounds( pict
, rect
) ;
824 #define wxMAC_DEFINE_PROC_GETTER( UPP , x ) \
827 static UPP sHandler = NULL; \
828 if ( sHandler == NULL ) \
829 sHandler = New##UPP( x ); \
833 //---------------------------------------------------------------------------
834 // wxMac string conversions
835 //---------------------------------------------------------------------------
837 void wxMacSetupConverters() ;
838 void wxMacCleanupConverters() ;
840 void wxMacStringToPascal( const wxString
&from
, StringPtr to
) ;
841 wxString
wxMacMakeStringFromPascal( ConstStringPtr from
) ;
845 wxString
wxMacFSRefToPath( const FSRef
*fsRef
, CFStringRef additionalPathComponent
= NULL
) ;
846 OSStatus
wxMacPathToFSRef( const wxString
&path
, FSRef
*fsRef
) ;
847 wxString
wxMacHFSUniStrToString( ConstHFSUniStr255Param uniname
) ;