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