]>
Commit | Line | Data |
---|---|---|
1 | ///////////////////////////////////////////////////////////////////////////// | |
2 | // Name: wx/osx/core/private.h | |
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 | ||
14 | #ifndef _WX_PRIVATE_CORE_H_ | |
15 | #define _WX_PRIVATE_CORE_H_ | |
16 | ||
17 | #include "wx/defs.h" | |
18 | ||
19 | #include <CoreFoundation/CoreFoundation.h> | |
20 | ||
21 | #include "wx/osx/core/cfstring.h" | |
22 | #include "wx/osx/core/cfdataref.h" | |
23 | ||
24 | #if wxOSX_USE_COCOA_OR_CARBON | |
25 | ||
26 | WXDLLIMPEXP_BASE long UMAGetSystemVersion() ; | |
27 | ||
28 | void WXDLLIMPEXP_CORE wxMacStringToPascal( const wxString&from , unsigned char * to ); | |
29 | wxString WXDLLIMPEXP_CORE wxMacMakeStringFromPascal( const unsigned char * from ); | |
30 | ||
31 | #endif | |
32 | ||
33 | #if wxUSE_GUI | |
34 | ||
35 | #if wxOSX_USE_IPHONE | |
36 | #include <CoreGraphics/CoreGraphics.h> | |
37 | #else | |
38 | #include <ApplicationServices/ApplicationServices.h> | |
39 | #endif | |
40 | ||
41 | #include "wx/bitmap.h" | |
42 | #include "wx/window.h" | |
43 | ||
44 | class WXDLLIMPEXP_CORE wxMacCGContextStateSaver | |
45 | { | |
46 | wxDECLARE_NO_COPY_CLASS(wxMacCGContextStateSaver); | |
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 | ||
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 | } ; | |
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 | ||
86 | class wxWindowMac; | |
87 | // to | |
88 | extern wxWindow* g_MacLastWindow; | |
89 | class wxNonOwnedWindow; | |
90 | ||
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; | |
96 | class wxTextCtrl; | |
97 | ||
98 | WXDLLIMPEXP_CORE wxWindowMac * wxFindWindowFromWXWidget(WXWidget inControl ); | |
99 | ||
100 | #if wxOSX_USE_CARBON | |
101 | typedef wxMacControl wxWidgetImplType; | |
102 | #else | |
103 | typedef wxWidgetImpl wxWidgetImplType; | |
104 | #endif | |
105 | ||
106 | #if wxUSE_MENUS | |
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 | ||
136 | DECLARE_ABSTRACT_CLASS(wxMenuItemImpl) | |
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 | ||
158 | virtual void PopUp( wxWindow *win, int x, int y ) = 0; | |
159 | ||
160 | static wxMenuImpl* Create( wxMenu* peer, const wxString& title ); | |
161 | static wxMenuImpl* CreateRootMenu( wxMenu* peer ); | |
162 | protected : | |
163 | wxMenu* m_peer; | |
164 | ||
165 | DECLARE_ABSTRACT_CLASS(wxMenuItemImpl) | |
166 | } ; | |
167 | #endif | |
168 | ||
169 | ||
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 | ||
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; | |
206 | virtual void SetControlSize( wxWindowVariant variant ) = 0; | |
207 | ||
208 | // native view coordinates are topleft to bottom right (flipped regarding CoreGraphics origin) | |
209 | virtual bool IsFlipped() const { return true; } | |
210 | ||
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 | ||
217 | virtual bool NeedsFrame() const; | |
218 | virtual void SetNeedsFrame( bool needs ); | |
219 | ||
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; | |
227 | ||
228 | virtual void SetDefaultButton( bool isDefault ) = 0; | |
229 | virtual void PerformClick() = 0; | |
230 | virtual void SetLabel( const wxString& title, wxFontEncoding encoding ) = 0; | |
231 | ||
232 | virtual void SetCursor( const wxCursor & cursor ) = 0; | |
233 | virtual void CaptureMouse() = 0; | |
234 | virtual void ReleaseMouse() = 0; | |
235 | ||
236 | virtual wxInt32 GetValue() const = 0; | |
237 | virtual void SetValue( wxInt32 v ) = 0; | |
238 | virtual wxBitmap GetBitmap() const = 0; | |
239 | virtual void SetBitmap( const wxBitmap& bitmap ) = 0; | |
240 | virtual void SetBitmapPosition( wxDirection dir ) = 0; | |
241 | virtual void SetupTabs( const wxNotebook ¬ebook ) =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; | |
247 | virtual wxInt32 GetMinimum() const = 0; | |
248 | virtual wxInt32 GetMaximum() const = 0; | |
249 | virtual void PulseGauge() = 0; | |
250 | virtual void SetScrollThumb( wxInt32 value, wxInt32 thumbSize ) = 0; | |
251 | ||
252 | virtual void SetFont( const wxFont & font , const wxColour& foreground , long windowStyle, bool ignoreBlack = true ) = 0; | |
253 | ||
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; | |
257 | ||
258 | virtual void InstallEventHandler( WXWidget control = NULL ) = 0; | |
259 | ||
260 | // static methods for associating native controls and their implementations | |
261 | ||
262 | static wxWidgetImpl* | |
263 | FindFromWXWidget(WXWidget control); | |
264 | ||
265 | static void RemoveAssociations( wxWidgetImpl* impl); | |
266 | ||
267 | static void Associate( WXWidget control, wxWidgetImpl *impl ); | |
268 | ||
269 | static WXWidget FindFocus(); | |
270 | ||
271 | // static creation methods, must be implemented by all toolkits | |
272 | ||
273 | static wxWidgetImplType* CreateUserPane( wxWindowMac* wxpeer, | |
274 | wxWindowMac* parent, | |
275 | wxWindowID id, | |
276 | const wxPoint& pos, | |
277 | const wxSize& size, | |
278 | long style, | |
279 | long extraStyle) ; | |
280 | static wxWidgetImplType* CreateContentView( wxNonOwnedWindow* now ) ; | |
281 | ||
282 | static wxWidgetImplType* CreateButton( wxWindowMac* wxpeer, | |
283 | wxWindowMac* parent, | |
284 | wxWindowID id, | |
285 | const wxString& label, | |
286 | const wxPoint& pos, | |
287 | const wxSize& size, | |
288 | long style, | |
289 | long extraStyle) ; | |
290 | ||
291 | static wxWidgetImplType* CreateDisclosureTriangle( wxWindowMac* wxpeer, | |
292 | wxWindowMac* parent, | |
293 | wxWindowID id, | |
294 | const wxString& label, | |
295 | const wxPoint& pos, | |
296 | const wxSize& size, | |
297 | long style, | |
298 | long extraStyle) ; | |
299 | ||
300 | static wxWidgetImplType* CreateStaticLine( wxWindowMac* wxpeer, | |
301 | wxWindowMac* parent, | |
302 | wxWindowID id, | |
303 | const wxPoint& pos, | |
304 | const wxSize& size, | |
305 | long style, | |
306 | long extraStyle) ; | |
307 | ||
308 | static wxWidgetImplType* CreateGroupBox( wxWindowMac* wxpeer, | |
309 | wxWindowMac* parent, | |
310 | wxWindowID id, | |
311 | const wxString& label, | |
312 | const wxPoint& pos, | |
313 | const wxSize& size, | |
314 | long style, | |
315 | long extraStyle) ; | |
316 | ||
317 | static wxWidgetImplType* CreateStaticText( wxWindowMac* wxpeer, | |
318 | wxWindowMac* parent, | |
319 | wxWindowID id, | |
320 | const wxString& label, | |
321 | const wxPoint& pos, | |
322 | const wxSize& size, | |
323 | long style, | |
324 | long extraStyle) ; | |
325 | ||
326 | static wxWidgetImplType* CreateTextControl( wxTextCtrl* wxpeer, | |
327 | wxWindowMac* parent, | |
328 | wxWindowID id, | |
329 | const wxString& content, | |
330 | const wxPoint& pos, | |
331 | const wxSize& size, | |
332 | long style, | |
333 | long extraStyle) ; | |
334 | ||
335 | static wxWidgetImplType* CreateSearchControl( wxTextCtrl* wxpeer, | |
336 | wxWindowMac* parent, | |
337 | wxWindowID id, | |
338 | const wxString& content, | |
339 | const wxPoint& pos, | |
340 | const wxSize& size, | |
341 | long style, | |
342 | long extraStyle) ; | |
343 | ||
344 | static wxWidgetImplType* CreateCheckBox( wxWindowMac* wxpeer, | |
345 | wxWindowMac* parent, | |
346 | wxWindowID id, | |
347 | const wxString& label, | |
348 | const wxPoint& pos, | |
349 | const wxSize& size, | |
350 | long style, | |
351 | long extraStyle); | |
352 | ||
353 | static wxWidgetImplType* CreateRadioButton( wxWindowMac* wxpeer, | |
354 | wxWindowMac* parent, | |
355 | wxWindowID id, | |
356 | const wxString& label, | |
357 | const wxPoint& pos, | |
358 | const wxSize& size, | |
359 | long style, | |
360 | long extraStyle); | |
361 | ||
362 | static wxWidgetImplType* CreateToggleButton( wxWindowMac* wxpeer, | |
363 | wxWindowMac* parent, | |
364 | wxWindowID id, | |
365 | const wxString& label, | |
366 | const wxPoint& pos, | |
367 | const wxSize& size, | |
368 | long style, | |
369 | long extraStyle); | |
370 | ||
371 | static wxWidgetImplType* CreateBitmapToggleButton( wxWindowMac* wxpeer, | |
372 | wxWindowMac* parent, | |
373 | wxWindowID id, | |
374 | const wxBitmap& bitmap, | |
375 | const wxPoint& pos, | |
376 | const wxSize& size, | |
377 | long style, | |
378 | long extraStyle); | |
379 | ||
380 | static wxWidgetImplType* CreateBitmapButton( wxWindowMac* wxpeer, | |
381 | wxWindowMac* parent, | |
382 | wxWindowID id, | |
383 | const wxBitmap& bitmap, | |
384 | const wxPoint& pos, | |
385 | const wxSize& size, | |
386 | long style, | |
387 | long extraStyle); | |
388 | ||
389 | static wxWidgetImplType* CreateTabView( wxWindowMac* wxpeer, | |
390 | wxWindowMac* parent, | |
391 | wxWindowID id, | |
392 | const wxPoint& pos, | |
393 | const wxSize& size, | |
394 | long style, | |
395 | long extraStyle); | |
396 | ||
397 | static wxWidgetImplType* CreateGauge( wxWindowMac* wxpeer, | |
398 | wxWindowMac* parent, | |
399 | wxWindowID id, | |
400 | wxInt32 value, | |
401 | wxInt32 minimum, | |
402 | wxInt32 maximum, | |
403 | const wxPoint& pos, | |
404 | const wxSize& size, | |
405 | long style, | |
406 | long extraStyle); | |
407 | ||
408 | static wxWidgetImplType* CreateSlider( wxWindowMac* wxpeer, | |
409 | wxWindowMac* parent, | |
410 | wxWindowID id, | |
411 | wxInt32 value, | |
412 | wxInt32 minimum, | |
413 | wxInt32 maximum, | |
414 | const wxPoint& pos, | |
415 | const wxSize& size, | |
416 | long style, | |
417 | long extraStyle); | |
418 | ||
419 | static wxWidgetImplType* CreateSpinButton( wxWindowMac* wxpeer, | |
420 | wxWindowMac* parent, | |
421 | wxWindowID id, | |
422 | wxInt32 value, | |
423 | wxInt32 minimum, | |
424 | wxInt32 maximum, | |
425 | const wxPoint& pos, | |
426 | const wxSize& size, | |
427 | long style, | |
428 | long extraStyle); | |
429 | ||
430 | static wxWidgetImplType* CreateScrollBar( wxWindowMac* wxpeer, | |
431 | wxWindowMac* parent, | |
432 | wxWindowID id, | |
433 | const wxPoint& pos, | |
434 | const wxSize& size, | |
435 | long style, | |
436 | long extraStyle); | |
437 | ||
438 | static wxWidgetImplType* CreateChoice( wxWindowMac* wxpeer, | |
439 | wxWindowMac* parent, | |
440 | wxWindowID id, | |
441 | wxMenu* menu, | |
442 | const wxPoint& pos, | |
443 | const wxSize& size, | |
444 | long style, | |
445 | long extraStyle); | |
446 | ||
447 | static wxWidgetImplType* CreateListBox( wxWindowMac* wxpeer, | |
448 | wxWindowMac* parent, | |
449 | wxWindowID id, | |
450 | const wxPoint& pos, | |
451 | const wxSize& size, | |
452 | long style, | |
453 | long extraStyle); | |
454 | ||
455 | // converts from Toplevel-Content relative to local | |
456 | static void Convert( wxPoint *pt , wxWidgetImpl *from , wxWidgetImpl *to ); | |
457 | protected : | |
458 | bool m_isRootControl; | |
459 | wxWindowMac* m_wxPeer; | |
460 | bool m_needsFocusRect; | |
461 | bool m_needsFrame; | |
462 | ||
463 | DECLARE_ABSTRACT_CLASS(wxWidgetImpl) | |
464 | }; | |
465 | ||
466 | // | |
467 | // the interface to be implemented eg by a listbox | |
468 | // | |
469 | ||
470 | class WXDLLIMPEXP_CORE wxListWidgetColumn | |
471 | { | |
472 | public : | |
473 | virtual ~wxListWidgetColumn() {} | |
474 | } ; | |
475 | ||
476 | class WXDLLIMPEXP_CORE wxListWidgetCellValue | |
477 | { | |
478 | public : | |
479 | wxListWidgetCellValue() {} | |
480 | virtual ~wxListWidgetCellValue() {} | |
481 | ||
482 | virtual void Set( CFStringRef value ) = 0; | |
483 | virtual void Set( const wxString& value ) = 0; | |
484 | virtual void Set( int value ) = 0; | |
485 | virtual void Check( bool check ); | |
486 | ||
487 | virtual bool IsChecked() const; | |
488 | virtual int GetIntValue() const = 0; | |
489 | virtual wxString GetStringValue() const = 0; | |
490 | } ; | |
491 | ||
492 | class WXDLLIMPEXP_CORE wxListWidgetImpl | |
493 | { | |
494 | public: | |
495 | wxListWidgetImpl() {} | |
496 | virtual ~wxListWidgetImpl() { } | |
497 | ||
498 | virtual wxListWidgetColumn* InsertTextColumn( unsigned pos, const wxString& title, bool editable = false, | |
499 | wxAlignment just = wxALIGN_LEFT , int defaultWidth = -1) = 0 ; | |
500 | virtual wxListWidgetColumn* InsertCheckColumn( unsigned pos , const wxString& title, bool editable = false, | |
501 | wxAlignment just = wxALIGN_LEFT , int defaultWidth = -1) = 0 ; | |
502 | ||
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; | |
517 | ||
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 | ||
529 | // | |
530 | // interface to be implemented by a textcontrol | |
531 | // | |
532 | ||
533 | class WXDLLIMPEXP_FWD_CORE wxTextAttr; | |
534 | ||
535 | // common interface for all implementations | |
536 | class WXDLLIMPEXP_CORE wxTextWidgetImpl | |
537 | ||
538 | { | |
539 | public : | |
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 ) ; | |
558 | virtual long GetLastPosition() const ; | |
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 | ||
587 | class wxSearchWidgetImpl | |
588 | { | |
589 | public : | |
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 | ||
605 | // | |
606 | // toplevel window implementation class | |
607 | // | |
608 | ||
609 | class wxNonOwnedWindowImpl : public wxObject | |
610 | { | |
611 | public : | |
612 | wxNonOwnedWindowImpl( wxNonOwnedWindow* nonownedwnd) : m_wxPeer(nonownedwnd) | |
613 | { | |
614 | } | |
615 | wxNonOwnedWindowImpl() | |
616 | { | |
617 | } | |
618 | virtual ~wxNonOwnedWindowImpl() | |
619 | { | |
620 | } | |
621 | ||
622 | virtual void Destroy() | |
623 | { | |
624 | } | |
625 | ||
626 | virtual void Create( wxWindow* parent, const wxPoint& pos, const wxSize& size, | |
627 | long style, long extraStyle, const wxString& name ) = 0; | |
628 | ||
629 | ||
630 | virtual WXWindow GetWXWindow() const = 0; | |
631 | ||
632 | virtual void Raise() | |
633 | { | |
634 | } | |
635 | ||
636 | virtual void Lower() | |
637 | { | |
638 | } | |
639 | ||
640 | virtual bool Show(bool WXUNUSED(show)) | |
641 | { | |
642 | return false; | |
643 | } | |
644 | ||
645 | virtual bool ShowWithEffect(bool show, wxShowEffect WXUNUSED(effect), unsigned WXUNUSED(timeout)) | |
646 | { | |
647 | return Show(show); | |
648 | } | |
649 | ||
650 | virtual void Update() | |
651 | { | |
652 | } | |
653 | ||
654 | virtual bool SetTransparent(wxByte WXUNUSED(alpha)) | |
655 | { | |
656 | return false; | |
657 | } | |
658 | ||
659 | virtual bool SetBackgroundColour(const wxColour& WXUNUSED(col) ) | |
660 | { | |
661 | return false; | |
662 | } | |
663 | ||
664 | virtual void SetExtraStyle( long WXUNUSED(exStyle) ) | |
665 | { | |
666 | } | |
667 | ||
668 | virtual bool SetBackgroundStyle(wxBackgroundStyle WXUNUSED(style)) | |
669 | { | |
670 | return false ; | |
671 | } | |
672 | ||
673 | bool CanSetTransparent() | |
674 | { | |
675 | return false; | |
676 | } | |
677 | ||
678 | virtual void GetContentArea( int &left , int &top , int &width , int &height ) const = 0; | |
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 | ||
683 | virtual bool SetShape(const wxRegion& WXUNUSED(region)) | |
684 | { | |
685 | return false; | |
686 | } | |
687 | ||
688 | virtual void SetTitle( const wxString& title, wxFontEncoding encoding ) = 0; | |
689 | ||
690 | virtual bool IsMaximized() const = 0; | |
691 | ||
692 | virtual bool IsIconized() const= 0; | |
693 | ||
694 | virtual void Iconize( bool iconize )= 0; | |
695 | ||
696 | virtual void Maximize(bool maximize) = 0; | |
697 | ||
698 | virtual bool IsFullScreen() const= 0; | |
699 | ||
700 | virtual bool ShowFullScreen(bool show, long style)= 0; | |
701 | ||
702 | virtual void RequestUserAttention(int flags) = 0; | |
703 | ||
704 | virtual void ScreenToWindow( int *x, int *y ) = 0; | |
705 | ||
706 | virtual void WindowToScreen( int *x, int *y ) = 0; | |
707 | ||
708 | wxNonOwnedWindow* GetWXPeer() { return m_wxPeer; } | |
709 | ||
710 | // static creation methods, must be implemented by all toolkits | |
711 | ||
712 | static wxNonOwnedWindowImpl* CreateNonOwnedWindow( wxNonOwnedWindow* wxpeer, wxWindow* parent, const wxPoint& pos, const wxSize& size, | |
713 | long style, long extraStyle, const wxString& name ) ; | |
714 | ||
715 | protected : | |
716 | wxNonOwnedWindow* m_wxPeer; | |
717 | DECLARE_ABSTRACT_CLASS(wxNonOwnedWindowImpl) | |
718 | }; | |
719 | ||
720 | #endif // wxUSE_GUI | |
721 | ||
722 | //--------------------------------------------------------------------------- | |
723 | // cocoa bridging utilities | |
724 | //--------------------------------------------------------------------------- | |
725 | ||
726 | bool wxMacInitCocoa(); | |
727 | ||
728 | class WXDLLIMPEXP_CORE wxMacAutoreleasePool | |
729 | { | |
730 | public : | |
731 | wxMacAutoreleasePool(); | |
732 | ~wxMacAutoreleasePool(); | |
733 | private : | |
734 | void* m_pool; | |
735 | }; | |
736 | ||
737 | // NSObject | |
738 | ||
739 | void wxMacCocoaRelease( void* obj ); | |
740 | void wxMacCocoaAutorelease( void* obj ); | |
741 | void* wxMacCocoaRetain( void* obj ); | |
742 | ||
743 | ||
744 | #endif | |
745 | // _WX_PRIVATE_CORE_H_ |