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>
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
) ;
275 OSStatus err
= MacCreateEvent( NULL
, inClassID
, inKind
,inWhen
,inAttributes
,&m_eventRef
) ;
281 OSStatus
GetParameter( EventParamName inName
, EventParamType inDesiredType
, UInt32 inBufferSize
, void * outData
) ;
283 template <typename T
> OSStatus
GetParameter( EventParamName inName
, EventParamType type
, T
*data
)
285 return GetParameter( inName
, type
, sizeof( T
) , data
) ;
287 template <typename T
> OSStatus
GetParameter( EventParamName inName
, T
*data
)
289 return GetParameter
<T
>( inName
, wxMacGetEventParamType
<T
>() , data
) ;
292 template <typename T
> T
GetParameter( EventParamName inName
)
295 verify_noerr( GetParameter
<T
>( inName
, &value
) ) ;
298 template <typename T
> T
GetParameter( EventParamName inName
, EventParamType inDesiredType
)
301 verify_noerr( GetParameter
<T
>( inName
, inDesiredType
, &value
) ) ;
305 OSStatus
SetParameter( EventParamName inName
, EventParamType inType
, UInt32 inSize
, const void * inData
) ;
306 template <typename T
> OSStatus
SetParameter( EventParamName inName
, EventParamType inDesiredType
, const T
*data
)
308 return SetParameter( inName
, inDesiredType
, sizeof( T
) , data
) ;
310 template <typename T
> OSStatus
SetParameter( EventParamName inName
, EventParamType inDesiredType
, const T
& data
)
312 return SetParameter
<T
>( inName
, inDesiredType
, &data
) ;
314 template <typename T
> OSStatus
SetParameter( EventParamName inName
, const T
*data
)
316 return SetParameter
<T
>( inName
, wxMacGetEventParamType
<T
>() , data
) ;
318 template <typename T
> OSStatus
SetParameter( EventParamName inName
, const T
& data
)
320 return SetParameter
<T
>( inName
, wxMacGetEventParamType
<T
>() , &data
) ;
324 return ::GetEventClass( m_eventRef
) ;
328 return ::GetEventKind( m_eventRef
) ;
332 return ::GetEventTime( m_eventRef
) ;
336 return EventTimeToTicks( GetTime() ) ;
338 OSStatus
SetTime( EventTime inWhen
= 0 /*now*/ )
340 return ::SetEventTime( m_eventRef
, inWhen
? inWhen
: GetCurrentEventTime() ) ;
342 operator EventRef () { return m_eventRef
; }
344 bool IsValid() { return m_eventRef
!= 0 ; }
346 EventRef m_eventRef
;
351 // helper class for allocating and deallocating Universal Proc Ptrs
354 template <typename procType
, typename uppType
, uppType (*newUPP
)(procType
) , void (*disposeUPP
)(uppType
) > class wxMacUPP
357 wxMacUPP( procType proc
)
360 m_upp
= (*newUPP
)( NULL
) ;
365 disposeUPP( m_upp
) ;
367 operator uppType() { return m_upp
; }
372 typedef wxMacUPP
<NMProcPtr
,NMUPP
,NewNMUPP
,DisposeNMUPP
> wxMacNMUPP
;
376 GWorldPtr wxMacCreateGWorld( int width , int height , int depth ) ;
377 void wxMacDestroyGWorld( GWorldPtr gw ) ;
378 PicHandle wxMacCreatePict( GWorldPtr gw , GWorldPtr mask = NULL ) ;
379 CIconHandle wxMacCreateCIcon(GWorldPtr image , GWorldPtr mask , short dstDepth , short iconSize ) ;
380 void wxMacSetColorTableEntry( CTabHandle newColors , int index , int red , int green , int blue ) ;
381 CTabHandle wxMacCreateColorTable( int numColors ) ;
383 void wxMacCreateBitmapButton( ControlButtonContentInfo
*info
, const wxBitmap
& bitmap
, int forceType
= 0 ) ;
384 void wxMacReleaseBitmapButton( ControlButtonContentInfo
*info
) ;
386 #define MAC_WXCOLORREF(a) (*((RGBColor*)&(a)))
387 #define MAC_WXHBITMAP(a) (GWorldPtr(a))
388 #define MAC_WXHMETAFILE(a) (PicHandle(a))
389 #define MAC_WXHICON(a) (IconRef(a))
390 #define MAC_WXHCURSOR(a) (CursHandle(a))
391 #define MAC_WXHRGN(a) (RgnHandle(a))
392 #define MAC_WXHWND(a) (WindowPtr(a))
393 #define MAC_WXRECPTR(a) ((Rect*)a)
394 #define MAC_WXPOINTPTR(a) ((Point*)a)
395 #define MAC_WXHMENU(a) ((MenuHandle)a)
397 struct wxOpaqueWindowRef
399 wxOpaqueWindowRef( WindowRef ref
) { m_data
= ref
; }
400 operator WindowRef() { return m_data
; }
405 void wxMacRectToNative( const wxRect
*wx
, Rect
*n
) ;
406 void wxMacNativeToRect( const Rect
*n
, wxRect
* wx
) ;
407 void wxMacPointToNative( const wxPoint
* wx
, Point
*n
) ;
408 void wxMacNativeToPoint( const Point
*n
, wxPoint
* wx
) ;
410 wxWindow
* wxFindControlFromMacControl(ControlRef inControl
) ;
411 wxTopLevelWindowMac
* wxFindWinFromMacWindow( WindowRef inWindow
) ;
412 wxMenu
* wxFindMenuFromMacMenu(MenuRef inMenuRef
) ;
414 extern wxWindow
* g_MacLastWindow
;
415 pascal OSStatus
wxMacTopLevelMouseEventHandler( EventHandlerCallRef handler
, EventRef event
, void *data
) ;
416 Rect
wxMacGetBoundsForControl( wxWindow
* window
, const wxPoint
& pos
, const wxSize
&size
, bool adjustForOrigin
= true ) ;
418 ControlActionUPP
GetwxMacLiveScrollbarActionProc() ;
423 wxMacControl( wxWindow
* peer
, bool isRootControl
= false ) ;
424 wxMacControl( wxWindow
* peer
, ControlRef control
) ;
425 wxMacControl( wxWindow
* peer
, WXWidget control
) ;
426 virtual ~wxMacControl() ;
430 virtual void Dispose() ;
432 bool Ok() const { return GetControlRef() != NULL
; }
434 virtual ControlRef
* GetControlRefAddr() { return &m_controlRef
; }
435 virtual ControlRef
GetControlRef() const { return m_controlRef
; }
437 virtual void SetReference( SInt32 data
) ;
439 void operator= (ControlRef c) { m_controlRef = c ; }
440 operator ControlRef () { return m_controlRef; }
441 operator ControlRef * () { return &m_controlRef; }
443 // accessing data and values
445 virtual OSStatus
SetData( ControlPartCode inPartCode
, ResType inTag
, Size inSize
, const void * inData
) ;
446 virtual OSStatus
GetData( ControlPartCode inPartCode
, ResType inTag
, Size inBufferSize
, void * inOutBuffer
, Size
* outActualSize
) const ;
447 virtual OSStatus
GetDataSize( ControlPartCode inPartCode
, ResType inTag
, Size
* outActualSize
) const ;
448 virtual OSStatus
SendEvent( EventRef ref
, OptionBits inOptions
= 0 ) ;
449 virtual OSStatus
SendHICommand( HICommand
&command
, OptionBits inOptions
= 0 ) ;
451 virtual OSStatus
SendHICommand( UInt32 commandID
, OptionBits inOptions
= 0 ) ;
453 virtual SInt32
GetValue() const ;
454 virtual SInt32
GetMaximum() const ;
455 virtual SInt32
GetMinimum() const ;
457 virtual void SetValue( SInt32 v
) ;
458 virtual void SetMinimum( SInt32 v
) ;
459 virtual void SetMaximum( SInt32 v
) ;
461 virtual void SetValueAndRange( SInt32 value
, SInt32 minimum
, SInt32 maximum
) ;
462 virtual void SetRange( SInt32 minimum
, SInt32 maximum
) ;
464 virtual OSStatus
SetFocus( ControlFocusPart focusPart
) ;
465 virtual bool HasFocus() const ;
466 virtual bool NeedsFocusRect() const ;
467 virtual void SetNeedsFocusRect( bool needs
) ;
471 Size
GetDataSize( ControlPartCode inPartCode
, ResType inTag
) const
474 verify_noerr( GetDataSize( inPartCode
, inTag
, &sz
) ) ;
477 template <typename T
> OSStatus
SetData( ControlPartCode inPartCode
, ResType inTag
, const T
*data
)
479 return SetData( inPartCode
, inTag
, sizeof( T
) , data
) ;
481 template <typename T
> OSStatus
SetData( ControlPartCode inPartCode
, ResType inTag
, const T
& data
)
483 return SetData( inPartCode
, inTag
, sizeof( T
) , &data
) ;
485 template <typename T
> OSStatus
GetData( ControlPartCode inPartCode
, ResType inTag
, T
*data
) const
488 return GetData( inPartCode
, inTag
, sizeof( T
) , data
, &dummy
) ;
490 template <typename T
> T
GetData( ControlPartCode inPartCode
, ResType inTag
) const
493 verify_noerr( GetData
<T
>( inPartCode
, inTag
, &value
) ) ;
497 // Flash the control for the specified amount of time
498 virtual void Flash( ControlPartCode part
, UInt32 ticks
= 8 ) ;
500 virtual void VisibilityChanged( bool shown
) ;
501 virtual void SuperChangedPosition() ;
504 virtual void SetFont( const wxFont
& font
, const wxColour
& foreground
, long windowStyle
) ;
505 virtual void SetBackground( const wxBrush
&brush
) ;
506 virtual ControlPartCode
HandleKey( SInt16 keyCode
, SInt16 charCode
, EventModifiers modifiers
) ;
507 void SetActionProc( ControlActionUPP actionProc
) ;
508 void SetViewSize( SInt32 viewSize
) ;
509 SInt32
GetViewSize() const ;
511 virtual bool IsVisible() const ;
512 virtual void SetVisibility( bool visible
, bool redraw
) ;
513 virtual bool IsEnabled() const ;
514 virtual bool IsActive() const ;
515 virtual void Enable( bool enable
) ;
517 // invalidates this control and all children
518 virtual void InvalidateWithChildren() ;
519 virtual void SetDrawingEnabled( bool enable
) ;
521 virtual bool GetNeedsDisplay() const ;
523 // where is in native window relative coordinates
524 virtual void SetNeedsDisplay( RgnHandle where
) ;
525 // where is in native window relative coordinates
526 virtual void SetNeedsDisplay( Rect
* where
= NULL
) ;
528 // if rect = NULL, entire view
529 virtual void ScrollRect( wxRect
*rect
, int dx
, int dy
) ;
531 // in native parent window relative coordinates
532 virtual void GetRect( Rect
*r
) ;
534 // in native parent window relative coordinates
535 virtual void SetRect( Rect
*r
) ;
537 virtual void GetRectInWindowCoords( Rect
*r
) ;
538 virtual void GetBestRect( Rect
*r
) ;
539 virtual void SetTitle( const wxString
&title
) ;
540 // converts from Toplevel-Content relative to local
541 static void Convert( wxPoint
*pt
, wxMacControl
*convert
, wxMacControl
*to
) ;
543 virtual void GetFeatures( UInt32
*features
) ;
544 virtual OSStatus
GetRegion( ControlPartCode partCode
, RgnHandle region
) ;
545 virtual OSStatus
SetZOrder( bool above
, wxMacControl
* other
) ;
546 // to be moved into a databrowser subclass
548 virtual OSStatus
SetSelectionFlags( DataBrowserSelectionFlags
) ;
549 virtual OSStatus
AddListViewColumn( DataBrowserListViewColumnDesc
*columnDesc
,
550 DataBrowserTableViewColumnIndex position
) ;
551 virtual OSStatus
AutoSizeListViewColumns() ;
552 virtual OSStatus
SetHasScrollBars( bool horiz
, bool vert
) ;
553 virtual OSStatus
SetTableViewHiliteStyle( DataBrowserTableViewHiliteStyle hiliteStyle
) ;
554 virtual OSStatus
SetListViewHeaderBtnHeight(UInt16 height
) ;
555 virtual OSStatus
SetCallbacks(const DataBrowserCallbacks
* callbacks
) ;
556 virtual OSStatus
UpdateItems( DataBrowserItemID container
, UInt32 numItems
,
557 const DataBrowserItemID
* items
,
558 DataBrowserPropertyID preSortProperty
,
559 DataBrowserPropertyID propertyID
) ;
560 virtual OSStatus
AddItems( DataBrowserItemID container
, UInt32 numItems
,
561 const DataBrowserItemID
* items
,
562 DataBrowserPropertyID preSortProperty
) ;
563 virtual OSStatus
RemoveItems( DataBrowserItemID container
, UInt32 numItems
,
564 const DataBrowserItemID
* items
,
565 DataBrowserPropertyID preSortProperty
) ;
566 virtual OSStatus
RevealItem( DataBrowserItemID item
,
567 DataBrowserPropertyID propertyID
,
568 DataBrowserRevealOptions options
) ;
569 virtual OSStatus
GetSelectionAnchor( DataBrowserItemID
* first
, DataBrowserItemID
* last
) ;
570 virtual bool IsItemSelected( DataBrowserItemID item
) ;
571 virtual OSStatus
SetSelectedItems(UInt32 numItems
,
572 const DataBrowserItemID
* items
,
573 DataBrowserSetOption operation
) ;
575 // to be moved into a tab control class
577 virtual OSStatus
SetTabEnabled( SInt16 tabNo
, bool enable
) ;
578 bool IsCompositing() { return m_isCompositing
; }
579 bool IsRootControl() { return m_isRootControl
; }
581 ControlRef m_controlRef
;
585 bool m_needsFocusRect
;
586 bool m_isCompositing
;
587 bool m_isRootControl
;
590 #if wxMAC_USE_CORE_GRAPHICS
592 class WXDLLEXPORT wxMacCGPath
: public wxGraphicPath
594 DECLARE_NO_COPY_CLASS(wxMacCGPath
)
599 // Starts a new subpath at
600 void MoveToPoint( wxCoord x1
, wxCoord y1
) ;
601 void AddLineToPoint( wxCoord x1
, wxCoord y1
) ;
602 void AddRectangle( wxCoord x
, wxCoord y
, wxCoord w
, wxCoord h
) ;
603 void AddCircle( wxCoord x
, wxCoord y
, wxCoord r
) ;
605 // closes the current subpath
606 void CloseSubpath() ;
608 CGPathRef
GetPath() const ;
610 CGMutablePathRef m_path
;
613 class WXDLLEXPORT wxMacCGContext
: public wxGraphicContext
615 DECLARE_NO_COPY_CLASS(wxMacCGContext
)
618 wxMacCGContext( CGrafPtr port
) ;
619 wxMacCGContext( CGContextRef cgcontext
) ;
623 virtual void Clip( const wxRegion
®ion
) ;
624 virtual void StrokePath( const wxGraphicPath
*p
) ;
625 virtual void DrawPath( const wxGraphicPath
*p
, int fillStyle
= wxWINDING_RULE
) ;
626 virtual void FillPath( const wxGraphicPath
*p
, const wxColor
&fillColor
, int fillStyle
= wxWINDING_RULE
) ;
628 virtual wxGraphicPath
* CreatePath() ;
629 virtual void SetPen( const wxPen
&pen
) ;
630 virtual void SetBrush( const wxBrush
&brush
) ;
631 CGContextRef
GetNativeContext() ;
632 void SetNativeContext( CGContextRef cg
) ;
633 CGPathDrawingMode
GetDrawingMode() const { return m_mode
; }
635 CGContextRef m_cgContext
;
637 CGPathDrawingMode m_mode
;
642 #endif // wxMAC_USE_CORE_GRAPHICS
646 CGColorSpaceRef
wxMacGetGenericRGBColorSpace(void) ;
647 void wxMacMemoryBufferReleaseProc(void *info
, const void *data
, size_t size
) ;
651 class WXDLLEXPORT wxBitmapRefData
: public wxGDIRefData
653 DECLARE_NO_COPY_CLASS(wxBitmapRefData
)
655 friend class WXDLLEXPORT wxIcon
;
656 friend class WXDLLEXPORT wxCursor
;
658 wxBitmapRefData(int width
, int height
, int depth
);
663 bool Ok() const { return m_ok
; }
664 void SetOk( bool isOk
) { m_ok
= isOk
; }
666 void SetWidth( int width
) { m_width
= width
; }
667 void SetHeight( int height
) { m_height
= height
; }
668 void SetDepth( int depth
) { m_depth
= depth
; }
670 int GetWidth() const { return m_width
; }
671 int GetHeight() const { return m_height
; }
672 int GetDepth() const { return m_depth
; }
674 void *GetRawAccess() const ;
675 void *BeginRawAccess() ;
676 void EndRawAccess() ;
678 bool HasAlpha() const { return m_hasAlpha
; }
679 void UseAlpha( bool useAlpha
) ;
683 wxPalette m_bitmapPalette
;
684 #endif // wxUSE_PALETTE
686 wxMask
* m_bitmapMask
; // Optional mask
688 CGImageRef
CGImageCreate() const ;
691 // returns true if the bitmap has a size that
692 // can be natively transferred into a true icon
693 // if no is returned GetIconRef will still produce
694 // an icon but it will be generated via a PICT and
695 // rescaled to 16 x 16
696 bool HasNativeSize() ;
698 // caller should increase ref count if needed longer
699 // than the bitmap exists
700 IconRef
GetIconRef() ;
702 // returns a Pict from the bitmap content
703 PicHandle
GetPictHandle() ;
704 GWorldPtr
GetHBITMAP(GWorldPtr
* mask
= NULL
) const ;
705 void UpdateAlphaMask() const ;
708 bool Create(int width
, int height
, int depth
) ;
716 wxMemoryBuffer m_memBuf
;
717 int m_rawAccessCount
;
720 mutable CGImageRef m_cgImageRef
;
723 PicHandle m_pictHandle
;
725 GWorldPtr m_hMaskBitmap
;
726 wxMemoryBuffer m_maskMemBuf
;
727 int m_maskBytesPerRow
;
730 class WXDLLEXPORT wxIconRefData
: public wxGDIRefData
734 wxIconRefData( WXHICON
) ;
735 virtual ~wxIconRefData() { Free(); }
740 void SetWidth( int width
) { m_width
= width
; }
741 void SetHeight( int height
) { m_height
= height
; }
743 int GetWidth() const { return m_width
; }
744 int GetHeight() const { return m_height
; }
746 WXHICON
GetHICON() const { return (WXHICON
) m_iconRef
; }
755 ControlRef
wxMacFindControlUnderMouse( wxTopLevelWindowMac
* toplevelWindow
, Point location
, WindowRef window
, ControlPartCode
*outPart
) ;
759 #define wxMAC_DEFINE_PROC_GETTER( UPP , x ) \
762 static UPP sHandler = NULL; \
763 if ( sHandler == NULL ) \
764 sHandler = New##UPP( x ); \
768 //---------------------------------------------------------------------------
769 // wxMac string conversions
770 //---------------------------------------------------------------------------
772 void wxMacSetupConverters() ;
773 void wxMacCleanupConverters() ;
775 void wxMacStringToPascal( const wxString
&from
, StringPtr to
) ;
776 wxString
wxMacMakeStringFromPascal( ConstStringPtr from
) ;
780 wxString
wxMacFSRefToPath( const FSRef
*fsRef
, CFStringRef additionalPathComponent
= NULL
) ;
781 OSStatus
wxMacPathToFSRef( const wxString
&path
, FSRef
*fsRef
) ;
782 wxString
wxMacHFSUniStrToString( ConstHFSUniStr255Param uniname
) ;