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