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