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