]>
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 | virtual bool SetBackgroundStyle(wxBackgroundStyle style) = 0; | |
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; | |
225 | virtual void SetControlSize( wxWindowVariant variant ) = 0; | |
226 | ||
227 | // native view coordinates are topleft to bottom right (flipped regarding CoreGraphics origin) | |
228 | virtual bool IsFlipped() const { return true; } | |
229 | ||
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 | ||
236 | virtual bool NeedsFrame() const; | |
237 | virtual void SetNeedsFrame( bool needs ); | |
238 | ||
239 | virtual bool CanFocus() const = 0; | |
240 | // return true if successful | |
241 | virtual bool SetFocus() = 0; | |
242 | virtual bool HasFocus() const = 0; | |
243 | ||
244 | virtual void RemoveFromParent() = 0; | |
245 | virtual void Embed( wxWidgetImpl *parent ) = 0; | |
246 | ||
247 | virtual void SetDefaultButton( bool isDefault ) = 0; | |
248 | virtual void PerformClick() = 0; | |
249 | virtual void SetLabel( const wxString& title, wxFontEncoding encoding ) = 0; | |
250 | ||
251 | virtual void SetCursor( const wxCursor & cursor ) = 0; | |
252 | virtual void CaptureMouse() = 0; | |
253 | virtual void ReleaseMouse() = 0; | |
254 | ||
255 | virtual wxInt32 GetValue() const = 0; | |
256 | virtual void SetValue( wxInt32 v ) = 0; | |
257 | virtual wxBitmap GetBitmap() const = 0; | |
258 | virtual void SetBitmap( const wxBitmap& bitmap ) = 0; | |
259 | virtual void SetBitmapPosition( wxDirection dir ) = 0; | |
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; | |
266 | virtual wxInt32 GetMinimum() const = 0; | |
267 | virtual wxInt32 GetMaximum() const = 0; | |
268 | virtual void PulseGauge() = 0; | |
269 | virtual void SetScrollThumb( wxInt32 value, wxInt32 thumbSize ) = 0; | |
270 | ||
271 | virtual void SetFont( const wxFont & font , const wxColour& foreground , long windowStyle, bool ignoreBlack = true ) = 0; | |
272 | ||
273 | virtual void SetToolTip(wxToolTip* WXUNUSED(tooltip)) { } | |
274 | ||
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; | |
278 | ||
279 | virtual void InstallEventHandler( WXWidget control = NULL ) = 0; | |
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; } | |
286 | ||
287 | // static methods for associating native controls and their implementations | |
288 | ||
289 | static wxWidgetImpl* | |
290 | FindFromWXWidget(WXWidget control); | |
291 | ||
292 | static void RemoveAssociations( wxWidgetImpl* impl); | |
293 | ||
294 | static void Associate( WXWidget control, wxWidgetImpl *impl ); | |
295 | ||
296 | static WXWidget FindFocus(); | |
297 | ||
298 | // static creation methods, must be implemented by all toolkits | |
299 | ||
300 | static wxWidgetImplType* CreateUserPane( wxWindowMac* wxpeer, | |
301 | wxWindowMac* parent, | |
302 | wxWindowID id, | |
303 | const wxPoint& pos, | |
304 | const wxSize& size, | |
305 | long style, | |
306 | long extraStyle) ; | |
307 | static wxWidgetImplType* CreateContentView( wxNonOwnedWindow* now ) ; | |
308 | ||
309 | static wxWidgetImplType* CreateButton( wxWindowMac* wxpeer, | |
310 | wxWindowMac* parent, | |
311 | wxWindowID id, | |
312 | const wxString& label, | |
313 | const wxPoint& pos, | |
314 | const wxSize& size, | |
315 | long style, | |
316 | long extraStyle) ; | |
317 | ||
318 | static wxWidgetImplType* CreateDisclosureTriangle( wxWindowMac* wxpeer, | |
319 | wxWindowMac* parent, | |
320 | wxWindowID id, | |
321 | const wxString& label, | |
322 | const wxPoint& pos, | |
323 | const wxSize& size, | |
324 | long style, | |
325 | long extraStyle) ; | |
326 | ||
327 | static wxWidgetImplType* CreateStaticLine( wxWindowMac* wxpeer, | |
328 | wxWindowMac* parent, | |
329 | wxWindowID id, | |
330 | const wxPoint& pos, | |
331 | const wxSize& size, | |
332 | long style, | |
333 | long extraStyle) ; | |
334 | ||
335 | static wxWidgetImplType* CreateGroupBox( wxWindowMac* wxpeer, | |
336 | wxWindowMac* parent, | |
337 | wxWindowID id, | |
338 | const wxString& label, | |
339 | const wxPoint& pos, | |
340 | const wxSize& size, | |
341 | long style, | |
342 | long extraStyle) ; | |
343 | ||
344 | static wxWidgetImplType* CreateStaticText( wxWindowMac* wxpeer, | |
345 | wxWindowMac* parent, | |
346 | wxWindowID id, | |
347 | const wxString& label, | |
348 | const wxPoint& pos, | |
349 | const wxSize& size, | |
350 | long style, | |
351 | long extraStyle) ; | |
352 | ||
353 | static wxWidgetImplType* CreateTextControl( wxTextCtrl* wxpeer, | |
354 | wxWindowMac* parent, | |
355 | wxWindowID id, | |
356 | const wxString& content, | |
357 | const wxPoint& pos, | |
358 | const wxSize& size, | |
359 | long style, | |
360 | long extraStyle) ; | |
361 | ||
362 | static wxWidgetImplType* CreateSearchControl( wxTextCtrl* wxpeer, | |
363 | wxWindowMac* parent, | |
364 | wxWindowID id, | |
365 | const wxString& content, | |
366 | const wxPoint& pos, | |
367 | const wxSize& size, | |
368 | long style, | |
369 | long extraStyle) ; | |
370 | ||
371 | static wxWidgetImplType* CreateCheckBox( wxWindowMac* wxpeer, | |
372 | wxWindowMac* parent, | |
373 | wxWindowID id, | |
374 | const wxString& label, | |
375 | const wxPoint& pos, | |
376 | const wxSize& size, | |
377 | long style, | |
378 | long extraStyle); | |
379 | ||
380 | static wxWidgetImplType* CreateRadioButton( wxWindowMac* wxpeer, | |
381 | wxWindowMac* parent, | |
382 | wxWindowID id, | |
383 | const wxString& label, | |
384 | const wxPoint& pos, | |
385 | const wxSize& size, | |
386 | long style, | |
387 | long extraStyle); | |
388 | ||
389 | static wxWidgetImplType* CreateToggleButton( wxWindowMac* wxpeer, | |
390 | wxWindowMac* parent, | |
391 | wxWindowID id, | |
392 | const wxString& label, | |
393 | const wxPoint& pos, | |
394 | const wxSize& size, | |
395 | long style, | |
396 | long extraStyle); | |
397 | ||
398 | static wxWidgetImplType* CreateBitmapToggleButton( wxWindowMac* wxpeer, | |
399 | wxWindowMac* parent, | |
400 | wxWindowID id, | |
401 | const wxBitmap& bitmap, | |
402 | const wxPoint& pos, | |
403 | const wxSize& size, | |
404 | long style, | |
405 | long extraStyle); | |
406 | ||
407 | static wxWidgetImplType* CreateBitmapButton( wxWindowMac* wxpeer, | |
408 | wxWindowMac* parent, | |
409 | wxWindowID id, | |
410 | const wxBitmap& bitmap, | |
411 | const wxPoint& pos, | |
412 | const wxSize& size, | |
413 | long style, | |
414 | long extraStyle); | |
415 | ||
416 | static wxWidgetImplType* CreateTabView( wxWindowMac* wxpeer, | |
417 | wxWindowMac* parent, | |
418 | wxWindowID id, | |
419 | const wxPoint& pos, | |
420 | const wxSize& size, | |
421 | long style, | |
422 | long extraStyle); | |
423 | ||
424 | static wxWidgetImplType* CreateGauge( wxWindowMac* wxpeer, | |
425 | wxWindowMac* parent, | |
426 | wxWindowID id, | |
427 | wxInt32 value, | |
428 | wxInt32 minimum, | |
429 | wxInt32 maximum, | |
430 | const wxPoint& pos, | |
431 | const wxSize& size, | |
432 | long style, | |
433 | long extraStyle); | |
434 | ||
435 | static wxWidgetImplType* CreateSlider( wxWindowMac* wxpeer, | |
436 | wxWindowMac* parent, | |
437 | wxWindowID id, | |
438 | wxInt32 value, | |
439 | wxInt32 minimum, | |
440 | wxInt32 maximum, | |
441 | const wxPoint& pos, | |
442 | const wxSize& size, | |
443 | long style, | |
444 | long extraStyle); | |
445 | ||
446 | static wxWidgetImplType* CreateSpinButton( wxWindowMac* wxpeer, | |
447 | wxWindowMac* parent, | |
448 | wxWindowID id, | |
449 | wxInt32 value, | |
450 | wxInt32 minimum, | |
451 | wxInt32 maximum, | |
452 | const wxPoint& pos, | |
453 | const wxSize& size, | |
454 | long style, | |
455 | long extraStyle); | |
456 | ||
457 | static wxWidgetImplType* CreateScrollBar( wxWindowMac* wxpeer, | |
458 | wxWindowMac* parent, | |
459 | wxWindowID id, | |
460 | const wxPoint& pos, | |
461 | const wxSize& size, | |
462 | long style, | |
463 | long extraStyle); | |
464 | ||
465 | static wxWidgetImplType* CreateChoice( wxWindowMac* wxpeer, | |
466 | wxWindowMac* parent, | |
467 | wxWindowID id, | |
468 | wxMenu* menu, | |
469 | const wxPoint& pos, | |
470 | const wxSize& size, | |
471 | long style, | |
472 | long extraStyle); | |
473 | ||
474 | static wxWidgetImplType* CreateListBox( wxWindowMac* wxpeer, | |
475 | wxWindowMac* parent, | |
476 | wxWindowID id, | |
477 | const wxPoint& pos, | |
478 | const wxSize& size, | |
479 | long style, | |
480 | long extraStyle); | |
481 | ||
482 | #if wxOSX_USE_COCOA | |
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 | ||
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; | |
499 | bool m_needsFrame; | |
500 | bool m_shouldSendEvents; | |
501 | ||
502 | DECLARE_ABSTRACT_CLASS(wxWidgetImpl) | |
503 | }; | |
504 | ||
505 | // | |
506 | // the interface to be implemented eg by a listbox | |
507 | // | |
508 | ||
509 | class WXDLLIMPEXP_CORE wxListWidgetColumn | |
510 | { | |
511 | public : | |
512 | virtual ~wxListWidgetColumn() {} | |
513 | } ; | |
514 | ||
515 | class WXDLLIMPEXP_CORE wxListWidgetCellValue | |
516 | { | |
517 | public : | |
518 | wxListWidgetCellValue() {} | |
519 | virtual ~wxListWidgetCellValue() {} | |
520 | ||
521 | virtual void Set( CFStringRef value ) = 0; | |
522 | virtual void Set( const wxString& value ) = 0; | |
523 | virtual void Set( int value ) = 0; | |
524 | virtual void Check( bool check ); | |
525 | ||
526 | virtual bool IsChecked() const; | |
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() { } | |
536 | ||
537 | virtual wxListWidgetColumn* InsertTextColumn( unsigned pos, const wxString& title, bool editable = false, | |
538 | wxAlignment just = wxALIGN_LEFT , int defaultWidth = -1) = 0 ; | |
539 | virtual wxListWidgetColumn* InsertCheckColumn( unsigned pos , const wxString& title, bool editable = false, | |
540 | wxAlignment just = wxALIGN_LEFT , int defaultWidth = -1) = 0 ; | |
541 | ||
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; | |
556 | ||
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; | |
566 | }; | |
567 | ||
568 | // | |
569 | // interface to be implemented by a textcontrol | |
570 | // | |
571 | ||
572 | class WXDLLIMPEXP_FWD_CORE wxTextAttr; | |
573 | ||
574 | // common interface for all implementations | |
575 | class WXDLLIMPEXP_CORE wxTextWidgetImpl | |
576 | ||
577 | { | |
578 | public : | |
579 | wxTextWidgetImpl() {} | |
580 | ||
581 | virtual ~wxTextWidgetImpl() {} | |
582 | ||
583 | virtual bool CanFocus() const { return true; } | |
584 | ||
585 | virtual wxString GetStringValue() const = 0 ; | |
586 | virtual void SetStringValue( const wxString &val ) = 0 ; | |
587 | virtual void SetSelection( long from, long to ) = 0 ; | |
588 | virtual void GetSelection( long* from, long* to ) const = 0 ; | |
589 | virtual void WriteText( const wxString& str ) = 0 ; | |
590 | ||
591 | virtual bool GetStyle( long position, wxTextAttr& style); | |
592 | virtual void SetStyle( long start, long end, const wxTextAttr& style ) ; | |
593 | virtual void Copy() ; | |
594 | virtual void Cut() ; | |
595 | virtual void Paste() ; | |
596 | virtual bool CanPaste() const ; | |
597 | virtual void SetEditable( bool editable ) ; | |
598 | virtual long GetLastPosition() const ; | |
599 | virtual void Replace( long from, long to, const wxString &str ) ; | |
600 | virtual void Remove( long from, long to ) ; | |
601 | ||
602 | ||
603 | virtual bool HasOwnContextMenu() const | |
604 | { return false ; } | |
605 | ||
606 | virtual bool SetupCursor( const wxPoint& WXUNUSED(pt) ) | |
607 | { return false ; } | |
608 | ||
609 | virtual void Clear() ; | |
610 | virtual bool CanUndo() const; | |
611 | virtual void Undo() ; | |
612 | virtual bool CanRedo() const; | |
613 | virtual void Redo() ; | |
614 | virtual int GetNumberOfLines() const ; | |
615 | virtual long XYToPosition(long x, long y) const; | |
616 | virtual bool PositionToXY(long pos, long *x, long *y) const ; | |
617 | virtual void ShowPosition(long WXUNUSED(pos)) ; | |
618 | virtual int GetLineLength(long lineNo) const ; | |
619 | virtual wxString GetLineText(long lineNo) const ; | |
620 | virtual void CheckSpelling(bool WXUNUSED(check)) { } | |
621 | ||
622 | virtual wxSize GetBestSize() const { return wxDefaultSize; } | |
623 | }; | |
624 | ||
625 | // common interface for all implementations | |
626 | class WXDLLIMPEXP_CORE wxComboWidgetImpl | |
627 | ||
628 | { | |
629 | public : | |
630 | wxComboWidgetImpl() {} | |
631 | ||
632 | virtual ~wxComboWidgetImpl() {} | |
633 | ||
634 | virtual int GetSelectedItem() const { return -1; }; | |
635 | virtual void SetSelectedItem(int WXUNUSED(item)) {}; | |
636 | ||
637 | virtual int GetNumberOfItems() const { return -1; }; | |
638 | ||
639 | virtual void InsertItem(int WXUNUSED(pos), const wxString& WXUNUSED(item)) {} | |
640 | ||
641 | virtual void RemoveItem(int WXUNUSED(pos)) {} | |
642 | ||
643 | virtual void Clear() {} | |
644 | ||
645 | virtual wxString GetStringAtIndex(int WXUNUSED(pos)) const { return wxEmptyString; } | |
646 | ||
647 | virtual int FindString(const wxString& WXUNUSED(text)) const { return -1; } | |
648 | }; | |
649 | ||
650 | // | |
651 | // common interface for buttons | |
652 | // | |
653 | ||
654 | class wxButtonImpl | |
655 | { | |
656 | public : | |
657 | wxButtonImpl(){} | |
658 | virtual ~wxButtonImpl(){} | |
659 | ||
660 | virtual void SetPressedBitmap( const wxBitmap& bitmap ) = 0; | |
661 | } ; | |
662 | ||
663 | // | |
664 | // common interface for search controls | |
665 | // | |
666 | ||
667 | class wxSearchWidgetImpl | |
668 | { | |
669 | public : | |
670 | wxSearchWidgetImpl(){} | |
671 | virtual ~wxSearchWidgetImpl(){} | |
672 | ||
673 | // search field options | |
674 | virtual void ShowSearchButton( bool show ) = 0; | |
675 | virtual bool IsSearchButtonVisible() const = 0; | |
676 | ||
677 | virtual void ShowCancelButton( bool show ) = 0; | |
678 | virtual bool IsCancelButtonVisible() const = 0; | |
679 | ||
680 | virtual void SetSearchMenu( wxMenu* menu ) = 0; | |
681 | ||
682 | virtual void SetDescriptiveText(const wxString& text) = 0; | |
683 | } ; | |
684 | ||
685 | // | |
686 | // toplevel window implementation class | |
687 | // | |
688 | ||
689 | class wxNonOwnedWindowImpl : public wxObject | |
690 | { | |
691 | public : | |
692 | wxNonOwnedWindowImpl( wxNonOwnedWindow* nonownedwnd) : m_wxPeer(nonownedwnd) | |
693 | { | |
694 | } | |
695 | wxNonOwnedWindowImpl() | |
696 | { | |
697 | } | |
698 | virtual ~wxNonOwnedWindowImpl() | |
699 | { | |
700 | } | |
701 | ||
702 | virtual void WillBeDestroyed() | |
703 | { | |
704 | } | |
705 | ||
706 | virtual void Create( wxWindow* parent, const wxPoint& pos, const wxSize& size, | |
707 | long style, long extraStyle, const wxString& name ) = 0; | |
708 | ||
709 | ||
710 | virtual WXWindow GetWXWindow() const = 0; | |
711 | ||
712 | virtual void Raise() | |
713 | { | |
714 | } | |
715 | ||
716 | virtual void Lower() | |
717 | { | |
718 | } | |
719 | ||
720 | virtual bool Show(bool WXUNUSED(show)) | |
721 | { | |
722 | return false; | |
723 | } | |
724 | ||
725 | virtual bool ShowWithEffect(bool show, wxShowEffect WXUNUSED(effect), unsigned WXUNUSED(timeout)) | |
726 | { | |
727 | return Show(show); | |
728 | } | |
729 | ||
730 | virtual void Update() | |
731 | { | |
732 | } | |
733 | ||
734 | virtual bool SetTransparent(wxByte WXUNUSED(alpha)) | |
735 | { | |
736 | return false; | |
737 | } | |
738 | ||
739 | virtual bool SetBackgroundColour(const wxColour& WXUNUSED(col) ) | |
740 | { | |
741 | return false; | |
742 | } | |
743 | ||
744 | virtual void SetExtraStyle( long WXUNUSED(exStyle) ) | |
745 | { | |
746 | } | |
747 | ||
748 | virtual void SetWindowStyleFlag( long WXUNUSED(style) ) | |
749 | { | |
750 | } | |
751 | ||
752 | virtual bool SetBackgroundStyle(wxBackgroundStyle WXUNUSED(style)) | |
753 | { | |
754 | return false ; | |
755 | } | |
756 | ||
757 | bool CanSetTransparent() | |
758 | { | |
759 | return false; | |
760 | } | |
761 | ||
762 | virtual void GetContentArea( int &left , int &top , int &width , int &height ) const = 0; | |
763 | virtual void MoveWindow(int x, int y, int width, int height) = 0; | |
764 | virtual void GetPosition( int &x, int &y ) const = 0; | |
765 | virtual void GetSize( int &width, int &height ) const = 0; | |
766 | ||
767 | virtual bool SetShape(const wxRegion& WXUNUSED(region)) | |
768 | { | |
769 | return false; | |
770 | } | |
771 | ||
772 | virtual void SetTitle( const wxString& title, wxFontEncoding encoding ) = 0; | |
773 | ||
774 | virtual bool IsMaximized() const = 0; | |
775 | ||
776 | virtual bool IsIconized() const= 0; | |
777 | ||
778 | virtual void Iconize( bool iconize )= 0; | |
779 | ||
780 | virtual void Maximize(bool maximize) = 0; | |
781 | ||
782 | virtual bool IsFullScreen() const= 0; | |
783 | ||
784 | virtual void ShowWithoutActivating() { Show(true); } | |
785 | ||
786 | virtual bool ShowFullScreen(bool show, long style)= 0; | |
787 | ||
788 | virtual void RequestUserAttention(int flags) = 0; | |
789 | ||
790 | virtual void ScreenToWindow( int *x, int *y ) = 0; | |
791 | ||
792 | virtual void WindowToScreen( int *x, int *y ) = 0; | |
793 | ||
794 | virtual bool IsActive() = 0; | |
795 | ||
796 | wxNonOwnedWindow* GetWXPeer() { return m_wxPeer; } | |
797 | ||
798 | static wxNonOwnedWindowImpl* | |
799 | FindFromWXWindow(WXWindow window); | |
800 | ||
801 | static void RemoveAssociations( wxNonOwnedWindowImpl* impl); | |
802 | ||
803 | static void Associate( WXWindow window, wxNonOwnedWindowImpl *impl ); | |
804 | ||
805 | // static creation methods, must be implemented by all toolkits | |
806 | ||
807 | static wxNonOwnedWindowImpl* CreateNonOwnedWindow( wxNonOwnedWindow* wxpeer, wxWindow* parent, WXWindow native) ; | |
808 | ||
809 | static wxNonOwnedWindowImpl* CreateNonOwnedWindow( wxNonOwnedWindow* wxpeer, wxWindow* parent, const wxPoint& pos, const wxSize& size, | |
810 | long style, long extraStyle, const wxString& name ) ; | |
811 | ||
812 | virtual void SetModified(bool WXUNUSED(modified)) { } | |
813 | virtual bool IsModified() const { return false; } | |
814 | ||
815 | protected : | |
816 | wxNonOwnedWindow* m_wxPeer; | |
817 | DECLARE_ABSTRACT_CLASS(wxNonOwnedWindowImpl) | |
818 | }; | |
819 | ||
820 | #endif // wxUSE_GUI | |
821 | ||
822 | //--------------------------------------------------------------------------- | |
823 | // cocoa bridging utilities | |
824 | //--------------------------------------------------------------------------- | |
825 | ||
826 | bool wxMacInitCocoa(); | |
827 | ||
828 | class WXDLLIMPEXP_CORE wxMacAutoreleasePool | |
829 | { | |
830 | public : | |
831 | wxMacAutoreleasePool(); | |
832 | ~wxMacAutoreleasePool(); | |
833 | private : | |
834 | void* m_pool; | |
835 | }; | |
836 | ||
837 | // NSObject | |
838 | ||
839 | void wxMacCocoaRelease( void* obj ); | |
840 | void wxMacCocoaAutorelease( void* obj ); | |
841 | void* wxMacCocoaRetain( void* obj ); | |
842 | ||
843 | ||
844 | #endif | |
845 | // _WX_PRIVATE_CORE_H_ |