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