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