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