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