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 // if rect = NULL, entire view
528 virtual void ScrollRect( wxRect
*rect
, int dx
, int dy
) ;
530 // in native parent window relative coordinates
531 virtual void GetRect( Rect
*r
) ;
533 // in native parent window relative coordinates
534 virtual void SetRect( Rect
*r
) ;
536 virtual void GetRectInWindowCoords( Rect
*r
) ;
537 virtual void GetBestRect( Rect
*r
) ;
538 virtual void SetTitle( const wxString
&title
) ;
539 // converts from Toplevel-Content relative to local
540 static void Convert( wxPoint
*pt
, wxMacControl
*convert
, wxMacControl
*to
) ;
542 virtual void GetFeatures( UInt32
*features
) ;
543 virtual OSStatus
GetRegion( ControlPartCode partCode
, RgnHandle region
) ;
544 virtual OSStatus
SetZOrder( bool above
, wxMacControl
* other
) ;
545 // to be moved into a databrowser subclass
547 virtual OSStatus
SetSelectionFlags( DataBrowserSelectionFlags
) ;
548 virtual OSStatus
AddListViewColumn( DataBrowserListViewColumnDesc
*columnDesc
,
549 DataBrowserTableViewColumnIndex position
) ;
550 virtual OSStatus
AutoSizeListViewColumns() ;
551 virtual OSStatus
SetHasScrollBars( bool horiz
, bool vert
) ;
552 virtual OSStatus
SetTableViewHiliteStyle( DataBrowserTableViewHiliteStyle hiliteStyle
) ;
553 virtual OSStatus
SetListViewHeaderBtnHeight(UInt16 height
) ;
554 virtual OSStatus
SetCallbacks(const DataBrowserCallbacks
* callbacks
) ;
555 virtual OSStatus
UpdateItems( DataBrowserItemID container
, UInt32 numItems
,
556 const DataBrowserItemID
* items
,
557 DataBrowserPropertyID preSortProperty
,
558 DataBrowserPropertyID propertyID
) ;
559 virtual OSStatus
AddItems( DataBrowserItemID container
, UInt32 numItems
,
560 const DataBrowserItemID
* items
,
561 DataBrowserPropertyID preSortProperty
) ;
562 virtual OSStatus
RemoveItems( DataBrowserItemID container
, UInt32 numItems
,
563 const DataBrowserItemID
* items
,
564 DataBrowserPropertyID preSortProperty
) ;
565 virtual OSStatus
RevealItem( DataBrowserItemID item
,
566 DataBrowserPropertyID propertyID
,
567 DataBrowserRevealOptions options
) ;
568 virtual OSStatus
GetSelectionAnchor( DataBrowserItemID
* first
, DataBrowserItemID
* last
) ;
569 virtual bool IsItemSelected( DataBrowserItemID item
) ;
570 virtual OSStatus
SetSelectedItems(UInt32 numItems
,
571 const DataBrowserItemID
* items
,
572 DataBrowserSetOption operation
) ;
574 // to be moved into a tab control class
576 virtual OSStatus
SetTabEnabled( SInt16 tabNo
, bool enable
) ;
577 bool IsCompositing() { return m_isCompositing
; }
578 bool IsRootControl() { return m_isRootControl
; }
580 ControlRef m_controlRef
;
584 bool m_needsFocusRect
;
585 bool m_isCompositing
;
586 bool m_isRootControl
;
589 #if wxMAC_USE_CORE_GRAPHICS
591 class WXDLLEXPORT wxMacCGPath
: public wxGraphicPath
593 DECLARE_NO_COPY_CLASS(wxMacCGPath
)
598 // Starts a new subpath at
599 void MoveToPoint( wxCoord x1
, wxCoord y1
) ;
600 void AddLineToPoint( wxCoord x1
, wxCoord y1
) ;
601 void AddRectangle( wxCoord x
, wxCoord y
, wxCoord w
, wxCoord h
) ;
602 void AddCircle( wxCoord x
, wxCoord y
, wxCoord r
) ;
604 // closes the current subpath
605 void CloseSubpath() ;
607 CGPathRef
GetPath() const ;
609 CGMutablePathRef m_path
;
612 class WXDLLEXPORT wxMacCGContext
: public wxGraphicContext
614 DECLARE_NO_COPY_CLASS(wxMacCGContext
)
617 wxMacCGContext( CGrafPtr port
) ;
618 wxMacCGContext( CGContextRef cgcontext
) ;
622 virtual void Clip( const wxRegion
®ion
) ;
623 virtual void StrokePath( const wxGraphicPath
*p
) ;
624 virtual void DrawPath( const wxGraphicPath
*p
, int fillStyle
= wxWINDING_RULE
) ;
625 virtual void FillPath( const wxGraphicPath
*p
, const wxColor
&fillColor
, int fillStyle
= wxWINDING_RULE
) ;
627 virtual wxGraphicPath
* CreatePath() ;
628 virtual void SetPen( const wxPen
&pen
) ;
629 virtual void SetBrush( const wxBrush
&brush
) ;
630 CGContextRef
GetNativeContext() ;
631 void SetNativeContext( CGContextRef cg
) ;
632 CGPathDrawingMode
GetDrawingMode() const { return m_mode
; }
634 CGContextRef m_cgContext
;
636 CGPathDrawingMode m_mode
;
641 #endif // wxMAC_USE_CORE_GRAPHICS
645 CGColorSpaceRef
wxMacGetGenericRGBColorSpace(void) ;
646 void wxMacMemoryBufferReleaseProc(void *info
, const void *data
, size_t size
) ;
650 class WXDLLEXPORT wxBitmapRefData
: public wxGDIRefData
652 DECLARE_NO_COPY_CLASS(wxBitmapRefData
)
654 friend class WXDLLEXPORT wxIcon
;
655 friend class WXDLLEXPORT wxCursor
;
657 wxBitmapRefData(int width
, int height
, int depth
);
662 bool Ok() const { return m_ok
; }
663 void SetOk( bool isOk
) { m_ok
= isOk
; }
665 void SetWidth( int width
) { m_width
= width
; }
666 void SetHeight( int height
) { m_height
= height
; }
667 void SetDepth( int depth
) { m_depth
= depth
; }
669 int GetWidth() const { return m_width
; }
670 int GetHeight() const { return m_height
; }
671 int GetDepth() const { return m_depth
; }
673 void *GetRawAccess() const ;
674 void *BeginRawAccess() ;
675 void EndRawAccess() ;
677 bool HasAlpha() const { return m_hasAlpha
; }
678 void UseAlpha( bool useAlpha
) ;
682 wxPalette m_bitmapPalette
;
683 #endif // wxUSE_PALETTE
685 wxMask
* m_bitmapMask
; // Optional mask
687 CGImageRef
CGImageCreate() const ;
690 // returns true if the bitmap has a size that
691 // can be natively transferred into a true icon
692 // if no is returned GetIconRef will still produce
693 // an icon but it will be generated via a PICT and
694 // rescaled to 16 x 16
695 bool HasNativeSize() ;
697 // caller should increase ref count if needed longer
698 // than the bitmap exists
699 IconRef
GetIconRef() ;
701 // returns a Pict from the bitmap content
702 PicHandle
GetPictHandle() ;
703 GWorldPtr
GetHBITMAP(GWorldPtr
* mask
= NULL
) const ;
704 void UpdateAlphaMask() const ;
707 bool Create(int width
, int height
, int depth
) ;
715 wxMemoryBuffer m_memBuf
;
716 int m_rawAccessCount
;
719 mutable CGImageRef m_cgImageRef
;
722 PicHandle m_pictHandle
;
724 GWorldPtr m_hMaskBitmap
;
725 wxMemoryBuffer m_maskMemBuf
;
726 int m_maskBytesPerRow
;
729 class WXDLLEXPORT wxIconRefData
: public wxGDIRefData
733 wxIconRefData( WXHICON
) ;
734 virtual ~wxIconRefData() { Free(); }
739 void SetWidth( int width
) { m_width
= width
; }
740 void SetHeight( int height
) { m_height
= height
; }
742 int GetWidth() const { return m_width
; }
743 int GetHeight() const { return m_height
; }
745 WXHICON
GetHICON() const { return (WXHICON
) m_iconRef
; }
754 ControlRef
wxMacFindControlUnderMouse( wxTopLevelWindowMac
* toplevelWindow
, Point location
, WindowRef window
, ControlPartCode
*outPart
) ;
758 #define wxMAC_DEFINE_PROC_GETTER( UPP , x ) \
761 static UPP sHandler = NULL; \
762 if ( sHandler == NULL ) \
763 sHandler = New##UPP( x ); \
767 //---------------------------------------------------------------------------
768 // wxMac string conversions
769 //---------------------------------------------------------------------------
771 void wxMacSetupConverters() ;
772 void wxMacCleanupConverters() ;
774 void wxMacStringToPascal( const wxString
&from
, StringPtr to
) ;
775 wxString
wxMacMakeStringFromPascal( ConstStringPtr from
) ;
779 wxString
wxMacFSRefToPath( const FSRef
*fsRef
, CFStringRef additionalPathComponent
= NULL
) ;
780 OSStatus
wxMacPathToFSRef( const wxString
&path
, FSRef
*fsRef
) ;
781 wxString
wxMacHFSUniStrToString( ConstHFSUniStr255Param uniname
) ;