]> git.saurik.com Git - wxWidgets.git/blame - include/wx/osx/core/private.h
Split wxTextCompleter into a base class and wxTextCompleterSimple.
[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
a9a4f229 9// RCS-ID: $Id$
5c6eb3a8
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
26632ccd 35#if ( !wxUSE_GUI && !wxOSX_USE_IPHONE ) || wxOSX_USE_COCOA_OR_CARBON
382c4ade
VZ
36
37// Carbon functions are currently still used in wxOSX/Cocoa too (including
38// wxBase part of it).
39#include <Carbon/Carbon.h>
1e181c7a 40
524c47aa 41WXDLLIMPEXP_BASE long UMAGetSystemVersion() ;
1e181c7a
SC
42
43void WXDLLIMPEXP_CORE wxMacStringToPascal( const wxString&from , unsigned char * to );
44wxString WXDLLIMPEXP_CORE wxMacMakeStringFromPascal( const unsigned char * from );
45
382c4ade
VZ
46WXDLLIMPEXP_BASE wxString wxMacFSRefToPath( const FSRef *fsRef , CFStringRef additionalPathComponent = NULL );
47WXDLLIMPEXP_BASE OSStatus wxMacPathToFSRef( const wxString&path , FSRef *fsRef );
48WXDLLIMPEXP_BASE wxString wxMacHFSUniStrToString( ConstHFSUniStr255Param uniname );
49
524c47aa
SC
50#endif
51
5c6eb3a8
SC
52#if wxUSE_GUI
53
eefe52da 54#if wxOSX_USE_IPHONE
5c6eb3a8 55#include <CoreGraphics/CoreGraphics.h>
eefe52da 56#else
09f0f2cf 57#include <ApplicationServices/ApplicationServices.h>
eefe52da
SC
58#endif
59
60#include "wx/bitmap.h"
61#include "wx/window.h"
5c6eb3a8
SC
62
63class WXDLLIMPEXP_CORE wxMacCGContextStateSaver
64{
c0c133e1 65 wxDECLARE_NO_COPY_CLASS(wxMacCGContextStateSaver);
5c6eb3a8
SC
66
67public:
68 wxMacCGContextStateSaver( CGContextRef cg )
69 {
70 m_cg = cg;
71 CGContextSaveGState( cg );
72 }
73 ~wxMacCGContextStateSaver()
74 {
75 CGContextRestoreGState( m_cg );
76 }
77private:
78 CGContextRef m_cg;
79};
80
eefe52da
SC
81class WXDLLIMPEXP_CORE wxDeferredObjectDeleter : public wxObject
82{
83public :
03647350 84 wxDeferredObjectDeleter( wxObject* obj ) : m_obj(obj)
eefe52da
SC
85 {
86 }
87 virtual ~wxDeferredObjectDeleter()
88 {
89 delete m_obj;
90 }
91protected :
92 wxObject* m_obj ;
93} ;
5c6eb3a8
SC
94
95// Quartz
96
97WXDLLIMPEXP_CORE CGImageRef wxMacCreateCGImageFromBitmap( const wxBitmap& bitmap );
98
99WXDLLIMPEXP_CORE CGDataProviderRef wxMacCGDataProviderCreateWithCFData( CFDataRef data );
100WXDLLIMPEXP_CORE CGDataConsumerRef wxMacCGDataConsumerCreateWithCFData( CFMutableDataRef data );
101WXDLLIMPEXP_CORE CGDataProviderRef wxMacCGDataProviderCreateWithMemoryBuffer( const wxMemoryBuffer& buf );
102
103CGColorSpaceRef WXDLLIMPEXP_CORE wxMacGetGenericRGBColorSpace(void);
104
eefe52da
SC
105class wxWindowMac;
106// to
107extern wxWindow* g_MacLastWindow;
108class wxNonOwnedWindow;
109
524c47aa
SC
110// temporary typedef so that no additional casts are necessary within carbon code at the moment
111
112class wxMacControl;
113class wxWidgetImpl;
c072b9ec 114class wxComboBox;
524c47aa 115class wxNotebook;
de24bdf2 116class wxTextCtrl;
11f87a38 117class wxSearchCtrl;
524c47aa 118
8fa9ac5e
SC
119WXDLLIMPEXP_CORE wxWindowMac * wxFindWindowFromWXWidget(WXWidget inControl );
120
524c47aa
SC
121#if wxOSX_USE_CARBON
122typedef wxMacControl wxWidgetImplType;
123#else
124typedef wxWidgetImpl wxWidgetImplType;
125#endif
126
6c1f25cc 127#if wxUSE_MENUS
03647350 128class wxMenuItemImpl : public wxObject
524c47aa
SC
129{
130public :
131 wxMenuItemImpl( wxMenuItem* peer ) : m_peer(peer)
132 {
133 }
03647350 134
524c47aa
SC
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;
03647350 141
524c47aa
SC
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 );
c46d0503
SC
153
154 // handle OS specific menu items if they weren't handled during normal processing
8915e40c 155 virtual bool DoDefault() { return false; }
524c47aa
SC
156protected :
157 wxMenuItem* m_peer;
03647350 158
69cc4323 159 DECLARE_ABSTRACT_CLASS(wxMenuItemImpl)
524c47aa
SC
160} ;
161
03647350 162class wxMenuImpl : public wxObject
524c47aa
SC
163{
164public :
165 wxMenuImpl( wxMenu* peer ) : m_peer(peer)
166 {
167 }
03647350
VZ
168
169 virtual ~wxMenuImpl() ;
170 virtual void InsertOrAppend(wxMenuItem *pItem, size_t pos) = 0;
524c47aa 171 virtual void Remove( wxMenuItem *pItem ) = 0;
03647350 172
524c47aa
SC
173 virtual void MakeRoot() = 0;
174
175 virtual void SetTitle( const wxString& text ) = 0;
176
177 virtual WXHMENU GetHMenu() = 0;
03647350 178
524c47aa
SC
179 wxMenu* GetWXPeer() { return m_peer ; }
180
2cb5d2d2
SC
181 virtual void PopUp( wxWindow *win, int x, int y ) = 0;
182
524c47aa
SC
183 static wxMenuImpl* Create( wxMenu* peer, const wxString& title );
184 static wxMenuImpl* CreateRootMenu( wxMenu* peer );
185protected :
186 wxMenu* m_peer;
03647350 187
69cc4323 188 DECLARE_ABSTRACT_CLASS(wxMenuItemImpl)
524c47aa 189} ;
6c1f25cc 190#endif
524c47aa
SC
191
192
eefe52da
SC
193class WXDLLIMPEXP_CORE wxWidgetImpl : public wxObject
194{
195public :
415f4a01 196 wxWidgetImpl( wxWindowMac* peer , bool isRootControl = false, bool isUserPane = false );
eefe52da
SC
197 wxWidgetImpl();
198 virtual ~wxWidgetImpl();
199
200 void Init();
201
eefe52da 202 bool IsRootControl() const { return m_isRootControl; }
415f4a01
SC
203
204 bool IsUserPane() const { return m_isUserPane; }
eefe52da
SC
205
206 wxWindowMac* GetWXPeer() const { return m_wxPeer; }
03647350 207
eefe52da
SC
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
ab9a0b84
VZ
216 virtual bool ShowWithEffect(bool WXUNUSED(show),
217 wxShowEffect WXUNUSED(effect),
218 unsigned WXUNUSED(timeout))
219 {
220 return false;
221 }
222
eefe52da 223 virtual void Raise() = 0;
03647350 224
eefe52da
SC
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;
03647350 230
eefe52da 231 virtual void SetBackgroundColour( const wxColour& col ) = 0;
bc5c09a3 232 virtual bool SetBackgroundStyle(wxBackgroundStyle style) = 0;
eefe52da
SC
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;
524c47aa 239 virtual void SetControlSize( wxWindowVariant variant ) = 0;
f18b5ee7
SC
240 virtual float GetContentScaleFactor() const
241 {
242 return 1.0;
243 }
54ea2834
SC
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 }
eefe52da 251
ee032c59
SC
252 // native view coordinates are topleft to bottom right (flipped regarding CoreGraphics origin)
253 virtual bool IsFlipped() const { return true; }
254
eefe52da
SC
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
f2f6030e
SC
261 virtual bool NeedsFrame() const;
262 virtual void SetNeedsFrame( bool needs );
263
eefe52da
SC
264 virtual bool CanFocus() const = 0;
265 // return true if successful
266 virtual bool SetFocus() = 0;
267 virtual bool HasFocus() const = 0;
03647350 268
eefe52da
SC
269 virtual void RemoveFromParent() = 0;
270 virtual void Embed( wxWidgetImpl *parent ) = 0;
03647350 271
524c47aa
SC
272 virtual void SetDefaultButton( bool isDefault ) = 0;
273 virtual void PerformClick() = 0;
274 virtual void SetLabel( const wxString& title, wxFontEncoding encoding ) = 0;
6a219e34 275#if wxUSE_MARKUP && wxOSX_USE_COCOA
f672c969
VZ
276 virtual void SetLabelMarkup( const wxString& WXUNUSED(markup) ) { }
277#endif
524c47aa 278
54f11060
SC
279 virtual void SetCursor( const wxCursor & cursor ) = 0;
280 virtual void CaptureMouse() = 0;
281 virtual void ReleaseMouse() = 0;
282
524c47aa
SC
283 virtual wxInt32 GetValue() const = 0;
284 virtual void SetValue( wxInt32 v ) = 0;
e5d05b90 285 virtual wxBitmap GetBitmap() const = 0;
524c47aa 286 virtual void SetBitmap( const wxBitmap& bitmap ) = 0;
e5d05b90 287 virtual void SetBitmapPosition( wxDirection dir ) = 0;
524c47aa
SC
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;
19c7ac3d
SC
294 virtual wxInt32 GetMinimum() const = 0;
295 virtual wxInt32 GetMaximum() const = 0;
524c47aa
SC
296 virtual void PulseGauge() = 0;
297 virtual void SetScrollThumb( wxInt32 value, wxInt32 thumbSize ) = 0;
298
1e181c7a 299 virtual void SetFont( const wxFont & font , const wxColour& foreground , long windowStyle, bool ignoreBlack = true ) = 0;
ce00f59b 300
a7b9865d 301 virtual void SetToolTip(wxToolTip* WXUNUSED(tooltip)) { }
1e181c7a 302
524c47aa
SC
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;
03647350 306
c4825ef7 307 virtual void InstallEventHandler( WXWidget control = NULL ) = 0;
ce00f59b 308
809020fc
KO
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; }
eefe52da 314
f55d9f74
SC
315 // static methods for associating native controls and their implementations
316
03647350 317 static wxWidgetImpl*
f55d9f74 318 FindFromWXWidget(WXWidget control);
03647350 319
f55d9f74 320 static void RemoveAssociations( wxWidgetImpl* impl);
03647350 321
f55d9f74 322 static void Associate( WXWidget control, wxWidgetImpl *impl );
03647350 323
f06e0fea 324 static WXWidget FindFocus();
03647350 325
eefe52da 326 // static creation methods, must be implemented by all toolkits
03647350
VZ
327
328 static wxWidgetImplType* CreateUserPane( wxWindowMac* wxpeer,
329 wxWindowMac* parent,
330 wxWindowID id,
331 const wxPoint& pos,
524c47aa 332 const wxSize& size,
03647350 333 long style,
524c47aa
SC
334 long extraStyle) ;
335 static wxWidgetImplType* CreateContentView( wxNonOwnedWindow* now ) ;
336
03647350
VZ
337 static wxWidgetImplType* CreateButton( 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* CreateDisclosureTriangle( wxWindowMac* wxpeer,
347 wxWindowMac* parent,
348 wxWindowID id,
524c47aa 349 const wxString& label,
03647350 350 const wxPoint& pos,
524c47aa 351 const wxSize& size,
03647350 352 long style,
524c47aa 353 long extraStyle) ;
03647350
VZ
354
355 static wxWidgetImplType* CreateStaticLine( wxWindowMac* wxpeer,
356 wxWindowMac* parent,
357 wxWindowID id,
358 const wxPoint& pos,
524c47aa 359 const wxSize& size,
03647350 360 long style,
524c47aa
SC
361 long extraStyle) ;
362
03647350
VZ
363 static wxWidgetImplType* CreateGroupBox( wxWindowMac* wxpeer,
364 wxWindowMac* parent,
365 wxWindowID id,
524c47aa 366 const wxString& label,
03647350 367 const wxPoint& pos,
524c47aa 368 const wxSize& size,
03647350 369 long style,
524c47aa
SC
370 long extraStyle) ;
371
03647350
VZ
372 static wxWidgetImplType* CreateStaticText( wxWindowMac* wxpeer,
373 wxWindowMac* parent,
374 wxWindowID id,
524c47aa 375 const wxString& label,
03647350 376 const wxPoint& pos,
524c47aa 377 const wxSize& size,
03647350 378 long style,
524c47aa
SC
379 long extraStyle) ;
380
03647350
VZ
381 static wxWidgetImplType* CreateTextControl( wxTextCtrl* wxpeer,
382 wxWindowMac* parent,
383 wxWindowID id,
524c47aa 384 const wxString& content,
03647350 385 const wxPoint& pos,
524c47aa 386 const wxSize& size,
03647350 387 long style,
524c47aa
SC
388 long extraStyle) ;
389
11f87a38 390 static wxWidgetImplType* CreateSearchControl( wxSearchCtrl* wxpeer,
03647350
VZ
391 wxWindowMac* parent,
392 wxWindowID id,
1e181c7a 393 const wxString& content,
03647350 394 const wxPoint& pos,
1e181c7a 395 const wxSize& size,
03647350 396 long style,
1e181c7a
SC
397 long extraStyle) ;
398
03647350
VZ
399 static wxWidgetImplType* CreateCheckBox( wxWindowMac* wxpeer,
400 wxWindowMac* parent,
401 wxWindowID id,
524c47aa 402 const wxString& label,
03647350 403 const wxPoint& pos,
524c47aa 404 const wxSize& size,
03647350 405 long style,
524c47aa 406 long extraStyle);
03647350
VZ
407
408 static wxWidgetImplType* CreateRadioButton( wxWindowMac* wxpeer,
409 wxWindowMac* parent,
410 wxWindowID id,
524c47aa 411 const wxString& label,
03647350 412 const wxPoint& pos,
524c47aa 413 const wxSize& size,
03647350 414 long style,
524c47aa
SC
415 long extraStyle);
416
03647350
VZ
417 static wxWidgetImplType* CreateToggleButton( wxWindowMac* wxpeer,
418 wxWindowMac* parent,
419 wxWindowID id,
524c47aa 420 const wxString& label,
03647350 421 const wxPoint& pos,
524c47aa 422 const wxSize& size,
03647350 423 long style,
524c47aa
SC
424 long extraStyle);
425
03647350
VZ
426 static wxWidgetImplType* CreateBitmapToggleButton( wxWindowMac* wxpeer,
427 wxWindowMac* parent,
428 wxWindowID id,
524c47aa 429 const wxBitmap& bitmap,
03647350 430 const wxPoint& pos,
524c47aa 431 const wxSize& size,
03647350 432 long style,
524c47aa
SC
433 long extraStyle);
434
03647350
VZ
435 static wxWidgetImplType* CreateBitmapButton( wxWindowMac* wxpeer,
436 wxWindowMac* parent,
437 wxWindowID id,
524c47aa 438 const wxBitmap& bitmap,
03647350 439 const wxPoint& pos,
524c47aa 440 const wxSize& size,
03647350 441 long style,
524c47aa
SC
442 long extraStyle);
443
03647350
VZ
444 static wxWidgetImplType* CreateTabView( wxWindowMac* wxpeer,
445 wxWindowMac* parent,
446 wxWindowID id,
447 const wxPoint& pos,
524c47aa 448 const wxSize& size,
03647350 449 long style,
524c47aa
SC
450 long extraStyle);
451
03647350
VZ
452 static wxWidgetImplType* CreateGauge( wxWindowMac* wxpeer,
453 wxWindowMac* parent,
454 wxWindowID id,
524c47aa
SC
455 wxInt32 value,
456 wxInt32 minimum,
457 wxInt32 maximum,
03647350 458 const wxPoint& pos,
524c47aa 459 const wxSize& size,
03647350 460 long style,
524c47aa
SC
461 long extraStyle);
462
03647350
VZ
463 static wxWidgetImplType* CreateSlider( wxWindowMac* wxpeer,
464 wxWindowMac* parent,
465 wxWindowID id,
524c47aa
SC
466 wxInt32 value,
467 wxInt32 minimum,
468 wxInt32 maximum,
03647350 469 const wxPoint& pos,
524c47aa 470 const wxSize& size,
03647350 471 long style,
524c47aa
SC
472 long extraStyle);
473
03647350
VZ
474 static wxWidgetImplType* CreateSpinButton( wxWindowMac* wxpeer,
475 wxWindowMac* parent,
476 wxWindowID id,
524c47aa
SC
477 wxInt32 value,
478 wxInt32 minimum,
479 wxInt32 maximum,
03647350 480 const wxPoint& pos,
524c47aa 481 const wxSize& size,
03647350 482 long style,
524c47aa
SC
483 long extraStyle);
484
03647350
VZ
485 static wxWidgetImplType* CreateScrollBar( wxWindowMac* wxpeer,
486 wxWindowMac* parent,
487 wxWindowID id,
488 const wxPoint& pos,
524c47aa 489 const wxSize& size,
03647350 490 long style,
524c47aa
SC
491 long extraStyle);
492
03647350
VZ
493 static wxWidgetImplType* CreateChoice( wxWindowMac* wxpeer,
494 wxWindowMac* parent,
495 wxWindowID id,
524c47aa 496 wxMenu* menu,
03647350 497 const wxPoint& pos,
524c47aa 498 const wxSize& size,
03647350 499 long style,
524c47aa
SC
500 long extraStyle);
501
03647350
VZ
502 static wxWidgetImplType* CreateListBox( wxWindowMac* wxpeer,
503 wxWindowMac* parent,
504 wxWindowID id,
505 const wxPoint& pos,
524c47aa 506 const wxSize& size,
03647350 507 long style,
524c47aa 508 long extraStyle);
eefe52da 509
c84030e0 510#if wxOSX_USE_COCOA
ce00f59b
VZ
511 static wxWidgetImplType* CreateComboBox( wxComboBox* wxpeer,
512 wxWindowMac* parent,
513 wxWindowID id,
f941a30b 514 wxMenu* menu,
ce00f59b 515 const wxPoint& pos,
f941a30b 516 const wxSize& size,
ce00f59b 517 long style,
f941a30b
KO
518 long extraStyle);
519#endif
520
eefe52da
SC
521 // converts from Toplevel-Content relative to local
522 static void Convert( wxPoint *pt , wxWidgetImpl *from , wxWidgetImpl *to );
523protected :
524 bool m_isRootControl;
415f4a01 525 bool m_isUserPane;
eefe52da
SC
526 wxWindowMac* m_wxPeer;
527 bool m_needsFocusRect;
f2f6030e 528 bool m_needsFrame;
809020fc 529 bool m_shouldSendEvents;
eefe52da
SC
530
531 DECLARE_ABSTRACT_CLASS(wxWidgetImpl)
532};
533
524c47aa
SC
534//
535// the interface to be implemented eg by a listbox
536//
537
03647350 538class WXDLLIMPEXP_CORE wxListWidgetColumn
524c47aa
SC
539{
540public :
541 virtual ~wxListWidgetColumn() {}
542} ;
543
544class WXDLLIMPEXP_CORE wxListWidgetCellValue
545{
546public :
547 wxListWidgetCellValue() {}
548 virtual ~wxListWidgetCellValue() {}
03647350 549
524c47aa
SC
550 virtual void Set( CFStringRef value ) = 0;
551 virtual void Set( const wxString& value ) = 0;
552 virtual void Set( int value ) = 0;
60ebcb8a 553 virtual void Check( bool check );
03647350 554
60ebcb8a 555 virtual bool IsChecked() const;
524c47aa
SC
556 virtual int GetIntValue() const = 0;
557 virtual wxString GetStringValue() const = 0;
558} ;
559
560class WXDLLIMPEXP_CORE wxListWidgetImpl
561{
562public:
563 wxListWidgetImpl() {}
564 virtual ~wxListWidgetImpl() { }
03647350
VZ
565
566 virtual wxListWidgetColumn* InsertTextColumn( unsigned pos, const wxString& title, bool editable = false,
524c47aa 567 wxAlignment just = wxALIGN_LEFT , int defaultWidth = -1) = 0 ;
03647350 568 virtual wxListWidgetColumn* InsertCheckColumn( unsigned pos , const wxString& title, bool editable = false,
524c47aa 569 wxAlignment just = wxALIGN_LEFT , int defaultWidth = -1) = 0 ;
03647350 570
524c47aa
SC
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;
03647350 585
524c47aa
SC
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;
ce00f59b 595
20196e15 596 virtual int DoListHitTest( const wxPoint& inpoint ) const = 0;
524c47aa
SC
597};
598
1e181c7a
SC
599//
600// interface to be implemented by a textcontrol
601//
602
21a9d326 603class WXDLLIMPEXP_FWD_CORE wxTextAttr;
c072b9ec 604class WXDLLIMPEXP_FWD_CORE wxTextEntry;
21a9d326 605
1e181c7a
SC
606// common interface for all implementations
607class WXDLLIMPEXP_CORE wxTextWidgetImpl
608
609{
610public :
c072b9ec
VZ
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) {}
1e181c7a
SC
616
617 virtual ~wxTextWidgetImpl() {}
618
c072b9ec
VZ
619 wxTextEntry *GetTextEntry() const { return m_entry; }
620
1e181c7a
SC
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
16671f22 629 virtual bool GetStyle( long position, wxTextAttr& style);
1e181c7a
SC
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 ) ;
0b6a49c2 636 virtual long GetLastPosition() const ;
1e181c7a
SC
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)) { }
ce00f59b 659
9ab7ff53 660 virtual wxSize GetBestSize() const { return wxDefaultSize; }
c072b9ec 661
99eb484a 662 virtual bool SetHint(const wxString& WXUNUSED(hint)) { return false; }
c072b9ec
VZ
663private:
664 wxTextEntry * const m_entry;
665
666 wxDECLARE_NO_COPY_CLASS(wxTextWidgetImpl);
1e181c7a
SC
667};
668
c84030e0
KO
669// common interface for all implementations
670class WXDLLIMPEXP_CORE wxComboWidgetImpl
671
672{
673public :
674 wxComboWidgetImpl() {}
675
676 virtual ~wxComboWidgetImpl() {}
ce00f59b 677
c84030e0
KO
678 virtual int GetSelectedItem() const { return -1; };
679 virtual void SetSelectedItem(int WXUNUSED(item)) {};
ce00f59b 680
c84030e0 681 virtual int GetNumberOfItems() const { return -1; };
ce00f59b 682
c84030e0 683 virtual void InsertItem(int WXUNUSED(pos), const wxString& WXUNUSED(item)) {}
ce00f59b 684
c84030e0 685 virtual void RemoveItem(int WXUNUSED(pos)) {}
ce00f59b 686
c84030e0 687 virtual void Clear() {}
ce00f59b 688
c84030e0 689 virtual wxString GetStringAtIndex(int WXUNUSED(pos)) const { return wxEmptyString; }
ce00f59b 690
c84030e0
KO
691 virtual int FindString(const wxString& WXUNUSED(text)) const { return -1; }
692};
693
411a1c35 694//
b38dc31f 695// common interface for buttons
411a1c35
SC
696//
697
b38dc31f 698class wxButtonImpl
411a1c35
SC
699{
700 public :
b38dc31f
SC
701 wxButtonImpl(){}
702 virtual ~wxButtonImpl(){}
ce00f59b 703
411a1c35
SC
704 virtual void SetPressedBitmap( const wxBitmap& bitmap ) = 0;
705} ;
706
1e181c7a
SC
707//
708// common interface for search controls
709//
710
711class wxSearchWidgetImpl
712{
713public :
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
524c47aa
SC
729//
730// toplevel window implementation class
731//
732
eefe52da
SC
733class wxNonOwnedWindowImpl : public wxObject
734{
735public :
736 wxNonOwnedWindowImpl( wxNonOwnedWindow* nonownedwnd) : m_wxPeer(nonownedwnd)
737 {
738 }
739 wxNonOwnedWindowImpl()
740 {
741 }
742 virtual ~wxNonOwnedWindowImpl()
743 {
744 }
03647350 745
0aaa6ace 746 virtual void WillBeDestroyed()
eefe52da
SC
747 {
748 }
749
750 virtual void Create( wxWindow* parent, const wxPoint& pos, const wxSize& size,
751 long style, long extraStyle, const wxString& name ) = 0;
03647350
VZ
752
753
eefe52da 754 virtual WXWindow GetWXWindow() const = 0;
03647350 755
eefe52da
SC
756 virtual void Raise()
757 {
758 }
03647350 759
eefe52da
SC
760 virtual void Lower()
761 {
762 }
763
1aec1f8b 764 virtual bool Show(bool WXUNUSED(show))
eefe52da
SC
765 {
766 return false;
767 }
03647350 768
1aec1f8b 769 virtual bool ShowWithEffect(bool show, wxShowEffect WXUNUSED(effect), unsigned WXUNUSED(timeout))
eefe52da
SC
770 {
771 return Show(show);
772 }
03647350 773
eefe52da
SC
774 virtual void Update()
775 {
776 }
777
1aec1f8b 778 virtual bool SetTransparent(wxByte WXUNUSED(alpha))
eefe52da
SC
779 {
780 return false;
781 }
782
1aec1f8b 783 virtual bool SetBackgroundColour(const wxColour& WXUNUSED(col) )
eefe52da
SC
784 {
785 return false;
786 }
787
1aec1f8b 788 virtual void SetExtraStyle( long WXUNUSED(exStyle) )
eefe52da
SC
789 {
790 }
ce00f59b 791
b6dc21e7
KO
792 virtual void SetWindowStyleFlag( long WXUNUSED(style) )
793 {
794 }
ce00f59b 795
1aec1f8b 796 virtual bool SetBackgroundStyle(wxBackgroundStyle WXUNUSED(style))
03647350 797 {
eefe52da
SC
798 return false ;
799 }
03647350 800
6f5778a6 801 virtual bool CanSetTransparent()
eefe52da
SC
802 {
803 return false;
804 }
805
03647350 806 virtual void GetContentArea( int &left , int &top , int &width , int &height ) const = 0;
eefe52da
SC
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
1aec1f8b 811 virtual bool SetShape(const wxRegion& WXUNUSED(region))
eefe52da
SC
812 {
813 return false;
814 }
03647350 815
eefe52da 816 virtual void SetTitle( const wxString& title, wxFontEncoding encoding ) = 0;
03647350 817
eefe52da 818 virtual bool IsMaximized() const = 0;
03647350 819
eefe52da 820 virtual bool IsIconized() const= 0;
03647350 821
eefe52da 822 virtual void Iconize( bool iconize )= 0;
03647350 823
eefe52da 824 virtual void Maximize(bool maximize) = 0;
03647350 825
eefe52da 826 virtual bool IsFullScreen() const= 0;
03647350 827
dbc7ceb9 828 virtual void ShowWithoutActivating() { Show(true); }
ce00f59b 829
eefe52da
SC
830 virtual bool ShowFullScreen(bool show, long style)= 0;
831
832 virtual void RequestUserAttention(int flags) = 0;
03647350
VZ
833
834 virtual void ScreenToWindow( int *x, int *y ) = 0;
835
eefe52da 836 virtual void WindowToScreen( int *x, int *y ) = 0;
03647350 837
dbc7ceb9 838 virtual bool IsActive() = 0;
ce00f59b 839
eefe52da 840 wxNonOwnedWindow* GetWXPeer() { return m_wxPeer; }
03647350 841
075e3553
SC
842 static wxNonOwnedWindowImpl*
843 FindFromWXWindow(WXWindow window);
ce00f59b 844
075e3553 845 static void RemoveAssociations( wxNonOwnedWindowImpl* impl);
ce00f59b 846
075e3553 847 static void Associate( WXWindow window, wxNonOwnedWindowImpl *impl );
ce00f59b 848
524c47aa 849 // static creation methods, must be implemented by all toolkits
03647350 850
17e2694c 851 static wxNonOwnedWindowImpl* CreateNonOwnedWindow( wxNonOwnedWindow* wxpeer, wxWindow* parent, WXWindow native) ;
ce00f59b 852
524c47aa
SC
853 static wxNonOwnedWindowImpl* CreateNonOwnedWindow( wxNonOwnedWindow* wxpeer, wxWindow* parent, const wxPoint& pos, const wxSize& size,
854 long style, long extraStyle, const wxString& name ) ;
ce00f59b 855
efb2fa41 856 virtual void SetModified(bool WXUNUSED(modified)) { }
ebf7d5c4 857 virtual bool IsModified() const { return false; }
524c47aa 858
31c659e8
SC
859#if wxOSX_USE_IPHONE
860 virtual CGFloat GetWindowLevel() const { return 0.0; }
861#else
9d243a47 862 virtual CGWindowLevel GetWindowLevel() const { return kCGNormalWindowLevel; }
31c659e8 863#endif
9d243a47 864 virtual void RestoreWindowLevel() {}
eefe52da
SC
865protected :
866 wxNonOwnedWindow* m_wxPeer;
867 DECLARE_ABSTRACT_CLASS(wxNonOwnedWindowImpl)
868};
869
5c6eb3a8
SC
870#endif // wxUSE_GUI
871
872//---------------------------------------------------------------------------
873// cocoa bridging utilities
874//---------------------------------------------------------------------------
875
876bool wxMacInitCocoa();
877
878class WXDLLIMPEXP_CORE wxMacAutoreleasePool
879{
880public :
881 wxMacAutoreleasePool();
882 ~wxMacAutoreleasePool();
883private :
884 void* m_pool;
885};
886
887// NSObject
888
889void wxMacCocoaRelease( void* obj );
890void wxMacCocoaAutorelease( void* obj );
f1c40652 891void* wxMacCocoaRetain( void* obj );
5c6eb3a8
SC
892
893
894#endif
eefe52da 895 // _WX_PRIVATE_CORE_H_