1 /////////////////////////////////////////////////////////////////////////////
3 // Purpose: wxWindow class
4 // Author: Julian Smart
8 // Copyright: (c) Julian Smart and Markus Holzem
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"
33 * Base class for frame, panel, canvas, panel items, dialog box.
38 * Event handler: windows have themselves as their event handlers
39 * by default, but their event handlers could be set to another
40 * object entirely. This separation can reduce the amount of
41 * derivation required, and allow alteration of a window's functionality
42 * (e.g. by a resource editor that temporarily switches event handlers).
45 class WXDLLEXPORT wxWindow
;
46 class WXDLLEXPORT wxEvent
;
47 class WXDLLEXPORT wxCommandEvent
;
48 class WXDLLEXPORT wxKeyEvent
;
49 class WXDLLEXPORT wxControl
;
50 class WXDLLEXPORT wxCursor
;
51 class WXDLLEXPORT wxColourMap
;
52 class WXDLLEXPORT wxFont
;
53 class WXDLLEXPORT wxMenu
;
54 class WXDLLEXPORT wxRectangle
;
55 class WXDLLEXPORT wxBitmap
;
56 class WXDLLEXPORT wxSizer
;
57 class WXDLLEXPORT wxList
;
58 class WXDLLEXPORT wxLayoutConstraints
;
59 class WXDLLEXPORT wxMouseEvent
;
60 class WXDLLEXPORT wxButton
;
61 class WXDLLEXPORT wxColour
;
62 class WXDLLEXPORT wxBrush
;
63 class WXDLLEXPORT wxPen
;
64 class WXDLLEXPORT wxIcon
;
65 class WXDLLEXPORT wxDC
;
66 class WXDLLEXPORT wxValidator
;
73 class WXDLLEXPORT wxResourceTable
;
74 class WXDLLEXPORT wxItemResource
;
77 WXDLLEXPORT_DATA(extern const char*) wxPanelNameStr
;
79 WXDLLEXPORT_DATA(extern const wxSize
) wxDefaultSize
;
80 WXDLLEXPORT_DATA(extern const wxPoint
) wxDefaultPosition
;
82 class WXDLLEXPORT wxWindow
: public wxEvtHandler
84 DECLARE_ABSTRACT_CLASS(wxWindow
)
86 friend class wxUpdateIterator
;
88 friend class wxPaintDC
;
92 inline wxWindow(wxWindow
*parent
, wxWindowID id
,
93 const wxPoint
& pos
= wxDefaultPosition
,
94 const wxSize
& size
= wxDefaultSize
,
96 const wxString
& name
= wxPanelNameStr
)
98 m_children
= new wxList
;
99 Create(parent
, id
, pos
, size
, style
, name
);
102 virtual ~wxWindow(void);
104 bool Create(wxWindow
*parent
, wxWindowID id
,
105 const wxPoint
& pos
= wxDefaultPosition
,
106 const wxSize
& size
= wxDefaultSize
,
108 const wxString
& name
= wxPanelNameStr
);
110 // Fit the window around the items
111 virtual void Fit(void);
113 // Show or hide the window
114 virtual bool Show(bool show
);
116 // Is the window shown?
117 virtual bool IsShown(void) const;
119 // Raise the window to the top of the Z order
120 virtual void Raise(void);
122 // Lower the window to the bottom of the Z order
123 virtual void Lower(void);
125 // Is the window enabled?
126 virtual bool IsEnabled(void) const;
129 inline bool Enabled(void) const { return IsEnabled(); }
131 // Dialog support: override these and call
132 // base class members to add functionality
133 // that can't be done using validators.
135 // Transfer values to controls. If returns FALSE,
136 // it's an application error (pops up a dialog)
137 virtual bool TransferDataToWindow(void);
139 // Transfer values from controls. If returns FALSE,
140 // transfer failed: don't quit
141 virtual bool TransferDataFromWindow(void);
143 // Validate controls. If returns FALSE,
144 // validation failed: don't quit
145 virtual bool Validate(void);
147 // Return code for dialogs
148 inline void SetReturnCode(int retCode
);
149 inline int GetReturnCode(void);
152 virtual void SetCursor(const wxCursor
& cursor
);
153 inline virtual wxCursor
*GetCursor(void) const { return (wxCursor
*)& m_windowCursor
; };
155 // Get the window with the focus
156 static wxWindow
*FindFocus(void);
158 // Get character size
159 virtual int GetCharHeight(void) const;
160 virtual int GetCharWidth(void) const;
162 // Get overall window size
163 virtual void GetSize(int *width
, int *height
) const;
165 // Get window position, relative to parent (or screen if no parent)
166 virtual void GetPosition(int *x
, int *y
) const;
168 // Get client (application-useable) size
169 virtual void GetClientSize(int *width
, int *height
) const;
171 // Set overall size and position
172 virtual void SetSize(int x
, int y
, int width
, int height
, int sizeFlags
= wxSIZE_AUTO
);
173 inline virtual void SetSize(int width
, int height
) { SetSize(-1, -1, width
, height
, wxSIZE_USE_EXISTING
); }
174 inline virtual void Move(int x
, int y
) { SetSize(x
, y
, -1, -1, wxSIZE_USE_EXISTING
); }
177 virtual void SetClientSize(int width
, int size
);
179 // Convert client to screen coordinates
180 virtual void ClientToScreen(int *x
, int *y
) const;
182 // Convert screen to client coordinates
183 virtual void ScreenToClient(int *x
, int *y
) const;
185 // Set the focus to this window
186 virtual void SetFocus(void);
188 // Capture/release mouse
189 virtual void CaptureMouse(void);
190 virtual void ReleaseMouse(void);
192 // Enable or disable the window
193 virtual void Enable(bool enable
);
195 #if USE_DRAG_AND_DROP
196 // Associate a drop target with this window (if the window already had a drop
197 // target, it's deleted!) and return the current drop target (may be NULL).
198 void SetDropTarget(wxDropTarget
*pDropTarget
);
199 wxDropTarget
*GetDropTarget() const { return m_pDropTarget
; }
202 // Accept files for dragging
203 virtual void DragAcceptFiles(bool accept
);
205 // Set/get the window title
206 virtual inline void SetTitle(const wxString
& WXUNUSED(title
)) {};
207 inline virtual wxString
GetTitle(void) const { return wxString(""); };
208 // Most windows have the concept of a label; for frames, this is the
209 // title; for items, this is the label or button text.
210 inline virtual wxString
GetLabel(void) const { return GetTitle(); }
212 // Set/get the window name (used for resource setting in X)
213 inline virtual wxString
GetName(void) const;
214 inline virtual void SetName(const wxString
& name
);
217 virtual void Centre(int direction
) ;
218 inline void Center(int direction
= wxHORIZONTAL
) { Centre(direction
); }
221 virtual bool PopupMenu(wxMenu
*menu
, int x
, int y
);
223 // Send the window a refresh event
224 virtual void Refresh(bool eraseBack
= TRUE
, const wxRectangle
*rect
= NULL
);
226 #if WXWIN_COMPATIBILITY
227 // Set/get scroll attributes
228 virtual void SetScrollRange(int orient
, int range
, bool refresh
= TRUE
);
229 virtual void SetScrollPage(int orient
, int page
, bool refresh
= TRUE
);
230 virtual int OldGetScrollRange(int orient
) const;
231 virtual int GetScrollPage(int orient
) const;
234 // New functions that will replace the above.
235 virtual void SetScrollbar(int orient
, int pos
, int thumbVisible
,
236 int range
, bool refresh
= TRUE
);
238 virtual void SetScrollPos(int orient
, int pos
, bool refresh
= TRUE
);
239 virtual int GetScrollPos(int orient
) const;
240 virtual int GetScrollRange(int orient
) const;
241 virtual int GetScrollThumb(int orient
) const;
243 virtual void ScrollWindow(int dx
, int dy
, const wxRectangle
*rect
= NULL
);
245 // Caret manipulation
246 virtual void CreateCaret(int w
, int h
);
247 virtual void CreateCaret(const wxBitmap
*bitmap
);
248 virtual void DestroyCaret(void);
249 virtual void ShowCaret(bool show
);
250 virtual void SetCaretPos(int x
, int y
);
251 virtual void GetCaretPos(int *x
, int *y
) const;
253 // Tell window how much it can be sized
254 virtual void SetSizeHints(int minW
= -1, int minH
= -1, int maxW
= -1, int maxH
= -1, int incW
= -1, int incH
= -1);
256 // Set/get the window's identifier
257 inline int GetId() const;
258 inline void SetId(int id
);
260 // Make the window modal (all other windows unresponsive)
261 virtual void MakeModal(bool modal
);
263 // Get the private handle (platform-dependent)
264 inline void *GetHandle(void) const;
266 // Set/get the window's relatives
267 inline wxWindow
*GetParent(void) const;
268 inline void SetParent(wxWindow
*p
) ;
269 inline wxWindow
*GetGrandParent(void) const;
270 inline wxList
*GetChildren() const;
272 // Set/get the window's font
273 virtual void SetFont(const wxFont
& f
);
274 inline virtual wxFont
*GetFont(void) const;
276 // Set/get the window's validator
277 void SetValidator(const wxValidator
& validator
);
278 inline wxValidator
*GetValidator(void) const;
280 // Set/get the window's style
281 inline void SetWindowStyleFlag(long flag
);
282 inline long GetWindowStyleFlag(void) const;
284 // Set/get double-clickability
285 // TODO: we probably wish to get rid of this, and
286 // always allow double clicks.
287 inline void SetDoubleClick(bool flag
);
288 inline bool GetDoubleClick(void) const;
289 inline void AllowDoubleClick(bool value
) { SetDoubleClick(value
); }
291 // Old way to handle a control command
292 virtual void OnCommand(wxWindow
& win
, wxCommandEvent
& event
);
294 // Set/get event handler
295 inline void SetEventHandler(wxEvtHandler
*handler
);
296 inline wxEvtHandler
*GetEventHandler(void) const;
298 // Push/pop event handler (i.e. allow a chain of event handlers
300 void PushEventHandler(wxEvtHandler
*handler
) ;
301 wxEvtHandler
*PopEventHandler(bool deleteHandler
= FALSE
) ;
303 // Close the window by calling OnClose, posting a deletion
304 virtual bool Close(bool force
= FALSE
);
306 // Destroy the window (delayed, if a managed window)
307 virtual bool Destroy(void) ;
309 // Mode for telling default OnSize members to
310 // call Layout(), if not using Sizers, just top-down constraints
311 inline void SetAutoLayout(bool a
);
312 inline bool GetAutoLayout(void) const;
314 // Set/get constraints
315 inline wxLayoutConstraints
*GetConstraints(void) const;
316 void SetConstraints(wxLayoutConstraints
*c
);
318 // Set/get window background colour
319 inline virtual void SetBackgroundColour(const wxColour
& col
);
320 inline virtual wxColour
GetBackgroundColour(void) const;
322 // Set/get window foreground colour
323 inline virtual void SetForegroundColour(const wxColour
& col
);
324 inline virtual wxColour
GetForegroundColour(void) const;
326 // TODO: are these really necessary???
327 // Set/get window default background colour (for children to inherit)
328 inline virtual void SetDefaultBackgroundColour(const wxColour
& col
);
329 inline virtual wxColour
GetDefaultBackgroundColour(void) const;
331 // Set/get window default foreground colour (for children to inherit)
332 inline virtual void SetDefaultForegroundColour(const wxColour
& col
);
333 inline virtual wxColour
GetDefaultForegroundColour(void) const;
335 // For backward compatibility
336 inline virtual void SetButtonFont(const wxFont
& font
) { SetFont(font
); }
337 inline virtual void SetLabelFont(const wxFont
& font
) { SetFont(font
); }
338 inline virtual wxFont
*GetLabelFont(void) const { return GetFont(); };
339 inline virtual wxFont
*GetButtonFont(void) const { return GetFont(); };
341 // Get the default button, if there is one
342 inline virtual wxButton
*GetDefaultItem(void) const;
343 inline virtual void SetDefaultItem(wxButton
*but
);
345 // Override to define new behaviour for default action (e.g. double clicking
347 virtual void OnDefaultAction(wxControl
*initiatingItem
);
351 virtual bool LoadFromResource(wxWindow
*parent
, const wxString
& resourceName
, const wxResourceTable
*table
= NULL
);
352 virtual wxControl
*CreateItem(const wxItemResource
*childResource
, const wxResourceTable
*table
= NULL
);
355 // Native resource loading
356 virtual bool LoadNativeDialog(wxWindow
* parent
, wxWindowID
& id
);
357 virtual bool LoadNativeDialog(wxWindow
* parent
, const wxString
& name
);
358 virtual wxWindow
* GetWindowChild1(wxWindowID
& id
);
359 virtual wxWindow
* GetWindowChild(wxWindowID
& id
);
361 virtual void GetTextExtent(const wxString
& string
, int *x
, int *y
,
363 int *externalLeading
= NULL
,
364 const wxFont
*theFont
= NULL
, bool use16
= FALSE
) const;
366 // Is the window retained?
367 inline bool IsRetained(void) const;
369 // Warp the pointer the given position
370 virtual void WarpPointer(int x_pos
, int y_pos
) ;
373 virtual void Clear(void);
375 // Find a window by id or name
376 virtual wxWindow
*FindWindow(long id
);
377 virtual wxWindow
*FindWindow(const wxString
& name
);
379 // Constraint operations
381 void SetSizer(wxSizer
*sizer
); // Adds sizer child to this window
382 inline wxSizer
*GetSizer(void) const ;
383 inline wxWindow
*GetSizerParent(void) const ;
384 inline void SetSizerParent(wxWindow
*win
);
386 // Do Update UI processing for controls
387 void UpdateWindowUI(void);
389 void OnSize(wxSizeEvent
& event
);
390 void OnEraseBackground(wxEraseEvent
& event
);
391 void OnChar(wxKeyEvent
& event
);
392 void OnPaint(wxPaintEvent
& event
);
393 void OnIdle(wxIdleEvent
& event
);
396 ////////////////////////////////////////////////////////////////////////
399 // Windows subclassing
400 void SubclassWin(WXHWND hWnd
);
401 void UnsubclassWin(void);
402 virtual long Default(void);
403 virtual bool MSWCommand(WXUINT param
, WXWORD id
);
404 virtual bool MSWNotify(WXWPARAM wParam
, WXLPARAM lParam
);
405 virtual wxWindow
*FindItem(int id
) const;
406 virtual wxWindow
*FindItemByHWND(WXHWND hWnd
, bool controlOnly
= FALSE
) const ;
407 virtual void PreDelete(WXHDC dc
); // Allows system cleanup
408 // TO DO: how many of these need to be virtual?
409 virtual WXHWND
GetHWND(void) const ;
410 virtual void SetHWND(WXHWND hWnd
);
412 // Make a Windows extended style from the given wxWindows window style
413 virtual WXDWORD
MakeExtendedStyle(long style
, bool eliminateBorders
= TRUE
);
414 // Determine whether 3D effects are wanted
415 virtual WXDWORD
Determine3DEffects(WXDWORD defaultBorderStyle
, bool *want3D
);
417 virtual void AddChild(wxWindow
*child
); // Adds reference to the child object
418 virtual void RemoveChild(wxWindow
*child
); // Removes reference to child
419 // (but doesn't delete the child object)
420 virtual void DestroyChildren(void); // Removes and destroys all children
422 inline bool IsBeingDeleted(void);
424 // MSW only: TRUE if this control is part of the main control
425 virtual bool ContainsHWND(WXHWND
WXUNUSED(hWnd
)) const { return FALSE
; };
427 // Constraint implementation
428 void UnsetConstraints(wxLayoutConstraints
*c
);
429 inline wxList
*GetConstraintsInvolvedIn(void) const ;
430 // Back-pointer to other windows we're involved with, so if we delete
431 // this window, we must delete any constraints we're involved with.
432 void AddConstraintReference(wxWindow
*otherWin
);
433 void RemoveConstraintReference(wxWindow
*otherWin
);
434 void DeleteRelatedConstraints(void);
436 virtual void ResetConstraints(void);
437 virtual void SetConstraintSizes(bool recurse
= TRUE
);
438 virtual bool LayoutPhase1(int *noChanges
);
439 virtual bool LayoutPhase2(int *noChanges
);
440 virtual bool DoPhase(int);
441 // Transforms from sizer coordinate space to actual
442 // parent coordinate space
443 virtual void TransformSizerToActual(int *x
, int *y
) const ;
445 // Set size with transformation to actual coordinates if nec.
446 virtual void SizerSetSize(int x
, int y
, int w
, int h
);
447 virtual void SizerMove(int x
, int y
);
449 // Only set/get the size/position of the constraint (if any)
450 virtual void SetSizeConstraint(int x
, int y
, int w
, int h
);
451 virtual void MoveConstraint(int x
, int y
);
452 virtual void GetSizeConstraint(int *w
, int *h
) const ;
453 virtual void GetClientSizeConstraint(int *w
, int *h
) const ;
454 virtual void GetPositionConstraint(int *x
, int *y
) const ;
456 wxObject
*GetChild(int number
) const ;
458 void MSWCreate(int id
, wxWindow
*parent
, const char *wclass
, wxWindow
*wx_win
, const char *title
,
459 int x
, int y
, int width
, int height
,
460 WXDWORD style
, const char *dialog_template
= NULL
,
461 WXDWORD exendedStyle
= 0);
463 // Actually defined in wx_canvs.cc since requires wxCanvas declaration
464 virtual void MSWDeviceToLogical(float *x
, float *y
) const ;
466 // Create an appropriate wxWindow from a HWND
467 virtual wxWindow
* CreateWindowFromHWND(wxWindow
* parent
, WXHWND hWnd
);
469 // Make sure the window style reflects the HWND style (roughly)
470 virtual void AdoptAttributesFromHWND(void);
472 // Setup background and foreground colours correctly
473 virtual void SetupColours(void);
476 virtual void MSWOnCreate(WXLPCREATESTRUCT cs
);
477 virtual bool MSWOnPaint(void);
478 virtual WXHICON
MSWOnQueryDragIcon(void) { return 0; }
479 virtual void MSWOnSize(int x
, int y
, WXUINT flag
);
480 virtual void MSWOnWindowPosChanging(void *lpPos
);
481 virtual void MSWOnHScroll(WXWORD nSBCode
, WXWORD pos
, WXHWND control
);
482 virtual void MSWOnVScroll(WXWORD nSBCode
, WXWORD pos
, WXHWND control
);
483 virtual bool MSWOnCommand(WXWORD id
, WXWORD cmd
, WXHWND control
);
484 virtual long MSWOnSysCommand(WXWPARAM wParam
, WXLPARAM lParam
);
485 virtual bool MSWOnNotify(WXWPARAM wParam
, WXLPARAM lParam
);
486 virtual WXHBRUSH
MSWOnCtlColor(WXHDC dc
, WXHWND pWnd
, WXUINT nCtlColor
,
487 WXUINT message
, WXWPARAM wParam
, WXLPARAM lParam
);
488 virtual bool MSWOnColorChange(WXHWND hWnd
, WXUINT message
, WXWPARAM wParam
, WXLPARAM lParam
);
489 virtual bool MSWOnEraseBkgnd(WXHDC pDC
);
490 virtual void MSWOnMenuHighlight(WXWORD item
, WXWORD flags
, WXHMENU sysmenu
);
491 virtual void MSWOnInitMenuPopup(WXHMENU menu
, int pos
, bool isSystem
);
492 virtual bool MSWOnClose(void);
493 virtual bool MSWOnDestroy(void);
494 virtual bool MSWOnSetFocus(WXHWND wnd
);
495 virtual bool MSWOnKillFocus(WXHWND wnd
);
496 virtual void MSWOnDropFiles(WXWPARAM wParam
);
497 virtual bool MSWOnInitDialog(WXHWND hWndFocus
);
498 virtual void MSWOnShow(bool show
, int status
);
500 // TODO: rationalise these functions into 1 or 2 which take the
501 // event type as argument.
502 virtual void MSWOnLButtonDown(int x
, int y
, WXUINT flags
);
503 virtual void MSWOnLButtonUp(int x
, int y
, WXUINT flags
);
504 virtual void MSWOnLButtonDClick(int x
, int y
, WXUINT flags
);
506 virtual void MSWOnMButtonDown(int x
, int y
, WXUINT flags
);
507 virtual void MSWOnMButtonUp(int x
, int y
, WXUINT flags
);
508 virtual void MSWOnMButtonDClick(int x
, int y
, WXUINT flags
);
510 virtual void MSWOnRButtonDown(int x
, int y
, WXUINT flags
);
511 virtual void MSWOnRButtonUp(int x
, int y
, WXUINT flags
);
512 virtual void MSWOnRButtonDClick(int x
, int y
, WXUINT flags
);
514 virtual void MSWOnMouseMove(int x
, int y
, WXUINT flags
);
515 virtual void MSWOnMouseEnter(int x
, int y
, WXUINT flags
);
516 virtual void MSWOnMouseLeave(int x
, int y
, WXUINT flags
);
518 virtual void MSWOnChar(WXWORD wParam
, WXLPARAM lParam
, bool isASCII
= FALSE
);
520 virtual bool MSWOnActivate(int flag
, bool minimized
, WXHWND activate
);
521 virtual long MSWOnMDIActivate(long flag
, WXHWND activate
, WXHWND deactivate
);
523 virtual bool MSWOnDrawItem(int id
, WXDRAWITEMSTRUCT
*item
);
524 virtual bool MSWOnMeasureItem(int id
, WXMEASUREITEMSTRUCT
*item
);
526 virtual void MSWOnJoyDown(int joystick
, int x
, int y
, WXUINT flags
);
527 virtual void MSWOnJoyUp(int joystick
, int x
, int y
, WXUINT flags
);
528 virtual void MSWOnJoyMove(int joystick
, int x
, int y
, WXUINT flags
);
529 virtual void MSWOnJoyZMove(int joystick
, int z
, WXUINT flags
);
532 virtual long MSWWindowProc(WXUINT nMsg
, WXWPARAM wParam
, WXLPARAM lParam
);
534 // Calls an appropriate default window procedure
535 virtual long MSWDefWindowProc(WXUINT nMsg
, WXWPARAM wParam
, WXLPARAM lParam
);
536 virtual bool MSWProcessMessage(WXMSG
* pMsg
);
537 virtual void MSWDestroyWindow(void);
539 // Detach "Window" menu from menu bar so it doesn't get deleted
540 void MSWDetachWindowMenu(void);
542 inline WXFARPROC
MSWGetOldWndProc() const;
543 inline void MSWSetOldWndProc(WXFARPROC proc
);
545 // Define for each class of dialog and control
546 virtual WXHBRUSH
OnCtlColor(WXHDC pDC
, WXHWND pWnd
, WXUINT nCtlColor
,
547 WXUINT message
, WXWPARAM wParam
, WXLPARAM lParam
);
549 inline void SetShowing(bool show
);
550 inline bool IsUserEnabled(void) const;
551 inline bool GetUseCtl3D(void) const ;
552 inline bool GetTransparentBackground(void) const ;
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(void);
564 ////////////////////////////////////////////////////////////////////////
568 long m_windowStyle
; // Store the window's style
569 wxEvtHandler
* m_windowEventHandler
; // Usually is 'this'
570 wxLayoutConstraints
* m_constraints
; // Constraints for this window
571 wxList
* m_constraintsInvolvedIn
; // List of constraints we're involved in
572 wxSizer
* m_windowSizer
; // Window's top-level sizer (if any)
573 wxWindow
* m_sizerParent
; // Window's parent sizer (if any)
574 bool m_autoLayout
; // Whether to call Layout() in OnSize
575 wxWindow
* m_windowParent
; // Each window always knows its parent
576 wxValidator
* m_windowValidator
;
577 // Old window proc, for subclassed controls
578 WXFARPROC m_oldWndProc
;
579 bool m_useCtl3D
; // Using CTL3D for this control
581 bool m_inOnSize
; // Protection against OnSize reentry
583 // Pointer to global memory, for EDIT controls that need
584 // special treatment to reduce USER area consumption.
585 WXHGLOBAL m_globalHandle
;
599 wxFont m_windowFont
; // Window's font
601 bool m_doubleClickAllowed
;
602 wxCursor m_windowCursor
; // Window's cursor
604 wxString m_windowName
; // Window name
606 #if USE_EXTENDED_STATICS
607 wxList m_staticItems
;
610 wxButton
* m_defaultItem
;
612 wxColour m_backgroundColour
;
613 wxColour m_defaultBackgroundColour
;
615 wxColour m_foregroundColour
;
616 wxColour m_defaultForegroundColour
;
618 bool m_backgroundTransparent
;
627 bool m_mouseInWindow
;
629 #if USE_DRAG_AND_DROP
630 wxDropTarget
*m_pDropTarget
; // the current drop target or NULL
631 #endif //USE_DRAG_AND_DROP
634 WXHWND m_hWnd
; // MS Windows window handle
636 WXWPARAM m_lastWParam
;
637 WXLPARAM m_lastLParam
;
638 wxRectangle m_updateRect
; // Bounding box for screen damage area
640 WXHRGN m_updateRgn
; // NT allows access to the rectangle list
642 WXHANDLE m_acceleratorTable
;
643 WXHMENU m_hMenu
; // Menu, if any
644 wxList
* m_children
; // Window's children
646 bool m_isBeingDeleted
; // Fudge because can't access parent
647 // when being deleted
649 DECLARE_EVENT_TABLE()
652 ////////////////////////////////////////////////////////////////////////
655 inline void *wxWindow::GetHandle(void) const { return (void *)GetHWND(); }
656 inline int wxWindow::GetId() const { return m_windowId
; }
657 inline void wxWindow::SetId(int id
) { m_windowId
= id
; }
658 inline wxWindow
*wxWindow::GetParent(void) const { return m_windowParent
; }
659 inline void wxWindow::SetParent(wxWindow
*p
) { m_windowParent
= p
; }
660 inline wxWindow
*wxWindow::GetGrandParent(void) const { return (m_windowParent
? m_windowParent
->m_windowParent
: NULL
); }
661 inline wxList
*wxWindow::GetChildren() const { return m_children
; }
662 inline wxFont
*wxWindow::GetFont(void) const { return (wxFont
*) & m_windowFont
; }
663 inline wxString
wxWindow::GetName(void) const { return m_windowName
; }
664 inline void wxWindow::SetName(const wxString
& name
) { m_windowName
= name
; }
665 inline long wxWindow::GetWindowStyleFlag(void) const { return m_windowStyle
; }
666 inline void wxWindow::SetWindowStyleFlag(long flag
) { m_windowStyle
= flag
; }
667 inline void wxWindow::SetDoubleClick(bool flag
) { m_doubleClickAllowed
= flag
; }
668 inline bool wxWindow::GetDoubleClick(void) const { return m_doubleClickAllowed
; }
669 inline void wxWindow::SetEventHandler(wxEvtHandler
*handler
) { m_windowEventHandler
= handler
; }
670 inline wxEvtHandler
*wxWindow::GetEventHandler(void) const { return m_windowEventHandler
; }
671 inline void wxWindow::SetAutoLayout(bool a
) { m_autoLayout
= a
; }
672 inline bool wxWindow::GetAutoLayout(void) const { return m_autoLayout
; }
673 inline wxLayoutConstraints
*wxWindow::GetConstraints(void) const { return m_constraints
; }
674 inline void wxWindow::SetBackgroundColour(const wxColour
& col
) { m_backgroundColour
= col
; };
675 inline wxColour
wxWindow::GetBackgroundColour(void) const { return m_backgroundColour
; };
676 inline void wxWindow::SetForegroundColour(const wxColour
& col
) { m_foregroundColour
= col
; };
677 inline wxColour
wxWindow::GetForegroundColour(void) const { return m_foregroundColour
; };
678 inline void wxWindow::SetDefaultForegroundColour(const wxColour
& col
) { m_defaultForegroundColour
= col
; };
679 inline wxColour
wxWindow::GetDefaultForegroundColour(void) const { return m_defaultForegroundColour
; };
680 inline void wxWindow::SetDefaultBackgroundColour(const wxColour
& col
) { m_defaultBackgroundColour
= col
; };
681 inline wxColour
wxWindow::GetDefaultBackgroundColour(void) const { return m_defaultBackgroundColour
; };
683 inline wxButton
*wxWindow::GetDefaultItem(void) const { return m_defaultItem
; }
684 inline void wxWindow::SetDefaultItem(wxButton
*but
) { m_defaultItem
= but
; }
685 inline bool wxWindow::IsRetained(void) const { return ((m_windowStyle
& wxRETAINED
) == wxRETAINED
); }
687 inline void wxWindow::SetShowing(bool show
) { m_isShown
= show
; }
688 inline wxList
*wxWindow::GetConstraintsInvolvedIn(void) const { return m_constraintsInvolvedIn
; }
689 inline wxSizer
*wxWindow::GetSizer(void) const { return m_windowSizer
; }
690 inline wxWindow
*wxWindow::GetSizerParent(void) const { return m_sizerParent
; }
691 inline void wxWindow::SetSizerParent(wxWindow
*win
) { m_sizerParent
= win
; }
692 inline WXFARPROC
wxWindow::MSWGetOldWndProc() const { return m_oldWndProc
; }
693 inline void wxWindow::MSWSetOldWndProc(WXFARPROC proc
) { m_oldWndProc
= proc
; }
694 inline wxValidator
*wxWindow::GetValidator(void) const { return m_windowValidator
; }
695 inline bool wxWindow::IsUserEnabled(void) const { return m_winEnabled
; }
696 inline bool wxWindow::GetUseCtl3D(void) const { return m_useCtl3D
; }
697 inline bool wxWindow::GetTransparentBackground(void) const { return m_backgroundTransparent
; }
698 inline void wxWindow::SetReturnCode(int retCode
) { m_returnCode
= retCode
; }
699 inline int wxWindow::GetReturnCode(void) { return m_returnCode
; }
700 inline bool wxWindow::IsBeingDeleted(void) { return m_isBeingDeleted
; }
702 // Window specific (so far)
703 wxWindow
* WXDLLEXPORT
wxGetActiveWindow(void);
705 // Allows iteration through damaged rectangles in OnPaint
706 class WXDLLEXPORT wxUpdateIterator
708 int rects
; // How many rects in Update region
709 int current
; // Current rectangle index
710 void *rp
; // current rectangle
712 WXRGNDATA
*rlist
; // Storage for regiondata
716 wxUpdateIterator(wxWindow
* wnd
);
717 ~wxUpdateIterator(void);
720 wxUpdateIterator
* operator ++(int);
721 void GetRect(wxRectangle
*rect
);
728 WXDLLEXPORT_DATA(extern wxList
) wxTopLevelWindows
;
730 int WXDLLEXPORT
wxCharCodeMSWToWX(int keySym
);
731 int WXDLLEXPORT
wxCharCodeWXToMSW(int id
, bool *IsVirtual
);
733 // Allocates control ids
734 int WXDLLEXPORT
NewControlId(void);