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