]>
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 SC |
207 | |
208 | virtual void SetNeedsDisplay( const wxRect* where = NULL ) = 0; | |
209 | virtual bool GetNeedsDisplay() const = 0; | |
210 | ||
211 | virtual bool NeedsFocusRect() const; | |
212 | virtual void SetNeedsFocusRect( bool needs ); | |
213 | ||
f2f6030e SC |
214 | virtual bool NeedsFrame() const; |
215 | virtual void SetNeedsFrame( bool needs ); | |
216 | ||
eefe52da SC |
217 | virtual bool CanFocus() const = 0; |
218 | // return true if successful | |
219 | virtual bool SetFocus() = 0; | |
220 | virtual bool HasFocus() const = 0; | |
221 | ||
222 | virtual void RemoveFromParent() = 0; | |
223 | virtual void Embed( wxWidgetImpl *parent ) = 0; | |
524c47aa SC |
224 | |
225 | virtual void SetDefaultButton( bool isDefault ) = 0; | |
226 | virtual void PerformClick() = 0; | |
227 | virtual void SetLabel( const wxString& title, wxFontEncoding encoding ) = 0; | |
228 | ||
54f11060 SC |
229 | virtual void SetCursor( const wxCursor & cursor ) = 0; |
230 | virtual void CaptureMouse() = 0; | |
231 | virtual void ReleaseMouse() = 0; | |
232 | ||
524c47aa SC |
233 | virtual wxInt32 GetValue() const = 0; |
234 | virtual void SetValue( wxInt32 v ) = 0; | |
235 | virtual void SetBitmap( const wxBitmap& bitmap ) = 0; | |
236 | virtual void SetupTabs( const wxNotebook ¬ebook ) =0; | |
237 | virtual void GetBestRect( wxRect *r ) const = 0; | |
238 | virtual bool IsEnabled() const = 0; | |
239 | virtual void Enable( bool enable ) = 0; | |
240 | virtual void SetMinimum( wxInt32 v ) = 0; | |
241 | virtual void SetMaximum( wxInt32 v ) = 0; | |
19c7ac3d SC |
242 | virtual wxInt32 GetMinimum() const = 0; |
243 | virtual wxInt32 GetMaximum() const = 0; | |
524c47aa SC |
244 | virtual void PulseGauge() = 0; |
245 | virtual void SetScrollThumb( wxInt32 value, wxInt32 thumbSize ) = 0; | |
246 | ||
1e181c7a SC |
247 | virtual void SetFont( const wxFont & font , const wxColour& foreground , long windowStyle, bool ignoreBlack = true ) = 0; |
248 | ||
524c47aa SC |
249 | // is the clicked event sent AFTER the state already changed, so no additional |
250 | // state changing logic is required from the outside | |
251 | virtual bool ButtonClickDidStateChange() = 0; | |
c4825ef7 SC |
252 | |
253 | virtual void InstallEventHandler( WXWidget control = NULL ) = 0; | |
eefe52da | 254 | |
f55d9f74 SC |
255 | // static methods for associating native controls and their implementations |
256 | ||
257 | static wxWidgetImpl* | |
258 | FindFromWXWidget(WXWidget control); | |
259 | ||
260 | static void RemoveAssociations( wxWidgetImpl* impl); | |
261 | ||
262 | static void Associate( WXWidget control, wxWidgetImpl *impl ); | |
263 | ||
f06e0fea SC |
264 | static WXWidget FindFocus(); |
265 | ||
eefe52da SC |
266 | // static creation methods, must be implemented by all toolkits |
267 | ||
524c47aa SC |
268 | static wxWidgetImplType* CreateUserPane( wxWindowMac* wxpeer, |
269 | wxWindowMac* parent, | |
270 | wxWindowID id, | |
271 | const wxPoint& pos, | |
272 | const wxSize& size, | |
273 | long style, | |
274 | long extraStyle) ; | |
275 | static wxWidgetImplType* CreateContentView( wxNonOwnedWindow* now ) ; | |
276 | ||
277 | static wxWidgetImplType* CreateButton( wxWindowMac* wxpeer, | |
278 | wxWindowMac* parent, | |
279 | wxWindowID id, | |
280 | const wxString& label, | |
281 | const wxPoint& pos, | |
282 | const wxSize& size, | |
283 | long style, | |
284 | long extraStyle) ; | |
285 | ||
286 | static wxWidgetImplType* CreateDisclosureTriangle( wxWindowMac* wxpeer, | |
287 | wxWindowMac* parent, | |
288 | wxWindowID id, | |
289 | const wxString& label, | |
290 | const wxPoint& pos, | |
291 | const wxSize& size, | |
292 | long style, | |
293 | long extraStyle) ; | |
294 | ||
295 | static wxWidgetImplType* CreateStaticLine( wxWindowMac* wxpeer, | |
296 | wxWindowMac* parent, | |
297 | wxWindowID id, | |
298 | const wxPoint& pos, | |
299 | const wxSize& size, | |
300 | long style, | |
301 | long extraStyle) ; | |
302 | ||
303 | static wxWidgetImplType* CreateGroupBox( wxWindowMac* wxpeer, | |
304 | wxWindowMac* parent, | |
305 | wxWindowID id, | |
306 | const wxString& label, | |
307 | const wxPoint& pos, | |
308 | const wxSize& size, | |
309 | long style, | |
310 | long extraStyle) ; | |
311 | ||
312 | static wxWidgetImplType* CreateStaticText( wxWindowMac* wxpeer, | |
313 | wxWindowMac* parent, | |
314 | wxWindowID id, | |
315 | const wxString& label, | |
316 | const wxPoint& pos, | |
317 | const wxSize& size, | |
318 | long style, | |
319 | long extraStyle) ; | |
320 | ||
321 | static wxWidgetImplType* CreateTextControl( wxTextCtrl* wxpeer, | |
322 | wxWindowMac* parent, | |
323 | wxWindowID id, | |
324 | const wxString& content, | |
325 | const wxPoint& pos, | |
326 | const wxSize& size, | |
327 | long style, | |
328 | long extraStyle) ; | |
329 | ||
1e181c7a SC |
330 | static wxWidgetImplType* CreateSearchControl( wxTextCtrl* wxpeer, |
331 | wxWindowMac* parent, | |
332 | wxWindowID id, | |
333 | const wxString& content, | |
334 | const wxPoint& pos, | |
335 | const wxSize& size, | |
336 | long style, | |
337 | long extraStyle) ; | |
338 | ||
524c47aa SC |
339 | static wxWidgetImplType* CreateCheckBox( wxWindowMac* wxpeer, |
340 | wxWindowMac* parent, | |
341 | wxWindowID id, | |
342 | const wxString& label, | |
343 | const wxPoint& pos, | |
344 | const wxSize& size, | |
345 | long style, | |
346 | long extraStyle); | |
347 | ||
348 | static wxWidgetImplType* CreateRadioButton( wxWindowMac* wxpeer, | |
349 | wxWindowMac* parent, | |
350 | wxWindowID id, | |
351 | const wxString& label, | |
352 | const wxPoint& pos, | |
353 | const wxSize& size, | |
354 | long style, | |
355 | long extraStyle); | |
356 | ||
357 | static wxWidgetImplType* CreateToggleButton( wxWindowMac* wxpeer, | |
358 | wxWindowMac* parent, | |
359 | wxWindowID id, | |
360 | const wxString& label, | |
361 | const wxPoint& pos, | |
362 | const wxSize& size, | |
363 | long style, | |
364 | long extraStyle); | |
365 | ||
366 | static wxWidgetImplType* CreateBitmapToggleButton( wxWindowMac* wxpeer, | |
367 | wxWindowMac* parent, | |
368 | wxWindowID id, | |
369 | const wxBitmap& bitmap, | |
370 | const wxPoint& pos, | |
371 | const wxSize& size, | |
372 | long style, | |
373 | long extraStyle); | |
374 | ||
375 | static wxWidgetImplType* CreateBitmapButton( wxWindowMac* wxpeer, | |
376 | wxWindowMac* parent, | |
377 | wxWindowID id, | |
378 | const wxBitmap& bitmap, | |
379 | const wxPoint& pos, | |
380 | const wxSize& size, | |
381 | long style, | |
382 | long extraStyle); | |
383 | ||
384 | static wxWidgetImplType* CreateTabView( wxWindowMac* wxpeer, | |
385 | wxWindowMac* parent, | |
386 | wxWindowID id, | |
387 | const wxPoint& pos, | |
388 | const wxSize& size, | |
389 | long style, | |
390 | long extraStyle); | |
391 | ||
392 | static wxWidgetImplType* CreateGauge( wxWindowMac* wxpeer, | |
393 | wxWindowMac* parent, | |
394 | wxWindowID id, | |
395 | wxInt32 value, | |
396 | wxInt32 minimum, | |
397 | wxInt32 maximum, | |
398 | const wxPoint& pos, | |
399 | const wxSize& size, | |
400 | long style, | |
401 | long extraStyle); | |
402 | ||
403 | static wxWidgetImplType* CreateSlider( wxWindowMac* wxpeer, | |
404 | wxWindowMac* parent, | |
405 | wxWindowID id, | |
406 | wxInt32 value, | |
407 | wxInt32 minimum, | |
408 | wxInt32 maximum, | |
409 | const wxPoint& pos, | |
410 | const wxSize& size, | |
411 | long style, | |
412 | long extraStyle); | |
413 | ||
414 | static wxWidgetImplType* CreateSpinButton( wxWindowMac* wxpeer, | |
415 | wxWindowMac* parent, | |
416 | wxWindowID id, | |
417 | wxInt32 value, | |
418 | wxInt32 minimum, | |
419 | wxInt32 maximum, | |
420 | const wxPoint& pos, | |
421 | const wxSize& size, | |
422 | long style, | |
423 | long extraStyle); | |
424 | ||
425 | static wxWidgetImplType* CreateScrollBar( wxWindowMac* wxpeer, | |
426 | wxWindowMac* parent, | |
427 | wxWindowID id, | |
428 | const wxPoint& pos, | |
429 | const wxSize& size, | |
430 | long style, | |
431 | long extraStyle); | |
432 | ||
433 | static wxWidgetImplType* CreateChoice( wxWindowMac* wxpeer, | |
434 | wxWindowMac* parent, | |
435 | wxWindowID id, | |
436 | wxMenu* menu, | |
437 | const wxPoint& pos, | |
438 | const wxSize& size, | |
439 | long style, | |
440 | long extraStyle); | |
441 | ||
442 | static wxWidgetImplType* CreateListBox( wxWindowMac* wxpeer, | |
443 | wxWindowMac* parent, | |
444 | wxWindowID id, | |
445 | const wxPoint& pos, | |
446 | const wxSize& size, | |
447 | long style, | |
448 | long extraStyle); | |
eefe52da SC |
449 | |
450 | // converts from Toplevel-Content relative to local | |
451 | static void Convert( wxPoint *pt , wxWidgetImpl *from , wxWidgetImpl *to ); | |
452 | protected : | |
453 | bool m_isRootControl; | |
454 | wxWindowMac* m_wxPeer; | |
455 | bool m_needsFocusRect; | |
f2f6030e | 456 | bool m_needsFrame; |
eefe52da SC |
457 | |
458 | DECLARE_ABSTRACT_CLASS(wxWidgetImpl) | |
459 | }; | |
460 | ||
524c47aa SC |
461 | // |
462 | // the interface to be implemented eg by a listbox | |
463 | // | |
464 | ||
524c47aa SC |
465 | class WXDLLIMPEXP_CORE wxListWidgetColumn |
466 | { | |
467 | public : | |
468 | virtual ~wxListWidgetColumn() {} | |
469 | } ; | |
470 | ||
471 | class WXDLLIMPEXP_CORE wxListWidgetCellValue | |
472 | { | |
473 | public : | |
474 | wxListWidgetCellValue() {} | |
475 | virtual ~wxListWidgetCellValue() {} | |
476 | ||
477 | virtual void Set( CFStringRef value ) = 0; | |
478 | virtual void Set( const wxString& value ) = 0; | |
479 | virtual void Set( int value ) = 0; | |
480 | ||
481 | virtual int GetIntValue() const = 0; | |
482 | virtual wxString GetStringValue() const = 0; | |
483 | } ; | |
484 | ||
485 | class WXDLLIMPEXP_CORE wxListWidgetImpl | |
486 | { | |
487 | public: | |
488 | wxListWidgetImpl() {} | |
489 | virtual ~wxListWidgetImpl() { } | |
490 | ||
491 | virtual wxListWidgetColumn* InsertTextColumn( unsigned pos, const wxString& title, bool editable = false, | |
492 | wxAlignment just = wxALIGN_LEFT , int defaultWidth = -1) = 0 ; | |
493 | virtual wxListWidgetColumn* InsertCheckColumn( unsigned pos , const wxString& title, bool editable = false, | |
494 | wxAlignment just = wxALIGN_LEFT , int defaultWidth = -1) = 0 ; | |
495 | ||
496 | // add and remove | |
497 | ||
498 | // TODO will be replaced | |
499 | virtual void ListDelete( unsigned int n ) = 0; | |
500 | virtual void ListInsert( unsigned int n ) = 0; | |
501 | virtual void ListClear() = 0; | |
502 | ||
503 | // selecting | |
504 | ||
505 | virtual void ListDeselectAll() = 0; | |
506 | virtual void ListSetSelection( unsigned int n, bool select, bool multi ) = 0; | |
507 | virtual int ListGetSelection() const = 0; | |
508 | virtual int ListGetSelections( wxArrayInt& aSelections ) const = 0; | |
509 | virtual bool ListIsSelected( unsigned int n ) const = 0; | |
510 | ||
511 | // display | |
512 | ||
513 | virtual void ListScrollTo( unsigned int n ) = 0; | |
514 | virtual void UpdateLine( unsigned int n, wxListWidgetColumn* col = NULL ) = 0; | |
515 | virtual void UpdateLineToEnd( unsigned int n) = 0; | |
516 | ||
517 | // accessing content | |
518 | ||
519 | virtual unsigned int ListGetCount() const = 0; | |
520 | }; | |
521 | ||
1e181c7a SC |
522 | // |
523 | // interface to be implemented by a textcontrol | |
524 | // | |
525 | ||
21a9d326 SC |
526 | class WXDLLIMPEXP_FWD_CORE wxTextAttr; |
527 | ||
1e181c7a SC |
528 | // common interface for all implementations |
529 | class WXDLLIMPEXP_CORE wxTextWidgetImpl | |
530 | ||
531 | { | |
532 | public : | |
533 | wxTextWidgetImpl() {} | |
534 | ||
535 | virtual ~wxTextWidgetImpl() {} | |
536 | ||
537 | virtual bool CanFocus() const { return true; } | |
538 | ||
539 | virtual wxString GetStringValue() const = 0 ; | |
540 | virtual void SetStringValue( const wxString &val ) = 0 ; | |
541 | virtual void SetSelection( long from, long to ) = 0 ; | |
542 | virtual void GetSelection( long* from, long* to ) const = 0 ; | |
543 | virtual void WriteText( const wxString& str ) = 0 ; | |
544 | ||
545 | virtual void SetStyle( long start, long end, const wxTextAttr& style ) ; | |
546 | virtual void Copy() ; | |
547 | virtual void Cut() ; | |
548 | virtual void Paste() ; | |
549 | virtual bool CanPaste() const ; | |
550 | virtual void SetEditable( bool editable ) ; | |
0b6a49c2 | 551 | virtual long GetLastPosition() const ; |
1e181c7a SC |
552 | virtual void Replace( long from, long to, const wxString &str ) ; |
553 | virtual void Remove( long from, long to ) ; | |
554 | ||
555 | ||
556 | virtual bool HasOwnContextMenu() const | |
557 | { return false ; } | |
558 | ||
559 | virtual bool SetupCursor( const wxPoint& WXUNUSED(pt) ) | |
560 | { return false ; } | |
561 | ||
562 | virtual void Clear() ; | |
563 | virtual bool CanUndo() const; | |
564 | virtual void Undo() ; | |
565 | virtual bool CanRedo() const; | |
566 | virtual void Redo() ; | |
567 | virtual int GetNumberOfLines() const ; | |
568 | virtual long XYToPosition(long x, long y) const; | |
569 | virtual bool PositionToXY(long pos, long *x, long *y) const ; | |
570 | virtual void ShowPosition(long WXUNUSED(pos)) ; | |
571 | virtual int GetLineLength(long lineNo) const ; | |
572 | virtual wxString GetLineText(long lineNo) const ; | |
573 | virtual void CheckSpelling(bool WXUNUSED(check)) { } | |
574 | }; | |
575 | ||
576 | // | |
577 | // common interface for search controls | |
578 | // | |
579 | ||
580 | class wxSearchWidgetImpl | |
581 | { | |
582 | public : | |
583 | wxSearchWidgetImpl(){} | |
584 | virtual ~wxSearchWidgetImpl(){} | |
585 | ||
586 | // search field options | |
587 | virtual void ShowSearchButton( bool show ) = 0; | |
588 | virtual bool IsSearchButtonVisible() const = 0; | |
589 | ||
590 | virtual void ShowCancelButton( bool show ) = 0; | |
591 | virtual bool IsCancelButtonVisible() const = 0; | |
592 | ||
593 | virtual void SetSearchMenu( wxMenu* menu ) = 0; | |
594 | ||
595 | virtual void SetDescriptiveText(const wxString& text) = 0; | |
596 | } ; | |
597 | ||
524c47aa SC |
598 | // |
599 | // toplevel window implementation class | |
600 | // | |
601 | ||
eefe52da SC |
602 | class wxNonOwnedWindowImpl : public wxObject |
603 | { | |
604 | public : | |
605 | wxNonOwnedWindowImpl( wxNonOwnedWindow* nonownedwnd) : m_wxPeer(nonownedwnd) | |
606 | { | |
607 | } | |
608 | wxNonOwnedWindowImpl() | |
609 | { | |
610 | } | |
611 | virtual ~wxNonOwnedWindowImpl() | |
612 | { | |
613 | } | |
614 | ||
615 | virtual void Destroy() | |
616 | { | |
617 | } | |
618 | ||
619 | virtual void Create( wxWindow* parent, const wxPoint& pos, const wxSize& size, | |
620 | long style, long extraStyle, const wxString& name ) = 0; | |
621 | ||
622 | ||
623 | virtual WXWindow GetWXWindow() const = 0; | |
624 | ||
625 | virtual void Raise() | |
626 | { | |
627 | } | |
628 | ||
629 | virtual void Lower() | |
630 | { | |
631 | } | |
632 | ||
1aec1f8b | 633 | virtual bool Show(bool WXUNUSED(show)) |
eefe52da SC |
634 | { |
635 | return false; | |
636 | } | |
637 | ||
1aec1f8b | 638 | virtual bool ShowWithEffect(bool show, wxShowEffect WXUNUSED(effect), unsigned WXUNUSED(timeout)) |
eefe52da SC |
639 | { |
640 | return Show(show); | |
641 | } | |
642 | ||
643 | virtual void Update() | |
644 | { | |
645 | } | |
646 | ||
1aec1f8b | 647 | virtual bool SetTransparent(wxByte WXUNUSED(alpha)) |
eefe52da SC |
648 | { |
649 | return false; | |
650 | } | |
651 | ||
1aec1f8b | 652 | virtual bool SetBackgroundColour(const wxColour& WXUNUSED(col) ) |
eefe52da SC |
653 | { |
654 | return false; | |
655 | } | |
656 | ||
1aec1f8b | 657 | virtual void SetExtraStyle( long WXUNUSED(exStyle) ) |
eefe52da SC |
658 | { |
659 | } | |
660 | ||
1aec1f8b | 661 | virtual bool SetBackgroundStyle(wxBackgroundStyle WXUNUSED(style)) |
eefe52da SC |
662 | { |
663 | return false ; | |
664 | } | |
665 | ||
666 | bool CanSetTransparent() | |
667 | { | |
668 | return false; | |
669 | } | |
670 | ||
671 | virtual void GetContentArea( int &left , int &top , int &width , int &height ) const = 0; | |
672 | virtual void MoveWindow(int x, int y, int width, int height) = 0; | |
673 | virtual void GetPosition( int &x, int &y ) const = 0; | |
674 | virtual void GetSize( int &width, int &height ) const = 0; | |
675 | ||
1aec1f8b | 676 | virtual bool SetShape(const wxRegion& WXUNUSED(region)) |
eefe52da SC |
677 | { |
678 | return false; | |
679 | } | |
680 | ||
681 | virtual void SetTitle( const wxString& title, wxFontEncoding encoding ) = 0; | |
682 | ||
683 | virtual bool IsMaximized() const = 0; | |
684 | ||
685 | virtual bool IsIconized() const= 0; | |
686 | ||
687 | virtual void Iconize( bool iconize )= 0; | |
688 | ||
689 | virtual void Maximize(bool maximize) = 0; | |
690 | ||
691 | virtual bool IsFullScreen() const= 0; | |
692 | ||
693 | virtual bool ShowFullScreen(bool show, long style)= 0; | |
694 | ||
695 | virtual void RequestUserAttention(int flags) = 0; | |
696 | ||
697 | virtual void ScreenToWindow( int *x, int *y ) = 0; | |
698 | ||
699 | virtual void WindowToScreen( int *x, int *y ) = 0; | |
700 | ||
701 | wxNonOwnedWindow* GetWXPeer() { return m_wxPeer; } | |
524c47aa SC |
702 | |
703 | // static creation methods, must be implemented by all toolkits | |
704 | ||
705 | static wxNonOwnedWindowImpl* CreateNonOwnedWindow( wxNonOwnedWindow* wxpeer, wxWindow* parent, const wxPoint& pos, const wxSize& size, | |
706 | long style, long extraStyle, const wxString& name ) ; | |
707 | ||
eefe52da SC |
708 | protected : |
709 | wxNonOwnedWindow* m_wxPeer; | |
710 | DECLARE_ABSTRACT_CLASS(wxNonOwnedWindowImpl) | |
711 | }; | |
712 | ||
5c6eb3a8 SC |
713 | #endif // wxUSE_GUI |
714 | ||
715 | //--------------------------------------------------------------------------- | |
716 | // cocoa bridging utilities | |
717 | //--------------------------------------------------------------------------- | |
718 | ||
719 | bool wxMacInitCocoa(); | |
720 | ||
721 | class WXDLLIMPEXP_CORE wxMacAutoreleasePool | |
722 | { | |
723 | public : | |
724 | wxMacAutoreleasePool(); | |
725 | ~wxMacAutoreleasePool(); | |
726 | private : | |
727 | void* m_pool; | |
728 | }; | |
729 | ||
730 | // NSObject | |
731 | ||
732 | void wxMacCocoaRelease( void* obj ); | |
733 | void wxMacCocoaAutorelease( void* obj ); | |
f1c40652 | 734 | void* wxMacCocoaRetain( void* obj ); |
5c6eb3a8 SC |
735 | |
736 | ||
737 | #endif | |
eefe52da | 738 | // _WX_PRIVATE_CORE_H_ |