]> git.saurik.com Git - wxWidgets.git/blob - include/wx/osx/cocoa/private.h
remove old (and unused) MSW-only wxFontEnumerator header
[wxWidgets.git] / include / wx / osx / cocoa / private.h
1 /////////////////////////////////////////////////////////////////////////////
2 // Name: wx/osx/cocoa/private.h
3 // Purpose: Private declarations: as this header is only included by
4 // wxWidgets itself, it may contain identifiers which don't start
5 // with "wx".
6 // Author: Stefan Csomor
7 // Modified by:
8 // Created: 1998-01-01
9 // RCS-ID: $Id: private.h 53819 2008-05-29 14:11:45Z SC $
10 // Copyright: (c) Stefan Csomor
11 // Licence: wxWindows licence
12 /////////////////////////////////////////////////////////////////////////////
13
14 #ifndef _WX_PRIVATE_COCOA_H_
15 #define _WX_PRIVATE_COCOA_H_
16
17 #include "wx/osx/core/private.h"
18
19 #include "wx/defs.h"
20
21 #include <ApplicationServices/ApplicationServices.h>
22
23 #ifdef __OBJC__
24
25 #import <Cocoa/Cocoa.h>
26
27 #if wxUSE_GUI
28
29 extern NSRect wxToNSRect( NSView* parent, const wxRect& r );
30 extern wxRect wxFromNSRect( NSView* parent, const NSRect& rect );
31 extern NSPoint wxToNSPoint( NSView* parent, const wxPoint& p );
32 extern wxPoint wxFromNSPoint( NSView* parent, const NSPoint& p );
33
34 // used for many wxControls
35
36 @interface wxNSButton : NSButton
37 {
38 wxWidgetImpl* impl;
39 }
40
41 - (void)setImplementation: (wxWidgetImpl *) theImplementation;
42 - (wxWidgetImpl*) implementation;
43 - (BOOL) isFlipped;
44 - (void) clickedAction: (id) sender;
45
46 @end
47
48 @interface wxNSBox : NSBox
49 {
50 wxWidgetImpl* impl;
51 }
52
53 - (void)setImplementation: (wxWidgetImpl *) theImplementation;
54 - (wxWidgetImpl*) implementation;
55 - (BOOL) isFlipped;
56
57 @end
58
59 @interface wxNSTextField : NSTextField
60 {
61 wxWidgetImpl* impl;
62 }
63
64 - (void)setImplementation: (wxWidgetImpl *) theImplementation;
65 - (wxWidgetImpl*) implementation;
66 - (BOOL) isFlipped;
67
68 @end
69
70 NSRect WXDLLIMPEXP_CORE wxOSXGetFrameForControl( wxWindowMac* window , const wxPoint& pos , const wxSize &size ,
71 bool adjustForOrigin = true );
72
73 #endif // wxUSE_GUI
74
75 #endif // __OBJC__
76
77 //
78 // shared between Cocoa and Carbon
79 //
80
81 // bring in themeing types without pulling in the headers
82
83 #if wxUSE_GUI
84 typedef SInt16 ThemeBrush;
85 CGColorRef WXDLLIMPEXP_CORE wxMacCreateCGColorFromHITheme( ThemeBrush brush ) ;
86 OSStatus WXDLLIMPEXP_CORE wxMacDrawCGImage(
87 CGContextRef inContext,
88 const CGRect * inBounds,
89 CGImageRef inImage) ;
90 WX_NSImage WXDLLIMPEXP_CORE wxOSXCreateNSImageFromCGImage( CGImageRef image );
91 #endif
92
93 long UMAGetSystemVersion() ;
94 WXDLLIMPEXP_BASE void wxMacStringToPascal( const wxString&from , StringPtr to );
95 WXDLLIMPEXP_BASE wxString wxMacFSRefToPath( const FSRef *fsRef , CFStringRef additionalPathComponent = NULL );
96 WXDLLIMPEXP_BASE OSStatus wxMacPathToFSRef( const wxString&path , FSRef *fsRef );
97 WXDLLIMPEXP_BASE wxString wxMacHFSUniStrToString( ConstHFSUniStr255Param uniname );
98
99 //
100 //
101 //
102
103 #if wxUSE_GUI
104
105 class WXDLLIMPEXP_CORE wxWidgetCocoaImpl : public wxWidgetImpl
106 {
107 public :
108 wxWidgetCocoaImpl( wxWindowMac* peer , WXWidget w, bool isRootControl = false ) ;
109 wxWidgetCocoaImpl() ;
110 ~wxWidgetCocoaImpl();
111
112 void Init();
113
114 virtual bool IsVisible() const ;
115 virtual void SetVisibility(bool);
116
117 virtual void Raise();
118
119 virtual void Lower();
120
121 virtual void ScrollRect( const wxRect *rect, int dx, int dy );
122
123 virtual WXWidget GetWXWidget() const { return m_osxView; }
124
125 virtual void SetBackgroundColour(const wxColour&);
126
127 virtual void GetContentArea( int &left , int &top , int &width , int &height ) const;
128 virtual void Move(int x, int y, int width, int height);
129 virtual void GetPosition( int &x, int &y ) const;
130 virtual void GetSize( int &width, int &height ) const;
131 virtual void SetControlSize( wxWindowVariant variant );
132
133 virtual void SetNeedsDisplay( const wxRect* where = NULL );
134 virtual bool GetNeedsDisplay() const;
135
136 virtual bool CanFocus() const;
137 // return true if successful
138 virtual bool SetFocus();
139 virtual bool HasFocus() const;
140
141 void RemoveFromParent();
142 void Embed( wxWidgetImpl *parent );
143
144 void SetDefaultButton( bool isDefault );
145 void PerformClick();
146 void SetLabel(const wxString& title, wxFontEncoding encoding);
147
148 wxInt32 GetValue() const;
149 void SetValue( wxInt32 v );
150 void SetBitmap( const wxBitmap& bitmap );
151 void SetupTabs( const wxNotebook &notebook );
152 void GetBestRect( wxRect *r ) const;
153 bool IsEnabled() const;
154 void Enable( bool enable );
155 bool ButtonClickDidStateChange() { return true ;}
156 void SetMinimum( wxInt32 v );
157 void SetMaximum( wxInt32 v );
158 void PulseGauge();
159 void SetScrollThumb( wxInt32 value, wxInt32 thumbSize );
160
161 void SetFont( const wxFont & font , const wxColour& foreground , long windowStyle, bool ignoreBlack = true );
162
163 void InstallEventHandler( WXWidget control = NULL );
164 protected:
165 WXWidget m_osxView;
166 DECLARE_DYNAMIC_CLASS_NO_COPY(wxWidgetCocoaImpl)
167 };
168
169 class wxNonOwnedWindowCocoaImpl : public wxNonOwnedWindowImpl
170 {
171 public :
172 wxNonOwnedWindowCocoaImpl( wxNonOwnedWindow* nonownedwnd) ;
173 wxNonOwnedWindowCocoaImpl();
174
175 virtual ~wxNonOwnedWindowCocoaImpl();
176
177 virtual void Destroy() ;
178 void Create( wxWindow* parent, const wxPoint& pos, const wxSize& size,
179 long style, long extraStyle, const wxString& name ) ;
180
181 WXWindow GetWXWindow() const;
182 void Raise();
183 void Lower();
184 bool Show(bool show);
185 bool ShowWithEffect(bool show, wxShowEffect effect, unsigned timeout);
186
187 void Update();
188 bool SetTransparent(wxByte alpha);
189 bool SetBackgroundColour(const wxColour& col );
190 void SetExtraStyle( long exStyle );
191 bool SetBackgroundStyle(wxBackgroundStyle style);
192 bool CanSetTransparent();
193
194 void MoveWindow(int x, int y, int width, int height);
195 void GetPosition( int &x, int &y ) const;
196 void GetSize( int &width, int &height ) const;
197
198 void GetContentArea( int &left , int &top , int &width , int &height ) const;
199 bool SetShape(const wxRegion& region);
200
201 virtual void SetTitle( const wxString& title, wxFontEncoding encoding ) ;
202
203 virtual bool IsMaximized() const;
204
205 virtual bool IsIconized() const;
206
207 virtual void Iconize( bool iconize );
208
209 virtual void Maximize(bool maximize);
210
211 virtual bool IsFullScreen() const;
212
213 virtual bool ShowFullScreen(bool show, long style);
214
215 virtual void RequestUserAttention(int flags);
216
217 virtual void ScreenToWindow( int *x, int *y );
218
219 virtual void WindowToScreen( int *x, int *y );
220
221 wxNonOwnedWindow* GetWXPeer() { return m_wxPeer; }
222 protected :
223 WX_NSWindow m_macWindow;
224 void * m_macFullScreenData ;
225 DECLARE_DYNAMIC_CLASS_NO_COPY(wxNonOwnedWindowCocoaImpl)
226 };
227
228 // NSCursor
229
230 WX_NSCursor wxMacCocoaCreateStockCursor( int cursor_type );
231 WX_NSCursor wxMacCocoaCreateCursorFromCGImage( CGImageRef cgImageRef, float hotSpotX, float hotSpotY );
232 void wxMacCocoaSetCursor( WX_NSCursor cursor );
233 void wxMacCocoaHideCursor();
234 void wxMacCocoaShowCursor();
235
236 typedef struct tagClassicCursor
237 {
238 wxUint16 bits[16];
239 wxUint16 mask[16];
240 wxInt16 hotspot[2];
241 }ClassicCursor;
242
243 const short kwxCursorBullseye = 0;
244 const short kwxCursorBlank = 1;
245 const short kwxCursorPencil = 2;
246 const short kwxCursorMagnifier = 3;
247 const short kwxCursorNoEntry = 4;
248 const short kwxCursorPaintBrush = 5;
249 const short kwxCursorPointRight = 6;
250 const short kwxCursorPointLeft = 7;
251 const short kwxCursorQuestionArrow = 8;
252 const short kwxCursorRightArrow = 9;
253 const short kwxCursorSizeNS = 10;
254 const short kwxCursorSize = 11;
255 const short kwxCursorSizeNESW = 12;
256 const short kwxCursorSizeNWSE = 13;
257 const short kwxCursorRoller = 14;
258 const short kwxCursorLast = kwxCursorRoller;
259
260 // exposing our fallback cursor map
261
262 extern ClassicCursor gMacCursors[];
263
264 #endif
265
266 #endif
267 // _WX_PRIVATE_COCOA_H_
268