1 /////////////////////////////////////////////////////////////////////////////
3 // Purpose: wxWindow class
4 // Author: Julian Smart
8 // Copyright: (c) Julian Smart
9 // Licence: wxWindows licence
10 /////////////////////////////////////////////////////////////////////////////
16 #pragma interface "window.h"
19 #include "wx/gdicmn.h"
21 #include "wx/cursor.h"
24 #include "wx/validate.h"
26 #include "wx/string.h"
28 #include "wx/region.h"
35 * Base class for frame, panel, canvas, panel items, dialog box.
40 * Event handler: windows have themselves as their event handlers
41 * by default, but their event handlers could be set to another
42 * object entirely. This separation can reduce the amount of
43 * derivation required, and allow alteration of a window's functionality
44 * (e.g. by a resource editor that temporarily switches event handlers).
47 class WXDLLEXPORT wxWindow
;
48 class WXDLLEXPORT wxEvent
;
49 class WXDLLEXPORT wxCommandEvent
;
50 class WXDLLEXPORT wxKeyEvent
;
51 class WXDLLEXPORT wxControl
;
52 class WXDLLEXPORT wxCursor
;
53 class WXDLLEXPORT wxColourMap
;
54 class WXDLLEXPORT wxFont
;
55 class WXDLLEXPORT wxMenu
;
56 class WXDLLEXPORT wxRect
;
57 class WXDLLEXPORT wxBitmap
;
58 class WXDLLEXPORT wxSizer
;
59 class WXDLLEXPORT wxList
;
60 class WXDLLEXPORT wxLayoutConstraints
;
61 class WXDLLEXPORT wxMouseEvent
;
62 class WXDLLEXPORT wxButton
;
63 class WXDLLEXPORT wxColour
;
64 class WXDLLEXPORT wxBrush
;
65 class WXDLLEXPORT wxPen
;
66 class WXDLLEXPORT wxIcon
;
67 class WXDLLEXPORT wxDC
;
68 class WXDLLEXPORT wxValidator
;
70 #if wxUSE_DRAG_AND_DROP
71 class WXDLLEXPORT wxDropTarget
;
74 #if wxUSE_WX_RESOURCES
75 class WXDLLEXPORT wxResourceTable
;
76 class WXDLLEXPORT wxItemResource
;
79 WXDLLEXPORT_DATA(extern const char*) wxPanelNameStr
;
81 WXDLLEXPORT_DATA(extern const wxSize
) wxDefaultSize
;
82 WXDLLEXPORT_DATA(extern const wxPoint
) wxDefaultPosition
;
84 //-----------------------------------------------------------------------------
86 //-----------------------------------------------------------------------------
92 virtual ~wxClientData() { }
95 //-----------------------------------------------------------------------------
97 //-----------------------------------------------------------------------------
99 class wxStringClientData
: public wxClientData
102 wxStringClientData() { }
103 wxStringClientData( wxString
&data
) { m_data
= data
; }
104 void SetData( wxString
&data
) { m_data
= data
; }
105 wxString
GetData() const { return m_data
; }
111 class WXDLLEXPORT wxWindow
: public wxEvtHandler
113 DECLARE_ABSTRACT_CLASS(wxWindow
)
115 friend class WXDLLEXPORT wxDC
;
116 friend class WXDLLEXPORT wxWindowDC
;
120 inline wxWindow(wxWindow
*parent
, wxWindowID id
,
121 const wxPoint
& pos
= wxDefaultPosition
,
122 const wxSize
& size
= wxDefaultSize
,
124 const wxString
& name
= wxPanelNameStr
)
126 m_children
= new wxList
;
127 Create(parent
, id
, pos
, size
, style
, name
);
132 bool Create(wxWindow
*parent
, wxWindowID id
,
133 const wxPoint
& pos
= wxDefaultPosition
,
134 const wxSize
& size
= wxDefaultSize
,
136 const wxString
& name
= wxPanelNameStr
);
138 // Fit the window around the items
141 // Show or hide the window
142 virtual bool Show(bool show
);
144 // Is the window shown?
145 virtual bool IsShown() const;
147 // Raise the window to the top of the Z order
148 virtual void Raise();
150 // Lower the window to the bottom of the Z order
151 virtual void Lower();
153 // Is the window enabled?
154 virtual bool IsEnabled() const;
157 inline bool Enabled() const { return IsEnabled(); }
159 // Dialog support: override these and call
160 // base class members to add functionality
161 // that can't be done using validators.
163 // Transfer values to controls. If returns FALSE,
164 // it's an application error (pops up a dialog)
165 virtual bool TransferDataToWindow();
167 // Transfer values from controls. If returns FALSE,
168 // transfer failed: don't quit
169 virtual bool TransferDataFromWindow();
171 // Validate controls. If returns FALSE,
172 // validation failed: don't quit
173 virtual bool Validate();
175 // Return code for dialogs
176 inline void SetReturnCode(int retCode
);
177 inline int GetReturnCode();
180 virtual void SetCursor(const wxCursor
& cursor
);
181 inline virtual wxCursor
*GetCursor() const { return (wxCursor
*)& m_windowCursor
; };
183 // Get the window with the focus
184 static wxWindow
*FindFocus();
186 // Get character size
187 virtual int GetCharHeight() const;
188 virtual int GetCharWidth() const;
190 // Get overall window size
191 virtual void GetSize(int *width
, int *height
) const;
192 virtual wxSize
GetSize() const { int w
, h
; GetSize(& w
, & h
); return wxSize(w
, h
); }
193 virtual wxRect
GetRect() const { int w
, h
; int x
, y
; GetPosition(& x
, & y
); GetSize(& w
, & h
); return wxRect(x
, y
, w
, h
); }
195 // Get window position, relative to parent (or screen if no parent)
196 virtual void GetPosition(int *x
, int *y
) const;
197 virtual wxPoint
GetPosition() const { int x
, y
; GetPosition(&x
, &y
); return wxPoint(x
, y
); }
199 // Get client (application-useable) size
200 virtual void GetClientSize(int *width
, int *height
) const;
201 virtual wxSize
GetClientSize() const { int w
, h
; GetClientSize(& w
, & h
); return wxSize(w
, h
); }
203 // Set overall size and position
204 virtual void SetSize(int x
, int y
, int width
, int height
, int sizeFlags
= wxSIZE_AUTO
);
205 virtual void SetSize(int width
, int height
) { SetSize(-1, -1, width
, height
, wxSIZE_USE_EXISTING
); }
206 virtual void SetSize(const wxRect
& rect
, int sizeFlags
= wxSIZE_AUTO
)
207 { SetSize(rect
.x
, rect
.y
, rect
.width
, rect
.height
, sizeFlags
); }
208 virtual void SetSize(const wxSize
& size
) { SetSize(-1, -1, size
.x
, size
.y
, wxSIZE_USE_EXISTING
); }
210 virtual void Move(int x
, int y
) { SetSize(x
, y
, -1, -1, wxSIZE_USE_EXISTING
); }
211 virtual void Move(const wxPoint
& pt
) { SetSize(pt
.x
, pt
.y
, -1, -1, wxSIZE_USE_EXISTING
); }
214 virtual void SetClientSize(int width
, int size
);
215 virtual void SetClientSize(const wxSize
& sz
) { SetClientSize(sz
.x
, sz
.y
); }
217 // Convert client to screen coordinates
218 virtual void ClientToScreen(int *x
, int *y
) const;
219 virtual wxPoint
ClientToScreen(const wxPoint
& pt
) const
220 { int x
= pt
.x
; int y
= pt
.y
; ClientToScreen(& x
, & y
); return wxPoint(x
, y
); }
222 // Convert screen to client coordinates
223 virtual void ScreenToClient(int *x
, int *y
) const;
224 virtual wxPoint
ScreenToClient(const wxPoint
& pt
) const
225 { int x
= pt
.x
; int y
= pt
.y
; ScreenToClient(& x
, & y
); return wxPoint(x
, y
); }
227 // Set the focus to this window
228 virtual void SetFocus();
230 // Capture/release mouse
231 virtual void CaptureMouse();
232 virtual void ReleaseMouse();
234 // Enable or disable the window
235 virtual void Enable(bool enable
);
237 #if wxUSE_DRAG_AND_DROP
238 // Associate a drop target with this window (if the window already had a drop
239 // target, it's deleted!) and return the current drop target (may be NULL).
240 void SetDropTarget(wxDropTarget
*pDropTarget
);
241 wxDropTarget
*GetDropTarget() const { return m_pDropTarget
; }
244 // Accept files for dragging
245 virtual void DragAcceptFiles(bool accept
);
247 // Update region access
248 virtual wxRegion
& GetUpdateRegion() const;
249 virtual bool IsExposed(int x
, int y
, int w
, int h
) const;
250 virtual bool IsExposed(const wxPoint
& pt
) const;
251 virtual bool IsExposed(const wxRect
& rect
) const;
253 // Set/get the window title
254 virtual inline void SetTitle(const wxString
& WXUNUSED(title
)) {};
255 inline virtual wxString
GetTitle() const { return wxString(""); };
256 // Most windows have the concept of a label; for frames, this is the
257 // title; for items, this is the label or button text.
258 inline virtual wxString
GetLabel() const { return GetTitle(); }
260 // Set/get the window name (used for resource setting in X)
261 inline virtual wxString
GetName() const;
262 inline virtual void SetName(const wxString
& name
);
265 virtual void Centre(int direction
) ;
266 inline void Center(int direction
= wxHORIZONTAL
) { Centre(direction
); }
269 virtual bool PopupMenu(wxMenu
*menu
, int x
, int y
);
271 // Send the window a refresh event
272 virtual void Refresh(bool eraseBack
= TRUE
, const wxRect
*rect
= NULL
);
274 // New functions that will replace the above.
275 virtual void SetScrollbar(int orient
, int pos
, int thumbVisible
,
276 int range
, bool refresh
= TRUE
);
278 virtual void SetScrollPos(int orient
, int pos
, bool refresh
= TRUE
);
279 virtual int GetScrollPos(int orient
) const;
280 virtual int GetScrollRange(int orient
) const;
281 virtual int GetScrollThumb(int orient
) const;
283 virtual void ScrollWindow(int dx
, int dy
, const wxRect
*rect
= NULL
);
285 // Caret manipulation
286 virtual void CreateCaret(int w
, int h
);
287 virtual void CreateCaret(const wxBitmap
*bitmap
);
288 virtual void DestroyCaret();
289 virtual void ShowCaret(bool show
);
290 virtual void SetCaretPos(int x
, int y
);
291 virtual void GetCaretPos(int *x
, int *y
) const;
293 // Tell window how much it can be sized
294 virtual void SetSizeHints(int minW
= -1, int minH
= -1, int maxW
= -1, int maxH
= -1, int incW
= -1, int incH
= -1);
296 // Set/get the window's identifier
297 inline int GetId() const;
298 inline void SetId(int id
);
300 virtual void SetAcceleratorTable(const wxAcceleratorTable
& accel
);
301 inline virtual wxAcceleratorTable
& GetAcceleratorTable() const { return (wxAcceleratorTable
&) m_acceleratorTable
; }
303 // Make the window modal (all other windows unresponsive)
304 virtual void MakeModal(bool modal
);
306 // Get the private handle (platform-dependent)
307 inline void *GetHandle() const;
309 // Set/get the window's relatives
310 inline wxWindow
*GetParent() const;
311 inline void SetParent(wxWindow
*p
) ;
312 inline wxWindow
*GetGrandParent() const;
313 inline wxList
*GetChildren() const;
314 // Reparents this window to have the new parent.
315 virtual bool Reparent(wxWindow
* parent
);
317 // Set/get the window's font
318 virtual void SetFont(const wxFont
& f
);
319 inline virtual wxFont
*GetFont() const;
321 // Set/get the window's validator
322 void SetValidator(const wxValidator
& validator
);
323 inline wxValidator
*GetValidator() const;
325 virtual void SetClientObject( wxClientData
*data
);
326 virtual wxClientData
*GetClientObject();
328 virtual void SetClientData( void *data
);
329 virtual void *GetClientData();
331 // Set/get the window's style
332 inline void SetWindowStyleFlag(long flag
);
333 inline long GetWindowStyleFlag() const;
335 // Handle a control command
336 virtual void OnCommand(wxWindow
& win
, wxCommandEvent
& event
);
338 // Set/get event handler
339 inline void SetEventHandler(wxEvtHandler
*handler
);
340 inline wxEvtHandler
*GetEventHandler() const;
342 // Push/pop event handler (i.e. allow a chain of event handlers
344 void PushEventHandler(wxEvtHandler
*handler
) ;
345 wxEvtHandler
*PopEventHandler(bool deleteHandler
= FALSE
) ;
347 // Close the window by calling OnClose, posting a deletion
348 virtual bool Close(bool force
= FALSE
);
350 // Destroy the window (delayed, if a managed window)
351 virtual bool Destroy() ;
353 // Mode for telling default OnSize members to
354 // call Layout(), if not using Sizers, just top-down constraints
355 inline void SetAutoLayout(bool a
);
356 inline bool GetAutoLayout() const;
358 // Set/get constraints
359 inline wxLayoutConstraints
*GetConstraints() const;
360 void SetConstraints(wxLayoutConstraints
*c
);
362 // Set/get window background colour
363 virtual void SetBackgroundColour(const wxColour
& col
);
364 inline virtual wxColour
GetBackgroundColour() const;
366 // Set/get window foreground colour
367 virtual void SetForegroundColour(const wxColour
& col
);
368 inline virtual wxColour
GetForegroundColour() const;
370 // Get the default button, if there is one
371 inline virtual wxButton
*GetDefaultItem() const;
372 inline virtual void SetDefaultItem(wxButton
*but
);
374 // Override to define new behaviour for default action (e.g. double clicking
376 virtual void OnDefaultAction(wxControl
*initiatingItem
);
379 #if wxUSE_WX_RESOURCES
380 virtual bool LoadFromResource(wxWindow
*parent
, const wxString
& resourceName
, const wxResourceTable
*table
= NULL
);
381 virtual wxControl
*CreateItem(const wxItemResource
* childResource
, const wxItemResource
* parentResource
,
382 const wxResourceTable
*table
= (const wxResourceTable
*) NULL
);
385 virtual void GetTextExtent(const wxString
& string
, int *x
, int *y
,
387 int *externalLeading
= NULL
,
388 const wxFont
*theFont
= NULL
, bool use16
= FALSE
) const;
390 // Is the window retained?
391 inline bool IsRetained() const;
393 // Warp the pointer the given position
394 virtual void WarpPointer(int x_pos
, int y_pos
) ;
397 virtual void Clear();
399 // Find a window by id or name
400 virtual wxWindow
*FindWindow(long id
);
401 virtual wxWindow
*FindWindow(const wxString
& name
);
403 // Constraint operations
405 void SetSizer(wxSizer
*sizer
); // Adds sizer child to this window
406 inline wxSizer
*GetSizer() const ;
407 inline wxWindow
*GetSizerParent() const ;
408 inline void SetSizerParent(wxWindow
*win
);
410 // Do Update UI processing for controls
411 void UpdateWindowUI();
413 void OnEraseBackground(wxEraseEvent
& event
);
414 void OnChar(wxKeyEvent
& event
);
415 void OnPaint(wxPaintEvent
& event
);
416 void OnIdle(wxIdleEvent
& event
);
418 // Does this window want to accept keyboard focus?
419 virtual bool AcceptsFocus() const;
421 virtual void PrepareDC( wxDC
& WXUNUSED(dc
) ) {};
425 ////////////////////////////////////////////////////////////////////////
428 // For implementation purposes - sometimes decorations make the client area
430 virtual wxPoint
GetClientAreaOrigin() const;
432 // Makes an adjustment to the window position (for example, a frame that has
433 // a toolbar that it manages itself).
434 virtual void AdjustForParentClientOrigin(int& x
, int& y
, int sizeFlags
);
436 // Executes the default message
437 virtual long Default();
439 /* TODO: you may need something like this
440 // Determine whether 3D effects are wanted
441 virtual WXDWORD Determine3DEffects(WXDWORD defaultBorderStyle, bool *want3D);
444 virtual void AddChild(wxWindow
*child
); // Adds reference to the child object
445 virtual void RemoveChild(wxWindow
*child
); // Removes reference to child
446 // (but doesn't delete the child object)
447 virtual void DestroyChildren(); // Removes and destroys all children
449 inline bool IsBeingDeleted() const { return FALSE
; } // TODO: Should probably eliminate this
451 // Constraint implementation
452 void UnsetConstraints(wxLayoutConstraints
*c
);
453 inline wxList
*GetConstraintsInvolvedIn() const ;
454 // Back-pointer to other windows we're involved with, so if we delete
455 // this window, we must delete any constraints we're involved with.
456 void AddConstraintReference(wxWindow
*otherWin
);
457 void RemoveConstraintReference(wxWindow
*otherWin
);
458 void DeleteRelatedConstraints();
460 virtual void ResetConstraints();
461 virtual void SetConstraintSizes(bool recurse
= TRUE
);
462 virtual bool LayoutPhase1(int *noChanges
);
463 virtual bool LayoutPhase2(int *noChanges
);
464 virtual bool DoPhase(int);
465 // Transforms from sizer coordinate space to actual
466 // parent coordinate space
467 virtual void TransformSizerToActual(int *x
, int *y
) const ;
469 // Set size with transformation to actual coordinates if nec.
470 virtual void SizerSetSize(int x
, int y
, int w
, int h
);
471 virtual void SizerMove(int x
, int y
);
473 // Only set/get the size/position of the constraint (if any)
474 virtual void SetSizeConstraint(int x
, int y
, int w
, int h
);
475 virtual void MoveConstraint(int x
, int y
);
476 virtual void GetSizeConstraint(int *w
, int *h
) const ;
477 virtual void GetClientSizeConstraint(int *w
, int *h
) const ;
478 virtual void GetPositionConstraint(int *x
, int *y
) const ;
480 // Dialog units translations. Implemented in wincmn.cpp.
481 wxPoint
ConvertPixelsToDialog(const wxPoint
& pt
) ;
482 wxPoint
ConvertDialogToPixels(const wxPoint
& pt
) ;
483 inline wxSize
ConvertPixelsToDialog(const wxSize
& sz
)
484 { wxPoint
pt(ConvertPixelsToDialog(wxPoint(sz
.x
, sz
.y
))); return wxSize(pt
.x
, pt
.y
); }
485 inline wxSize
ConvertDialogToPixels(const wxSize
& sz
)
486 { wxPoint
pt(ConvertDialogToPixels(wxPoint(sz
.x
, sz
.y
))); return wxSize(pt
.x
, pt
.y
); }
488 wxObject
*GetChild(int number
) const ;
490 // Generates a new id for controls
491 static int NewControlId();
493 // Responds to colour changes: passes event on to children.
494 void OnSysColourChanged(wxSysColourChangedEvent
& event
);
496 // Transfers data to any child controls
497 void OnInitDialog(wxInitDialogEvent
& event
);
499 // Sends an OnInitDialog event, which in turns transfers data to
500 // to the window via validators.
501 virtual void InitDialog();
505 void ClearUpdateRects();
506 void CanvasGetSize(int* width
, int* height
) const; // If have drawing area
507 void CanvasGetClientSize(int *width
, int *height
) const;
508 void CanvasGetPosition(int *x
, int *y
) const; // If have drawing area
509 void CanvasSetClientSize(int width
, int size
);
510 void CanvasSetSize(int x
, int y
, int width
, int height
, int sizeFlags
= wxSIZE_AUTO
);
512 // Gives window a chance to do something in response to a size
513 // message, e.g. arrange status bar, toolbar etc.
514 virtual bool PreResize() { return TRUE
; }
516 // Get main widget for this window, e.g. a text widget
517 virtual WXWidget
GetMainWidget() const;
518 // Get the widget that corresponds to the label (for font setting, label setting etc.)
519 virtual WXWidget
GetLabelWidget() const { return GetMainWidget(); }
520 // Get the client widget for this window (something we can
521 // create other windows on)
522 virtual WXWidget
GetClientWidget() const;
523 // Get the top widget for this window, e.g. the scrolled widget parent
524 // of a multi-line text widget. Top means, top in the window hierarchy
525 // that implements this window.
526 virtual WXWidget
GetTopWidget() const;
527 virtual void SetMainWidget(WXWidget w
) { m_mainWidget
= w
; }
528 bool CanAddEventHandler() const { return m_canAddEventHandler
; }
529 void SetCanAddEventHandler(bool flag
) { m_canAddEventHandler
= flag
; }
531 // Get the underlying X window and display
532 virtual WXWindow
GetXWindow() const;
533 virtual WXDisplay
*GetXDisplay() const;
535 virtual WXPixmap
GetBackingPixmap() const { return m_backingPixmap
; }
536 inline int GetPixmapWidth() const { return m_pixmapWidth
; }
537 inline int GetPixmapHeight() const { return m_pixmapHeight
; }
540 virtual void ChangeFont(bool keepOriginalSize
= TRUE
); // Change to the current font (often overridden)
541 virtual void DoChangeForegroundColour(WXWidget widget
, wxColour
& foregroundColour
);
542 virtual void DoChangeBackgroundColour(WXWidget widget
, wxColour
& backgroundColour
, bool changeArmColour
= FALSE
);
543 // These to be overridden as needed (may change several widgets)
544 virtual void ChangeBackgroundColour(); // Change background and foreground colour using current
545 // background colour setting (Motif generates
546 // foreground based on background)
547 virtual void ChangeForegroundColour(); // Change foreground colour using current
548 // foreground colour setting
550 // Adds the widget to the hash table and adds event handlers.
551 bool AttachWidget (wxWindow
* parent
, WXWidget mainWidget
,
552 WXWidget formWidget
, int x
, int y
, int width
, int height
);
553 bool DetachWidget(WXWidget widget
);
555 // Generates a paint event
556 virtual void DoPaint();
558 // How to implement accelerators. If we find a key event,
559 // translate to wxWindows wxKeyEvent form. Find a widget for the window.
560 // Now find a wxWindow for the widget. If there isn't one, go up the widget hierarchy
561 // trying to find one. Once one is found, call ProcessAccelerator for the
562 // window. If it returns TRUE (processed the event), skip the X event,
563 // otherwise carry on up the wxWindows window hierarchy calling ProcessAccelerator.
564 // If all return FALSE, process the X event as normal.
565 // Eventually we can implement OnCharHook the same way, but concentrate on accelerators
567 // ProcessAccelerator must look at the current accelerator table, and try to find
568 // what menu id or window (beneath it) has this ID. Then construct an appropriate command
569 // event and send it.
570 virtual bool ProcessAccelerator(wxKeyEvent
& event
);
572 ////////////////////////////////////////////////////////////////////////
576 long m_windowStyle
; // Store the window's style
577 wxEvtHandler
* m_windowEventHandler
; // Usually is 'this'
578 wxLayoutConstraints
* m_constraints
; // Constraints for this window
579 wxList
* m_constraintsInvolvedIn
; // List of constraints we're involved in
580 wxSizer
* m_windowSizer
; // Window's top-level sizer (if any)
581 wxWindow
* m_sizerParent
; // Window's parent sizer (if any)
582 bool m_autoLayout
; // Whether to call Layout() in OnSize
583 wxWindow
* m_windowParent
; // Each window always knows its parent
584 wxValidator
* m_windowValidator
;
595 wxFont m_windowFont
; // Window's font
596 wxCursor m_windowCursor
; // Window's cursor
597 wxString m_windowName
; // Window name
599 wxButton
* m_defaultItem
;
601 wxColour m_backgroundColour
;
602 wxColour m_foregroundColour
;
603 wxAcceleratorTable m_acceleratorTable
;
604 wxClientData
* m_clientObject
;
607 #if wxUSE_DRAG_AND_DROP
608 wxDropTarget
*m_pDropTarget
; // the current drop target or NULL
609 #endif //USE_DRAG_AND_DROP
612 wxRegion m_updateRegion
;
613 wxList
* m_children
; // Window's children
618 bool m_canAddEventHandler
;
619 bool m_button1Pressed
;
620 bool m_button2Pressed
;
621 bool m_button3Pressed
;
622 // For double-click detection
623 long m_lastTS
; // last timestamp
624 int m_lastButton
; // last pressed button
625 wxList m_updateRects
; // List of wxRects representing damaged region
628 WXWidget m_mainWidget
;
629 WXWidget m_hScrollBar
;
630 WXWidget m_vScrollBar
;
631 WXWidget m_borderWidget
;
632 WXWidget m_scrolledWindow
;
633 WXWidget m_drawingArea
;
637 WXPixmap m_backingPixmap
;
642 int m_scrollPosX
; // Store the last scroll pos,
643 int m_scrollPosY
; // since in wxWin the pos isn't
644 // set automatically by system
646 DECLARE_EVENT_TABLE()
649 ////////////////////////////////////////////////////////////////////////
652 inline void *wxWindow::GetHandle() const { return (void *)NULL
; }
653 inline int wxWindow::GetId() const { return m_windowId
; }
654 inline void wxWindow::SetId(int id
) { m_windowId
= id
; }
655 inline wxWindow
*wxWindow::GetParent() const { return m_windowParent
; }
656 inline void wxWindow::SetParent(wxWindow
*p
) { m_windowParent
= p
; }
657 inline wxWindow
*wxWindow::GetGrandParent() const { return (m_windowParent
? m_windowParent
->m_windowParent
: (wxWindow
*) NULL
); }
658 inline wxList
*wxWindow::GetChildren() const { return m_children
; }
659 inline wxFont
*wxWindow::GetFont() const { return (wxFont
*) & m_windowFont
; }
660 inline wxString
wxWindow::GetName() const { return m_windowName
; }
661 inline void wxWindow::SetName(const wxString
& name
) { m_windowName
= name
; }
662 inline long wxWindow::GetWindowStyleFlag() const { return m_windowStyle
; }
663 inline void wxWindow::SetWindowStyleFlag(long flag
) { m_windowStyle
= flag
; }
664 inline void wxWindow::SetEventHandler(wxEvtHandler
*handler
) { m_windowEventHandler
= handler
; }
665 inline wxEvtHandler
*wxWindow::GetEventHandler() const { return m_windowEventHandler
; }
666 inline void wxWindow::SetAutoLayout(bool a
) { m_autoLayout
= a
; }
667 inline bool wxWindow::GetAutoLayout() const { return m_autoLayout
; }
668 inline wxLayoutConstraints
*wxWindow::GetConstraints() const { return m_constraints
; }
669 inline wxColour
wxWindow::GetBackgroundColour() const { return m_backgroundColour
; };
670 inline wxColour
wxWindow::GetForegroundColour() const { return m_foregroundColour
; };
672 inline wxButton
*wxWindow::GetDefaultItem() const { return m_defaultItem
; }
673 inline void wxWindow::SetDefaultItem(wxButton
*but
) { m_defaultItem
= but
; }
674 inline bool wxWindow::IsRetained() const { return ((m_windowStyle
& wxRETAINED
) == wxRETAINED
); }
676 inline wxList
*wxWindow::GetConstraintsInvolvedIn() const { return m_constraintsInvolvedIn
; }
677 inline wxSizer
*wxWindow::GetSizer() const { return m_windowSizer
; }
678 inline wxWindow
*wxWindow::GetSizerParent() const { return m_sizerParent
; }
679 inline void wxWindow::SetSizerParent(wxWindow
*win
) { m_sizerParent
= win
; }
680 inline wxValidator
*wxWindow::GetValidator() const { return m_windowValidator
; }
681 inline void wxWindow::SetReturnCode(int retCode
) { m_returnCode
= retCode
; }
682 inline int wxWindow::GetReturnCode() { return m_returnCode
; }
684 // Get the active window.
685 wxWindow
* WXDLLEXPORT
wxGetActiveWindow();
687 WXDLLEXPORT_DATA(extern wxList
) wxTopLevelWindows
;