]>
Commit | Line | Data |
---|---|---|
8cf73271 SC |
1 | ///////////////////////////////////////////////////////////////////////////// |
2 | // Name: private.h | |
3 | // Purpose: Private declarations: as this header is only included by | |
77ffb593 | 4 | // wxWidgets itself, it may contain identifiers which don't start |
8cf73271 SC |
5 | // with "wx". |
6 | // Author: Stefan Csomor | |
7 | // Modified by: | |
8 | // Created: 1998-01-01 | |
9 | // RCS-ID: $Id$ | |
10 | // Copyright: (c) Stefan Csomor | |
65571936 | 11 | // Licence: wxWindows licence |
8cf73271 SC |
12 | ///////////////////////////////////////////////////////////////////////////// |
13 | ||
14 | #ifndef _WX_PRIVATE_H_ | |
15 | #define _WX_PRIVATE_H_ | |
16 | ||
17 | #include "wx/defs.h" | |
18 | #include "wx/app.h" | |
19 | ||
20 | #ifdef __DARWIN__ | |
21 | # include <Carbon/Carbon.h> | |
22 | #else | |
4f305456 | 23 | # include <Debugging.h> |
8cf73271 SC |
24 | # include <Quickdraw.h> |
25 | # include <Appearance.h> | |
26 | # include <Folders.h> | |
27 | # include <Controls.h> | |
28 | # include <ControlDefinitions.h> | |
29 | # include <LowMem.h> | |
30 | # include <Gestalt.h> | |
31 | #endif | |
32 | ||
33 | #if UNIVERSAL_INTERFACES_VERSION < 0x0340 | |
34 | #error "please update to Apple's lastest universal headers from http://developer.apple.com/sdk/" | |
35 | #endif | |
36 | ||
c3a404b0 SC |
37 | #ifndef MAC_OS_X_VERSION_10_3 |
38 | #define MAC_OS_X_VERSION_10_3 1030 | |
39 | #endif | |
40 | ||
8cf73271 SC |
41 | #if wxUSE_GUI |
42 | ||
43 | #include "wx/window.h" | |
44 | ||
45 | class wxMacPortStateHelper | |
46 | { | |
47 | DECLARE_NO_COPY_CLASS(wxMacPortStateHelper) | |
48 | ||
49 | public: | |
50 | wxMacPortStateHelper( GrafPtr newport) ; | |
51 | wxMacPortStateHelper() ; | |
52 | ~wxMacPortStateHelper() ; | |
53 | ||
54 | void Setup( GrafPtr newport ) ; | |
55 | void Clear() ; | |
56 | bool IsCleared() { return m_clip == NULL ; } | |
57 | GrafPtr GetCurrentPort() { return m_currentPort ; } | |
58 | ||
59 | private: | |
60 | GrafPtr m_currentPort ; | |
61 | GrafPtr m_oldPort ; | |
62 | RgnHandle m_clip ; | |
63 | ThemeDrawingState m_drawingState ; | |
64 | short m_textFont ; | |
65 | short m_textSize ; | |
66 | short m_textStyle ; | |
67 | short m_textMode ; | |
68 | } ; | |
69 | ||
4f305456 SC |
70 | class WXDLLEXPORT wxMacPortSaver |
71 | { | |
72 | DECLARE_NO_COPY_CLASS(wxMacPortSaver) | |
73 | ||
74 | public: | |
75 | wxMacPortSaver( GrafPtr port ) | |
76 | { | |
77 | ::GetPort( &m_port ) ; | |
78 | ::SetPort( port ) ; | |
79 | } | |
80 | ~wxMacPortSaver() | |
81 | { | |
82 | ::SetPort( m_port ) ; | |
83 | } | |
84 | private : | |
85 | GrafPtr m_port ; | |
86 | } ; | |
87 | ||
8cf73271 SC |
88 | class WXDLLEXPORT wxMacPortSetter |
89 | { | |
90 | DECLARE_NO_COPY_CLASS(wxMacPortSetter) | |
91 | ||
92 | public: | |
93 | wxMacPortSetter( const wxDC* dc ) ; | |
94 | ~wxMacPortSetter() ; | |
95 | private: | |
96 | wxMacPortStateHelper m_ph ; | |
97 | const wxDC* m_dc ; | |
98 | } ; | |
99 | ||
4f305456 SC |
100 | /* |
101 | Clips to the visible region of a control within the current port | |
102 | */ | |
103 | ||
104 | class WXDLLEXPORT wxMacWindowClipper : public wxMacPortSaver | |
8cf73271 SC |
105 | { |
106 | DECLARE_NO_COPY_CLASS(wxMacWindowClipper) | |
107 | ||
108 | public: | |
109 | wxMacWindowClipper( const wxWindow* win ) ; | |
110 | ~wxMacWindowClipper() ; | |
111 | private: | |
01299d56 | 112 | GrafPtr m_newPort ; |
8cf73271 SC |
113 | RgnHandle m_formerClip ; |
114 | RgnHandle m_newClip ; | |
115 | } ; | |
116 | ||
01299d56 SC |
117 | class WXDLLEXPORT wxMacWindowStateSaver : public wxMacWindowClipper |
118 | { | |
119 | DECLARE_NO_COPY_CLASS(wxMacWindowStateSaver) | |
120 | ||
121 | public: | |
122 | wxMacWindowStateSaver( const wxWindow* win ) ; | |
123 | ~wxMacWindowStateSaver() ; | |
124 | private: | |
125 | GrafPtr m_newPort ; | |
126 | ThemeDrawingState m_themeDrawingState ; | |
127 | } ; | |
128 | ||
4f305456 | 129 | /* |
8cf73271 SC |
130 | class wxMacDrawingHelper |
131 | { | |
132 | DECLARE_NO_COPY_CLASS(wxMacDrawingHelper) | |
133 | ||
134 | public: | |
135 | wxMacDrawingHelper( wxWindowMac * theWindow , bool clientArea = false ) ; | |
136 | ~wxMacDrawingHelper() ; | |
137 | bool Ok() { return m_ok ; } | |
138 | void LocalToWindow( Rect *rect) { OffsetRect( rect , m_origin.h , m_origin.v ) ; } | |
139 | void LocalToWindow( Point *pt ) { AddPt( m_origin , pt ) ; } | |
140 | void LocalToWindow( RgnHandle rgn ) { OffsetRgn( rgn , m_origin.h , m_origin.v ) ; } | |
141 | const Point& GetOrigin() { return m_origin ; } | |
142 | private: | |
143 | Point m_origin ; | |
144 | GrafPtr m_formerPort ; | |
145 | GrafPtr m_currentPort ; | |
146 | PenState m_savedPenState ; | |
147 | bool m_ok ; | |
148 | } ; | |
4f305456 | 149 | */ |
8cf73271 SC |
150 | |
151 | // app.h | |
152 | bool wxMacConvertEventToRecord( EventRef event , EventRecord *rec) ; | |
153 | ||
154 | #endif // wxUSE_GUI | |
155 | ||
156 | // filefn.h | |
157 | WXDLLEXPORT wxString wxMacFSSpec2MacFilename( const FSSpec *spec ) ; | |
a2b77260 | 158 | WXDLLEXPORT void wxMacFilename2FSSpec( const wxString &path , FSSpec *spec ) ; |
8cf73271 SC |
159 | |
160 | // utils.h | |
161 | WXDLLEXPORT wxString wxMacFindFolder(short vRefNum, | |
162 | OSType folderType, | |
163 | Boolean createFolder); | |
164 | ||
165 | #if wxUSE_GUI | |
166 | ||
167 | GWorldPtr wxMacCreateGWorld( int width , int height , int depth ) ; | |
168 | void wxMacDestroyGWorld( GWorldPtr gw ) ; | |
169 | PicHandle wxMacCreatePict( GWorldPtr gw , GWorldPtr mask = NULL ) ; | |
170 | CIconHandle wxMacCreateCIcon(GWorldPtr image , GWorldPtr mask , short dstDepth , short iconSize ) ; | |
171 | void wxMacSetColorTableEntry( CTabHandle newColors , int index , int red , int green , int blue ) ; | |
172 | CTabHandle wxMacCreateColorTable( int numColors ) ; | |
173 | void wxMacCreateBitmapButton( ControlButtonContentInfo*info , const wxBitmap& bitmap , int forceType = 0 ) ; | |
174 | ||
175 | #define MAC_WXCOLORREF(a) (*((RGBColor*)&(a))) | |
176 | #define MAC_WXHBITMAP(a) (GWorldPtr(a)) | |
177 | #define MAC_WXHMETAFILE(a) (PicHandle(a)) | |
178 | #define MAC_WXHICON(a) (CIconHandle(a)) | |
179 | #define MAC_WXHCURSOR(a) (CursHandle(a)) | |
180 | #define MAC_WXHRGN(a) (RgnHandle(a)) | |
181 | #define MAC_WXHWND(a) (WindowPtr(a)) | |
182 | #define MAC_WXRECPTR(a) ((Rect*)a) | |
183 | #define MAC_WXPOINTPTR(a) ((Point*)a) | |
184 | #define MAC_WXHMENU(a) ((MenuHandle)a) | |
185 | ||
4f305456 SC |
186 | struct wxOpaqueWindowRef |
187 | { | |
188 | wxOpaqueWindowRef( WindowRef ref ) { m_data = ref ; } | |
189 | operator WindowRef() { return m_data ; } | |
190 | private : | |
191 | WindowRef m_data ; | |
192 | } ; | |
193 | ||
41b53169 SC |
194 | wxWindow * wxFindControlFromMacControl(ControlRef inControl ) ; |
195 | wxTopLevelWindowMac* wxFindWinFromMacWindow( WindowRef inWindow ) ; | |
196 | wxMenu* wxFindMenuFromMacMenu(MenuRef inMenuRef) ; | |
197 | ||
4f305456 SC |
198 | extern wxWindow* g_MacLastWindow ; |
199 | pascal OSStatus wxMacTopLevelMouseEventHandler( EventHandlerCallRef handler , EventRef event , void *data ) ; | |
271cad4c | 200 | Rect wxMacGetBoundsForControl( wxWindow* window , const wxPoint& pos , const wxSize &size , bool adjustForOrigin = true ) ; |
4f305456 SC |
201 | |
202 | template<typename T> EventParamType wxMacGetEventParamType() { wxFAIL_MSG( wxT("Unknown Param Type") ) ; return 0 ; } | |
203 | template<> inline EventParamType wxMacGetEventParamType<RgnHandle>() { return typeQDRgnHandle ; } | |
204 | template<> inline EventParamType wxMacGetEventParamType<ControlRef>() { return typeControlRef ; } | |
205 | template<> inline EventParamType wxMacGetEventParamType<WindowRef>() { return typeWindowRef ; } | |
206 | template<> inline EventParamType wxMacGetEventParamType<MenuRef>() { return typeMenuRef ; } | |
207 | template<> inline EventParamType wxMacGetEventParamType<EventRef>() { return typeEventRef ; } | |
208 | template<> inline EventParamType wxMacGetEventParamType<Point>() { return typeQDPoint ; } | |
209 | template<> inline EventParamType wxMacGetEventParamType<Rect>() { return typeQDRectangle ; } | |
210 | template<> inline EventParamType wxMacGetEventParamType<Boolean>() { return typeBoolean ; } | |
211 | #if TARGET_API_MAC_OSX | |
6d4c54a7 | 212 | template<> inline EventParamType wxMacGetEventParamType<HICommand>() { return typeHICommand ; } |
4f305456 SC |
213 | template<> inline EventParamType wxMacGetEventParamType<HIPoint>() { return typeHIPoint ; } |
214 | template<> inline EventParamType wxMacGetEventParamType<HISize>() { return typeHISize ; } | |
215 | template<> inline EventParamType wxMacGetEventParamType<HIRect>() { return typeHIRect ; } | |
216 | template<> inline EventParamType wxMacGetEventParamType<void*>() { return typeVoidPtr ; } | |
217 | #endif | |
218 | template<> inline EventParamType wxMacGetEventParamType<Collection>() { return typeCollection ; } | |
219 | template<> inline EventParamType wxMacGetEventParamType<CGContextRef>() { return typeCGContextRef ; } | |
220 | /* | |
221 | These are ambiguous | |
222 | template<> EventParamType wxMacGetEventParamType<GrafPtr>() { return typeGrafPtr ; } | |
223 | template<> EventParamType wxMacGetEventParamType<OSStatus>() { return typeOSStatus ; } | |
224 | template<> EventParamType wxMacGetEventParamType<CFIndex>() { return typeCFIndex ; } | |
225 | template<> EventParamType wxMacGetEventParamType<GWorldPtr>() { return typeGWorldPtr ; } | |
226 | */ | |
227 | ||
228 | class wxMacCarbonEvent | |
229 | { | |
230 | ||
231 | public : | |
6d4c54a7 | 232 | wxMacCarbonEvent( EventRef event , bool release = false ) |
4f305456 SC |
233 | { |
234 | m_eventRef = event ; | |
6d4c54a7 SC |
235 | m_release = release ; |
236 | } | |
237 | wxMacCarbonEvent(UInt32 inClassID,UInt32 inKind,EventTime inWhen = 0 /*now*/,EventAttributes inAttributes=kEventAttributeNone) | |
238 | { | |
239 | m_eventRef = NULL ; | |
240 | verify_noerr( MacCreateEvent( NULL , inClassID, inKind,inWhen,inAttributes,&m_eventRef) ) ; | |
241 | m_release = true ; | |
242 | } | |
243 | ~wxMacCarbonEvent() | |
244 | { | |
245 | if ( m_release ) | |
246 | ReleaseEvent( m_eventRef ) ; | |
4f305456 SC |
247 | } |
248 | ||
249 | OSStatus GetParameter( EventParamName inName, EventParamType inDesiredType, UInt32 inBufferSize, void * outData) ; | |
250 | ||
251 | template <typename T> OSStatus GetParameter( EventParamName inName, EventParamType type , T *data ) | |
252 | { | |
253 | return GetParameter( inName, type , sizeof( T ) , data ) ; | |
254 | } | |
255 | template <typename T> OSStatus GetParameter( EventParamName inName, T *data ) | |
256 | { | |
257 | return GetParameter<T>( inName, wxMacGetEventParamType<T>() , data ) ; | |
258 | } | |
259 | ||
260 | template <typename T> T GetParameter( EventParamName inName ) | |
261 | { | |
262 | T value ; | |
263 | verify_noerr( GetParameter<T>( inName, &value ) ) ; | |
264 | return value ; | |
265 | } | |
266 | template <typename T> T GetParameter( EventParamName inName, EventParamType inDesiredType ) | |
267 | { | |
268 | T value ; | |
269 | verify_noerr( GetParameter<T>( inName, inDesiredType , &value ) ) ; | |
270 | return value ; | |
271 | } | |
272 | ||
6d4c54a7 SC |
273 | OSStatus SetParameter( EventParamName inName, EventParamType inType, UInt32 inSize, const void * inData) ; |
274 | template <typename T> OSStatus SetParameter( EventParamName inName, EventParamType inDesiredType , const T *data ) | |
4f305456 | 275 | { |
2aefa0ef SC |
276 | return SetParameter( inName, inDesiredType , sizeof( T ) , data ) ; |
277 | } | |
6d4c54a7 | 278 | template <typename T> OSStatus SetParameter( EventParamName inName, EventParamType inDesiredType , const T& data ) |
2aefa0ef SC |
279 | { |
280 | return SetParameter<T>( inName, inDesiredType , &data ) ; | |
4f305456 | 281 | } |
6d4c54a7 | 282 | template <typename T> OSStatus SetParameter( EventParamName inName, const T *data ) |
4f305456 SC |
283 | { |
284 | return SetParameter<T>( inName, wxMacGetEventParamType<T>() , data ) ; | |
285 | } | |
6d4c54a7 | 286 | template <typename T> OSStatus SetParameter( EventParamName inName, const T& data ) |
2aefa0ef SC |
287 | { |
288 | return SetParameter<T>( inName, wxMacGetEventParamType<T>() , &data ) ; | |
289 | } | |
86d8b744 SC |
290 | UInt32 GetClass() |
291 | { | |
292 | return ::GetEventClass( m_eventRef ) ; | |
293 | } | |
41b53169 | 294 | UInt32 GetKind() |
4f305456 SC |
295 | { |
296 | return ::GetEventKind( m_eventRef ) ; | |
297 | } | |
298 | EventTime GetTime() | |
299 | { | |
300 | return ::GetEventTime( m_eventRef ) ; | |
301 | } | |
302 | UInt32 GetTicks() | |
303 | { | |
304 | return EventTimeToTicks( GetTime() ) ; | |
305 | } | |
6d4c54a7 | 306 | operator EventRef () { return m_eventRef; } |
4f305456 SC |
307 | protected : |
308 | EventRef m_eventRef ; | |
6d4c54a7 | 309 | bool m_release ; |
4f305456 SC |
310 | } ; |
311 | ||
86d8b744 SC |
312 | class wxMacControl |
313 | { | |
314 | public : | |
6d4c54a7 SC |
315 | wxMacControl() |
316 | { | |
317 | m_controlRef = NULL ; | |
318 | } | |
319 | ||
86d8b744 SC |
320 | wxMacControl( ControlRef control ) |
321 | { | |
322 | m_controlRef = control ; | |
323 | } | |
324 | wxMacControl( WXWidget control ) | |
325 | { | |
326 | m_controlRef = (ControlRef) control ; | |
327 | } | |
0fc3bc3b SC |
328 | virtual ~wxMacControl() |
329 | { | |
330 | } | |
6d4c54a7 | 331 | |
5ca0d812 SC |
332 | virtual void Dispose() ; |
333 | ||
334 | bool Ok() const { return GetControlRef() != NULL ; } | |
335 | ||
336 | virtual ControlRef * GetControlRefAddr() { return &m_controlRef; } | |
337 | virtual ControlRef GetControlRef() const { return m_controlRef ; } | |
338 | ||
339 | virtual void SetReference( SInt32 data ) ; | |
340 | /* | |
2837271a SC |
341 | void operator= (ControlRef c) { m_controlRef = c ; } |
342 | operator ControlRef () { return m_controlRef; } | |
343 | operator ControlRef * () { return &m_controlRef; } | |
5ca0d812 | 344 | */ |
2837271a SC |
345 | // accessing data and values |
346 | ||
347 | virtual OSStatus SetData( ControlPartCode inPartCode , ResType inTag , Size inSize , const void * inData ) ; | |
0fc3bc3b SC |
348 | virtual OSStatus GetData( ControlPartCode inPartCode , ResType inTag , Size inBufferSize , void * inOutBuffer , Size * outActualSize ) const ; |
349 | virtual OSStatus GetDataSize( ControlPartCode inPartCode , ResType inTag , Size * outActualSize ) const ; | |
2837271a SC |
350 | virtual OSStatus SendEvent( EventRef ref , OptionBits inOptions = 0 ) ; |
351 | virtual OSStatus SendHICommand( HICommand &command , OptionBits inOptions = 0 ) ; | |
352 | ||
0fc3bc3b | 353 | virtual OSStatus SendHICommand( UInt32 commandID , OptionBits inOptions = 0 ) ; |
2837271a | 354 | |
0fc3bc3b SC |
355 | virtual SInt32 GetValue() const ; |
356 | virtual SInt32 GetMaximum() const ; | |
357 | virtual SInt32 GetMinimum() const ; | |
2837271a | 358 | |
0fc3bc3b SC |
359 | virtual void SetValue( SInt32 v ) ; |
360 | virtual void SetMinimum( SInt32 v ) ; | |
361 | virtual void SetMaximum( SInt32 v ) ; | |
2837271a | 362 | |
0fc3bc3b SC |
363 | virtual void SetValueAndRange( SInt32 value , SInt32 minimum , SInt32 maximum ) ; |
364 | virtual void SetRange( SInt32 minimum , SInt32 maximum ) ; | |
2837271a | 365 | |
5ca0d812 SC |
366 | virtual OSStatus SetFocus( ControlFocusPart focusPart ) ; |
367 | virtual bool HasFocus() const ; | |
368 | virtual bool NeedsFocusRect() const ; | |
369 | ||
2837271a SC |
370 | // templated helpers |
371 | ||
0fc3bc3b | 372 | Size GetDataSize( ControlPartCode inPartCode , ResType inTag ) const |
86d8b744 SC |
373 | { |
374 | Size sz ; | |
375 | verify_noerr( GetDataSize( inPartCode , inTag , &sz ) ) ; | |
376 | return sz ; | |
377 | } | |
6d4c54a7 | 378 | template <typename T> OSStatus SetData( ControlPartCode inPartCode , ResType inTag , const T *data ) |
86d8b744 SC |
379 | { |
380 | return SetData( inPartCode , inTag , sizeof( T ) , data ) ; | |
381 | } | |
6d4c54a7 | 382 | template <typename T> OSStatus SetData( ControlPartCode inPartCode , ResType inTag , const T& data ) |
86d8b744 SC |
383 | { |
384 | return SetData( inPartCode , inTag , sizeof( T ) , &data ) ; | |
385 | } | |
0fc3bc3b | 386 | template <typename T> OSStatus GetData( ControlPartCode inPartCode , ResType inTag , T *data ) const |
86d8b744 SC |
387 | { |
388 | Size dummy ; | |
389 | return GetData( inPartCode , inTag , sizeof( T ) , data , &dummy ) ; | |
390 | } | |
0fc3bc3b | 391 | template <typename T> T GetData( ControlPartCode inPartCode , ResType inTag ) const |
86d8b744 SC |
392 | { |
393 | T value ; | |
394 | verify_noerr( GetData<T>( inPartCode , inTag , &value ) ) ; | |
395 | return value ; | |
396 | } | |
2837271a | 397 | |
6d4c54a7 | 398 | // Flash the control for the specified amount of time |
0fc3bc3b SC |
399 | virtual void Flash( ControlPartCode part , UInt32 ticks = 8 ) ; |
400 | virtual void VisibilityChanged( bool shown ) ; | |
401 | virtual void SetFont( const wxFont & font , const wxColour& foreground , long windowStyle ) ; | |
7ea087b7 | 402 | virtual void SetBackground( const wxBrush &brush ) ; |
5ca0d812 SC |
403 | virtual ControlPartCode HandleKey( SInt16 keyCode, SInt16 charCode, EventModifiers modifiers ) ; |
404 | void SetActionProc( ControlActionUPP actionProc ) ; | |
405 | void SetViewSize( SInt32 viewSize ) ; | |
406 | SInt32 GetViewSize() const ; | |
407 | ||
408 | virtual bool IsVisible() const ; | |
409 | virtual void SetVisibility( bool visible , bool redraw ) ; | |
410 | virtual bool IsEnabled() const ; | |
411 | virtual bool IsActive() const ; | |
412 | virtual void Enable( bool enable ) ; | |
413 | ||
414 | // invalidates this control and all children | |
415 | virtual void InvalidateWithChildren() ; | |
416 | virtual void SetDrawingEnabled( bool enable ) ; | |
417 | virtual bool GetNeedsDisplay() const ; | |
418 | virtual void SetNeedsDisplay( bool needsDisplay , RgnHandle where = NULL ) ; | |
419 | ||
420 | virtual void ScrollRect( const wxRect &rect , int dx , int dy ) ; | |
421 | ||
422 | virtual void GetRect( Rect *r ) ; | |
423 | virtual void SetRect( Rect *r ) ; | |
424 | virtual void GetRectInWindowCoords( Rect *r ) ; | |
425 | virtual void GetBestRect( Rect *r ) ; | |
426 | virtual void SetTitle( const wxString &title ) ; | |
427 | // converts from Toplevel-Content relative to local | |
428 | static void Convert( wxPoint *pt , wxMacControl *convert , wxMacControl *to ) ; | |
429 | ||
430 | virtual void GetFeatures( UInt32 *features ) ; | |
431 | virtual OSStatus GetRegion( ControlPartCode partCode , RgnHandle region ) ; | |
432 | virtual OSStatus SetZOrder( bool above , wxMacControl* other ) ; | |
433 | // to be moved into a databrowser subclass | |
434 | ||
435 | virtual OSStatus SetSelectionFlags( DataBrowserSelectionFlags ) ; | |
436 | virtual OSStatus AddListViewColumn( DataBrowserListViewColumnDesc *columnDesc, | |
437 | DataBrowserTableViewColumnIndex position ) ; | |
438 | virtual OSStatus AutoSizeListViewColumns() ; | |
439 | virtual OSStatus SetHasScrollBars( bool horiz , bool vert ) ; | |
440 | virtual OSStatus SetTableViewHiliteStyle( DataBrowserTableViewHiliteStyle hiliteStyle ) ; | |
441 | virtual OSStatus SetListViewHeaderBtnHeight(UInt16 height) ; | |
442 | virtual OSStatus SetCallbacks(const DataBrowserCallbacks * callbacks) ; | |
443 | virtual OSStatus UpdateItems( DataBrowserItemID container, UInt32 numItems, | |
444 | const DataBrowserItemID* items, | |
445 | DataBrowserPropertyID preSortProperty, | |
446 | DataBrowserPropertyID propertyID ) ; | |
447 | virtual OSStatus AddItems( DataBrowserItemID container, UInt32 numItems, | |
448 | const DataBrowserItemID* items, | |
449 | DataBrowserPropertyID preSortProperty ) ; | |
450 | virtual OSStatus RemoveItems( DataBrowserItemID container, UInt32 numItems, | |
451 | const DataBrowserItemID* items, | |
452 | DataBrowserPropertyID preSortProperty ) ; | |
453 | virtual OSStatus RevealItem( DataBrowserItemID item, | |
454 | DataBrowserPropertyID propertyID, | |
455 | DataBrowserRevealOptions options ) ; | |
456 | virtual bool IsItemSelected( DataBrowserItemID item ) ; | |
457 | virtual OSStatus SetSelectedItems(UInt32 numItems, | |
458 | const DataBrowserItemID * items, | |
459 | DataBrowserSetOption operation ) ; | |
460 | ||
461 | // to be moved into a tab control class | |
462 | ||
463 | virtual OSStatus SetTabEnabled( SInt16 tabNo , bool enable ) ; | |
86d8b744 | 464 | protected : |
0fc3bc3b SC |
465 | ControlRef m_controlRef ; |
466 | wxFont m_font ; | |
467 | long m_windowStyle ; | |
86d8b744 SC |
468 | } ; |
469 | ||
8cf73271 SC |
470 | #endif // wxUSE_GUI |
471 | ||
472 | //--------------------------------------------------------------------------- | |
473 | // wxMac string conversions | |
474 | //--------------------------------------------------------------------------- | |
475 | ||
476 | void wxMacSetupConverters() ; | |
477 | void wxMacCleanupConverters() ; | |
478 | ||
479 | void wxMacStringToPascal( const wxString&from , StringPtr to ) ; | |
480 | wxString wxMacMakeStringFromPascal( ConstStringPtr from ) ; | |
481 | ||
482 | void wxMacConvertNewlines13To10( char * data ) ; | |
483 | void wxMacConvertNewlines10To13( char * data ) ; | |
484 | void wxMacConvertNewlines13To10( wxString *data ) ; | |
485 | void wxMacConvertNewlines10To13( wxString *data ) ; | |
486 | ||
487 | #if wxUSE_UNICODE | |
488 | void wxMacConvertNewlines13To10( wxChar * data ) ; | |
489 | void wxMacConvertNewlines10To13( wxChar * data ) ; | |
490 | #endif | |
491 | ||
492 | #if TARGET_CARBON | |
493 | ||
494 | class wxMacCFStringHolder | |
495 | { | |
496 | public: | |
497 | wxMacCFStringHolder() | |
498 | { | |
499 | m_cfs = NULL ; | |
500 | m_release = false ; | |
501 | } | |
502 | ||
503 | wxMacCFStringHolder(const wxString &str , wxFontEncoding encoding ) | |
504 | { | |
505 | m_cfs = NULL ; | |
506 | m_release = false ; | |
507 | Assign( str , encoding ) ; | |
508 | } | |
509 | ||
510 | wxMacCFStringHolder(CFStringRef ref , bool release = true ) | |
511 | { | |
512 | m_cfs = ref ; | |
513 | m_release = release ; | |
514 | } | |
515 | ||
516 | ~wxMacCFStringHolder() | |
517 | { | |
518 | Release() ; | |
519 | } | |
520 | ||
521 | CFStringRef Detach() | |
522 | { | |
523 | CFStringRef retval = m_cfs ; | |
524 | m_release = false ; | |
525 | m_cfs = NULL ; | |
526 | return retval ; | |
527 | } | |
528 | ||
529 | void Release() | |
530 | { | |
531 | if ( m_release && m_cfs) | |
532 | CFRelease( m_cfs ) ; | |
533 | m_cfs = NULL ; | |
534 | } | |
535 | ||
536 | void Assign( const wxString &str , wxFontEncoding encoding ) ; | |
537 | ||
538 | operator CFStringRef () { return m_cfs; } | |
539 | wxString AsString( wxFontEncoding encoding = wxFONTENCODING_DEFAULT ) ; | |
540 | ||
541 | private: | |
542 | ||
543 | CFStringRef m_cfs; | |
544 | bool m_release ; | |
545 | } ; | |
546 | ||
547 | #endif | |
548 | ||
1a42f89c | 549 | // utils.cpp |
8cf73271 SC |
550 | |
551 | wxUint32 wxMacGetSystemEncFromFontEnc(wxFontEncoding encoding) ; | |
552 | wxFontEncoding wxMacGetFontEncFromSystemEnc(wxUint32 encoding) ; | |
6c85f776 | 553 | void wxMacWakeUp() ; |
8cf73271 | 554 | |
1a42f89c SC |
555 | // toplevel.cpp |
556 | ||
557 | ControlRef wxMacFindControlUnderMouse( Point location , WindowRef window , ControlPartCode *outPart ) ; | |
8cf73271 | 558 | |
a2b77260 SC |
559 | // filefn.cpp |
560 | ||
561 | wxString wxMacFSRefToPath( const FSRef *fsRef , CFStringRef additionalPathComponent = NULL ) ; | |
562 | OSStatus wxMacPathToFSRef( const wxString&path , FSRef *fsRef ) ; | |
563 | wxString wxMacHFSUniStrToString( ConstHFSUniStr255Param uniname ) ; | |
aa0cc8a1 | 564 | |
8cf73271 SC |
565 | #endif |
566 | // _WX_PRIVATE_H_ |