]>
Commit | Line | Data |
---|---|---|
1 | ///////////////////////////////////////////////////////////////////////////// | |
2 | // Name: wx/osx/core/private.h | |
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 | ||
14 | #ifndef _WX_PRIVATE_CORE_H_ | |
15 | #define _WX_PRIVATE_CORE_H_ | |
16 | ||
17 | #include "wx/defs.h" | |
18 | ||
19 | #include <CoreFoundation/CoreFoundation.h> | |
20 | ||
21 | #include "wx/osx/core/cfstring.h" | |
22 | #include "wx/osx/core/cfdataref.h" | |
23 | ||
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 | ||
35 | #if wxOSX_USE_COCOA_OR_CARBON | |
36 | ||
37 | WXDLLIMPEXP_BASE long UMAGetSystemVersion() ; | |
38 | ||
39 | void WXDLLIMPEXP_CORE wxMacStringToPascal( const wxString&from , unsigned char * to ); | |
40 | wxString WXDLLIMPEXP_CORE wxMacMakeStringFromPascal( const unsigned char * from ); | |
41 | ||
42 | #endif | |
43 | ||
44 | #if wxUSE_GUI | |
45 | ||
46 | #if wxOSX_USE_IPHONE | |
47 | #include <CoreGraphics/CoreGraphics.h> | |
48 | #else | |
49 | #include <ApplicationServices/ApplicationServices.h> | |
50 | #endif | |
51 | ||
52 | #include "wx/bitmap.h" | |
53 | #include "wx/window.h" | |
54 | ||
55 | class WXDLLIMPEXP_CORE wxMacCGContextStateSaver | |
56 | { | |
57 | wxDECLARE_NO_COPY_CLASS(wxMacCGContextStateSaver); | |
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 | ||
73 | class WXDLLIMPEXP_CORE wxDeferredObjectDeleter : public wxObject | |
74 | { | |
75 | public : | |
76 | wxDeferredObjectDeleter( wxObject* obj ) : m_obj(obj) | |
77 | { | |
78 | } | |
79 | virtual ~wxDeferredObjectDeleter() | |
80 | { | |
81 | delete m_obj; | |
82 | } | |
83 | protected : | |
84 | wxObject* m_obj ; | |
85 | } ; | |
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 | ||
97 | class wxWindowMac; | |
98 | // to | |
99 | extern wxWindow* g_MacLastWindow; | |
100 | class wxNonOwnedWindow; | |
101 | ||
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; | |
107 | class wxTextCtrl; | |
108 | ||
109 | WXDLLIMPEXP_CORE wxWindowMac * wxFindWindowFromWXWidget(WXWidget inControl ); | |
110 | ||
111 | #if wxOSX_USE_CARBON | |
112 | typedef wxMacControl wxWidgetImplType; | |
113 | #else | |
114 | typedef wxWidgetImpl wxWidgetImplType; | |
115 | #endif | |
116 | ||
117 | #if wxUSE_MENUS | |
118 | class wxMenuItemImpl : public wxObject | |
119 | { | |
120 | public : | |
121 | wxMenuItemImpl( wxMenuItem* peer ) : m_peer(peer) | |
122 | { | |
123 | } | |
124 | ||
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; | |
131 | ||
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; | |
146 | ||
147 | DECLARE_ABSTRACT_CLASS(wxMenuItemImpl) | |
148 | } ; | |
149 | ||
150 | class wxMenuImpl : public wxObject | |
151 | { | |
152 | public : | |
153 | wxMenuImpl( wxMenu* peer ) : m_peer(peer) | |
154 | { | |
155 | } | |
156 | ||
157 | virtual ~wxMenuImpl() ; | |
158 | virtual void InsertOrAppend(wxMenuItem *pItem, size_t pos) = 0; | |
159 | virtual void Remove( wxMenuItem *pItem ) = 0; | |
160 | ||
161 | virtual void MakeRoot() = 0; | |
162 | ||
163 | virtual void SetTitle( const wxString& text ) = 0; | |
164 | ||
165 | virtual WXHMENU GetHMenu() = 0; | |
166 | ||
167 | wxMenu* GetWXPeer() { return m_peer ; } | |
168 | ||
169 | virtual void PopUp( wxWindow *win, int x, int y ) = 0; | |
170 | ||
171 | static wxMenuImpl* Create( wxMenu* peer, const wxString& title ); | |
172 | static wxMenuImpl* CreateRootMenu( wxMenu* peer ); | |
173 | protected : | |
174 | wxMenu* m_peer; | |
175 | ||
176 | DECLARE_ABSTRACT_CLASS(wxMenuItemImpl) | |
177 | } ; | |
178 | #endif | |
179 | ||
180 | ||
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 | ||
190 | bool IsRootControl() const { return m_isRootControl; } | |
191 | ||
192 | wxWindowMac* GetWXPeer() const { return m_wxPeer; } | |
193 | ||
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 | ||
202 | virtual bool ShowWithEffect(bool WXUNUSED(show), | |
203 | wxShowEffect WXUNUSED(effect), | |
204 | unsigned WXUNUSED(timeout)) | |
205 | { | |
206 | return false; | |
207 | } | |
208 | ||
209 | virtual void Raise() = 0; | |
210 | ||
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; | |
216 | ||
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; | |
224 | virtual void SetControlSize( wxWindowVariant variant ) = 0; | |
225 | ||
226 | // native view coordinates are topleft to bottom right (flipped regarding CoreGraphics origin) | |
227 | virtual bool IsFlipped() const { return true; } | |
228 | ||
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 | ||
235 | virtual bool NeedsFrame() const; | |
236 | virtual void SetNeedsFrame( bool needs ); | |
237 | ||
238 | virtual bool CanFocus() const = 0; | |
239 | // return true if successful | |
240 | virtual bool SetFocus() = 0; | |
241 | virtual bool HasFocus() const = 0; | |
242 | ||
243 | virtual void RemoveFromParent() = 0; | |
244 | virtual void Embed( wxWidgetImpl *parent ) = 0; | |
245 | ||
246 | virtual void SetDefaultButton( bool isDefault ) = 0; | |
247 | virtual void PerformClick() = 0; | |
248 | virtual void SetLabel( const wxString& title, wxFontEncoding encoding ) = 0; | |
249 | ||
250 | virtual void SetCursor( const wxCursor & cursor ) = 0; | |
251 | virtual void CaptureMouse() = 0; | |
252 | virtual void ReleaseMouse() = 0; | |
253 | ||
254 | virtual wxInt32 GetValue() const = 0; | |
255 | virtual void SetValue( wxInt32 v ) = 0; | |
256 | virtual wxBitmap GetBitmap() const = 0; | |
257 | virtual void SetBitmap( const wxBitmap& bitmap ) = 0; | |
258 | virtual void SetBitmapPosition( wxDirection dir ) = 0; | |
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; | |
265 | virtual wxInt32 GetMinimum() const = 0; | |
266 | virtual wxInt32 GetMaximum() const = 0; | |
267 | virtual void PulseGauge() = 0; | |
268 | virtual void SetScrollThumb( wxInt32 value, wxInt32 thumbSize ) = 0; | |
269 | ||
270 | virtual void SetFont( const wxFont & font , const wxColour& foreground , long windowStyle, bool ignoreBlack = true ) = 0; | |
271 | ||
272 | virtual void SetToolTip(wxToolTip* WXUNUSED(tooltip)) { } | |
273 | ||
274 | // is the clicked event sent AFTER the state already changed, so no additional | |
275 | // state changing logic is required from the outside | |
276 | virtual bool ButtonClickDidStateChange() = 0; | |
277 | ||
278 | virtual void InstallEventHandler( WXWidget control = NULL ) = 0; | |
279 | ||
280 | // static methods for associating native controls and their implementations | |
281 | ||
282 | static wxWidgetImpl* | |
283 | FindFromWXWidget(WXWidget control); | |
284 | ||
285 | static void RemoveAssociations( wxWidgetImpl* impl); | |
286 | ||
287 | static void Associate( WXWidget control, wxWidgetImpl *impl ); | |
288 | ||
289 | static WXWidget FindFocus(); | |
290 | ||
291 | // static creation methods, must be implemented by all toolkits | |
292 | ||
293 | static wxWidgetImplType* CreateUserPane( wxWindowMac* wxpeer, | |
294 | wxWindowMac* parent, | |
295 | wxWindowID id, | |
296 | const wxPoint& pos, | |
297 | const wxSize& size, | |
298 | long style, | |
299 | long extraStyle) ; | |
300 | static wxWidgetImplType* CreateContentView( wxNonOwnedWindow* now ) ; | |
301 | ||
302 | static wxWidgetImplType* CreateButton( wxWindowMac* wxpeer, | |
303 | wxWindowMac* parent, | |
304 | wxWindowID id, | |
305 | const wxString& label, | |
306 | const wxPoint& pos, | |
307 | const wxSize& size, | |
308 | long style, | |
309 | long extraStyle) ; | |
310 | ||
311 | static wxWidgetImplType* CreateDisclosureTriangle( wxWindowMac* wxpeer, | |
312 | wxWindowMac* parent, | |
313 | wxWindowID id, | |
314 | const wxString& label, | |
315 | const wxPoint& pos, | |
316 | const wxSize& size, | |
317 | long style, | |
318 | long extraStyle) ; | |
319 | ||
320 | static wxWidgetImplType* CreateStaticLine( wxWindowMac* wxpeer, | |
321 | wxWindowMac* parent, | |
322 | wxWindowID id, | |
323 | const wxPoint& pos, | |
324 | const wxSize& size, | |
325 | long style, | |
326 | long extraStyle) ; | |
327 | ||
328 | static wxWidgetImplType* CreateGroupBox( wxWindowMac* wxpeer, | |
329 | wxWindowMac* parent, | |
330 | wxWindowID id, | |
331 | const wxString& label, | |
332 | const wxPoint& pos, | |
333 | const wxSize& size, | |
334 | long style, | |
335 | long extraStyle) ; | |
336 | ||
337 | static wxWidgetImplType* CreateStaticText( wxWindowMac* wxpeer, | |
338 | wxWindowMac* parent, | |
339 | wxWindowID id, | |
340 | const wxString& label, | |
341 | const wxPoint& pos, | |
342 | const wxSize& size, | |
343 | long style, | |
344 | long extraStyle) ; | |
345 | ||
346 | static wxWidgetImplType* CreateTextControl( wxTextCtrl* wxpeer, | |
347 | wxWindowMac* parent, | |
348 | wxWindowID id, | |
349 | const wxString& content, | |
350 | const wxPoint& pos, | |
351 | const wxSize& size, | |
352 | long style, | |
353 | long extraStyle) ; | |
354 | ||
355 | static wxWidgetImplType* CreateSearchControl( wxTextCtrl* wxpeer, | |
356 | wxWindowMac* parent, | |
357 | wxWindowID id, | |
358 | const wxString& content, | |
359 | const wxPoint& pos, | |
360 | const wxSize& size, | |
361 | long style, | |
362 | long extraStyle) ; | |
363 | ||
364 | static wxWidgetImplType* CreateCheckBox( wxWindowMac* wxpeer, | |
365 | wxWindowMac* parent, | |
366 | wxWindowID id, | |
367 | const wxString& label, | |
368 | const wxPoint& pos, | |
369 | const wxSize& size, | |
370 | long style, | |
371 | long extraStyle); | |
372 | ||
373 | static wxWidgetImplType* CreateRadioButton( wxWindowMac* wxpeer, | |
374 | wxWindowMac* parent, | |
375 | wxWindowID id, | |
376 | const wxString& label, | |
377 | const wxPoint& pos, | |
378 | const wxSize& size, | |
379 | long style, | |
380 | long extraStyle); | |
381 | ||
382 | static wxWidgetImplType* CreateToggleButton( wxWindowMac* wxpeer, | |
383 | wxWindowMac* parent, | |
384 | wxWindowID id, | |
385 | const wxString& label, | |
386 | const wxPoint& pos, | |
387 | const wxSize& size, | |
388 | long style, | |
389 | long extraStyle); | |
390 | ||
391 | static wxWidgetImplType* CreateBitmapToggleButton( wxWindowMac* wxpeer, | |
392 | wxWindowMac* parent, | |
393 | wxWindowID id, | |
394 | const wxBitmap& bitmap, | |
395 | const wxPoint& pos, | |
396 | const wxSize& size, | |
397 | long style, | |
398 | long extraStyle); | |
399 | ||
400 | static wxWidgetImplType* CreateBitmapButton( wxWindowMac* wxpeer, | |
401 | wxWindowMac* parent, | |
402 | wxWindowID id, | |
403 | const wxBitmap& bitmap, | |
404 | const wxPoint& pos, | |
405 | const wxSize& size, | |
406 | long style, | |
407 | long extraStyle); | |
408 | ||
409 | static wxWidgetImplType* CreateTabView( wxWindowMac* wxpeer, | |
410 | wxWindowMac* parent, | |
411 | wxWindowID id, | |
412 | const wxPoint& pos, | |
413 | const wxSize& size, | |
414 | long style, | |
415 | long extraStyle); | |
416 | ||
417 | static wxWidgetImplType* CreateGauge( wxWindowMac* wxpeer, | |
418 | wxWindowMac* parent, | |
419 | wxWindowID id, | |
420 | wxInt32 value, | |
421 | wxInt32 minimum, | |
422 | wxInt32 maximum, | |
423 | const wxPoint& pos, | |
424 | const wxSize& size, | |
425 | long style, | |
426 | long extraStyle); | |
427 | ||
428 | static wxWidgetImplType* CreateSlider( wxWindowMac* wxpeer, | |
429 | wxWindowMac* parent, | |
430 | wxWindowID id, | |
431 | wxInt32 value, | |
432 | wxInt32 minimum, | |
433 | wxInt32 maximum, | |
434 | const wxPoint& pos, | |
435 | const wxSize& size, | |
436 | long style, | |
437 | long extraStyle); | |
438 | ||
439 | static wxWidgetImplType* CreateSpinButton( wxWindowMac* wxpeer, | |
440 | wxWindowMac* parent, | |
441 | wxWindowID id, | |
442 | wxInt32 value, | |
443 | wxInt32 minimum, | |
444 | wxInt32 maximum, | |
445 | const wxPoint& pos, | |
446 | const wxSize& size, | |
447 | long style, | |
448 | long extraStyle); | |
449 | ||
450 | static wxWidgetImplType* CreateScrollBar( wxWindowMac* wxpeer, | |
451 | wxWindowMac* parent, | |
452 | wxWindowID id, | |
453 | const wxPoint& pos, | |
454 | const wxSize& size, | |
455 | long style, | |
456 | long extraStyle); | |
457 | ||
458 | static wxWidgetImplType* CreateChoice( wxWindowMac* wxpeer, | |
459 | wxWindowMac* parent, | |
460 | wxWindowID id, | |
461 | wxMenu* menu, | |
462 | const wxPoint& pos, | |
463 | const wxSize& size, | |
464 | long style, | |
465 | long extraStyle); | |
466 | ||
467 | static wxWidgetImplType* CreateListBox( wxWindowMac* wxpeer, | |
468 | wxWindowMac* parent, | |
469 | wxWindowID id, | |
470 | const wxPoint& pos, | |
471 | const wxSize& size, | |
472 | long style, | |
473 | long extraStyle); | |
474 | ||
475 | #if wxOSX_USE_COCOA | |
476 | static wxWidgetImplType* CreateComboBox( wxWindowMac* wxpeer, | |
477 | wxWindowMac* parent, | |
478 | wxWindowID id, | |
479 | wxMenu* menu, | |
480 | const wxPoint& pos, | |
481 | const wxSize& size, | |
482 | long style, | |
483 | long extraStyle); | |
484 | #endif | |
485 | ||
486 | // converts from Toplevel-Content relative to local | |
487 | static void Convert( wxPoint *pt , wxWidgetImpl *from , wxWidgetImpl *to ); | |
488 | protected : | |
489 | bool m_isRootControl; | |
490 | wxWindowMac* m_wxPeer; | |
491 | bool m_needsFocusRect; | |
492 | bool m_needsFrame; | |
493 | ||
494 | DECLARE_ABSTRACT_CLASS(wxWidgetImpl) | |
495 | }; | |
496 | ||
497 | // | |
498 | // the interface to be implemented eg by a listbox | |
499 | // | |
500 | ||
501 | class WXDLLIMPEXP_CORE wxListWidgetColumn | |
502 | { | |
503 | public : | |
504 | virtual ~wxListWidgetColumn() {} | |
505 | } ; | |
506 | ||
507 | class WXDLLIMPEXP_CORE wxListWidgetCellValue | |
508 | { | |
509 | public : | |
510 | wxListWidgetCellValue() {} | |
511 | virtual ~wxListWidgetCellValue() {} | |
512 | ||
513 | virtual void Set( CFStringRef value ) = 0; | |
514 | virtual void Set( const wxString& value ) = 0; | |
515 | virtual void Set( int value ) = 0; | |
516 | virtual void Check( bool check ); | |
517 | ||
518 | virtual bool IsChecked() const; | |
519 | virtual int GetIntValue() const = 0; | |
520 | virtual wxString GetStringValue() const = 0; | |
521 | } ; | |
522 | ||
523 | class WXDLLIMPEXP_CORE wxListWidgetImpl | |
524 | { | |
525 | public: | |
526 | wxListWidgetImpl() {} | |
527 | virtual ~wxListWidgetImpl() { } | |
528 | ||
529 | virtual wxListWidgetColumn* InsertTextColumn( unsigned pos, const wxString& title, bool editable = false, | |
530 | wxAlignment just = wxALIGN_LEFT , int defaultWidth = -1) = 0 ; | |
531 | virtual wxListWidgetColumn* InsertCheckColumn( unsigned pos , const wxString& title, bool editable = false, | |
532 | wxAlignment just = wxALIGN_LEFT , int defaultWidth = -1) = 0 ; | |
533 | ||
534 | // add and remove | |
535 | ||
536 | // TODO will be replaced | |
537 | virtual void ListDelete( unsigned int n ) = 0; | |
538 | virtual void ListInsert( unsigned int n ) = 0; | |
539 | virtual void ListClear() = 0; | |
540 | ||
541 | // selecting | |
542 | ||
543 | virtual void ListDeselectAll() = 0; | |
544 | virtual void ListSetSelection( unsigned int n, bool select, bool multi ) = 0; | |
545 | virtual int ListGetSelection() const = 0; | |
546 | virtual int ListGetSelections( wxArrayInt& aSelections ) const = 0; | |
547 | virtual bool ListIsSelected( unsigned int n ) const = 0; | |
548 | ||
549 | // display | |
550 | ||
551 | virtual void ListScrollTo( unsigned int n ) = 0; | |
552 | virtual void UpdateLine( unsigned int n, wxListWidgetColumn* col = NULL ) = 0; | |
553 | virtual void UpdateLineToEnd( unsigned int n) = 0; | |
554 | ||
555 | // accessing content | |
556 | ||
557 | virtual unsigned int ListGetCount() const = 0; | |
558 | }; | |
559 | ||
560 | // | |
561 | // interface to be implemented by a textcontrol | |
562 | // | |
563 | ||
564 | class WXDLLIMPEXP_FWD_CORE wxTextAttr; | |
565 | ||
566 | // common interface for all implementations | |
567 | class WXDLLIMPEXP_CORE wxTextWidgetImpl | |
568 | ||
569 | { | |
570 | public : | |
571 | wxTextWidgetImpl() {} | |
572 | ||
573 | virtual ~wxTextWidgetImpl() {} | |
574 | ||
575 | virtual bool CanFocus() const { return true; } | |
576 | ||
577 | virtual wxString GetStringValue() const = 0 ; | |
578 | virtual void SetStringValue( const wxString &val ) = 0 ; | |
579 | virtual void SetSelection( long from, long to ) = 0 ; | |
580 | virtual void GetSelection( long* from, long* to ) const = 0 ; | |
581 | virtual void WriteText( const wxString& str ) = 0 ; | |
582 | ||
583 | virtual bool GetStyle( long position, wxTextAttr& style); | |
584 | virtual void SetStyle( long start, long end, const wxTextAttr& style ) ; | |
585 | virtual void Copy() ; | |
586 | virtual void Cut() ; | |
587 | virtual void Paste() ; | |
588 | virtual bool CanPaste() const ; | |
589 | virtual void SetEditable( bool editable ) ; | |
590 | virtual long GetLastPosition() const ; | |
591 | virtual void Replace( long from, long to, const wxString &str ) ; | |
592 | virtual void Remove( long from, long to ) ; | |
593 | ||
594 | ||
595 | virtual bool HasOwnContextMenu() const | |
596 | { return false ; } | |
597 | ||
598 | virtual bool SetupCursor( const wxPoint& WXUNUSED(pt) ) | |
599 | { return false ; } | |
600 | ||
601 | virtual void Clear() ; | |
602 | virtual bool CanUndo() const; | |
603 | virtual void Undo() ; | |
604 | virtual bool CanRedo() const; | |
605 | virtual void Redo() ; | |
606 | virtual int GetNumberOfLines() const ; | |
607 | virtual long XYToPosition(long x, long y) const; | |
608 | virtual bool PositionToXY(long pos, long *x, long *y) const ; | |
609 | virtual void ShowPosition(long WXUNUSED(pos)) ; | |
610 | virtual int GetLineLength(long lineNo) const ; | |
611 | virtual wxString GetLineText(long lineNo) const ; | |
612 | virtual void CheckSpelling(bool WXUNUSED(check)) { } | |
613 | ||
614 | virtual wxSize GetBestSize() const { return wxDefaultSize; } | |
615 | }; | |
616 | ||
617 | // common interface for all implementations | |
618 | class WXDLLIMPEXP_CORE wxComboWidgetImpl | |
619 | ||
620 | { | |
621 | public : | |
622 | wxComboWidgetImpl() {} | |
623 | ||
624 | virtual ~wxComboWidgetImpl() {} | |
625 | ||
626 | virtual int GetSelectedItem() const { return -1; }; | |
627 | virtual void SetSelectedItem(int WXUNUSED(item)) {}; | |
628 | ||
629 | virtual int GetNumberOfItems() const { return -1; }; | |
630 | ||
631 | virtual void InsertItem(int WXUNUSED(pos), const wxString& WXUNUSED(item)) {} | |
632 | ||
633 | virtual void RemoveItem(int WXUNUSED(pos)) {} | |
634 | ||
635 | virtual void Clear() {} | |
636 | ||
637 | virtual wxString GetStringAtIndex(int WXUNUSED(pos)) const { return wxEmptyString; } | |
638 | ||
639 | virtual int FindString(const wxString& WXUNUSED(text)) const { return -1; } | |
640 | }; | |
641 | ||
642 | // | |
643 | // common interface for buttons | |
644 | // | |
645 | ||
646 | class wxButtonImpl | |
647 | { | |
648 | public : | |
649 | wxButtonImpl(){} | |
650 | virtual ~wxButtonImpl(){} | |
651 | ||
652 | virtual void SetPressedBitmap( const wxBitmap& bitmap ) = 0; | |
653 | } ; | |
654 | ||
655 | // | |
656 | // common interface for search controls | |
657 | // | |
658 | ||
659 | class wxSearchWidgetImpl | |
660 | { | |
661 | public : | |
662 | wxSearchWidgetImpl(){} | |
663 | virtual ~wxSearchWidgetImpl(){} | |
664 | ||
665 | // search field options | |
666 | virtual void ShowSearchButton( bool show ) = 0; | |
667 | virtual bool IsSearchButtonVisible() const = 0; | |
668 | ||
669 | virtual void ShowCancelButton( bool show ) = 0; | |
670 | virtual bool IsCancelButtonVisible() const = 0; | |
671 | ||
672 | virtual void SetSearchMenu( wxMenu* menu ) = 0; | |
673 | ||
674 | virtual void SetDescriptiveText(const wxString& text) = 0; | |
675 | } ; | |
676 | ||
677 | // | |
678 | // toplevel window implementation class | |
679 | // | |
680 | ||
681 | class wxNonOwnedWindowImpl : public wxObject | |
682 | { | |
683 | public : | |
684 | wxNonOwnedWindowImpl( wxNonOwnedWindow* nonownedwnd) : m_wxPeer(nonownedwnd) | |
685 | { | |
686 | } | |
687 | wxNonOwnedWindowImpl() | |
688 | { | |
689 | } | |
690 | virtual ~wxNonOwnedWindowImpl() | |
691 | { | |
692 | } | |
693 | ||
694 | virtual void WillBeDestroyed() | |
695 | { | |
696 | } | |
697 | ||
698 | virtual void Create( wxWindow* parent, const wxPoint& pos, const wxSize& size, | |
699 | long style, long extraStyle, const wxString& name ) = 0; | |
700 | ||
701 | ||
702 | virtual WXWindow GetWXWindow() const = 0; | |
703 | ||
704 | virtual void Raise() | |
705 | { | |
706 | } | |
707 | ||
708 | virtual void Lower() | |
709 | { | |
710 | } | |
711 | ||
712 | virtual bool Show(bool WXUNUSED(show)) | |
713 | { | |
714 | return false; | |
715 | } | |
716 | ||
717 | virtual bool ShowWithEffect(bool show, wxShowEffect WXUNUSED(effect), unsigned WXUNUSED(timeout)) | |
718 | { | |
719 | return Show(show); | |
720 | } | |
721 | ||
722 | virtual void Update() | |
723 | { | |
724 | } | |
725 | ||
726 | virtual bool SetTransparent(wxByte WXUNUSED(alpha)) | |
727 | { | |
728 | return false; | |
729 | } | |
730 | ||
731 | virtual bool SetBackgroundColour(const wxColour& WXUNUSED(col) ) | |
732 | { | |
733 | return false; | |
734 | } | |
735 | ||
736 | virtual void SetExtraStyle( long WXUNUSED(exStyle) ) | |
737 | { | |
738 | } | |
739 | ||
740 | virtual void SetWindowStyleFlag( long WXUNUSED(style) ) | |
741 | { | |
742 | } | |
743 | ||
744 | virtual bool SetBackgroundStyle(wxBackgroundStyle WXUNUSED(style)) | |
745 | { | |
746 | return false ; | |
747 | } | |
748 | ||
749 | bool CanSetTransparent() | |
750 | { | |
751 | return false; | |
752 | } | |
753 | ||
754 | virtual void GetContentArea( int &left , int &top , int &width , int &height ) const = 0; | |
755 | virtual void MoveWindow(int x, int y, int width, int height) = 0; | |
756 | virtual void GetPosition( int &x, int &y ) const = 0; | |
757 | virtual void GetSize( int &width, int &height ) const = 0; | |
758 | ||
759 | virtual bool SetShape(const wxRegion& WXUNUSED(region)) | |
760 | { | |
761 | return false; | |
762 | } | |
763 | ||
764 | virtual void SetTitle( const wxString& title, wxFontEncoding encoding ) = 0; | |
765 | ||
766 | virtual bool IsMaximized() const = 0; | |
767 | ||
768 | virtual bool IsIconized() const= 0; | |
769 | ||
770 | virtual void Iconize( bool iconize )= 0; | |
771 | ||
772 | virtual void Maximize(bool maximize) = 0; | |
773 | ||
774 | virtual bool IsFullScreen() const= 0; | |
775 | ||
776 | virtual void ShowWithoutActivating() { Show(true); } | |
777 | ||
778 | virtual bool ShowFullScreen(bool show, long style)= 0; | |
779 | ||
780 | virtual void RequestUserAttention(int flags) = 0; | |
781 | ||
782 | virtual void ScreenToWindow( int *x, int *y ) = 0; | |
783 | ||
784 | virtual void WindowToScreen( int *x, int *y ) = 0; | |
785 | ||
786 | virtual bool IsActive() = 0; | |
787 | ||
788 | wxNonOwnedWindow* GetWXPeer() { return m_wxPeer; } | |
789 | ||
790 | // static creation methods, must be implemented by all toolkits | |
791 | ||
792 | static wxNonOwnedWindowImpl* CreateNonOwnedWindow( wxNonOwnedWindow* wxpeer, wxWindow* parent, const wxPoint& pos, const wxSize& size, | |
793 | long style, long extraStyle, const wxString& name ) ; | |
794 | ||
795 | virtual void SetModified(bool WXUNUSED(modified)) { } | |
796 | virtual bool IsModified() const { return false; } | |
797 | ||
798 | protected : | |
799 | wxNonOwnedWindow* m_wxPeer; | |
800 | DECLARE_ABSTRACT_CLASS(wxNonOwnedWindowImpl) | |
801 | }; | |
802 | ||
803 | #endif // wxUSE_GUI | |
804 | ||
805 | //--------------------------------------------------------------------------- | |
806 | // cocoa bridging utilities | |
807 | //--------------------------------------------------------------------------- | |
808 | ||
809 | bool wxMacInitCocoa(); | |
810 | ||
811 | class WXDLLIMPEXP_CORE wxMacAutoreleasePool | |
812 | { | |
813 | public : | |
814 | wxMacAutoreleasePool(); | |
815 | ~wxMacAutoreleasePool(); | |
816 | private : | |
817 | void* m_pool; | |
818 | }; | |
819 | ||
820 | // NSObject | |
821 | ||
822 | void wxMacCocoaRelease( void* obj ); | |
823 | void wxMacCocoaAutorelease( void* obj ); | |
824 | void* wxMacCocoaRetain( void* obj ); | |
825 | ||
826 | ||
827 | #endif | |
828 | // _WX_PRIVATE_CORE_H_ |