1 /////////////////////////////////////////////////////////////////////////////
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>
34 #if UNIVERSAL_INTERFACES_VERSION < 0x0340
35 #error "please update to Apple's lastest universal headers from http://developer.apple.com/sdk/"
38 #ifndef MAC_OS_X_VERSION_10_3
39 #define MAC_OS_X_VERSION_10_3 1030
42 #ifndef MAC_OS_X_VERSION_10_4
43 #define MAC_OS_X_VERSION_10_4 1040
46 #ifdef __WXMAC_CARBON__
47 #include "wx/mac/corefoundation/cfstring.h"
51 // as macro in FixMath.h for 10.3
52 inline Fixed
IntToFixed( int inInt
)
54 return (((SInt32
) inInt
) << 16);
57 inline int FixedToInt( Fixed inFixed
)
59 return (((SInt32
) inFixed
) >> 16);
66 #include "wx/window.h"
67 #include "wx/toplevel.h"
69 class wxMacPortStateHelper
71 DECLARE_NO_COPY_CLASS(wxMacPortStateHelper
)
74 wxMacPortStateHelper( GrafPtr newport
) ;
75 wxMacPortStateHelper() ;
76 ~wxMacPortStateHelper() ;
78 void Setup( GrafPtr newport
) ;
80 bool IsCleared() { return m_clip
== NULL
; }
81 GrafPtr
GetCurrentPort() { return m_currentPort
; }
84 GrafPtr m_currentPort
;
87 ThemeDrawingState m_drawingState
;
94 class WXDLLEXPORT wxMacPortSaver
96 DECLARE_NO_COPY_CLASS(wxMacPortSaver
)
99 wxMacPortSaver( GrafPtr port
)
101 ::GetPort( &m_port
) ;
106 ::SetPort( m_port
) ;
112 class WXDLLEXPORT wxMacPortSetter
114 DECLARE_NO_COPY_CLASS(wxMacPortSetter
)
117 wxMacPortSetter( const wxDC
* dc
) ;
120 wxMacPortStateHelper m_ph
;
125 Clips to the visible region of a control within the current port
128 class WXDLLEXPORT wxMacWindowClipper
: public wxMacPortSaver
130 DECLARE_NO_COPY_CLASS(wxMacWindowClipper
)
133 wxMacWindowClipper( const wxWindow
* win
) ;
134 ~wxMacWindowClipper() ;
137 RgnHandle m_formerClip
;
138 RgnHandle m_newClip
;
141 class WXDLLEXPORT wxMacWindowStateSaver
: public wxMacWindowClipper
143 DECLARE_NO_COPY_CLASS(wxMacWindowStateSaver
)
146 wxMacWindowStateSaver( const wxWindow
* win
) ;
147 ~wxMacWindowStateSaver() ;
150 ThemeDrawingState m_themeDrawingState
;
153 #if wxMAC_USE_CORE_GRAPHICS
154 class WXDLLEXPORT wxMacCGContextStateSaver
156 DECLARE_NO_COPY_CLASS(wxMacCGContextStateSaver
)
159 wxMacCGContextStateSaver( CGContextRef cg
)
162 CGContextSaveGState( cg
) ;
164 ~wxMacCGContextStateSaver()
166 CGContextRestoreGState( m_cg
) ;
174 class wxMacDrawingHelper
176 DECLARE_NO_COPY_CLASS(wxMacDrawingHelper)
179 wxMacDrawingHelper( wxWindowMac * theWindow , bool clientArea = false ) ;
180 ~wxMacDrawingHelper() ;
181 bool Ok() { return m_ok ; }
182 void LocalToWindow( Rect *rect) { OffsetRect( rect , m_origin.h , m_origin.v ) ; }
183 void LocalToWindow( Point *pt ) { AddPt( m_origin , pt ) ; }
184 void LocalToWindow( RgnHandle rgn ) { OffsetRgn( rgn , m_origin.h , m_origin.v ) ; }
185 const Point& GetOrigin() { return m_origin ; }
188 GrafPtr m_formerPort ;
189 GrafPtr m_currentPort ;
190 PenState m_savedPenState ;
196 bool wxMacConvertEventToRecord( EventRef event
, EventRecord
*rec
) ;
201 WXDLLEXPORT wxString
wxMacFSSpec2MacFilename( const FSSpec
*spec
) ;
202 WXDLLEXPORT
void wxMacFilename2FSSpec( const wxString
&path
, FSSpec
*spec
) ;
205 WXDLLEXPORT wxString
wxMacFindFolder(short vRefNum
,
207 Boolean createFolder
);
209 template<typename T
> EventParamType
wxMacGetEventParamType() { wxFAIL_MSG( wxT("Unknown Param Type") ) ; return 0 ; }
210 template<> inline EventParamType wxMacGetEventParamType
<RgnHandle
>() { return typeQDRgnHandle
; }
211 template<> inline EventParamType wxMacGetEventParamType
<ControlRef
>() { return typeControlRef
; }
212 template<> inline EventParamType wxMacGetEventParamType
<WindowRef
>() { return typeWindowRef
; }
213 template<> inline EventParamType wxMacGetEventParamType
<MenuRef
>() { return typeMenuRef
; }
214 template<> inline EventParamType wxMacGetEventParamType
<EventRef
>() { return typeEventRef
; }
215 template<> inline EventParamType wxMacGetEventParamType
<Point
>() { return typeQDPoint
; }
216 template<> inline EventParamType wxMacGetEventParamType
<Rect
>() { return typeQDRectangle
; }
217 template<> inline EventParamType wxMacGetEventParamType
<Boolean
>() { return typeBoolean
; }
218 #if TARGET_API_MAC_OSX
219 template<> inline EventParamType wxMacGetEventParamType
<HICommand
>() { return typeHICommand
; }
220 template<> inline EventParamType wxMacGetEventParamType
<HIPoint
>() { return typeHIPoint
; }
221 template<> inline EventParamType wxMacGetEventParamType
<HISize
>() { return typeHISize
; }
222 template<> inline EventParamType wxMacGetEventParamType
<HIRect
>() { return typeHIRect
; }
223 template<> inline EventParamType wxMacGetEventParamType
<void*>() { return typeVoidPtr
; }
225 template<> inline EventParamType wxMacGetEventParamType
<Collection
>() { return typeCollection
; }
226 template<> inline EventParamType wxMacGetEventParamType
<CGContextRef
>() { return typeCGContextRef
; }
229 template<> EventParamType wxMacGetEventParamType<GrafPtr>() { return typeGrafPtr ; }
230 template<> EventParamType wxMacGetEventParamType<OSStatus>() { return typeOSStatus ; }
231 template<> EventParamType wxMacGetEventParamType<CFIndex>() { return typeCFIndex ; }
232 template<> EventParamType wxMacGetEventParamType<GWorldPtr>() { return typeGWorldPtr ; }
235 class wxMacCarbonEvent
245 wxMacCarbonEvent( EventRef event
, bool release
= false )
248 m_release
= release
;
251 wxMacCarbonEvent(UInt32 inClassID
,UInt32 inKind
,EventTime inWhen
= 0 /*now*/,EventAttributes inAttributes
=kEventAttributeNone
)
254 verify_noerr( MacCreateEvent( NULL
, inClassID
, inKind
,inWhen
,inAttributes
,&m_eventRef
) ) ;
261 ReleaseEvent( m_eventRef
) ;
264 OSStatus
Create(UInt32 inClassID
,UInt32 inKind
,EventTime inWhen
= 0 /*now*/,EventAttributes inAttributes
=kEventAttributeNone
)
266 verify( (m_eventRef
== NULL
) || m_release
) ;
267 if ( m_eventRef
&& m_release
)
269 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
SetTime( EventTime inWhen
= 0 /*now*/ )
339 return ::SetEventTime( m_eventRef
, inWhen
? inWhen
: GetCurrentEventTime() ) ;
341 operator EventRef () { return m_eventRef
; }
343 bool IsValid() { return m_eventRef
!= 0 ; }
345 EventRef m_eventRef
;
350 // helper class for allocating and deallocating Universal Proc Ptrs
353 template <typename procType
, typename uppType
, uppType (*newUPP
)(procType
) , void (*disposeUPP
)(uppType
) > class wxMacUPP
356 wxMacUPP( procType proc
)
359 m_upp
= (*newUPP
)( NULL
) ;
364 disposeUPP( m_upp
) ;
366 operator uppType() { return m_upp
; }
371 typedef wxMacUPP
<NMProcPtr
,NMUPP
,NewNMUPP
,DisposeNMUPP
> wxMacNMUPP
;
375 GWorldPtr wxMacCreateGWorld( int width , int height , int depth ) ;
376 void wxMacDestroyGWorld( GWorldPtr gw ) ;
377 PicHandle wxMacCreatePict( GWorldPtr gw , GWorldPtr mask = NULL ) ;
378 CIconHandle wxMacCreateCIcon(GWorldPtr image , GWorldPtr mask , short dstDepth , short iconSize ) ;
379 void wxMacSetColorTableEntry( CTabHandle newColors , int index , int red , int green , int blue ) ;
380 CTabHandle wxMacCreateColorTable( int numColors ) ;
382 void wxMacCreateBitmapButton( ControlButtonContentInfo
*info
, const wxBitmap
& bitmap
, int forceType
= 0 ) ;
383 void wxMacReleaseBitmapButton( ControlButtonContentInfo
*info
) ;
385 #define MAC_WXCOLORREF(a) (*((RGBColor*)&(a)))
386 #define MAC_WXHBITMAP(a) (GWorldPtr(a))
387 #define MAC_WXHMETAFILE(a) (PicHandle(a))
388 #define MAC_WXHICON(a) (IconRef(a))
389 #define MAC_WXHCURSOR(a) (CursHandle(a))
390 #define MAC_WXHRGN(a) (RgnHandle(a))
391 #define MAC_WXHWND(a) (WindowPtr(a))
392 #define MAC_WXRECPTR(a) ((Rect*)a)
393 #define MAC_WXPOINTPTR(a) ((Point*)a)
394 #define MAC_WXHMENU(a) ((MenuHandle)a)
396 struct wxOpaqueWindowRef
398 wxOpaqueWindowRef( WindowRef ref
) { m_data
= ref
; }
399 operator WindowRef() { return m_data
; }
404 void wxMacRectToNative( const wxRect
*wx
, Rect
*n
) ;
405 void wxMacNativeToRect( const Rect
*n
, wxRect
* wx
) ;
406 void wxMacPointToNative( const wxPoint
* wx
, Point
*n
) ;
407 void wxMacNativeToPoint( const Point
*n
, wxPoint
* wx
) ;
409 wxWindow
* wxFindControlFromMacControl(ControlRef inControl
) ;
410 wxTopLevelWindowMac
* wxFindWinFromMacWindow( WindowRef inWindow
) ;
411 wxMenu
* wxFindMenuFromMacMenu(MenuRef inMenuRef
) ;
413 extern wxWindow
* g_MacLastWindow
;
414 pascal OSStatus
wxMacTopLevelMouseEventHandler( EventHandlerCallRef handler
, EventRef event
, void *data
) ;
415 Rect
wxMacGetBoundsForControl( wxWindow
* window
, const wxPoint
& pos
, const wxSize
&size
, bool adjustForOrigin
= true ) ;
417 ControlActionUPP
GetwxMacLiveScrollbarActionProc() ;
422 wxMacControl( wxWindow
* peer
, bool isRootControl
= false ) ;
423 wxMacControl( wxWindow
* peer
, ControlRef control
) ;
424 wxMacControl( wxWindow
* peer
, WXWidget control
) ;
425 virtual ~wxMacControl() ;
429 virtual void Dispose() ;
431 bool Ok() const { return GetControlRef() != NULL
; }
433 virtual ControlRef
* GetControlRefAddr() { return &m_controlRef
; }
434 virtual ControlRef
GetControlRef() const { return m_controlRef
; }
436 virtual void SetReference( SInt32 data
) ;
438 void operator= (ControlRef c) { m_controlRef = c ; }
439 operator ControlRef () { return m_controlRef; }
440 operator ControlRef * () { return &m_controlRef; }
442 // accessing data and values
444 virtual OSStatus
SetData( ControlPartCode inPartCode
, ResType inTag
, Size inSize
, const void * inData
) ;
445 virtual OSStatus
GetData( ControlPartCode inPartCode
, ResType inTag
, Size inBufferSize
, void * inOutBuffer
, Size
* outActualSize
) const ;
446 virtual OSStatus
GetDataSize( ControlPartCode inPartCode
, ResType inTag
, Size
* outActualSize
) const ;
447 virtual OSStatus
SendEvent( EventRef ref
, OptionBits inOptions
= 0 ) ;
448 virtual OSStatus
SendHICommand( HICommand
&command
, OptionBits inOptions
= 0 ) ;
450 virtual OSStatus
SendHICommand( UInt32 commandID
, OptionBits inOptions
= 0 ) ;
452 virtual SInt32
GetValue() const ;
453 virtual SInt32
GetMaximum() const ;
454 virtual SInt32
GetMinimum() const ;
456 virtual void SetValue( SInt32 v
) ;
457 virtual void SetMinimum( SInt32 v
) ;
458 virtual void SetMaximum( SInt32 v
) ;
460 virtual void SetValueAndRange( SInt32 value
, SInt32 minimum
, SInt32 maximum
) ;
461 virtual void SetRange( SInt32 minimum
, SInt32 maximum
) ;
463 virtual OSStatus
SetFocus( ControlFocusPart focusPart
) ;
464 virtual bool HasFocus() const ;
465 virtual bool NeedsFocusRect() const ;
466 virtual void SetNeedsFocusRect( bool needs
) ;
470 Size
GetDataSize( ControlPartCode inPartCode
, ResType inTag
) const
473 verify_noerr( GetDataSize( inPartCode
, inTag
, &sz
) ) ;
476 template <typename T
> OSStatus
SetData( ControlPartCode inPartCode
, ResType inTag
, const T
*data
)
478 return SetData( inPartCode
, inTag
, sizeof( T
) , data
) ;
480 template <typename T
> OSStatus
SetData( ControlPartCode inPartCode
, ResType inTag
, const T
& data
)
482 return SetData( inPartCode
, inTag
, sizeof( T
) , &data
) ;
484 template <typename T
> OSStatus
GetData( ControlPartCode inPartCode
, ResType inTag
, T
*data
) const
487 return GetData( inPartCode
, inTag
, sizeof( T
) , data
, &dummy
) ;
489 template <typename T
> T
GetData( ControlPartCode inPartCode
, ResType inTag
) const
492 verify_noerr( GetData
<T
>( inPartCode
, inTag
, &value
) ) ;
496 // Flash the control for the specified amount of time
497 virtual void Flash( ControlPartCode part
, UInt32 ticks
= 8 ) ;
499 virtual void VisibilityChanged( bool shown
) ;
500 virtual void SuperChangedPosition() ;
503 virtual void SetFont( const wxFont
& font
, const wxColour
& foreground
, long windowStyle
) ;
504 virtual void SetBackground( const wxBrush
&brush
) ;
505 virtual ControlPartCode
HandleKey( SInt16 keyCode
, SInt16 charCode
, EventModifiers modifiers
) ;
506 void SetActionProc( ControlActionUPP actionProc
) ;
507 void SetViewSize( SInt32 viewSize
) ;
508 SInt32
GetViewSize() const ;
510 virtual bool IsVisible() const ;
511 virtual void SetVisibility( bool visible
, bool redraw
) ;
512 virtual bool IsEnabled() const ;
513 virtual bool IsActive() const ;
514 virtual void Enable( bool enable
) ;
516 // invalidates this control and all children
517 virtual void InvalidateWithChildren() ;
518 virtual void SetDrawingEnabled( bool enable
) ;
520 virtual bool GetNeedsDisplay() const ;
522 // where is in native window relative coordinates
523 virtual void SetNeedsDisplay( RgnHandle where
) ;
524 // where is in native window relative coordinates
525 virtual void SetNeedsDisplay( Rect
* where
= NULL
) ;
527 virtual void ScrollRect( const wxRect
&rect
, int dx
, int dy
) ;
529 // in native parent window relative coordinates
530 virtual void GetRect( Rect
*r
) ;
532 // in native parent window relative coordinates
533 virtual void SetRect( Rect
*r
) ;
535 virtual void GetRectInWindowCoords( Rect
*r
) ;
536 virtual void GetBestRect( Rect
*r
) ;
537 virtual void SetTitle( const wxString
&title
) ;
538 // converts from Toplevel-Content relative to local
539 static void Convert( wxPoint
*pt
, wxMacControl
*convert
, wxMacControl
*to
) ;
541 virtual void GetFeatures( UInt32
*features
) ;
542 virtual OSStatus
GetRegion( ControlPartCode partCode
, RgnHandle region
) ;
543 virtual OSStatus
SetZOrder( bool above
, wxMacControl
* other
) ;
544 // to be moved into a databrowser subclass
546 virtual OSStatus
SetSelectionFlags( DataBrowserSelectionFlags
) ;
547 virtual OSStatus
AddListViewColumn( DataBrowserListViewColumnDesc
*columnDesc
,
548 DataBrowserTableViewColumnIndex position
) ;
549 virtual OSStatus
AutoSizeListViewColumns() ;
550 virtual OSStatus
SetHasScrollBars( bool horiz
, bool vert
) ;
551 virtual OSStatus
SetTableViewHiliteStyle( DataBrowserTableViewHiliteStyle hiliteStyle
) ;
552 virtual OSStatus
SetListViewHeaderBtnHeight(UInt16 height
) ;
553 virtual OSStatus
SetCallbacks(const DataBrowserCallbacks
* callbacks
) ;
554 virtual OSStatus
UpdateItems( DataBrowserItemID container
, UInt32 numItems
,
555 const DataBrowserItemID
* items
,
556 DataBrowserPropertyID preSortProperty
,
557 DataBrowserPropertyID propertyID
) ;
558 virtual OSStatus
AddItems( DataBrowserItemID container
, UInt32 numItems
,
559 const DataBrowserItemID
* items
,
560 DataBrowserPropertyID preSortProperty
) ;
561 virtual OSStatus
RemoveItems( DataBrowserItemID container
, UInt32 numItems
,
562 const DataBrowserItemID
* items
,
563 DataBrowserPropertyID preSortProperty
) ;
564 virtual OSStatus
RevealItem( DataBrowserItemID item
,
565 DataBrowserPropertyID propertyID
,
566 DataBrowserRevealOptions options
) ;
567 virtual OSStatus
GetSelectionAnchor( DataBrowserItemID
* first
, DataBrowserItemID
* last
) ;
568 virtual bool IsItemSelected( DataBrowserItemID item
) ;
569 virtual OSStatus
SetSelectedItems(UInt32 numItems
,
570 const DataBrowserItemID
* items
,
571 DataBrowserSetOption operation
) ;
573 // to be moved into a tab control class
575 virtual OSStatus
SetTabEnabled( SInt16 tabNo
, bool enable
) ;
576 bool IsCompositing() { return m_isCompositing
; }
577 bool IsRootControl() { return m_isRootControl
; }
579 ControlRef m_controlRef
;
583 bool m_needsFocusRect
;
584 bool m_isCompositing
;
585 bool m_isRootControl
;
588 #if wxMAC_USE_CORE_GRAPHICS
590 class WXDLLEXPORT wxMacCGPath
: public wxGraphicPath
592 DECLARE_NO_COPY_CLASS(wxMacCGPath
)
597 // Starts a new subpath at
598 void MoveToPoint( wxCoord x1
, wxCoord y1
) ;
599 void AddLineToPoint( wxCoord x1
, wxCoord y1
) ;
600 void AddRectangle( wxCoord x
, wxCoord y
, wxCoord w
, wxCoord h
) ;
601 void AddCircle( wxCoord x
, wxCoord y
, wxCoord r
) ;
603 // closes the current subpath
604 void CloseSubpath() ;
606 CGPathRef
GetPath() const ;
608 CGMutablePathRef m_path
;
611 class WXDLLEXPORT wxMacCGContext
: public wxGraphicContext
613 DECLARE_NO_COPY_CLASS(wxMacCGContext
)
616 wxMacCGContext( CGrafPtr port
) ;
617 wxMacCGContext( CGContextRef cgcontext
) ;
621 virtual void Clip( const wxRegion
®ion
) ;
622 virtual void StrokePath( const wxGraphicPath
*p
) ;
623 virtual void DrawPath( const wxGraphicPath
*p
, int fillStyle
= wxWINDING_RULE
) ;
624 virtual void FillPath( const wxGraphicPath
*p
, const wxColor
&fillColor
, int fillStyle
= wxWINDING_RULE
) ;
626 virtual wxGraphicPath
* CreatePath() ;
627 virtual void SetPen( const wxPen
&pen
) ;
628 virtual void SetBrush( const wxBrush
&brush
) ;
629 CGContextRef
GetNativeContext() ;
630 void SetNativeContext( CGContextRef cg
) ;
631 CGPathDrawingMode
GetDrawingMode() const { return m_mode
; }
633 CGContextRef m_cgContext
;
635 CGPathDrawingMode m_mode
;
640 #endif // wxMAC_USE_CORE_GRAPHICS
644 CGColorSpaceRef
wxMacGetGenericRGBColorSpace(void) ;
645 void wxMacMemoryBufferReleaseProc(void *info
, const void *data
, size_t size
) ;
649 class WXDLLEXPORT wxBitmapRefData
: public wxGDIRefData
651 DECLARE_NO_COPY_CLASS(wxBitmapRefData
)
653 friend class WXDLLEXPORT wxIcon
;
654 friend class WXDLLEXPORT wxCursor
;
656 wxBitmapRefData(int width
, int height
, int depth
);
661 bool Ok() const { return m_ok
; }
662 void SetOk( bool isOk
) { m_ok
= isOk
; }
664 void SetWidth( int width
) { m_width
= width
; }
665 void SetHeight( int height
) { m_height
= height
; }
666 void SetDepth( int depth
) { m_depth
= depth
; }
668 int GetWidth() const { return m_width
; }
669 int GetHeight() const { return m_height
; }
670 int GetDepth() const { return m_depth
; }
672 void *GetRawAccess() const ;
673 void *BeginRawAccess() ;
674 void EndRawAccess() ;
676 bool HasAlpha() const { return m_hasAlpha
; }
677 void UseAlpha( bool useAlpha
) ;
681 wxPalette m_bitmapPalette
;
682 #endif // wxUSE_PALETTE
684 wxMask
* m_bitmapMask
; // Optional mask
686 CGImageRef
CGImageCreate() const ;
689 // returns true if the bitmap has a size that
690 // can be natively transferred into a true icon
691 // if no is returned GetIconRef will still produce
692 // an icon but it will be generated via a PICT and
693 // rescaled to 16 x 16
694 bool HasNativeSize() ;
696 // caller should increase ref count if needed longer
697 // than the bitmap exists
698 IconRef
GetIconRef() ;
700 // returns a Pict from the bitmap content
701 PicHandle
GetPictHandle() ;
702 GWorldPtr
GetHBITMAP(GWorldPtr
* mask
= NULL
) const ;
703 void UpdateAlphaMask() const ;
706 bool Create(int width
, int height
, int depth
) ;
714 wxMemoryBuffer m_memBuf
;
715 int m_rawAccessCount
;
718 mutable CGImageRef m_cgImageRef
;
721 PicHandle m_pictHandle
;
723 GWorldPtr m_hMaskBitmap
;
724 wxMemoryBuffer m_maskMemBuf
;
725 int m_maskBytesPerRow
;
728 class WXDLLEXPORT wxIconRefData
: public wxGDIRefData
732 wxIconRefData( WXHICON
) ;
733 virtual ~wxIconRefData() { Free(); }
738 void SetWidth( int width
) { m_width
= width
; }
739 void SetHeight( int height
) { m_height
= height
; }
741 int GetWidth() const { return m_width
; }
742 int GetHeight() const { return m_height
; }
744 WXHICON
GetHICON() const { return (WXHICON
) m_iconRef
; }
753 ControlRef
wxMacFindControlUnderMouse( wxTopLevelWindowMac
* toplevelWindow
, Point location
, WindowRef window
, ControlPartCode
*outPart
) ;
757 #define wxMAC_DEFINE_PROC_GETTER( UPP , x ) \
760 static UPP sHandler = NULL; \
761 if ( sHandler == NULL ) \
762 sHandler = New##UPP( x ); \
766 //---------------------------------------------------------------------------
767 // wxMac string conversions
768 //---------------------------------------------------------------------------
770 void wxMacSetupConverters() ;
771 void wxMacCleanupConverters() ;
773 void wxMacStringToPascal( const wxString
&from
, StringPtr to
) ;
774 wxString
wxMacMakeStringFromPascal( ConstStringPtr from
) ;
778 wxString
wxMacFSRefToPath( const FSRef
*fsRef
, CFStringRef additionalPathComponent
= NULL
) ;
779 OSStatus
wxMacPathToFSRef( const wxString
&path
, FSRef
*fsRef
) ;
780 wxString
wxMacHFSUniStrToString( ConstHFSUniStr255Param uniname
) ;