rtti api mods added
[wxWidgets.git] / include / wx / window.h
1 ///////////////////////////////////////////////////////////////////////////////
2 // Name: wx/window.h
3 // Purpose: wxWindowBase class - the interface of wxWindow
4 // Author: Vadim Zeitlin
5 // Modified by: Ron Lee
6 // Created: 01/02/97
7 // RCS-ID: $Id$
8 // Copyright: (c) wxWindows team
9 // Licence: wxWindows licence
10 ///////////////////////////////////////////////////////////////////////////////
11
12 #ifndef _WX_WINDOW_H_BASE_
13 #define _WX_WINDOW_H_BASE_
14
15 #if defined(__GNUG__) && !defined(NO_GCC_PRAGMA)
16 #pragma interface "windowbase.h"
17 #endif
18
19 // ----------------------------------------------------------------------------
20 // headers which we must include here
21 // ----------------------------------------------------------------------------
22
23 #include "wx/event.h" // the base class
24
25 #include "wx/list.h" // defines wxWindowList
26
27 #include "wx/cursor.h" // we have member variables of these classes
28 #include "wx/font.h" // so we can't do without them
29 #include "wx/colour.h"
30 #include "wx/region.h"
31 #include "wx/utils.h"
32
33 #include "wx/validate.h" // for wxDefaultValidator (always include it)
34
35 #if wxUSE_PALETTE
36 #include "wx/palette.h"
37 #endif // wxUSE_PALETTE
38
39 #if wxUSE_ACCEL
40 #include "wx/accel.h"
41 #endif // wxUSE_ACCEL
42
43 #if wxUSE_ACCESSIBILITY
44 #include "wx/access.h"
45 #endif
46
47 // when building wxUniv/Foo we don't want the code for native menu use to be
48 // compiled in - it should only be used when building real wxFoo
49 #ifdef __WXUNIVERSAL__
50 #define wxUSE_MENUS_NATIVE 0
51 #else // __WXMSW__
52 #define wxUSE_MENUS_NATIVE wxUSE_MENUS
53 #endif // __WXUNIVERSAL__/__WXMSW__
54
55 // ----------------------------------------------------------------------------
56 // forward declarations
57 // ----------------------------------------------------------------------------
58
59 class WXDLLEXPORT wxCaret;
60 class WXDLLEXPORT wxControl;
61 class WXDLLEXPORT wxCursor;
62 class WXDLLEXPORT wxDC;
63 class WXDLLEXPORT wxDropTarget;
64 class WXDLLEXPORT wxItemResource;
65 class WXDLLEXPORT wxLayoutConstraints;
66 class WXDLLEXPORT wxResourceTable;
67 class WXDLLEXPORT wxSizer;
68 class WXDLLEXPORT wxToolTip;
69 class WXDLLEXPORT wxWindowBase;
70 class WXDLLEXPORT wxWindow;
71
72 #if wxUSE_ACCESSIBILITY
73 class WXDLLEXPORT wxAccessible;
74 #endif
75
76 // ----------------------------------------------------------------------------
77 // (pseudo)template list classes
78 // ----------------------------------------------------------------------------
79
80 WX_DECLARE_LIST_3(wxWindow, wxWindowBase, wxWindowList, wxWindowListNode, class WXDLLEXPORT);
81
82 // ----------------------------------------------------------------------------
83 // global variables
84 // ----------------------------------------------------------------------------
85
86 WXDLLEXPORT_DATA(extern wxWindowList) wxTopLevelWindows;
87
88 // ----------------------------------------------------------------------------
89 // wxWindowBase is the base class for all GUI controls/widgets, this is the public
90 // interface of this class.
91 //
92 // Event handler: windows have themselves as their event handlers by default,
93 // but their event handlers could be set to another object entirely. This
94 // separation can reduce the amount of derivation required, and allow
95 // alteration of a window's functionality (e.g. by a resource editor that
96 // temporarily switches event handlers).
97 // ----------------------------------------------------------------------------
98
99 class WXDLLEXPORT wxWindowBase : public wxEvtHandler
100 {
101 public:
102 // creating the window
103 // -------------------
104
105 // default ctor
106 wxWindowBase() { InitBase(); }
107
108 // pseudo ctor (can't be virtual, called from ctor)
109 bool CreateBase(wxWindowBase *parent,
110 wxWindowID winid,
111 const wxPoint& pos = wxDefaultPosition,
112 const wxSize& size = wxDefaultSize,
113 long style = 0,
114 const wxValidator& validator = wxDefaultValidator,
115 const wxString& name = wxPanelNameStr);
116
117 virtual ~wxWindowBase();
118
119 // deleting the window
120 // -------------------
121
122 // ask the window to close itself, return TRUE if the event handler
123 // honoured our request
124 bool Close( bool force = FALSE );
125
126 // the following functions delete the C++ objects (the window itself
127 // or its children) as well as the GUI windows and normally should
128 // never be used directly
129
130 // delete window unconditionally (dangerous!), returns TRUE if ok
131 virtual bool Destroy();
132 // delete all children of this window, returns TRUE if ok
133 bool DestroyChildren();
134
135 // is the window being deleted?
136 bool IsBeingDeleted() const { return m_isBeingDeleted; }
137
138 // window attributes
139 // -----------------
140
141 // NB: in future versions of wxWindows Set/GetTitle() will only work
142 // with the top level windows (such as dialogs and frames) and
143 // Set/GetLabel() only with the other ones (i.e. all controls).
144
145 // the title (or label, see below) of the window: the text which the
146 // window shows
147 virtual void SetTitle( const wxString& WXUNUSED(title) ) {}
148 virtual wxString GetTitle() const { return wxEmptyString; }
149
150 // label is just the same as the title (but for, e.g., buttons it
151 // makes more sense to speak about labels)
152 virtual void SetLabel(const wxString& label) { SetTitle(label); }
153 virtual wxString GetLabel() const { return GetTitle(); }
154
155 // the window name is used for ressource setting in X, it is not the
156 // same as the window title/label
157 virtual void SetName( const wxString &name ) { m_windowName = name; }
158 virtual wxString GetName() const { return m_windowName; }
159
160 // window id uniquely identifies the window among its siblings unless
161 // it is -1 which means "don't care"
162 void SetId( wxWindowID winid ) { m_windowId = winid; }
163 wxWindowID GetId() const { return m_windowId; }
164
165 // generate a control id for the controls which were not given one by
166 // user
167 static int NewControlId() { return --ms_lastControlId; }
168 // get the id of the control following the one with the given
169 // (autogenerated) id
170 static int NextControlId(int winid) { return winid - 1; }
171 // get the id of the control preceding the one with the given
172 // (autogenerated) id
173 static int PrevControlId(int winid) { return winid + 1; }
174
175 // moving/resizing
176 // ---------------
177
178 // set the window size and/or position
179 void SetSize( int x, int y, int width, int height,
180 int sizeFlags = wxSIZE_AUTO )
181 { DoSetSize(x, y, width, height, sizeFlags); }
182
183 void SetSize( int width, int height )
184 { DoSetSize( -1, -1, width, height, wxSIZE_USE_EXISTING ); }
185
186 void SetSize( const wxSize& size )
187 { SetSize( size.x, size.y); }
188
189 void SetSize(const wxRect& rect, int sizeFlags = wxSIZE_AUTO)
190 { DoSetSize(rect.x, rect.y, rect.width, rect.height, sizeFlags); }
191
192 void Move(int x, int y, int flags = wxSIZE_USE_EXISTING)
193 { DoSetSize(x, y, -1, -1, flags); }
194
195 void Move(const wxPoint& pt, int flags = wxSIZE_USE_EXISTING)
196 { Move(pt.x, pt.y, flags); }
197
198 // Z-order
199 virtual void Raise() = 0;
200 virtual void Lower() = 0;
201
202 // client size is the size of area available for subwindows
203 void SetClientSize( int width, int height )
204 { DoSetClientSize(width, height); }
205
206 void SetClientSize( const wxSize& size )
207 { DoSetClientSize(size.x, size.y); }
208
209 void SetClientSize(const wxRect& rect)
210 { SetClientSize( rect.width, rect.height ); }
211
212 // get the window position and/or size (pointers may be NULL)
213 void GetPosition( int *x, int *y ) const { DoGetPosition(x, y); }
214 wxPoint GetPosition() const
215 {
216 int w, h;
217 DoGetPosition(&w, &h);
218
219 return wxPoint(w, h);
220 }
221
222 void SetPosition( const wxPoint& pt ) { Move( pt ) ; }
223
224 void GetSize( int *w, int *h ) const { DoGetSize(w, h); }
225 wxSize GetSize() const
226 {
227 int w, h;
228 DoGetSize(& w, & h);
229 return wxSize(w, h);
230 }
231
232 // the following are just helper functions to help some compiler with the extended rtti inf
233 void SetWindowPosition( const wxPoint &pt) { SetPosition( pt ) ; }
234 wxPoint GetWindowPosition() const { return GetPosition() ; }
235
236 void SetWindowSize( const wxSize &sz ) { SetSize( sz ) ; }
237 wxSize GetWindowSize() const { return GetSize() ; }
238
239 wxRect GetRect() const
240 {
241 int x, y, w, h;
242 GetPosition(& x, & y);
243 GetSize(& w, & h);
244
245 return wxRect(x, y, w, h);
246 }
247
248 void GetClientSize( int *w, int *h ) const { DoGetClientSize(w, h); }
249 wxSize GetClientSize() const
250 {
251 int w, h;
252 DoGetClientSize(& w, & h);
253
254 return wxSize(w, h);
255 }
256
257 // get the origin of the client area of the window relative to the
258 // window top left corner (the client area may be shifted because of
259 // the borders, scrollbars, other decorations...)
260 virtual wxPoint GetClientAreaOrigin() const;
261
262 // get the client rectangle in window (i.e. client) coordinates
263 wxRect GetClientRect() const
264 {
265 return wxRect(GetClientAreaOrigin(), GetClientSize());
266 }
267
268 // get the size best suited for the window (in fact, minimal
269 // acceptable size using which it will still look "nice")
270 wxSize GetBestSize() const { return DoGetBestSize(); }
271 void GetBestSize(int *w, int *h) const
272 {
273 wxSize s = DoGetBestSize();
274 if ( w )
275 *w = s.x;
276 if ( h )
277 *h = s.y;
278 }
279
280 // There are times (and windows) where 'Best' size and 'Min' size
281 // are vastly out of sync. This should be remedied somehow, but in
282 // the meantime, this method will return the larger of BestSize
283 // (the window's smallest legible size), and any user specified
284 // MinSize hint.
285 wxSize GetAdjustedBestSize() const
286 {
287 wxSize s( DoGetBestSize() );
288 return wxSize( wxMax( s.x, GetMinWidth() ), wxMax( s.y, GetMinHeight() ) );
289 }
290
291 // the generic centre function - centers the window on parent by`
292 // default or on screen if it doesn't have parent or
293 // wxCENTER_ON_SCREEN flag is given
294 void Centre( int direction = wxBOTH );
295 void Center( int direction = wxBOTH ) { Centre(direction); }
296
297 // centre on screen (only works for top level windows)
298 void CentreOnScreen(int dir = wxBOTH) { Centre(dir | wxCENTER_ON_SCREEN); }
299 void CenterOnScreen(int dir = wxBOTH) { CentreOnScreen(dir); }
300
301 // centre with respect to the the parent window
302 void CentreOnParent(int dir = wxBOTH) { Centre(dir | wxCENTER_FRAME); }
303 void CenterOnParent(int dir = wxBOTH) { CentreOnParent(dir); }
304
305 // set window size to wrap around its children
306 virtual void Fit();
307
308 // set virtual size to satisfy children
309 virtual void FitInside();
310
311 // set min/max size of the window
312 virtual void SetSizeHints( int minW, int minH,
313 int maxW = -1, int maxH = -1,
314 int incW = -1, int incH = -1 );
315
316 virtual void SetVirtualSizeHints( int minW, int minH,
317 int maxW = -1, int maxH = -1 );
318
319 virtual int GetMinWidth() const { return m_minWidth; }
320 virtual int GetMinHeight() const { return m_minHeight; }
321 int GetMaxWidth() const { return m_maxWidth; }
322 int GetMaxHeight() const { return m_maxHeight; }
323
324 // Override this method to control the values given to Sizers etc.
325 virtual wxSize GetMaxSize() const { return wxSize( m_maxWidth, m_maxHeight ); }
326
327 // Methods for accessing the virtual size of a window. For most
328 // windows this is just the client area of the window, but for
329 // some like scrolled windows it is more or less independent of
330 // the screen window size. You may override the DoXXXVirtual
331 // methods below for classes where that is is the case.
332
333 void SetVirtualSize( const wxSize &size ) { DoSetVirtualSize( size.x, size.y ); }
334 void SetVirtualSize( int x, int y ) { DoSetVirtualSize( x, y ); }
335
336 wxSize GetVirtualSize() const { return DoGetVirtualSize(); }
337 void GetVirtualSize( int *x, int *y ) const
338 {
339 wxSize s( DoGetVirtualSize() );
340
341 if( x )
342 *x = s.GetWidth();
343 if( y )
344 *y = s.GetHeight();
345 }
346
347 // Override these methods for windows that have a virtual size
348 // independent of their client size. eg. the virtual area of a
349 // wxScrolledWindow. Default is to alias VirtualSize to ClientSize.
350
351 virtual void DoSetVirtualSize( int x, int y );
352 virtual wxSize DoGetVirtualSize() const; // { return m_virtualSize; }
353
354 // Return the largest of ClientSize and BestSize (as determined
355 // by a sizer, interior children, or other means)
356
357 virtual wxSize GetBestVirtualSize() const
358 {
359 wxSize client( GetClientSize() );
360 wxSize best( GetBestSize() );
361
362 return wxSize( wxMax( client.x, best.x ), wxMax( client.y, best.y ) );
363 }
364
365 // window state
366 // ------------
367
368 // returns TRUE if window was shown/hidden, FALSE if the nothing was
369 // done (window was already shown/hidden)
370 virtual bool Show( bool show = TRUE );
371 bool Hide() { return Show(FALSE); }
372
373 // returns TRUE if window was enabled/disabled, FALSE if nothing done
374 virtual bool Enable( bool enable = TRUE );
375 bool Disable() { return Enable(FALSE); }
376
377 bool IsShown() const { return m_isShown; }
378 bool IsEnabled() const { return m_isEnabled; }
379
380 // get/set window style (setting style won't update the window and so
381 // is only useful for internal usage)
382 virtual void SetWindowStyleFlag( long style ) { m_windowStyle = style; }
383 virtual long GetWindowStyleFlag() const { return m_windowStyle; }
384
385 // just some (somewhat shorter) synonims
386 void SetWindowStyle( long style ) { SetWindowStyleFlag(style); }
387 long GetWindowStyle() const { return GetWindowStyleFlag(); }
388
389 bool HasFlag(int flag) const { return (m_windowStyle & flag) != 0; }
390 virtual bool IsRetained() const { return HasFlag(wxRETAINED); }
391
392 // extra style: the less often used style bits which can't be set with
393 // SetWindowStyleFlag()
394 virtual void SetExtraStyle(long exStyle) { m_exStyle = exStyle; }
395 long GetExtraStyle() const { return m_exStyle; }
396
397 // make the window modal (all other windows unresponsive)
398 virtual void MakeModal(bool modal = TRUE);
399
400 virtual void SetThemeEnabled(bool enableTheme) { m_themeEnabled = enableTheme; }
401 virtual bool GetThemeEnabled() const { return m_themeEnabled; }
402
403 // focus and keyboard handling
404 // ---------------------------
405
406 // set focus to this window
407 virtual void SetFocus() = 0;
408
409 // set focus to this window as the result of a keyboard action
410 virtual void SetFocusFromKbd() { SetFocus(); }
411
412 // return the window which currently has the focus or NULL
413 static wxWindow *FindFocus() /* = 0: implement in derived classes */;
414
415 // can this window have focus?
416 virtual bool AcceptsFocus() const { return IsShown() && IsEnabled(); }
417
418 // can this window be given focus by keyboard navigation? if not, the
419 // only way to give it focus (provided it accepts it at all) is to
420 // click it
421 virtual bool AcceptsFocusFromKeyboard() const { return AcceptsFocus(); }
422
423 // NB: these methods really don't belong here but with the current
424 // class hierarchy there is no other place for them :-(
425
426 // get the default child of this parent, i.e. the one which is
427 // activated by pressing <Enter>
428 virtual wxWindow *GetDefaultItem() const { return NULL; }
429
430 // set this child as default, return the old default
431 virtual wxWindow *SetDefaultItem(wxWindow * WXUNUSED(child))
432 { return NULL; }
433
434 // set this child as temporary default
435 virtual void SetTmpDefaultItem(wxWindow * WXUNUSED(win)) { }
436
437 // parent/children relations
438 // -------------------------
439
440 // get the list of children
441 const wxWindowList& GetChildren() const { return m_children; }
442 wxWindowList& GetChildren() { return m_children; }
443
444 // needed just for extended runtime
445 const wxWindowList& GetWindowChildren() const { return GetChildren() ; }
446
447 // get the parent or the parent of the parent
448 wxWindow *GetParent() const { return m_parent; }
449 inline wxWindow *GetGrandParent() const;
450
451 // is this window a top level one?
452 virtual bool IsTopLevel() const;
453
454 // it doesn't really change parent, use ReParent() instead
455 void SetParent( wxWindowBase *parent ) { m_parent = (wxWindow *)parent; }
456 // change the real parent of this window, return TRUE if the parent
457 // was changed, FALSE otherwise (error or newParent == oldParent)
458 virtual bool Reparent( wxWindowBase *newParent );
459
460 // implementation mostly
461 virtual void AddChild( wxWindowBase *child );
462 virtual void RemoveChild( wxWindowBase *child );
463
464 // looking for windows
465 // -------------------
466
467 // find window among the descendants of this one either by id or by
468 // name (return NULL if not found)
469 wxWindow *FindWindow( long winid );
470 wxWindow *FindWindow( const wxString& name );
471
472 // Find a window among any window (all return NULL if not found)
473 static wxWindow *FindWindowById( long winid, const wxWindow *parent = NULL );
474 static wxWindow *FindWindowByName( const wxString& name,
475 const wxWindow *parent = NULL );
476 static wxWindow *FindWindowByLabel( const wxString& label,
477 const wxWindow *parent = NULL );
478
479 // event handler stuff
480 // -------------------
481
482 // get the current event handler
483 wxEvtHandler *GetEventHandler() const { return m_eventHandler; }
484
485 // replace the event handler (allows to completely subclass the
486 // window)
487 void SetEventHandler( wxEvtHandler *handler ) { m_eventHandler = handler; }
488
489 // push/pop event handler: allows to chain a custom event handler to
490 // alreasy existing ones
491 void PushEventHandler( wxEvtHandler *handler );
492 wxEvtHandler *PopEventHandler( bool deleteHandler = FALSE );
493
494 // find the given handler in the event handler chain and remove (but
495 // not delete) it from the event handler chain, return TRUE if it was
496 // found and FALSE otherwise (this also results in an assert failure so
497 // this function should only be called when the handler is supposed to
498 // be there)
499 bool RemoveEventHandler(wxEvtHandler *handler);
500
501 // validators
502 // ----------
503
504 #if wxUSE_VALIDATORS
505 // a window may have an associated validator which is used to control
506 // user input
507 virtual void SetValidator( const wxValidator &validator );
508 virtual wxValidator *GetValidator() { return m_windowValidator; }
509 #endif // wxUSE_VALIDATORS
510
511
512 // dialog oriented functions
513 // -------------------------
514
515 // validate the correctness of input, return TRUE if ok
516 virtual bool Validate();
517
518 // transfer data between internal and GUI representations
519 virtual bool TransferDataToWindow();
520 virtual bool TransferDataFromWindow();
521
522 virtual void InitDialog();
523
524 #if wxUSE_ACCEL
525 // accelerators
526 // ------------
527 virtual void SetAcceleratorTable( const wxAcceleratorTable& accel )
528 { m_acceleratorTable = accel; }
529 wxAcceleratorTable *GetAcceleratorTable()
530 { return &m_acceleratorTable; }
531
532 #endif // wxUSE_ACCEL
533
534 #if wxUSE_HOTKEY
535 // hot keys (system wide accelerators)
536 // -----------------------------------
537
538 virtual bool RegisterHotKey(int hotkeyId, int modifiers, int keycode);
539 virtual bool UnregisterHotKey(int hotkeyId);
540 #endif // wxUSE_HOTKEY
541
542
543 // dialog units translations
544 // -------------------------
545
546 wxPoint ConvertPixelsToDialog( const wxPoint& pt );
547 wxPoint ConvertDialogToPixels( const wxPoint& pt );
548 wxSize ConvertPixelsToDialog( const wxSize& sz )
549 {
550 wxPoint pt(ConvertPixelsToDialog(wxPoint(sz.x, sz.y)));
551
552 return wxSize(pt.x, pt.y);
553 }
554
555 wxSize ConvertDialogToPixels( const wxSize& sz )
556 {
557 wxPoint pt(ConvertDialogToPixels(wxPoint(sz.x, sz.y)));
558
559 return wxSize(pt.x, pt.y);
560 }
561
562 // mouse functions
563 // ---------------
564
565 // move the mouse to the specified position
566 virtual void WarpPointer(int x, int y) = 0;
567
568 // start or end mouse capture, these functions maintain the stack of
569 // windows having captured the mouse and after calling ReleaseMouse()
570 // the mouse is not released but returns to the window which had had
571 // captured it previously (if any)
572 void CaptureMouse();
573 void ReleaseMouse();
574
575 // get the window which currently captures the mouse or NULL
576 static wxWindow *GetCapture();
577
578 // does this window have the capture?
579 virtual bool HasCapture() const
580 { return (wxWindow *)this == GetCapture(); }
581
582 // painting the window
583 // -------------------
584
585 // mark the specified rectangle (or the whole window) as "dirty" so it
586 // will be repainted
587 virtual void Refresh( bool eraseBackground = TRUE,
588 const wxRect *rect = (const wxRect *) NULL ) = 0;
589
590 // a less awkward wrapper for Refresh
591 void RefreshRect(const wxRect& rect) { Refresh(TRUE, &rect); }
592
593 // repaint all invalid areas of the window immediately
594 virtual void Update() { }
595
596 // clear the window background
597 virtual void ClearBackground();
598
599 // freeze the window: don't redraw it until it is thawed
600 virtual void Freeze() { }
601
602 // thaw the window: redraw it after it had been frozen
603 virtual void Thaw() { }
604
605 // adjust DC for drawing on this window
606 virtual void PrepareDC( wxDC & WXUNUSED(dc) ) { }
607
608 // the update region of the window contains the areas which must be
609 // repainted by the program
610 const wxRegion& GetUpdateRegion() const { return m_updateRegion; }
611 wxRegion& GetUpdateRegion() { return m_updateRegion; }
612
613 // get the update rectangleregion bounding box in client coords
614 wxRect GetUpdateClientRect() const;
615
616 // these functions verify whether the given point/rectangle belongs to
617 // (or at least intersects with) the update region
618 bool IsExposed( int x, int y ) const;
619 bool IsExposed( int x, int y, int w, int h ) const;
620
621 bool IsExposed( const wxPoint& pt ) const
622 { return IsExposed(pt.x, pt.y); }
623 bool IsExposed( const wxRect& rect ) const
624 { return IsExposed(rect.x, rect.y, rect.width, rect.height); }
625
626 // colours, fonts and cursors
627 // --------------------------
628
629 // set/retrieve the window colours (system defaults are used by
630 // default): Set functions return TRUE if colour was changed
631 virtual bool SetBackgroundColour( const wxColour &colour );
632 virtual bool SetForegroundColour( const wxColour &colour );
633
634 wxColour GetBackgroundColour() const { return m_backgroundColour; }
635 wxColour GetForegroundColour() const { return m_foregroundColour; }
636
637 // set/retrieve the cursor for this window (SetCursor() returns TRUE
638 // if the cursor was really changed)
639 virtual bool SetCursor( const wxCursor &cursor );
640 const wxCursor& GetCursor() const { return m_cursor; }
641 wxCursor& GetCursor() { return m_cursor; }
642
643 // set/retrieve the font for the window (SetFont() returns TRUE if the
644 // font really changed)
645 virtual bool SetFont( const wxFont &font ) = 0;
646 const wxFont& GetFont() const { return m_font; }
647 wxFont& GetFont() { return m_font; }
648
649 // for resolving RTTI conflicts
650 wxFont GetWindowFont() const { return GetFont() ; }
651
652 #if wxUSE_CARET
653 // associate a caret with the window
654 void SetCaret(wxCaret *caret);
655 // get the current caret (may be NULL)
656 wxCaret *GetCaret() const { return m_caret; }
657 #endif // wxUSE_CARET
658
659 // get the (average) character size for the current font
660 virtual int GetCharHeight() const = 0;
661 virtual int GetCharWidth() const = 0;
662
663 // get the width/height/... of the text using current or specified
664 // font
665 virtual void GetTextExtent(const wxString& string,
666 int *x, int *y,
667 int *descent = (int *) NULL,
668 int *externalLeading = (int *) NULL,
669 const wxFont *theFont = (const wxFont *) NULL)
670 const = 0;
671
672 // client <-> screen coords
673 // ------------------------
674
675 // translate to/from screen/client coordinates (pointers may be NULL)
676 void ClientToScreen( int *x, int *y ) const
677 { DoClientToScreen(x, y); }
678 void ScreenToClient( int *x, int *y ) const
679 { DoScreenToClient(x, y); }
680
681 // wxPoint interface to do the same thing
682 wxPoint ClientToScreen(const wxPoint& pt) const
683 {
684 int x = pt.x, y = pt.y;
685 DoClientToScreen(&x, &y);
686
687 return wxPoint(x, y);
688 }
689
690 wxPoint ScreenToClient(const wxPoint& pt) const
691 {
692 int x = pt.x, y = pt.y;
693 DoScreenToClient(&x, &y);
694
695 return wxPoint(x, y);
696 }
697
698 // test where the given (in client coords) point lies
699 wxHitTest HitTest(wxCoord x, wxCoord y) const
700 { return DoHitTest(x, y); }
701
702 wxHitTest HitTest(const wxPoint& pt) const
703 { return DoHitTest(pt.x, pt.y); }
704
705 // misc
706 // ----
707
708 // get the window border style from the given flags: this is different from
709 // simply doing flags & wxBORDER_MASK because it uses GetDefaultBorder() to
710 // translate wxBORDER_DEFAULT to something reasonable
711 wxBorder GetBorder(long flags) const;
712
713 // get border for the flags of this window
714 wxBorder GetBorder() const { return GetBorder(GetWindowStyleFlag()); }
715
716 // send wxUpdateUIEvents to this window, and children if recurse is TRUE
717 virtual void UpdateWindowUI(long flags = wxUPDATE_UI_NONE);
718
719 // do the window-specific processing after processing the update event
720 virtual void DoUpdateWindowUI(wxUpdateUIEvent& event) ;
721
722 #if wxUSE_MENUS
723 bool PopupMenu( wxMenu *menu, const wxPoint& pos )
724 { return DoPopupMenu(menu, pos.x, pos.y); }
725 bool PopupMenu( wxMenu *menu, int x, int y )
726 { return DoPopupMenu(menu, x, y); }
727 #endif // wxUSE_MENUS
728
729 // scrollbars
730 // ----------
731
732 // does the window have the scrollbar for this orientation?
733 bool HasScrollbar(int orient) const
734 {
735 return (m_windowStyle &
736 (orient == wxHORIZONTAL ? wxHSCROLL : wxVSCROLL)) != 0;
737 }
738
739 // configure the window scrollbars
740 virtual void SetScrollbar( int orient,
741 int pos,
742 int thumbvisible,
743 int range,
744 bool refresh = TRUE ) = 0;
745 virtual void SetScrollPos( int orient, int pos, bool refresh = TRUE ) = 0;
746 virtual int GetScrollPos( int orient ) const = 0;
747 virtual int GetScrollThumb( int orient ) const = 0;
748 virtual int GetScrollRange( int orient ) const = 0;
749
750 // scroll window to the specified position
751 virtual void ScrollWindow( int dx, int dy,
752 const wxRect* rect = (wxRect *) NULL ) = 0;
753
754 // scrolls window by line/page: note that not all controls support this
755 //
756 // return TRUE if the position changed, FALSE otherwise
757 virtual bool ScrollLines(int WXUNUSED(lines)) { return FALSE; }
758 virtual bool ScrollPages(int WXUNUSED(pages)) { return FALSE; }
759
760 // convenient wrappers for ScrollLines/Pages
761 bool LineUp() { return ScrollLines(-1); }
762 bool LineDown() { return ScrollLines(1); }
763 bool PageUp() { return ScrollPages(-1); }
764 bool PageDown() { return ScrollPages(1); }
765
766 // context-sensitive help
767 // ----------------------
768
769 // these are the convenience functions wrapping wxHelpProvider methods
770
771 #if wxUSE_HELP
772 // associate this help text with this window
773 void SetHelpText(const wxString& text);
774 // associate this help text with all windows with the same id as this
775 // one
776 void SetHelpTextForId(const wxString& text);
777 // get the help string associated with this window (may be empty)
778 wxString GetHelpText() const;
779 #endif // wxUSE_HELP
780
781 // tooltips
782 // --------
783
784 #if wxUSE_TOOLTIPS
785 // the easiest way to set a tooltip for a window is to use this method
786 void SetToolTip( const wxString &tip );
787 // attach a tooltip to the window
788 void SetToolTip( wxToolTip *tip ) { DoSetToolTip(tip); }
789 // get the associated tooltip or NULL if none
790 wxToolTip* GetToolTip() const { return m_tooltip; }
791 wxString GetToolTipText() const ;
792 #endif // wxUSE_TOOLTIPS
793
794 // drag and drop
795 // -------------
796 #if wxUSE_DRAG_AND_DROP
797 // set/retrieve the drop target associated with this window (may be
798 // NULL; it's owned by the window and will be deleted by it)
799 virtual void SetDropTarget( wxDropTarget *dropTarget ) = 0;
800 virtual wxDropTarget *GetDropTarget() const { return m_dropTarget; }
801 #endif // wxUSE_DRAG_AND_DROP
802
803 // constraints and sizers
804 // ----------------------
805 #if wxUSE_CONSTRAINTS
806 // set the constraints for this window or retrieve them (may be NULL)
807 void SetConstraints( wxLayoutConstraints *constraints );
808 wxLayoutConstraints *GetConstraints() const { return m_constraints; }
809
810 // implementation only
811 void UnsetConstraints(wxLayoutConstraints *c);
812 wxWindowList *GetConstraintsInvolvedIn() const
813 { return m_constraintsInvolvedIn; }
814 void AddConstraintReference(wxWindowBase *otherWin);
815 void RemoveConstraintReference(wxWindowBase *otherWin);
816 void DeleteRelatedConstraints();
817 void ResetConstraints();
818
819 // these methods may be overriden for special layout algorithms
820 virtual void SetConstraintSizes(bool recurse = TRUE);
821 virtual bool LayoutPhase1(int *noChanges);
822 virtual bool LayoutPhase2(int *noChanges);
823 virtual bool DoPhase(int phase);
824
825 // these methods are virtual but normally won't be overridden
826 virtual void SetSizeConstraint(int x, int y, int w, int h);
827 virtual void MoveConstraint(int x, int y);
828 virtual void GetSizeConstraint(int *w, int *h) const ;
829 virtual void GetClientSizeConstraint(int *w, int *h) const ;
830 virtual void GetPositionConstraint(int *x, int *y) const ;
831
832 #endif // wxUSE_CONSTRAINTS
833
834 // when using constraints or sizers, it makes sense to update
835 // children positions automatically whenever the window is resized
836 // - this is done if autoLayout is on
837 void SetAutoLayout( bool autoLayout ) { m_autoLayout = autoLayout; }
838 bool GetAutoLayout() const { return m_autoLayout; }
839
840 // lay out the window and its children
841 virtual bool Layout();
842
843 // sizers
844 void SetSizer(wxSizer *sizer, bool deleteOld = TRUE );
845 void SetSizerAndFit( wxSizer *sizer, bool deleteOld = TRUE );
846
847 wxSizer *GetSizer() const { return m_windowSizer; }
848
849 // Track if this window is a member of a sizer
850 void SetContainingSizer(wxSizer* sizer)
851 {
852 // adding a window to a sizer twice is going to result in fatal and
853 // hard to debug problems later because when deleting the second
854 // associated wxSizerItem we're going to dereference a dangling
855 // pointer; so try to detect this as early as possible
856 wxASSERT_MSG( !sizer || m_containingSizer != sizer,
857 _T("Adding a window to the same sizer twice?") );
858
859 m_containingSizer = sizer;
860 }
861 wxSizer *GetContainingSizer() const { return m_containingSizer; }
862
863 // accessibility
864 // ----------------------
865 #if wxUSE_ACCESSIBILITY
866 // Override to create a specific accessible object.
867 virtual wxAccessible* CreateAccessible();
868
869 // Sets the accessible object.
870 void SetAccessible(wxAccessible* accessible) ;
871
872 // Returns the accessible object.
873 wxAccessible* GetAccessible() { return m_accessible; };
874
875 // Returns the accessible object, creating if necessary.
876 wxAccessible* GetOrCreateAccessible() ;
877 #endif
878
879 // implementation
880 // --------------
881
882 // event handlers
883 void OnSysColourChanged( wxSysColourChangedEvent& event );
884 void OnInitDialog( wxInitDialogEvent &event );
885 void OnMiddleClick( wxMouseEvent& event );
886 #if wxUSE_HELP
887 void OnHelp(wxHelpEvent& event);
888 #endif // wxUSE_HELP
889
890 // virtual function for implementing internal idle
891 // behaviour
892 virtual void OnInternalIdle() {}
893
894 // call internal idle recursively
895 // void ProcessInternalIdle() ;
896
897 // get the handle of the window for the underlying window system: this
898 // is only used for wxWin itself or for user code which wants to call
899 // platform-specific APIs
900 virtual WXWidget GetHandle() const = 0;
901
902 #if wxUSE_PALETTE
903 // Store the palette used by DCs in wxWindow so that the dcs can share
904 // a palette. And we can respond to palette messages.
905 wxPalette GetPalette() const { return m_palette; }
906
907 // When palette is changed tell the DC to set the system palette to the
908 // new one.
909 void SetPalette(const wxPalette& pal);
910
911 // return true if we have a specific palette
912 bool HasCustomPalette() const { return m_hasCustomPalette; }
913
914 // return the first parent window with a custom palette or NULL
915 wxWindow *GetAncestorWithCustomPalette() const;
916 #endif // wxUSE_PALETTE
917
918 protected:
919 // event handling specific to wxWindow
920 virtual bool TryValidator(wxEvent& event);
921 virtual bool TryParent(wxEvent& event);
922
923
924 #if wxUSE_CONSTRAINTS
925 // satisfy the constraints for the windows but don't set the window sizes
926 void SatisfyConstraints();
927 #endif // wxUSE_CONSTRAINTS
928
929 // Send the wxWindowDestroyEvent
930 void SendDestroyEvent();
931
932 // the window id - a number which uniquely identifies a window among
933 // its siblings unless it is -1
934 wxWindowID m_windowId;
935
936 // the parent window of this window (or NULL) and the list of the children
937 // of this window
938 wxWindow *m_parent;
939 wxWindowList m_children;
940
941 // the minimal allowed size for the window (no minimal size if variable(s)
942 // contain(s) -1)
943 int m_minWidth,
944 m_minHeight,
945 m_maxWidth,
946 m_maxHeight;
947
948 // event handler for this window: usually is just 'this' but may be
949 // changed with SetEventHandler()
950 wxEvtHandler *m_eventHandler;
951
952 #if wxUSE_VALIDATORS
953 // associated validator or NULL if none
954 wxValidator *m_windowValidator;
955 #endif // wxUSE_VALIDATORS
956
957 #if wxUSE_DRAG_AND_DROP
958 wxDropTarget *m_dropTarget;
959 #endif // wxUSE_DRAG_AND_DROP
960
961 // visual window attributes
962 wxCursor m_cursor;
963 wxFont m_font;
964 wxColour m_backgroundColour, m_foregroundColour;
965
966 #if wxUSE_CARET
967 wxCaret *m_caret;
968 #endif // wxUSE_CARET
969
970 // the region which should be repainted in response to paint event
971 wxRegion m_updateRegion;
972
973 #if wxUSE_ACCEL
974 // the accelerator table for the window which translates key strokes into
975 // command events
976 wxAcceleratorTable m_acceleratorTable;
977 #endif // wxUSE_ACCEL
978
979 // the tooltip for this window (may be NULL)
980 #if wxUSE_TOOLTIPS
981 wxToolTip *m_tooltip;
982 #endif // wxUSE_TOOLTIPS
983
984 // constraints and sizers
985 #if wxUSE_CONSTRAINTS
986 // the constraints for this window or NULL
987 wxLayoutConstraints *m_constraints;
988
989 // constraints this window is involved in
990 wxWindowList *m_constraintsInvolvedIn;
991 #endif // wxUSE_CONSTRAINTS
992
993 // this window's sizer
994 wxSizer *m_windowSizer;
995
996 // The sizer this window is a member of, if any
997 wxSizer *m_containingSizer;
998
999 // Layout() window automatically when its size changes?
1000 bool m_autoLayout:1;
1001
1002 // window state
1003 bool m_isShown:1;
1004 bool m_isEnabled:1;
1005 bool m_isBeingDeleted:1;
1006
1007 // was the window colours/font explicitly changed by user?
1008 bool m_hasBgCol:1;
1009 bool m_hasFgCol:1;
1010 bool m_hasFont:1;
1011
1012 // window attributes
1013 long m_windowStyle,
1014 m_exStyle;
1015 wxString m_windowName;
1016 bool m_themeEnabled;
1017
1018 #if wxUSE_PALETTE
1019 wxPalette m_palette;
1020 bool m_hasCustomPalette;
1021 #endif // wxUSE_PALETTE
1022
1023 #if wxUSE_ACCESSIBILITY
1024 wxAccessible* m_accessible;
1025 #endif
1026 // Virtual size (scrolling)
1027 wxSize m_virtualSize;
1028
1029 int m_minVirtualWidth; // VirtualSizeHints
1030 int m_minVirtualHeight;
1031 int m_maxVirtualWidth;
1032 int m_maxVirtualHeight;
1033
1034 // common part of all ctors: it is not virtual because it is called from
1035 // ctor
1036 void InitBase();
1037
1038 // override this to change the default (i.e. used when no style is
1039 // specified) border for the window class
1040 virtual wxBorder GetDefaultBorder() const;
1041
1042 // get the default size for the new window if no explicit size given
1043 // FIXME why 20 and not 30, 10 or ...?
1044 static int WidthDefault(int w) { return w == -1 ? 20 : w; }
1045 static int HeightDefault(int h) { return h == -1 ? 20 : h; }
1046
1047 // set the best size for the control if the default size was given:
1048 // replaces the fields of size == -1 with the best values for them and
1049 // calls SetSize() if needed
1050 //
1051 // This function is rather unfortunately named.. it's really just a
1052 // smarter SetSize / convenience function for expanding wxDefaultSize.
1053 // Note that it does not influence the value returned by GetBestSize
1054 // at all.
1055 void SetBestSize(const wxSize& size)
1056 {
1057 // the size only needs to be changed if the current size is incomplete,
1058 // i.e. one of the components was specified as default -- so if both
1059 // were given, simply don't do anything
1060 if ( size.x == -1 || size.y == -1 )
1061 {
1062 wxSize sizeBest = DoGetBestSize();
1063 if ( size.x != -1 )
1064 sizeBest.x = size.x;
1065 if ( size.y != -1 )
1066 sizeBest.y = size.y;
1067
1068 SetSize(sizeBest);
1069 }
1070 }
1071
1072 // more pure virtual functions
1073 // ---------------------------
1074
1075 // NB: we must have DoSomething() function when Something() is an overloaded
1076 // method: indeed, we can't just have "virtual Something()" in case when
1077 // the function is overloaded because then we'd have to make virtual all
1078 // the variants (otherwise only the virtual function may be called on a
1079 // pointer to derived class according to C++ rules) which is, in
1080 // general, absolutely not needed. So instead we implement all
1081 // overloaded Something()s in terms of DoSomething() which will be the
1082 // only one to be virtual.
1083
1084 // coordinates translation
1085 virtual void DoClientToScreen( int *x, int *y ) const = 0;
1086 virtual void DoScreenToClient( int *x, int *y ) const = 0;
1087
1088 virtual wxHitTest DoHitTest(wxCoord x, wxCoord y) const;
1089
1090 // capture/release the mouse, used by Capture/ReleaseMouse()
1091 virtual void DoCaptureMouse() = 0;
1092 virtual void DoReleaseMouse() = 0;
1093
1094 // retrieve the position/size of the window
1095 virtual void DoGetPosition( int *x, int *y ) const = 0;
1096 virtual void DoGetSize( int *width, int *height ) const = 0;
1097 virtual void DoGetClientSize( int *width, int *height ) const = 0;
1098
1099 // get the size which best suits the window: for a control, it would be
1100 // the minimal size which doesn't truncate the control, for a panel - the
1101 // same size as it would have after a call to Fit()
1102 virtual wxSize DoGetBestSize() const;
1103
1104 // this is the virtual function to be overriden in any derived class which
1105 // wants to change how SetSize() or Move() works - it is called by all
1106 // versions of these functions in the base class
1107 virtual void DoSetSize(int x, int y,
1108 int width, int height,
1109 int sizeFlags = wxSIZE_AUTO) = 0;
1110
1111 // same as DoSetSize() for the client size
1112 virtual void DoSetClientSize(int width, int height) = 0;
1113
1114 // move the window to the specified location and resize it: this is called
1115 // from both DoSetSize() and DoSetClientSize() and would usually just
1116 // reposition this window except for composite controls which will want to
1117 // arrange themselves inside the given rectangle
1118 virtual void DoMoveWindow(int x, int y, int width, int height) = 0;
1119
1120 #if wxUSE_TOOLTIPS
1121 virtual void DoSetToolTip( wxToolTip *tip );
1122 #endif // wxUSE_TOOLTIPS
1123
1124 #if wxUSE_MENUS
1125 virtual bool DoPopupMenu( wxMenu *menu, int x, int y ) = 0;
1126 #endif // wxUSE_MENUS
1127
1128 // Makes an adjustment to the window position (for example, a frame that has
1129 // a toolbar that it manages itself).
1130 virtual void AdjustForParentClientOrigin(int& x, int& y, int sizeFlags) const;
1131
1132
1133 private:
1134
1135 // contains the last id generated by NewControlId
1136 static int ms_lastControlId;
1137
1138 // the stack of windows which have captured the mouse
1139 static struct WXDLLEXPORT wxWindowNext *ms_winCaptureNext;
1140
1141 DECLARE_ABSTRACT_CLASS(wxWindowBase)
1142 DECLARE_NO_COPY_CLASS(wxWindowBase)
1143 DECLARE_EVENT_TABLE()
1144 };
1145
1146 // ----------------------------------------------------------------------------
1147 // now include the declaration of wxWindow class
1148 // ----------------------------------------------------------------------------
1149
1150 // include the declaration of the platform-specific class
1151 #if defined(__WXMSW__)
1152 #ifdef __WXUNIVERSAL__
1153 #define wxWindowNative wxWindowMSW
1154 #else // !wxUniv
1155 #define wxWindowMSW wxWindow
1156 #define sm_classwxWindowMSW sm_classwxWindow
1157 #define sm_constructorPropertiesCountwxWindowMSW sm_constructorPropertiesCountwxWindow
1158 #define sm_constructorPropertieswxWindowMSW sm_constructorPropertieswxWindow
1159 #define sm_constructorwxWindowMSW sm_constructorwxWindow
1160 #endif // wxUniv/!wxUniv
1161 #include "wx/msw/window.h"
1162 #elif defined(__WXMOTIF__)
1163 #include "wx/motif/window.h"
1164 #elif defined(__WXGTK__)
1165 #ifdef __WXUNIVERSAL__
1166 #define wxWindowNative wxWindowGTK
1167 #else // !wxUniv
1168 #define wxWindowGTK wxWindow
1169 #define sm_classwxWindowGTK sm_classwxWindow
1170 #endif // wxUniv
1171 #include "wx/gtk/window.h"
1172 #elif defined(__WXX11__)
1173 #ifdef __WXUNIVERSAL__
1174 #define wxWindowNative wxWindowX11
1175 #else // !wxUniv
1176 #define wxWindowX11 wxWindow
1177 #define sm_classwxWindowX11 sm_classwxWindow
1178 #endif // wxUniv
1179 #include "wx/x11/window.h"
1180 #elif defined(__WXMGL__)
1181 #ifdef __WXUNIVERSAL__
1182 #define wxWindowNative wxWindowMGL
1183 #else // !wxUniv
1184 #define wxWindowMGL wxWindow
1185 #define sm_classwxWindowMGL sm_classwxWindow
1186 #endif // wxUniv
1187 #include "wx/mgl/window.h"
1188 #elif defined(__WXMAC__)
1189 #ifdef __WXUNIVERSAL__
1190 #define wxWindowNative wxWindowMac
1191 #else // !wxUniv
1192 #define wxWindowMac wxWindow
1193 #define sm_classwxWindowMac sm_classwxWindow
1194 #endif // wxUniv
1195 #include "wx/mac/window.h"
1196 #elif defined(__WXCOCOA__)
1197 #ifdef __WXUNIVERSAL__
1198 #define wxWindowNative wxWindowCocoa
1199 #else // !wxUniv
1200 #define wxWindowCocoa wxWindow
1201 #define sm_classwxWindowCocoa sm_classwxWindow
1202 #endif // wxUniv
1203 #include "wx/cocoa/window.h"
1204 #elif defined(__WXPM__)
1205 #ifdef __WXUNIVERSAL__
1206 #define wxWindowNative wxWindowOS2
1207 #else // !wxUniv
1208 #define wxWindowOS2 wxWindow
1209 #define sm_classwxWindowOS2 sm_classwxWindow
1210 #endif // wxUniv/!wxUniv
1211 #include "wx/os2/window.h"
1212 #endif
1213
1214 // for wxUniversal, we now derive the real wxWindow from wxWindow<platform>,
1215 // for the native ports we already have defined it above
1216 #if defined(__WXUNIVERSAL__)
1217 #ifndef wxWindowNative
1218 #error "wxWindowNative must be defined above!"
1219 #endif
1220
1221 #include "wx/univ/window.h"
1222 #endif // wxUniv
1223
1224 // ----------------------------------------------------------------------------
1225 // inline functions which couldn't be declared in the class body because of
1226 // forward dependencies
1227 // ----------------------------------------------------------------------------
1228
1229 inline wxWindow *wxWindowBase::GetGrandParent() const
1230 {
1231 return m_parent ? m_parent->GetParent() : (wxWindow *)NULL;
1232 }
1233
1234 // ----------------------------------------------------------------------------
1235 // global functions
1236 // ----------------------------------------------------------------------------
1237
1238 // Find the wxWindow at the current mouse position, also returning the mouse
1239 // position.
1240 WXDLLEXPORT extern wxWindow* wxFindWindowAtPointer(wxPoint& pt);
1241
1242 // Get the current mouse position.
1243 WXDLLEXPORT extern wxPoint wxGetMousePosition();
1244
1245 // get the currently active window of this application or NULL
1246 WXDLLEXPORT extern wxWindow *wxGetActiveWindow();
1247
1248 // get the (first) top level parent window
1249 WXDLLEXPORT wxWindow* wxGetTopLevelParent(wxWindow *win);
1250
1251 // deprecated (doesn't start with 'wx' prefix), use wxWindow::NewControlId()
1252 inline int NewControlId() { return wxWindowBase::NewControlId(); }
1253
1254 #if wxUSE_ACCESSIBILITY
1255 // ----------------------------------------------------------------------------
1256 // accessible object for windows
1257 // ----------------------------------------------------------------------------
1258
1259 class WXDLLEXPORT wxWindowAccessible: public wxAccessible
1260 {
1261 public:
1262 wxWindowAccessible(wxWindow* win): wxAccessible(win) { if (win) win->SetAccessible(this); }
1263 virtual ~wxWindowAccessible() {};
1264
1265 // Overridables
1266
1267 // Can return either a child object, or an integer
1268 // representing the child element, starting from 1.
1269 virtual wxAccStatus HitTest(const wxPoint& pt, int* childId, wxAccessible** childObject);
1270
1271 // Returns the rectangle for this object (id = 0) or a child element (id > 0).
1272 virtual wxAccStatus GetLocation(wxRect& rect, int elementId);
1273
1274 // Navigates from fromId to toId/toObject.
1275 virtual wxAccStatus Navigate(wxNavDir navDir, int fromId,
1276 int* toId, wxAccessible** toObject);
1277
1278 // Gets the name of the specified object.
1279 virtual wxAccStatus GetName(int childId, wxString* name);
1280
1281 // Gets the number of children.
1282 virtual wxAccStatus GetChildCount(int* childCount);
1283
1284 // Gets the specified child (starting from 1).
1285 // If *child is NULL and return value is wxACC_OK,
1286 // this means that the child is a simple element and
1287 // not an accessible object.
1288 virtual wxAccStatus GetChild(int childId, wxAccessible** child);
1289
1290 // Gets the parent, or NULL.
1291 virtual wxAccStatus GetParent(wxAccessible** parent);
1292
1293 // Performs the default action. childId is 0 (the action for this object)
1294 // or > 0 (the action for a child).
1295 // Return wxACC_NOT_SUPPORTED if there is no default action for this
1296 // window (e.g. an edit control).
1297 virtual wxAccStatus DoDefaultAction(int childId);
1298
1299 // Gets the default action for this object (0) or > 0 (the action for a child).
1300 // Return wxACC_OK even if there is no action. actionName is the action, or the empty
1301 // string if there is no action.
1302 // The retrieved string describes the action that is performed on an object,
1303 // not what the object does as a result. For example, a toolbar button that prints
1304 // a document has a default action of "Press" rather than "Prints the current document."
1305 virtual wxAccStatus GetDefaultAction(int childId, wxString* actionName);
1306
1307 // Returns the description for this object or a child.
1308 virtual wxAccStatus GetDescription(int childId, wxString* description);
1309
1310 // Returns help text for this object or a child, similar to tooltip text.
1311 virtual wxAccStatus GetHelpText(int childId, wxString* helpText);
1312
1313 // Returns the keyboard shortcut for this object or child.
1314 // Return e.g. ALT+K
1315 virtual wxAccStatus GetKeyboardShortcut(int childId, wxString* shortcut);
1316
1317 // Returns a role constant.
1318 virtual wxAccStatus GetRole(int childId, wxAccRole* role);
1319
1320 // Returns a state constant.
1321 virtual wxAccStatus GetState(int childId, long* state);
1322
1323 // Returns a localized string representing the value for the object
1324 // or child.
1325 virtual wxAccStatus GetValue(int childId, wxString* strValue);
1326
1327 // Selects the object or child.
1328 virtual wxAccStatus Select(int childId, wxAccSelectionFlags selectFlags);
1329
1330 // Gets the window with the keyboard focus.
1331 // If childId is 0 and child is NULL, no object in
1332 // this subhierarchy has the focus.
1333 // If this object has the focus, child should be 'this'.
1334 virtual wxAccStatus GetFocus(int* childId, wxAccessible** child);
1335
1336 // Gets a variant representing the selected children
1337 // of this object.
1338 // Acceptable values:
1339 // - a null variant (IsNull() returns TRUE)
1340 // - a list variant (GetType() == wxT("list")
1341 // - an integer representing the selected child element,
1342 // or 0 if this object is selected (GetType() == wxT("long")
1343 // - a "void*" pointer to a wxAccessible child object
1344 virtual wxAccStatus GetSelections(wxVariant* selections);
1345 };
1346
1347 #endif // wxUSE_ACCESSIBILITY
1348
1349
1350 #endif
1351 // _WX_WINDOW_H_BASE_
1352