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