]> git.saurik.com Git - wxWidgets.git/blame - include/wx/osx/core/private.h
Fixed auto-resizing behavior when double-clicking a splitter; Added wxPropertyGrid...
[wxWidgets.git] / include / wx / osx / core / private.h
CommitLineData
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 37WXDLLIMPEXP_BASE long UMAGetSystemVersion() ;
1e181c7a
SC
38
39void WXDLLIMPEXP_CORE wxMacStringToPascal( const wxString&from , unsigned char * to );
40wxString 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
55class WXDLLIMPEXP_CORE wxMacCGContextStateSaver
56{
c0c133e1 57 wxDECLARE_NO_COPY_CLASS(wxMacCGContextStateSaver);
5c6eb3a8
SC
58
59public:
60 wxMacCGContextStateSaver( CGContextRef cg )
61 {
62 m_cg = cg;
63 CGContextSaveGState( cg );
64 }
65 ~wxMacCGContextStateSaver()
66 {
67 CGContextRestoreGState( m_cg );
68 }
69private:
70 CGContextRef m_cg;
71};
72
eefe52da
SC
73class WXDLLIMPEXP_CORE wxDeferredObjectDeleter : public wxObject
74{
75public :
03647350 76 wxDeferredObjectDeleter( wxObject* obj ) : m_obj(obj)
eefe52da
SC
77 {
78 }
79 virtual ~wxDeferredObjectDeleter()
80 {
81 delete m_obj;
82 }
83protected :
84 wxObject* m_obj ;
85} ;
5c6eb3a8
SC
86
87// Quartz
88
89WXDLLIMPEXP_CORE CGImageRef wxMacCreateCGImageFromBitmap( const wxBitmap& bitmap );
90
91WXDLLIMPEXP_CORE CGDataProviderRef wxMacCGDataProviderCreateWithCFData( CFDataRef data );
92WXDLLIMPEXP_CORE CGDataConsumerRef wxMacCGDataConsumerCreateWithCFData( CFMutableDataRef data );
93WXDLLIMPEXP_CORE CGDataProviderRef wxMacCGDataProviderCreateWithMemoryBuffer( const wxMemoryBuffer& buf );
94
95CGColorSpaceRef WXDLLIMPEXP_CORE wxMacGetGenericRGBColorSpace(void);
96
eefe52da
SC
97class wxWindowMac;
98// to
99extern wxWindow* g_MacLastWindow;
100class wxNonOwnedWindow;
101
524c47aa
SC
102// temporary typedef so that no additional casts are necessary within carbon code at the moment
103
104class wxMacControl;
105class wxWidgetImpl;
106class wxNotebook;
de24bdf2 107class wxTextCtrl;
524c47aa 108
8fa9ac5e
SC
109WXDLLIMPEXP_CORE wxWindowMac * wxFindWindowFromWXWidget(WXWidget inControl );
110
524c47aa
SC
111#if wxOSX_USE_CARBON
112typedef wxMacControl wxWidgetImplType;
113#else
114typedef wxWidgetImpl wxWidgetImplType;
115#endif
116
6c1f25cc 117#if wxUSE_MENUS
03647350 118class wxMenuItemImpl : public wxObject
524c47aa
SC
119{
120public :
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
144protected :
145 wxMenuItem* m_peer;
03647350 146
69cc4323 147 DECLARE_ABSTRACT_CLASS(wxMenuItemImpl)
524c47aa
SC
148} ;
149
03647350 150class wxMenuImpl : public wxObject
524c47aa
SC
151{
152public :
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 );
173protected :
174 wxMenu* m_peer;
03647350 175
69cc4323 176 DECLARE_ABSTRACT_CLASS(wxMenuItemImpl)
524c47aa 177} ;
6c1f25cc 178#endif
524c47aa
SC
179
180
eefe52da
SC
181class WXDLLIMPEXP_CORE wxWidgetImpl : public wxObject
182{
183public :
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 &notebook ) =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 270 virtual void SetFont( const wxFont & font , const wxColour& foreground , long windowStyle, bool ignoreBlack = true ) = 0;
a7b9865d
KO
271
272 virtual void SetToolTip(wxToolTip* WXUNUSED(tooltip)) { }
1e181c7a 273
524c47aa
SC
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;
03647350 277
c4825ef7 278 virtual void InstallEventHandler( WXWidget control = NULL ) = 0;
eefe52da 279
f55d9f74
SC
280 // static methods for associating native controls and their implementations
281
03647350 282 static wxWidgetImpl*
f55d9f74 283 FindFromWXWidget(WXWidget control);
03647350 284
f55d9f74 285 static void RemoveAssociations( wxWidgetImpl* impl);
03647350 286
f55d9f74 287 static void Associate( WXWidget control, wxWidgetImpl *impl );
03647350 288
f06e0fea 289 static WXWidget FindFocus();
03647350 290
eefe52da 291 // static creation methods, must be implemented by all toolkits
03647350
VZ
292
293 static wxWidgetImplType* CreateUserPane( wxWindowMac* wxpeer,
294 wxWindowMac* parent,
295 wxWindowID id,
296 const wxPoint& pos,
524c47aa 297 const wxSize& size,
03647350 298 long style,
524c47aa
SC
299 long extraStyle) ;
300 static wxWidgetImplType* CreateContentView( wxNonOwnedWindow* now ) ;
301
03647350
VZ
302 static wxWidgetImplType* CreateButton( wxWindowMac* wxpeer,
303 wxWindowMac* parent,
304 wxWindowID id,
524c47aa 305 const wxString& label,
03647350 306 const wxPoint& pos,
524c47aa 307 const wxSize& size,
03647350 308 long style,
524c47aa
SC
309 long extraStyle) ;
310
03647350
VZ
311 static wxWidgetImplType* CreateDisclosureTriangle( wxWindowMac* wxpeer,
312 wxWindowMac* parent,
313 wxWindowID id,
524c47aa 314 const wxString& label,
03647350 315 const wxPoint& pos,
524c47aa 316 const wxSize& size,
03647350 317 long style,
524c47aa 318 long extraStyle) ;
03647350
VZ
319
320 static wxWidgetImplType* CreateStaticLine( wxWindowMac* wxpeer,
321 wxWindowMac* parent,
322 wxWindowID id,
323 const wxPoint& pos,
524c47aa 324 const wxSize& size,
03647350 325 long style,
524c47aa
SC
326 long extraStyle) ;
327
03647350
VZ
328 static wxWidgetImplType* CreateGroupBox( wxWindowMac* wxpeer,
329 wxWindowMac* parent,
330 wxWindowID id,
524c47aa 331 const wxString& label,
03647350 332 const wxPoint& pos,
524c47aa 333 const wxSize& size,
03647350 334 long style,
524c47aa
SC
335 long extraStyle) ;
336
03647350
VZ
337 static wxWidgetImplType* CreateStaticText( wxWindowMac* wxpeer,
338 wxWindowMac* parent,
339 wxWindowID id,
524c47aa 340 const wxString& label,
03647350 341 const wxPoint& pos,
524c47aa 342 const wxSize& size,
03647350 343 long style,
524c47aa
SC
344 long extraStyle) ;
345
03647350
VZ
346 static wxWidgetImplType* CreateTextControl( wxTextCtrl* wxpeer,
347 wxWindowMac* parent,
348 wxWindowID id,
524c47aa 349 const wxString& content,
03647350 350 const wxPoint& pos,
524c47aa 351 const wxSize& size,
03647350 352 long style,
524c47aa
SC
353 long extraStyle) ;
354
03647350
VZ
355 static wxWidgetImplType* CreateSearchControl( wxTextCtrl* wxpeer,
356 wxWindowMac* parent,
357 wxWindowID id,
1e181c7a 358 const wxString& content,
03647350 359 const wxPoint& pos,
1e181c7a 360 const wxSize& size,
03647350 361 long style,
1e181c7a
SC
362 long extraStyle) ;
363
03647350
VZ
364 static wxWidgetImplType* CreateCheckBox( wxWindowMac* wxpeer,
365 wxWindowMac* parent,
366 wxWindowID id,
524c47aa 367 const wxString& label,
03647350 368 const wxPoint& pos,
524c47aa 369 const wxSize& size,
03647350 370 long style,
524c47aa 371 long extraStyle);
03647350
VZ
372
373 static wxWidgetImplType* CreateRadioButton( wxWindowMac* wxpeer,
374 wxWindowMac* parent,
375 wxWindowID id,
524c47aa 376 const wxString& label,
03647350 377 const wxPoint& pos,
524c47aa 378 const wxSize& size,
03647350 379 long style,
524c47aa
SC
380 long extraStyle);
381
03647350
VZ
382 static wxWidgetImplType* CreateToggleButton( wxWindowMac* wxpeer,
383 wxWindowMac* parent,
384 wxWindowID id,
524c47aa 385 const wxString& label,
03647350 386 const wxPoint& pos,
524c47aa 387 const wxSize& size,
03647350 388 long style,
524c47aa
SC
389 long extraStyle);
390
03647350
VZ
391 static wxWidgetImplType* CreateBitmapToggleButton( wxWindowMac* wxpeer,
392 wxWindowMac* parent,
393 wxWindowID id,
524c47aa 394 const wxBitmap& bitmap,
03647350 395 const wxPoint& pos,
524c47aa 396 const wxSize& size,
03647350 397 long style,
524c47aa
SC
398 long extraStyle);
399
03647350
VZ
400 static wxWidgetImplType* CreateBitmapButton( wxWindowMac* wxpeer,
401 wxWindowMac* parent,
402 wxWindowID id,
524c47aa 403 const wxBitmap& bitmap,
03647350 404 const wxPoint& pos,
524c47aa 405 const wxSize& size,
03647350 406 long style,
524c47aa
SC
407 long extraStyle);
408
03647350
VZ
409 static wxWidgetImplType* CreateTabView( wxWindowMac* wxpeer,
410 wxWindowMac* parent,
411 wxWindowID id,
412 const wxPoint& pos,
524c47aa 413 const wxSize& size,
03647350 414 long style,
524c47aa
SC
415 long extraStyle);
416
03647350
VZ
417 static wxWidgetImplType* CreateGauge( wxWindowMac* wxpeer,
418 wxWindowMac* parent,
419 wxWindowID id,
524c47aa
SC
420 wxInt32 value,
421 wxInt32 minimum,
422 wxInt32 maximum,
03647350 423 const wxPoint& pos,
524c47aa 424 const wxSize& size,
03647350 425 long style,
524c47aa
SC
426 long extraStyle);
427
03647350
VZ
428 static wxWidgetImplType* CreateSlider( wxWindowMac* wxpeer,
429 wxWindowMac* parent,
430 wxWindowID id,
524c47aa
SC
431 wxInt32 value,
432 wxInt32 minimum,
433 wxInt32 maximum,
03647350 434 const wxPoint& pos,
524c47aa 435 const wxSize& size,
03647350 436 long style,
524c47aa
SC
437 long extraStyle);
438
03647350
VZ
439 static wxWidgetImplType* CreateSpinButton( wxWindowMac* wxpeer,
440 wxWindowMac* parent,
441 wxWindowID id,
524c47aa
SC
442 wxInt32 value,
443 wxInt32 minimum,
444 wxInt32 maximum,
03647350 445 const wxPoint& pos,
524c47aa 446 const wxSize& size,
03647350 447 long style,
524c47aa
SC
448 long extraStyle);
449
03647350
VZ
450 static wxWidgetImplType* CreateScrollBar( wxWindowMac* wxpeer,
451 wxWindowMac* parent,
452 wxWindowID id,
453 const wxPoint& pos,
524c47aa 454 const wxSize& size,
03647350 455 long style,
524c47aa
SC
456 long extraStyle);
457
03647350
VZ
458 static wxWidgetImplType* CreateChoice( wxWindowMac* wxpeer,
459 wxWindowMac* parent,
460 wxWindowID id,
524c47aa 461 wxMenu* menu,
03647350 462 const wxPoint& pos,
524c47aa 463 const wxSize& size,
03647350 464 long style,
524c47aa
SC
465 long extraStyle);
466
03647350
VZ
467 static wxWidgetImplType* CreateListBox( wxWindowMac* wxpeer,
468 wxWindowMac* parent,
469 wxWindowID id,
470 const wxPoint& pos,
524c47aa 471 const wxSize& size,
03647350 472 long style,
524c47aa 473 long extraStyle);
eefe52da 474
c84030e0 475#if wxOSX_USE_COCOA
f941a30b
KO
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
eefe52da
SC
486 // converts from Toplevel-Content relative to local
487 static void Convert( wxPoint *pt , wxWidgetImpl *from , wxWidgetImpl *to );
488protected :
489 bool m_isRootControl;
490 wxWindowMac* m_wxPeer;
491 bool m_needsFocusRect;
f2f6030e 492 bool m_needsFrame;
eefe52da
SC
493
494 DECLARE_ABSTRACT_CLASS(wxWidgetImpl)
495};
496
524c47aa
SC
497//
498// the interface to be implemented eg by a listbox
499//
500
03647350 501class WXDLLIMPEXP_CORE wxListWidgetColumn
524c47aa
SC
502{
503public :
504 virtual ~wxListWidgetColumn() {}
505} ;
506
507class WXDLLIMPEXP_CORE wxListWidgetCellValue
508{
509public :
510 wxListWidgetCellValue() {}
511 virtual ~wxListWidgetCellValue() {}
03647350 512
524c47aa
SC
513 virtual void Set( CFStringRef value ) = 0;
514 virtual void Set( const wxString& value ) = 0;
515 virtual void Set( int value ) = 0;
60ebcb8a 516 virtual void Check( bool check );
03647350 517
60ebcb8a 518 virtual bool IsChecked() const;
524c47aa
SC
519 virtual int GetIntValue() const = 0;
520 virtual wxString GetStringValue() const = 0;
521} ;
522
523class WXDLLIMPEXP_CORE wxListWidgetImpl
524{
525public:
526 wxListWidgetImpl() {}
527 virtual ~wxListWidgetImpl() { }
03647350
VZ
528
529 virtual wxListWidgetColumn* InsertTextColumn( unsigned pos, const wxString& title, bool editable = false,
524c47aa 530 wxAlignment just = wxALIGN_LEFT , int defaultWidth = -1) = 0 ;
03647350 531 virtual wxListWidgetColumn* InsertCheckColumn( unsigned pos , const wxString& title, bool editable = false,
524c47aa 532 wxAlignment just = wxALIGN_LEFT , int defaultWidth = -1) = 0 ;
03647350 533
524c47aa
SC
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;
03647350 548
524c47aa
SC
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
1e181c7a
SC
560//
561// interface to be implemented by a textcontrol
562//
563
21a9d326
SC
564class WXDLLIMPEXP_FWD_CORE wxTextAttr;
565
1e181c7a
SC
566// common interface for all implementations
567class WXDLLIMPEXP_CORE wxTextWidgetImpl
568
569{
570public :
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
16671f22 583 virtual bool GetStyle( long position, wxTextAttr& style);
1e181c7a
SC
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 ) ;
0b6a49c2 590 virtual long GetLastPosition() const ;
1e181c7a
SC
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)) { }
9ab7ff53
KO
613
614 virtual wxSize GetBestSize() const { return wxDefaultSize; }
1e181c7a
SC
615};
616
c84030e0
KO
617// common interface for all implementations
618class WXDLLIMPEXP_CORE wxComboWidgetImpl
619
620{
621public :
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
411a1c35 642//
b38dc31f 643// common interface for buttons
411a1c35
SC
644//
645
b38dc31f 646class wxButtonImpl
411a1c35
SC
647{
648 public :
b38dc31f
SC
649 wxButtonImpl(){}
650 virtual ~wxButtonImpl(){}
411a1c35
SC
651
652 virtual void SetPressedBitmap( const wxBitmap& bitmap ) = 0;
653} ;
654
1e181c7a
SC
655//
656// common interface for search controls
657//
658
659class wxSearchWidgetImpl
660{
661public :
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
524c47aa
SC
677//
678// toplevel window implementation class
679//
680
eefe52da
SC
681class wxNonOwnedWindowImpl : public wxObject
682{
683public :
684 wxNonOwnedWindowImpl( wxNonOwnedWindow* nonownedwnd) : m_wxPeer(nonownedwnd)
685 {
686 }
687 wxNonOwnedWindowImpl()
688 {
689 }
690 virtual ~wxNonOwnedWindowImpl()
691 {
692 }
03647350 693
0aaa6ace 694 virtual void WillBeDestroyed()
eefe52da
SC
695 {
696 }
697
698 virtual void Create( wxWindow* parent, const wxPoint& pos, const wxSize& size,
699 long style, long extraStyle, const wxString& name ) = 0;
03647350
VZ
700
701
eefe52da 702 virtual WXWindow GetWXWindow() const = 0;
03647350 703
eefe52da
SC
704 virtual void Raise()
705 {
706 }
03647350 707
eefe52da
SC
708 virtual void Lower()
709 {
710 }
711
1aec1f8b 712 virtual bool Show(bool WXUNUSED(show))
eefe52da
SC
713 {
714 return false;
715 }
03647350 716
1aec1f8b 717 virtual bool ShowWithEffect(bool show, wxShowEffect WXUNUSED(effect), unsigned WXUNUSED(timeout))
eefe52da
SC
718 {
719 return Show(show);
720 }
03647350 721
eefe52da
SC
722 virtual void Update()
723 {
724 }
725
1aec1f8b 726 virtual bool SetTransparent(wxByte WXUNUSED(alpha))
eefe52da
SC
727 {
728 return false;
729 }
730
1aec1f8b 731 virtual bool SetBackgroundColour(const wxColour& WXUNUSED(col) )
eefe52da
SC
732 {
733 return false;
734 }
735
1aec1f8b 736 virtual void SetExtraStyle( long WXUNUSED(exStyle) )
eefe52da
SC
737 {
738 }
b6dc21e7
KO
739
740 virtual void SetWindowStyleFlag( long WXUNUSED(style) )
741 {
742 }
743
1aec1f8b 744 virtual bool SetBackgroundStyle(wxBackgroundStyle WXUNUSED(style))
03647350 745 {
eefe52da
SC
746 return false ;
747 }
03647350 748
eefe52da
SC
749 bool CanSetTransparent()
750 {
751 return false;
752 }
753
03647350 754 virtual void GetContentArea( int &left , int &top , int &width , int &height ) const = 0;
eefe52da
SC
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
1aec1f8b 759 virtual bool SetShape(const wxRegion& WXUNUSED(region))
eefe52da
SC
760 {
761 return false;
762 }
03647350 763
eefe52da 764 virtual void SetTitle( const wxString& title, wxFontEncoding encoding ) = 0;
03647350 765
eefe52da 766 virtual bool IsMaximized() const = 0;
03647350 767
eefe52da 768 virtual bool IsIconized() const= 0;
03647350 769
eefe52da 770 virtual void Iconize( bool iconize )= 0;
03647350 771
eefe52da 772 virtual void Maximize(bool maximize) = 0;
03647350 773
eefe52da 774 virtual bool IsFullScreen() const= 0;
03647350 775
dbc7ceb9
KO
776 virtual void ShowWithoutActivating() { Show(true); }
777
eefe52da
SC
778 virtual bool ShowFullScreen(bool show, long style)= 0;
779
780 virtual void RequestUserAttention(int flags) = 0;
03647350
VZ
781
782 virtual void ScreenToWindow( int *x, int *y ) = 0;
783
eefe52da 784 virtual void WindowToScreen( int *x, int *y ) = 0;
03647350 785
dbc7ceb9
KO
786 virtual bool IsActive() = 0;
787
eefe52da 788 wxNonOwnedWindow* GetWXPeer() { return m_wxPeer; }
03647350 789
524c47aa 790 // static creation methods, must be implemented by all toolkits
03647350 791
524c47aa
SC
792 static wxNonOwnedWindowImpl* CreateNonOwnedWindow( wxNonOwnedWindow* wxpeer, wxWindow* parent, const wxPoint& pos, const wxSize& size,
793 long style, long extraStyle, const wxString& name ) ;
efb2fa41
KO
794
795 virtual void SetModified(bool WXUNUSED(modified)) { }
ebf7d5c4 796 virtual bool IsModified() const { return false; }
524c47aa 797
eefe52da
SC
798protected :
799 wxNonOwnedWindow* m_wxPeer;
800 DECLARE_ABSTRACT_CLASS(wxNonOwnedWindowImpl)
801};
802
5c6eb3a8
SC
803#endif // wxUSE_GUI
804
805//---------------------------------------------------------------------------
806// cocoa bridging utilities
807//---------------------------------------------------------------------------
808
809bool wxMacInitCocoa();
810
811class WXDLLIMPEXP_CORE wxMacAutoreleasePool
812{
813public :
814 wxMacAutoreleasePool();
815 ~wxMacAutoreleasePool();
816private :
817 void* m_pool;
818};
819
820// NSObject
821
822void wxMacCocoaRelease( void* obj );
823void wxMacCocoaAutorelease( void* obj );
f1c40652 824void* wxMacCocoaRetain( void* obj );
5c6eb3a8
SC
825
826
827#endif
eefe52da 828 // _WX_PRIVATE_CORE_H_