]>
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 ) ; | |
158 | WXDLLEXPORT void wxMacFilename2FSSpec( const char *path , FSSpec *spec ) ; | |
159 | WXDLLEXPORT void wxMacFilename2FSSpec( const wxChar *path , FSSpec *spec ) ; | |
160 | # ifndef __DARWIN__ | |
161 | // Mac file names are POSIX (Unix style) under Darwin, so these are not needed | |
162 | WXDLLEXPORT wxString wxMacFSSpec2UnixFilename( const FSSpec *spec ) ; | |
4f305456 SC |
163 | WXDLLEXPORT void wxUnixFilename2FSSpec( const char *path , FSSpec *spec ) ; |
164 | WXDLLEXPORT wxString wxMac2UnixFilename( const char *s) ; | |
165 | WXDLLEXPORT wxString wxUnix2MacFilename( const char *s); | |
8cf73271 SC |
166 | # endif |
167 | ||
168 | // utils.h | |
169 | WXDLLEXPORT wxString wxMacFindFolder(short vRefNum, | |
170 | OSType folderType, | |
171 | Boolean createFolder); | |
172 | ||
173 | #if wxUSE_GUI | |
174 | ||
175 | GWorldPtr wxMacCreateGWorld( int width , int height , int depth ) ; | |
176 | void wxMacDestroyGWorld( GWorldPtr gw ) ; | |
177 | PicHandle wxMacCreatePict( GWorldPtr gw , GWorldPtr mask = NULL ) ; | |
178 | CIconHandle wxMacCreateCIcon(GWorldPtr image , GWorldPtr mask , short dstDepth , short iconSize ) ; | |
179 | void wxMacSetColorTableEntry( CTabHandle newColors , int index , int red , int green , int blue ) ; | |
180 | CTabHandle wxMacCreateColorTable( int numColors ) ; | |
181 | void wxMacCreateBitmapButton( ControlButtonContentInfo*info , const wxBitmap& bitmap , int forceType = 0 ) ; | |
182 | ||
183 | #define MAC_WXCOLORREF(a) (*((RGBColor*)&(a))) | |
184 | #define MAC_WXHBITMAP(a) (GWorldPtr(a)) | |
185 | #define MAC_WXHMETAFILE(a) (PicHandle(a)) | |
186 | #define MAC_WXHICON(a) (CIconHandle(a)) | |
187 | #define MAC_WXHCURSOR(a) (CursHandle(a)) | |
188 | #define MAC_WXHRGN(a) (RgnHandle(a)) | |
189 | #define MAC_WXHWND(a) (WindowPtr(a)) | |
190 | #define MAC_WXRECPTR(a) ((Rect*)a) | |
191 | #define MAC_WXPOINTPTR(a) ((Point*)a) | |
192 | #define MAC_WXHMENU(a) ((MenuHandle)a) | |
193 | ||
4f305456 SC |
194 | struct wxOpaqueWindowRef |
195 | { | |
196 | wxOpaqueWindowRef( WindowRef ref ) { m_data = ref ; } | |
197 | operator WindowRef() { return m_data ; } | |
198 | private : | |
199 | WindowRef m_data ; | |
200 | } ; | |
201 | ||
41b53169 SC |
202 | wxWindow * wxFindControlFromMacControl(ControlRef inControl ) ; |
203 | wxTopLevelWindowMac* wxFindWinFromMacWindow( WindowRef inWindow ) ; | |
204 | wxMenu* wxFindMenuFromMacMenu(MenuRef inMenuRef) ; | |
205 | ||
4f305456 SC |
206 | extern wxWindow* g_MacLastWindow ; |
207 | pascal OSStatus wxMacTopLevelMouseEventHandler( EventHandlerCallRef handler , EventRef event , void *data ) ; | |
271cad4c | 208 | Rect wxMacGetBoundsForControl( wxWindow* window , const wxPoint& pos , const wxSize &size , bool adjustForOrigin = true ) ; |
4f305456 SC |
209 | |
210 | template<typename T> EventParamType wxMacGetEventParamType() { wxFAIL_MSG( wxT("Unknown Param Type") ) ; return 0 ; } | |
211 | template<> inline EventParamType wxMacGetEventParamType<RgnHandle>() { return typeQDRgnHandle ; } | |
212 | template<> inline EventParamType wxMacGetEventParamType<ControlRef>() { return typeControlRef ; } | |
213 | template<> inline EventParamType wxMacGetEventParamType<WindowRef>() { return typeWindowRef ; } | |
214 | template<> inline EventParamType wxMacGetEventParamType<MenuRef>() { return typeMenuRef ; } | |
215 | template<> inline EventParamType wxMacGetEventParamType<EventRef>() { return typeEventRef ; } | |
216 | template<> inline EventParamType wxMacGetEventParamType<Point>() { return typeQDPoint ; } | |
217 | template<> inline EventParamType wxMacGetEventParamType<Rect>() { return typeQDRectangle ; } | |
218 | template<> inline EventParamType wxMacGetEventParamType<Boolean>() { return typeBoolean ; } | |
219 | #if TARGET_API_MAC_OSX | |
6d4c54a7 | 220 | template<> inline EventParamType wxMacGetEventParamType<HICommand>() { return typeHICommand ; } |
4f305456 SC |
221 | template<> inline EventParamType wxMacGetEventParamType<HIPoint>() { return typeHIPoint ; } |
222 | template<> inline EventParamType wxMacGetEventParamType<HISize>() { return typeHISize ; } | |
223 | template<> inline EventParamType wxMacGetEventParamType<HIRect>() { return typeHIRect ; } | |
224 | template<> inline EventParamType wxMacGetEventParamType<void*>() { return typeVoidPtr ; } | |
225 | #endif | |
226 | template<> inline EventParamType wxMacGetEventParamType<Collection>() { return typeCollection ; } | |
227 | template<> inline EventParamType wxMacGetEventParamType<CGContextRef>() { return typeCGContextRef ; } | |
228 | /* | |
229 | These are ambiguous | |
230 | template<> EventParamType wxMacGetEventParamType<GrafPtr>() { return typeGrafPtr ; } | |
231 | template<> EventParamType wxMacGetEventParamType<OSStatus>() { return typeOSStatus ; } | |
232 | template<> EventParamType wxMacGetEventParamType<CFIndex>() { return typeCFIndex ; } | |
233 | template<> EventParamType wxMacGetEventParamType<GWorldPtr>() { return typeGWorldPtr ; } | |
234 | */ | |
235 | ||
236 | class wxMacCarbonEvent | |
237 | { | |
238 | ||
239 | public : | |
6d4c54a7 | 240 | wxMacCarbonEvent( EventRef event , bool release = false ) |
4f305456 SC |
241 | { |
242 | m_eventRef = event ; | |
6d4c54a7 SC |
243 | m_release = release ; |
244 | } | |
245 | wxMacCarbonEvent(UInt32 inClassID,UInt32 inKind,EventTime inWhen = 0 /*now*/,EventAttributes inAttributes=kEventAttributeNone) | |
246 | { | |
247 | m_eventRef = NULL ; | |
248 | verify_noerr( MacCreateEvent( NULL , inClassID, inKind,inWhen,inAttributes,&m_eventRef) ) ; | |
249 | m_release = true ; | |
250 | } | |
251 | ~wxMacCarbonEvent() | |
252 | { | |
253 | if ( m_release ) | |
254 | ReleaseEvent( m_eventRef ) ; | |
4f305456 SC |
255 | } |
256 | ||
257 | OSStatus GetParameter( EventParamName inName, EventParamType inDesiredType, UInt32 inBufferSize, void * outData) ; | |
258 | ||
259 | template <typename T> OSStatus GetParameter( EventParamName inName, EventParamType type , T *data ) | |
260 | { | |
261 | return GetParameter( inName, type , sizeof( T ) , data ) ; | |
262 | } | |
263 | template <typename T> OSStatus GetParameter( EventParamName inName, T *data ) | |
264 | { | |
265 | return GetParameter<T>( inName, wxMacGetEventParamType<T>() , data ) ; | |
266 | } | |
267 | ||
268 | template <typename T> T GetParameter( EventParamName inName ) | |
269 | { | |
270 | T value ; | |
271 | verify_noerr( GetParameter<T>( inName, &value ) ) ; | |
272 | return value ; | |
273 | } | |
274 | template <typename T> T GetParameter( EventParamName inName, EventParamType inDesiredType ) | |
275 | { | |
276 | T value ; | |
277 | verify_noerr( GetParameter<T>( inName, inDesiredType , &value ) ) ; | |
278 | return value ; | |
279 | } | |
280 | ||
6d4c54a7 SC |
281 | OSStatus SetParameter( EventParamName inName, EventParamType inType, UInt32 inSize, const void * inData) ; |
282 | template <typename T> OSStatus SetParameter( EventParamName inName, EventParamType inDesiredType , const T *data ) | |
4f305456 | 283 | { |
2aefa0ef SC |
284 | return SetParameter( inName, inDesiredType , sizeof( T ) , data ) ; |
285 | } | |
6d4c54a7 | 286 | template <typename T> OSStatus SetParameter( EventParamName inName, EventParamType inDesiredType , const T& data ) |
2aefa0ef SC |
287 | { |
288 | return SetParameter<T>( inName, inDesiredType , &data ) ; | |
4f305456 | 289 | } |
6d4c54a7 | 290 | template <typename T> OSStatus SetParameter( EventParamName inName, const T *data ) |
4f305456 SC |
291 | { |
292 | return SetParameter<T>( inName, wxMacGetEventParamType<T>() , data ) ; | |
293 | } | |
6d4c54a7 | 294 | template <typename T> OSStatus SetParameter( EventParamName inName, const T& data ) |
2aefa0ef SC |
295 | { |
296 | return SetParameter<T>( inName, wxMacGetEventParamType<T>() , &data ) ; | |
297 | } | |
86d8b744 SC |
298 | UInt32 GetClass() |
299 | { | |
300 | return ::GetEventClass( m_eventRef ) ; | |
301 | } | |
41b53169 | 302 | UInt32 GetKind() |
4f305456 SC |
303 | { |
304 | return ::GetEventKind( m_eventRef ) ; | |
305 | } | |
306 | EventTime GetTime() | |
307 | { | |
308 | return ::GetEventTime( m_eventRef ) ; | |
309 | } | |
310 | UInt32 GetTicks() | |
311 | { | |
312 | return EventTimeToTicks( GetTime() ) ; | |
313 | } | |
6d4c54a7 | 314 | operator EventRef () { return m_eventRef; } |
4f305456 SC |
315 | protected : |
316 | EventRef m_eventRef ; | |
6d4c54a7 | 317 | bool m_release ; |
4f305456 SC |
318 | } ; |
319 | ||
86d8b744 SC |
320 | class wxMacControl |
321 | { | |
322 | public : | |
6d4c54a7 SC |
323 | wxMacControl() |
324 | { | |
325 | m_controlRef = NULL ; | |
326 | } | |
327 | ||
86d8b744 SC |
328 | wxMacControl( ControlRef control ) |
329 | { | |
330 | m_controlRef = control ; | |
331 | } | |
332 | wxMacControl( WXWidget control ) | |
333 | { | |
334 | m_controlRef = (ControlRef) control ; | |
335 | } | |
0fc3bc3b SC |
336 | virtual ~wxMacControl() |
337 | { | |
338 | } | |
6d4c54a7 | 339 | |
5ca0d812 SC |
340 | virtual void Dispose() ; |
341 | ||
342 | bool Ok() const { return GetControlRef() != NULL ; } | |
343 | ||
344 | virtual ControlRef * GetControlRefAddr() { return &m_controlRef; } | |
345 | virtual ControlRef GetControlRef() const { return m_controlRef ; } | |
346 | ||
347 | virtual void SetReference( SInt32 data ) ; | |
348 | /* | |
2837271a SC |
349 | void operator= (ControlRef c) { m_controlRef = c ; } |
350 | operator ControlRef () { return m_controlRef; } | |
351 | operator ControlRef * () { return &m_controlRef; } | |
5ca0d812 | 352 | */ |
2837271a SC |
353 | // accessing data and values |
354 | ||
355 | virtual OSStatus SetData( ControlPartCode inPartCode , ResType inTag , Size inSize , const void * inData ) ; | |
0fc3bc3b SC |
356 | virtual OSStatus GetData( ControlPartCode inPartCode , ResType inTag , Size inBufferSize , void * inOutBuffer , Size * outActualSize ) const ; |
357 | virtual OSStatus GetDataSize( ControlPartCode inPartCode , ResType inTag , Size * outActualSize ) const ; | |
2837271a SC |
358 | virtual OSStatus SendEvent( EventRef ref , OptionBits inOptions = 0 ) ; |
359 | virtual OSStatus SendHICommand( HICommand &command , OptionBits inOptions = 0 ) ; | |
360 | ||
0fc3bc3b | 361 | virtual OSStatus SendHICommand( UInt32 commandID , OptionBits inOptions = 0 ) ; |
2837271a | 362 | |
0fc3bc3b SC |
363 | virtual SInt32 GetValue() const ; |
364 | virtual SInt32 GetMaximum() const ; | |
365 | virtual SInt32 GetMinimum() const ; | |
2837271a | 366 | |
0fc3bc3b SC |
367 | virtual void SetValue( SInt32 v ) ; |
368 | virtual void SetMinimum( SInt32 v ) ; | |
369 | virtual void SetMaximum( SInt32 v ) ; | |
2837271a | 370 | |
0fc3bc3b SC |
371 | virtual void SetValueAndRange( SInt32 value , SInt32 minimum , SInt32 maximum ) ; |
372 | virtual void SetRange( SInt32 minimum , SInt32 maximum ) ; | |
2837271a | 373 | |
5ca0d812 SC |
374 | virtual OSStatus SetFocus( ControlFocusPart focusPart ) ; |
375 | virtual bool HasFocus() const ; | |
376 | virtual bool NeedsFocusRect() const ; | |
377 | ||
2837271a SC |
378 | // templated helpers |
379 | ||
0fc3bc3b | 380 | Size GetDataSize( ControlPartCode inPartCode , ResType inTag ) const |
86d8b744 SC |
381 | { |
382 | Size sz ; | |
383 | verify_noerr( GetDataSize( inPartCode , inTag , &sz ) ) ; | |
384 | return sz ; | |
385 | } | |
6d4c54a7 | 386 | template <typename T> OSStatus SetData( ControlPartCode inPartCode , ResType inTag , const T *data ) |
86d8b744 SC |
387 | { |
388 | return SetData( inPartCode , inTag , sizeof( T ) , data ) ; | |
389 | } | |
6d4c54a7 | 390 | template <typename T> OSStatus SetData( ControlPartCode inPartCode , ResType inTag , const T& data ) |
86d8b744 SC |
391 | { |
392 | return SetData( inPartCode , inTag , sizeof( T ) , &data ) ; | |
393 | } | |
0fc3bc3b | 394 | template <typename T> OSStatus GetData( ControlPartCode inPartCode , ResType inTag , T *data ) const |
86d8b744 SC |
395 | { |
396 | Size dummy ; | |
397 | return GetData( inPartCode , inTag , sizeof( T ) , data , &dummy ) ; | |
398 | } | |
0fc3bc3b | 399 | template <typename T> T GetData( ControlPartCode inPartCode , ResType inTag ) const |
86d8b744 SC |
400 | { |
401 | T value ; | |
402 | verify_noerr( GetData<T>( inPartCode , inTag , &value ) ) ; | |
403 | return value ; | |
404 | } | |
2837271a | 405 | |
6d4c54a7 | 406 | // Flash the control for the specified amount of time |
0fc3bc3b SC |
407 | virtual void Flash( ControlPartCode part , UInt32 ticks = 8 ) ; |
408 | virtual void VisibilityChanged( bool shown ) ; | |
409 | virtual void SetFont( const wxFont & font , const wxColour& foreground , long windowStyle ) ; | |
5ca0d812 SC |
410 | virtual ControlPartCode HandleKey( SInt16 keyCode, SInt16 charCode, EventModifiers modifiers ) ; |
411 | void SetActionProc( ControlActionUPP actionProc ) ; | |
412 | void SetViewSize( SInt32 viewSize ) ; | |
413 | SInt32 GetViewSize() const ; | |
414 | ||
415 | virtual bool IsVisible() const ; | |
416 | virtual void SetVisibility( bool visible , bool redraw ) ; | |
417 | virtual bool IsEnabled() const ; | |
418 | virtual bool IsActive() const ; | |
419 | virtual void Enable( bool enable ) ; | |
420 | ||
421 | // invalidates this control and all children | |
422 | virtual void InvalidateWithChildren() ; | |
423 | virtual void SetDrawingEnabled( bool enable ) ; | |
424 | virtual bool GetNeedsDisplay() const ; | |
425 | virtual void SetNeedsDisplay( bool needsDisplay , RgnHandle where = NULL ) ; | |
426 | ||
427 | virtual void ScrollRect( const wxRect &rect , int dx , int dy ) ; | |
428 | ||
429 | virtual void GetRect( Rect *r ) ; | |
430 | virtual void SetRect( Rect *r ) ; | |
431 | virtual void GetRectInWindowCoords( Rect *r ) ; | |
432 | virtual void GetBestRect( Rect *r ) ; | |
433 | virtual void SetTitle( const wxString &title ) ; | |
434 | // converts from Toplevel-Content relative to local | |
435 | static void Convert( wxPoint *pt , wxMacControl *convert , wxMacControl *to ) ; | |
436 | ||
437 | virtual void GetFeatures( UInt32 *features ) ; | |
438 | virtual OSStatus GetRegion( ControlPartCode partCode , RgnHandle region ) ; | |
439 | virtual OSStatus SetZOrder( bool above , wxMacControl* other ) ; | |
440 | // to be moved into a databrowser subclass | |
441 | ||
442 | virtual OSStatus SetSelectionFlags( DataBrowserSelectionFlags ) ; | |
443 | virtual OSStatus AddListViewColumn( DataBrowserListViewColumnDesc *columnDesc, | |
444 | DataBrowserTableViewColumnIndex position ) ; | |
445 | virtual OSStatus AutoSizeListViewColumns() ; | |
446 | virtual OSStatus SetHasScrollBars( bool horiz , bool vert ) ; | |
447 | virtual OSStatus SetTableViewHiliteStyle( DataBrowserTableViewHiliteStyle hiliteStyle ) ; | |
448 | virtual OSStatus SetListViewHeaderBtnHeight(UInt16 height) ; | |
449 | virtual OSStatus SetCallbacks(const DataBrowserCallbacks * callbacks) ; | |
450 | virtual OSStatus UpdateItems( DataBrowserItemID container, UInt32 numItems, | |
451 | const DataBrowserItemID* items, | |
452 | DataBrowserPropertyID preSortProperty, | |
453 | DataBrowserPropertyID propertyID ) ; | |
454 | virtual OSStatus AddItems( DataBrowserItemID container, UInt32 numItems, | |
455 | const DataBrowserItemID* items, | |
456 | DataBrowserPropertyID preSortProperty ) ; | |
457 | virtual OSStatus RemoveItems( DataBrowserItemID container, UInt32 numItems, | |
458 | const DataBrowserItemID* items, | |
459 | DataBrowserPropertyID preSortProperty ) ; | |
460 | virtual OSStatus RevealItem( DataBrowserItemID item, | |
461 | DataBrowserPropertyID propertyID, | |
462 | DataBrowserRevealOptions options ) ; | |
463 | virtual bool IsItemSelected( DataBrowserItemID item ) ; | |
464 | virtual OSStatus SetSelectedItems(UInt32 numItems, | |
465 | const DataBrowserItemID * items, | |
466 | DataBrowserSetOption operation ) ; | |
467 | ||
468 | // to be moved into a tab control class | |
469 | ||
470 | virtual OSStatus SetTabEnabled( SInt16 tabNo , bool enable ) ; | |
86d8b744 | 471 | protected : |
0fc3bc3b SC |
472 | ControlRef m_controlRef ; |
473 | wxFont m_font ; | |
474 | long m_windowStyle ; | |
86d8b744 SC |
475 | } ; |
476 | ||
8cf73271 SC |
477 | #endif // wxUSE_GUI |
478 | ||
479 | //--------------------------------------------------------------------------- | |
480 | // wxMac string conversions | |
481 | //--------------------------------------------------------------------------- | |
482 | ||
483 | void wxMacSetupConverters() ; | |
484 | void wxMacCleanupConverters() ; | |
485 | ||
486 | void wxMacStringToPascal( const wxString&from , StringPtr to ) ; | |
487 | wxString wxMacMakeStringFromPascal( ConstStringPtr from ) ; | |
488 | ||
489 | void wxMacConvertNewlines13To10( char * data ) ; | |
490 | void wxMacConvertNewlines10To13( char * data ) ; | |
491 | void wxMacConvertNewlines13To10( wxString *data ) ; | |
492 | void wxMacConvertNewlines10To13( wxString *data ) ; | |
493 | ||
494 | #if wxUSE_UNICODE | |
495 | void wxMacConvertNewlines13To10( wxChar * data ) ; | |
496 | void wxMacConvertNewlines10To13( wxChar * data ) ; | |
497 | #endif | |
498 | ||
499 | #if TARGET_CARBON | |
500 | ||
501 | class wxMacCFStringHolder | |
502 | { | |
503 | public: | |
504 | wxMacCFStringHolder() | |
505 | { | |
506 | m_cfs = NULL ; | |
507 | m_release = false ; | |
508 | } | |
509 | ||
510 | wxMacCFStringHolder(const wxString &str , wxFontEncoding encoding ) | |
511 | { | |
512 | m_cfs = NULL ; | |
513 | m_release = false ; | |
514 | Assign( str , encoding ) ; | |
515 | } | |
516 | ||
517 | wxMacCFStringHolder(CFStringRef ref , bool release = true ) | |
518 | { | |
519 | m_cfs = ref ; | |
520 | m_release = release ; | |
521 | } | |
522 | ||
523 | ~wxMacCFStringHolder() | |
524 | { | |
525 | Release() ; | |
526 | } | |
527 | ||
528 | CFStringRef Detach() | |
529 | { | |
530 | CFStringRef retval = m_cfs ; | |
531 | m_release = false ; | |
532 | m_cfs = NULL ; | |
533 | return retval ; | |
534 | } | |
535 | ||
536 | void Release() | |
537 | { | |
538 | if ( m_release && m_cfs) | |
539 | CFRelease( m_cfs ) ; | |
540 | m_cfs = NULL ; | |
541 | } | |
542 | ||
543 | void Assign( const wxString &str , wxFontEncoding encoding ) ; | |
544 | ||
545 | operator CFStringRef () { return m_cfs; } | |
546 | wxString AsString( wxFontEncoding encoding = wxFONTENCODING_DEFAULT ) ; | |
547 | ||
548 | private: | |
549 | ||
550 | CFStringRef m_cfs; | |
551 | bool m_release ; | |
552 | } ; | |
553 | ||
554 | #endif | |
555 | ||
1a42f89c | 556 | // utils.cpp |
8cf73271 SC |
557 | |
558 | wxUint32 wxMacGetSystemEncFromFontEnc(wxFontEncoding encoding) ; | |
559 | wxFontEncoding wxMacGetFontEncFromSystemEnc(wxUint32 encoding) ; | |
6c85f776 | 560 | void wxMacWakeUp() ; |
8cf73271 | 561 | |
1a42f89c SC |
562 | // toplevel.cpp |
563 | ||
564 | ControlRef wxMacFindControlUnderMouse( Point location , WindowRef window , ControlPartCode *outPart ) ; | |
8cf73271 SC |
565 | |
566 | #endif | |
567 | // _WX_PRIVATE_H_ |