1 ///////////////////////////////////////////////////////////////////////////////
3 // Purpose: wxWindowBase class - the interface of wxWindowBase
4 // Author: Vadim Zeitlin
8 // Copyright: (c) wxWindows team
9 // Licence: wxWindows licence
10 ///////////////////////////////////////////////////////////////////////////////
12 #ifndef _WX_WINDOW_H_BASE_
13 #define _WX_WINDOW_H_BASE_
16 #pragma interface "windowbase.h"
19 // ----------------------------------------------------------------------------
20 // headers which we must include here
21 // ----------------------------------------------------------------------------
23 #include "wx/event.h" // the base class
25 #include "wx/list.h" // defines wxWindowList
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"
33 // ----------------------------------------------------------------------------
34 // forward declarations
35 // ----------------------------------------------------------------------------
37 class WXDLLEXPORT wxClientData
;
38 class WXDLLEXPORT wxControl
;
39 class WXDLLEXPORT wxCursor
;
40 class WXDLLEXPORT wxDC
;
41 class WXDLLEXPORT wxDropTarget
;
42 class WXDLLEXPORT wxItemResource
;
43 class WXDLLEXPORT wxLayoutConstraints
;
44 class WXDLLEXPORT wxResourceTable
;
45 class WXDLLEXPORT wxSizer
;
46 class WXDLLEXPORT wxToolTip
;
47 class WXDLLEXPORT wxValidator
;
48 class WXDLLEXPORT wxWindowBase
;
49 class WXDLLEXPORT wxWindow
;
51 // ----------------------------------------------------------------------------
52 // (pseudo)template list classes
53 // ----------------------------------------------------------------------------
55 WX_DECLARE_LIST_3(wxWindow
, wxWindowBase
, wxWindowList
, wxWindowListNode
);
57 // ----------------------------------------------------------------------------
59 // ----------------------------------------------------------------------------
61 WXDLLEXPORT_DATA(extern wxWindowList
) wxTopLevelWindows
;
63 // ----------------------------------------------------------------------------
64 // helper classes used by [SG]etClientObject/Data
66 // TODO move into a separate header?
67 // ----------------------------------------------------------------------------
73 virtual ~wxClientData() { }
76 class wxStringClientData
: public wxClientData
79 wxStringClientData() { }
80 wxStringClientData( const wxString
&data
) : m_data(data
) { }
81 void SetData( const wxString
&data
) { m_data
= data
; }
82 const wxString
& GetData() const { return m_data
; }
88 // ----------------------------------------------------------------------------
89 // wxWindowBase is the base class for all GUI controls/widgets, this is the public
90 // interface of this class.
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 // ----------------------------------------------------------------------------
99 class WXDLLEXPORT wxWindowBase
: public wxEvtHandler
101 DECLARE_ABSTRACT_CLASS(wxWindowBase
);
104 // creating the window
105 // -------------------
108 wxWindowBase() { InitBase(); }
110 // pseudo ctor (can't be virtual, called from ctor)
111 bool CreateBase(wxWindowBase
*parent
,
113 const wxPoint
& pos
= wxDefaultPosition
,
114 const wxSize
& size
= wxDefaultSize
,
116 const wxString
& name
= wxPanelNameStr
);
118 virtual ~wxWindowBase();
120 #if wxUSE_WX_RESOURCES
121 // these functions are implemented in resource.cpp and resourc2.cpp
122 virtual bool LoadFromResource(wxWindow
*parent
,
123 const wxString
& resourceName
,
124 const wxResourceTable
*table
= (const wxResourceTable
*) NULL
);
125 virtual wxControl
*CreateItem(const wxItemResource
* childResource
,
126 const wxItemResource
* parentResource
,
127 const wxResourceTable
*table
= (const wxResourceTable
*) NULL
);
128 #endif // wxUSE_WX_RESOURCES
130 // deleting the window
131 // -------------------
133 // ask the window to close itself, return TRUE if the event handler
134 // honoured our request
135 bool Close( bool force
= FALSE
);
137 // the following functions delete the C++ objects (the window itself
138 // or its children) as well as the GUI windows and normally should
139 // never be used directly
141 // delete window unconditionally (dangerous!), returns TRUE if ok
142 virtual bool Destroy();
143 // delete all children of this window, returns TRUE if ok
144 bool DestroyChildren();
146 // is the window being deleted?
147 bool IsBeingDeleted() const { return m_isBeingDeleted
; }
152 // the title (or label, see below) of the window: the text which the
154 virtual void SetTitle( const wxString
& WXUNUSED(title
) ) { }
155 virtual wxString
GetTitle() const { return ""; }
157 // label is just the same as the title (but for, e.g., buttons it
158 // makes more sense to speak about labels)
159 void SetLabel(const wxString
& label
) { SetTitle(label
); }
160 wxString
GetLabel() const { return GetTitle(); }
162 // the window name is used for ressource setting in X, it is not the
163 // same as the window title/label
164 virtual void SetName( const wxString
&name
) { m_windowName
= name
; }
165 virtual wxString
GetName() const { return m_windowName
; }
167 // window id uniquely identifies the window among its siblings unless
168 // it is -1 which means "don't care"
169 void SetId( wxWindowID id
) { m_windowId
= id
; }
170 wxWindowID
GetId() const { return m_windowId
; }
172 // generate a control id for the controls which were not given one by
174 static int NewControlId() { return --ms_lastControlId
; }
175 // get the id of the control following the one with the given
176 // (autogenerated) id
177 static int NextControlId(int id
) { return id
- 1; }
178 // get the id of the control preceding the one with the given
179 // (autogenerated) id
180 static int PrevControlId(int id
) { return id
+ 1; }
185 // set the window size and/or position
186 void SetSize( int x
, int y
, int width
, int height
,
187 int sizeFlags
= wxSIZE_AUTO
)
188 { DoSetSize(x
, y
, width
, height
, sizeFlags
); }
190 void SetSize( int width
, int height
)
191 { DoSetSize( -1, -1, width
, height
, wxSIZE_USE_EXISTING
); }
193 void SetSize( const wxSize
& size
)
194 { SetSize( size
.x
, size
.y
); }
196 void SetSize(const wxRect
& rect
, int sizeFlags
= wxSIZE_AUTO
)
197 { DoSetSize(rect
.x
, rect
.y
, rect
.width
, rect
.height
, sizeFlags
); }
199 void Move( int x
, int y
)
200 { DoSetSize( x
, y
, -1, -1, wxSIZE_USE_EXISTING
); }
202 void Move(const wxPoint
& pt
)
203 { Move(pt
.x
, pt
.y
); }
206 virtual void Raise() = 0;
207 virtual void Lower() = 0;
209 // client size is the size of area available for subwindows
210 void SetClientSize( int width
, int height
)
211 { DoSetClientSize(width
, height
); }
213 void SetClientSize( const wxSize
& size
)
214 { DoSetClientSize(size
.x
, size
.y
); }
216 void SetClientSize(const wxRect
& rect
)
217 { SetClientSize( rect
.width
, rect
.height
); }
219 // get the window position and/or size (pointers may be NULL)
220 void GetPosition( int *x
, int *y
) const { DoGetPosition(x
, y
); }
221 wxPoint
GetPosition() const
224 DoGetPosition(&w
, &h
);
226 return wxPoint(w
, h
);
229 void GetSize( int *w
, int *h
) const { DoGetSize(w
, h
); }
230 wxSize
GetSize() const
237 wxRect
GetRect() const
240 GetPosition(& x
, & y
);
243 return wxRect(x
, y
, w
, h
);
246 void GetClientSize( int *w
, int *h
) const { DoGetClientSize(w
, h
); }
247 wxSize
GetClientSize() const
250 DoGetClientSize(& w
, & h
);
255 // centre with respect to the the parent window
256 void Centre( int direction
= wxHORIZONTAL
);
257 void Center( int direction
= wxHORIZONTAL
) { Centre(direction
); }
259 // set window size to wrap around its children
262 // set min/max size of the window
263 virtual void SetSizeHints( int minW
, int minH
,
264 int maxW
= -1, int maxH
= -1,
265 int incW
= -1, int incH
= -1 );
270 // returns TRUE if window was shown/hidden, FALSE if the nothing was
271 // done (window was already shown/hidden)
272 virtual bool Show( bool show
= TRUE
);
273 bool Hide() { return Show(FALSE
); }
275 // returns TRUE if window was enabled/disabled, FALSE if nothing done
276 virtual bool Enable( bool enable
= TRUE
);
277 bool Disable() { return Enable(FALSE
); }
279 bool IsShown() const { return m_isShown
; }
280 bool IsEnabled() const { return m_isEnabled
; }
282 // get/set window style (setting style won't update the window and so
283 // is only useful for internal usage)
284 virtual void SetWindowStyleFlag( long style
) { m_windowStyle
= style
; }
285 virtual long GetWindowStyleFlag() const { return m_windowStyle
; }
287 // just some (somewhat shorter) synonims
288 void SetWindowStyle( long style
) { SetWindowStyleFlag(style
); }
289 long GetWindowStyle() const { return GetWindowStyleFlag(); }
291 bool HasFlag(int flag
) const { return (m_windowStyle
& flag
) != 0; }
293 virtual bool IsRetained() const
294 { return (m_windowStyle
& wxRETAINED
) != 0; }
296 // make the window modal (all other windows unresponsive)
297 virtual void MakeModal(bool modal
= TRUE
);
302 // set focus to this window
303 virtual void SetFocus() = 0;
305 // return the window which currently has the focus or NULL
306 static wxWindow
*FindFocus() /* = 0: implement in derived classes */;
308 // can this window have focus?
309 virtual bool AcceptsFocus() const { return IsShown() && IsEnabled(); }
311 // parent/children relations
312 // -------------------------
314 // get the list of children
315 const wxWindowList
& GetChildren() const { return m_children
; }
316 wxWindowList
& GetChildren() { return m_children
; }
318 // get the parent or the parent of the parent
319 wxWindow
*GetParent() const { return m_parent
; }
320 inline wxWindow
*GetGrandParent() const;
322 // is this window a top level one?
323 bool IsTopLevel() const { return m_parent
!= 0; }
325 // it doesn't really change parent, use ReParent() instead
326 void SetParent( wxWindowBase
*parent
) { m_parent
= (wxWindow
*)parent
; }
327 // change the real parent of this window, return TRUE if the parent
328 // was changed, FALSE otherwise (error or newParent == oldParent)
329 virtual bool Reparent( wxWindowBase
*newParent
);
331 // find window among the descendants of this one either by id or by
332 // name (return NULL if not found)
333 wxWindow
*FindWindow( long id
);
334 wxWindow
*FindWindow( const wxString
& name
);
336 // implementation mostly
337 virtual void AddChild( wxWindowBase
*child
);
338 virtual void RemoveChild( wxWindowBase
*child
);
340 // event handler stuff
341 // -------------------
343 // get the current event handler
344 wxEvtHandler
*GetEventHandler() const { return m_eventHandler
; }
346 // replace the event handler (allows to completely subclass the
348 void SetEventHandler( wxEvtHandler
*handler
) { m_eventHandler
= handler
; }
350 // push/pop event handler: allows to chain a custom event handler to
351 // alreasy existing ones
352 void PushEventHandler( wxEvtHandler
*handler
);
353 wxEvtHandler
*PopEventHandler( bool deleteHandler
= FALSE
);
355 // validators and client data
356 // --------------------------
358 // a window may have an associated validator which is used to control
360 virtual void SetValidator( const wxValidator
&validator
);
361 virtual wxValidator
*GetValidator() { return m_windowValidator
; }
363 // each window may have associated client data: either a pointer to
364 // wxClientData object in which case it is managed by the window (i.e.
365 // it will delete the data when it's destroyed) or an untyped pointer
366 // which won't be deleted by the window
367 virtual void SetClientObject( wxClientData
*data
)
369 if ( m_clientObject
)
370 delete m_clientObject
;
372 m_clientObject
= data
;
374 virtual wxClientData
*GetClientObject() const { return m_clientObject
; }
376 virtual void SetClientData( void *data
) { m_clientData
= data
; }
377 virtual void *GetClientData() const { return m_clientData
; }
379 // dialog oriented functions
380 // -------------------------
382 // validate the correctness of input, return TRUE if ok
383 virtual bool Validate();
385 // transfer data between internal and GUI representations
386 virtual bool TransferDataToWindow();
387 virtual bool TransferDataFromWindow();
389 virtual void InitDialog();
393 virtual void SetAcceleratorTable( const wxAcceleratorTable
& accel
)
394 { m_acceleratorTable
= accel
; }
395 wxAcceleratorTable
*GetAcceleratorTable()
396 { return &m_acceleratorTable
; }
398 // dialog units translations
399 // -------------------------
401 wxPoint
ConvertPixelsToDialog( const wxPoint
& pt
);
402 wxPoint
ConvertDialogToPixels( const wxPoint
& pt
);
403 wxSize
ConvertPixelsToDialog( const wxSize
& sz
)
405 wxPoint
pt(ConvertPixelsToDialog(wxPoint(sz
.x
, sz
.y
)));
407 return wxSize(pt
.x
, pt
.y
);
410 wxSize
ConvertDialogToPixels( const wxSize
& sz
)
412 wxPoint
pt(ConvertDialogToPixels(wxPoint(sz
.x
, sz
.y
)));
414 return wxSize(pt
.x
, pt
.y
);
420 // move the mouse to the specified position
421 virtual void WarpPointer(int x
, int y
) = 0;
423 // start or end mouse capture
424 virtual void CaptureMouse() = 0;
425 virtual void ReleaseMouse() = 0;
427 // painting the window
428 // -------------------
430 // mark the specified rectangle (or the whole window) as "dirty" so it
432 virtual void Refresh( bool eraseBackground
= TRUE
,
433 const wxRect
*rect
= (const wxRect
*) NULL
) = 0;
434 // clear the window entirely
435 virtual void Clear() = 0;
437 // adjust DC for drawing on this window
438 virtual void PrepareDC( wxDC
& WXUNUSED(dc
) ) { }
440 // the update region of the window contains the areas which must be
441 // repainted by the program
442 const wxRegion
& GetUpdateRegion() const { return m_updateRegion
; }
443 wxRegion
& GetUpdateRegion() { return m_updateRegion
; }
445 // these functions verify whether the given point/rectangle belongs to
446 // (or at least intersects with) the update region
447 bool IsExposed( int x
, int y
) const;
448 bool IsExposed( int x
, int y
, int w
, int h
) const;
450 bool IsExposed( const wxPoint
& pt
) const
451 { return IsExposed(pt
.x
, pt
.y
); }
452 bool IsExposed( const wxRect
& rect
) const
453 { return IsExposed(rect
.x
, rect
.y
, rect
.width
, rect
.height
); }
455 // colours, fonts and cursors
456 // --------------------------
458 // set/retrieve the window colours (system defaults are used by
459 // default): Set functions return TRUE if colour was changed
460 virtual bool SetBackgroundColour( const wxColour
&colour
);
461 virtual bool SetForegroundColour( const wxColour
&colour
);
463 wxColour
GetBackgroundColour() const { return m_backgroundColour
; }
464 wxColour
GetForegroundColour() const { return m_foregroundColour
; }
466 // set/retrieve the cursor for this window (SetCursor() returns TRUE
467 // if the cursor was really changed)
468 virtual bool SetCursor( const wxCursor
&cursor
);
469 const wxCursor
& GetCursor() const { return m_cursor
; }
470 wxCursor
& GetCursor() { return m_cursor
; }
472 // set/retrieve the font for the window (SetFont() returns TRUE if the
473 // font really changed)
474 virtual bool SetFont( const wxFont
&font
) = 0;
475 const wxFont
& GetFont() const { return m_font
; }
476 wxFont
& GetFont() { return m_font
; }
478 // get the (average) character size for the current font
479 virtual int GetCharHeight() const = 0;
480 virtual int GetCharWidth() const = 0;
482 // get the width/height/... of the text using current or specified
484 virtual void GetTextExtent(const wxString
& string
,
486 int *descent
= (int *) NULL
,
487 int *externalLeading
= (int *) NULL
,
488 const wxFont
*theFont
= (const wxFont
*) NULL
)
491 // translate to/from screen/client coordinates (pointers may be NULL)
492 void ClientToScreen( int *x
, int *y
) const
493 { DoClientToScreen(x
, y
); }
494 void ScreenToClient( int *x
, int *y
) const
495 { DoScreenToClient(x
, y
); }
496 wxPoint
ClientToScreen(const wxPoint
& pt
) const
498 int x
= pt
.x
, y
= pt
.y
;
499 DoClientToScreen(&x
, &y
);
501 return wxPoint(x
, y
);
504 wxPoint
ScreenToClient(const wxPoint
& pt
) const
506 int x
= pt
.x
, y
= pt
.y
;
507 DoScreenToClient(&x
, &y
);
509 return wxPoint(x
, y
);
515 void UpdateWindowUI();
517 virtual bool PopupMenu( wxMenu
*menu
, int x
, int y
) = 0;
522 // configure the window scrollbars
523 virtual void SetScrollbar( int orient
,
527 bool refresh
= TRUE
) = 0;
528 virtual void SetScrollPos( int orient
, int pos
, bool refresh
= TRUE
) = 0;
529 virtual int GetScrollPos( int orient
) const = 0;
530 virtual int GetScrollThumb( int orient
) const = 0;
531 virtual int GetScrollRange( int orient
) const = 0;
533 // scroll window to the specified position
534 virtual void ScrollWindow( int dx
, int dy
,
535 const wxRect
* rect
= (wxRect
*) NULL
) = 0;
540 // the easiest way to set a tooltip for a window is to use this method
541 void SetToolTip( const wxString
&tip
);
542 // attach a tooltip to the window
543 void SetToolTip( wxToolTip
*tip
) { DoSetToolTip(tip
); }
544 // get the associated tooltip or NULL if none
545 wxToolTip
* GetToolTip() const { return m_tooltip
; }
546 #endif // wxUSE_TOOLTIPS
550 #if wxUSE_DRAG_AND_DROP
551 // set/retrieve the drop target associated with this window (may be
552 // NULL; it's owned by the window and will be deleted by it)
553 virtual void SetDropTarget( wxDropTarget
*dropTarget
) = 0;
554 virtual wxDropTarget
*GetDropTarget() const { return m_dropTarget
; }
555 #endif // wxUSE_DRAG_AND_DROP
557 // constraints and sizers
558 // ----------------------
559 #if wxUSE_CONSTRAINTS
560 // set the constraints for this window or retrieve them (may be NULL)
561 void SetConstraints( wxLayoutConstraints
*constraints
);
562 wxLayoutConstraints
*GetConstraints() const { return m_constraints
; }
564 // when using constraints, it makes sense to update children positions
565 // automatically whenever the window is resized - this is done if
567 void SetAutoLayout( bool autoLayout
) { m_autoLayout
= autoLayout
; }
568 bool GetAutoLayout() const { return m_autoLayout
; }
570 // do layout the window and its children
571 virtual bool Layout();
573 // implementation only
574 void UnsetConstraints(wxLayoutConstraints
*c
);
575 wxWindowList
*GetConstraintsInvolvedIn() const
576 { return m_constraintsInvolvedIn
; }
577 void AddConstraintReference(wxWindowBase
*otherWin
);
578 void RemoveConstraintReference(wxWindowBase
*otherWin
);
579 void DeleteRelatedConstraints();
580 void ResetConstraints();
582 // these methods may be overriden for special layout algorithms
583 virtual void SetConstraintSizes(bool recurse
= TRUE
);
584 virtual bool LayoutPhase1(int *noChanges
);
585 virtual bool LayoutPhase2(int *noChanges
);
586 virtual bool DoPhase(int);
588 // these methods are virtual but normally won't be overridden
589 virtual void TransformSizerToActual(int *x
, int *y
) const ;
590 virtual void SetSizeConstraint(int x
, int y
, int w
, int h
);
591 virtual void MoveConstraint(int x
, int y
);
592 virtual void GetSizeConstraint(int *w
, int *h
) const ;
593 virtual void GetClientSizeConstraint(int *w
, int *h
) const ;
594 virtual void GetPositionConstraint(int *x
, int *y
) const ;
597 // TODO: what are they and how do they work??
598 void SetSizer( wxSizer
*sizer
);
599 wxSizer
*GetSizer() const { return m_windowSizer
; }
601 void SetSizerParent( wxWindowBase
*win
) { m_sizerParent
= win
; }
602 wxWindowBase
*GetSizerParent() const { return m_sizerParent
; }
604 virtual void SizerSetSize(int x
, int y
, int w
, int h
);
605 virtual void SizerMove(int x
, int y
);
606 #endif // wxUSE_CONSTRAINTS
608 // backward compatibility
609 // ----------------------
610 #if WXWIN_COMPATIBILITY
611 bool Enabled() const { return IsEnabled(); }
613 void SetButtonFont(const wxFont
& font
) { SetFont(font
); }
614 void SetLabelFont(const wxFont
& font
) { SetFont(font
); }
615 wxFont
& GetLabelFont() { return GetFont(); };
616 wxFont
& GetButtonFont() { return GetFont(); };
617 #endif // WXWIN_COMPATIBILITY
623 void OnSysColourChanged( wxSysColourChangedEvent
& event
);
624 void OnInitDialog( wxInitDialogEvent
&event
);
626 // get the haqndle of the window for the underlying window system: this
627 // is only used for wxWin itself or for user code which wants to call
628 // platform-specific APIs
629 virtual WXWidget
GetHandle() const = 0;
632 // the window id - a number which uniquely identifies a window among
633 // its siblings unless it is -1
634 wxWindowID m_windowId
;
636 // the parent window of this window (or NULL) and the list of the children
639 wxWindowList m_children
;
641 // the minimal allowed size for the window (no minimal size if variable(s)
643 int m_minWidth
, m_minHeight
, m_maxWidth
, m_maxHeight
;
645 // event handler for this window: usually is just 'this' but may be
646 // changed with SetEventHandler()
647 wxEvtHandler
*m_eventHandler
;
649 // associated validator or NULL if none
650 wxValidator
*m_windowValidator
;
652 #if wxUSE_DRAG_AND_DROP
653 wxDropTarget
*m_dropTarget
;
654 #endif // wxUSE_DRAG_AND_DROP
656 // visual window attributes
659 wxColour m_backgroundColour
, m_foregroundColour
;
661 // the region which should be repainted in response to paint event
662 wxRegion m_updateRegion
;
664 // the accelerator table for the window which translates key strokes into
666 wxAcceleratorTable m_acceleratorTable
;
668 // user data associated with the window: either an object which will be
669 // deleted by the window when it's deleted or some raw pointer which we do
671 wxClientData
*m_clientObject
;
674 // the tooltip for this window (may be NULL)
676 wxToolTip
*m_tooltip
;
677 #endif // wxUSE_TOOLTIPS
679 // constraints and sizers
680 #if wxUSE_CONSTRAINTS
681 // the constraints for this window or NULL
682 wxLayoutConstraints
*m_constraints
;
684 // constraints this window is involved in
685 wxWindowList
*m_constraintsInvolvedIn
;
687 // top level and the parent sizers
688 // TODO what's this and how does it work?)
689 wxSizer
*m_windowSizer
;
690 wxWindowBase
*m_sizerParent
;
692 // Layout() window automatically when its size changes?
694 #endif // wxUSE_CONSTRAINTS
699 bool m_isBeingDeleted
:1;
703 wxString m_windowName
;
706 // common part of all ctors: it is not virtual because it is called from
710 // get the default size for the new window if no explicit size given
711 // FIXME why 20 and not 30, 10 or ...?
712 static int WidthDefault(int w
) { return w
== -1 ? 20 : w
; }
713 static int HeightDefault(int h
) { return h
== -1 ? 20 : h
; }
715 // more pure virtual functions
716 // ---------------------------
718 // NB: we must have DoSomething() function when Something() is an overloaded
719 // method: indeed, we can't just have "virtual Something()" in case when
720 // the function is overloaded because then we'd have to make virtual all
721 // the variants (otherwise only the virtual function may be called on a
722 // pointer to derived class according to C++ rules) which is, in
723 // general, absolutely not needed. So instead we implement all
724 // overloaded Something()s in terms of DoSomething() which will be the
725 // only one to be virtual.
727 // coordinates translation
728 virtual void DoClientToScreen( int *x
, int *y
) const = 0;
729 virtual void DoScreenToClient( int *x
, int *y
) const = 0;
731 // retrieve the position/size of the window
732 virtual void DoGetPosition( int *x
, int *y
) const = 0;
733 virtual void DoGetSize( int *width
, int *height
) const = 0;
734 virtual void DoGetClientSize( int *width
, int *height
) const = 0;
736 // this is the virtual function to be overriden in any derived class which
737 // wants to change how SetSize() or Move() works - it is called by all
738 // versions of these functions in the base class
739 virtual void DoSetSize(int x
, int y
,
740 int width
, int height
,
741 int sizeFlags
= wxSIZE_AUTO
) = 0;
743 // same as DoSetSize() for the client size
744 virtual void DoSetClientSize(int width
, int height
) = 0;
747 virtual void DoSetToolTip( wxToolTip
*tip
);
748 #endif // wxUSE_TOOLTIPS
751 // contains the last id generated by NewControlId
752 static int ms_lastControlId
;
754 DECLARE_NO_COPY_CLASS(wxWindowBase
);
755 DECLARE_EVENT_TABLE()
758 // ----------------------------------------------------------------------------
759 // now include the declaration of wxWindow class
760 // ----------------------------------------------------------------------------
762 #if defined(__WXMSW__)
763 #include "wx/msw/window.h"
764 #elif defined(__WXMOTIF__)
765 #include "wx/motif/window.h"
766 #elif defined(__WXGTK__)
767 #include "wx/gtk/window.h"
768 #elif defined(__WXQT__)
769 #include "wx/qt/window.h"
770 #elif defined(__WXMAC__)
771 #include "wx/mac/window.h"
774 // ----------------------------------------------------------------------------
775 // inline functions which couldn't be declared in the class body because of
776 // forward dependencies
777 // ----------------------------------------------------------------------------
779 inline wxWindow
*wxWindowBase::GetGrandParent() const
781 return m_parent
? m_parent
->GetParent() : (wxWindow
*)NULL
;
784 // ----------------------------------------------------------------------------
786 // ----------------------------------------------------------------------------
788 WXDLLEXPORT
extern wxWindow
* wxGetActiveWindow();
789 inline WXDLLEXPORT
int NewControlId() { return wxWindowBase::NewControlId(); }
792 // _WX_WINDOW_H_BASE_