]>
Commit | Line | Data |
---|---|---|
5c6eb3a8 | 1 | ///////////////////////////////////////////////////////////////////////////// |
eefe52da | 2 | // Name: wx/osx/core/private.h |
5c6eb3a8 SC |
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 | ||
eefe52da SC |
14 | #ifndef _WX_PRIVATE_CORE_H_ |
15 | #define _WX_PRIVATE_CORE_H_ | |
5c6eb3a8 SC |
16 | |
17 | #include "wx/defs.h" | |
18 | ||
19 | #include <CoreFoundation/CoreFoundation.h> | |
20 | ||
ef0e9220 SC |
21 | #include "wx/osx/core/cfstring.h" |
22 | #include "wx/osx/core/cfdataref.h" | |
5c6eb3a8 | 23 | |
030495ec VZ |
24 | // Define helper macros allowing to insert small snippets of code to be |
25 | // compiled for high enough OS X version only: this shouldn't be abused for | |
26 | // anything big but it's handy for e.g. specifying OS X 10.6-only protocols in | |
27 | // the Objective C classes declarations when they're not supported under the | |
28 | // previous versions | |
29 | #if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_6 | |
30 | #define wxOSX_10_6_AND_LATER(x) x | |
31 | #else | |
32 | #define wxOSX_10_6_AND_LATER(x) | |
33 | #endif | |
34 | ||
382c4ade VZ |
35 | #if !wxUSE_GUI || wxOSX_USE_COCOA_OR_CARBON |
36 | ||
37 | // Carbon functions are currently still used in wxOSX/Cocoa too (including | |
38 | // wxBase part of it). | |
39 | #include <Carbon/Carbon.h> | |
1e181c7a | 40 | |
524c47aa | 41 | WXDLLIMPEXP_BASE long UMAGetSystemVersion() ; |
1e181c7a SC |
42 | |
43 | void WXDLLIMPEXP_CORE wxMacStringToPascal( const wxString&from , unsigned char * to ); | |
44 | wxString WXDLLIMPEXP_CORE wxMacMakeStringFromPascal( const unsigned char * from ); | |
45 | ||
382c4ade VZ |
46 | WXDLLIMPEXP_BASE wxString wxMacFSRefToPath( const FSRef *fsRef , CFStringRef additionalPathComponent = NULL ); |
47 | WXDLLIMPEXP_BASE OSStatus wxMacPathToFSRef( const wxString&path , FSRef *fsRef ); | |
48 | WXDLLIMPEXP_BASE wxString wxMacHFSUniStrToString( ConstHFSUniStr255Param uniname ); | |
49 | ||
524c47aa SC |
50 | #endif |
51 | ||
5c6eb3a8 SC |
52 | #if wxUSE_GUI |
53 | ||
eefe52da | 54 | #if wxOSX_USE_IPHONE |
5c6eb3a8 | 55 | #include <CoreGraphics/CoreGraphics.h> |
eefe52da | 56 | #else |
09f0f2cf | 57 | #include <ApplicationServices/ApplicationServices.h> |
eefe52da SC |
58 | #endif |
59 | ||
60 | #include "wx/bitmap.h" | |
61 | #include "wx/window.h" | |
5c6eb3a8 SC |
62 | |
63 | class WXDLLIMPEXP_CORE wxMacCGContextStateSaver | |
64 | { | |
c0c133e1 | 65 | wxDECLARE_NO_COPY_CLASS(wxMacCGContextStateSaver); |
5c6eb3a8 SC |
66 | |
67 | public: | |
68 | wxMacCGContextStateSaver( CGContextRef cg ) | |
69 | { | |
70 | m_cg = cg; | |
71 | CGContextSaveGState( cg ); | |
72 | } | |
73 | ~wxMacCGContextStateSaver() | |
74 | { | |
75 | CGContextRestoreGState( m_cg ); | |
76 | } | |
77 | private: | |
78 | CGContextRef m_cg; | |
79 | }; | |
80 | ||
eefe52da SC |
81 | class WXDLLIMPEXP_CORE wxDeferredObjectDeleter : public wxObject |
82 | { | |
83 | public : | |
03647350 | 84 | wxDeferredObjectDeleter( wxObject* obj ) : m_obj(obj) |
eefe52da SC |
85 | { |
86 | } | |
87 | virtual ~wxDeferredObjectDeleter() | |
88 | { | |
89 | delete m_obj; | |
90 | } | |
91 | protected : | |
92 | wxObject* m_obj ; | |
93 | } ; | |
5c6eb3a8 SC |
94 | |
95 | // Quartz | |
96 | ||
97 | WXDLLIMPEXP_CORE CGImageRef wxMacCreateCGImageFromBitmap( const wxBitmap& bitmap ); | |
98 | ||
99 | WXDLLIMPEXP_CORE CGDataProviderRef wxMacCGDataProviderCreateWithCFData( CFDataRef data ); | |
100 | WXDLLIMPEXP_CORE CGDataConsumerRef wxMacCGDataConsumerCreateWithCFData( CFMutableDataRef data ); | |
101 | WXDLLIMPEXP_CORE CGDataProviderRef wxMacCGDataProviderCreateWithMemoryBuffer( const wxMemoryBuffer& buf ); | |
102 | ||
103 | CGColorSpaceRef WXDLLIMPEXP_CORE wxMacGetGenericRGBColorSpace(void); | |
104 | ||
eefe52da SC |
105 | class wxWindowMac; |
106 | // to | |
107 | extern wxWindow* g_MacLastWindow; | |
108 | class wxNonOwnedWindow; | |
109 | ||
524c47aa SC |
110 | // temporary typedef so that no additional casts are necessary within carbon code at the moment |
111 | ||
112 | class wxMacControl; | |
113 | class wxWidgetImpl; | |
c072b9ec | 114 | class wxComboBox; |
524c47aa | 115 | class wxNotebook; |
de24bdf2 | 116 | class wxTextCtrl; |
11f87a38 | 117 | class wxSearchCtrl; |
524c47aa | 118 | |
8fa9ac5e SC |
119 | WXDLLIMPEXP_CORE wxWindowMac * wxFindWindowFromWXWidget(WXWidget inControl ); |
120 | ||
524c47aa SC |
121 | #if wxOSX_USE_CARBON |
122 | typedef wxMacControl wxWidgetImplType; | |
123 | #else | |
124 | typedef wxWidgetImpl wxWidgetImplType; | |
125 | #endif | |
126 | ||
6c1f25cc | 127 | #if wxUSE_MENUS |
03647350 | 128 | class wxMenuItemImpl : public wxObject |
524c47aa SC |
129 | { |
130 | public : | |
131 | wxMenuItemImpl( wxMenuItem* peer ) : m_peer(peer) | |
132 | { | |
133 | } | |
03647350 | 134 | |
524c47aa SC |
135 | virtual ~wxMenuItemImpl() ; |
136 | virtual void SetBitmap( const wxBitmap& bitmap ) = 0; | |
137 | virtual void Enable( bool enable ) = 0; | |
138 | virtual void Check( bool check ) = 0; | |
139 | virtual void SetLabel( const wxString& text, wxAcceleratorEntry *entry ) = 0; | |
140 | virtual void Hide( bool hide = true ) = 0; | |
03647350 | 141 | |
524c47aa SC |
142 | virtual void * GetHMenuItem() = 0; |
143 | ||
144 | wxMenuItem* GetWXPeer() { return m_peer ; } | |
145 | ||
146 | static wxMenuItemImpl* Create( wxMenuItem* peer, wxMenu *pParentMenu, | |
147 | int id, | |
148 | const wxString& text, | |
149 | wxAcceleratorEntry *entry, | |
150 | const wxString& strHelp, | |
151 | wxItemKind kind, | |
152 | wxMenu *pSubMenu ); | |
c46d0503 SC |
153 | |
154 | // handle OS specific menu items if they weren't handled during normal processing | |
8915e40c | 155 | virtual bool DoDefault() { return false; } |
524c47aa SC |
156 | protected : |
157 | wxMenuItem* m_peer; | |
03647350 | 158 | |
69cc4323 | 159 | DECLARE_ABSTRACT_CLASS(wxMenuItemImpl) |
524c47aa SC |
160 | } ; |
161 | ||
03647350 | 162 | class wxMenuImpl : public wxObject |
524c47aa SC |
163 | { |
164 | public : | |
165 | wxMenuImpl( wxMenu* peer ) : m_peer(peer) | |
166 | { | |
167 | } | |
03647350 VZ |
168 | |
169 | virtual ~wxMenuImpl() ; | |
170 | virtual void InsertOrAppend(wxMenuItem *pItem, size_t pos) = 0; | |
524c47aa | 171 | virtual void Remove( wxMenuItem *pItem ) = 0; |
03647350 | 172 | |
524c47aa SC |
173 | virtual void MakeRoot() = 0; |
174 | ||
175 | virtual void SetTitle( const wxString& text ) = 0; | |
176 | ||
177 | virtual WXHMENU GetHMenu() = 0; | |
03647350 | 178 | |
524c47aa SC |
179 | wxMenu* GetWXPeer() { return m_peer ; } |
180 | ||
2cb5d2d2 SC |
181 | virtual void PopUp( wxWindow *win, int x, int y ) = 0; |
182 | ||
524c47aa SC |
183 | static wxMenuImpl* Create( wxMenu* peer, const wxString& title ); |
184 | static wxMenuImpl* CreateRootMenu( wxMenu* peer ); | |
185 | protected : | |
186 | wxMenu* m_peer; | |
03647350 | 187 | |
69cc4323 | 188 | DECLARE_ABSTRACT_CLASS(wxMenuItemImpl) |
524c47aa | 189 | } ; |
6c1f25cc | 190 | #endif |
524c47aa SC |
191 | |
192 | ||
eefe52da SC |
193 | class WXDLLIMPEXP_CORE wxWidgetImpl : public wxObject |
194 | { | |
195 | public : | |
196 | wxWidgetImpl( wxWindowMac* peer , bool isRootControl = false ); | |
197 | wxWidgetImpl(); | |
198 | virtual ~wxWidgetImpl(); | |
199 | ||
200 | void Init(); | |
201 | ||
eefe52da SC |
202 | bool IsRootControl() const { return m_isRootControl; } |
203 | ||
204 | wxWindowMac* GetWXPeer() const { return m_wxPeer; } | |
03647350 | 205 | |
eefe52da SC |
206 | bool IsOk() const { return GetWXWidget() != NULL; } |
207 | ||
208 | // not only the control itself, but also all its parents must be visible | |
209 | // in order for this function to return true | |
210 | virtual bool IsVisible() const = 0; | |
211 | // set the visibility of this widget (maybe latent) | |
212 | virtual void SetVisibility( bool visible ) = 0; | |
213 | ||
ab9a0b84 VZ |
214 | virtual bool ShowWithEffect(bool WXUNUSED(show), |
215 | wxShowEffect WXUNUSED(effect), | |
216 | unsigned WXUNUSED(timeout)) | |
217 | { | |
218 | return false; | |
219 | } | |
220 | ||
eefe52da | 221 | virtual void Raise() = 0; |
03647350 | 222 | |
eefe52da SC |
223 | virtual void Lower() = 0; |
224 | ||
225 | virtual void ScrollRect( const wxRect *rect, int dx, int dy ) = 0; | |
226 | ||
227 | virtual WXWidget GetWXWidget() const = 0; | |
03647350 | 228 | |
eefe52da | 229 | virtual void SetBackgroundColour( const wxColour& col ) = 0; |
bc5c09a3 | 230 | virtual bool SetBackgroundStyle(wxBackgroundStyle style) = 0; |
eefe52da SC |
231 | |
232 | // all coordinates in native parent widget relative coordinates | |
233 | virtual void GetContentArea( int &left , int &top , int &width , int &height ) const = 0; | |
234 | virtual void Move(int x, int y, int width, int height) = 0; | |
235 | virtual void GetPosition( int &x, int &y ) const = 0; | |
236 | virtual void GetSize( int &width, int &height ) const = 0; | |
524c47aa | 237 | virtual void SetControlSize( wxWindowVariant variant ) = 0; |
f18b5ee7 SC |
238 | virtual float GetContentScaleFactor() const |
239 | { | |
240 | return 1.0; | |
241 | } | |
54ea2834 SC |
242 | |
243 | // the native coordinates may have an 'aura' for shadows etc, if this is the case the layout | |
244 | // inset indicates on which insets the real control is drawn | |
245 | virtual void GetLayoutInset(int &left , int &top , int &right, int &bottom) const | |
246 | { | |
247 | left = top = right = bottom = 0; | |
248 | } | |
eefe52da | 249 | |
ee032c59 SC |
250 | // native view coordinates are topleft to bottom right (flipped regarding CoreGraphics origin) |
251 | virtual bool IsFlipped() const { return true; } | |
252 | ||
eefe52da SC |
253 | virtual void SetNeedsDisplay( const wxRect* where = NULL ) = 0; |
254 | virtual bool GetNeedsDisplay() const = 0; | |
255 | ||
256 | virtual bool NeedsFocusRect() const; | |
257 | virtual void SetNeedsFocusRect( bool needs ); | |
258 | ||
f2f6030e SC |
259 | virtual bool NeedsFrame() const; |
260 | virtual void SetNeedsFrame( bool needs ); | |
261 | ||
eefe52da SC |
262 | virtual bool CanFocus() const = 0; |
263 | // return true if successful | |
264 | virtual bool SetFocus() = 0; | |
265 | virtual bool HasFocus() const = 0; | |
03647350 | 266 | |
eefe52da SC |
267 | virtual void RemoveFromParent() = 0; |
268 | virtual void Embed( wxWidgetImpl *parent ) = 0; | |
03647350 | 269 | |
524c47aa SC |
270 | virtual void SetDefaultButton( bool isDefault ) = 0; |
271 | virtual void PerformClick() = 0; | |
272 | virtual void SetLabel( const wxString& title, wxFontEncoding encoding ) = 0; | |
6a219e34 | 273 | #if wxUSE_MARKUP && wxOSX_USE_COCOA |
f672c969 VZ |
274 | virtual void SetLabelMarkup( const wxString& WXUNUSED(markup) ) { } |
275 | #endif | |
524c47aa | 276 | |
54f11060 SC |
277 | virtual void SetCursor( const wxCursor & cursor ) = 0; |
278 | virtual void CaptureMouse() = 0; | |
279 | virtual void ReleaseMouse() = 0; | |
280 | ||
524c47aa SC |
281 | virtual wxInt32 GetValue() const = 0; |
282 | virtual void SetValue( wxInt32 v ) = 0; | |
e5d05b90 | 283 | virtual wxBitmap GetBitmap() const = 0; |
524c47aa | 284 | virtual void SetBitmap( const wxBitmap& bitmap ) = 0; |
e5d05b90 | 285 | virtual void SetBitmapPosition( wxDirection dir ) = 0; |
524c47aa SC |
286 | virtual void SetupTabs( const wxNotebook ¬ebook ) =0; |
287 | virtual void GetBestRect( wxRect *r ) const = 0; | |
288 | virtual bool IsEnabled() const = 0; | |
289 | virtual void Enable( bool enable ) = 0; | |
290 | virtual void SetMinimum( wxInt32 v ) = 0; | |
291 | virtual void SetMaximum( wxInt32 v ) = 0; | |
19c7ac3d SC |
292 | virtual wxInt32 GetMinimum() const = 0; |
293 | virtual wxInt32 GetMaximum() const = 0; | |
524c47aa SC |
294 | virtual void PulseGauge() = 0; |
295 | virtual void SetScrollThumb( wxInt32 value, wxInt32 thumbSize ) = 0; | |
296 | ||
1e181c7a | 297 | virtual void SetFont( const wxFont & font , const wxColour& foreground , long windowStyle, bool ignoreBlack = true ) = 0; |
ce00f59b | 298 | |
a7b9865d | 299 | virtual void SetToolTip(wxToolTip* WXUNUSED(tooltip)) { } |
1e181c7a | 300 | |
524c47aa SC |
301 | // is the clicked event sent AFTER the state already changed, so no additional |
302 | // state changing logic is required from the outside | |
303 | virtual bool ButtonClickDidStateChange() = 0; | |
03647350 | 304 | |
c4825ef7 | 305 | virtual void InstallEventHandler( WXWidget control = NULL ) = 0; |
ce00f59b | 306 | |
809020fc KO |
307 | // Mechanism used to keep track of whether a change should send an event |
308 | // Do SendEvents(false) when starting actions that would trigger programmatic events | |
309 | // and SendEvents(true) at the end of the block. | |
310 | virtual void SendEvents(bool shouldSendEvents) { m_shouldSendEvents = shouldSendEvents; } | |
311 | virtual bool ShouldSendEvents() { return m_shouldSendEvents; } | |
eefe52da | 312 | |
f55d9f74 SC |
313 | // static methods for associating native controls and their implementations |
314 | ||
03647350 | 315 | static wxWidgetImpl* |
f55d9f74 | 316 | FindFromWXWidget(WXWidget control); |
03647350 | 317 | |
f55d9f74 | 318 | static void RemoveAssociations( wxWidgetImpl* impl); |
03647350 | 319 | |
f55d9f74 | 320 | static void Associate( WXWidget control, wxWidgetImpl *impl ); |
03647350 | 321 | |
f06e0fea | 322 | static WXWidget FindFocus(); |
03647350 | 323 | |
eefe52da | 324 | // static creation methods, must be implemented by all toolkits |
03647350 VZ |
325 | |
326 | static wxWidgetImplType* CreateUserPane( wxWindowMac* wxpeer, | |
327 | wxWindowMac* parent, | |
328 | wxWindowID id, | |
329 | const wxPoint& pos, | |
524c47aa | 330 | const wxSize& size, |
03647350 | 331 | long style, |
524c47aa SC |
332 | long extraStyle) ; |
333 | static wxWidgetImplType* CreateContentView( wxNonOwnedWindow* now ) ; | |
334 | ||
03647350 VZ |
335 | static wxWidgetImplType* CreateButton( wxWindowMac* wxpeer, |
336 | wxWindowMac* parent, | |
337 | wxWindowID id, | |
524c47aa | 338 | const wxString& label, |
03647350 | 339 | const wxPoint& pos, |
524c47aa | 340 | const wxSize& size, |
03647350 | 341 | long style, |
524c47aa SC |
342 | long extraStyle) ; |
343 | ||
03647350 VZ |
344 | static wxWidgetImplType* CreateDisclosureTriangle( wxWindowMac* wxpeer, |
345 | wxWindowMac* parent, | |
346 | wxWindowID id, | |
524c47aa | 347 | const wxString& label, |
03647350 | 348 | const wxPoint& pos, |
524c47aa | 349 | const wxSize& size, |
03647350 | 350 | long style, |
524c47aa | 351 | long extraStyle) ; |
03647350 VZ |
352 | |
353 | static wxWidgetImplType* CreateStaticLine( wxWindowMac* wxpeer, | |
354 | wxWindowMac* parent, | |
355 | wxWindowID id, | |
356 | const wxPoint& pos, | |
524c47aa | 357 | const wxSize& size, |
03647350 | 358 | long style, |
524c47aa SC |
359 | long extraStyle) ; |
360 | ||
03647350 VZ |
361 | static wxWidgetImplType* CreateGroupBox( wxWindowMac* wxpeer, |
362 | wxWindowMac* parent, | |
363 | wxWindowID id, | |
524c47aa | 364 | const wxString& label, |
03647350 | 365 | const wxPoint& pos, |
524c47aa | 366 | const wxSize& size, |
03647350 | 367 | long style, |
524c47aa SC |
368 | long extraStyle) ; |
369 | ||
03647350 VZ |
370 | static wxWidgetImplType* CreateStaticText( wxWindowMac* wxpeer, |
371 | wxWindowMac* parent, | |
372 | wxWindowID id, | |
524c47aa | 373 | const wxString& label, |
03647350 | 374 | const wxPoint& pos, |
524c47aa | 375 | const wxSize& size, |
03647350 | 376 | long style, |
524c47aa SC |
377 | long extraStyle) ; |
378 | ||
03647350 VZ |
379 | static wxWidgetImplType* CreateTextControl( wxTextCtrl* wxpeer, |
380 | wxWindowMac* parent, | |
381 | wxWindowID id, | |
524c47aa | 382 | const wxString& content, |
03647350 | 383 | const wxPoint& pos, |
524c47aa | 384 | const wxSize& size, |
03647350 | 385 | long style, |
524c47aa SC |
386 | long extraStyle) ; |
387 | ||
11f87a38 | 388 | static wxWidgetImplType* CreateSearchControl( wxSearchCtrl* wxpeer, |
03647350 VZ |
389 | wxWindowMac* parent, |
390 | wxWindowID id, | |
1e181c7a | 391 | const wxString& content, |
03647350 | 392 | const wxPoint& pos, |
1e181c7a | 393 | const wxSize& size, |
03647350 | 394 | long style, |
1e181c7a SC |
395 | long extraStyle) ; |
396 | ||
03647350 VZ |
397 | static wxWidgetImplType* CreateCheckBox( wxWindowMac* wxpeer, |
398 | wxWindowMac* parent, | |
399 | wxWindowID id, | |
524c47aa | 400 | const wxString& label, |
03647350 | 401 | const wxPoint& pos, |
524c47aa | 402 | const wxSize& size, |
03647350 | 403 | long style, |
524c47aa | 404 | long extraStyle); |
03647350 VZ |
405 | |
406 | static wxWidgetImplType* CreateRadioButton( wxWindowMac* wxpeer, | |
407 | wxWindowMac* parent, | |
408 | wxWindowID id, | |
524c47aa | 409 | const wxString& label, |
03647350 | 410 | const wxPoint& pos, |
524c47aa | 411 | const wxSize& size, |
03647350 | 412 | long style, |
524c47aa SC |
413 | long extraStyle); |
414 | ||
03647350 VZ |
415 | static wxWidgetImplType* CreateToggleButton( wxWindowMac* wxpeer, |
416 | wxWindowMac* parent, | |
417 | wxWindowID id, | |
524c47aa | 418 | const wxString& label, |
03647350 | 419 | const wxPoint& pos, |
524c47aa | 420 | const wxSize& size, |
03647350 | 421 | long style, |
524c47aa SC |
422 | long extraStyle); |
423 | ||
03647350 VZ |
424 | static wxWidgetImplType* CreateBitmapToggleButton( wxWindowMac* wxpeer, |
425 | wxWindowMac* parent, | |
426 | wxWindowID id, | |
524c47aa | 427 | const wxBitmap& bitmap, |
03647350 | 428 | const wxPoint& pos, |
524c47aa | 429 | const wxSize& size, |
03647350 | 430 | long style, |
524c47aa SC |
431 | long extraStyle); |
432 | ||
03647350 VZ |
433 | static wxWidgetImplType* CreateBitmapButton( wxWindowMac* wxpeer, |
434 | wxWindowMac* parent, | |
435 | wxWindowID id, | |
524c47aa | 436 | const wxBitmap& bitmap, |
03647350 | 437 | const wxPoint& pos, |
524c47aa | 438 | const wxSize& size, |
03647350 | 439 | long style, |
524c47aa SC |
440 | long extraStyle); |
441 | ||
03647350 VZ |
442 | static wxWidgetImplType* CreateTabView( wxWindowMac* wxpeer, |
443 | wxWindowMac* parent, | |
444 | wxWindowID id, | |
445 | const wxPoint& pos, | |
524c47aa | 446 | const wxSize& size, |
03647350 | 447 | long style, |
524c47aa SC |
448 | long extraStyle); |
449 | ||
03647350 VZ |
450 | static wxWidgetImplType* CreateGauge( wxWindowMac* wxpeer, |
451 | wxWindowMac* parent, | |
452 | wxWindowID id, | |
524c47aa SC |
453 | wxInt32 value, |
454 | wxInt32 minimum, | |
455 | wxInt32 maximum, | |
03647350 | 456 | const wxPoint& pos, |
524c47aa | 457 | const wxSize& size, |
03647350 | 458 | long style, |
524c47aa SC |
459 | long extraStyle); |
460 | ||
03647350 VZ |
461 | static wxWidgetImplType* CreateSlider( wxWindowMac* wxpeer, |
462 | wxWindowMac* parent, | |
463 | wxWindowID id, | |
524c47aa SC |
464 | wxInt32 value, |
465 | wxInt32 minimum, | |
466 | wxInt32 maximum, | |
03647350 | 467 | const wxPoint& pos, |
524c47aa | 468 | const wxSize& size, |
03647350 | 469 | long style, |
524c47aa SC |
470 | long extraStyle); |
471 | ||
03647350 VZ |
472 | static wxWidgetImplType* CreateSpinButton( wxWindowMac* wxpeer, |
473 | wxWindowMac* parent, | |
474 | wxWindowID id, | |
524c47aa SC |
475 | wxInt32 value, |
476 | wxInt32 minimum, | |
477 | wxInt32 maximum, | |
03647350 | 478 | const wxPoint& pos, |
524c47aa | 479 | const wxSize& size, |
03647350 | 480 | long style, |
524c47aa SC |
481 | long extraStyle); |
482 | ||
03647350 VZ |
483 | static wxWidgetImplType* CreateScrollBar( wxWindowMac* wxpeer, |
484 | wxWindowMac* parent, | |
485 | wxWindowID id, | |
486 | const wxPoint& pos, | |
524c47aa | 487 | const wxSize& size, |
03647350 | 488 | long style, |
524c47aa SC |
489 | long extraStyle); |
490 | ||
03647350 VZ |
491 | static wxWidgetImplType* CreateChoice( wxWindowMac* wxpeer, |
492 | wxWindowMac* parent, | |
493 | wxWindowID id, | |
524c47aa | 494 | wxMenu* menu, |
03647350 | 495 | const wxPoint& pos, |
524c47aa | 496 | const wxSize& size, |
03647350 | 497 | long style, |
524c47aa SC |
498 | long extraStyle); |
499 | ||
03647350 VZ |
500 | static wxWidgetImplType* CreateListBox( wxWindowMac* wxpeer, |
501 | wxWindowMac* parent, | |
502 | wxWindowID id, | |
503 | const wxPoint& pos, | |
524c47aa | 504 | const wxSize& size, |
03647350 | 505 | long style, |
524c47aa | 506 | long extraStyle); |
eefe52da | 507 | |
c84030e0 | 508 | #if wxOSX_USE_COCOA |
ce00f59b VZ |
509 | static wxWidgetImplType* CreateComboBox( wxComboBox* wxpeer, |
510 | wxWindowMac* parent, | |
511 | wxWindowID id, | |
f941a30b | 512 | wxMenu* menu, |
ce00f59b | 513 | const wxPoint& pos, |
f941a30b | 514 | const wxSize& size, |
ce00f59b | 515 | long style, |
f941a30b KO |
516 | long extraStyle); |
517 | #endif | |
518 | ||
eefe52da SC |
519 | // converts from Toplevel-Content relative to local |
520 | static void Convert( wxPoint *pt , wxWidgetImpl *from , wxWidgetImpl *to ); | |
521 | protected : | |
522 | bool m_isRootControl; | |
523 | wxWindowMac* m_wxPeer; | |
524 | bool m_needsFocusRect; | |
f2f6030e | 525 | bool m_needsFrame; |
809020fc | 526 | bool m_shouldSendEvents; |
eefe52da SC |
527 | |
528 | DECLARE_ABSTRACT_CLASS(wxWidgetImpl) | |
529 | }; | |
530 | ||
524c47aa SC |
531 | // |
532 | // the interface to be implemented eg by a listbox | |
533 | // | |
534 | ||
03647350 | 535 | class WXDLLIMPEXP_CORE wxListWidgetColumn |
524c47aa SC |
536 | { |
537 | public : | |
538 | virtual ~wxListWidgetColumn() {} | |
539 | } ; | |
540 | ||
541 | class WXDLLIMPEXP_CORE wxListWidgetCellValue | |
542 | { | |
543 | public : | |
544 | wxListWidgetCellValue() {} | |
545 | virtual ~wxListWidgetCellValue() {} | |
03647350 | 546 | |
524c47aa SC |
547 | virtual void Set( CFStringRef value ) = 0; |
548 | virtual void Set( const wxString& value ) = 0; | |
549 | virtual void Set( int value ) = 0; | |
60ebcb8a | 550 | virtual void Check( bool check ); |
03647350 | 551 | |
60ebcb8a | 552 | virtual bool IsChecked() const; |
524c47aa SC |
553 | virtual int GetIntValue() const = 0; |
554 | virtual wxString GetStringValue() const = 0; | |
555 | } ; | |
556 | ||
557 | class WXDLLIMPEXP_CORE wxListWidgetImpl | |
558 | { | |
559 | public: | |
560 | wxListWidgetImpl() {} | |
561 | virtual ~wxListWidgetImpl() { } | |
03647350 VZ |
562 | |
563 | virtual wxListWidgetColumn* InsertTextColumn( unsigned pos, const wxString& title, bool editable = false, | |
524c47aa | 564 | wxAlignment just = wxALIGN_LEFT , int defaultWidth = -1) = 0 ; |
03647350 | 565 | virtual wxListWidgetColumn* InsertCheckColumn( unsigned pos , const wxString& title, bool editable = false, |
524c47aa | 566 | wxAlignment just = wxALIGN_LEFT , int defaultWidth = -1) = 0 ; |
03647350 | 567 | |
524c47aa SC |
568 | // add and remove |
569 | ||
570 | // TODO will be replaced | |
571 | virtual void ListDelete( unsigned int n ) = 0; | |
572 | virtual void ListInsert( unsigned int n ) = 0; | |
573 | virtual void ListClear() = 0; | |
574 | ||
575 | // selecting | |
576 | ||
577 | virtual void ListDeselectAll() = 0; | |
578 | virtual void ListSetSelection( unsigned int n, bool select, bool multi ) = 0; | |
579 | virtual int ListGetSelection() const = 0; | |
580 | virtual int ListGetSelections( wxArrayInt& aSelections ) const = 0; | |
581 | virtual bool ListIsSelected( unsigned int n ) const = 0; | |
03647350 | 582 | |
524c47aa SC |
583 | // display |
584 | ||
585 | virtual void ListScrollTo( unsigned int n ) = 0; | |
586 | virtual void UpdateLine( unsigned int n, wxListWidgetColumn* col = NULL ) = 0; | |
587 | virtual void UpdateLineToEnd( unsigned int n) = 0; | |
588 | ||
589 | // accessing content | |
590 | ||
591 | virtual unsigned int ListGetCount() const = 0; | |
ce00f59b | 592 | |
20196e15 | 593 | virtual int DoListHitTest( const wxPoint& inpoint ) const = 0; |
524c47aa SC |
594 | }; |
595 | ||
1e181c7a SC |
596 | // |
597 | // interface to be implemented by a textcontrol | |
598 | // | |
599 | ||
21a9d326 | 600 | class WXDLLIMPEXP_FWD_CORE wxTextAttr; |
c072b9ec | 601 | class WXDLLIMPEXP_FWD_CORE wxTextEntry; |
21a9d326 | 602 | |
1e181c7a SC |
603 | // common interface for all implementations |
604 | class WXDLLIMPEXP_CORE wxTextWidgetImpl | |
605 | ||
606 | { | |
607 | public : | |
c072b9ec VZ |
608 | // Any widgets implementing this interface must be associated with a |
609 | // wxTextEntry so instead of requiring the derived classes to implement | |
610 | // another (pure) virtual function, just take the pointer to this entry in | |
611 | // our ctor and implement GetTextEntry() ourselves. | |
612 | wxTextWidgetImpl(wxTextEntry *entry) : m_entry(entry) {} | |
1e181c7a SC |
613 | |
614 | virtual ~wxTextWidgetImpl() {} | |
615 | ||
c072b9ec VZ |
616 | wxTextEntry *GetTextEntry() const { return m_entry; } |
617 | ||
1e181c7a SC |
618 | virtual bool CanFocus() const { return true; } |
619 | ||
620 | virtual wxString GetStringValue() const = 0 ; | |
621 | virtual void SetStringValue( const wxString &val ) = 0 ; | |
622 | virtual void SetSelection( long from, long to ) = 0 ; | |
623 | virtual void GetSelection( long* from, long* to ) const = 0 ; | |
624 | virtual void WriteText( const wxString& str ) = 0 ; | |
625 | ||
16671f22 | 626 | virtual bool GetStyle( long position, wxTextAttr& style); |
1e181c7a SC |
627 | virtual void SetStyle( long start, long end, const wxTextAttr& style ) ; |
628 | virtual void Copy() ; | |
629 | virtual void Cut() ; | |
630 | virtual void Paste() ; | |
631 | virtual bool CanPaste() const ; | |
632 | virtual void SetEditable( bool editable ) ; | |
0b6a49c2 | 633 | virtual long GetLastPosition() const ; |
1e181c7a SC |
634 | virtual void Replace( long from, long to, const wxString &str ) ; |
635 | virtual void Remove( long from, long to ) ; | |
636 | ||
637 | ||
638 | virtual bool HasOwnContextMenu() const | |
639 | { return false ; } | |
640 | ||
641 | virtual bool SetupCursor( const wxPoint& WXUNUSED(pt) ) | |
642 | { return false ; } | |
643 | ||
644 | virtual void Clear() ; | |
645 | virtual bool CanUndo() const; | |
646 | virtual void Undo() ; | |
647 | virtual bool CanRedo() const; | |
648 | virtual void Redo() ; | |
649 | virtual int GetNumberOfLines() const ; | |
650 | virtual long XYToPosition(long x, long y) const; | |
651 | virtual bool PositionToXY(long pos, long *x, long *y) const ; | |
652 | virtual void ShowPosition(long WXUNUSED(pos)) ; | |
653 | virtual int GetLineLength(long lineNo) const ; | |
654 | virtual wxString GetLineText(long lineNo) const ; | |
655 | virtual void CheckSpelling(bool WXUNUSED(check)) { } | |
ce00f59b | 656 | |
9ab7ff53 | 657 | virtual wxSize GetBestSize() const { return wxDefaultSize; } |
c072b9ec | 658 | |
99eb484a | 659 | virtual bool SetHint(const wxString& WXUNUSED(hint)) { return false; } |
c072b9ec VZ |
660 | private: |
661 | wxTextEntry * const m_entry; | |
662 | ||
663 | wxDECLARE_NO_COPY_CLASS(wxTextWidgetImpl); | |
1e181c7a SC |
664 | }; |
665 | ||
c84030e0 KO |
666 | // common interface for all implementations |
667 | class WXDLLIMPEXP_CORE wxComboWidgetImpl | |
668 | ||
669 | { | |
670 | public : | |
671 | wxComboWidgetImpl() {} | |
672 | ||
673 | virtual ~wxComboWidgetImpl() {} | |
ce00f59b | 674 | |
c84030e0 KO |
675 | virtual int GetSelectedItem() const { return -1; }; |
676 | virtual void SetSelectedItem(int WXUNUSED(item)) {}; | |
ce00f59b | 677 | |
c84030e0 | 678 | virtual int GetNumberOfItems() const { return -1; }; |
ce00f59b | 679 | |
c84030e0 | 680 | virtual void InsertItem(int WXUNUSED(pos), const wxString& WXUNUSED(item)) {} |
ce00f59b | 681 | |
c84030e0 | 682 | virtual void RemoveItem(int WXUNUSED(pos)) {} |
ce00f59b | 683 | |
c84030e0 | 684 | virtual void Clear() {} |
ce00f59b | 685 | |
c84030e0 | 686 | virtual wxString GetStringAtIndex(int WXUNUSED(pos)) const { return wxEmptyString; } |
ce00f59b | 687 | |
c84030e0 KO |
688 | virtual int FindString(const wxString& WXUNUSED(text)) const { return -1; } |
689 | }; | |
690 | ||
411a1c35 | 691 | // |
b38dc31f | 692 | // common interface for buttons |
411a1c35 SC |
693 | // |
694 | ||
b38dc31f | 695 | class wxButtonImpl |
411a1c35 SC |
696 | { |
697 | public : | |
b38dc31f SC |
698 | wxButtonImpl(){} |
699 | virtual ~wxButtonImpl(){} | |
ce00f59b | 700 | |
411a1c35 SC |
701 | virtual void SetPressedBitmap( const wxBitmap& bitmap ) = 0; |
702 | } ; | |
703 | ||
1e181c7a SC |
704 | // |
705 | // common interface for search controls | |
706 | // | |
707 | ||
708 | class wxSearchWidgetImpl | |
709 | { | |
710 | public : | |
711 | wxSearchWidgetImpl(){} | |
712 | virtual ~wxSearchWidgetImpl(){} | |
713 | ||
714 | // search field options | |
715 | virtual void ShowSearchButton( bool show ) = 0; | |
716 | virtual bool IsSearchButtonVisible() const = 0; | |
717 | ||
718 | virtual void ShowCancelButton( bool show ) = 0; | |
719 | virtual bool IsCancelButtonVisible() const = 0; | |
720 | ||
721 | virtual void SetSearchMenu( wxMenu* menu ) = 0; | |
722 | ||
723 | virtual void SetDescriptiveText(const wxString& text) = 0; | |
724 | } ; | |
725 | ||
524c47aa SC |
726 | // |
727 | // toplevel window implementation class | |
728 | // | |
729 | ||
eefe52da SC |
730 | class wxNonOwnedWindowImpl : public wxObject |
731 | { | |
732 | public : | |
733 | wxNonOwnedWindowImpl( wxNonOwnedWindow* nonownedwnd) : m_wxPeer(nonownedwnd) | |
734 | { | |
735 | } | |
736 | wxNonOwnedWindowImpl() | |
737 | { | |
738 | } | |
739 | virtual ~wxNonOwnedWindowImpl() | |
740 | { | |
741 | } | |
03647350 | 742 | |
0aaa6ace | 743 | virtual void WillBeDestroyed() |
eefe52da SC |
744 | { |
745 | } | |
746 | ||
747 | virtual void Create( wxWindow* parent, const wxPoint& pos, const wxSize& size, | |
748 | long style, long extraStyle, const wxString& name ) = 0; | |
03647350 VZ |
749 | |
750 | ||
eefe52da | 751 | virtual WXWindow GetWXWindow() const = 0; |
03647350 | 752 | |
eefe52da SC |
753 | virtual void Raise() |
754 | { | |
755 | } | |
03647350 | 756 | |
eefe52da SC |
757 | virtual void Lower() |
758 | { | |
759 | } | |
760 | ||
1aec1f8b | 761 | virtual bool Show(bool WXUNUSED(show)) |
eefe52da SC |
762 | { |
763 | return false; | |
764 | } | |
03647350 | 765 | |
1aec1f8b | 766 | virtual bool ShowWithEffect(bool show, wxShowEffect WXUNUSED(effect), unsigned WXUNUSED(timeout)) |
eefe52da SC |
767 | { |
768 | return Show(show); | |
769 | } | |
03647350 | 770 | |
eefe52da SC |
771 | virtual void Update() |
772 | { | |
773 | } | |
774 | ||
1aec1f8b | 775 | virtual bool SetTransparent(wxByte WXUNUSED(alpha)) |
eefe52da SC |
776 | { |
777 | return false; | |
778 | } | |
779 | ||
1aec1f8b | 780 | virtual bool SetBackgroundColour(const wxColour& WXUNUSED(col) ) |
eefe52da SC |
781 | { |
782 | return false; | |
783 | } | |
784 | ||
1aec1f8b | 785 | virtual void SetExtraStyle( long WXUNUSED(exStyle) ) |
eefe52da SC |
786 | { |
787 | } | |
ce00f59b | 788 | |
b6dc21e7 KO |
789 | virtual void SetWindowStyleFlag( long WXUNUSED(style) ) |
790 | { | |
791 | } | |
ce00f59b | 792 | |
1aec1f8b | 793 | virtual bool SetBackgroundStyle(wxBackgroundStyle WXUNUSED(style)) |
03647350 | 794 | { |
eefe52da SC |
795 | return false ; |
796 | } | |
03647350 | 797 | |
6f5778a6 | 798 | virtual bool CanSetTransparent() |
eefe52da SC |
799 | { |
800 | return false; | |
801 | } | |
802 | ||
03647350 | 803 | virtual void GetContentArea( int &left , int &top , int &width , int &height ) const = 0; |
eefe52da SC |
804 | virtual void MoveWindow(int x, int y, int width, int height) = 0; |
805 | virtual void GetPosition( int &x, int &y ) const = 0; | |
806 | virtual void GetSize( int &width, int &height ) const = 0; | |
807 | ||
1aec1f8b | 808 | virtual bool SetShape(const wxRegion& WXUNUSED(region)) |
eefe52da SC |
809 | { |
810 | return false; | |
811 | } | |
03647350 | 812 | |
eefe52da | 813 | virtual void SetTitle( const wxString& title, wxFontEncoding encoding ) = 0; |
03647350 | 814 | |
eefe52da | 815 | virtual bool IsMaximized() const = 0; |
03647350 | 816 | |
eefe52da | 817 | virtual bool IsIconized() const= 0; |
03647350 | 818 | |
eefe52da | 819 | virtual void Iconize( bool iconize )= 0; |
03647350 | 820 | |
eefe52da | 821 | virtual void Maximize(bool maximize) = 0; |
03647350 | 822 | |
eefe52da | 823 | virtual bool IsFullScreen() const= 0; |
03647350 | 824 | |
dbc7ceb9 | 825 | virtual void ShowWithoutActivating() { Show(true); } |
ce00f59b | 826 | |
eefe52da SC |
827 | virtual bool ShowFullScreen(bool show, long style)= 0; |
828 | ||
829 | virtual void RequestUserAttention(int flags) = 0; | |
03647350 VZ |
830 | |
831 | virtual void ScreenToWindow( int *x, int *y ) = 0; | |
832 | ||
eefe52da | 833 | virtual void WindowToScreen( int *x, int *y ) = 0; |
03647350 | 834 | |
dbc7ceb9 | 835 | virtual bool IsActive() = 0; |
ce00f59b | 836 | |
eefe52da | 837 | wxNonOwnedWindow* GetWXPeer() { return m_wxPeer; } |
03647350 | 838 | |
075e3553 SC |
839 | static wxNonOwnedWindowImpl* |
840 | FindFromWXWindow(WXWindow window); | |
ce00f59b | 841 | |
075e3553 | 842 | static void RemoveAssociations( wxNonOwnedWindowImpl* impl); |
ce00f59b | 843 | |
075e3553 | 844 | static void Associate( WXWindow window, wxNonOwnedWindowImpl *impl ); |
ce00f59b | 845 | |
524c47aa | 846 | // static creation methods, must be implemented by all toolkits |
03647350 | 847 | |
17e2694c | 848 | static wxNonOwnedWindowImpl* CreateNonOwnedWindow( wxNonOwnedWindow* wxpeer, wxWindow* parent, WXWindow native) ; |
ce00f59b | 849 | |
524c47aa SC |
850 | static wxNonOwnedWindowImpl* CreateNonOwnedWindow( wxNonOwnedWindow* wxpeer, wxWindow* parent, const wxPoint& pos, const wxSize& size, |
851 | long style, long extraStyle, const wxString& name ) ; | |
ce00f59b | 852 | |
efb2fa41 | 853 | virtual void SetModified(bool WXUNUSED(modified)) { } |
ebf7d5c4 | 854 | virtual bool IsModified() const { return false; } |
524c47aa | 855 | |
eefe52da SC |
856 | protected : |
857 | wxNonOwnedWindow* m_wxPeer; | |
858 | DECLARE_ABSTRACT_CLASS(wxNonOwnedWindowImpl) | |
859 | }; | |
860 | ||
5c6eb3a8 SC |
861 | #endif // wxUSE_GUI |
862 | ||
863 | //--------------------------------------------------------------------------- | |
864 | // cocoa bridging utilities | |
865 | //--------------------------------------------------------------------------- | |
866 | ||
867 | bool wxMacInitCocoa(); | |
868 | ||
869 | class WXDLLIMPEXP_CORE wxMacAutoreleasePool | |
870 | { | |
871 | public : | |
872 | wxMacAutoreleasePool(); | |
873 | ~wxMacAutoreleasePool(); | |
874 | private : | |
875 | void* m_pool; | |
876 | }; | |
877 | ||
878 | // NSObject | |
879 | ||
880 | void wxMacCocoaRelease( void* obj ); | |
881 | void wxMacCocoaAutorelease( void* obj ); | |
f1c40652 | 882 | void* wxMacCocoaRetain( void* obj ); |
5c6eb3a8 SC |
883 | |
884 | ||
885 | #endif | |
eefe52da | 886 | // _WX_PRIVATE_CORE_H_ |