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 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 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 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;
194 // set the window size and/or position
195 void SetSize( int x
, int y
, int width
, int height
,
196 int sizeFlags
= wxSIZE_AUTO
)
197 { DoSetSize(x
, y
, width
, height
, sizeFlags
); }
199 void SetSize( int width
, int height
)
200 { DoSetSize( -1, -1, width
, height
, wxSIZE_USE_EXISTING
); }
202 void SetSize( const wxSize
& size
)
203 { SetSize( size
.x
, size
.y
); }
205 void SetSize(const wxRect
& rect
, int sizeFlags
= wxSIZE_AUTO
)
206 { DoSetSize(rect
.x
, rect
.y
, rect
.width
, rect
.height
, sizeFlags
); }
208 void Move( int x
, int y
)
209 { DoSetSize( x
, y
, -1, -1, wxSIZE_USE_EXISTING
); }
211 void Move(const wxPoint
& pt
)
212 { Move(pt
.x
, pt
.y
); }
214 // client size is the size of area available for subwindows
215 void SetClientSize( int width
, int height
)
216 { DoSetClientSize(width
, height
); }
218 void SetClientSize( const wxSize
& size
)
219 { DoSetClientSize(size
.x
, size
.y
); }
221 void SetClientSize(const wxRect
& rect
)
222 { SetClientSize( rect
.width
, rect
.height
); }
224 // get the window position and/or size
225 virtual void GetPosition( int *x
, int *y
) const;
226 wxPoint
GetPosition() const
229 GetPosition(& w
, & h
);
231 return wxPoint(w
, h
);
234 virtual void GetSize( int *width
, int *height
) const;
236 wxSize
GetSize() const
243 wxRect
GetRect() const
246 GetPosition(& x
, & y
);
249 return wxRect(x
, y
, w
, h
);
252 virtual void GetClientSize( int *width
, int *height
) const;
253 wxSize
GetClientSize() const
256 GetClientSize(& w
, & h
);
260 // Convert client to screen coordinates
261 virtual void ClientToScreen(int *x
, int *y
) const;
262 virtual wxPoint
ClientToScreen(const wxPoint
& pt
) const
263 { int x
= pt
.x
; int y
= pt
.y
; ClientToScreen(& x
, & y
); return wxPoint(x
, y
); }
265 // Convert screen to client coordinates
266 virtual void ScreenToClient(int *x
, int *y
) const;
267 virtual wxPoint
ScreenToClient(const wxPoint
& pt
) const
268 { int x
= pt
.x
; int y
= pt
.y
; ScreenToClient(& x
, & y
); return wxPoint(x
, y
); }
270 // Set the focus to this window
271 virtual void SetFocus();
273 // Capture/release mouse
274 virtual void CaptureMouse();
275 virtual void ReleaseMouse();
277 // Enable or disable the window
278 virtual void Enable(bool enable
);
280 #if wxUSE_DRAG_AND_DROP
281 // Associate a drop target with this window (if the window already had a drop
282 // target, it's deleted!) and return the current drop target (may be NULL).
283 void SetDropTarget(wxDropTarget
*pDropTarget
);
284 wxDropTarget
*GetDropTarget() const { return m_pDropTarget
; }
287 // Accept files for dragging
288 virtual void DragAcceptFiles(bool accept
);
291 // create a tooltip with this text
292 void SetToolTip(const wxString
& tip
);
296 // pointer may be NULL to remove the tooltip
297 void SetToolTip(wxToolTip
*tooltip
);
298 // get the current tooltip (may return NULL if none)
299 wxToolTip
* GetToolTip() const { return m_tooltip
; }
302 // Update region access
303 virtual wxRegion
& GetUpdateRegion() const;
304 virtual bool IsExposed(int x
, int y
, int w
, int h
) const;
305 virtual bool IsExposed(const wxPoint
& pt
) const;
306 virtual bool IsExposed(const wxRect
& rect
) const;
308 // Set/get the window title
309 virtual void SetTitle(const wxString
& WXUNUSED(title
)) {};
310 virtual wxString
GetTitle() const { return wxString(""); };
311 // Most windows have the concept of a label; for frames, this is the
312 // title; for items, this is the label or button text.
313 virtual wxString
GetLabel() const { return GetTitle(); }
315 // Set/get the window name (used for resource setting in X)
316 virtual wxString
GetName() const;
317 virtual void SetName(const wxString
& name
);
320 virtual void Centre(int direction
) ;
321 void Center(int direction
= wxHORIZONTAL
) { Centre(direction
); }
324 virtual bool PopupMenu(wxMenu
*menu
, int x
, int y
);
326 // Send the window a refresh event
327 virtual void Refresh(bool eraseBack
= TRUE
, const wxRect
*rect
= NULL
);
329 // New functions that will replace the above.
330 virtual void SetScrollbar(int orient
, int pos
, int thumbVisible
,
331 int range
, bool refresh
= TRUE
);
333 // Helper functions for Motif
334 void CreateScrollbar(int orientation
);
335 void DestroyScrollbar(int orientation
);
337 virtual void SetScrollPos(int orient
, int pos
, bool refresh
= TRUE
);
338 virtual int GetScrollPos(int orient
) const;
339 virtual int GetScrollRange(int orient
) const;
340 virtual int GetScrollThumb(int orient
) const;
342 virtual void ScrollWindow(int dx
, int dy
, const wxRect
*rect
= NULL
);
344 // Caret manipulation
345 virtual void CreateCaret(int w
, int h
);
346 virtual void CreateCaret(const wxBitmap
*bitmap
);
347 virtual void DestroyCaret();
348 virtual void ShowCaret(bool show
);
349 virtual void SetCaretPos(int x
, int y
);
350 virtual void GetCaretPos(int *x
, int *y
) const;
352 // Tell window how much it can be sized
353 virtual void SetSizeHints(int minW
= -1, int minH
= -1, int maxW
= -1, int maxH
= -1, int incW
= -1, int incH
= -1);
355 // Set/get the window's identifier
356 inline int GetId() const;
357 inline void SetId(int id
);
359 virtual void SetAcceleratorTable(const wxAcceleratorTable
& accel
);
360 virtual wxAcceleratorTable
& GetAcceleratorTable() const { return (wxAcceleratorTable
&) m_acceleratorTable
; }
362 // Make the window modal (all other windows unresponsive)
363 virtual void MakeModal(bool modal
);
365 // Get the private handle (platform-dependent)
366 inline void *GetHandle() const;
368 // Set/get the window's relatives
369 inline wxWindow
*GetParent() const;
370 inline void SetParent(wxWindow
*p
) ;
371 inline wxWindow
*GetGrandParent() const;
372 inline wxList
& GetChildren() const;
373 // Reparents this window to have the new parent.
374 virtual bool Reparent(wxWindow
* parent
);
376 // Set/get the window's font
377 virtual void SetFont(const wxFont
& f
);
378 virtual wxFont
& GetFont() const;
380 // Set/get the window's validator
381 void SetValidator(const wxValidator
& validator
);
382 inline wxValidator
*GetValidator() const;
384 virtual void SetClientObject( wxClientData
*data
);
385 virtual wxClientData
*GetClientObject();
387 virtual void SetClientData( void *data
);
388 virtual void *GetClientData();
390 // Set/get the window's style
391 inline void SetWindowStyleFlag(long flag
);
392 inline long GetWindowStyleFlag() const;
394 // Handle a control command
395 virtual void OnCommand(wxWindow
& win
, wxCommandEvent
& event
);
397 // Set/get event handler
398 inline void SetEventHandler(wxEvtHandler
*handler
);
399 inline wxEvtHandler
*GetEventHandler() const;
401 // Push/pop event handler (i.e. allow a chain of event handlers
403 void PushEventHandler(wxEvtHandler
*handler
) ;
404 wxEvtHandler
*PopEventHandler(bool deleteHandler
= FALSE
) ;
406 // Close the window by calling OnClose, posting a deletion
407 virtual bool Close(bool force
= FALSE
);
409 // Destroy the window (delayed, if a managed window)
410 virtual bool Destroy() ;
412 // Mode for telling default OnSize members to
413 // call Layout(), if not using Sizers, just top-down constraints
414 inline void SetAutoLayout(bool a
);
415 inline bool GetAutoLayout() const;
417 // Set/get constraints
418 inline wxLayoutConstraints
*GetConstraints() const;
419 void SetConstraints(wxLayoutConstraints
*c
);
421 // Set/get window background colour
422 virtual void SetBackgroundColour(const wxColour
& col
);
423 virtual wxColour
GetBackgroundColour() const;
425 // Set/get window foreground colour
426 virtual void SetForegroundColour(const wxColour
& col
);
427 virtual wxColour
GetForegroundColour() const;
429 // Get the default button, if there is one
430 virtual wxButton
*GetDefaultItem() const;
431 virtual void SetDefaultItem(wxButton
*but
);
433 // Override to define new behaviour for default action (e.g. double clicking
435 virtual void OnDefaultAction(wxControl
*initiatingItem
);
438 #if wxUSE_WX_RESOURCES
439 virtual bool LoadFromResource(wxWindow
*parent
, const wxString
& resourceName
, const wxResourceTable
*table
= NULL
);
440 virtual wxControl
*CreateItem(const wxItemResource
* childResource
, const wxItemResource
* parentResource
,
441 const wxResourceTable
*table
= (const wxResourceTable
*) NULL
);
444 virtual void GetTextExtent(const wxString
& string
, int *x
, int *y
,
446 int *externalLeading
= NULL
,
447 const wxFont
*theFont
= NULL
, bool use16
= FALSE
) const;
449 // Is the window retained?
450 inline bool IsRetained() const;
452 // Warp the pointer the given position
453 virtual void WarpPointer(int x_pos
, int y_pos
) ;
456 virtual void Clear();
458 // Find a window by id or name
459 virtual wxWindow
*FindWindow(long id
);
460 virtual wxWindow
*FindWindow(const wxString
& name
);
462 // Constraint operations
464 void SetSizer(wxSizer
*sizer
); // Adds sizer child to this window
465 inline wxSizer
*GetSizer() const ;
466 inline wxWindow
*GetSizerParent() const ;
467 inline void SetSizerParent(wxWindow
*win
);
469 // Do Update UI processing for controls
470 void UpdateWindowUI();
472 void OnEraseBackground(wxEraseEvent
& event
);
473 void OnChar(wxKeyEvent
& event
);
474 void OnKeyDown(wxKeyEvent
& event
);
475 void OnKeyUp(wxKeyEvent
& event
);
476 void OnPaint(wxPaintEvent
& event
);
477 void OnIdle(wxIdleEvent
& event
);
479 // Does this window want to accept keyboard focus?
480 virtual bool AcceptsFocus() const;
482 virtual void PrepareDC( wxDC
& WXUNUSED(dc
) ) {};
486 ////////////////////////////////////////////////////////////////////////
489 // For implementation purposes - sometimes decorations make the client area
491 virtual wxPoint
GetClientAreaOrigin() const;
493 // Makes an adjustment to the window position (for example, a frame that has
494 // a toolbar that it manages itself).
495 virtual void AdjustForParentClientOrigin(int& x
, int& y
, int sizeFlags
);
497 // Executes the default message
498 virtual long Default();
500 /* TODO: you may need something like this
501 // Determine whether 3D effects are wanted
502 virtual WXDWORD Determine3DEffects(WXDWORD defaultBorderStyle, bool *want3D);
505 virtual void AddChild(wxWindow
*child
); // Adds reference to the child object
506 virtual void RemoveChild(wxWindow
*child
); // Removes reference to child
507 // (but doesn't delete the child object)
508 virtual void DestroyChildren(); // Removes and destroys all children
510 bool IsBeingDeleted() const { return FALSE
; } // TODO: Should probably eliminate this
512 // Constraint implementation
513 void UnsetConstraints(wxLayoutConstraints
*c
);
514 inline wxList
*GetConstraintsInvolvedIn() const ;
515 // Back-pointer to other windows we're involved with, so if we delete
516 // this window, we must delete any constraints we're involved with.
517 void AddConstraintReference(wxWindow
*otherWin
);
518 void RemoveConstraintReference(wxWindow
*otherWin
);
519 void DeleteRelatedConstraints();
521 virtual void ResetConstraints();
522 virtual void SetConstraintSizes(bool recurse
= TRUE
);
523 virtual bool LayoutPhase1(int *noChanges
);
524 virtual bool LayoutPhase2(int *noChanges
);
525 virtual bool DoPhase(int);
526 // Transforms from sizer coordinate space to actual
527 // parent coordinate space
528 virtual void TransformSizerToActual(int *x
, int *y
) const ;
530 // Set size with transformation to actual coordinates if nec.
531 virtual void SizerSetSize(int x
, int y
, int w
, int h
);
532 virtual void SizerMove(int x
, int y
);
534 // Only set/get the size/position of the constraint (if any)
535 virtual void SetSizeConstraint(int x
, int y
, int w
, int h
);
536 virtual void MoveConstraint(int x
, int y
);
537 virtual void GetSizeConstraint(int *w
, int *h
) const ;
538 virtual void GetClientSizeConstraint(int *w
, int *h
) const ;
539 virtual void GetPositionConstraint(int *x
, int *y
) const ;
541 // Dialog units translations. Implemented in wincmn.cpp.
542 wxPoint
ConvertPixelsToDialog(const wxPoint
& pt
) ;
543 wxPoint
ConvertDialogToPixels(const wxPoint
& pt
) ;
544 inline wxSize
ConvertPixelsToDialog(const wxSize
& sz
)
545 { wxPoint
pt(ConvertPixelsToDialog(wxPoint(sz
.x
, sz
.y
))); return wxSize(pt
.x
, pt
.y
); }
546 inline wxSize
ConvertDialogToPixels(const wxSize
& sz
)
547 { wxPoint
pt(ConvertDialogToPixels(wxPoint(sz
.x
, sz
.y
))); return wxSize(pt
.x
, pt
.y
); }
549 wxObject
*GetChild(int number
) const ;
551 // Generates a new id for controls
552 static int NewControlId();
554 // Responds to colour changes: passes event on to children.
555 void OnSysColourChanged(wxSysColourChangedEvent
& event
);
557 // Transfers data to any child controls
558 void OnInitDialog(wxInitDialogEvent
& event
);
560 // Sends an OnInitDialog event, which in turns transfers data to
561 // to the window via validators.
562 virtual void InitDialog();
566 void ClearUpdateRects();
567 void CanvasGetSize(int* width
, int* height
) const; // If have drawing area
568 void CanvasGetClientSize(int *width
, int *height
) const;
569 void CanvasGetPosition(int *x
, int *y
) const; // If have drawing area
570 void CanvasSetClientSize(int width
, int size
);
571 void CanvasSetSize(int x
, int y
, int width
, int height
, int sizeFlags
= wxSIZE_AUTO
);
573 // Gives window a chance to do something in response to a size
574 // message, e.g. arrange status bar, toolbar etc.
575 virtual bool PreResize() { return TRUE
; }
577 // Get main widget for this window, e.g. a text widget
578 virtual WXWidget
GetMainWidget() const;
579 // Get the widget that corresponds to the label (for font setting, label setting etc.)
580 virtual WXWidget
GetLabelWidget() const { return GetMainWidget(); }
581 // Get the client widget for this window (something we can
582 // create other windows on)
583 virtual WXWidget
GetClientWidget() const;
584 // Get the top widget for this window, e.g. the scrolled widget parent
585 // of a multi-line text widget. Top means, top in the window hierarchy
586 // that implements this window.
587 virtual WXWidget
GetTopWidget() const;
588 virtual void SetMainWidget(WXWidget w
) { m_mainWidget
= w
; }
589 bool CanAddEventHandler() const { return m_canAddEventHandler
; }
590 void SetCanAddEventHandler(bool flag
) { m_canAddEventHandler
= flag
; }
592 // Get the underlying X window and display
593 virtual WXWindow
GetXWindow() const;
594 virtual WXDisplay
*GetXDisplay() const;
596 virtual WXPixmap
GetBackingPixmap() const { return m_backingPixmap
; }
597 int GetPixmapWidth() const { return m_pixmapWidth
; }
598 int GetPixmapHeight() const { return m_pixmapHeight
; }
601 virtual void ChangeFont(bool keepOriginalSize
= TRUE
); // Change to the current font (often overridden)
602 virtual void DoChangeForegroundColour(WXWidget widget
, wxColour
& foregroundColour
);
603 virtual void DoChangeBackgroundColour(WXWidget widget
, wxColour
& backgroundColour
, bool changeArmColour
= FALSE
);
604 // These to be overridden as needed (may change several widgets)
605 virtual void ChangeBackgroundColour(); // Change background and foreground colour using current
606 // background colour setting (Motif generates
607 // foreground based on background)
608 virtual void ChangeForegroundColour(); // Change foreground colour using current
609 // foreground colour setting
611 // Adds the widget to the hash table and adds event handlers.
612 bool AttachWidget (wxWindow
* parent
, WXWidget mainWidget
,
613 WXWidget formWidget
, int x
, int y
, int width
, int height
);
614 bool DetachWidget(WXWidget widget
);
616 // Generates a paint event
617 virtual void DoPaint();
619 // How to implement accelerators. If we find a key event,
620 // translate to wxWindows wxKeyEvent form. Find a widget for the window.
621 // Now find a wxWindow for the widget. If there isn't one, go up the widget hierarchy
622 // trying to find one. Once one is found, call ProcessAccelerator for the
623 // window. If it returns TRUE (processed the event), skip the X event,
624 // otherwise carry on up the wxWindows window hierarchy calling ProcessAccelerator.
625 // If all return FALSE, process the X event as normal.
626 // Eventually we can implement OnCharHook the same way, but concentrate on accelerators
628 // ProcessAccelerator must look at the current accelerator table, and try to find
629 // what menu id or window (beneath it) has this ID. Then construct an appropriate command
630 // event and send it.
631 virtual bool ProcessAccelerator(wxKeyEvent
& event
);
633 ////////////////////////////////////////////////////////////////////////
637 long m_windowStyle
; // Store the window's style
638 wxEvtHandler
* m_windowEventHandler
; // Usually is 'this'
639 wxLayoutConstraints
* m_constraints
; // Constraints for this window
640 wxList
* m_constraintsInvolvedIn
; // List of constraints we're involved in
641 wxSizer
* m_windowSizer
; // Window's top-level sizer (if any)
642 wxWindow
* m_sizerParent
; // Window's parent sizer (if any)
643 bool m_autoLayout
; // Whether to call Layout() in OnSize
644 wxWindow
* m_windowParent
; // Each window always knows its parent
645 wxValidator
* m_windowValidator
;
656 wxFont m_windowFont
; // Window's font
657 wxCursor m_windowCursor
; // Window's cursor
658 wxString m_windowName
; // Window name
660 wxButton
* m_defaultItem
;
662 wxColour m_backgroundColour
;
663 wxColour m_foregroundColour
;
664 wxAcceleratorTable m_acceleratorTable
;
665 wxClientData
* m_clientObject
;
668 #if wxUSE_DRAG_AND_DROP
669 wxDropTarget
*m_pDropTarget
; // the current drop target or NULL
670 #endif //USE_DRAG_AND_DROP
673 wxRegion m_updateRegion
;
674 wxList
* m_children
; // Window's children
679 bool m_needsRefresh
; // Do we need to repaint the backing store?
680 bool m_canAddEventHandler
;
681 bool m_button1Pressed
;
682 bool m_button2Pressed
;
683 bool m_button3Pressed
;
684 // For double-click detection
685 long m_lastTS
; // last timestamp
686 int m_lastButton
; // last pressed button
687 wxList m_updateRects
; // List of wxRects representing damaged region
690 WXWidget m_mainWidget
;
691 WXWidget m_hScrollBar
;
692 WXWidget m_vScrollBar
;
693 WXWidget m_borderWidget
;
694 WXWidget m_scrolledWindow
;
695 WXWidget m_drawingArea
;
699 WXPixmap m_backingPixmap
;
704 int m_scrollPosX
; // Store the last scroll pos,
705 int m_scrollPosY
; // since in wxWin the pos isn't
706 // set automatically by system
708 // this is the virtual function to be overriden in any derived class which
709 // wants to change how SetSize() or Move() works - it is called by all
710 // versions of these functions in the base class
711 virtual void DoSetSize(int x
, int y
,
712 int width
, int height
,
713 int sizeFlags
= wxSIZE_AUTO
);
715 // same as DoSetSize() for the client size
716 virtual void DoSetClientSize(int width
, int height
);
719 DECLARE_EVENT_TABLE()
722 ////////////////////////////////////////////////////////////////////////
725 inline void *wxWindow::GetHandle() const { return (void *)NULL
; }
726 inline int wxWindow::GetId() const { return m_windowId
; }
727 inline void wxWindow::SetId(int id
) { m_windowId
= id
; }
728 inline wxWindow
*wxWindow::GetParent() const { return m_windowParent
; }
729 inline void wxWindow::SetParent(wxWindow
*p
) { m_windowParent
= p
; }
730 inline wxWindow
*wxWindow::GetGrandParent() const { return (m_windowParent
? m_windowParent
->m_windowParent
: (wxWindow
*) NULL
); }
731 inline wxList
& wxWindow::GetChildren() const { return (wxList
&) * m_children
; }
732 inline wxFont
& wxWindow::GetFont() const { return (wxFont
&) m_windowFont
; }
733 inline wxString
wxWindow::GetName() const { return m_windowName
; }
734 inline void wxWindow::SetName(const wxString
& name
) { m_windowName
= name
; }
735 inline long wxWindow::GetWindowStyleFlag() const { return m_windowStyle
; }
736 inline void wxWindow::SetWindowStyleFlag(long flag
) { m_windowStyle
= flag
; }
737 inline void wxWindow::SetEventHandler(wxEvtHandler
*handler
) { m_windowEventHandler
= handler
; }
738 inline wxEvtHandler
*wxWindow::GetEventHandler() const { return m_windowEventHandler
; }
739 inline void wxWindow::SetAutoLayout(bool a
) { m_autoLayout
= a
; }
740 inline bool wxWindow::GetAutoLayout() const { return m_autoLayout
; }
741 inline wxLayoutConstraints
*wxWindow::GetConstraints() const { return m_constraints
; }
742 inline wxColour
wxWindow::GetBackgroundColour() const { return m_backgroundColour
; };
743 inline wxColour
wxWindow::GetForegroundColour() const { return m_foregroundColour
; };
745 inline wxButton
*wxWindow::GetDefaultItem() const { return m_defaultItem
; }
746 inline void wxWindow::SetDefaultItem(wxButton
*but
) { m_defaultItem
= but
; }
747 inline bool wxWindow::IsRetained() const { return ((m_windowStyle
& wxRETAINED
) == wxRETAINED
); }
749 inline wxList
*wxWindow::GetConstraintsInvolvedIn() const { return m_constraintsInvolvedIn
; }
750 inline wxSizer
*wxWindow::GetSizer() const { return m_windowSizer
; }
751 inline wxWindow
*wxWindow::GetSizerParent() const { return m_sizerParent
; }
752 inline void wxWindow::SetSizerParent(wxWindow
*win
) { m_sizerParent
= win
; }
753 inline wxValidator
*wxWindow::GetValidator() const { return m_windowValidator
; }
754 inline void wxWindow::SetReturnCode(int retCode
) { m_returnCode
= retCode
; }
755 inline int wxWindow::GetReturnCode() { return m_returnCode
; }
757 // Get the active window.
758 wxWindow
* WXDLLEXPORT
wxGetActiveWindow();
760 WXDLLEXPORT_DATA(extern wxList
) wxTopLevelWindows
;
762 // A little class to switch off size optimization while an instance of the object
764 class WXDLLEXPORT wxNoOptimize
: public wxObject
770 static bool CanOptimize();