]>
Commit | Line | Data |
---|---|---|
5c6eb3a8 | 1 | ///////////////////////////////////////////////////////////////////////////// |
bcb07ff0 | 2 | // Name: wx/osx/carbon/private.h |
5c6eb3a8 SC |
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 | ||
bcb07ff0 | 17 | #include "wx/osx/core/private.h" |
5c6eb3a8 SC |
18 | |
19 | #include <Carbon/Carbon.h> | |
20 | ||
5c6eb3a8 SC |
21 | #if MAC_OS_X_VERSION_MAX_ALLOWED < MAC_OS_X_VERSION_10_5 |
22 | typedef UInt32 URefCon; | |
23 | typedef SInt32 SRefCon; | |
24 | #endif | |
25 | ||
26 | #if wxUSE_GUI | |
27 | ||
524c47aa SC |
28 | #include "wx/osx/uma.h" |
29 | ||
5c6eb3a8 | 30 | #include "wx/listbox.h" |
ccd5d46c SC |
31 | #include "wx/osx/dc.h" |
32 | #include "wx/osx/dcclient.h" | |
33 | #include "wx/osx/dcmemory.h" | |
5c6eb3a8 | 34 | |
5c6eb3a8 SC |
35 | // app.h |
36 | ||
37 | #if MAC_OS_X_VERSION_MIN_REQUIRED < MAC_OS_X_VERSION_10_5 | |
38 | bool wxMacConvertEventToRecord( EventRef event , EventRecord *rec); | |
39 | #endif | |
40 | ||
bcb07ff0 SC |
41 | WXDLLIMPEXP_CORE wxWindowMac * wxFindWindowFromWXWidget(WXWidget inControl ); |
42 | // TODO REMOVE WXDLLIMPEXP_CORE wxNonOwnedWindow* wxFindWindowFromWXWindow( WXWindow inWindow ); | |
43 | ||
5c6eb3a8 SC |
44 | #endif // wxUSE_GUI |
45 | ||
46 | // filefn.h | |
47 | WXDLLIMPEXP_BASE wxString wxMacFSSpec2MacFilename( const FSSpec *spec ); | |
48 | WXDLLIMPEXP_BASE void wxMacFilename2FSSpec( const wxString &path , FSSpec *spec ); | |
49 | ||
50 | // utils.h | |
51 | WXDLLIMPEXP_BASE wxString wxMacFindFolderNoSeparator(short vRefNum, | |
52 | OSType folderType, | |
53 | Boolean createFolder); | |
54 | WXDLLIMPEXP_BASE wxString wxMacFindFolder(short vRefNum, | |
55 | OSType folderType, | |
56 | Boolean createFolder); | |
57 | ||
58 | template<typename T> EventParamType wxMacGetEventParamType() { wxFAIL_MSG( wxT("Unknown Param Type") ); return 0; } | |
59 | template<> inline EventParamType wxMacGetEventParamType<RgnHandle>() { return typeQDRgnHandle; } | |
60 | template<> inline EventParamType wxMacGetEventParamType<ControlRef>() { return typeControlRef; } | |
61 | template<> inline EventParamType wxMacGetEventParamType<WindowRef>() { return typeWindowRef; } | |
62 | template<> inline EventParamType wxMacGetEventParamType<MenuRef>() { return typeMenuRef; } | |
63 | template<> inline EventParamType wxMacGetEventParamType<EventRef>() { return typeEventRef; } | |
64 | template<> inline EventParamType wxMacGetEventParamType<Point>() { return typeQDPoint; } | |
65 | template<> inline EventParamType wxMacGetEventParamType<Rect>() { return typeQDRectangle; } | |
66 | template<> inline EventParamType wxMacGetEventParamType<Boolean>() { return typeBoolean; } | |
67 | template<> inline EventParamType wxMacGetEventParamType<SInt16>() { return typeSInt16; } | |
68 | template<> inline EventParamType wxMacGetEventParamType<SInt32>() { return typeSInt32; } | |
69 | template<> inline EventParamType wxMacGetEventParamType<UInt32>() { return typeUInt32; } | |
70 | template<> inline EventParamType wxMacGetEventParamType<RGBColor>() { return typeRGBColor; } | |
71 | template<> inline EventParamType wxMacGetEventParamType<HICommand>() { return typeHICommand; } | |
72 | template<> inline EventParamType wxMacGetEventParamType<HIPoint>() { return typeHIPoint; } | |
73 | template<> inline EventParamType wxMacGetEventParamType<HISize>() { return typeHISize; } | |
74 | template<> inline EventParamType wxMacGetEventParamType<HIRect>() { return typeHIRect; } | |
75 | template<> inline EventParamType wxMacGetEventParamType<void*>() { return typeVoidPtr; } | |
76 | template<> inline EventParamType wxMacGetEventParamType<CFDictionaryRef>() { return typeCFDictionaryRef; } | |
77 | template<> inline EventParamType wxMacGetEventParamType<Collection>() { return typeCollection; } | |
78 | template<> inline EventParamType wxMacGetEventParamType<CGContextRef>() { return typeCGContextRef; } | |
79 | /* | |
80 | These are ambiguous | |
81 | template<> EventParamType wxMacGetEventParamType<GrafPtr>() { return typeGrafPtr; } | |
82 | template<> EventParamType wxMacGetEventParamType<OSStatus>() { return typeOSStatus; } | |
83 | template<> EventParamType wxMacGetEventParamType<CFIndex>() { return typeCFIndex; } | |
84 | template<> EventParamType wxMacGetEventParamType<GWorldPtr>() { return typeGWorldPtr; } | |
85 | */ | |
86 | ||
87 | class WXDLLIMPEXP_CORE wxMacCarbonEvent | |
88 | { | |
89 | ||
90 | public : | |
91 | wxMacCarbonEvent() | |
92 | { | |
93 | m_eventRef = 0; | |
94 | m_release = false; | |
95 | } | |
96 | ||
97 | wxMacCarbonEvent( EventRef event , bool release = false ) | |
98 | { | |
99 | m_eventRef = event; | |
100 | m_release = release; | |
101 | } | |
102 | ||
103 | wxMacCarbonEvent(UInt32 inClassID,UInt32 inKind,EventTime inWhen = 0 /*now*/,EventAttributes inAttributes=kEventAttributeNone) | |
104 | { | |
105 | m_eventRef = NULL; | |
106 | verify_noerr( MacCreateEvent( NULL , inClassID, inKind,inWhen,inAttributes,&m_eventRef) ); | |
107 | m_release = true; | |
108 | } | |
109 | ||
110 | ~wxMacCarbonEvent() | |
111 | { | |
112 | if ( m_release ) | |
113 | ReleaseEvent( m_eventRef ); | |
114 | } | |
115 | ||
116 | OSStatus Create(UInt32 inClassID,UInt32 inKind,EventTime inWhen = 0 /*now*/,EventAttributes inAttributes=kEventAttributeNone) | |
117 | { | |
118 | verify( (m_eventRef == NULL) || m_release ); | |
119 | if ( m_eventRef && m_release ) | |
120 | { | |
121 | ReleaseEvent( m_eventRef ); | |
122 | m_release = false; | |
123 | m_eventRef = NULL; | |
124 | } | |
125 | OSStatus err = MacCreateEvent( NULL , inClassID, inKind,inWhen,inAttributes,&m_eventRef); | |
126 | if ( err == noErr ) | |
127 | m_release = true; | |
128 | return err; | |
129 | } | |
130 | ||
131 | OSStatus GetParameter( EventParamName inName, EventParamType inDesiredType, UInt32 inBufferSize, void * outData); | |
132 | ||
133 | template <typename T> OSStatus GetParameter( EventParamName inName, EventParamType type , T *data ) | |
134 | { | |
135 | return GetParameter( inName, type , sizeof( T ) , data ); | |
136 | } | |
137 | template <typename T> OSStatus GetParameter( EventParamName inName, T *data ) | |
138 | { | |
139 | return GetParameter<T>( inName, wxMacGetEventParamType<T>() , data ); | |
140 | } | |
141 | ||
142 | template <typename T> T GetParameter( EventParamName inName ) | |
143 | { | |
144 | T value; | |
145 | verify_noerr( GetParameter<T>( inName, &value ) ); | |
146 | return value; | |
147 | } | |
148 | template <typename T> T GetParameter( EventParamName inName, EventParamType inDesiredType ) | |
149 | { | |
150 | T value; | |
151 | verify_noerr( GetParameter<T>( inName, inDesiredType , &value ) ); | |
152 | return value; | |
153 | } | |
154 | ||
155 | OSStatus SetParameter( EventParamName inName, EventParamType inType, UInt32 inSize, const void * inData); | |
156 | template <typename T> OSStatus SetParameter( EventParamName inName, EventParamType inDesiredType , const T *data ) | |
157 | { | |
158 | return SetParameter( inName, inDesiredType , sizeof( T ) , data ); | |
159 | } | |
160 | template <typename T> OSStatus SetParameter( EventParamName inName, EventParamType inDesiredType , const T& data ) | |
161 | { | |
162 | return SetParameter<T>( inName, inDesiredType , &data ); | |
163 | } | |
164 | template <typename T> OSStatus SetParameter( EventParamName inName, const T *data ) | |
165 | { | |
166 | return SetParameter<T>( inName, wxMacGetEventParamType<T>() , data ); | |
167 | } | |
168 | template <typename T> OSStatus SetParameter( EventParamName inName, const T& data ) | |
169 | { | |
170 | return SetParameter<T>( inName, wxMacGetEventParamType<T>() , &data ); | |
171 | } | |
172 | UInt32 GetClass() | |
173 | { | |
174 | return ::GetEventClass( m_eventRef ); | |
175 | } | |
176 | UInt32 GetKind() | |
177 | { | |
178 | return ::GetEventKind( m_eventRef ); | |
179 | } | |
180 | EventTime GetTime() | |
181 | { | |
182 | return ::GetEventTime( m_eventRef ); | |
183 | } | |
184 | UInt32 GetTicks() | |
185 | { | |
186 | return EventTimeToTicks( GetTime() ); | |
187 | } | |
188 | OSStatus SetCurrentTime( ) | |
189 | { | |
190 | return ::SetEventTime( m_eventRef , GetCurrentEventTime() ); | |
191 | } | |
192 | OSStatus SetTime( EventTime when ) | |
193 | { | |
194 | return ::SetEventTime( m_eventRef , when ); | |
195 | } | |
196 | operator EventRef () { return m_eventRef; } | |
197 | ||
198 | bool IsValid() { return m_eventRef != 0; } | |
199 | protected : | |
200 | EventRef m_eventRef; | |
201 | bool m_release; | |
202 | }; | |
203 | ||
5c6eb3a8 SC |
204 | #if wxUSE_GUI |
205 | ||
206 | class WXDLLIMPEXP_FWD_CORE wxMacToolTipTimer ; | |
207 | ||
208 | class WXDLLIMPEXP_CORE wxMacToolTip | |
209 | { | |
210 | public : | |
211 | wxMacToolTip() ; | |
212 | ~wxMacToolTip() ; | |
213 | ||
214 | void Setup( WindowRef window , const wxString& text , const wxPoint& localPosition ) ; | |
215 | void Draw() ; | |
216 | void Clear() ; | |
217 | ||
218 | long GetMark() | |
219 | { return m_mark ; } | |
220 | ||
221 | bool IsShown() | |
222 | { return m_shown ; } | |
223 | ||
224 | private : | |
225 | wxString m_label ; | |
226 | wxPoint m_position ; | |
227 | Rect m_rect ; | |
228 | WindowRef m_window ; | |
229 | PicHandle m_backpict ; | |
230 | bool m_shown ; | |
231 | long m_mark ; | |
232 | #if wxUSE_TIMER | |
233 | wxMacToolTipTimer* m_timer ; | |
234 | #endif | |
235 | wxCFStringRef m_helpTextRef ; | |
236 | } ; | |
237 | ||
238 | // Quartz | |
239 | ||
240 | WXDLLIMPEXP_CORE void wxMacCreateBitmapButton( ControlButtonContentInfo*info , const wxBitmap& bitmap , int forceType = 0 ); | |
241 | WXDLLIMPEXP_CORE void wxMacReleaseBitmapButton( ControlButtonContentInfo*info ); | |
5c6eb3a8 SC |
242 | |
243 | #define MAC_WXHBITMAP(a) (GWorldPtr(a)) | |
244 | #define MAC_WXHMETAFILE(a) (PicHandle(a)) | |
245 | #define MAC_WXHICON(a) (IconRef(a)) | |
246 | #define MAC_WXHCURSOR(a) (CursHandle(a)) | |
247 | #define MAC_WXHRGN(a) (RgnHandle(a)) | |
248 | #define MAC_WXHWND(a) (WindowPtr(a)) | |
249 | #define MAC_WXRECPTR(a) ((Rect*)a) | |
250 | #define MAC_WXPOINTPTR(a) ((Point*)a) | |
251 | #define MAC_WXHMENU(a) ((MenuHandle)a) | |
252 | ||
253 | struct wxOpaqueWindowRef | |
254 | { | |
255 | wxOpaqueWindowRef( WindowRef ref ) { m_data = ref; } | |
256 | operator WindowRef() { return m_data; } | |
257 | private : | |
258 | WindowRef m_data; | |
259 | }; | |
260 | ||
261 | WXDLLIMPEXP_CORE void wxMacRectToNative( const wxRect *wx , Rect *n ); | |
262 | WXDLLIMPEXP_CORE void wxMacNativeToRect( const Rect *n , wxRect* wx ); | |
263 | WXDLLIMPEXP_CORE void wxMacPointToNative( const wxPoint* wx , Point *n ); | |
264 | WXDLLIMPEXP_CORE void wxMacNativeToPoint( const Point *n , wxPoint* wx ); | |
265 | ||
5c6eb3a8 SC |
266 | WXDLLIMPEXP_CORE wxMenu* wxFindMenuFromMacMenu(MenuRef inMenuRef); |
267 | ||
268 | WXDLLIMPEXP_CORE int wxMacCommandToId( UInt32 macCommandId ); | |
269 | WXDLLIMPEXP_CORE UInt32 wxIdToMacCommand( int wxId ); | |
270 | WXDLLIMPEXP_CORE wxMenu* wxFindMenuFromMacCommand( const HICommand &macCommandId , wxMenuItem* &item ); | |
271 | ||
5c6eb3a8 | 272 | WXDLLIMPEXP_CORE pascal OSStatus wxMacTopLevelMouseEventHandler( EventHandlerCallRef handler , EventRef event , void *data ); |
bcb07ff0 | 273 | WXDLLIMPEXP_CORE Rect wxMacGetBoundsForControl( wxWindowMac* window , const wxPoint& pos , const wxSize &size , bool adjustForOrigin = true ); |
5c6eb3a8 SC |
274 | |
275 | ControlActionUPP GetwxMacLiveScrollbarActionProc(); | |
276 | ||
277 | // additional optional event defines | |
278 | ||
279 | #if MAC_OS_X_VERSION_MAX_ALLOWED < MAC_OS_X_VERSION_10_5 | |
280 | enum { | |
281 | kEventControlFocusPartChanged = 164 | |
282 | }; | |
283 | #endif | |
284 | ||
bcb07ff0 | 285 | class WXDLLIMPEXP_CORE wxMacControl : public wxWidgetImpl |
5c6eb3a8 SC |
286 | { |
287 | public : | |
bcb07ff0 | 288 | wxMacControl( wxWindowMac* peer , bool isRootControl = false ); |
5c6eb3a8 SC |
289 | wxMacControl() ; |
290 | virtual ~wxMacControl(); | |
291 | ||
292 | void Init(); | |
293 | ||
5c6eb3a8 SC |
294 | void SetReferenceInNativeControl(); |
295 | static wxMacControl* GetReferenceFromNativeControl(ControlRef control); | |
296 | ||
297 | virtual ControlRef * GetControlRefAddr() { return &m_controlRef; } | |
298 | virtual ControlRef GetControlRef() const { return m_controlRef; } | |
299 | ||
bcb07ff0 SC |
300 | virtual WXWidget GetWXWidget() const { return (WXWidget) m_controlRef; } |
301 | ||
bcb07ff0 SC |
302 | virtual bool IsVisible() const; |
303 | ||
304 | virtual void Raise(); | |
305 | ||
306 | virtual void Lower(); | |
307 | ||
308 | virtual void ScrollRect( const wxRect *rect, int dx, int dy ); | |
309 | ||
310 | virtual void GetContentArea( int &left , int &top , int &width , int &height ) const; | |
311 | virtual void Move(int x, int y, int width, int height); | |
312 | virtual void GetPosition( int &x, int &y ) const; | |
313 | virtual void GetSize( int &width, int &height ) const; | |
524c47aa | 314 | virtual void SetControlSize( wxWindowVariant variant ) ; |
bcb07ff0 SC |
315 | |
316 | // where is in native window relative coordinates | |
317 | virtual void SetNeedsDisplay( const wxRect* where = NULL ); | |
318 | virtual bool GetNeedsDisplay() const; | |
319 | ||
320 | virtual bool CanFocus() const; | |
321 | // return true if successful | |
322 | virtual bool SetFocus(); | |
323 | virtual bool HasFocus() const; | |
324 | ||
325 | void RemoveFromParent(); | |
326 | void Embed( wxWidgetImpl *parent ); | |
524c47aa SC |
327 | |
328 | void SetDefaultButton( bool isDefault ); | |
329 | void PerformClick(); | |
330 | void SetLabel( const wxString& title, wxFontEncoding encoding ); | |
331 | ||
54f11060 SC |
332 | void SetCursor( const wxCursor & cursor ); |
333 | void CaptureMouse(); | |
334 | void ReleaseMouse(); | |
335 | ||
524c47aa SC |
336 | wxInt32 GetValue() const; |
337 | void SetValue( wxInt32 v ); | |
338 | void SetBitmap( const wxBitmap& bitmap ); | |
339 | void SetupTabs( const wxNotebook ¬ebook ); | |
340 | ||
341 | void GetBestRect( wxRect *r ) const; | |
342 | bool IsEnabled() const; | |
343 | void Enable( bool enable ); | |
344 | bool ButtonClickDidStateChange() { return false ;} | |
345 | void SetMinimum( wxInt32 v ); | |
346 | void SetMaximum( wxInt32 v ); | |
347 | void PulseGauge() ; | |
348 | void SetScrollThumb( wxInt32 value, wxInt32 thumbSize ); | |
349 | ||
350 | // temp convenience methods | |
351 | ||
352 | void GetBestRect( Rect *r ) const; | |
5c6eb3a8 SC |
353 | /* |
354 | void operator= (ControlRef c) { m_controlRef = c; } | |
355 | operator ControlRef () { return m_controlRef; } | |
356 | operator ControlRef * () { return &m_controlRef; } | |
357 | */ | |
358 | // accessing data and values | |
359 | ||
360 | virtual OSStatus SetData( ControlPartCode inPartCode , ResType inTag , Size inSize , const void * inData ); | |
361 | virtual OSStatus GetData( ControlPartCode inPartCode , ResType inTag , Size inBufferSize , void * inOutBuffer , Size * outActualSize ) const; | |
362 | virtual OSStatus GetDataSize( ControlPartCode inPartCode , ResType inTag , Size * outActualSize ) const; | |
363 | virtual OSStatus SendEvent( EventRef ref , OptionBits inOptions = 0 ); | |
364 | virtual OSStatus SendHICommand( HICommand &command , OptionBits inOptions = 0 ); | |
365 | ||
366 | virtual OSStatus SendHICommand( UInt32 commandID , OptionBits inOptions = 0 ); | |
367 | ||
19c7ac3d SC |
368 | virtual wxInt32 GetMaximum() const; |
369 | virtual wxInt32 GetMinimum() const; | |
524c47aa | 370 | |
5c6eb3a8 SC |
371 | virtual void SetValueAndRange( SInt32 value , SInt32 minimum , SInt32 maximum ); |
372 | virtual void SetRange( SInt32 minimum , SInt32 maximum ); | |
373 | ||
5c6eb3a8 SC |
374 | // templated helpers |
375 | ||
376 | Size GetDataSize( ControlPartCode inPartCode , ResType inTag ) const | |
377 | { | |
378 | Size sz; | |
379 | verify_noerr( GetDataSize( inPartCode , inTag , &sz ) ); | |
380 | return sz; | |
381 | } | |
382 | template <typename T> OSStatus SetData( ControlPartCode inPartCode , ResType inTag , const T *data ) | |
383 | { | |
384 | return SetData( inPartCode , inTag , sizeof( T ) , data ); | |
385 | } | |
386 | template <typename T> OSStatus SetData( ControlPartCode inPartCode , ResType inTag , const T& data ) | |
387 | { | |
388 | return SetData( inPartCode , inTag , sizeof( T ) , &data ); | |
389 | } | |
390 | template <typename T> OSStatus SetData( ResType inTag , const T *data ) | |
391 | { | |
392 | return SetData( kControlEntireControl , inTag , sizeof( T ) , data ); | |
393 | } | |
394 | template <typename T> OSStatus SetData( ResType inTag , const T& data ) | |
395 | { | |
396 | return SetData( kControlEntireControl , inTag , sizeof( T ) , &data ); | |
397 | } | |
398 | template <typename T> OSStatus GetData( ControlPartCode inPartCode , ResType inTag , T *data ) const | |
399 | { | |
400 | Size dummy; | |
401 | return GetData( inPartCode , inTag , sizeof( T ) , data , &dummy ); | |
402 | } | |
403 | template <typename T> T GetData( ControlPartCode inPartCode , ResType inTag ) const | |
404 | { | |
405 | T value; | |
406 | OSStatus err = GetData<T>( inPartCode , inTag , &value ); | |
407 | ||
408 | if ( err != noErr ) | |
409 | { | |
410 | wxFAIL_MSG( wxString::Format(wxT("GetData Failed for Part [%i] and Tag [%i]"), | |
411 | inPartCode, (int)inTag) ); | |
412 | } | |
413 | ||
414 | return value; | |
415 | } | |
416 | template <typename T> OSStatus GetData( ResType inTag , T *data ) const | |
417 | { | |
418 | Size dummy; | |
419 | return GetData( kControlEntireControl , inTag , sizeof( T ) , data , &dummy ); | |
420 | } | |
421 | template <typename T> T GetData( ResType inTag ) const | |
422 | { | |
423 | return GetData<T>( kControlEntireControl , inTag ); | |
424 | } | |
425 | ||
426 | // Flash the control for the specified amount of time | |
5c6eb3a8 SC |
427 | |
428 | virtual void VisibilityChanged( bool shown ); | |
429 | virtual void SuperChangedPosition(); | |
430 | ||
431 | ||
1e181c7a | 432 | virtual void SetFont( const wxFont & font , const wxColour& foreground , long windowStyle, bool ignoreBlack = true ); |
5c6eb3a8 SC |
433 | virtual void SetBackgroundColour( const wxColour& col ); |
434 | virtual ControlPartCode HandleKey( SInt16 keyCode, SInt16 charCode, EventModifiers modifiers ); | |
435 | void SetActionProc( ControlActionUPP actionProc ); | |
5c6eb3a8 SC |
436 | SInt32 GetViewSize() const; |
437 | ||
bcb07ff0 | 438 | virtual void SetVisibility( bool visible ); |
524c47aa | 439 | |
5c6eb3a8 | 440 | virtual bool IsActive() const; |
5c6eb3a8 SC |
441 | |
442 | // invalidates this control and all children | |
443 | virtual void InvalidateWithChildren(); | |
444 | virtual void SetDrawingEnabled( bool enable ); | |
5c6eb3a8 SC |
445 | |
446 | // in native parent window relative coordinates | |
5c6eb3a8 SC |
447 | |
448 | virtual void GetRectInWindowCoords( Rect *r ); | |
bcb07ff0 | 449 | |
5c6eb3a8 SC |
450 | |
451 | virtual void GetFeatures( UInt32 *features ); | |
452 | virtual OSStatus GetRegion( ControlPartCode partCode , RgnHandle region ); | |
bcb07ff0 SC |
453 | |
454 | // to be moved into a tab control class | |
5c6eb3a8 | 455 | |
bcb07ff0 | 456 | virtual OSStatus SetTabEnabled( SInt16 tabNo , bool enable ); |
5c6eb3a8 | 457 | |
f55d9f74 | 458 | void InstallEventHandler( WXWidget control = NULL ); |
5c6eb3a8 | 459 | protected : |
bcb07ff0 | 460 | WXEVENTHANDLERREF m_macControlEventHandler ; |
5c6eb3a8 SC |
461 | ControlRef m_controlRef; |
462 | wxFont m_font; | |
463 | long m_windowStyle; | |
5c6eb3a8 SC |
464 | DECLARE_DYNAMIC_CLASS_NO_COPY(wxMacControl) |
465 | }; | |
466 | ||
467 | // ============================================================================ | |
468 | // DataBrowser Wrapper | |
469 | // ============================================================================ | |
470 | // | |
471 | // basing on DataBrowserItemIDs | |
472 | // | |
473 | ||
474 | class WXDLLIMPEXP_CORE wxMacDataBrowserControl : public wxMacControl | |
475 | { | |
476 | public : | |
477 | wxMacDataBrowserControl( wxWindow* peer, const wxPoint& pos, const wxSize& size, long style); | |
478 | wxMacDataBrowserControl() {} | |
479 | ||
480 | OSStatus SetCallbacks( const DataBrowserCallbacks *callbacks ); | |
481 | ||
482 | OSStatus GetItemCount( DataBrowserItemID container, | |
483 | Boolean recurse, | |
484 | DataBrowserItemState state, | |
485 | ItemCount *numItems) const; | |
486 | ||
487 | OSStatus GetItems( DataBrowserItemID container, | |
488 | Boolean recurse, | |
489 | DataBrowserItemState state, | |
490 | Handle items) const; | |
491 | ||
492 | ||
493 | OSStatus AddColumn( DataBrowserListViewColumnDesc *columnDesc, | |
494 | DataBrowserTableViewColumnIndex position ); | |
495 | ||
496 | OSStatus RemoveColumn( DataBrowserTableViewColumnIndex position ); | |
497 | ||
498 | OSStatus AutoSizeColumns(); | |
499 | ||
500 | OSStatus SetHasScrollBars( bool horiz, bool vert ); | |
501 | OSStatus SetHiliteStyle( DataBrowserTableViewHiliteStyle hiliteStyle ); | |
502 | ||
503 | OSStatus SetHeaderButtonHeight( UInt16 height ); | |
504 | OSStatus GetHeaderButtonHeight( UInt16 *height ); | |
505 | ||
506 | OSStatus UpdateItems( DataBrowserItemID container, UInt32 numItems, | |
507 | const DataBrowserItemID *items, | |
508 | DataBrowserPropertyID preSortProperty, | |
509 | DataBrowserPropertyID propertyID ) const; | |
510 | ||
511 | OSStatus AddItems( DataBrowserItemID container, UInt32 numItems, | |
512 | const DataBrowserItemID *items, | |
513 | DataBrowserPropertyID preSortProperty ); | |
514 | OSStatus RemoveItems( DataBrowserItemID container, UInt32 numItems, | |
515 | const DataBrowserItemID *items, | |
516 | DataBrowserPropertyID preSortProperty ); | |
517 | OSStatus RevealItem( DataBrowserItemID item, | |
518 | DataBrowserPropertyID propertyID, | |
519 | DataBrowserRevealOptions options ) const; | |
520 | ||
521 | OSStatus SetSelectionFlags( DataBrowserSelectionFlags ); | |
522 | OSStatus GetSelectionAnchor( DataBrowserItemID *first, DataBrowserItemID *last ) const; | |
523 | bool IsItemSelected( DataBrowserItemID item ) const; | |
524 | OSStatus SetSelectedItems( UInt32 numItems, | |
525 | const DataBrowserItemID *items, | |
526 | DataBrowserSetOption operation ); | |
527 | ||
528 | OSStatus GetItemID( DataBrowserTableViewRowIndex row, | |
529 | DataBrowserItemID * item ) const; | |
530 | OSStatus GetItemRow( DataBrowserItemID item, | |
531 | DataBrowserTableViewRowIndex * row ) const; | |
532 | ||
533 | OSStatus SetDefaultRowHeight( UInt16 height ); | |
534 | OSStatus GetDefaultRowHeight( UInt16 * height ) const; | |
535 | ||
536 | OSStatus SetRowHeight( DataBrowserItemID item , UInt16 height); | |
537 | OSStatus GetRowHeight( DataBrowserItemID item , UInt16 *height) const; | |
538 | ||
539 | OSStatus GetColumnWidth( DataBrowserPropertyID column , UInt16 *width ) const; | |
540 | OSStatus SetColumnWidth( DataBrowserPropertyID column , UInt16 width ); | |
541 | ||
542 | OSStatus GetDefaultColumnWidth( UInt16 *width ) const; | |
543 | OSStatus SetDefaultColumnWidth( UInt16 width ); | |
544 | ||
545 | OSStatus GetColumnCount( UInt32* numColumns) const; | |
546 | ||
547 | OSStatus GetColumnIDFromIndex( DataBrowserTableViewColumnIndex position, DataBrowserTableViewColumnID* id ); | |
548 | ||
549 | OSStatus GetColumnPosition( DataBrowserPropertyID column, DataBrowserTableViewColumnIndex *position) const; | |
550 | OSStatus SetColumnPosition( DataBrowserPropertyID column, DataBrowserTableViewColumnIndex position); | |
551 | ||
552 | OSStatus GetScrollPosition( UInt32 *top , UInt32 *left ) const; | |
553 | OSStatus SetScrollPosition( UInt32 top , UInt32 left ); | |
554 | ||
555 | OSStatus GetSortProperty( DataBrowserPropertyID *column ) const; | |
556 | OSStatus SetSortProperty( DataBrowserPropertyID column ); | |
557 | ||
558 | OSStatus GetSortOrder( DataBrowserSortOrder *order ) const; | |
559 | OSStatus SetSortOrder( DataBrowserSortOrder order ); | |
560 | ||
561 | OSStatus GetPropertyFlags( DataBrowserPropertyID property, DataBrowserPropertyFlags *flags ) const; | |
562 | OSStatus SetPropertyFlags( DataBrowserPropertyID property, DataBrowserPropertyFlags flags ); | |
563 | ||
564 | OSStatus GetHeaderDesc( DataBrowserPropertyID property, DataBrowserListViewHeaderDesc *desc ) const; | |
565 | OSStatus SetHeaderDesc( DataBrowserPropertyID property, DataBrowserListViewHeaderDesc *desc ); | |
566 | ||
567 | OSStatus SetDisclosureColumn( DataBrowserPropertyID property , Boolean expandableRows ); | |
568 | protected : | |
569 | ||
570 | static pascal void DataBrowserItemNotificationProc( | |
571 | ControlRef browser, | |
572 | DataBrowserItemID itemID, | |
573 | DataBrowserItemNotification message, | |
574 | DataBrowserItemDataRef itemData ); | |
575 | ||
576 | virtual void ItemNotification( | |
577 | DataBrowserItemID itemID, | |
578 | DataBrowserItemNotification message, | |
579 | DataBrowserItemDataRef itemData) = 0; | |
580 | ||
581 | static pascal OSStatus DataBrowserGetSetItemDataProc( | |
582 | ControlRef browser, | |
583 | DataBrowserItemID itemID, | |
584 | DataBrowserPropertyID property, | |
585 | DataBrowserItemDataRef itemData, | |
586 | Boolean changeValue ); | |
587 | ||
588 | virtual OSStatus GetSetItemData( | |
589 | DataBrowserItemID itemID, | |
590 | DataBrowserPropertyID property, | |
591 | DataBrowserItemDataRef itemData, | |
592 | Boolean changeValue ) = 0; | |
593 | ||
594 | static pascal Boolean DataBrowserCompareProc( | |
595 | ControlRef browser, | |
596 | DataBrowserItemID itemOneID, | |
597 | DataBrowserItemID itemTwoID, | |
598 | DataBrowserPropertyID sortProperty); | |
599 | ||
600 | virtual Boolean CompareItems(DataBrowserItemID itemOneID, | |
601 | DataBrowserItemID itemTwoID, | |
602 | DataBrowserPropertyID sortProperty) = 0; | |
603 | DECLARE_ABSTRACT_CLASS(wxMacDataBrowserControl) | |
604 | }; | |
605 | ||
606 | // ============================================================================ | |
607 | // Higher-level Databrowser | |
608 | // ============================================================================ | |
609 | // | |
610 | // basing on data item objects | |
611 | // | |
612 | ||
613 | // forward decl | |
614 | ||
615 | class wxMacDataItemBrowserControl; | |
616 | class wxMacListBoxItem; | |
617 | ||
618 | const DataBrowserPropertyID kTextColumnId = 1024; | |
619 | const DataBrowserPropertyID kNumericOrderColumnId = 1025; | |
620 | ||
621 | // for multi-column controls, we will use this + the column ID to identify the | |
622 | // column. We don't use kTextColumnId there, and ideally the two should merge. | |
623 | const DataBrowserPropertyID kMinColumnId = 1050; | |
624 | ||
625 | // base API for high-level databrowser operations | |
626 | ||
5c6eb3a8 SC |
627 | // base class for databrowser items |
628 | ||
629 | enum DataItemType { | |
630 | DataItem_Text | |
631 | }; | |
632 | ||
524c47aa | 633 | /* |
5c6eb3a8 SC |
634 | class WXDLLIMPEXP_CORE wxMacDataItem |
635 | { | |
524c47aa SC |
636 | public : |
637 | wxMacDataItem(); | |
638 | virtual ~wxMacDataItem(); | |
639 | } ; | |
640 | */ | |
641 | ||
642 | class WXDLLIMPEXP_CORE wxMacDataItem | |
643 | { | |
5c6eb3a8 SC |
644 | public : |
645 | wxMacDataItem(); | |
646 | virtual ~wxMacDataItem(); | |
647 | ||
648 | virtual bool IsLessThan(wxMacDataItemBrowserControl *owner , | |
649 | const wxMacDataItem*, | |
650 | DataBrowserPropertyID property) const; | |
651 | ||
652 | // returns true if access was successful, otherwise false | |
653 | virtual OSStatus GetSetData(wxMacDataItemBrowserControl *owner , | |
654 | DataBrowserPropertyID property, | |
655 | DataBrowserItemDataRef itemData, | |
656 | bool changeValue ); | |
657 | ||
658 | virtual void Notification(wxMacDataItemBrowserControl *owner , | |
659 | DataBrowserItemNotification message, | |
660 | DataBrowserItemDataRef itemData ) const; | |
661 | ||
5c6eb3a8 SC |
662 | void SetOrder( SInt32 order ); |
663 | SInt32 GetOrder() const; | |
664 | ||
5c6eb3a8 | 665 | protected : |
5c6eb3a8 | 666 | SInt32 m_order; |
5c6eb3a8 SC |
667 | |
668 | }; | |
669 | ||
670 | enum ListSortOrder { | |
671 | SortOrder_None, | |
672 | SortOrder_Text_Ascending, | |
673 | SortOrder_Text_Descending | |
674 | }; | |
675 | ||
676 | typedef wxMacDataItem* wxMacDataItemPtr; | |
677 | const wxMacDataItemPtr wxMacDataBrowserRootContainer = NULL; | |
524c47aa | 678 | typedef void * wxListColumnId ; |
5c6eb3a8 SC |
679 | |
680 | WX_DEFINE_USER_EXPORTED_ARRAY_PTR(wxMacDataItemPtr, wxArrayMacDataItemPtr, class WXDLLIMPEXP_CORE); | |
681 | ||
524c47aa | 682 | class WXDLLIMPEXP_CORE wxMacDataItemBrowserControl : public wxMacDataBrowserControl |
5c6eb3a8 SC |
683 | { |
684 | public : | |
685 | wxMacDataItemBrowserControl( wxWindow* peer , const wxPoint& pos, const wxSize& size, long style); | |
686 | wxMacDataItemBrowserControl() {} | |
687 | // create a list item (can be a subclass of wxMacListBoxItem) | |
688 | ||
5c6eb3a8 SC |
689 | unsigned int GetItemCount(const wxMacDataItem* container, bool recurse , DataBrowserItemState state) const; |
690 | void GetItems(const wxMacDataItem* container, bool recurse , | |
691 | DataBrowserItemState state, wxArrayMacDataItemPtr &items ) const; | |
692 | ||
693 | unsigned int GetSelectedItemCount( const wxMacDataItem* container, bool recurse ) const; | |
694 | ||
695 | unsigned int GetLineFromItem(const wxMacDataItem *item) const; | |
696 | wxMacDataItem * GetItemFromLine(unsigned int n) const; | |
697 | ||
698 | void UpdateItem(const wxMacDataItem *container, const wxMacDataItem *item, | |
699 | DataBrowserPropertyID property) const; | |
700 | void UpdateItems(const wxMacDataItem *container, wxArrayMacDataItemPtr &items, | |
701 | DataBrowserPropertyID property) const; | |
702 | ||
703 | void InsertColumn(int colId, DataBrowserPropertyType colType, | |
704 | const wxString& title, SInt16 just = teFlushDefault, int defaultWidth = -1); | |
705 | ||
706 | int GetColumnWidth(int colId); | |
707 | void SetColumnWidth(int colId, int width); | |
708 | ||
709 | void AddItem(wxMacDataItem *container, wxMacDataItem *item); | |
710 | void AddItems(wxMacDataItem *container, wxArrayMacDataItemPtr &items ); | |
711 | ||
712 | void RemoveAllItems(wxMacDataItem *container); | |
713 | void RemoveItem(wxMacDataItem *container, wxMacDataItem* item); | |
714 | void RemoveItems(wxMacDataItem *container, wxArrayMacDataItemPtr &items); | |
715 | ||
716 | void SetSelectedItem( wxMacDataItem* item , DataBrowserSetOption option); | |
717 | void SetSelectedItems( wxArrayMacDataItemPtr &items , DataBrowserSetOption option); | |
718 | void SetSelectedAllItems( DataBrowserSetOption option); | |
719 | Boolean IsItemSelected( const wxMacDataItem* item) const; | |
720 | ||
721 | void RevealItem( wxMacDataItem* item, DataBrowserRevealOptions options); | |
722 | ||
723 | void GetSelectionAnchor( wxMacDataItemPtr* first , wxMacDataItemPtr* last) const; | |
724 | ||
524c47aa SC |
725 | // add and remove |
726 | ||
727 | virtual void MacDelete( unsigned int n ); | |
728 | virtual void MacInsert( unsigned int n, wxMacDataItem* item); | |
729 | virtual void MacClear(); | |
730 | ||
731 | // accessing content | |
732 | ||
733 | virtual unsigned int MacGetCount() const; | |
734 | ||
735 | public : | |
736 | ||
5c6eb3a8 SC |
737 | // item aware methods, to be used in subclasses |
738 | ||
739 | virtual Boolean CompareItems(const wxMacDataItem* itemOneID, | |
740 | const wxMacDataItem* itemTwoID, | |
741 | DataBrowserPropertyID sortProperty); | |
742 | ||
743 | virtual OSStatus GetSetItemData(wxMacDataItem* itemID, | |
744 | DataBrowserPropertyID property, | |
745 | DataBrowserItemDataRef itemData, | |
746 | Boolean changeValue ); | |
747 | ||
748 | virtual void ItemNotification( | |
749 | const wxMacDataItem* itemID, | |
750 | DataBrowserItemNotification message, | |
751 | DataBrowserItemDataRef itemData); | |
752 | ||
753 | // as we are getting the same events for human and API selection we have to suppress | |
754 | // events in the latter case, since this will be used from many subclasses we keep it here | |
755 | ||
756 | bool IsSelectionSuppressed() const { return m_suppressSelection; } | |
757 | bool SuppressSelection( bool suppress ); | |
758 | ||
5c6eb3a8 SC |
759 | // client data |
760 | ||
761 | virtual wxClientDataType GetClientDataType() const; | |
762 | virtual void SetClientDataType(wxClientDataType clientDataItemsType); | |
763 | //virtual ListSortOrder GetSortOrder() const; | |
764 | //virtual void SetSortOrder(const ListSortOrder sort); | |
765 | ||
766 | ||
767 | ||
768 | protected: | |
769 | ||
770 | ListSortOrder m_sortOrder; | |
771 | wxClientDataType m_clientDataItemsType; | |
772 | ||
773 | // ID aware base methods, should be 'final' ie not changed in subclasses | |
774 | ||
775 | virtual Boolean CompareItems(DataBrowserItemID itemOneID, | |
776 | DataBrowserItemID itemTwoID, | |
777 | DataBrowserPropertyID sortProperty); | |
778 | ||
779 | virtual OSStatus GetSetItemData(DataBrowserItemID itemID, | |
780 | DataBrowserPropertyID property, | |
781 | DataBrowserItemDataRef itemData, | |
782 | Boolean changeValue ); | |
783 | ||
784 | virtual void ItemNotification( | |
785 | DataBrowserItemID itemID, | |
786 | DataBrowserItemNotification message, | |
787 | DataBrowserItemDataRef itemData); | |
788 | ||
789 | ||
790 | private : | |
791 | ||
792 | bool m_suppressSelection; | |
793 | DECLARE_DYNAMIC_CLASS_NO_COPY(wxMacDataItemBrowserControl) | |
794 | }; | |
795 | ||
796 | class WXDLLIMPEXP_CORE wxMacDataItemBrowserSelectionSuppressor | |
797 | { | |
798 | public : | |
799 | wxMacDataItemBrowserSelectionSuppressor(wxMacDataItemBrowserControl *browser); | |
800 | ~wxMacDataItemBrowserSelectionSuppressor(); | |
801 | ||
802 | private : | |
803 | ||
804 | bool m_former; | |
805 | wxMacDataItemBrowserControl* m_browser; | |
806 | }; | |
807 | ||
808 | // ============================================================================ | |
809 | // platform listbox implementation | |
810 | // ============================================================================ | |
811 | ||
812 | // exposed for reuse in wxCheckListBox | |
813 | ||
814 | class WXDLLIMPEXP_CORE wxMacListBoxItem : public wxMacDataItem | |
815 | { | |
816 | public : | |
817 | wxMacListBoxItem(); | |
818 | ||
819 | virtual ~wxMacListBoxItem(); | |
820 | ||
524c47aa SC |
821 | virtual OSStatus GetSetData(wxMacDataItemBrowserControl *owner , |
822 | DataBrowserPropertyID property, | |
823 | DataBrowserItemDataRef itemData, | |
824 | bool changeValue ); | |
825 | ||
5c6eb3a8 SC |
826 | virtual void Notification(wxMacDataItemBrowserControl *owner , |
827 | DataBrowserItemNotification message, | |
828 | DataBrowserItemDataRef itemData ) const; | |
524c47aa | 829 | protected : |
5c6eb3a8 SC |
830 | }; |
831 | ||
524c47aa SC |
832 | class WXDLLIMPEXP_CORE wxMacDataBrowserColumn : public wxListWidgetColumn |
833 | { | |
834 | public : | |
835 | wxMacDataBrowserColumn( DataBrowserPropertyID propertyId, DataBrowserPropertyType colType, bool editable ) | |
836 | : m_property(propertyId), m_editable(editable), m_type( colType ) | |
837 | { | |
838 | } | |
839 | ~wxMacDataBrowserColumn() | |
840 | { | |
841 | } | |
842 | DataBrowserPropertyID GetProperty() const { return m_property ; } | |
843 | ||
844 | bool IsEditable() const { return m_editable; } | |
845 | ||
846 | DataBrowserPropertyType GetType() const { return m_type; } | |
847 | ||
848 | protected : | |
849 | DataBrowserPropertyID m_property; | |
850 | bool m_editable; | |
851 | DataBrowserPropertyType m_type; | |
852 | } ; | |
853 | ||
854 | WX_DEFINE_ARRAY_PTR(wxMacDataBrowserColumn *, wxArrayMacDataBrowserColumns); | |
855 | ||
856 | ||
857 | class WXDLLIMPEXP_CORE wxMacDataBrowserCellValue : public wxListWidgetCellValue | |
858 | { | |
859 | public : | |
860 | wxMacDataBrowserCellValue(DataBrowserItemDataRef data) : m_data(data) {} | |
861 | virtual ~wxMacDataBrowserCellValue() {} | |
862 | ||
863 | virtual void Set( CFStringRef value ); | |
864 | virtual void Set( const wxString& value ); | |
865 | virtual void Set( int value ) ; | |
866 | ||
867 | virtual int GetIntValue() const ; | |
868 | virtual wxString GetStringValue() const ; | |
869 | protected : | |
870 | DataBrowserItemDataRef m_data; | |
871 | } ; | |
872 | ||
873 | ||
874 | class WXDLLIMPEXP_CORE wxMacDataBrowserListControl : public wxMacDataItemBrowserControl, public wxListWidgetImpl | |
5c6eb3a8 SC |
875 | { |
876 | public: | |
877 | wxMacDataBrowserListControl( wxWindow *peer, const wxPoint& pos, const wxSize& size, long style ); | |
878 | wxMacDataBrowserListControl() {} | |
879 | virtual ~wxMacDataBrowserListControl(); | |
880 | ||
524c47aa | 881 | // wxListWidgetImpl Methods |
5c6eb3a8 | 882 | |
524c47aa SC |
883 | wxListWidgetColumn* InsertTextColumn( unsigned int pos, const wxString& title, bool editable = false, |
884 | wxAlignment just = wxALIGN_LEFT , int defaultWidth = -1) ; | |
885 | wxListWidgetColumn* InsertCheckColumn( unsigned int pos , const wxString& title, bool editable = false, | |
886 | wxAlignment just = wxALIGN_LEFT , int defaultWidth = -1) ; | |
887 | ||
888 | wxMacDataBrowserColumn* DoInsertColumn( unsigned int pos, DataBrowserPropertyID property, | |
889 | const wxString& title, bool editable, | |
890 | DataBrowserPropertyType colType, SInt16 just, int width ); | |
891 | // add and remove | |
892 | ||
893 | virtual void ListDelete( unsigned int n ); | |
894 | virtual void ListInsert( unsigned int n ); | |
895 | virtual void ListClear(); | |
896 | ||
897 | // selecting | |
898 | ||
899 | virtual void ListDeselectAll(); | |
900 | virtual void ListSetSelection( unsigned int n, bool select, bool multi = false ); | |
901 | virtual int ListGetSelection() const; | |
902 | virtual int ListGetSelections( wxArrayInt& aSelections ) const; | |
903 | virtual bool ListIsSelected( unsigned int n ) const; | |
904 | ||
905 | // display | |
906 | ||
907 | virtual void ListScrollTo( unsigned int n ); | |
908 | ||
909 | // accessing content | |
910 | ||
911 | virtual unsigned int ListGetCount() const; | |
912 | ||
913 | virtual void UpdateLine( unsigned int n, wxListWidgetColumn* col = NULL ); | |
914 | virtual void UpdateLineToEnd( unsigned int n) ; | |
915 | ||
916 | virtual void ItemNotification( | |
917 | const wxMacDataItem* itemID, | |
918 | DataBrowserItemNotification message, | |
919 | DataBrowserItemDataRef itemData); | |
5c6eb3a8 SC |
920 | |
921 | // pointing back | |
922 | ||
524c47aa SC |
923 | wxMacDataBrowserColumn* GetColumnFromProperty( DataBrowserPropertyID ); |
924 | private: | |
925 | wxArrayMacDataBrowserColumns m_columns; | |
926 | int m_nextColumnId ; | |
5c6eb3a8 SC |
927 | |
928 | DECLARE_DYNAMIC_CLASS_NO_COPY(wxMacDataBrowserListControl) | |
929 | }; | |
930 | ||
931 | // ============================================================================ | |
932 | // graphics implementation | |
933 | // ============================================================================ | |
934 | ||
935 | // draw the image 'upside down' corrected as HIViewDrawCGImage does | |
936 | ||
937 | OSStatus WXDLLIMPEXP_CORE wxMacDrawCGImage( | |
938 | CGContextRef inContext, | |
939 | const HIRect * inBounds, | |
940 | CGImageRef inImage) ; | |
941 | ||
942 | CGColorRef WXDLLIMPEXP_CORE wxMacCreateCGColorFromHITheme( ThemeBrush brush ) ; | |
943 | ||
5c6eb3a8 SC |
944 | #endif // wxUSE_GUI |
945 | ||
946 | #define wxMAC_DEFINE_PROC_GETTER( UPP , x ) \ | |
947 | UPP Get##x() \ | |
948 | { \ | |
949 | static UPP sHandler = NULL; \ | |
950 | if ( sHandler == NULL ) \ | |
951 | sHandler = New##UPP( x ); \ | |
952 | return sHandler; \ | |
953 | } | |
954 | ||
955 | //--------------------------------------------------------------------------- | |
956 | // wxMac string conversions | |
957 | //--------------------------------------------------------------------------- | |
958 | ||
959 | void wxMacSetupConverters(); | |
960 | void wxMacCleanupConverters(); | |
961 | ||
b2767951 | 962 | // utils.cpp |
5c6eb3a8 SC |
963 | |
964 | // filefn.cpp | |
965 | ||
966 | WXDLLIMPEXP_BASE wxString wxMacFSRefToPath( const FSRef *fsRef , CFStringRef additionalPathComponent = NULL ); | |
967 | WXDLLIMPEXP_BASE OSStatus wxMacPathToFSRef( const wxString&path , FSRef *fsRef ); | |
968 | WXDLLIMPEXP_BASE wxString wxMacHFSUniStrToString( ConstHFSUniStr255Param uniname ); | |
969 | ||
5c6eb3a8 SC |
970 | //--------------------------------------------------------------------------- |
971 | // cocoa bridging utilities | |
972 | //--------------------------------------------------------------------------- | |
973 | ||
974 | bool wxMacInitCocoa(); | |
975 | ||
5c6eb3a8 SC |
976 | typedef Cursor ClassicCursor; |
977 | ||
5c6eb3a8 SC |
978 | // ------------- |
979 | // Common to all | |
980 | // ------------- | |
981 | ||
982 | // Cursor support | |
983 | ||
984 | const short kwxCursorBullseye = 0; | |
985 | const short kwxCursorBlank = 1; | |
986 | const short kwxCursorPencil = 2; | |
987 | const short kwxCursorMagnifier = 3; | |
988 | const short kwxCursorNoEntry = 4; | |
989 | const short kwxCursorPaintBrush = 5; | |
990 | const short kwxCursorPointRight = 6; | |
991 | const short kwxCursorPointLeft = 7; | |
992 | const short kwxCursorQuestionArrow = 8; | |
993 | const short kwxCursorRightArrow = 9; | |
994 | const short kwxCursorSizeNS = 10; | |
995 | const short kwxCursorSize = 11; | |
996 | const short kwxCursorSizeNESW = 12; | |
997 | const short kwxCursorSizeNWSE = 13; | |
998 | const short kwxCursorRoller = 14; | |
999 | const short kwxCursorLast = kwxCursorRoller; | |
1000 | ||
1001 | // exposing our fallback cursor map | |
1002 | ||
1003 | extern ClassicCursor gMacCursors[]; | |
1004 | ||
bcb07ff0 SC |
1005 | // |
1006 | // | |
1007 | // | |
1008 | ||
1009 | #if wxUSE_GUI | |
1010 | ||
1011 | class wxNonOwnedWindowCarbonImpl : public wxNonOwnedWindowImpl | |
1012 | { | |
1013 | public : | |
1014 | wxNonOwnedWindowCarbonImpl( wxNonOwnedWindow* nonownedwnd) ; | |
1015 | wxNonOwnedWindowCarbonImpl(); | |
1016 | virtual ~wxNonOwnedWindowCarbonImpl(); | |
1017 | ||
1018 | virtual void Destroy() ; | |
1019 | void Create( wxWindow* parent, const wxPoint& pos, const wxSize& size, | |
1020 | long style, long extraStyle, const wxString& name ) ; | |
1021 | ||
1022 | WXWindow GetWXWindow() const; | |
1023 | void Raise(); | |
1024 | void Lower(); | |
1025 | bool Show(bool show); | |
1026 | bool ShowWithEffect(bool show, wxShowEffect effect, unsigned timeout); | |
1027 | ||
1028 | ||
1029 | void Update(); | |
1030 | bool SetTransparent(wxByte alpha); | |
1031 | bool SetBackgroundColour(const wxColour& col ); | |
1032 | void SetExtraStyle( long exStyle ); | |
1033 | bool SetBackgroundStyle(wxBackgroundStyle style); | |
1034 | bool CanSetTransparent(); | |
1035 | void MoveWindow(int x, int y, int width, int height); | |
1036 | void GetPosition( int &x, int &y ) const; | |
1037 | void GetSize( int &width, int &height ) const; | |
1038 | void GetContentArea( int &left , int &top , int &width , int &height ) const; | |
1039 | ||
1040 | bool SetShape(const wxRegion& region); | |
1041 | ||
1042 | virtual void SetTitle( const wxString& title, wxFontEncoding encoding ) ; | |
1043 | ||
1044 | virtual bool IsMaximized() const; | |
1045 | ||
1046 | virtual bool IsIconized() const; | |
1047 | ||
1048 | virtual void Iconize( bool iconize ); | |
1049 | ||
1050 | virtual void Maximize(bool maximize); | |
1051 | ||
1052 | virtual bool IsFullScreen() const; | |
1053 | ||
1054 | virtual bool ShowFullScreen(bool show, long style); | |
1055 | ||
1056 | virtual void RequestUserAttention(int flags); | |
1057 | ||
1058 | virtual void ScreenToWindow( int *x, int *y ); | |
1059 | ||
1060 | virtual void WindowToScreen( int *x, int *y ); | |
1061 | ||
1062 | ||
1063 | bool MacGetUnifiedAppearance() const ; | |
1064 | void MacChangeWindowAttributes( wxUint32 attributesToSet , wxUint32 attributesToClear ) ; | |
1065 | wxUint32 MacGetWindowAttributes() const ; | |
1066 | void MacSetMetalAppearance( bool set ) ; | |
1067 | bool MacGetMetalAppearance() const ; | |
1068 | void MacSetUnifiedAppearance( bool set ); | |
1069 | ||
1070 | WXEVENTHANDLERREF MacGetEventHandler() { return m_macEventHandler ; } | |
1071 | ||
1072 | wxNonOwnedWindow* GetWXPeer() { return m_wxPeer; } | |
1073 | protected : | |
1074 | void MacInstallTopLevelWindowEventHandler(); | |
1075 | ||
1076 | WXEVENTHANDLERREF m_macEventHandler ; | |
1077 | WindowRef m_macWindow; | |
1078 | void * m_macFullScreenData ; | |
1079 | DECLARE_DYNAMIC_CLASS_NO_COPY(wxNonOwnedWindowCarbonImpl) | |
1080 | }; | |
1081 | ||
1082 | #endif // wxUSE_GUI | |
1083 | ||
5c6eb3a8 SC |
1084 | #endif |
1085 | // _WX_PRIVATE_H_ |