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