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