]>
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 SC |
217 | virtual void SetBackgroundColour( const wxColour& col ) = 0; |
218 | ||
219 | // all coordinates in native parent widget relative coordinates | |
220 | virtual void GetContentArea( int &left , int &top , int &width , int &height ) const = 0; | |
221 | virtual void Move(int x, int y, int width, int height) = 0; | |
222 | virtual void GetPosition( int &x, int &y ) const = 0; | |
223 | virtual void GetSize( int &width, int &height ) const = 0; | |
524c47aa | 224 | virtual void SetControlSize( wxWindowVariant variant ) = 0; |
eefe52da | 225 | |
ee032c59 SC |
226 | // native view coordinates are topleft to bottom right (flipped regarding CoreGraphics origin) |
227 | virtual bool IsFlipped() const { return true; } | |
228 | ||
eefe52da SC |
229 | virtual void SetNeedsDisplay( const wxRect* where = NULL ) = 0; |
230 | virtual bool GetNeedsDisplay() const = 0; | |
231 | ||
232 | virtual bool NeedsFocusRect() const; | |
233 | virtual void SetNeedsFocusRect( bool needs ); | |
234 | ||
f2f6030e SC |
235 | virtual bool NeedsFrame() const; |
236 | virtual void SetNeedsFrame( bool needs ); | |
237 | ||
eefe52da SC |
238 | virtual bool CanFocus() const = 0; |
239 | // return true if successful | |
240 | virtual bool SetFocus() = 0; | |
241 | virtual bool HasFocus() const = 0; | |
03647350 | 242 | |
eefe52da SC |
243 | virtual void RemoveFromParent() = 0; |
244 | virtual void Embed( wxWidgetImpl *parent ) = 0; | |
03647350 | 245 | |
524c47aa SC |
246 | virtual void SetDefaultButton( bool isDefault ) = 0; |
247 | virtual void PerformClick() = 0; | |
248 | virtual void SetLabel( const wxString& title, wxFontEncoding encoding ) = 0; | |
249 | ||
54f11060 SC |
250 | virtual void SetCursor( const wxCursor & cursor ) = 0; |
251 | virtual void CaptureMouse() = 0; | |
252 | virtual void ReleaseMouse() = 0; | |
253 | ||
524c47aa SC |
254 | virtual wxInt32 GetValue() const = 0; |
255 | virtual void SetValue( wxInt32 v ) = 0; | |
e5d05b90 | 256 | virtual wxBitmap GetBitmap() const = 0; |
524c47aa | 257 | virtual void SetBitmap( const wxBitmap& bitmap ) = 0; |
e5d05b90 | 258 | virtual void SetBitmapPosition( wxDirection dir ) = 0; |
524c47aa SC |
259 | virtual void SetupTabs( const wxNotebook ¬ebook ) =0; |
260 | virtual void GetBestRect( wxRect *r ) const = 0; | |
261 | virtual bool IsEnabled() const = 0; | |
262 | virtual void Enable( bool enable ) = 0; | |
263 | virtual void SetMinimum( wxInt32 v ) = 0; | |
264 | virtual void SetMaximum( wxInt32 v ) = 0; | |
19c7ac3d SC |
265 | virtual wxInt32 GetMinimum() const = 0; |
266 | virtual wxInt32 GetMaximum() const = 0; | |
524c47aa SC |
267 | virtual void PulseGauge() = 0; |
268 | virtual void SetScrollThumb( wxInt32 value, wxInt32 thumbSize ) = 0; | |
269 | ||
1e181c7a SC |
270 | virtual void SetFont( const wxFont & font , const wxColour& foreground , long windowStyle, bool ignoreBlack = true ) = 0; |
271 | ||
524c47aa SC |
272 | // is the clicked event sent AFTER the state already changed, so no additional |
273 | // state changing logic is required from the outside | |
274 | virtual bool ButtonClickDidStateChange() = 0; | |
03647350 | 275 | |
c4825ef7 | 276 | virtual void InstallEventHandler( WXWidget control = NULL ) = 0; |
eefe52da | 277 | |
f55d9f74 SC |
278 | // static methods for associating native controls and their implementations |
279 | ||
03647350 | 280 | static wxWidgetImpl* |
f55d9f74 | 281 | FindFromWXWidget(WXWidget control); |
03647350 | 282 | |
f55d9f74 | 283 | static void RemoveAssociations( wxWidgetImpl* impl); |
03647350 | 284 | |
f55d9f74 | 285 | static void Associate( WXWidget control, wxWidgetImpl *impl ); |
03647350 | 286 | |
f06e0fea | 287 | static WXWidget FindFocus(); |
03647350 | 288 | |
eefe52da | 289 | // static creation methods, must be implemented by all toolkits |
03647350 VZ |
290 | |
291 | static wxWidgetImplType* CreateUserPane( wxWindowMac* wxpeer, | |
292 | wxWindowMac* parent, | |
293 | wxWindowID id, | |
294 | const wxPoint& pos, | |
524c47aa | 295 | const wxSize& size, |
03647350 | 296 | long style, |
524c47aa SC |
297 | long extraStyle) ; |
298 | static wxWidgetImplType* CreateContentView( wxNonOwnedWindow* now ) ; | |
299 | ||
03647350 VZ |
300 | static wxWidgetImplType* CreateButton( wxWindowMac* wxpeer, |
301 | wxWindowMac* parent, | |
302 | wxWindowID id, | |
524c47aa | 303 | const wxString& label, |
03647350 | 304 | const wxPoint& pos, |
524c47aa | 305 | const wxSize& size, |
03647350 | 306 | long style, |
524c47aa SC |
307 | long extraStyle) ; |
308 | ||
03647350 VZ |
309 | static wxWidgetImplType* CreateDisclosureTriangle( 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 | 316 | long extraStyle) ; |
03647350 VZ |
317 | |
318 | static wxWidgetImplType* CreateStaticLine( 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 | ||
03647350 VZ |
326 | static wxWidgetImplType* CreateGroupBox( wxWindowMac* wxpeer, |
327 | wxWindowMac* parent, | |
328 | wxWindowID id, | |
524c47aa | 329 | const wxString& label, |
03647350 | 330 | const wxPoint& pos, |
524c47aa | 331 | const wxSize& size, |
03647350 | 332 | long style, |
524c47aa SC |
333 | long extraStyle) ; |
334 | ||
03647350 VZ |
335 | static wxWidgetImplType* CreateStaticText( 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* CreateTextControl( wxTextCtrl* wxpeer, |
345 | wxWindowMac* parent, | |
346 | wxWindowID id, | |
524c47aa | 347 | const wxString& content, |
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* CreateSearchControl( wxTextCtrl* wxpeer, |
354 | wxWindowMac* parent, | |
355 | wxWindowID id, | |
1e181c7a | 356 | const wxString& content, |
03647350 | 357 | const wxPoint& pos, |
1e181c7a | 358 | const wxSize& size, |
03647350 | 359 | long style, |
1e181c7a SC |
360 | long extraStyle) ; |
361 | ||
03647350 VZ |
362 | static wxWidgetImplType* CreateCheckBox( 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 | 369 | long extraStyle); |
03647350 VZ |
370 | |
371 | static wxWidgetImplType* CreateRadioButton( 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 SC |
378 | long extraStyle); |
379 | ||
03647350 VZ |
380 | static wxWidgetImplType* CreateToggleButton( 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* CreateBitmapToggleButton( wxWindowMac* wxpeer, |
390 | wxWindowMac* parent, | |
391 | wxWindowID id, | |
524c47aa | 392 | const wxBitmap& bitmap, |
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* CreateBitmapButton( 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* CreateTabView( wxWindowMac* wxpeer, |
408 | wxWindowMac* parent, | |
409 | wxWindowID id, | |
410 | const wxPoint& pos, | |
524c47aa | 411 | const wxSize& size, |
03647350 | 412 | long style, |
524c47aa SC |
413 | long extraStyle); |
414 | ||
03647350 VZ |
415 | static wxWidgetImplType* CreateGauge( wxWindowMac* wxpeer, |
416 | wxWindowMac* parent, | |
417 | wxWindowID id, | |
524c47aa SC |
418 | wxInt32 value, |
419 | wxInt32 minimum, | |
420 | wxInt32 maximum, | |
03647350 | 421 | const wxPoint& pos, |
524c47aa | 422 | const wxSize& size, |
03647350 | 423 | long style, |
524c47aa SC |
424 | long extraStyle); |
425 | ||
03647350 VZ |
426 | static wxWidgetImplType* CreateSlider( wxWindowMac* wxpeer, |
427 | wxWindowMac* parent, | |
428 | wxWindowID id, | |
524c47aa SC |
429 | wxInt32 value, |
430 | wxInt32 minimum, | |
431 | wxInt32 maximum, | |
03647350 | 432 | const wxPoint& pos, |
524c47aa | 433 | const wxSize& size, |
03647350 | 434 | long style, |
524c47aa SC |
435 | long extraStyle); |
436 | ||
03647350 VZ |
437 | static wxWidgetImplType* CreateSpinButton( wxWindowMac* wxpeer, |
438 | wxWindowMac* parent, | |
439 | wxWindowID id, | |
524c47aa SC |
440 | wxInt32 value, |
441 | wxInt32 minimum, | |
442 | wxInt32 maximum, | |
03647350 | 443 | const wxPoint& pos, |
524c47aa | 444 | const wxSize& size, |
03647350 | 445 | long style, |
524c47aa SC |
446 | long extraStyle); |
447 | ||
03647350 VZ |
448 | static wxWidgetImplType* CreateScrollBar( wxWindowMac* wxpeer, |
449 | wxWindowMac* parent, | |
450 | wxWindowID id, | |
451 | const wxPoint& pos, | |
524c47aa | 452 | const wxSize& size, |
03647350 | 453 | long style, |
524c47aa SC |
454 | long extraStyle); |
455 | ||
03647350 VZ |
456 | static wxWidgetImplType* CreateChoice( wxWindowMac* wxpeer, |
457 | wxWindowMac* parent, | |
458 | wxWindowID id, | |
524c47aa | 459 | wxMenu* menu, |
03647350 | 460 | const wxPoint& pos, |
524c47aa | 461 | const wxSize& size, |
03647350 | 462 | long style, |
524c47aa SC |
463 | long extraStyle); |
464 | ||
03647350 VZ |
465 | static wxWidgetImplType* CreateListBox( wxWindowMac* wxpeer, |
466 | wxWindowMac* parent, | |
467 | wxWindowID id, | |
468 | const wxPoint& pos, | |
524c47aa | 469 | const wxSize& size, |
03647350 | 470 | long style, |
524c47aa | 471 | long extraStyle); |
eefe52da SC |
472 | |
473 | // converts from Toplevel-Content relative to local | |
474 | static void Convert( wxPoint *pt , wxWidgetImpl *from , wxWidgetImpl *to ); | |
475 | protected : | |
476 | bool m_isRootControl; | |
477 | wxWindowMac* m_wxPeer; | |
478 | bool m_needsFocusRect; | |
f2f6030e | 479 | bool m_needsFrame; |
eefe52da SC |
480 | |
481 | DECLARE_ABSTRACT_CLASS(wxWidgetImpl) | |
482 | }; | |
483 | ||
524c47aa SC |
484 | // |
485 | // the interface to be implemented eg by a listbox | |
486 | // | |
487 | ||
03647350 | 488 | class WXDLLIMPEXP_CORE wxListWidgetColumn |
524c47aa SC |
489 | { |
490 | public : | |
491 | virtual ~wxListWidgetColumn() {} | |
492 | } ; | |
493 | ||
494 | class WXDLLIMPEXP_CORE wxListWidgetCellValue | |
495 | { | |
496 | public : | |
497 | wxListWidgetCellValue() {} | |
498 | virtual ~wxListWidgetCellValue() {} | |
03647350 | 499 | |
524c47aa SC |
500 | virtual void Set( CFStringRef value ) = 0; |
501 | virtual void Set( const wxString& value ) = 0; | |
502 | virtual void Set( int value ) = 0; | |
60ebcb8a | 503 | virtual void Check( bool check ); |
03647350 | 504 | |
60ebcb8a | 505 | virtual bool IsChecked() const; |
524c47aa SC |
506 | virtual int GetIntValue() const = 0; |
507 | virtual wxString GetStringValue() const = 0; | |
508 | } ; | |
509 | ||
510 | class WXDLLIMPEXP_CORE wxListWidgetImpl | |
511 | { | |
512 | public: | |
513 | wxListWidgetImpl() {} | |
514 | virtual ~wxListWidgetImpl() { } | |
03647350 VZ |
515 | |
516 | virtual wxListWidgetColumn* InsertTextColumn( unsigned pos, const wxString& title, bool editable = false, | |
524c47aa | 517 | wxAlignment just = wxALIGN_LEFT , int defaultWidth = -1) = 0 ; |
03647350 | 518 | virtual wxListWidgetColumn* InsertCheckColumn( unsigned pos , const wxString& title, bool editable = false, |
524c47aa | 519 | wxAlignment just = wxALIGN_LEFT , int defaultWidth = -1) = 0 ; |
03647350 | 520 | |
524c47aa SC |
521 | // add and remove |
522 | ||
523 | // TODO will be replaced | |
524 | virtual void ListDelete( unsigned int n ) = 0; | |
525 | virtual void ListInsert( unsigned int n ) = 0; | |
526 | virtual void ListClear() = 0; | |
527 | ||
528 | // selecting | |
529 | ||
530 | virtual void ListDeselectAll() = 0; | |
531 | virtual void ListSetSelection( unsigned int n, bool select, bool multi ) = 0; | |
532 | virtual int ListGetSelection() const = 0; | |
533 | virtual int ListGetSelections( wxArrayInt& aSelections ) const = 0; | |
534 | virtual bool ListIsSelected( unsigned int n ) const = 0; | |
03647350 | 535 | |
524c47aa SC |
536 | // display |
537 | ||
538 | virtual void ListScrollTo( unsigned int n ) = 0; | |
539 | virtual void UpdateLine( unsigned int n, wxListWidgetColumn* col = NULL ) = 0; | |
540 | virtual void UpdateLineToEnd( unsigned int n) = 0; | |
541 | ||
542 | // accessing content | |
543 | ||
544 | virtual unsigned int ListGetCount() const = 0; | |
545 | }; | |
546 | ||
1e181c7a SC |
547 | // |
548 | // interface to be implemented by a textcontrol | |
549 | // | |
550 | ||
21a9d326 SC |
551 | class WXDLLIMPEXP_FWD_CORE wxTextAttr; |
552 | ||
1e181c7a SC |
553 | // common interface for all implementations |
554 | class WXDLLIMPEXP_CORE wxTextWidgetImpl | |
555 | ||
556 | { | |
557 | public : | |
558 | wxTextWidgetImpl() {} | |
559 | ||
560 | virtual ~wxTextWidgetImpl() {} | |
561 | ||
562 | virtual bool CanFocus() const { return true; } | |
563 | ||
564 | virtual wxString GetStringValue() const = 0 ; | |
565 | virtual void SetStringValue( const wxString &val ) = 0 ; | |
566 | virtual void SetSelection( long from, long to ) = 0 ; | |
567 | virtual void GetSelection( long* from, long* to ) const = 0 ; | |
568 | virtual void WriteText( const wxString& str ) = 0 ; | |
569 | ||
16671f22 | 570 | virtual bool GetStyle( long position, wxTextAttr& style); |
1e181c7a SC |
571 | virtual void SetStyle( long start, long end, const wxTextAttr& style ) ; |
572 | virtual void Copy() ; | |
573 | virtual void Cut() ; | |
574 | virtual void Paste() ; | |
575 | virtual bool CanPaste() const ; | |
576 | virtual void SetEditable( bool editable ) ; | |
0b6a49c2 | 577 | virtual long GetLastPosition() const ; |
1e181c7a SC |
578 | virtual void Replace( long from, long to, const wxString &str ) ; |
579 | virtual void Remove( long from, long to ) ; | |
580 | ||
581 | ||
582 | virtual bool HasOwnContextMenu() const | |
583 | { return false ; } | |
584 | ||
585 | virtual bool SetupCursor( const wxPoint& WXUNUSED(pt) ) | |
586 | { return false ; } | |
587 | ||
588 | virtual void Clear() ; | |
589 | virtual bool CanUndo() const; | |
590 | virtual void Undo() ; | |
591 | virtual bool CanRedo() const; | |
592 | virtual void Redo() ; | |
593 | virtual int GetNumberOfLines() const ; | |
594 | virtual long XYToPosition(long x, long y) const; | |
595 | virtual bool PositionToXY(long pos, long *x, long *y) const ; | |
596 | virtual void ShowPosition(long WXUNUSED(pos)) ; | |
597 | virtual int GetLineLength(long lineNo) const ; | |
598 | virtual wxString GetLineText(long lineNo) const ; | |
599 | virtual void CheckSpelling(bool WXUNUSED(check)) { } | |
9ab7ff53 KO |
600 | |
601 | virtual wxSize GetBestSize() const { return wxDefaultSize; } | |
1e181c7a SC |
602 | }; |
603 | ||
411a1c35 | 604 | // |
b38dc31f | 605 | // common interface for buttons |
411a1c35 SC |
606 | // |
607 | ||
b38dc31f | 608 | class wxButtonImpl |
411a1c35 SC |
609 | { |
610 | public : | |
b38dc31f SC |
611 | wxButtonImpl(){} |
612 | virtual ~wxButtonImpl(){} | |
411a1c35 SC |
613 | |
614 | virtual void SetPressedBitmap( const wxBitmap& bitmap ) = 0; | |
615 | } ; | |
616 | ||
1e181c7a SC |
617 | // |
618 | // common interface for search controls | |
619 | // | |
620 | ||
621 | class wxSearchWidgetImpl | |
622 | { | |
623 | public : | |
624 | wxSearchWidgetImpl(){} | |
625 | virtual ~wxSearchWidgetImpl(){} | |
626 | ||
627 | // search field options | |
628 | virtual void ShowSearchButton( bool show ) = 0; | |
629 | virtual bool IsSearchButtonVisible() const = 0; | |
630 | ||
631 | virtual void ShowCancelButton( bool show ) = 0; | |
632 | virtual bool IsCancelButtonVisible() const = 0; | |
633 | ||
634 | virtual void SetSearchMenu( wxMenu* menu ) = 0; | |
635 | ||
636 | virtual void SetDescriptiveText(const wxString& text) = 0; | |
637 | } ; | |
638 | ||
524c47aa SC |
639 | // |
640 | // toplevel window implementation class | |
641 | // | |
642 | ||
eefe52da SC |
643 | class wxNonOwnedWindowImpl : public wxObject |
644 | { | |
645 | public : | |
646 | wxNonOwnedWindowImpl( wxNonOwnedWindow* nonownedwnd) : m_wxPeer(nonownedwnd) | |
647 | { | |
648 | } | |
649 | wxNonOwnedWindowImpl() | |
650 | { | |
651 | } | |
652 | virtual ~wxNonOwnedWindowImpl() | |
653 | { | |
654 | } | |
03647350 VZ |
655 | |
656 | virtual void Destroy() | |
eefe52da SC |
657 | { |
658 | } | |
659 | ||
660 | virtual void Create( wxWindow* parent, const wxPoint& pos, const wxSize& size, | |
661 | long style, long extraStyle, const wxString& name ) = 0; | |
03647350 VZ |
662 | |
663 | ||
eefe52da | 664 | virtual WXWindow GetWXWindow() const = 0; |
03647350 | 665 | |
eefe52da SC |
666 | virtual void Raise() |
667 | { | |
668 | } | |
03647350 | 669 | |
eefe52da SC |
670 | virtual void Lower() |
671 | { | |
672 | } | |
673 | ||
1aec1f8b | 674 | virtual bool Show(bool WXUNUSED(show)) |
eefe52da SC |
675 | { |
676 | return false; | |
677 | } | |
03647350 | 678 | |
1aec1f8b | 679 | virtual bool ShowWithEffect(bool show, wxShowEffect WXUNUSED(effect), unsigned WXUNUSED(timeout)) |
eefe52da SC |
680 | { |
681 | return Show(show); | |
682 | } | |
03647350 | 683 | |
eefe52da SC |
684 | virtual void Update() |
685 | { | |
686 | } | |
687 | ||
1aec1f8b | 688 | virtual bool SetTransparent(wxByte WXUNUSED(alpha)) |
eefe52da SC |
689 | { |
690 | return false; | |
691 | } | |
692 | ||
1aec1f8b | 693 | virtual bool SetBackgroundColour(const wxColour& WXUNUSED(col) ) |
eefe52da SC |
694 | { |
695 | return false; | |
696 | } | |
697 | ||
1aec1f8b | 698 | virtual void SetExtraStyle( long WXUNUSED(exStyle) ) |
eefe52da SC |
699 | { |
700 | } | |
b6dc21e7 KO |
701 | |
702 | virtual void SetWindowStyleFlag( long WXUNUSED(style) ) | |
703 | { | |
704 | } | |
705 | ||
1aec1f8b | 706 | virtual bool SetBackgroundStyle(wxBackgroundStyle WXUNUSED(style)) |
03647350 | 707 | { |
eefe52da SC |
708 | return false ; |
709 | } | |
03647350 | 710 | |
eefe52da SC |
711 | bool CanSetTransparent() |
712 | { | |
713 | return false; | |
714 | } | |
715 | ||
03647350 | 716 | virtual void GetContentArea( int &left , int &top , int &width , int &height ) const = 0; |
eefe52da SC |
717 | virtual void MoveWindow(int x, int y, int width, int height) = 0; |
718 | virtual void GetPosition( int &x, int &y ) const = 0; | |
719 | virtual void GetSize( int &width, int &height ) const = 0; | |
720 | ||
1aec1f8b | 721 | virtual bool SetShape(const wxRegion& WXUNUSED(region)) |
eefe52da SC |
722 | { |
723 | return false; | |
724 | } | |
03647350 | 725 | |
eefe52da | 726 | virtual void SetTitle( const wxString& title, wxFontEncoding encoding ) = 0; |
03647350 | 727 | |
eefe52da | 728 | virtual bool IsMaximized() const = 0; |
03647350 | 729 | |
eefe52da | 730 | virtual bool IsIconized() const= 0; |
03647350 | 731 | |
eefe52da | 732 | virtual void Iconize( bool iconize )= 0; |
03647350 | 733 | |
eefe52da | 734 | virtual void Maximize(bool maximize) = 0; |
03647350 | 735 | |
eefe52da | 736 | virtual bool IsFullScreen() const= 0; |
03647350 | 737 | |
dbc7ceb9 KO |
738 | virtual void ShowWithoutActivating() { Show(true); } |
739 | ||
eefe52da SC |
740 | virtual bool ShowFullScreen(bool show, long style)= 0; |
741 | ||
742 | virtual void RequestUserAttention(int flags) = 0; | |
03647350 VZ |
743 | |
744 | virtual void ScreenToWindow( int *x, int *y ) = 0; | |
745 | ||
eefe52da | 746 | virtual void WindowToScreen( int *x, int *y ) = 0; |
03647350 | 747 | |
dbc7ceb9 KO |
748 | virtual bool IsActive() = 0; |
749 | ||
eefe52da | 750 | wxNonOwnedWindow* GetWXPeer() { return m_wxPeer; } |
03647350 | 751 | |
524c47aa | 752 | // static creation methods, must be implemented by all toolkits |
03647350 | 753 | |
524c47aa SC |
754 | static wxNonOwnedWindowImpl* CreateNonOwnedWindow( wxNonOwnedWindow* wxpeer, wxWindow* parent, const wxPoint& pos, const wxSize& size, |
755 | long style, long extraStyle, const wxString& name ) ; | |
efb2fa41 KO |
756 | |
757 | virtual void SetModified(bool WXUNUSED(modified)) { } | |
ebf7d5c4 | 758 | virtual bool IsModified() const { return false; } |
524c47aa | 759 | |
eefe52da SC |
760 | protected : |
761 | wxNonOwnedWindow* m_wxPeer; | |
762 | DECLARE_ABSTRACT_CLASS(wxNonOwnedWindowImpl) | |
763 | }; | |
764 | ||
5c6eb3a8 SC |
765 | #endif // wxUSE_GUI |
766 | ||
767 | //--------------------------------------------------------------------------- | |
768 | // cocoa bridging utilities | |
769 | //--------------------------------------------------------------------------- | |
770 | ||
771 | bool wxMacInitCocoa(); | |
772 | ||
773 | class WXDLLIMPEXP_CORE wxMacAutoreleasePool | |
774 | { | |
775 | public : | |
776 | wxMacAutoreleasePool(); | |
777 | ~wxMacAutoreleasePool(); | |
778 | private : | |
779 | void* m_pool; | |
780 | }; | |
781 | ||
782 | // NSObject | |
783 | ||
784 | void wxMacCocoaRelease( void* obj ); | |
785 | void wxMacCocoaAutorelease( void* obj ); | |
f1c40652 | 786 | void* wxMacCocoaRetain( void* obj ); |
5c6eb3a8 SC |
787 | |
788 | ||
789 | #endif | |
eefe52da | 790 | // _WX_PRIVATE_CORE_H_ |