]> git.saurik.com Git - wxWidgets.git/blob - include/wx/motif/window.h
Accelerators implemented for wxMotif; some wxComboBox stupidities cured
[wxWidgets.git] / include / wx / motif / window.h
1 /////////////////////////////////////////////////////////////////////////////
2 // Name: window.h
3 // Purpose: wxWindow class
4 // Author: Julian Smart
5 // Modified by:
6 // Created: 17/09/98
7 // RCS-ID: $Id$
8 // Copyright: (c) Julian Smart
9 // Licence: wxWindows licence
10 /////////////////////////////////////////////////////////////////////////////
11
12 #ifndef _WX_WINDOW_H_
13 #define _WX_WINDOW_H_
14
15 #ifdef __GNUG__
16 #pragma interface "window.h"
17 #endif
18
19 #include "wx/gdicmn.h"
20 #include "wx/icon.h"
21 #include "wx/cursor.h"
22 #include "wx/pen.h"
23 #include "wx/font.h"
24 #include "wx/validate.h"
25 #include "wx/event.h"
26 #include "wx/string.h"
27 #include "wx/list.h"
28 #include "wx/region.h"
29 #include "wx/accel.h"
30
31 #define wxKEY_SHIFT 1
32 #define wxKEY_CTRL 2
33
34 /*
35 * Base class for frame, panel, canvas, panel items, dialog box.
36 *
37 */
38
39 /*
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).
45 */
46
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 wxRectangle;
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;
69
70 #if wxUSE_DRAG_AND_DROP
71 class WXDLLEXPORT wxDropTarget;
72 #endif
73
74 #if wxUSE_WX_RESOURCES
75 class WXDLLEXPORT wxResourceTable;
76 class WXDLLEXPORT wxItemResource;
77 #endif
78
79 WXDLLEXPORT_DATA(extern const char*) wxPanelNameStr;
80
81 WXDLLEXPORT_DATA(extern const wxSize) wxDefaultSize;
82 WXDLLEXPORT_DATA(extern const wxPoint) wxDefaultPosition;
83
84 //-----------------------------------------------------------------------------
85 // wxClientData
86 //-----------------------------------------------------------------------------
87
88 class wxClientData
89 {
90 public:
91 wxClientData() { }
92 virtual ~wxClientData() { }
93 };
94
95 //-----------------------------------------------------------------------------
96 // wxStringClientData
97 //-----------------------------------------------------------------------------
98
99 class wxStringClientData: public wxClientData
100 {
101 public:
102 wxStringClientData() { }
103 wxStringClientData( wxString &data ) { m_data = data; }
104 void SetData( wxString &data ) { m_data = data; }
105 wxString GetData() const { return m_data; }
106
107 private:
108 wxString m_data;
109 };
110
111 class WXDLLEXPORT wxWindow: public wxEvtHandler
112 {
113 DECLARE_ABSTRACT_CLASS(wxWindow)
114
115 friend class WXDLLEXPORT wxDC;
116 friend class WXDLLEXPORT wxWindowDC;
117
118 public:
119 wxWindow();
120 inline wxWindow(wxWindow *parent, wxWindowID id,
121 const wxPoint& pos = wxDefaultPosition,
122 const wxSize& size = wxDefaultSize,
123 long style = 0,
124 const wxString& name = wxPanelNameStr)
125 {
126 m_children = new wxList;
127 Create(parent, id, pos, size, style, name);
128 }
129
130 virtual ~wxWindow();
131
132 bool Create(wxWindow *parent, wxWindowID id,
133 const wxPoint& pos = wxDefaultPosition,
134 const wxSize& size = wxDefaultSize,
135 long style = 0,
136 const wxString& name = wxPanelNameStr);
137
138 // Fit the window around the items
139 virtual void Fit();
140
141 // Show or hide the window
142 virtual bool Show(bool show);
143
144 // Is the window shown?
145 virtual bool IsShown() const;
146
147 // Raise the window to the top of the Z order
148 virtual void Raise();
149
150 // Lower the window to the bottom of the Z order
151 virtual void Lower();
152
153 // Is the window enabled?
154 virtual bool IsEnabled() const;
155
156 // For compatibility
157 inline bool Enabled() const { return IsEnabled(); }
158
159 // Dialog support: override these and call
160 // base class members to add functionality
161 // that can't be done using validators.
162
163 // Transfer values to controls. If returns FALSE,
164 // it's an application error (pops up a dialog)
165 virtual bool TransferDataToWindow();
166
167 // Transfer values from controls. If returns FALSE,
168 // transfer failed: don't quit
169 virtual bool TransferDataFromWindow();
170
171 // Validate controls. If returns FALSE,
172 // validation failed: don't quit
173 virtual bool Validate();
174
175 // Return code for dialogs
176 inline void SetReturnCode(int retCode);
177 inline int GetReturnCode();
178
179 // Set the cursor
180 virtual void SetCursor(const wxCursor& cursor);
181 inline virtual wxCursor *GetCursor() const { return (wxCursor *)& m_windowCursor; };
182
183 // Get the window with the focus
184 static wxWindow *FindFocus();
185
186 // Get character size
187 virtual int GetCharHeight() const;
188 virtual int GetCharWidth() const;
189
190 // Get overall window size
191 virtual void GetSize(int *width, int *height) const;
192
193 // Get window position, relative to parent (or screen if no parent)
194 virtual void GetPosition(int *x, int *y) const;
195
196 // Get client (application-useable) size
197 virtual void GetClientSize(int *width, int *height) const;
198
199 // Set overall size and position
200 virtual void SetSize(int x, int y, int width, int height, int sizeFlags = wxSIZE_AUTO);
201 inline virtual void SetSize(int width, int height) { SetSize(-1, -1, width, height, wxSIZE_USE_EXISTING); }
202 inline virtual void Move(int x, int y) { SetSize(x, y, -1, -1, wxSIZE_USE_EXISTING); }
203
204 // Set client size
205 virtual void SetClientSize(int width, int size);
206
207 // Convert client to screen coordinates
208 virtual void ClientToScreen(int *x, int *y) const;
209
210 // Convert screen to client coordinates
211 virtual void ScreenToClient(int *x, int *y) const;
212
213 // Set the focus to this window
214 virtual void SetFocus();
215
216 // Capture/release mouse
217 virtual void CaptureMouse();
218 virtual void ReleaseMouse();
219
220 // Enable or disable the window
221 virtual void Enable(bool enable);
222
223 #if wxUSE_DRAG_AND_DROP
224 // Associate a drop target with this window (if the window already had a drop
225 // target, it's deleted!) and return the current drop target (may be NULL).
226 void SetDropTarget(wxDropTarget *pDropTarget);
227 wxDropTarget *GetDropTarget() const { return m_pDropTarget; }
228 #endif
229
230 // Accept files for dragging
231 virtual void DragAcceptFiles(bool accept);
232
233 // Update region access
234 virtual wxRegion& GetUpdateRegion() const;
235 virtual bool IsExposed(int x, int y, int w, int h) const;
236 virtual bool IsExposed(const wxPoint& pt) const;
237 virtual bool IsExposed(const wxRect& rect) const;
238
239 // Set/get the window title
240 virtual inline void SetTitle(const wxString& WXUNUSED(title)) {};
241 inline virtual wxString GetTitle() const { return wxString(""); };
242 // Most windows have the concept of a label; for frames, this is the
243 // title; for items, this is the label or button text.
244 inline virtual wxString GetLabel() const { return GetTitle(); }
245
246 // Set/get the window name (used for resource setting in X)
247 inline virtual wxString GetName() const;
248 inline virtual void SetName(const wxString& name);
249
250 // Centre the window
251 virtual void Centre(int direction) ;
252 inline void Center(int direction = wxHORIZONTAL) { Centre(direction); }
253
254 // Popup a menu
255 virtual bool PopupMenu(wxMenu *menu, int x, int y);
256
257 // Send the window a refresh event
258 virtual void Refresh(bool eraseBack = TRUE, const wxRectangle *rect = NULL);
259
260 // New functions that will replace the above.
261 virtual void SetScrollbar(int orient, int pos, int thumbVisible,
262 int range, bool refresh = TRUE);
263
264 virtual void SetScrollPos(int orient, int pos, bool refresh = TRUE);
265 virtual int GetScrollPos(int orient) const;
266 virtual int GetScrollRange(int orient) const;
267 virtual int GetScrollThumb(int orient) const;
268
269 virtual void ScrollWindow(int dx, int dy, const wxRectangle *rect = NULL);
270
271 // Caret manipulation
272 virtual void CreateCaret(int w, int h);
273 virtual void CreateCaret(const wxBitmap *bitmap);
274 virtual void DestroyCaret();
275 virtual void ShowCaret(bool show);
276 virtual void SetCaretPos(int x, int y);
277 virtual void GetCaretPos(int *x, int *y) const;
278
279 // Tell window how much it can be sized
280 virtual void SetSizeHints(int minW = -1, int minH = -1, int maxW = -1, int maxH = -1, int incW = -1, int incH = -1);
281
282 // Set/get the window's identifier
283 inline int GetId() const;
284 inline void SetId(int id);
285
286 virtual void SetAcceleratorTable(const wxAcceleratorTable& accel);
287 inline virtual wxAcceleratorTable& GetAcceleratorTable() const { return (wxAcceleratorTable&) m_acceleratorTable; }
288
289 // Make the window modal (all other windows unresponsive)
290 virtual void MakeModal(bool modal);
291
292 // Get the private handle (platform-dependent)
293 inline void *GetHandle() const;
294
295 // Set/get the window's relatives
296 inline wxWindow *GetParent() const;
297 inline void SetParent(wxWindow *p) ;
298 inline wxWindow *GetGrandParent() const;
299 inline wxList *GetChildren() const;
300
301 // Set/get the window's font
302 virtual void SetFont(const wxFont& f);
303 inline virtual wxFont *GetFont() const;
304
305 // Set/get the window's validator
306 void SetValidator(const wxValidator& validator);
307 inline wxValidator *GetValidator() const;
308
309 virtual void SetClientObject( wxClientData *data );
310 virtual wxClientData *GetClientObject();
311
312 virtual void SetClientData( void *data );
313 virtual void *GetClientData();
314
315 // Set/get the window's style
316 inline void SetWindowStyleFlag(long flag);
317 inline long GetWindowStyleFlag() const;
318
319 // Handle a control command
320 virtual void OnCommand(wxWindow& win, wxCommandEvent& event);
321
322 // Set/get event handler
323 inline void SetEventHandler(wxEvtHandler *handler);
324 inline wxEvtHandler *GetEventHandler() const;
325
326 // Push/pop event handler (i.e. allow a chain of event handlers
327 // be searched)
328 void PushEventHandler(wxEvtHandler *handler) ;
329 wxEvtHandler *PopEventHandler(bool deleteHandler = FALSE) ;
330
331 // Close the window by calling OnClose, posting a deletion
332 virtual bool Close(bool force = FALSE);
333
334 // Destroy the window (delayed, if a managed window)
335 virtual bool Destroy() ;
336
337 // Mode for telling default OnSize members to
338 // call Layout(), if not using Sizers, just top-down constraints
339 inline void SetAutoLayout(bool a);
340 inline bool GetAutoLayout() const;
341
342 // Set/get constraints
343 inline wxLayoutConstraints *GetConstraints() const;
344 void SetConstraints(wxLayoutConstraints *c);
345
346 // Set/get window background colour
347 virtual void SetBackgroundColour(const wxColour& col);
348 inline virtual wxColour GetBackgroundColour() const;
349
350 // Set/get window foreground colour
351 virtual void SetForegroundColour(const wxColour& col);
352 inline virtual wxColour GetForegroundColour() const;
353
354 // Get the default button, if there is one
355 inline virtual wxButton *GetDefaultItem() const;
356 inline virtual void SetDefaultItem(wxButton *but);
357
358 // Override to define new behaviour for default action (e.g. double clicking
359 // on a listbox)
360 virtual void OnDefaultAction(wxControl *initiatingItem);
361
362 // Resource loading
363 #if wxUSE_WX_RESOURCES
364 virtual bool LoadFromResource(wxWindow *parent, const wxString& resourceName, const wxResourceTable *table = NULL);
365 virtual wxControl *CreateItem(const wxItemResource* childResource, const wxItemResource* parentResource,
366 const wxResourceTable *table = (const wxResourceTable *) NULL);
367 #endif
368
369 virtual void GetTextExtent(const wxString& string, int *x, int *y,
370 int *descent = NULL,
371 int *externalLeading = NULL,
372 const wxFont *theFont = NULL, bool use16 = FALSE) const;
373
374 // Is the window retained?
375 inline bool IsRetained() const;
376
377 // Warp the pointer the given position
378 virtual void WarpPointer(int x_pos, int y_pos) ;
379
380 // Clear the window
381 virtual void Clear();
382
383 // Find a window by id or name
384 virtual wxWindow *FindWindow(long id);
385 virtual wxWindow *FindWindow(const wxString& name);
386
387 // Constraint operations
388 bool Layout();
389 void SetSizer(wxSizer *sizer); // Adds sizer child to this window
390 inline wxSizer *GetSizer() const ;
391 inline wxWindow *GetSizerParent() const ;
392 inline void SetSizerParent(wxWindow *win);
393
394 // Do Update UI processing for controls
395 void UpdateWindowUI();
396
397 void OnEraseBackground(wxEraseEvent& event);
398 void OnChar(wxKeyEvent& event);
399 void OnPaint(wxPaintEvent& event);
400 void OnIdle(wxIdleEvent& event);
401
402 // Does this window want to accept keyboard focus?
403 virtual bool AcceptsFocus() const;
404
405 virtual void PrepareDC( wxDC & WXUNUSED(dc) ) {};
406
407
408 public:
409 ////////////////////////////////////////////////////////////////////////
410 //// IMPLEMENTATION
411
412 // For implementation purposes - sometimes decorations make the client area
413 // smaller
414 virtual wxPoint GetClientAreaOrigin() const;
415
416 // Makes an adjustment to the window position (for example, a frame that has
417 // a toolbar that it manages itself).
418 virtual void AdjustForParentClientOrigin(int& x, int& y, int sizeFlags);
419
420 // Executes the default message
421 virtual long Default();
422
423 /* TODO: you may need something like this
424 // Determine whether 3D effects are wanted
425 virtual WXDWORD Determine3DEffects(WXDWORD defaultBorderStyle, bool *want3D);
426 */
427
428 virtual void AddChild(wxWindow *child); // Adds reference to the child object
429 virtual void RemoveChild(wxWindow *child); // Removes reference to child
430 // (but doesn't delete the child object)
431 virtual void DestroyChildren(); // Removes and destroys all children
432
433 inline bool IsBeingDeleted() const { return FALSE; } // TODO: Should probably eliminate this
434
435 // Constraint implementation
436 void UnsetConstraints(wxLayoutConstraints *c);
437 inline wxList *GetConstraintsInvolvedIn() const ;
438 // Back-pointer to other windows we're involved with, so if we delete
439 // this window, we must delete any constraints we're involved with.
440 void AddConstraintReference(wxWindow *otherWin);
441 void RemoveConstraintReference(wxWindow *otherWin);
442 void DeleteRelatedConstraints();
443
444 virtual void ResetConstraints();
445 virtual void SetConstraintSizes(bool recurse = TRUE);
446 virtual bool LayoutPhase1(int *noChanges);
447 virtual bool LayoutPhase2(int *noChanges);
448 virtual bool DoPhase(int);
449 // Transforms from sizer coordinate space to actual
450 // parent coordinate space
451 virtual void TransformSizerToActual(int *x, int *y) const ;
452
453 // Set size with transformation to actual coordinates if nec.
454 virtual void SizerSetSize(int x, int y, int w, int h);
455 virtual void SizerMove(int x, int y);
456
457 // Only set/get the size/position of the constraint (if any)
458 virtual void SetSizeConstraint(int x, int y, int w, int h);
459 virtual void MoveConstraint(int x, int y);
460 virtual void GetSizeConstraint(int *w, int *h) const ;
461 virtual void GetClientSizeConstraint(int *w, int *h) const ;
462 virtual void GetPositionConstraint(int *x, int *y) const ;
463
464 // Dialog units translations. Implemented in wincmn.cpp.
465 wxPoint ConvertPixelsToDialog(const wxPoint& pt) ;
466 wxPoint ConvertDialogToPixels(const wxPoint& pt) ;
467 inline wxSize ConvertPixelsToDialog(const wxSize& sz)
468 { wxPoint pt(ConvertPixelsToDialog(wxPoint(sz.x, sz.y))); return wxSize(pt.x, pt.y); }
469 inline wxSize ConvertDialogToPixels(const wxSize& sz)
470 { wxPoint pt(ConvertDialogToPixels(wxPoint(sz.x, sz.y))); return wxSize(pt.x, pt.y); }
471
472 wxObject *GetChild(int number) const ;
473
474 // Generates a new id for controls
475 static int NewControlId();
476
477 // Responds to colour changes: passes event on to children.
478 void OnSysColourChanged(wxSysColourChangedEvent& event);
479
480 // Transfers data to any child controls
481 void OnInitDialog(wxInitDialogEvent& event);
482
483 // Sends an OnInitDialog event, which in turns transfers data to
484 // to the window via validators.
485 virtual void InitDialog();
486
487 /// Motif-specific
488
489 void ClearUpdateRects();
490 void CanvasGetSize(int* width, int* height) const; // If have drawing area
491 void CanvasGetClientSize(int *width, int *height) const;
492 void CanvasGetPosition(int *x, int *y) const; // If have drawing area
493 void CanvasSetClientSize(int width, int size);
494 void CanvasSetSize(int x, int y, int width, int height, int sizeFlags = wxSIZE_AUTO);
495
496 // Gives window a chance to do something in response to a size
497 // message, e.g. arrange status bar, toolbar etc.
498 virtual bool PreResize() { return TRUE; }
499
500 // Get main widget for this window, e.g. a text widget
501 virtual WXWidget GetMainWidget() const;
502 // Get the widget that corresponds to the label (for font setting, label setting etc.)
503 virtual WXWidget GetLabelWidget() const { return GetMainWidget(); }
504 // Get the client widget for this window (something we can
505 // create other windows on)
506 virtual WXWidget GetClientWidget() const;
507 // Get the top widget for this window, e.g. the scrolled widget parent
508 // of a multi-line text widget. Top means, top in the window hierarchy
509 // that implements this window.
510 virtual WXWidget GetTopWidget() const;
511 virtual void SetMainWidget(WXWidget w) { m_mainWidget = w; }
512 bool CanAddEventHandler() const { return m_canAddEventHandler; }
513 void SetCanAddEventHandler(bool flag) { m_canAddEventHandler = flag; }
514
515 // Get the underlying X window and display
516 virtual WXWindow GetXWindow() const;
517 virtual WXDisplay *GetXDisplay() const;
518
519 virtual WXPixmap GetBackingPixmap() const { return m_backingPixmap; }
520 inline int GetPixmapWidth() const { return m_pixmapWidth; }
521 inline int GetPixmapHeight() const { return m_pixmapHeight; }
522
523 // Change properties
524 virtual void ChangeFont(bool keepOriginalSize = TRUE); // Change to the current font (often overridden)
525 virtual void DoChangeForegroundColour(WXWidget widget, wxColour& foregroundColour);
526 virtual void DoChangeBackgroundColour(WXWidget widget, wxColour& backgroundColour, bool changeArmColour = FALSE);
527 // These to be overridden as needed (may change several widgets)
528 virtual void ChangeBackgroundColour(); // Change background and foreground colour using current
529 // background colour setting (Motif generates
530 // foreground based on background)
531 virtual void ChangeForegroundColour(); // Change foreground colour using current
532 // foreground colour setting
533
534 // Adds the widget to the hash table and adds event handlers.
535 bool AttachWidget (wxWindow* parent, WXWidget mainWidget,
536 WXWidget formWidget, int x, int y, int width, int height);
537 bool DetachWidget(WXWidget widget);
538
539 // Generates a paint event
540 virtual void DoPaint();
541
542 // How to implement accelerators. If we find a key event,
543 // translate to wxWindows wxKeyEvent form. Find a widget for the window.
544 // Now find a wxWindow for the widget. If there isn't one, go up the widget hierarchy
545 // trying to find one. Once one is found, call ProcessAccelerator for the
546 // window. If it returns TRUE (processed the event), skip the X event,
547 // otherwise carry on up the wxWindows window hierarchy calling ProcessAccelerator.
548 // If all return FALSE, process the X event as normal.
549 // Eventually we can implement OnCharHook the same way, but concentrate on accelerators
550 // for now.
551 // ProcessAccelerator must look at the current accelerator table, and try to find
552 // what menu id or window (beneath it) has this ID. Then construct an appropriate command
553 // event and send it.
554 virtual bool ProcessAccelerator(wxKeyEvent& event);
555
556 ////////////////////////////////////////////////////////////////////////
557 //// PROTECTED DATA
558 protected:
559 int m_windowId;
560 long m_windowStyle; // Store the window's style
561 wxEvtHandler * m_windowEventHandler; // Usually is 'this'
562 wxLayoutConstraints * m_constraints; // Constraints for this window
563 wxList * m_constraintsInvolvedIn; // List of constraints we're involved in
564 wxSizer * m_windowSizer; // Window's top-level sizer (if any)
565 wxWindow * m_sizerParent; // Window's parent sizer (if any)
566 bool m_autoLayout; // Whether to call Layout() in OnSize
567 wxWindow * m_windowParent; // Each window always knows its parent
568 wxValidator * m_windowValidator;
569 int m_minSizeX;
570 int m_minSizeY;
571 int m_maxSizeX;
572 int m_maxSizeY;
573
574 // Caret data
575 int m_caretWidth;
576 int m_caretHeight;
577 bool m_caretEnabled;
578 bool m_caretShown;
579 wxFont m_windowFont; // Window's font
580 wxCursor m_windowCursor; // Window's cursor
581 wxString m_windowName; // Window name
582
583 wxButton * m_defaultItem;
584
585 wxColour m_backgroundColour ;
586 wxColour m_foregroundColour ;
587 wxAcceleratorTable m_acceleratorTable;
588 wxClientData* m_clientObject;
589 void* m_clientData;
590
591 #if wxUSE_DRAG_AND_DROP
592 wxDropTarget *m_pDropTarget; // the current drop target or NULL
593 #endif //USE_DRAG_AND_DROP
594
595 public:
596 wxRegion m_updateRegion;
597 wxList * m_children; // Window's children
598 int m_returnCode;
599
600 public:
601 /// Motif-specific
602 bool m_canAddEventHandler;
603 bool m_button1Pressed;
604 bool m_button2Pressed;
605 bool m_button3Pressed;
606 // For double-click detection
607 long m_lastTS; // last timestamp
608 int m_lastButton; // last pressed button
609 wxList m_updateRects; // List of wxRectangles representing damaged region
610 bool m_isShown;
611 protected:
612 WXWidget m_mainWidget;
613 WXWidget m_hScrollBar;
614 WXWidget m_vScrollBar;
615 WXWidget m_borderWidget;
616 WXWidget m_scrolledWindow;
617 WXWidget m_drawingArea;
618 bool m_winCaptured;
619 bool m_hScroll;
620 bool m_vScroll;
621 WXPixmap m_backingPixmap;
622 int m_pixmapWidth;
623 int m_pixmapHeight;
624 int m_pixmapOffsetX;
625 int m_pixmapOffsetY;
626 int m_scrollPosX; // Store the last scroll pos,
627 int m_scrollPosY; // since in wxWin the pos isn't
628 // set automatically by system
629
630 DECLARE_EVENT_TABLE()
631 };
632
633 ////////////////////////////////////////////////////////////////////////
634 //// INLINES
635
636 inline void *wxWindow::GetHandle() const { return (void *)NULL; }
637 inline int wxWindow::GetId() const { return m_windowId; }
638 inline void wxWindow::SetId(int id) { m_windowId = id; }
639 inline wxWindow *wxWindow::GetParent() const { return m_windowParent; }
640 inline void wxWindow::SetParent(wxWindow *p) { m_windowParent = p; }
641 inline wxWindow *wxWindow::GetGrandParent() const { return (m_windowParent ? m_windowParent->m_windowParent : (wxWindow*) NULL); }
642 inline wxList *wxWindow::GetChildren() const { return m_children; }
643 inline wxFont *wxWindow::GetFont() const { return (wxFont *) & m_windowFont; }
644 inline wxString wxWindow::GetName() const { return m_windowName; }
645 inline void wxWindow::SetName(const wxString& name) { m_windowName = name; }
646 inline long wxWindow::GetWindowStyleFlag() const { return m_windowStyle; }
647 inline void wxWindow::SetWindowStyleFlag(long flag) { m_windowStyle = flag; }
648 inline void wxWindow::SetEventHandler(wxEvtHandler *handler) { m_windowEventHandler = handler; }
649 inline wxEvtHandler *wxWindow::GetEventHandler() const { return m_windowEventHandler; }
650 inline void wxWindow::SetAutoLayout(bool a) { m_autoLayout = a; }
651 inline bool wxWindow::GetAutoLayout() const { return m_autoLayout; }
652 inline wxLayoutConstraints *wxWindow::GetConstraints() const { return m_constraints; }
653 inline wxColour wxWindow::GetBackgroundColour() const { return m_backgroundColour; };
654 inline wxColour wxWindow::GetForegroundColour() const { return m_foregroundColour; };
655
656 inline wxButton *wxWindow::GetDefaultItem() const { return m_defaultItem; }
657 inline void wxWindow::SetDefaultItem(wxButton *but) { m_defaultItem = but; }
658 inline bool wxWindow::IsRetained() const { return ((m_windowStyle & wxRETAINED) == wxRETAINED); }
659
660 inline wxList *wxWindow::GetConstraintsInvolvedIn() const { return m_constraintsInvolvedIn; }
661 inline wxSizer *wxWindow::GetSizer() const { return m_windowSizer; }
662 inline wxWindow *wxWindow::GetSizerParent() const { return m_sizerParent; }
663 inline void wxWindow::SetSizerParent(wxWindow *win) { m_sizerParent = win; }
664 inline wxValidator *wxWindow::GetValidator() const { return m_windowValidator; }
665 inline void wxWindow::SetReturnCode(int retCode) { m_returnCode = retCode; }
666 inline int wxWindow::GetReturnCode() { return m_returnCode; }
667
668 // Get the active window.
669 wxWindow* WXDLLEXPORT wxGetActiveWindow();
670
671 WXDLLEXPORT_DATA(extern wxList) wxTopLevelWindows;
672
673 #endif
674 // _WX_WINDOW_H_