]> git.saurik.com Git - wxWidgets.git/blame - include/wx/osx/core/private.h
Added a virtual wxWindow::OSXGetViewOrWindow() method.
[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
524c47aa 24#if wxOSX_USE_COCOA_OR_CARBON
1e181c7a 25
524c47aa 26WXDLLIMPEXP_BASE long UMAGetSystemVersion() ;
1e181c7a
SC
27
28void WXDLLIMPEXP_CORE wxMacStringToPascal( const wxString&from , unsigned char * to );
29wxString WXDLLIMPEXP_CORE wxMacMakeStringFromPascal( const unsigned char * from );
30
524c47aa
SC
31#endif
32
5c6eb3a8
SC
33#if wxUSE_GUI
34
eefe52da 35#if wxOSX_USE_IPHONE
5c6eb3a8 36#include <CoreGraphics/CoreGraphics.h>
eefe52da 37#else
09f0f2cf 38#include <ApplicationServices/ApplicationServices.h>
eefe52da
SC
39#endif
40
41#include "wx/bitmap.h"
42#include "wx/window.h"
5c6eb3a8
SC
43
44class WXDLLIMPEXP_CORE wxMacCGContextStateSaver
45{
c0c133e1 46 wxDECLARE_NO_COPY_CLASS(wxMacCGContextStateSaver);
5c6eb3a8
SC
47
48public:
49 wxMacCGContextStateSaver( CGContextRef cg )
50 {
51 m_cg = cg;
52 CGContextSaveGState( cg );
53 }
54 ~wxMacCGContextStateSaver()
55 {
56 CGContextRestoreGState( m_cg );
57 }
58private:
59 CGContextRef m_cg;
60};
61
eefe52da
SC
62class WXDLLIMPEXP_CORE wxDeferredObjectDeleter : public wxObject
63{
64public :
03647350 65 wxDeferredObjectDeleter( wxObject* obj ) : m_obj(obj)
eefe52da
SC
66 {
67 }
68 virtual ~wxDeferredObjectDeleter()
69 {
70 delete m_obj;
71 }
72protected :
73 wxObject* m_obj ;
74} ;
5c6eb3a8
SC
75
76// Quartz
77
78WXDLLIMPEXP_CORE CGImageRef wxMacCreateCGImageFromBitmap( const wxBitmap& bitmap );
79
80WXDLLIMPEXP_CORE CGDataProviderRef wxMacCGDataProviderCreateWithCFData( CFDataRef data );
81WXDLLIMPEXP_CORE CGDataConsumerRef wxMacCGDataConsumerCreateWithCFData( CFMutableDataRef data );
82WXDLLIMPEXP_CORE CGDataProviderRef wxMacCGDataProviderCreateWithMemoryBuffer( const wxMemoryBuffer& buf );
83
84CGColorSpaceRef WXDLLIMPEXP_CORE wxMacGetGenericRGBColorSpace(void);
85
eefe52da
SC
86class wxWindowMac;
87// to
88extern wxWindow* g_MacLastWindow;
89class wxNonOwnedWindow;
90
524c47aa
SC
91// temporary typedef so that no additional casts are necessary within carbon code at the moment
92
93class wxMacControl;
94class wxWidgetImpl;
95class wxNotebook;
de24bdf2 96class wxTextCtrl;
524c47aa 97
8fa9ac5e
SC
98WXDLLIMPEXP_CORE wxWindowMac * wxFindWindowFromWXWidget(WXWidget inControl );
99
524c47aa
SC
100#if wxOSX_USE_CARBON
101typedef wxMacControl wxWidgetImplType;
102#else
103typedef wxWidgetImpl wxWidgetImplType;
104#endif
105
6c1f25cc 106#if wxUSE_MENUS
03647350 107class wxMenuItemImpl : public wxObject
524c47aa
SC
108{
109public :
110 wxMenuItemImpl( wxMenuItem* peer ) : m_peer(peer)
111 {
112 }
03647350 113
524c47aa
SC
114 virtual ~wxMenuItemImpl() ;
115 virtual void SetBitmap( const wxBitmap& bitmap ) = 0;
116 virtual void Enable( bool enable ) = 0;
117 virtual void Check( bool check ) = 0;
118 virtual void SetLabel( const wxString& text, wxAcceleratorEntry *entry ) = 0;
119 virtual void Hide( bool hide = true ) = 0;
03647350 120
524c47aa
SC
121 virtual void * GetHMenuItem() = 0;
122
123 wxMenuItem* GetWXPeer() { return m_peer ; }
124
125 static wxMenuItemImpl* Create( wxMenuItem* peer, wxMenu *pParentMenu,
126 int id,
127 const wxString& text,
128 wxAcceleratorEntry *entry,
129 const wxString& strHelp,
130 wxItemKind kind,
131 wxMenu *pSubMenu );
132
133protected :
134 wxMenuItem* m_peer;
03647350 135
69cc4323 136 DECLARE_ABSTRACT_CLASS(wxMenuItemImpl)
524c47aa
SC
137} ;
138
03647350 139class wxMenuImpl : public wxObject
524c47aa
SC
140{
141public :
142 wxMenuImpl( wxMenu* peer ) : m_peer(peer)
143 {
144 }
03647350
VZ
145
146 virtual ~wxMenuImpl() ;
147 virtual void InsertOrAppend(wxMenuItem *pItem, size_t pos) = 0;
524c47aa 148 virtual void Remove( wxMenuItem *pItem ) = 0;
03647350 149
524c47aa
SC
150 virtual void MakeRoot() = 0;
151
152 virtual void SetTitle( const wxString& text ) = 0;
153
154 virtual WXHMENU GetHMenu() = 0;
03647350 155
524c47aa
SC
156 wxMenu* GetWXPeer() { return m_peer ; }
157
2cb5d2d2
SC
158 virtual void PopUp( wxWindow *win, int x, int y ) = 0;
159
524c47aa
SC
160 static wxMenuImpl* Create( wxMenu* peer, const wxString& title );
161 static wxMenuImpl* CreateRootMenu( wxMenu* peer );
162protected :
163 wxMenu* m_peer;
03647350 164
69cc4323 165 DECLARE_ABSTRACT_CLASS(wxMenuItemImpl)
524c47aa 166} ;
6c1f25cc 167#endif
524c47aa
SC
168
169
eefe52da
SC
170class WXDLLIMPEXP_CORE wxWidgetImpl : public wxObject
171{
172public :
173 wxWidgetImpl( wxWindowMac* peer , bool isRootControl = false );
174 wxWidgetImpl();
175 virtual ~wxWidgetImpl();
176
177 void Init();
178
eefe52da
SC
179 bool IsRootControl() const { return m_isRootControl; }
180
181 wxWindowMac* GetWXPeer() const { return m_wxPeer; }
03647350 182
eefe52da
SC
183 bool IsOk() const { return GetWXWidget() != NULL; }
184
185 // not only the control itself, but also all its parents must be visible
186 // in order for this function to return true
187 virtual bool IsVisible() const = 0;
188 // set the visibility of this widget (maybe latent)
189 virtual void SetVisibility( bool visible ) = 0;
190
191 virtual void Raise() = 0;
03647350 192
eefe52da
SC
193 virtual void Lower() = 0;
194
195 virtual void ScrollRect( const wxRect *rect, int dx, int dy ) = 0;
196
197 virtual WXWidget GetWXWidget() const = 0;
03647350 198
eefe52da
SC
199 virtual void SetBackgroundColour( const wxColour& col ) = 0;
200
201 // all coordinates in native parent widget relative coordinates
202 virtual void GetContentArea( int &left , int &top , int &width , int &height ) const = 0;
203 virtual void Move(int x, int y, int width, int height) = 0;
204 virtual void GetPosition( int &x, int &y ) const = 0;
205 virtual void GetSize( int &width, int &height ) const = 0;
524c47aa 206 virtual void SetControlSize( wxWindowVariant variant ) = 0;
eefe52da 207
ee032c59
SC
208 // native view coordinates are topleft to bottom right (flipped regarding CoreGraphics origin)
209 virtual bool IsFlipped() const { return true; }
210
eefe52da
SC
211 virtual void SetNeedsDisplay( const wxRect* where = NULL ) = 0;
212 virtual bool GetNeedsDisplay() const = 0;
213
214 virtual bool NeedsFocusRect() const;
215 virtual void SetNeedsFocusRect( bool needs );
216
f2f6030e
SC
217 virtual bool NeedsFrame() const;
218 virtual void SetNeedsFrame( bool needs );
219
eefe52da
SC
220 virtual bool CanFocus() const = 0;
221 // return true if successful
222 virtual bool SetFocus() = 0;
223 virtual bool HasFocus() const = 0;
03647350 224
eefe52da
SC
225 virtual void RemoveFromParent() = 0;
226 virtual void Embed( wxWidgetImpl *parent ) = 0;
03647350 227
524c47aa
SC
228 virtual void SetDefaultButton( bool isDefault ) = 0;
229 virtual void PerformClick() = 0;
230 virtual void SetLabel( const wxString& title, wxFontEncoding encoding ) = 0;
231
54f11060
SC
232 virtual void SetCursor( const wxCursor & cursor ) = 0;
233 virtual void CaptureMouse() = 0;
234 virtual void ReleaseMouse() = 0;
235
524c47aa
SC
236 virtual wxInt32 GetValue() const = 0;
237 virtual void SetValue( wxInt32 v ) = 0;
e5d05b90 238 virtual wxBitmap GetBitmap() const = 0;
524c47aa 239 virtual void SetBitmap( const wxBitmap& bitmap ) = 0;
e5d05b90 240 virtual void SetBitmapPosition( wxDirection dir ) = 0;
524c47aa
SC
241 virtual void SetupTabs( const wxNotebook &notebook ) =0;
242 virtual void GetBestRect( wxRect *r ) const = 0;
243 virtual bool IsEnabled() const = 0;
244 virtual void Enable( bool enable ) = 0;
245 virtual void SetMinimum( wxInt32 v ) = 0;
246 virtual void SetMaximum( wxInt32 v ) = 0;
19c7ac3d
SC
247 virtual wxInt32 GetMinimum() const = 0;
248 virtual wxInt32 GetMaximum() const = 0;
524c47aa
SC
249 virtual void PulseGauge() = 0;
250 virtual void SetScrollThumb( wxInt32 value, wxInt32 thumbSize ) = 0;
251
1e181c7a
SC
252 virtual void SetFont( const wxFont & font , const wxColour& foreground , long windowStyle, bool ignoreBlack = true ) = 0;
253
524c47aa
SC
254 // is the clicked event sent AFTER the state already changed, so no additional
255 // state changing logic is required from the outside
256 virtual bool ButtonClickDidStateChange() = 0;
03647350 257
c4825ef7 258 virtual void InstallEventHandler( WXWidget control = NULL ) = 0;
eefe52da 259
f55d9f74
SC
260 // static methods for associating native controls and their implementations
261
03647350 262 static wxWidgetImpl*
f55d9f74 263 FindFromWXWidget(WXWidget control);
03647350 264
f55d9f74 265 static void RemoveAssociations( wxWidgetImpl* impl);
03647350 266
f55d9f74 267 static void Associate( WXWidget control, wxWidgetImpl *impl );
03647350 268
f06e0fea 269 static WXWidget FindFocus();
03647350 270
eefe52da 271 // static creation methods, must be implemented by all toolkits
03647350
VZ
272
273 static wxWidgetImplType* CreateUserPane( wxWindowMac* wxpeer,
274 wxWindowMac* parent,
275 wxWindowID id,
276 const wxPoint& pos,
524c47aa 277 const wxSize& size,
03647350 278 long style,
524c47aa
SC
279 long extraStyle) ;
280 static wxWidgetImplType* CreateContentView( wxNonOwnedWindow* now ) ;
281
03647350
VZ
282 static wxWidgetImplType* CreateButton( wxWindowMac* wxpeer,
283 wxWindowMac* parent,
284 wxWindowID id,
524c47aa 285 const wxString& label,
03647350 286 const wxPoint& pos,
524c47aa 287 const wxSize& size,
03647350 288 long style,
524c47aa
SC
289 long extraStyle) ;
290
03647350
VZ
291 static wxWidgetImplType* CreateDisclosureTriangle( wxWindowMac* wxpeer,
292 wxWindowMac* parent,
293 wxWindowID id,
524c47aa 294 const wxString& label,
03647350 295 const wxPoint& pos,
524c47aa 296 const wxSize& size,
03647350 297 long style,
524c47aa 298 long extraStyle) ;
03647350
VZ
299
300 static wxWidgetImplType* CreateStaticLine( wxWindowMac* wxpeer,
301 wxWindowMac* parent,
302 wxWindowID id,
303 const wxPoint& pos,
524c47aa 304 const wxSize& size,
03647350 305 long style,
524c47aa
SC
306 long extraStyle) ;
307
03647350
VZ
308 static wxWidgetImplType* CreateGroupBox( 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* CreateStaticText( 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
SC
324 long extraStyle) ;
325
03647350
VZ
326 static wxWidgetImplType* CreateTextControl( wxTextCtrl* wxpeer,
327 wxWindowMac* parent,
328 wxWindowID id,
524c47aa 329 const wxString& content,
03647350 330 const wxPoint& pos,
524c47aa 331 const wxSize& size,
03647350 332 long style,
524c47aa
SC
333 long extraStyle) ;
334
03647350
VZ
335 static wxWidgetImplType* CreateSearchControl( wxTextCtrl* wxpeer,
336 wxWindowMac* parent,
337 wxWindowID id,
1e181c7a 338 const wxString& content,
03647350 339 const wxPoint& pos,
1e181c7a 340 const wxSize& size,
03647350 341 long style,
1e181c7a
SC
342 long extraStyle) ;
343
03647350
VZ
344 static wxWidgetImplType* CreateCheckBox( wxWindowMac* wxpeer,
345 wxWindowMac* parent,
346 wxWindowID id,
524c47aa 347 const wxString& label,
03647350 348 const wxPoint& pos,
524c47aa 349 const wxSize& size,
03647350 350 long style,
524c47aa 351 long extraStyle);
03647350
VZ
352
353 static wxWidgetImplType* CreateRadioButton( wxWindowMac* wxpeer,
354 wxWindowMac* parent,
355 wxWindowID id,
524c47aa 356 const wxString& label,
03647350 357 const wxPoint& pos,
524c47aa 358 const wxSize& size,
03647350 359 long style,
524c47aa
SC
360 long extraStyle);
361
03647350
VZ
362 static wxWidgetImplType* CreateToggleButton( wxWindowMac* wxpeer,
363 wxWindowMac* parent,
364 wxWindowID id,
524c47aa 365 const wxString& label,
03647350 366 const wxPoint& pos,
524c47aa 367 const wxSize& size,
03647350 368 long style,
524c47aa
SC
369 long extraStyle);
370
03647350
VZ
371 static wxWidgetImplType* CreateBitmapToggleButton( wxWindowMac* wxpeer,
372 wxWindowMac* parent,
373 wxWindowID id,
524c47aa 374 const wxBitmap& bitmap,
03647350 375 const wxPoint& pos,
524c47aa 376 const wxSize& size,
03647350 377 long style,
524c47aa
SC
378 long extraStyle);
379
03647350
VZ
380 static wxWidgetImplType* CreateBitmapButton( wxWindowMac* wxpeer,
381 wxWindowMac* parent,
382 wxWindowID id,
524c47aa 383 const wxBitmap& bitmap,
03647350 384 const wxPoint& pos,
524c47aa 385 const wxSize& size,
03647350 386 long style,
524c47aa
SC
387 long extraStyle);
388
03647350
VZ
389 static wxWidgetImplType* CreateTabView( wxWindowMac* wxpeer,
390 wxWindowMac* parent,
391 wxWindowID id,
392 const wxPoint& pos,
524c47aa 393 const wxSize& size,
03647350 394 long style,
524c47aa
SC
395 long extraStyle);
396
03647350
VZ
397 static wxWidgetImplType* CreateGauge( wxWindowMac* wxpeer,
398 wxWindowMac* parent,
399 wxWindowID id,
524c47aa
SC
400 wxInt32 value,
401 wxInt32 minimum,
402 wxInt32 maximum,
03647350 403 const wxPoint& pos,
524c47aa 404 const wxSize& size,
03647350 405 long style,
524c47aa
SC
406 long extraStyle);
407
03647350
VZ
408 static wxWidgetImplType* CreateSlider( wxWindowMac* wxpeer,
409 wxWindowMac* parent,
410 wxWindowID id,
524c47aa
SC
411 wxInt32 value,
412 wxInt32 minimum,
413 wxInt32 maximum,
03647350 414 const wxPoint& pos,
524c47aa 415 const wxSize& size,
03647350 416 long style,
524c47aa
SC
417 long extraStyle);
418
03647350
VZ
419 static wxWidgetImplType* CreateSpinButton( wxWindowMac* wxpeer,
420 wxWindowMac* parent,
421 wxWindowID id,
524c47aa
SC
422 wxInt32 value,
423 wxInt32 minimum,
424 wxInt32 maximum,
03647350 425 const wxPoint& pos,
524c47aa 426 const wxSize& size,
03647350 427 long style,
524c47aa
SC
428 long extraStyle);
429
03647350
VZ
430 static wxWidgetImplType* CreateScrollBar( wxWindowMac* wxpeer,
431 wxWindowMac* parent,
432 wxWindowID id,
433 const wxPoint& pos,
524c47aa 434 const wxSize& size,
03647350 435 long style,
524c47aa
SC
436 long extraStyle);
437
03647350
VZ
438 static wxWidgetImplType* CreateChoice( wxWindowMac* wxpeer,
439 wxWindowMac* parent,
440 wxWindowID id,
524c47aa 441 wxMenu* menu,
03647350 442 const wxPoint& pos,
524c47aa 443 const wxSize& size,
03647350 444 long style,
524c47aa
SC
445 long extraStyle);
446
03647350
VZ
447 static wxWidgetImplType* CreateListBox( wxWindowMac* wxpeer,
448 wxWindowMac* parent,
449 wxWindowID id,
450 const wxPoint& pos,
524c47aa 451 const wxSize& size,
03647350 452 long style,
524c47aa 453 long extraStyle);
eefe52da
SC
454
455 // converts from Toplevel-Content relative to local
456 static void Convert( wxPoint *pt , wxWidgetImpl *from , wxWidgetImpl *to );
457protected :
458 bool m_isRootControl;
459 wxWindowMac* m_wxPeer;
460 bool m_needsFocusRect;
f2f6030e 461 bool m_needsFrame;
eefe52da
SC
462
463 DECLARE_ABSTRACT_CLASS(wxWidgetImpl)
464};
465
524c47aa
SC
466//
467// the interface to be implemented eg by a listbox
468//
469
03647350 470class WXDLLIMPEXP_CORE wxListWidgetColumn
524c47aa
SC
471{
472public :
473 virtual ~wxListWidgetColumn() {}
474} ;
475
476class WXDLLIMPEXP_CORE wxListWidgetCellValue
477{
478public :
479 wxListWidgetCellValue() {}
480 virtual ~wxListWidgetCellValue() {}
03647350 481
524c47aa
SC
482 virtual void Set( CFStringRef value ) = 0;
483 virtual void Set( const wxString& value ) = 0;
484 virtual void Set( int value ) = 0;
60ebcb8a 485 virtual void Check( bool check );
03647350 486
60ebcb8a 487 virtual bool IsChecked() const;
524c47aa
SC
488 virtual int GetIntValue() const = 0;
489 virtual wxString GetStringValue() const = 0;
490} ;
491
492class WXDLLIMPEXP_CORE wxListWidgetImpl
493{
494public:
495 wxListWidgetImpl() {}
496 virtual ~wxListWidgetImpl() { }
03647350
VZ
497
498 virtual wxListWidgetColumn* InsertTextColumn( unsigned pos, const wxString& title, bool editable = false,
524c47aa 499 wxAlignment just = wxALIGN_LEFT , int defaultWidth = -1) = 0 ;
03647350 500 virtual wxListWidgetColumn* InsertCheckColumn( unsigned pos , const wxString& title, bool editable = false,
524c47aa 501 wxAlignment just = wxALIGN_LEFT , int defaultWidth = -1) = 0 ;
03647350 502
524c47aa
SC
503 // add and remove
504
505 // TODO will be replaced
506 virtual void ListDelete( unsigned int n ) = 0;
507 virtual void ListInsert( unsigned int n ) = 0;
508 virtual void ListClear() = 0;
509
510 // selecting
511
512 virtual void ListDeselectAll() = 0;
513 virtual void ListSetSelection( unsigned int n, bool select, bool multi ) = 0;
514 virtual int ListGetSelection() const = 0;
515 virtual int ListGetSelections( wxArrayInt& aSelections ) const = 0;
516 virtual bool ListIsSelected( unsigned int n ) const = 0;
03647350 517
524c47aa
SC
518 // display
519
520 virtual void ListScrollTo( unsigned int n ) = 0;
521 virtual void UpdateLine( unsigned int n, wxListWidgetColumn* col = NULL ) = 0;
522 virtual void UpdateLineToEnd( unsigned int n) = 0;
523
524 // accessing content
525
526 virtual unsigned int ListGetCount() const = 0;
527};
528
1e181c7a
SC
529//
530// interface to be implemented by a textcontrol
531//
532
21a9d326
SC
533class WXDLLIMPEXP_FWD_CORE wxTextAttr;
534
1e181c7a
SC
535// common interface for all implementations
536class WXDLLIMPEXP_CORE wxTextWidgetImpl
537
538{
539public :
540 wxTextWidgetImpl() {}
541
542 virtual ~wxTextWidgetImpl() {}
543
544 virtual bool CanFocus() const { return true; }
545
546 virtual wxString GetStringValue() const = 0 ;
547 virtual void SetStringValue( const wxString &val ) = 0 ;
548 virtual void SetSelection( long from, long to ) = 0 ;
549 virtual void GetSelection( long* from, long* to ) const = 0 ;
550 virtual void WriteText( const wxString& str ) = 0 ;
551
552 virtual void SetStyle( long start, long end, const wxTextAttr& style ) ;
553 virtual void Copy() ;
554 virtual void Cut() ;
555 virtual void Paste() ;
556 virtual bool CanPaste() const ;
557 virtual void SetEditable( bool editable ) ;
0b6a49c2 558 virtual long GetLastPosition() const ;
1e181c7a
SC
559 virtual void Replace( long from, long to, const wxString &str ) ;
560 virtual void Remove( long from, long to ) ;
561
562
563 virtual bool HasOwnContextMenu() const
564 { return false ; }
565
566 virtual bool SetupCursor( const wxPoint& WXUNUSED(pt) )
567 { return false ; }
568
569 virtual void Clear() ;
570 virtual bool CanUndo() const;
571 virtual void Undo() ;
572 virtual bool CanRedo() const;
573 virtual void Redo() ;
574 virtual int GetNumberOfLines() const ;
575 virtual long XYToPosition(long x, long y) const;
576 virtual bool PositionToXY(long pos, long *x, long *y) const ;
577 virtual void ShowPosition(long WXUNUSED(pos)) ;
578 virtual int GetLineLength(long lineNo) const ;
579 virtual wxString GetLineText(long lineNo) const ;
580 virtual void CheckSpelling(bool WXUNUSED(check)) { }
581};
582
583//
584// common interface for search controls
585//
586
587class wxSearchWidgetImpl
588{
589public :
590 wxSearchWidgetImpl(){}
591 virtual ~wxSearchWidgetImpl(){}
592
593 // search field options
594 virtual void ShowSearchButton( bool show ) = 0;
595 virtual bool IsSearchButtonVisible() const = 0;
596
597 virtual void ShowCancelButton( bool show ) = 0;
598 virtual bool IsCancelButtonVisible() const = 0;
599
600 virtual void SetSearchMenu( wxMenu* menu ) = 0;
601
602 virtual void SetDescriptiveText(const wxString& text) = 0;
603} ;
604
524c47aa
SC
605//
606// toplevel window implementation class
607//
608
eefe52da
SC
609class wxNonOwnedWindowImpl : public wxObject
610{
611public :
612 wxNonOwnedWindowImpl( wxNonOwnedWindow* nonownedwnd) : m_wxPeer(nonownedwnd)
613 {
614 }
615 wxNonOwnedWindowImpl()
616 {
617 }
618 virtual ~wxNonOwnedWindowImpl()
619 {
620 }
03647350
VZ
621
622 virtual void Destroy()
eefe52da
SC
623 {
624 }
625
626 virtual void Create( wxWindow* parent, const wxPoint& pos, const wxSize& size,
627 long style, long extraStyle, const wxString& name ) = 0;
03647350
VZ
628
629
eefe52da 630 virtual WXWindow GetWXWindow() const = 0;
03647350 631
eefe52da
SC
632 virtual void Raise()
633 {
634 }
03647350 635
eefe52da
SC
636 virtual void Lower()
637 {
638 }
639
1aec1f8b 640 virtual bool Show(bool WXUNUSED(show))
eefe52da
SC
641 {
642 return false;
643 }
03647350 644
1aec1f8b 645 virtual bool ShowWithEffect(bool show, wxShowEffect WXUNUSED(effect), unsigned WXUNUSED(timeout))
eefe52da
SC
646 {
647 return Show(show);
648 }
03647350 649
eefe52da
SC
650 virtual void Update()
651 {
652 }
653
1aec1f8b 654 virtual bool SetTransparent(wxByte WXUNUSED(alpha))
eefe52da
SC
655 {
656 return false;
657 }
658
1aec1f8b 659 virtual bool SetBackgroundColour(const wxColour& WXUNUSED(col) )
eefe52da
SC
660 {
661 return false;
662 }
663
1aec1f8b 664 virtual void SetExtraStyle( long WXUNUSED(exStyle) )
eefe52da
SC
665 {
666 }
03647350 667
1aec1f8b 668 virtual bool SetBackgroundStyle(wxBackgroundStyle WXUNUSED(style))
03647350 669 {
eefe52da
SC
670 return false ;
671 }
03647350 672
eefe52da
SC
673 bool CanSetTransparent()
674 {
675 return false;
676 }
677
03647350 678 virtual void GetContentArea( int &left , int &top , int &width , int &height ) const = 0;
eefe52da
SC
679 virtual void MoveWindow(int x, int y, int width, int height) = 0;
680 virtual void GetPosition( int &x, int &y ) const = 0;
681 virtual void GetSize( int &width, int &height ) const = 0;
682
1aec1f8b 683 virtual bool SetShape(const wxRegion& WXUNUSED(region))
eefe52da
SC
684 {
685 return false;
686 }
03647350 687
eefe52da 688 virtual void SetTitle( const wxString& title, wxFontEncoding encoding ) = 0;
03647350 689
eefe52da 690 virtual bool IsMaximized() const = 0;
03647350 691
eefe52da 692 virtual bool IsIconized() const= 0;
03647350 693
eefe52da 694 virtual void Iconize( bool iconize )= 0;
03647350 695
eefe52da 696 virtual void Maximize(bool maximize) = 0;
03647350 697
eefe52da 698 virtual bool IsFullScreen() const= 0;
03647350 699
eefe52da
SC
700 virtual bool ShowFullScreen(bool show, long style)= 0;
701
702 virtual void RequestUserAttention(int flags) = 0;
03647350
VZ
703
704 virtual void ScreenToWindow( int *x, int *y ) = 0;
705
eefe52da 706 virtual void WindowToScreen( int *x, int *y ) = 0;
03647350 707
eefe52da 708 wxNonOwnedWindow* GetWXPeer() { return m_wxPeer; }
03647350 709
524c47aa 710 // static creation methods, must be implemented by all toolkits
03647350 711
524c47aa
SC
712 static wxNonOwnedWindowImpl* CreateNonOwnedWindow( wxNonOwnedWindow* wxpeer, wxWindow* parent, const wxPoint& pos, const wxSize& size,
713 long style, long extraStyle, const wxString& name ) ;
714
eefe52da
SC
715protected :
716 wxNonOwnedWindow* m_wxPeer;
717 DECLARE_ABSTRACT_CLASS(wxNonOwnedWindowImpl)
718};
719
5c6eb3a8
SC
720#endif // wxUSE_GUI
721
722//---------------------------------------------------------------------------
723// cocoa bridging utilities
724//---------------------------------------------------------------------------
725
726bool wxMacInitCocoa();
727
728class WXDLLIMPEXP_CORE wxMacAutoreleasePool
729{
730public :
731 wxMacAutoreleasePool();
732 ~wxMacAutoreleasePool();
733private :
734 void* m_pool;
735};
736
737// NSObject
738
739void wxMacCocoaRelease( void* obj );
740void wxMacCocoaAutorelease( void* obj );
f1c40652 741void* wxMacCocoaRetain( void* obj );
5c6eb3a8
SC
742
743
744#endif
eefe52da 745 // _WX_PRIVATE_CORE_H_