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