]> git.saurik.com Git - wxWidgets.git/blame - include/wx/mac/carbon/private.h
unifying CFTypes
[wxWidgets.git] / include / wx / mac / carbon / private.h
CommitLineData
8cf73271 1/////////////////////////////////////////////////////////////////////////////
fb5246be 2// Name: wx/mac/carbon/private.h
8cf73271 3// Purpose: Private declarations: as this header is only included by
77ffb593 4// wxWidgets itself, it may contain identifiers which don't start
8cf73271
SC
5// with "wx".
6// Author: Stefan Csomor
7// Modified by:
8// Created: 1998-01-01
9// RCS-ID: $Id$
10// Copyright: (c) Stefan Csomor
65571936 11// Licence: wxWindows licence
8cf73271
SC
12/////////////////////////////////////////////////////////////////////////////
13
14#ifndef _WX_PRIVATE_H_
15#define _WX_PRIVATE_H_
16
17#include "wx/defs.h"
8cf73271 18
a9479081 19#include <Carbon/Carbon.h>
fe63cfad 20
5185263f 21#include "wx/mac/corefoundation/cfstring.h"
ebf2a1ec 22#include "wx/mac/corefoundation/cfdataref.h"
3d639707 23
fc964c0d 24#if MAC_OS_X_VERSION_MAX_ALLOWED < MAC_OS_X_VERSION_10_5
fe63cfad
SC
25typedef UInt32 URefCon;
26typedef SInt32 SRefCon;
27#endif
28
8cf73271
SC
29#if wxUSE_GUI
30
dd0d56f5 31#include "wx/listbox.h"
888dde65
RR
32#include "wx/mac/carbon/dc.h"
33#include "wx/mac/carbon/dcclient.h"
34#include "wx/mac/carbon/dcmemory.h"
8cf73271 35
fb5246be 36class WXDLLEXPORT wxMacCGContextStateSaver
ddb08e02
SC
37{
38 DECLARE_NO_COPY_CLASS(wxMacCGContextStateSaver)
fb5246be 39
ddb08e02 40public:
fb5246be 41 wxMacCGContextStateSaver( CGContextRef cg )
ddb08e02 42 {
6cce68ea
SC
43 m_cg = cg;
44 CGContextSaveGState( cg );
ddb08e02 45 }
fb5246be 46 ~wxMacCGContextStateSaver()
ddb08e02 47 {
6cce68ea 48 CGContextRestoreGState( m_cg );
ddb08e02
SC
49 }
50private:
6cce68ea
SC
51 CGContextRef m_cg;
52};
ddb08e02 53
8cf73271 54// app.h
0beae935
SC
55
56#if MAC_OS_X_VERSION_MIN_REQUIRED < MAC_OS_X_VERSION_10_5
6cce68ea 57bool wxMacConvertEventToRecord( EventRef event , EventRecord *rec);
0beae935 58#endif
8cf73271
SC
59
60#endif // wxUSE_GUI
61
62// filefn.h
e17206f7
VS
63WXDLLIMPEXP_BASE wxString wxMacFSSpec2MacFilename( const FSSpec *spec );
64WXDLLIMPEXP_BASE void wxMacFilename2FSSpec( const wxString &path , FSSpec *spec );
8cf73271
SC
65
66// utils.h
e17206f7
VS
67WXDLLIMPEXP_BASE wxString wxMacFindFolderNoSeparator(short vRefNum,
68 OSType folderType,
69 Boolean createFolder);
70WXDLLIMPEXP_BASE wxString wxMacFindFolder(short vRefNum,
71 OSType folderType,
72 Boolean createFolder);
8cf73271 73
6cce68ea
SC
74template<typename T> EventParamType wxMacGetEventParamType() { wxFAIL_MSG( wxT("Unknown Param Type") ); return 0; }
75template<> inline EventParamType wxMacGetEventParamType<RgnHandle>() { return typeQDRgnHandle; }
76template<> inline EventParamType wxMacGetEventParamType<ControlRef>() { return typeControlRef; }
77template<> inline EventParamType wxMacGetEventParamType<WindowRef>() { return typeWindowRef; }
78template<> inline EventParamType wxMacGetEventParamType<MenuRef>() { return typeMenuRef; }
79template<> inline EventParamType wxMacGetEventParamType<EventRef>() { return typeEventRef; }
80template<> inline EventParamType wxMacGetEventParamType<Point>() { return typeQDPoint; }
81template<> inline EventParamType wxMacGetEventParamType<Rect>() { return typeQDRectangle; }
82template<> inline EventParamType wxMacGetEventParamType<Boolean>() { return typeBoolean; }
83template<> inline EventParamType wxMacGetEventParamType<SInt16>() { return typeSInt16; }
84template<> inline EventParamType wxMacGetEventParamType<SInt32>() { return typeSInt32; }
85template<> inline EventParamType wxMacGetEventParamType<UInt32>() { return typeUInt32; }
86template<> inline EventParamType wxMacGetEventParamType<RGBColor>() { return typeRGBColor; }
6cce68ea
SC
87template<> inline EventParamType wxMacGetEventParamType<HICommand>() { return typeHICommand; }
88template<> inline EventParamType wxMacGetEventParamType<HIPoint>() { return typeHIPoint; }
89template<> inline EventParamType wxMacGetEventParamType<HISize>() { return typeHISize; }
90template<> inline EventParamType wxMacGetEventParamType<HIRect>() { return typeHIRect; }
91template<> inline EventParamType wxMacGetEventParamType<void*>() { return typeVoidPtr; }
6cce68ea 92template<> inline EventParamType wxMacGetEventParamType<CFDictionaryRef>() { return typeCFDictionaryRef; }
6cce68ea
SC
93template<> inline EventParamType wxMacGetEventParamType<Collection>() { return typeCollection; }
94template<> inline EventParamType wxMacGetEventParamType<CGContextRef>() { return typeCGContextRef; }
4f305456 95/*
885fb02f 96 These are ambiguous
6cce68ea
SC
97 template<> EventParamType wxMacGetEventParamType<GrafPtr>() { return typeGrafPtr; }
98 template<> EventParamType wxMacGetEventParamType<OSStatus>() { return typeOSStatus; }
99 template<> EventParamType wxMacGetEventParamType<CFIndex>() { return typeCFIndex; }
100 template<> EventParamType wxMacGetEventParamType<GWorldPtr>() { return typeGWorldPtr; }
885fb02f 101 */
4f305456
SC
102
103class wxMacCarbonEvent
104{
fb5246be 105
4f305456 106public :
a4848597
SC
107 wxMacCarbonEvent()
108 {
6cce68ea
SC
109 m_eventRef = 0;
110 m_release = false;
a4848597 111 }
fb5246be
WS
112
113 wxMacCarbonEvent( EventRef event , bool release = false )
4f305456 114 {
6cce68ea
SC
115 m_eventRef = event;
116 m_release = release;
6d4c54a7 117 }
fb5246be
WS
118
119 wxMacCarbonEvent(UInt32 inClassID,UInt32 inKind,EventTime inWhen = 0 /*now*/,EventAttributes inAttributes=kEventAttributeNone)
6d4c54a7 120 {
6cce68ea
SC
121 m_eventRef = NULL;
122 verify_noerr( MacCreateEvent( NULL , inClassID, inKind,inWhen,inAttributes,&m_eventRef) );
123 m_release = true;
6d4c54a7 124 }
fb5246be 125
6d4c54a7
SC
126 ~wxMacCarbonEvent()
127 {
128 if ( m_release )
6cce68ea 129 ReleaseEvent( m_eventRef );
4f305456 130 }
fb5246be
WS
131
132 OSStatus Create(UInt32 inClassID,UInt32 inKind,EventTime inWhen = 0 /*now*/,EventAttributes inAttributes=kEventAttributeNone)
a4848597 133 {
6cce68ea 134 verify( (m_eventRef == NULL) || m_release );
a4848597
SC
135 if ( m_eventRef && m_release )
136 {
6cce68ea
SC
137 ReleaseEvent( m_eventRef );
138 m_release = false;
139 m_eventRef = NULL;
a4848597 140 }
6cce68ea 141 OSStatus err = MacCreateEvent( NULL , inClassID, inKind,inWhen,inAttributes,&m_eventRef);
a4848597 142 if ( err == noErr )
6cce68ea
SC
143 m_release = true;
144 return err;
a4848597 145 }
fb5246be 146
6cce68ea 147 OSStatus GetParameter( EventParamName inName, EventParamType inDesiredType, UInt32 inBufferSize, void * outData);
fb5246be 148
4f305456
SC
149 template <typename T> OSStatus GetParameter( EventParamName inName, EventParamType type , T *data )
150 {
6cce68ea 151 return GetParameter( inName, type , sizeof( T ) , data );
4f305456
SC
152 }
153 template <typename T> OSStatus GetParameter( EventParamName inName, T *data )
154 {
6cce68ea 155 return GetParameter<T>( inName, wxMacGetEventParamType<T>() , data );
4f305456 156 }
fb5246be 157
4f305456
SC
158 template <typename T> T GetParameter( EventParamName inName )
159 {
6cce68ea
SC
160 T value;
161 verify_noerr( GetParameter<T>( inName, &value ) );
162 return value;
4f305456
SC
163 }
164 template <typename T> T GetParameter( EventParamName inName, EventParamType inDesiredType )
165 {
6cce68ea
SC
166 T value;
167 verify_noerr( GetParameter<T>( inName, inDesiredType , &value ) );
168 return value;
4f305456 169 }
fb5246be 170
6cce68ea 171 OSStatus SetParameter( EventParamName inName, EventParamType inType, UInt32 inSize, const void * inData);
6d4c54a7 172 template <typename T> OSStatus SetParameter( EventParamName inName, EventParamType inDesiredType , const T *data )
4f305456 173 {
6cce68ea 174 return SetParameter( inName, inDesiredType , sizeof( T ) , data );
2aefa0ef 175 }
6d4c54a7 176 template <typename T> OSStatus SetParameter( EventParamName inName, EventParamType inDesiredType , const T& data )
2aefa0ef 177 {
6cce68ea 178 return SetParameter<T>( inName, inDesiredType , &data );
4f305456 179 }
6d4c54a7 180 template <typename T> OSStatus SetParameter( EventParamName inName, const T *data )
4f305456 181 {
6cce68ea 182 return SetParameter<T>( inName, wxMacGetEventParamType<T>() , data );
4f305456 183 }
6d4c54a7 184 template <typename T> OSStatus SetParameter( EventParamName inName, const T& data )
2aefa0ef 185 {
6cce68ea 186 return SetParameter<T>( inName, wxMacGetEventParamType<T>() , &data );
2aefa0ef 187 }
86d8b744
SC
188 UInt32 GetClass()
189 {
6cce68ea 190 return ::GetEventClass( m_eventRef );
86d8b744 191 }
41b53169 192 UInt32 GetKind()
4f305456 193 {
6cce68ea 194 return ::GetEventKind( m_eventRef );
4f305456
SC
195 }
196 EventTime GetTime()
197 {
6cce68ea 198 return ::GetEventTime( m_eventRef );
4f305456
SC
199 }
200 UInt32 GetTicks()
201 {
6cce68ea 202 return EventTimeToTicks( GetTime() );
4f305456 203 }
2c01d335 204 OSStatus SetCurrentTime( )
a4848597 205 {
6cce68ea 206 return ::SetEventTime( m_eventRef , GetCurrentEventTime() );
2c01d335 207 }
fb5246be 208 OSStatus SetTime( EventTime when )
2c01d335 209 {
6cce68ea 210 return ::SetEventTime( m_eventRef , when );
a4848597
SC
211 }
212 operator EventRef () { return m_eventRef; }
fb5246be 213
6cce68ea 214 bool IsValid() { return m_eventRef != 0; }
4f305456 215protected :
6cce68ea
SC
216 EventRef m_eventRef;
217 bool m_release;
218};
4f305456 219
3feeb1e1
SC
220//
221// helper class for allocating and deallocating Universal Proc Ptrs
222//
223
224template <typename procType, typename uppType , uppType (*newUPP)(procType) , void (*disposeUPP)(uppType) > class wxMacUPP
225{
226public :
89954433 227 wxMacUPP( procType WXUNUSED(proc) )
3feeb1e1 228 {
6cce68ea
SC
229 m_upp = NULL;
230 m_upp = (*newUPP)( NULL );
3feeb1e1
SC
231 }
232 ~wxMacUPP()
233 {
234 if ( m_upp )
6cce68ea 235 disposeUPP( m_upp );
3feeb1e1 236 }
6cce68ea 237 operator uppType() { return m_upp; }
3feeb1e1 238private :
6cce68ea
SC
239 uppType m_upp;
240};
3feeb1e1 241
6cce68ea 242typedef wxMacUPP<NMProcPtr,NMUPP,NewNMUPP,DisposeNMUPP> wxMacNMUPP;
3feeb1e1 243
18b94824
SC
244template <typename refType> class wxMacCFRefHolder
245{
246public :
247 wxMacCFRefHolder()
fb5246be 248 : m_ref(NULL) , m_release(false)
18b94824
SC
249 {
250 }
fb5246be
WS
251
252 wxMacCFRefHolder( refType ref , bool release = true )
18b94824
SC
253 : m_ref(ref) , m_release(release)
254 {
255 }
fb5246be 256
18b94824
SC
257 ~wxMacCFRefHolder()
258 {
6cce68ea 259 Release();
18b94824 260 }
fb5246be 261
18b94824
SC
262 void Release()
263 {
264 if ( m_release && m_ref != NULL )
6cce68ea
SC
265 CFRelease( m_ref );
266 m_ref = NULL;
18b94824 267 }
fb5246be 268
18b94824
SC
269 refType Detach()
270 {
6cce68ea
SC
271 refType val = m_ref;
272 m_release = false;
273 m_ref = NULL;
274 return val;
18b94824 275 }
fb5246be 276
18b94824
SC
277 void Set( refType ref , bool release = true )
278 {
6cce68ea
SC
279 Release();
280 m_release = release;
281 m_ref = ref;
18b94824 282 }
fb5246be 283
18b94824 284 operator refType () const { return m_ref; }
fb5246be 285
ebf2a1ec
SC
286 wxMacCFRefHolder& operator=(refType r)
287 {
288 Set( r );
289 return *this;
290 }
18b94824 291private :
6cce68ea
SC
292 refType m_ref;
293 bool m_release;
fb5246be 294
18b94824 295 DECLARE_NO_COPY_CLASS( wxMacCFRefHolder )
6cce68ea 296};
18b94824 297
885fb02f 298#if wxUSE_GUI
6cce68ea 299
ebf2a1ec
SC
300class wxMacToolTipTimer ;
301
302class wxMacToolTip
303{
304public :
305 wxMacToolTip() ;
306 ~wxMacToolTip() ;
307
308 void Setup( WindowRef window , const wxString& text , const wxPoint& localPosition ) ;
309 void Draw() ;
310 void Clear() ;
311
312 long GetMark()
313 { return m_mark ; }
314
315 bool IsShown()
316 { return m_shown ; }
317
318private :
319 wxString m_label ;
320 wxPoint m_position ;
321 Rect m_rect ;
322 WindowRef m_window ;
323 PicHandle m_backpict ;
324 bool m_shown ;
325 long m_mark ;
326#if wxUSE_TIMER
327 wxMacToolTipTimer* m_timer ;
328#endif
ebf2a1ec 329 wxMacCFStringHolder m_helpTextRef ;
ebf2a1ec
SC
330} ;
331
3e109f6d
SC
332// Quartz
333
334WXDLLIMPEXP_CORE void wxMacCreateBitmapButton( ControlButtonContentInfo*info , const wxBitmap& bitmap , int forceType = 0 );
335WXDLLIMPEXP_CORE void wxMacReleaseBitmapButton( ControlButtonContentInfo*info );
336WXDLLIMPEXP_CORE CGImageRef wxMacCreateCGImageFromBitmap( const wxBitmap& bitmap );
337
338WXDLLIMPEXP_CORE CGDataProviderRef wxMacCGDataProviderCreateWithCFData( CFDataRef data );
339WXDLLIMPEXP_CORE CGDataConsumerRef wxMacCGDataConsumerCreateWithCFData( CFMutableDataRef data );
340WXDLLIMPEXP_CORE CGDataProviderRef wxMacCGDataProviderCreateWithMemoryBuffer( const wxMemoryBuffer& buf );
341
885fb02f 342
885fb02f
SC
343#define MAC_WXHBITMAP(a) (GWorldPtr(a))
344#define MAC_WXHMETAFILE(a) (PicHandle(a))
20b69855 345#define MAC_WXHICON(a) (IconRef(a))
885fb02f
SC
346#define MAC_WXHCURSOR(a) (CursHandle(a))
347#define MAC_WXHRGN(a) (RgnHandle(a))
348#define MAC_WXHWND(a) (WindowPtr(a))
349#define MAC_WXRECPTR(a) ((Rect*)a)
350#define MAC_WXPOINTPTR(a) ((Point*)a)
351#define MAC_WXHMENU(a) ((MenuHandle)a)
352
353struct wxOpaqueWindowRef
354{
6cce68ea
SC
355 wxOpaqueWindowRef( WindowRef ref ) { m_data = ref; }
356 operator WindowRef() { return m_data; }
885fb02f 357private :
6cce68ea
SC
358 WindowRef m_data;
359};
885fb02f 360
6cce68ea
SC
361void wxMacRectToNative( const wxRect *wx , Rect *n );
362void wxMacNativeToRect( const Rect *n , wxRect* wx );
363void wxMacPointToNative( const wxPoint* wx , Point *n );
364void wxMacNativeToPoint( const Point *n , wxPoint* wx );
285b5ce0 365
2301cda0
SC
366WXDLLIMPEXP_CORE wxWindow * wxFindControlFromMacControl(ControlRef inControl );
367WXDLLIMPEXP_CORE wxTopLevelWindowMac* wxFindWinFromMacWindow( WindowRef inWindow );
368WXDLLIMPEXP_CORE wxMenu* wxFindMenuFromMacMenu(MenuRef inMenuRef);
885fb02f 369
2301cda0
SC
370WXDLLIMPEXP_CORE int wxMacCommandToId( UInt32 macCommandId );
371WXDLLIMPEXP_CORE UInt32 wxIdToMacCommand( int wxId );
372WXDLLIMPEXP_CORE wxMenu* wxFindMenuFromMacCommand( const HICommand &macCommandId , wxMenuItem* &item );
1628261e 373
6cce68ea 374extern wxWindow* g_MacLastWindow;
2301cda0
SC
375WXDLLIMPEXP_CORE pascal OSStatus wxMacTopLevelMouseEventHandler( EventHandlerCallRef handler , EventRef event , void *data );
376WXDLLIMPEXP_CORE Rect wxMacGetBoundsForControl( wxWindow* window , const wxPoint& pos , const wxSize &size , bool adjustForOrigin = true );
885fb02f 377
6cce68ea 378ControlActionUPP GetwxMacLiveScrollbarActionProc();
285b5ce0 379
577246ef
SC
380// additional optional event defines
381
382#if MAC_OS_X_VERSION_MAX_ALLOWED < MAC_OS_X_VERSION_10_5
383enum {
384 kEventControlFocusPartChanged = 164
385};
386#endif
387
bf9a1615 388class wxMacControl : public wxObject
86d8b744
SC
389{
390public :
6cce68ea
SC
391 wxMacControl( wxWindow* peer , bool isRootControl = false );
392 wxMacControl( wxWindow* peer , ControlRef control );
393 wxMacControl( wxWindow* peer , WXWidget control );
bf9a1615 394 wxMacControl() ;
6cce68ea
SC
395 virtual ~wxMacControl();
396
397 void Init();
fb5246be 398
6cce68ea 399 virtual void Dispose();
fb5246be 400
b7cacb43
VZ
401 bool Ok() const { return IsOk(); }
402 bool IsOk() const { return GetControlRef() != NULL; }
5ca0d812 403
6cce68ea
SC
404 void SetReferenceInNativeControl();
405 static wxMacControl* GetReferenceFromNativeControl(ControlRef control);
5ca0d812 406
fb5246be 407 virtual ControlRef * GetControlRefAddr() { return &m_controlRef; }
6cce68ea 408 virtual ControlRef GetControlRef() const { return m_controlRef; }
fb5246be 409
eb89f88a 410 virtual void SetReference( URefCon data );
5ca0d812 411 /*
6cce68ea 412 void operator= (ControlRef c) { m_controlRef = c; }
fb5246be
WS
413 operator ControlRef () { return m_controlRef; }
414 operator ControlRef * () { return &m_controlRef; }
5ca0d812 415 */
2837271a
SC
416 // accessing data and values
417
6cce68ea
SC
418 virtual OSStatus SetData( ControlPartCode inPartCode , ResType inTag , Size inSize , const void * inData );
419 virtual OSStatus GetData( ControlPartCode inPartCode , ResType inTag , Size inBufferSize , void * inOutBuffer , Size * outActualSize ) const;
420 virtual OSStatus GetDataSize( ControlPartCode inPartCode , ResType inTag , Size * outActualSize ) const;
421 virtual OSStatus SendEvent( EventRef ref , OptionBits inOptions = 0 );
422 virtual OSStatus SendHICommand( HICommand &command , OptionBits inOptions = 0 );
2837271a 423
6cce68ea 424 virtual OSStatus SendHICommand( UInt32 commandID , OptionBits inOptions = 0 );
2837271a 425
6cce68ea
SC
426 virtual SInt32 GetValue() const;
427 virtual SInt32 GetMaximum() const;
428 virtual SInt32 GetMinimum() const;
fb5246be 429
6cce68ea
SC
430 virtual void SetValue( SInt32 v );
431 virtual void SetMinimum( SInt32 v );
432 virtual void SetMaximum( SInt32 v );
2837271a 433
6cce68ea
SC
434 virtual void SetValueAndRange( SInt32 value , SInt32 minimum , SInt32 maximum );
435 virtual void SetRange( SInt32 minimum , SInt32 maximum );
fb5246be 436
6cce68ea
SC
437 virtual OSStatus SetFocus( ControlFocusPart focusPart );
438 virtual bool HasFocus() const;
439 virtual bool NeedsFocusRect() const;
440 virtual void SetNeedsFocusRect( bool needs );
fb5246be 441
2837271a
SC
442 // templated helpers
443
0fc3bc3b 444 Size GetDataSize( ControlPartCode inPartCode , ResType inTag ) const
86d8b744 445 {
6cce68ea
SC
446 Size sz;
447 verify_noerr( GetDataSize( inPartCode , inTag , &sz ) );
448 return sz;
86d8b744 449 }
6d4c54a7 450 template <typename T> OSStatus SetData( ControlPartCode inPartCode , ResType inTag , const T *data )
86d8b744 451 {
6cce68ea 452 return SetData( inPartCode , inTag , sizeof( T ) , data );
86d8b744 453 }
6d4c54a7 454 template <typename T> OSStatus SetData( ControlPartCode inPartCode , ResType inTag , const T& data )
86d8b744 455 {
6cce68ea 456 return SetData( inPartCode , inTag , sizeof( T ) , &data );
86d8b744 457 }
fbb7ee81
SC
458 template <typename T> OSStatus SetData( ResType inTag , const T *data )
459 {
6cce68ea 460 return SetData( kControlEntireControl , inTag , sizeof( T ) , data );
fbb7ee81
SC
461 }
462 template <typename T> OSStatus SetData( ResType inTag , const T& data )
463 {
6cce68ea 464 return SetData( kControlEntireControl , inTag , sizeof( T ) , &data );
fbb7ee81 465 }
0fc3bc3b 466 template <typename T> OSStatus GetData( ControlPartCode inPartCode , ResType inTag , T *data ) const
86d8b744 467 {
6cce68ea
SC
468 Size dummy;
469 return GetData( inPartCode , inTag , sizeof( T ) , data , &dummy );
86d8b744 470 }
0fc3bc3b 471 template <typename T> T GetData( ControlPartCode inPartCode , ResType inTag ) const
86d8b744 472 {
6cce68ea
SC
473 T value;
474 OSStatus err = GetData<T>( inPartCode , inTag , &value );
725566ca
VZ
475
476 wxASSERT_MSG( err == noErr,
477 wxString::Format(wxT("GetData Failed for Part [%i] and Tag [%i]"),
478 inPartCode, (int)inTag) );
6cce68ea 479 return value;
86d8b744 480 }
fbb7ee81
SC
481 template <typename T> OSStatus GetData( ResType inTag , T *data ) const
482 {
6cce68ea
SC
483 Size dummy;
484 return GetData( kControlEntireControl , inTag , sizeof( T ) , data , &dummy );
fbb7ee81
SC
485 }
486 template <typename T> T GetData( ResType inTag ) const
487 {
6cce68ea 488 return GetData<T>( kControlEntireControl , inTag );
fbb7ee81 489 }
725566ca 490
6d4c54a7 491 // Flash the control for the specified amount of time
6cce68ea 492 virtual void Flash( ControlPartCode part , UInt32 ticks = 8 );
89a66f11 493
6cce68ea
SC
494 virtual void VisibilityChanged( bool shown );
495 virtual void SuperChangedPosition();
89a66f11
SC
496
497
6cce68ea 498 virtual void SetFont( const wxFont & font , const wxColour& foreground , long windowStyle );
850df2d7 499 virtual void SetBackgroundColour( const wxColour& col );
6cce68ea
SC
500 virtual ControlPartCode HandleKey( SInt16 keyCode, SInt16 charCode, EventModifiers modifiers );
501 void SetActionProc( ControlActionUPP actionProc );
502 void SetViewSize( SInt32 viewSize );
503 SInt32 GetViewSize() const;
fb5246be 504
6cce68ea
SC
505 virtual bool IsVisible() const;
506 virtual void SetVisibility( bool visible , bool redraw );
507 virtual bool IsEnabled() const;
508 virtual bool IsActive() const;
509 virtual void Enable( bool enable );
fb5246be 510
5ca0d812 511 // invalidates this control and all children
6cce68ea
SC
512 virtual void InvalidateWithChildren();
513 virtual void SetDrawingEnabled( bool enable );
6cce68ea 514 virtual bool GetNeedsDisplay() const;
a9479081 515
285b5ce0 516 // where is in native window relative coordinates
6cce68ea 517 virtual void SetNeedsDisplay( RgnHandle where );
285b5ce0 518 // where is in native window relative coordinates
6cce68ea 519 virtual void SetNeedsDisplay( Rect* where = NULL );
285b5ce0 520
fb5246be 521 // if rect = NULL, entire view
6cce68ea 522 virtual void ScrollRect( wxRect *rect , int dx , int dy );
5ca0d812 523
285b5ce0 524 // in native parent window relative coordinates
6cce68ea 525 virtual void GetRect( Rect *r );
285b5ce0
SC
526
527 // in native parent window relative coordinates
6cce68ea 528 virtual void SetRect( Rect *r );
285b5ce0 529
6cce68ea
SC
530 virtual void GetRectInWindowCoords( Rect *r );
531 virtual void GetBestRect( Rect *r );
532 virtual void SetLabel( const wxString &title );
5ca0d812 533 // converts from Toplevel-Content relative to local
6cce68ea 534 static void Convert( wxPoint *pt , wxMacControl *convert , wxMacControl *to );
fb5246be 535
6cce68ea
SC
536 virtual void GetFeatures( UInt32 *features );
537 virtual OSStatus GetRegion( ControlPartCode partCode , RgnHandle region );
538 virtual OSStatus SetZOrder( bool above , wxMacControl* other );
725566ca 539
6cce68ea 540 bool IsRootControl() { return m_isRootControl; }
725566ca 541
6cce68ea
SC
542 wxWindow* GetPeer() const
543 {
544 return m_peer;
545 }
ba5b8a68
SC
546
547 // to be moved into a tab control class
548
6cce68ea
SC
549 virtual OSStatus SetTabEnabled( SInt16 tabNo , bool enable );
550protected :
551 ControlRef m_controlRef;
552 wxFont m_font;
553 long m_windowStyle;
554 wxWindow* m_peer;
555 bool m_needsFocusRect;
6cce68ea 556 bool m_isRootControl;
bf9a1615 557 DECLARE_DYNAMIC_CLASS_NO_COPY(wxMacControl)
6cce68ea
SC
558};
559
560// ============================================================================
561// DataBrowser Wrapper
562// ============================================================================
563//
564// basing on DataBrowserItemIDs
565//
566
567class wxMacDataBrowserControl : public wxMacControl
568{
569public :
570 wxMacDataBrowserControl( wxWindow* peer, const wxPoint& pos, const wxSize& size, long style);
bf9a1615 571 wxMacDataBrowserControl() {}
6cce68ea
SC
572
573 OSStatus SetCallbacks( const DataBrowserCallbacks *callbacks );
725566ca 574
6cce68ea
SC
575 OSStatus GetItemCount( DataBrowserItemID container,
576 Boolean recurse,
577 DataBrowserItemState state,
eb89f88a 578 ItemCount *numItems) const;
725566ca 579
6cce68ea
SC
580 OSStatus GetItems( DataBrowserItemID container,
581 Boolean recurse,
582 DataBrowserItemState state,
583 Handle items) const;
725566ca 584
6cce68ea
SC
585
586 OSStatus AddColumn( DataBrowserListViewColumnDesc *columnDesc,
587 DataBrowserTableViewColumnIndex position );
7b514b3b 588
e2bc1d69 589 OSStatus RemoveColumn( DataBrowserTableViewColumnIndex position );
725566ca 590
6cce68ea 591 OSStatus AutoSizeColumns();
725566ca 592
6cce68ea
SC
593 OSStatus SetHasScrollBars( bool horiz, bool vert );
594 OSStatus SetHiliteStyle( DataBrowserTableViewHiliteStyle hiliteStyle );
725566ca 595
6cce68ea
SC
596 OSStatus SetHeaderButtonHeight( UInt16 height );
597 OSStatus GetHeaderButtonHeight( UInt16 *height );
598
599 OSStatus UpdateItems( DataBrowserItemID container, UInt32 numItems,
600 const DataBrowserItemID *items,
601 DataBrowserPropertyID preSortProperty,
602 DataBrowserPropertyID propertyID ) const;
725566ca 603
6cce68ea
SC
604 OSStatus AddItems( DataBrowserItemID container, UInt32 numItems,
605 const DataBrowserItemID *items,
606 DataBrowserPropertyID preSortProperty );
607 OSStatus RemoveItems( DataBrowserItemID container, UInt32 numItems,
608 const DataBrowserItemID *items,
609 DataBrowserPropertyID preSortProperty );
610 OSStatus RevealItem( DataBrowserItemID item,
611 DataBrowserPropertyID propertyID,
612 DataBrowserRevealOptions options ) const;
613
614 OSStatus SetSelectionFlags( DataBrowserSelectionFlags );
615 OSStatus GetSelectionAnchor( DataBrowserItemID *first, DataBrowserItemID *last ) const;
616 bool IsItemSelected( DataBrowserItemID item ) const;
617 OSStatus SetSelectedItems( UInt32 numItems,
618 const DataBrowserItemID *items,
619 DataBrowserSetOption operation );
620
725566ca 621 OSStatus GetItemID( DataBrowserTableViewRowIndex row,
6cce68ea 622 DataBrowserItemID * item ) const;
725566ca 623 OSStatus GetItemRow( DataBrowserItemID item,
6cce68ea 624 DataBrowserTableViewRowIndex * row ) const;
725566ca 625
6cce68ea
SC
626 OSStatus SetDefaultRowHeight( UInt16 height );
627 OSStatus GetDefaultRowHeight( UInt16 * height ) const;
725566ca 628
6cce68ea
SC
629 OSStatus SetRowHeight( DataBrowserItemID item , UInt16 height);
630 OSStatus GetRowHeight( DataBrowserItemID item , UInt16 *height) const;
725566ca 631
6cce68ea
SC
632 OSStatus GetColumnWidth( DataBrowserPropertyID column , UInt16 *width ) const;
633 OSStatus SetColumnWidth( DataBrowserPropertyID column , UInt16 width );
725566ca 634
6cce68ea
SC
635 OSStatus GetDefaultColumnWidth( UInt16 *width ) const;
636 OSStatus SetDefaultColumnWidth( UInt16 width );
725566ca 637
6cce68ea
SC
638 OSStatus GetColumnCount( UInt32* numColumns) const;
639
e2bc1d69
KO
640 OSStatus GetColumnIDFromIndex( DataBrowserTableViewColumnIndex position, DataBrowserTableViewColumnID* id );
641
eb89f88a
SC
642 OSStatus GetColumnPosition( DataBrowserPropertyID column, DataBrowserTableViewColumnIndex *position) const;
643 OSStatus SetColumnPosition( DataBrowserPropertyID column, DataBrowserTableViewColumnIndex position);
725566ca 644
6cce68ea
SC
645 OSStatus GetScrollPosition( UInt32 *top , UInt32 *left ) const;
646 OSStatus SetScrollPosition( UInt32 top , UInt32 left );
725566ca 647
6cce68ea
SC
648 OSStatus GetSortProperty( DataBrowserPropertyID *column ) const;
649 OSStatus SetSortProperty( DataBrowserPropertyID column );
725566ca 650
6cce68ea
SC
651 OSStatus GetSortOrder( DataBrowserSortOrder *order ) const;
652 OSStatus SetSortOrder( DataBrowserSortOrder order );
725566ca 653
6cce68ea
SC
654 OSStatus GetPropertyFlags( DataBrowserPropertyID property, DataBrowserPropertyFlags *flags ) const;
655 OSStatus SetPropertyFlags( DataBrowserPropertyID property, DataBrowserPropertyFlags flags );
725566ca 656
6cce68ea
SC
657 OSStatus GetHeaderDesc( DataBrowserPropertyID property, DataBrowserListViewHeaderDesc *desc ) const;
658 OSStatus SetHeaderDesc( DataBrowserPropertyID property, DataBrowserListViewHeaderDesc *desc );
725566ca 659
6cce68ea 660 OSStatus SetDisclosureColumn( DataBrowserPropertyID property , Boolean expandableRows );
86d8b744 661protected :
725566ca 662
6cce68ea
SC
663 static pascal void DataBrowserItemNotificationProc(
664 ControlRef browser,
665 DataBrowserItemID itemID,
666 DataBrowserItemNotification message,
667 DataBrowserItemDataRef itemData );
668
669 virtual void ItemNotification(
670 DataBrowserItemID itemID,
671 DataBrowserItemNotification message,
672 DataBrowserItemDataRef itemData) = 0;
673
674 static pascal OSStatus DataBrowserGetSetItemDataProc(
675 ControlRef browser,
676 DataBrowserItemID itemID,
677 DataBrowserPropertyID property,
678 DataBrowserItemDataRef itemData,
679 Boolean changeValue );
680
681 virtual OSStatus GetSetItemData(
682 DataBrowserItemID itemID,
683 DataBrowserPropertyID property,
684 DataBrowserItemDataRef itemData,
685 Boolean changeValue ) = 0;
686
687 static pascal Boolean DataBrowserCompareProc(
1b88201f
WS
688 ControlRef browser,
689 DataBrowserItemID itemOneID,
690 DataBrowserItemID itemTwoID,
691 DataBrowserPropertyID sortProperty);
692
693 virtual Boolean CompareItems(DataBrowserItemID itemOneID,
694 DataBrowserItemID itemTwoID,
695 DataBrowserPropertyID sortProperty) = 0;
bf9a1615 696 DECLARE_ABSTRACT_CLASS(wxMacDataBrowserControl)
6cce68ea
SC
697};
698
699// ============================================================================
725566ca 700// Higher-level Databrowser
6cce68ea
SC
701// ============================================================================
702//
703// basing on data item objects
704//
705
706// forward decl
707
708class wxMacDataItemBrowserControl;
e2bc1d69
KO
709class wxMacListBoxItem;
710
e362c2b9
SC
711const DataBrowserPropertyID kTextColumnId = 1024;
712const DataBrowserPropertyID kNumericOrderColumnId = 1025;
e2bc1d69 713
7b514b3b 714// for multi-column controls, we will use this + the column ID to identify the
e2bc1d69 715// column. We don't use kTextColumnId there, and ideally the two should merge.
e362c2b9 716const DataBrowserPropertyID kMinColumnId = 1050;
e2bc1d69
KO
717
718// base API for high-level databrowser operations
719
720class wxMacListControl
721{
722public:
723 virtual void MacDelete( unsigned int n ) = 0;
a236aa20 724 virtual void MacInsert( unsigned int n, const wxArrayStringsAdapter& items, int column = -1 ) = 0;
e2bc1d69
KO
725 // returns index of newly created line
726 virtual int MacAppend( const wxString& item ) = 0;
727 virtual void MacSetString( unsigned int n, const wxString& item ) = 0;
728 virtual void MacClear() = 0;
729 virtual void MacDeselectAll() = 0;
730 virtual void MacSetSelection( unsigned int n, bool select, bool multi ) = 0;
731 virtual int MacGetSelection() const = 0;
732 virtual int MacGetSelections( wxArrayInt& aSelections ) const = 0;
733 virtual bool MacIsSelected( unsigned int n ) const = 0;
734 virtual void MacScrollTo( unsigned int n ) = 0;
735 virtual wxString MacGetString( unsigned int n) const = 0;
736 virtual unsigned int MacGetCount() const = 0;
737
738 virtual void MacSetClientData( unsigned int n, void * data) = 0;
739 virtual void * MacGetClientData( unsigned int) const = 0;
740
741 virtual ~wxMacListControl() { }
7b514b3b 742};
6cce68ea
SC
743
744// base class for databrowser items
745
e2bc1d69
KO
746enum DataItemType {
747 DataItem_Text
748};
749
6cce68ea
SC
750class wxMacDataItem
751{
752public :
753 wxMacDataItem();
754 virtual ~wxMacDataItem();
725566ca
VZ
755
756 virtual bool IsLessThan(wxMacDataItemBrowserControl *owner ,
757 const wxMacDataItem*,
6cce68ea 758 DataBrowserPropertyID property) const;
725566ca 759
6cce68ea 760 // returns true if access was successful, otherwise false
725566ca 761 virtual OSStatus GetSetData(wxMacDataItemBrowserControl *owner ,
6cce68ea
SC
762 DataBrowserPropertyID property,
763 DataBrowserItemDataRef itemData,
764 bool changeValue );
765
725566ca 766 virtual void Notification(wxMacDataItemBrowserControl *owner ,
6cce68ea
SC
767 DataBrowserItemNotification message,
768 DataBrowserItemDataRef itemData ) const;
7b514b3b 769
e2bc1d69 770 void SetLabel( const wxString& str);
7b514b3b 771 const wxString& GetLabel() const;
e2bc1d69
KO
772
773 void SetOrder( SInt32 order );
774 SInt32 GetOrder() const;
775
776 void SetData( void* data);
777 void* GetData() const;
7b514b3b 778
e2bc1d69 779 void SetColumn( short col );
7b514b3b
VZ
780 short GetColumn();
781
e2bc1d69
KO
782protected :
783 wxString m_label;
784 wxMacCFStringHolder m_cfLabel;
785 void * m_data;
786 SInt32 m_order;
7b514b3b
VZ
787 DataBrowserPropertyID m_colId;
788
e2bc1d69
KO
789};
790
791enum ListSortOrder {
792 SortOrder_None,
793 SortOrder_Text_Ascending,
794 SortOrder_Text_Descending
6cce68ea
SC
795};
796
797typedef wxMacDataItem* wxMacDataItemPtr;
798const wxMacDataItemPtr wxMacDataBrowserRootContainer = NULL;
799
800WX_DEFINE_USER_EXPORTED_ARRAY_PTR(wxMacDataItemPtr, wxArrayMacDataItemPtr, class WXDLLIMPEXP_CORE);
801
e2bc1d69 802class wxMacDataItemBrowserControl : public wxMacDataBrowserControl, public wxMacListControl
6cce68ea
SC
803{
804public :
805 wxMacDataItemBrowserControl( wxWindow* peer , const wxPoint& pos, const wxSize& size, long style);
bf9a1615 806 wxMacDataItemBrowserControl() {}
e2bc1d69
KO
807 // create a list item (can be a subclass of wxMacListBoxItem)
808
809 virtual wxMacDataItem* CreateItem();
810
6cce68ea 811 unsigned int GetItemCount(const wxMacDataItem* container, bool recurse , DataBrowserItemState state) const;
725566ca 812 void GetItems(const wxMacDataItem* container, bool recurse ,
6cce68ea 813 DataBrowserItemState state, wxArrayMacDataItemPtr &items ) const;
7b514b3b 814
e2bc1d69 815 unsigned int GetSelectedItemCount( const wxMacDataItem* container, bool recurse ) const;
725566ca 816
6cce68ea
SC
817 unsigned int GetLineFromItem(const wxMacDataItem *item) const;
818 wxMacDataItem * GetItemFromLine(unsigned int n) const;
725566ca
VZ
819
820 void UpdateItem(const wxMacDataItem *container, const wxMacDataItem *item,
6cce68ea 821 DataBrowserPropertyID property) const;
725566ca 822 void UpdateItems(const wxMacDataItem *container, wxArrayMacDataItemPtr &items,
6cce68ea 823 DataBrowserPropertyID property) const;
725566ca 824
3ef4e126
SC
825 void InsertColumn(int colId, DataBrowserPropertyType colType,
826 const wxString& title, SInt16 just = teFlushDefault, int defaultWidth = -1);
7b514b3b 827
e2bc1d69
KO
828 int GetColumnWidth(int colId);
829 void SetColumnWidth(int colId, int width);
830
6cce68ea
SC
831 void AddItem(wxMacDataItem *container, wxMacDataItem *item);
832 void AddItems(wxMacDataItem *container, wxArrayMacDataItemPtr &items );
833
834 void RemoveAllItems(wxMacDataItem *container);
835 void RemoveItem(wxMacDataItem *container, wxMacDataItem* item);
836 void RemoveItems(wxMacDataItem *container, wxArrayMacDataItemPtr &items);
725566ca 837
6cce68ea
SC
838 void SetSelectedItem( wxMacDataItem* item , DataBrowserSetOption option);
839 void SetSelectedItems( wxArrayMacDataItemPtr &items , DataBrowserSetOption option);
840 void SetSelectedAllItems( DataBrowserSetOption option);
841 Boolean IsItemSelected( const wxMacDataItem* item) const;
725566ca 842
6cce68ea 843 void RevealItem( wxMacDataItem* item, DataBrowserRevealOptions options);
725566ca 844
6cce68ea 845 void GetSelectionAnchor( wxMacDataItemPtr* first , wxMacDataItemPtr* last) const;
725566ca 846
6cce68ea 847 // item aware methods, to be used in subclasses
725566ca
VZ
848
849 virtual Boolean CompareItems(const wxMacDataItem* itemOneID,
850 const wxMacDataItem* itemTwoID,
6cce68ea
SC
851 DataBrowserPropertyID sortProperty);
852
853 virtual OSStatus GetSetItemData(wxMacDataItem* itemID,
854 DataBrowserPropertyID property,
855 DataBrowserItemDataRef itemData,
856 Boolean changeValue );
857
858 virtual void ItemNotification(
859 const wxMacDataItem* itemID,
860 DataBrowserItemNotification message,
861 DataBrowserItemDataRef itemData);
8b64a7e2
PC
862
863 // as we are getting the same events for human and API selection we have to suppress
864 // events in the latter case, since this will be used from many subclasses we keep it here
865
866 bool IsSelectionSuppressed() const { return m_suppressSelection; }
867 bool SuppressSelection( bool suppress );
7b514b3b
VZ
868
869
e2bc1d69
KO
870 // wxMacListControl Methods
871 // add and remove
872
873 virtual void MacDelete( unsigned int n );
a236aa20 874 virtual void MacInsert( unsigned int n, const wxArrayStringsAdapter& items, int column = -1 );
e2bc1d69
KO
875 virtual int MacAppend( const wxString& item );
876 virtual void MacClear();
877
878 // selecting
879
880 virtual void MacDeselectAll();
881 virtual void MacSetSelection( unsigned int n, bool select, bool multi = false );
882 virtual int MacGetSelection() const;
883 virtual int MacGetSelections( wxArrayInt& aSelections ) const;
884 virtual bool MacIsSelected( unsigned int n ) const;
885
886 // display
887
888 virtual void MacScrollTo( unsigned int n );
889
890 // accessing content
891
892 virtual void MacSetString( unsigned int n, const wxString& item );
893 virtual void MacSetClientData( unsigned int n, void * data);
894 virtual wxString MacGetString( unsigned int n) const;
895 virtual void * MacGetClientData( unsigned int) const;
896 virtual unsigned int MacGetCount() const;
897
898 // client data
899
900 virtual wxClientDataType GetClientDataType() const;
901 virtual void SetClientDataType(wxClientDataType clientDataItemsType);
67650ea0
KO
902 //virtual ListSortOrder GetSortOrder() const;
903 //virtual void SetSortOrder(const ListSortOrder sort);
e2bc1d69 904
7b514b3b 905
8b64a7e2
PC
906
907protected:
e2bc1d69
KO
908
909 ListSortOrder m_sortOrder;
910 wxClientDataType m_clientDataItemsType;
911
6cce68ea 912 // ID aware base methods, should be 'final' ie not changed in subclasses
725566ca
VZ
913
914 virtual Boolean CompareItems(DataBrowserItemID itemOneID,
915 DataBrowserItemID itemTwoID,
6cce68ea
SC
916 DataBrowserPropertyID sortProperty);
917
918 virtual OSStatus GetSetItemData(DataBrowserItemID itemID,
919 DataBrowserPropertyID property,
920 DataBrowserItemDataRef itemData,
921 Boolean changeValue );
922
923 virtual void ItemNotification(
924 DataBrowserItemID itemID,
925 DataBrowserItemNotification message,
926 DataBrowserItemDataRef itemData);
927
e2bc1d69 928
6cce68ea
SC
929private :
930
931 bool m_suppressSelection;
bf9a1615 932 DECLARE_DYNAMIC_CLASS_NO_COPY(wxMacDataItemBrowserControl)
6cce68ea
SC
933};
934
935class wxMacDataItemBrowserSelectionSuppressor
936{
937public :
938 wxMacDataItemBrowserSelectionSuppressor(wxMacDataItemBrowserControl *browser);
939 ~wxMacDataItemBrowserSelectionSuppressor();
725566ca 940
6cce68ea
SC
941private :
942
943 bool m_former;
944 wxMacDataItemBrowserControl* m_browser;
945};
946
947// ============================================================================
948// platform listbox implementation
949// ============================================================================
e2bc1d69 950
6cce68ea
SC
951// exposed for reuse in wxCheckListBox
952
953class wxMacListBoxItem : public wxMacDataItem
954{
955public :
956 wxMacListBoxItem();
725566ca 957
6cce68ea 958 virtual ~wxMacListBoxItem();
725566ca 959
725566ca 960 virtual void Notification(wxMacDataItemBrowserControl *owner ,
6cce68ea
SC
961 DataBrowserItemNotification message,
962 DataBrowserItemDataRef itemData ) const;
6cce68ea
SC
963};
964
e2bc1d69 965class wxMacDataBrowserListControl : public wxMacDataItemBrowserControl
6cce68ea
SC
966{
967public:
e2bc1d69 968 wxMacDataBrowserListControl( wxWindow *peer, const wxPoint& pos, const wxSize& size, long style );
bf9a1615 969 wxMacDataBrowserListControl() {}
d3c7fc99 970 virtual ~wxMacDataBrowserListControl();
6cce68ea 971
e6fd62dd
RD
972 virtual wxMacDataItem* CreateItem();
973
6cce68ea
SC
974 // pointing back
975
e2bc1d69
KO
976 wxWindow * GetPeer() const;
977
bf9a1615 978 DECLARE_DYNAMIC_CLASS_NO_COPY(wxMacDataBrowserListControl)
6cce68ea
SC
979};
980
981// ============================================================================
982// graphics implementation
983// ============================================================================
86d8b744 984
11556386
SC
985// draw the image 'upside down' corrected as HIViewDrawCGImage does
986
3e109f6d 987OSStatus WXDLLIMPEXP_CORE wxMacDrawCGImage(
11556386
SC
988 CGContextRef inContext,
989 const HIRect * inBounds,
990 CGImageRef inImage) ;
991
3e109f6d 992CGColorRef WXDLLIMPEXP_CORE wxMacCreateCGColorFromHITheme( ThemeBrush brush ) ;
850df2d7 993
3e109f6d 994CGColorSpaceRef WXDLLIMPEXP_CORE wxMacGetGenericRGBColorSpace(void);
20b69855 995
285b5ce0
SC
996// toplevel.cpp
997
ebf2a1ec
SC
998class wxMacDeferredWindowDeleter : public wxObject
999{
1000public :
1001 wxMacDeferredWindowDeleter( WindowRef windowRef );
1002 virtual ~wxMacDeferredWindowDeleter();
1003
1004protected :
1005 WindowRef m_macWindow ;
1006} ;
1007
8cf73271
SC
1008#endif // wxUSE_GUI
1009
285b5ce0
SC
1010#define wxMAC_DEFINE_PROC_GETTER( UPP , x ) \
1011UPP Get##x() \
1012{ \
1013 static UPP sHandler = NULL; \
1014 if ( sHandler == NULL ) \
1015 sHandler = New##UPP( x ); \
1016 return sHandler; \
1017}
1018
8cf73271
SC
1019//---------------------------------------------------------------------------
1020// wxMac string conversions
1021//---------------------------------------------------------------------------
1022
6cce68ea
SC
1023void wxMacSetupConverters();
1024void wxMacCleanupConverters();
8cf73271 1025
e17206f7
VS
1026WXDLLIMPEXP_BASE void wxMacStringToPascal( const wxString&from , StringPtr to );
1027WXDLLIMPEXP_BASE wxString wxMacMakeStringFromPascal( ConstStringPtr from );
8cf73271 1028
a2b77260
SC
1029// filefn.cpp
1030
e17206f7
VS
1031WXDLLIMPEXP_BASE wxString wxMacFSRefToPath( const FSRef *fsRef , CFStringRef additionalPathComponent = NULL );
1032WXDLLIMPEXP_BASE OSStatus wxMacPathToFSRef( const wxString&path , FSRef *fsRef );
1033WXDLLIMPEXP_BASE wxString wxMacHFSUniStrToString( ConstHFSUniStr255Param uniname );
aa0cc8a1 1034
eb89f88a
SC
1035#if wxUSE_GUI
1036
1037// deprecating QD
1038
1039void wxMacLocalToGlobal( WindowRef window , Point*pt );
1040void wxMacGlobalToLocal( WindowRef window , Point*pt );
1041
1042#endif
1043
ebf2a1ec
SC
1044//---------------------------------------------------------------------------
1045// cocoa bridging utilities
1046//---------------------------------------------------------------------------
1047
1048bool wxMacInitCocoa();
1049
1050class wxMacAutoreleasePool
1051{
1052public :
1053 wxMacAutoreleasePool();
1054 ~wxMacAutoreleasePool();
1055private :
1056 void* m_pool;
1057};
1058
1059// NSObject
1060
1061void wxMacCocoaRelease( void* obj );
1062void wxMacCocoaAutorelease( void* obj );
1063void wxMacCocoaRetain( void* obj );
1064
1065#if wxMAC_USE_COCOA
1066
1067// NSCursor
1068
1069WX_NSCursor wxMacCocoaCreateStockCursor( int cursor_type );
1070WX_NSCursor wxMacCocoaCreateCursorFromCGImage( CGImageRef cgImageRef, float hotSpotX, float hotSpotY );
1071void wxMacCocoaSetCursor( WX_NSCursor cursor );
1072void wxMacCocoaHideCursor();
1073void wxMacCocoaShowCursor();
1074
1075typedef struct tagClassicCursor
1076{
1077 wxUint16 bits[16];
1078 wxUint16 mask[16];
1079 wxInt16 hotspot[2];
1080}ClassicCursor;
1081
1082#else // !wxMAC_USE_COCOA
1083
1084// non Darwin
1085
1086typedef Cursor ClassicCursor;
1087
1088#endif // wxMAC_USE_COCOA
1089
1090// -------------
1091// Common to all
1092// -------------
1093
1094// Cursor support
1095
1096const short kwxCursorBullseye = 0;
1097const short kwxCursorBlank = 1;
1098const short kwxCursorPencil = 2;
1099const short kwxCursorMagnifier = 3;
1100const short kwxCursorNoEntry = 4;
1101const short kwxCursorPaintBrush = 5;
1102const short kwxCursorPointRight = 6;
1103const short kwxCursorPointLeft = 7;
1104const short kwxCursorQuestionArrow = 8;
1105const short kwxCursorRightArrow = 9;
1106const short kwxCursorSizeNS = 10;
1107const short kwxCursorSize = 11;
1108const short kwxCursorSizeNESW = 12;
1109const short kwxCursorSizeNWSE = 13;
1110const short kwxCursorRoller = 14;
1111const short kwxCursorLast = kwxCursorRoller;
1112
1113// exposing our fallback cursor map
1114
1115extern ClassicCursor gMacCursors[];
1116
8cf73271
SC
1117#endif
1118 // _WX_PRIVATE_H_