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"
36 * Base class for frame, panel, canvas, panel items, dialog box.
41 * Event handler: windows have themselves as their event handlers
42 * by default, but their event handlers could be set to another
43 * object entirely. This separation can reduce the amount of
44 * derivation required, and allow alteration of a window's functionality
45 * (e.g. by a resource editor that temporarily switches event handlers).
48 class WXDLLEXPORT wxWindow
;
49 class WXDLLEXPORT wxEvent
;
50 class WXDLLEXPORT wxCommandEvent
;
51 class WXDLLEXPORT wxKeyEvent
;
52 class WXDLLEXPORT wxControl
;
53 class WXDLLEXPORT wxCursor
;
54 class WXDLLEXPORT wxColourMap
;
55 class WXDLLEXPORT wxFont
;
56 class WXDLLEXPORT wxMenu
;
57 class WXDLLEXPORT wxRect
;
58 class WXDLLEXPORT wxBitmap
;
59 class WXDLLEXPORT wxSizer
;
60 class WXDLLEXPORT wxList
;
61 class WXDLLEXPORT wxLayoutConstraints
;
62 class WXDLLEXPORT wxMouseEvent
;
63 class WXDLLEXPORT wxButton
;
64 class WXDLLEXPORT wxColour
;
65 class WXDLLEXPORT wxBrush
;
66 class WXDLLEXPORT wxPen
;
67 class WXDLLEXPORT wxIcon
;
68 class WXDLLEXPORT wxDC
;
69 class WXDLLEXPORT wxValidator
;
71 #if wxUSE_DRAG_AND_DROP
72 class WXDLLEXPORT wxDropTarget
;
75 #if wxUSE_WX_RESOURCES
76 class WXDLLEXPORT wxResourceTable
;
77 class WXDLLEXPORT wxItemResource
;
80 WXDLLEXPORT_DATA(extern const char*) wxPanelNameStr
;
82 WXDLLEXPORT_DATA(extern const wxSize
) wxDefaultSize
;
83 WXDLLEXPORT_DATA(extern const wxPoint
) wxDefaultPosition
;
85 //-----------------------------------------------------------------------------
87 //-----------------------------------------------------------------------------
93 virtual ~wxClientData() { }
96 //-----------------------------------------------------------------------------
98 //-----------------------------------------------------------------------------
100 class wxStringClientData
: public wxClientData
103 wxStringClientData() { }
104 wxStringClientData( wxString
&data
) { m_data
= data
; }
105 void SetData( wxString
&data
) { m_data
= data
; }
106 wxString
GetData() const { return m_data
; }
112 class WXDLLEXPORT wxWindow
: public wxEvtHandler
114 DECLARE_ABSTRACT_CLASS(wxWindow
)
116 friend class WXDLLEXPORT wxDC
;
117 friend class WXDLLEXPORT wxWindowDC
;
121 inline wxWindow(wxWindow
*parent
, wxWindowID id
,
122 const wxPoint
& pos
= wxDefaultPosition
,
123 const wxSize
& size
= wxDefaultSize
,
125 const wxString
& name
= wxPanelNameStr
)
127 m_children
= new wxList
;
128 Create(parent
, id
, pos
, size
, style
, name
);
133 bool Create(wxWindow
*parent
, wxWindowID id
,
134 const wxPoint
& pos
= wxDefaultPosition
,
135 const wxSize
& size
= wxDefaultSize
,
137 const wxString
& name
= wxPanelNameStr
);
139 // Fit the window around the items
142 // Show or hide the window
143 virtual bool Show(bool show
);
145 // Is the window shown?
146 virtual bool IsShown() const;
148 // Raise the window to the top of the Z order
149 virtual void Raise();
151 // Lower the window to the bottom of the Z order
152 virtual void Lower();
154 // Is the window enabled?
155 virtual bool IsEnabled() const;
158 inline bool Enabled() const { return IsEnabled(); }
160 // Dialog support: override these and call
161 // base class members to add functionality
162 // that can't be done using validators.
164 // Transfer values to controls. If returns FALSE,
165 // it's an application error (pops up a dialog)
166 virtual bool TransferDataToWindow();
168 // Transfer values from controls. If returns FALSE,
169 // transfer failed: don't quit
170 virtual bool TransferDataFromWindow();
172 // Validate controls. If returns FALSE,
173 // validation failed: don't quit
174 virtual bool Validate();
176 // Return code for dialogs
177 inline void SetReturnCode(int retCode
);
178 inline int GetReturnCode();
181 virtual void SetCursor(const wxCursor
& cursor
);
182 inline virtual wxCursor
*GetCursor() const { return (wxCursor
*)& m_windowCursor
; };
184 // Get the window with the focus
185 static wxWindow
*FindFocus();
187 // Get character size
188 virtual int GetCharHeight() const;
189 virtual int GetCharWidth() const;
191 // Get overall window size
192 virtual void GetSize(int *width
, int *height
) const;
193 virtual wxSize
GetSize() const { int w
, h
; GetSize(& w
, & h
); return wxSize(w
, h
); }
194 virtual wxRect
GetRect() const { int w
, h
; int x
, y
; GetPosition(& x
, & y
); GetSize(& w
, & h
); return wxRect(x
, y
, w
, h
); }
196 // Get window position, relative to parent (or screen if no parent)
197 virtual void GetPosition(int *x
, int *y
) const;
198 virtual wxPoint
GetPosition() const { int x
, y
; GetPosition(&x
, &y
); return wxPoint(x
, y
); }
200 // Get client (application-useable) size
201 virtual void GetClientSize(int *width
, int *height
) const;
202 virtual wxSize
GetClientSize() const { int w
, h
; GetClientSize(& w
, & h
); return wxSize(w
, h
); }
204 // Set overall size and position
205 virtual void SetSize(int x
, int y
, int width
, int height
, int sizeFlags
= wxSIZE_AUTO
);
206 virtual void SetSize(int width
, int height
) { SetSize(-1, -1, width
, height
, wxSIZE_USE_EXISTING
); }
207 virtual void SetSize(const wxRect
& rect
, int sizeFlags
= wxSIZE_AUTO
)
208 { SetSize(rect
.x
, rect
.y
, rect
.width
, rect
.height
, sizeFlags
); }
209 virtual void SetSize(const wxSize
& size
) { SetSize(-1, -1, size
.x
, size
.y
, wxSIZE_USE_EXISTING
); }
211 virtual void Move(int x
, int y
) { SetSize(x
, y
, -1, -1, wxSIZE_USE_EXISTING
); }
212 virtual void Move(const wxPoint
& pt
) { SetSize(pt
.x
, pt
.y
, -1, -1, wxSIZE_USE_EXISTING
); }
215 virtual void SetClientSize(int width
, int size
);
216 virtual void SetClientSize(const wxSize
& sz
) { SetClientSize(sz
.x
, sz
.y
); }
218 // Convert client to screen coordinates
219 virtual void ClientToScreen(int *x
, int *y
) const;
220 virtual wxPoint
ClientToScreen(const wxPoint
& pt
) const
221 { int x
= pt
.x
; int y
= pt
.y
; ClientToScreen(& x
, & y
); return wxPoint(x
, y
); }
223 // Convert screen to client coordinates
224 virtual void ScreenToClient(int *x
, int *y
) const;
225 virtual wxPoint
ScreenToClient(const wxPoint
& pt
) const
226 { int x
= pt
.x
; int y
= pt
.y
; ScreenToClient(& x
, & y
); return wxPoint(x
, y
); }
228 // Set the focus to this window
229 virtual void SetFocus();
231 // Capture/release mouse
232 virtual void CaptureMouse();
233 virtual void ReleaseMouse();
235 // Enable or disable the window
236 virtual void Enable(bool enable
);
238 #if wxUSE_DRAG_AND_DROP
239 // Associate a drop target with this window (if the window already had a drop
240 // target, it's deleted!) and return the current drop target (may be NULL).
241 void SetDropTarget(wxDropTarget
*pDropTarget
);
242 wxDropTarget
*GetDropTarget() const { return m_pDropTarget
; }
245 // Accept files for dragging
246 virtual void DragAcceptFiles(bool accept
);
249 // create a tooltip with this text
250 void SetToolTip(const wxString
& tip
);
254 // pointer may be NULL to remove the tooltip
255 void SetToolTip(wxToolTip
*tooltip
);
256 // get the current tooltip (may return NULL if none)
257 wxToolTip
* GetToolTip() const { return m_tooltip
; }
260 // Update region access
261 virtual wxRegion
& GetUpdateRegion() const;
262 virtual bool IsExposed(int x
, int y
, int w
, int h
) const;
263 virtual bool IsExposed(const wxPoint
& pt
) const;
264 virtual bool IsExposed(const wxRect
& rect
) const;
266 // Set/get the window title
267 virtual inline void SetTitle(const wxString
& WXUNUSED(title
)) {};
268 inline virtual wxString
GetTitle() const { return wxString(""); };
269 // Most windows have the concept of a label; for frames, this is the
270 // title; for items, this is the label or button text.
271 inline virtual wxString
GetLabel() const { return GetTitle(); }
273 // Set/get the window name (used for resource setting in X)
274 inline virtual wxString
GetName() const;
275 inline virtual void SetName(const wxString
& name
);
278 virtual void Centre(int direction
) ;
279 inline void Center(int direction
= wxHORIZONTAL
) { Centre(direction
); }
282 virtual bool PopupMenu(wxMenu
*menu
, int x
, int y
);
284 // Send the window a refresh event
285 virtual void Refresh(bool eraseBack
= TRUE
, const wxRect
*rect
= NULL
);
287 // New functions that will replace the above.
288 virtual void SetScrollbar(int orient
, int pos
, int thumbVisible
,
289 int range
, bool refresh
= TRUE
);
291 // Helper functions for Motif
292 void CreateScrollbar(int orientation
);
293 void DestroyScrollbar(int orientation
);
295 virtual void SetScrollPos(int orient
, int pos
, bool refresh
= TRUE
);
296 virtual int GetScrollPos(int orient
) const;
297 virtual int GetScrollRange(int orient
) const;
298 virtual int GetScrollThumb(int orient
) const;
300 virtual void ScrollWindow(int dx
, int dy
, const wxRect
*rect
= NULL
);
302 // Caret manipulation
303 virtual void CreateCaret(int w
, int h
);
304 virtual void CreateCaret(const wxBitmap
*bitmap
);
305 virtual void DestroyCaret();
306 virtual void ShowCaret(bool show
);
307 virtual void SetCaretPos(int x
, int y
);
308 virtual void GetCaretPos(int *x
, int *y
) const;
310 // Tell window how much it can be sized
311 virtual void SetSizeHints(int minW
= -1, int minH
= -1, int maxW
= -1, int maxH
= -1, int incW
= -1, int incH
= -1);
313 // Set/get the window's identifier
314 inline int GetId() const;
315 inline void SetId(int id
);
317 virtual void SetAcceleratorTable(const wxAcceleratorTable
& accel
);
318 inline virtual wxAcceleratorTable
& GetAcceleratorTable() const { return (wxAcceleratorTable
&) m_acceleratorTable
; }
320 // Make the window modal (all other windows unresponsive)
321 virtual void MakeModal(bool modal
);
323 // Get the private handle (platform-dependent)
324 inline void *GetHandle() const;
326 // Set/get the window's relatives
327 inline wxWindow
*GetParent() const;
328 inline void SetParent(wxWindow
*p
) ;
329 inline wxWindow
*GetGrandParent() const;
330 inline wxList
& GetChildren() const;
331 // Reparents this window to have the new parent.
332 virtual bool Reparent(wxWindow
* parent
);
334 // Set/get the window's font
335 virtual void SetFont(const wxFont
& f
);
336 inline virtual wxFont
& GetFont() const;
338 // Set/get the window's validator
339 void SetValidator(const wxValidator
& validator
);
340 inline wxValidator
*GetValidator() const;
342 virtual void SetClientObject( wxClientData
*data
);
343 virtual wxClientData
*GetClientObject();
345 virtual void SetClientData( void *data
);
346 virtual void *GetClientData();
348 // Set/get the window's style
349 inline void SetWindowStyleFlag(long flag
);
350 inline long GetWindowStyleFlag() const;
352 // Handle a control command
353 virtual void OnCommand(wxWindow
& win
, wxCommandEvent
& event
);
355 // Set/get event handler
356 inline void SetEventHandler(wxEvtHandler
*handler
);
357 inline wxEvtHandler
*GetEventHandler() const;
359 // Push/pop event handler (i.e. allow a chain of event handlers
361 void PushEventHandler(wxEvtHandler
*handler
) ;
362 wxEvtHandler
*PopEventHandler(bool deleteHandler
= FALSE
) ;
364 // Close the window by calling OnClose, posting a deletion
365 virtual bool Close(bool force
= FALSE
);
367 // Destroy the window (delayed, if a managed window)
368 virtual bool Destroy() ;
370 // Mode for telling default OnSize members to
371 // call Layout(), if not using Sizers, just top-down constraints
372 inline void SetAutoLayout(bool a
);
373 inline bool GetAutoLayout() const;
375 // Set/get constraints
376 inline wxLayoutConstraints
*GetConstraints() const;
377 void SetConstraints(wxLayoutConstraints
*c
);
379 // Set/get window background colour
380 virtual void SetBackgroundColour(const wxColour
& col
);
381 inline virtual wxColour
GetBackgroundColour() const;
383 // Set/get window foreground colour
384 virtual void SetForegroundColour(const wxColour
& col
);
385 inline virtual wxColour
GetForegroundColour() const;
387 // Get the default button, if there is one
388 inline virtual wxButton
*GetDefaultItem() const;
389 inline virtual void SetDefaultItem(wxButton
*but
);
391 // Override to define new behaviour for default action (e.g. double clicking
393 virtual void OnDefaultAction(wxControl
*initiatingItem
);
396 #if wxUSE_WX_RESOURCES
397 virtual bool LoadFromResource(wxWindow
*parent
, const wxString
& resourceName
, const wxResourceTable
*table
= NULL
);
398 virtual wxControl
*CreateItem(const wxItemResource
* childResource
, const wxItemResource
* parentResource
,
399 const wxResourceTable
*table
= (const wxResourceTable
*) NULL
);
402 virtual void GetTextExtent(const wxString
& string
, int *x
, int *y
,
404 int *externalLeading
= NULL
,
405 const wxFont
*theFont
= NULL
, bool use16
= FALSE
) const;
407 // Is the window retained?
408 inline bool IsRetained() const;
410 // Warp the pointer the given position
411 virtual void WarpPointer(int x_pos
, int y_pos
) ;
414 virtual void Clear();
416 // Find a window by id or name
417 virtual wxWindow
*FindWindow(long id
);
418 virtual wxWindow
*FindWindow(const wxString
& name
);
420 // Constraint operations
422 void SetSizer(wxSizer
*sizer
); // Adds sizer child to this window
423 inline wxSizer
*GetSizer() const ;
424 inline wxWindow
*GetSizerParent() const ;
425 inline void SetSizerParent(wxWindow
*win
);
427 // Do Update UI processing for controls
428 void UpdateWindowUI();
430 void OnEraseBackground(wxEraseEvent
& event
);
431 void OnChar(wxKeyEvent
& event
);
432 void OnKeyDown(wxKeyEvent
& event
);
433 void OnKeyUp(wxKeyEvent
& event
);
434 void OnPaint(wxPaintEvent
& event
);
435 void OnIdle(wxIdleEvent
& event
);
437 // Does this window want to accept keyboard focus?
438 virtual bool AcceptsFocus() const;
440 virtual void PrepareDC( wxDC
& WXUNUSED(dc
) ) {};
444 ////////////////////////////////////////////////////////////////////////
447 // For implementation purposes - sometimes decorations make the client area
449 virtual wxPoint
GetClientAreaOrigin() const;
451 // Makes an adjustment to the window position (for example, a frame that has
452 // a toolbar that it manages itself).
453 virtual void AdjustForParentClientOrigin(int& x
, int& y
, int sizeFlags
);
455 // Executes the default message
456 virtual long Default();
458 /* TODO: you may need something like this
459 // Determine whether 3D effects are wanted
460 virtual WXDWORD Determine3DEffects(WXDWORD defaultBorderStyle, bool *want3D);
463 virtual void AddChild(wxWindow
*child
); // Adds reference to the child object
464 virtual void RemoveChild(wxWindow
*child
); // Removes reference to child
465 // (but doesn't delete the child object)
466 virtual void DestroyChildren(); // Removes and destroys all children
468 inline bool IsBeingDeleted() const { return FALSE
; } // TODO: Should probably eliminate this
470 // Constraint implementation
471 void UnsetConstraints(wxLayoutConstraints
*c
);
472 inline wxList
*GetConstraintsInvolvedIn() const ;
473 // Back-pointer to other windows we're involved with, so if we delete
474 // this window, we must delete any constraints we're involved with.
475 void AddConstraintReference(wxWindow
*otherWin
);
476 void RemoveConstraintReference(wxWindow
*otherWin
);
477 void DeleteRelatedConstraints();
479 virtual void ResetConstraints();
480 virtual void SetConstraintSizes(bool recurse
= TRUE
);
481 virtual bool LayoutPhase1(int *noChanges
);
482 virtual bool LayoutPhase2(int *noChanges
);
483 virtual bool DoPhase(int);
484 // Transforms from sizer coordinate space to actual
485 // parent coordinate space
486 virtual void TransformSizerToActual(int *x
, int *y
) const ;
488 // Set size with transformation to actual coordinates if nec.
489 virtual void SizerSetSize(int x
, int y
, int w
, int h
);
490 virtual void SizerMove(int x
, int y
);
492 // Only set/get the size/position of the constraint (if any)
493 virtual void SetSizeConstraint(int x
, int y
, int w
, int h
);
494 virtual void MoveConstraint(int x
, int y
);
495 virtual void GetSizeConstraint(int *w
, int *h
) const ;
496 virtual void GetClientSizeConstraint(int *w
, int *h
) const ;
497 virtual void GetPositionConstraint(int *x
, int *y
) const ;
499 // Dialog units translations. Implemented in wincmn.cpp.
500 wxPoint
ConvertPixelsToDialog(const wxPoint
& pt
) ;
501 wxPoint
ConvertDialogToPixels(const wxPoint
& pt
) ;
502 inline wxSize
ConvertPixelsToDialog(const wxSize
& sz
)
503 { wxPoint
pt(ConvertPixelsToDialog(wxPoint(sz
.x
, sz
.y
))); return wxSize(pt
.x
, pt
.y
); }
504 inline wxSize
ConvertDialogToPixels(const wxSize
& sz
)
505 { wxPoint
pt(ConvertDialogToPixels(wxPoint(sz
.x
, sz
.y
))); return wxSize(pt
.x
, pt
.y
); }
507 wxObject
*GetChild(int number
) const ;
509 // Generates a new id for controls
510 static int NewControlId();
512 // Responds to colour changes: passes event on to children.
513 void OnSysColourChanged(wxSysColourChangedEvent
& event
);
515 // Transfers data to any child controls
516 void OnInitDialog(wxInitDialogEvent
& event
);
518 // Sends an OnInitDialog event, which in turns transfers data to
519 // to the window via validators.
520 virtual void InitDialog();
524 void ClearUpdateRects();
525 void CanvasGetSize(int* width
, int* height
) const; // If have drawing area
526 void CanvasGetClientSize(int *width
, int *height
) const;
527 void CanvasGetPosition(int *x
, int *y
) const; // If have drawing area
528 void CanvasSetClientSize(int width
, int size
);
529 void CanvasSetSize(int x
, int y
, int width
, int height
, int sizeFlags
= wxSIZE_AUTO
);
531 // Gives window a chance to do something in response to a size
532 // message, e.g. arrange status bar, toolbar etc.
533 virtual bool PreResize() { return TRUE
; }
535 // Get main widget for this window, e.g. a text widget
536 virtual WXWidget
GetMainWidget() const;
537 // Get the widget that corresponds to the label (for font setting, label setting etc.)
538 virtual WXWidget
GetLabelWidget() const { return GetMainWidget(); }
539 // Get the client widget for this window (something we can
540 // create other windows on)
541 virtual WXWidget
GetClientWidget() const;
542 // Get the top widget for this window, e.g. the scrolled widget parent
543 // of a multi-line text widget. Top means, top in the window hierarchy
544 // that implements this window.
545 virtual WXWidget
GetTopWidget() const;
546 virtual void SetMainWidget(WXWidget w
) { m_mainWidget
= w
; }
547 bool CanAddEventHandler() const { return m_canAddEventHandler
; }
548 void SetCanAddEventHandler(bool flag
) { m_canAddEventHandler
= flag
; }
550 // Get the underlying X window and display
551 virtual WXWindow
GetXWindow() const;
552 virtual WXDisplay
*GetXDisplay() const;
554 virtual WXPixmap
GetBackingPixmap() const { return m_backingPixmap
; }
555 inline int GetPixmapWidth() const { return m_pixmapWidth
; }
556 inline int GetPixmapHeight() const { return m_pixmapHeight
; }
559 virtual void ChangeFont(bool keepOriginalSize
= TRUE
); // Change to the current font (often overridden)
560 virtual void DoChangeForegroundColour(WXWidget widget
, wxColour
& foregroundColour
);
561 virtual void DoChangeBackgroundColour(WXWidget widget
, wxColour
& backgroundColour
, bool changeArmColour
= FALSE
);
562 // These to be overridden as needed (may change several widgets)
563 virtual void ChangeBackgroundColour(); // Change background and foreground colour using current
564 // background colour setting (Motif generates
565 // foreground based on background)
566 virtual void ChangeForegroundColour(); // Change foreground colour using current
567 // foreground colour setting
569 // Adds the widget to the hash table and adds event handlers.
570 bool AttachWidget (wxWindow
* parent
, WXWidget mainWidget
,
571 WXWidget formWidget
, int x
, int y
, int width
, int height
);
572 bool DetachWidget(WXWidget widget
);
574 // Generates a paint event
575 virtual void DoPaint();
577 // How to implement accelerators. If we find a key event,
578 // translate to wxWindows wxKeyEvent form. Find a widget for the window.
579 // Now find a wxWindow for the widget. If there isn't one, go up the widget hierarchy
580 // trying to find one. Once one is found, call ProcessAccelerator for the
581 // window. If it returns TRUE (processed the event), skip the X event,
582 // otherwise carry on up the wxWindows window hierarchy calling ProcessAccelerator.
583 // If all return FALSE, process the X event as normal.
584 // Eventually we can implement OnCharHook the same way, but concentrate on accelerators
586 // ProcessAccelerator must look at the current accelerator table, and try to find
587 // what menu id or window (beneath it) has this ID. Then construct an appropriate command
588 // event and send it.
589 virtual bool ProcessAccelerator(wxKeyEvent
& event
);
591 ////////////////////////////////////////////////////////////////////////
595 long m_windowStyle
; // Store the window's style
596 wxEvtHandler
* m_windowEventHandler
; // Usually is 'this'
597 wxLayoutConstraints
* m_constraints
; // Constraints for this window
598 wxList
* m_constraintsInvolvedIn
; // List of constraints we're involved in
599 wxSizer
* m_windowSizer
; // Window's top-level sizer (if any)
600 wxWindow
* m_sizerParent
; // Window's parent sizer (if any)
601 bool m_autoLayout
; // Whether to call Layout() in OnSize
602 wxWindow
* m_windowParent
; // Each window always knows its parent
603 wxValidator
* m_windowValidator
;
614 wxFont m_windowFont
; // Window's font
615 wxCursor m_windowCursor
; // Window's cursor
616 wxString m_windowName
; // Window name
618 wxButton
* m_defaultItem
;
620 wxColour m_backgroundColour
;
621 wxColour m_foregroundColour
;
622 wxAcceleratorTable m_acceleratorTable
;
623 wxClientData
* m_clientObject
;
626 #if wxUSE_DRAG_AND_DROP
627 wxDropTarget
*m_pDropTarget
; // the current drop target or NULL
628 #endif //USE_DRAG_AND_DROP
631 wxRegion m_updateRegion
;
632 wxList
* m_children
; // Window's children
637 bool m_canAddEventHandler
;
638 bool m_button1Pressed
;
639 bool m_button2Pressed
;
640 bool m_button3Pressed
;
641 // For double-click detection
642 long m_lastTS
; // last timestamp
643 int m_lastButton
; // last pressed button
644 wxList m_updateRects
; // List of wxRects representing damaged region
647 WXWidget m_mainWidget
;
648 WXWidget m_hScrollBar
;
649 WXWidget m_vScrollBar
;
650 WXWidget m_borderWidget
;
651 WXWidget m_scrolledWindow
;
652 WXWidget m_drawingArea
;
656 WXPixmap m_backingPixmap
;
661 int m_scrollPosX
; // Store the last scroll pos,
662 int m_scrollPosY
; // since in wxWin the pos isn't
663 // set automatically by system
665 DECLARE_EVENT_TABLE()
668 ////////////////////////////////////////////////////////////////////////
671 inline void *wxWindow::GetHandle() const { return (void *)NULL
; }
672 inline int wxWindow::GetId() const { return m_windowId
; }
673 inline void wxWindow::SetId(int id
) { m_windowId
= id
; }
674 inline wxWindow
*wxWindow::GetParent() const { return m_windowParent
; }
675 inline void wxWindow::SetParent(wxWindow
*p
) { m_windowParent
= p
; }
676 inline wxWindow
*wxWindow::GetGrandParent() const { return (m_windowParent
? m_windowParent
->m_windowParent
: (wxWindow
*) NULL
); }
677 inline wxList
& wxWindow::GetChildren() const { return (wxList
&) * m_children
; }
678 inline wxFont
& wxWindow::GetFont() const { return (wxFont
&) m_windowFont
; }
679 inline wxString
wxWindow::GetName() const { return m_windowName
; }
680 inline void wxWindow::SetName(const wxString
& name
) { m_windowName
= name
; }
681 inline long wxWindow::GetWindowStyleFlag() const { return m_windowStyle
; }
682 inline void wxWindow::SetWindowStyleFlag(long flag
) { m_windowStyle
= flag
; }
683 inline void wxWindow::SetEventHandler(wxEvtHandler
*handler
) { m_windowEventHandler
= handler
; }
684 inline wxEvtHandler
*wxWindow::GetEventHandler() const { return m_windowEventHandler
; }
685 inline void wxWindow::SetAutoLayout(bool a
) { m_autoLayout
= a
; }
686 inline bool wxWindow::GetAutoLayout() const { return m_autoLayout
; }
687 inline wxLayoutConstraints
*wxWindow::GetConstraints() const { return m_constraints
; }
688 inline wxColour
wxWindow::GetBackgroundColour() const { return m_backgroundColour
; };
689 inline wxColour
wxWindow::GetForegroundColour() const { return m_foregroundColour
; };
691 inline wxButton
*wxWindow::GetDefaultItem() const { return m_defaultItem
; }
692 inline void wxWindow::SetDefaultItem(wxButton
*but
) { m_defaultItem
= but
; }
693 inline bool wxWindow::IsRetained() const { return ((m_windowStyle
& wxRETAINED
) == wxRETAINED
); }
695 inline wxList
*wxWindow::GetConstraintsInvolvedIn() const { return m_constraintsInvolvedIn
; }
696 inline wxSizer
*wxWindow::GetSizer() const { return m_windowSizer
; }
697 inline wxWindow
*wxWindow::GetSizerParent() const { return m_sizerParent
; }
698 inline void wxWindow::SetSizerParent(wxWindow
*win
) { m_sizerParent
= win
; }
699 inline wxValidator
*wxWindow::GetValidator() const { return m_windowValidator
; }
700 inline void wxWindow::SetReturnCode(int retCode
) { m_returnCode
= retCode
; }
701 inline int wxWindow::GetReturnCode() { return m_returnCode
; }
703 // Get the active window.
704 wxWindow
* WXDLLEXPORT
wxGetActiveWindow();
706 WXDLLEXPORT_DATA(extern wxList
) wxTopLevelWindows
;
708 // A little class to switch off size optimization while an instance of the object
710 class WXDLLEXPORT wxNoOptimize
: public wxObject
716 static bool CanOptimize();