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