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