]> git.saurik.com Git - wxWidgets.git/blame - include/wx/osx/core/private.h
Fix emulator compilation with wxX11 after GetMainWindow() renaming.
[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;
809020fc
KO
279
280 // Mechanism used to keep track of whether a change should send an event
281 // Do SendEvents(false) when starting actions that would trigger programmatic events
282 // and SendEvents(true) at the end of the block.
283 virtual void SendEvents(bool shouldSendEvents) { m_shouldSendEvents = shouldSendEvents; }
284 virtual bool ShouldSendEvents() { return m_shouldSendEvents; }
eefe52da 285
f55d9f74
SC
286 // static methods for associating native controls and their implementations
287
03647350 288 static wxWidgetImpl*
f55d9f74 289 FindFromWXWidget(WXWidget control);
03647350 290
f55d9f74 291 static void RemoveAssociations( wxWidgetImpl* impl);
03647350 292
f55d9f74 293 static void Associate( WXWidget control, wxWidgetImpl *impl );
03647350 294
f06e0fea 295 static WXWidget FindFocus();
03647350 296
eefe52da 297 // static creation methods, must be implemented by all toolkits
03647350
VZ
298
299 static wxWidgetImplType* CreateUserPane( wxWindowMac* wxpeer,
300 wxWindowMac* parent,
301 wxWindowID id,
302 const wxPoint& pos,
524c47aa 303 const wxSize& size,
03647350 304 long style,
524c47aa
SC
305 long extraStyle) ;
306 static wxWidgetImplType* CreateContentView( wxNonOwnedWindow* now ) ;
307
03647350
VZ
308 static wxWidgetImplType* CreateButton( wxWindowMac* wxpeer,
309 wxWindowMac* parent,
310 wxWindowID id,
524c47aa 311 const wxString& label,
03647350 312 const wxPoint& pos,
524c47aa 313 const wxSize& size,
03647350 314 long style,
524c47aa
SC
315 long extraStyle) ;
316
03647350
VZ
317 static wxWidgetImplType* CreateDisclosureTriangle( wxWindowMac* wxpeer,
318 wxWindowMac* parent,
319 wxWindowID id,
524c47aa 320 const wxString& label,
03647350 321 const wxPoint& pos,
524c47aa 322 const wxSize& size,
03647350 323 long style,
524c47aa 324 long extraStyle) ;
03647350
VZ
325
326 static wxWidgetImplType* CreateStaticLine( wxWindowMac* wxpeer,
327 wxWindowMac* parent,
328 wxWindowID id,
329 const wxPoint& pos,
524c47aa 330 const wxSize& size,
03647350 331 long style,
524c47aa
SC
332 long extraStyle) ;
333
03647350
VZ
334 static wxWidgetImplType* CreateGroupBox( wxWindowMac* wxpeer,
335 wxWindowMac* parent,
336 wxWindowID id,
524c47aa 337 const wxString& label,
03647350 338 const wxPoint& pos,
524c47aa 339 const wxSize& size,
03647350 340 long style,
524c47aa
SC
341 long extraStyle) ;
342
03647350
VZ
343 static wxWidgetImplType* CreateStaticText( wxWindowMac* wxpeer,
344 wxWindowMac* parent,
345 wxWindowID id,
524c47aa 346 const wxString& label,
03647350 347 const wxPoint& pos,
524c47aa 348 const wxSize& size,
03647350 349 long style,
524c47aa
SC
350 long extraStyle) ;
351
03647350
VZ
352 static wxWidgetImplType* CreateTextControl( wxTextCtrl* wxpeer,
353 wxWindowMac* parent,
354 wxWindowID id,
524c47aa 355 const wxString& content,
03647350 356 const wxPoint& pos,
524c47aa 357 const wxSize& size,
03647350 358 long style,
524c47aa
SC
359 long extraStyle) ;
360
03647350
VZ
361 static wxWidgetImplType* CreateSearchControl( wxTextCtrl* wxpeer,
362 wxWindowMac* parent,
363 wxWindowID id,
1e181c7a 364 const wxString& content,
03647350 365 const wxPoint& pos,
1e181c7a 366 const wxSize& size,
03647350 367 long style,
1e181c7a
SC
368 long extraStyle) ;
369
03647350
VZ
370 static wxWidgetImplType* CreateCheckBox( wxWindowMac* wxpeer,
371 wxWindowMac* parent,
372 wxWindowID id,
524c47aa 373 const wxString& label,
03647350 374 const wxPoint& pos,
524c47aa 375 const wxSize& size,
03647350 376 long style,
524c47aa 377 long extraStyle);
03647350
VZ
378
379 static wxWidgetImplType* CreateRadioButton( wxWindowMac* wxpeer,
380 wxWindowMac* parent,
381 wxWindowID id,
524c47aa 382 const wxString& label,
03647350 383 const wxPoint& pos,
524c47aa 384 const wxSize& size,
03647350 385 long style,
524c47aa
SC
386 long extraStyle);
387
03647350
VZ
388 static wxWidgetImplType* CreateToggleButton( wxWindowMac* wxpeer,
389 wxWindowMac* parent,
390 wxWindowID id,
524c47aa 391 const wxString& label,
03647350 392 const wxPoint& pos,
524c47aa 393 const wxSize& size,
03647350 394 long style,
524c47aa
SC
395 long extraStyle);
396
03647350
VZ
397 static wxWidgetImplType* CreateBitmapToggleButton( wxWindowMac* wxpeer,
398 wxWindowMac* parent,
399 wxWindowID id,
524c47aa 400 const wxBitmap& bitmap,
03647350 401 const wxPoint& pos,
524c47aa 402 const wxSize& size,
03647350 403 long style,
524c47aa
SC
404 long extraStyle);
405
03647350
VZ
406 static wxWidgetImplType* CreateBitmapButton( wxWindowMac* wxpeer,
407 wxWindowMac* parent,
408 wxWindowID id,
524c47aa 409 const wxBitmap& bitmap,
03647350 410 const wxPoint& pos,
524c47aa 411 const wxSize& size,
03647350 412 long style,
524c47aa
SC
413 long extraStyle);
414
03647350
VZ
415 static wxWidgetImplType* CreateTabView( wxWindowMac* wxpeer,
416 wxWindowMac* parent,
417 wxWindowID id,
418 const wxPoint& pos,
524c47aa 419 const wxSize& size,
03647350 420 long style,
524c47aa
SC
421 long extraStyle);
422
03647350
VZ
423 static wxWidgetImplType* CreateGauge( wxWindowMac* wxpeer,
424 wxWindowMac* parent,
425 wxWindowID id,
524c47aa
SC
426 wxInt32 value,
427 wxInt32 minimum,
428 wxInt32 maximum,
03647350 429 const wxPoint& pos,
524c47aa 430 const wxSize& size,
03647350 431 long style,
524c47aa
SC
432 long extraStyle);
433
03647350
VZ
434 static wxWidgetImplType* CreateSlider( wxWindowMac* wxpeer,
435 wxWindowMac* parent,
436 wxWindowID id,
524c47aa
SC
437 wxInt32 value,
438 wxInt32 minimum,
439 wxInt32 maximum,
03647350 440 const wxPoint& pos,
524c47aa 441 const wxSize& size,
03647350 442 long style,
524c47aa
SC
443 long extraStyle);
444
03647350
VZ
445 static wxWidgetImplType* CreateSpinButton( wxWindowMac* wxpeer,
446 wxWindowMac* parent,
447 wxWindowID id,
524c47aa
SC
448 wxInt32 value,
449 wxInt32 minimum,
450 wxInt32 maximum,
03647350 451 const wxPoint& pos,
524c47aa 452 const wxSize& size,
03647350 453 long style,
524c47aa
SC
454 long extraStyle);
455
03647350
VZ
456 static wxWidgetImplType* CreateScrollBar( wxWindowMac* wxpeer,
457 wxWindowMac* parent,
458 wxWindowID id,
459 const wxPoint& pos,
524c47aa 460 const wxSize& size,
03647350 461 long style,
524c47aa
SC
462 long extraStyle);
463
03647350
VZ
464 static wxWidgetImplType* CreateChoice( wxWindowMac* wxpeer,
465 wxWindowMac* parent,
466 wxWindowID id,
524c47aa 467 wxMenu* menu,
03647350 468 const wxPoint& pos,
524c47aa 469 const wxSize& size,
03647350 470 long style,
524c47aa
SC
471 long extraStyle);
472
03647350
VZ
473 static wxWidgetImplType* CreateListBox( wxWindowMac* wxpeer,
474 wxWindowMac* parent,
475 wxWindowID id,
476 const wxPoint& pos,
524c47aa 477 const wxSize& size,
03647350 478 long style,
524c47aa 479 long extraStyle);
eefe52da 480
c84030e0 481#if wxOSX_USE_COCOA
f941a30b
KO
482 static wxWidgetImplType* CreateComboBox( wxWindowMac* wxpeer,
483 wxWindowMac* parent,
484 wxWindowID id,
485 wxMenu* menu,
486 const wxPoint& pos,
487 const wxSize& size,
488 long style,
489 long extraStyle);
490#endif
491
eefe52da
SC
492 // converts from Toplevel-Content relative to local
493 static void Convert( wxPoint *pt , wxWidgetImpl *from , wxWidgetImpl *to );
494protected :
495 bool m_isRootControl;
496 wxWindowMac* m_wxPeer;
497 bool m_needsFocusRect;
f2f6030e 498 bool m_needsFrame;
809020fc 499 bool m_shouldSendEvents;
eefe52da
SC
500
501 DECLARE_ABSTRACT_CLASS(wxWidgetImpl)
502};
503
524c47aa
SC
504//
505// the interface to be implemented eg by a listbox
506//
507
03647350 508class WXDLLIMPEXP_CORE wxListWidgetColumn
524c47aa
SC
509{
510public :
511 virtual ~wxListWidgetColumn() {}
512} ;
513
514class WXDLLIMPEXP_CORE wxListWidgetCellValue
515{
516public :
517 wxListWidgetCellValue() {}
518 virtual ~wxListWidgetCellValue() {}
03647350 519
524c47aa
SC
520 virtual void Set( CFStringRef value ) = 0;
521 virtual void Set( const wxString& value ) = 0;
522 virtual void Set( int value ) = 0;
60ebcb8a 523 virtual void Check( bool check );
03647350 524
60ebcb8a 525 virtual bool IsChecked() const;
524c47aa
SC
526 virtual int GetIntValue() const = 0;
527 virtual wxString GetStringValue() const = 0;
528} ;
529
530class WXDLLIMPEXP_CORE wxListWidgetImpl
531{
532public:
533 wxListWidgetImpl() {}
534 virtual ~wxListWidgetImpl() { }
03647350
VZ
535
536 virtual wxListWidgetColumn* InsertTextColumn( unsigned pos, const wxString& title, bool editable = false,
524c47aa 537 wxAlignment just = wxALIGN_LEFT , int defaultWidth = -1) = 0 ;
03647350 538 virtual wxListWidgetColumn* InsertCheckColumn( unsigned pos , const wxString& title, bool editable = false,
524c47aa 539 wxAlignment just = wxALIGN_LEFT , int defaultWidth = -1) = 0 ;
03647350 540
524c47aa
SC
541 // add and remove
542
543 // TODO will be replaced
544 virtual void ListDelete( unsigned int n ) = 0;
545 virtual void ListInsert( unsigned int n ) = 0;
546 virtual void ListClear() = 0;
547
548 // selecting
549
550 virtual void ListDeselectAll() = 0;
551 virtual void ListSetSelection( unsigned int n, bool select, bool multi ) = 0;
552 virtual int ListGetSelection() const = 0;
553 virtual int ListGetSelections( wxArrayInt& aSelections ) const = 0;
554 virtual bool ListIsSelected( unsigned int n ) const = 0;
03647350 555
524c47aa
SC
556 // display
557
558 virtual void ListScrollTo( unsigned int n ) = 0;
559 virtual void UpdateLine( unsigned int n, wxListWidgetColumn* col = NULL ) = 0;
560 virtual void UpdateLineToEnd( unsigned int n) = 0;
561
562 // accessing content
563
564 virtual unsigned int ListGetCount() const = 0;
565};
566
1e181c7a
SC
567//
568// interface to be implemented by a textcontrol
569//
570
21a9d326
SC
571class WXDLLIMPEXP_FWD_CORE wxTextAttr;
572
1e181c7a
SC
573// common interface for all implementations
574class WXDLLIMPEXP_CORE wxTextWidgetImpl
575
576{
577public :
578 wxTextWidgetImpl() {}
579
580 virtual ~wxTextWidgetImpl() {}
581
582 virtual bool CanFocus() const { return true; }
583
584 virtual wxString GetStringValue() const = 0 ;
585 virtual void SetStringValue( const wxString &val ) = 0 ;
586 virtual void SetSelection( long from, long to ) = 0 ;
587 virtual void GetSelection( long* from, long* to ) const = 0 ;
588 virtual void WriteText( const wxString& str ) = 0 ;
589
16671f22 590 virtual bool GetStyle( long position, wxTextAttr& style);
1e181c7a
SC
591 virtual void SetStyle( long start, long end, const wxTextAttr& style ) ;
592 virtual void Copy() ;
593 virtual void Cut() ;
594 virtual void Paste() ;
595 virtual bool CanPaste() const ;
596 virtual void SetEditable( bool editable ) ;
0b6a49c2 597 virtual long GetLastPosition() const ;
1e181c7a
SC
598 virtual void Replace( long from, long to, const wxString &str ) ;
599 virtual void Remove( long from, long to ) ;
600
601
602 virtual bool HasOwnContextMenu() const
603 { return false ; }
604
605 virtual bool SetupCursor( const wxPoint& WXUNUSED(pt) )
606 { return false ; }
607
608 virtual void Clear() ;
609 virtual bool CanUndo() const;
610 virtual void Undo() ;
611 virtual bool CanRedo() const;
612 virtual void Redo() ;
613 virtual int GetNumberOfLines() const ;
614 virtual long XYToPosition(long x, long y) const;
615 virtual bool PositionToXY(long pos, long *x, long *y) const ;
616 virtual void ShowPosition(long WXUNUSED(pos)) ;
617 virtual int GetLineLength(long lineNo) const ;
618 virtual wxString GetLineText(long lineNo) const ;
619 virtual void CheckSpelling(bool WXUNUSED(check)) { }
9ab7ff53
KO
620
621 virtual wxSize GetBestSize() const { return wxDefaultSize; }
1e181c7a
SC
622};
623
c84030e0
KO
624// common interface for all implementations
625class WXDLLIMPEXP_CORE wxComboWidgetImpl
626
627{
628public :
629 wxComboWidgetImpl() {}
630
631 virtual ~wxComboWidgetImpl() {}
632
633 virtual int GetSelectedItem() const { return -1; };
634 virtual void SetSelectedItem(int WXUNUSED(item)) {};
635
636 virtual int GetNumberOfItems() const { return -1; };
637
638 virtual void InsertItem(int WXUNUSED(pos), const wxString& WXUNUSED(item)) {}
639
640 virtual void RemoveItem(int WXUNUSED(pos)) {}
641
642 virtual void Clear() {}
643
644 virtual wxString GetStringAtIndex(int WXUNUSED(pos)) const { return wxEmptyString; }
645
646 virtual int FindString(const wxString& WXUNUSED(text)) const { return -1; }
647};
648
411a1c35 649//
b38dc31f 650// common interface for buttons
411a1c35
SC
651//
652
b38dc31f 653class wxButtonImpl
411a1c35
SC
654{
655 public :
b38dc31f
SC
656 wxButtonImpl(){}
657 virtual ~wxButtonImpl(){}
411a1c35
SC
658
659 virtual void SetPressedBitmap( const wxBitmap& bitmap ) = 0;
660} ;
661
1e181c7a
SC
662//
663// common interface for search controls
664//
665
666class wxSearchWidgetImpl
667{
668public :
669 wxSearchWidgetImpl(){}
670 virtual ~wxSearchWidgetImpl(){}
671
672 // search field options
673 virtual void ShowSearchButton( bool show ) = 0;
674 virtual bool IsSearchButtonVisible() const = 0;
675
676 virtual void ShowCancelButton( bool show ) = 0;
677 virtual bool IsCancelButtonVisible() const = 0;
678
679 virtual void SetSearchMenu( wxMenu* menu ) = 0;
680
681 virtual void SetDescriptiveText(const wxString& text) = 0;
682} ;
683
524c47aa
SC
684//
685// toplevel window implementation class
686//
687
eefe52da
SC
688class wxNonOwnedWindowImpl : public wxObject
689{
690public :
691 wxNonOwnedWindowImpl( wxNonOwnedWindow* nonownedwnd) : m_wxPeer(nonownedwnd)
692 {
693 }
694 wxNonOwnedWindowImpl()
695 {
696 }
697 virtual ~wxNonOwnedWindowImpl()
698 {
699 }
03647350 700
0aaa6ace 701 virtual void WillBeDestroyed()
eefe52da
SC
702 {
703 }
704
705 virtual void Create( wxWindow* parent, const wxPoint& pos, const wxSize& size,
706 long style, long extraStyle, const wxString& name ) = 0;
03647350
VZ
707
708
eefe52da 709 virtual WXWindow GetWXWindow() const = 0;
03647350 710
eefe52da
SC
711 virtual void Raise()
712 {
713 }
03647350 714
eefe52da
SC
715 virtual void Lower()
716 {
717 }
718
1aec1f8b 719 virtual bool Show(bool WXUNUSED(show))
eefe52da
SC
720 {
721 return false;
722 }
03647350 723
1aec1f8b 724 virtual bool ShowWithEffect(bool show, wxShowEffect WXUNUSED(effect), unsigned WXUNUSED(timeout))
eefe52da
SC
725 {
726 return Show(show);
727 }
03647350 728
eefe52da
SC
729 virtual void Update()
730 {
731 }
732
1aec1f8b 733 virtual bool SetTransparent(wxByte WXUNUSED(alpha))
eefe52da
SC
734 {
735 return false;
736 }
737
1aec1f8b 738 virtual bool SetBackgroundColour(const wxColour& WXUNUSED(col) )
eefe52da
SC
739 {
740 return false;
741 }
742
1aec1f8b 743 virtual void SetExtraStyle( long WXUNUSED(exStyle) )
eefe52da
SC
744 {
745 }
b6dc21e7
KO
746
747 virtual void SetWindowStyleFlag( long WXUNUSED(style) )
748 {
749 }
750
1aec1f8b 751 virtual bool SetBackgroundStyle(wxBackgroundStyle WXUNUSED(style))
03647350 752 {
eefe52da
SC
753 return false ;
754 }
03647350 755
eefe52da
SC
756 bool CanSetTransparent()
757 {
758 return false;
759 }
760
03647350 761 virtual void GetContentArea( int &left , int &top , int &width , int &height ) const = 0;
eefe52da
SC
762 virtual void MoveWindow(int x, int y, int width, int height) = 0;
763 virtual void GetPosition( int &x, int &y ) const = 0;
764 virtual void GetSize( int &width, int &height ) const = 0;
765
1aec1f8b 766 virtual bool SetShape(const wxRegion& WXUNUSED(region))
eefe52da
SC
767 {
768 return false;
769 }
03647350 770
eefe52da 771 virtual void SetTitle( const wxString& title, wxFontEncoding encoding ) = 0;
03647350 772
eefe52da 773 virtual bool IsMaximized() const = 0;
03647350 774
eefe52da 775 virtual bool IsIconized() const= 0;
03647350 776
eefe52da 777 virtual void Iconize( bool iconize )= 0;
03647350 778
eefe52da 779 virtual void Maximize(bool maximize) = 0;
03647350 780
eefe52da 781 virtual bool IsFullScreen() const= 0;
03647350 782
dbc7ceb9
KO
783 virtual void ShowWithoutActivating() { Show(true); }
784
eefe52da
SC
785 virtual bool ShowFullScreen(bool show, long style)= 0;
786
787 virtual void RequestUserAttention(int flags) = 0;
03647350
VZ
788
789 virtual void ScreenToWindow( int *x, int *y ) = 0;
790
eefe52da 791 virtual void WindowToScreen( int *x, int *y ) = 0;
03647350 792
dbc7ceb9
KO
793 virtual bool IsActive() = 0;
794
eefe52da 795 wxNonOwnedWindow* GetWXPeer() { return m_wxPeer; }
03647350 796
524c47aa 797 // static creation methods, must be implemented by all toolkits
03647350 798
524c47aa
SC
799 static wxNonOwnedWindowImpl* CreateNonOwnedWindow( wxNonOwnedWindow* wxpeer, wxWindow* parent, const wxPoint& pos, const wxSize& size,
800 long style, long extraStyle, const wxString& name ) ;
efb2fa41
KO
801
802 virtual void SetModified(bool WXUNUSED(modified)) { }
ebf7d5c4 803 virtual bool IsModified() const { return false; }
524c47aa 804
eefe52da
SC
805protected :
806 wxNonOwnedWindow* m_wxPeer;
807 DECLARE_ABSTRACT_CLASS(wxNonOwnedWindowImpl)
808};
809
5c6eb3a8
SC
810#endif // wxUSE_GUI
811
812//---------------------------------------------------------------------------
813// cocoa bridging utilities
814//---------------------------------------------------------------------------
815
816bool wxMacInitCocoa();
817
818class WXDLLIMPEXP_CORE wxMacAutoreleasePool
819{
820public :
821 wxMacAutoreleasePool();
822 ~wxMacAutoreleasePool();
823private :
824 void* m_pool;
825};
826
827// NSObject
828
829void wxMacCocoaRelease( void* obj );
830void wxMacCocoaAutorelease( void* obj );
f1c40652 831void* wxMacCocoaRetain( void* obj );
5c6eb3a8
SC
832
833
834#endif
eefe52da 835 // _WX_PRIVATE_CORE_H_