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