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