]>
Commit | Line | Data |
---|---|---|
93cf77c0 JS |
1 | ///////////////////////////////////////////////////////////////////////////// |
2 | // Name: windows.cpp | |
3 | // Purpose: wxWindow | |
4 | // Author: AUTHOR | |
5 | // Modified by: | |
6 | // Created: ??/??/98 | |
7 | // RCS-ID: $Id$ | |
8 | // Copyright: (c) AUTHOR | |
9 | // Licence: wxWindows licence | |
10 | ///////////////////////////////////////////////////////////////////////////// | |
11 | ||
12 | #ifdef __GNUG__ | |
13 | #pragma implementation "window.h" | |
14 | #endif | |
15 | ||
16 | #include "wx/setup.h" | |
17 | #include "wx/menu.h" | |
18 | #include "wx/dc.h" | |
19 | #include "wx/dcclient.h" | |
20 | #include "wx/utils.h" | |
21 | #include "wx/app.h" | |
22 | #include "wx/panel.h" | |
23 | #include "wx/layout.h" | |
24 | #include "wx/dialog.h" | |
25 | #include "wx/listbox.h" | |
26 | #include "wx/button.h" | |
27 | #include "wx/settings.h" | |
28 | #include "wx/msgdlg.h" | |
34138703 | 29 | #include "wx/frame.h" |
93cf77c0 JS |
30 | |
31 | #include "wx/menuitem.h" | |
32 | #include "wx/log.h" | |
33 | ||
34 | #if USE_DRAG_AND_DROP | |
35 | #include "wx/dnd.h" | |
36 | #endif | |
37 | ||
38 | #include <string.h> | |
39 | ||
40 | extern wxList wxPendingDelete; | |
41 | ||
42 | #if !USE_SHARED_LIBRARY | |
43 | IMPLEMENT_DYNAMIC_CLASS(wxWindow, wxEvtHandler) | |
44 | ||
45 | BEGIN_EVENT_TABLE(wxWindow, wxEvtHandler) | |
46 | EVT_CHAR(wxWindow::OnChar) | |
47 | EVT_ERASE_BACKGROUND(wxWindow::OnEraseBackground) | |
48 | EVT_SYS_COLOUR_CHANGED(wxWindow::OnSysColourChanged) | |
49 | EVT_INIT_DIALOG(wxWindow::OnInitDialog) | |
50 | EVT_IDLE(wxWindow::OnIdle) | |
51 | END_EVENT_TABLE() | |
52 | ||
53 | #endif | |
54 | ||
55 | ||
56 | // Constructor | |
57 | wxWindow::wxWindow() | |
58 | { | |
59 | // Generic | |
60 | m_windowId = 0; | |
61 | m_windowStyle = 0; | |
62 | m_windowParent = NULL; | |
63 | m_windowEventHandler = this; | |
64 | m_windowName = ""; | |
65 | m_windowCursor = *wxSTANDARD_CURSOR; | |
66 | m_children = new wxList; | |
67 | m_constraints = NULL; | |
68 | m_constraintsInvolvedIn = NULL; | |
69 | m_windowSizer = NULL; | |
70 | m_sizerParent = NULL; | |
71 | m_autoLayout = FALSE; | |
72 | m_windowValidator = NULL; | |
73 | m_defaultItem = NULL; | |
74 | m_returnCode = 0; | |
75 | m_caretWidth = 0; m_caretHeight = 0; | |
76 | m_caretEnabled = FALSE; | |
77 | m_caretShown = FALSE; | |
78 | m_backgroundColour = wxSystemSettings::GetSystemColour(wxSYS_COLOUR_WINDOW) ; ; | |
79 | m_foregroundColour = *wxBLACK; | |
80 | m_defaultForegroundColour = *wxBLACK ; | |
81 | m_defaultBackgroundColour = wxSystemSettings::GetSystemColour(wxSYS_COLOUR_3DFACE) ; | |
82 | ||
83 | #if USE_DRAG_AND_DROP | |
84 | m_pDropTarget = NULL; | |
85 | #endif | |
86 | } | |
87 | ||
88 | // Destructor | |
89 | wxWindow::~wxWindow() | |
90 | { | |
91 | // Have to delete constraints/sizer FIRST otherwise | |
92 | // sizers may try to look at deleted windows as they | |
93 | // delete themselves. | |
94 | #if USE_CONSTRAINTS | |
95 | DeleteRelatedConstraints(); | |
96 | if (m_constraints) | |
97 | { | |
98 | // This removes any dangling pointers to this window | |
99 | // in other windows' constraintsInvolvedIn lists. | |
100 | UnsetConstraints(m_constraints); | |
101 | delete m_constraints; | |
102 | m_constraints = NULL; | |
103 | } | |
104 | if (m_windowSizer) | |
105 | { | |
106 | delete m_windowSizer; | |
107 | m_windowSizer = NULL; | |
108 | } | |
109 | // If this is a child of a sizer, remove self from parent | |
110 | if (m_sizerParent) | |
111 | m_sizerParent->RemoveChild((wxWindow *)this); | |
112 | #endif | |
113 | ||
114 | if (m_windowParent) | |
115 | m_windowParent->RemoveChild(this); | |
116 | ||
117 | DestroyChildren(); | |
118 | ||
119 | // TODO: destroy the window | |
120 | ||
121 | delete m_children; | |
122 | m_children = NULL; | |
123 | ||
124 | // Just in case the window has been Closed, but | |
125 | // we're then deleting immediately: don't leave | |
126 | // dangling pointers. | |
127 | wxPendingDelete.DeleteObject(this); | |
128 | ||
129 | if ( m_windowValidator ) | |
130 | delete m_windowValidator; | |
131 | } | |
132 | ||
133 | // Destroy the window (delayed, if a managed window) | |
134 | bool wxWindow::Destroy() | |
135 | { | |
136 | delete this; | |
137 | return TRUE; | |
138 | } | |
139 | ||
140 | // Constructor | |
141 | bool wxWindow::Create(wxWindow *parent, wxWindowID id, | |
142 | const wxPoint& pos, | |
143 | const wxSize& size, | |
144 | long style, | |
145 | const wxString& name) | |
146 | { | |
147 | // Generic | |
148 | m_windowId = 0; | |
149 | m_windowStyle = 0; | |
150 | m_windowParent = NULL; | |
151 | m_windowEventHandler = this; | |
152 | m_windowName = ""; | |
153 | m_windowCursor = *wxSTANDARD_CURSOR; | |
154 | m_constraints = NULL; | |
155 | m_constraintsInvolvedIn = NULL; | |
156 | m_windowSizer = NULL; | |
157 | m_sizerParent = NULL; | |
158 | m_autoLayout = FALSE; | |
159 | m_windowValidator = NULL; | |
160 | ||
161 | #if USE_DRAG_AND_DROP | |
162 | m_pDropTarget = NULL; | |
163 | #endif | |
164 | ||
165 | m_caretWidth = 0; m_caretHeight = 0; | |
166 | m_caretEnabled = FALSE; | |
167 | m_caretShown = FALSE; | |
168 | m_minSizeX = -1; | |
169 | m_minSizeY = -1; | |
170 | m_maxSizeX = -1; | |
171 | m_maxSizeY = -1; | |
172 | m_defaultItem = NULL; | |
173 | m_windowParent = NULL; | |
174 | if (!parent) | |
175 | return FALSE; | |
176 | ||
177 | if (parent) parent->AddChild(this); | |
178 | ||
179 | m_returnCode = 0; | |
180 | ||
181 | SetName(name); | |
182 | ||
183 | if ( id == -1 ) | |
184 | m_windowId = (int)NewControlId(); | |
185 | else | |
186 | m_windowId = id; | |
187 | ||
188 | m_backgroundColour = wxSystemSettings::GetSystemColour(wxSYS_COLOUR_WINDOW) ; ; | |
189 | m_foregroundColour = *wxBLACK; | |
190 | m_defaultForegroundColour = *wxBLACK ; | |
191 | m_defaultBackgroundColour = wxSystemSettings::GetSystemColour(wxSYS_COLOUR_3DFACE) ; | |
192 | ||
193 | m_windowStyle = style; | |
194 | ||
195 | if ( id == -1 ) | |
196 | m_windowId = (int)NewControlId(); | |
197 | else | |
198 | m_windowId = id; | |
199 | ||
200 | // TODO: create the window | |
201 | ||
202 | return TRUE; | |
203 | } | |
204 | ||
205 | void wxWindow::SetFocus() | |
206 | { | |
207 | // TODO | |
208 | } | |
209 | ||
210 | void wxWindow::Enable(bool enable) | |
211 | { | |
212 | // TODO | |
213 | } | |
214 | ||
215 | void wxWindow::CaptureMouse() | |
216 | { | |
217 | // TODO | |
218 | } | |
219 | ||
220 | void wxWindow::ReleaseMouse() | |
221 | { | |
222 | // TODO | |
223 | } | |
224 | ||
225 | // Push/pop event handler (i.e. allow a chain of event handlers | |
226 | // be searched) | |
227 | void wxWindow::PushEventHandler(wxEvtHandler *handler) | |
228 | { | |
229 | handler->SetNextHandler(GetEventHandler()); | |
230 | SetEventHandler(handler); | |
231 | } | |
232 | ||
233 | wxEvtHandler *wxWindow::PopEventHandler(bool deleteHandler) | |
234 | { | |
235 | if ( GetEventHandler() ) | |
236 | { | |
237 | wxEvtHandler *handlerA = GetEventHandler(); | |
238 | wxEvtHandler *handlerB = handlerA->GetNextHandler(); | |
239 | handlerA->SetNextHandler(NULL); | |
240 | SetEventHandler(handlerB); | |
241 | if ( deleteHandler ) | |
242 | { | |
243 | delete handlerA; | |
244 | return NULL; | |
245 | } | |
246 | else | |
247 | return handlerA; | |
248 | } | |
249 | else | |
250 | return NULL; | |
251 | } | |
252 | ||
253 | #if USE_DRAG_AND_DROP | |
254 | ||
255 | void wxWindow::SetDropTarget(wxDropTarget *pDropTarget) | |
256 | { | |
257 | if ( m_pDropTarget != 0 ) { | |
93cf77c0 JS |
258 | delete m_pDropTarget; |
259 | } | |
260 | ||
261 | m_pDropTarget = pDropTarget; | |
262 | if ( m_pDropTarget != 0 ) | |
34138703 JS |
263 | { |
264 | // TODO | |
265 | } | |
93cf77c0 JS |
266 | } |
267 | ||
268 | #endif | |
269 | ||
270 | // Old style file-manager drag&drop | |
271 | void wxWindow::DragAcceptFiles(bool accept) | |
272 | { | |
273 | // TODO | |
274 | } | |
275 | ||
276 | // Get total size | |
277 | void wxWindow::GetSize(int *x, int *y) const | |
278 | { | |
279 | // TODO | |
280 | } | |
281 | ||
282 | void wxWindow::GetPosition(int *x, int *y) const | |
283 | { | |
284 | // TODO | |
285 | } | |
286 | ||
287 | void wxWindow::ScreenToClient(int *x, int *y) const | |
288 | { | |
289 | // TODO | |
290 | } | |
291 | ||
292 | void wxWindow::ClientToScreen(int *x, int *y) const | |
293 | { | |
294 | // TODO | |
295 | } | |
296 | ||
297 | void wxWindow::SetCursor(const wxCursor& cursor) | |
298 | { | |
299 | m_windowCursor = cursor; | |
300 | if (m_windowCursor.Ok()) | |
301 | { | |
302 | // TODO | |
303 | } | |
304 | } | |
305 | ||
306 | ||
307 | // Get size *available for subwindows* i.e. excluding menu bar etc. | |
308 | void wxWindow::GetClientSize(int *x, int *y) const | |
309 | { | |
310 | // TODO | |
311 | } | |
312 | ||
313 | void wxWindow::SetSize(int x, int y, int width, int height, int sizeFlags) | |
314 | { | |
315 | // TODO | |
316 | } | |
317 | ||
318 | void wxWindow::SetClientSize(int width, int height) | |
319 | { | |
320 | // TODO | |
321 | } | |
322 | ||
323 | // For implementation purposes - sometimes decorations make the client area | |
324 | // smaller | |
325 | wxPoint wxWindow::GetClientAreaOrigin() const | |
326 | { | |
327 | return wxPoint(0, 0); | |
328 | } | |
329 | ||
330 | // Makes an adjustment to the window position (for example, a frame that has | |
331 | // a toolbar that it manages itself). | |
332 | void wxWindow::AdjustForParentClientOrigin(int& x, int& y, int sizeFlags) | |
333 | { | |
334 | if (((sizeFlags & wxSIZE_NO_ADJUSTMENTS) == 0) && GetParent()) | |
335 | { | |
336 | wxPoint pt(GetParent()->GetClientAreaOrigin()); | |
337 | x += pt.x; y += pt.y; | |
338 | } | |
339 | } | |
340 | ||
341 | bool wxWindow::Show(bool show) | |
342 | { | |
343 | // TODO | |
344 | return FALSE; | |
345 | } | |
346 | ||
347 | bool wxWindow::IsShown() const | |
348 | { | |
349 | // TODO | |
350 | return FALSE; | |
351 | } | |
352 | ||
353 | int wxWindow::GetCharHeight() const | |
354 | { | |
355 | // TODO | |
356 | return 0; | |
357 | } | |
358 | ||
359 | int wxWindow::GetCharWidth() const | |
360 | { | |
361 | // TODO | |
362 | return 0; | |
363 | } | |
364 | ||
365 | void wxWindow::GetTextExtent(const wxString& string, int *x, int *y, | |
366 | int *descent, int *externalLeading, const wxFont *theFont, bool) const | |
367 | { | |
368 | wxFont *fontToUse = (wxFont *)theFont; | |
369 | if (!fontToUse) | |
370 | fontToUse = (wxFont *) & m_windowFont; | |
371 | ||
372 | // TODO | |
373 | } | |
374 | ||
375 | void wxWindow::Refresh(bool eraseBack, const wxRectangle *rect) | |
376 | { | |
377 | // TODO | |
378 | } | |
379 | ||
380 | // Responds to colour changes: passes event on to children. | |
381 | void wxWindow::OnSysColourChanged(wxSysColourChangedEvent& event) | |
382 | { | |
383 | wxNode *node = GetChildren()->First(); | |
384 | while ( node ) | |
385 | { | |
386 | // Only propagate to non-top-level windows | |
387 | wxWindow *win = (wxWindow *)node->Data(); | |
388 | if ( win->GetParent() ) | |
389 | { | |
390 | wxSysColourChangedEvent event2; | |
391 | event.m_eventObject = win; | |
392 | win->GetEventHandler()->ProcessEvent(event2); | |
393 | } | |
394 | ||
395 | node = node->Next(); | |
396 | } | |
397 | } | |
398 | ||
399 | // This can be called by the app (or wxWindows) to do default processing for the current | |
400 | // event. Save message/event info in wxWindow so they can be used in this function. | |
401 | long wxWindow::Default() | |
402 | { | |
403 | // TODO | |
404 | return 0; | |
405 | } | |
406 | ||
407 | void wxWindow::InitDialog() | |
408 | { | |
409 | wxInitDialogEvent event(GetId()); | |
410 | event.SetEventObject( this ); | |
411 | GetEventHandler()->ProcessEvent(event); | |
412 | } | |
413 | ||
414 | // Default init dialog behaviour is to transfer data to window | |
415 | void wxWindow::OnInitDialog(wxInitDialogEvent& event) | |
416 | { | |
417 | TransferDataToWindow(); | |
418 | } | |
419 | ||
420 | // Caret manipulation | |
421 | void wxWindow::CreateCaret(int w, int h) | |
422 | { | |
423 | m_caretWidth = w; | |
424 | m_caretHeight = h; | |
425 | m_caretEnabled = TRUE; | |
426 | } | |
427 | ||
428 | void wxWindow::CreateCaret(const wxBitmap *WXUNUSED(bitmap)) | |
429 | { | |
430 | // TODO | |
431 | } | |
432 | ||
433 | void wxWindow::ShowCaret(bool show) | |
434 | { | |
435 | // TODO | |
436 | } | |
437 | ||
438 | void wxWindow::DestroyCaret() | |
439 | { | |
440 | // TODO | |
441 | m_caretEnabled = FALSE; | |
442 | } | |
443 | ||
444 | void wxWindow::SetCaretPos(int x, int y) | |
445 | { | |
446 | // TODO | |
447 | } | |
448 | ||
449 | void wxWindow::GetCaretPos(int *x, int *y) const | |
450 | { | |
451 | // TODO | |
452 | } | |
453 | ||
454 | wxWindow *wxGetActiveWindow() | |
455 | { | |
456 | // TODO | |
457 | return NULL; | |
458 | } | |
459 | ||
460 | void wxWindow::SetSizeHints(int minW, int minH, int maxW, int maxH, int WXUNUSED(incW), int WXUNUSED(incH)) | |
461 | { | |
462 | m_minSizeX = minW; | |
463 | m_minSizeY = minH; | |
464 | m_maxSizeX = maxW; | |
465 | m_maxSizeY = maxH; | |
466 | } | |
467 | ||
468 | void wxWindow::Centre(int direction) | |
469 | { | |
470 | int x, y, width, height, panel_width, panel_height, new_x, new_y; | |
471 | ||
472 | wxWindow *father = (wxWindow *)GetParent(); | |
473 | if (!father) | |
474 | return; | |
475 | ||
476 | father->GetClientSize(&panel_width, &panel_height); | |
477 | GetSize(&width, &height); | |
478 | GetPosition(&x, &y); | |
479 | ||
480 | new_x = -1; | |
481 | new_y = -1; | |
482 | ||
483 | if (direction & wxHORIZONTAL) | |
484 | new_x = (int)((panel_width - width)/2); | |
485 | ||
486 | if (direction & wxVERTICAL) | |
487 | new_y = (int)((panel_height - height)/2); | |
488 | ||
489 | SetSize(new_x, new_y, -1, -1); | |
490 | ||
491 | } | |
492 | ||
493 | // Coordinates relative to the window | |
494 | void wxWindow::WarpPointer (int x_pos, int y_pos) | |
495 | { | |
496 | // TODO | |
497 | } | |
498 | ||
499 | void wxWindow::OnEraseBackground(wxEraseEvent& event) | |
500 | { | |
501 | // TODO | |
502 | Default(); | |
503 | } | |
504 | ||
505 | int wxWindow::GetScrollPos(int orient) const | |
506 | { | |
507 | // TODO | |
508 | return 0; | |
509 | } | |
510 | ||
511 | // This now returns the whole range, not just the number | |
512 | // of positions that we can scroll. | |
513 | int wxWindow::GetScrollRange(int orient) const | |
514 | { | |
515 | // TODO | |
516 | return 0; | |
517 | } | |
518 | ||
519 | int wxWindow::GetScrollThumb(int orient) const | |
520 | { | |
521 | // TODO | |
522 | return 0; | |
523 | } | |
524 | ||
525 | void wxWindow::SetScrollPos(int orient, int pos, bool refresh) | |
526 | { | |
527 | // TODO | |
34138703 | 528 | return; |
93cf77c0 JS |
529 | } |
530 | ||
531 | // New function that will replace some of the above. | |
532 | void wxWindow::SetScrollbar(int orient, int pos, int thumbVisible, | |
533 | int range, bool refresh) | |
534 | { | |
535 | // TODO | |
536 | } | |
537 | ||
538 | // Does a physical scroll | |
539 | void wxWindow::ScrollWindow(int dx, int dy, const wxRectangle *rect) | |
540 | { | |
541 | // TODO | |
34138703 | 542 | return; |
93cf77c0 JS |
543 | } |
544 | ||
545 | void wxWindow::SetFont(const wxFont& font) | |
546 | { | |
547 | m_windowFont = font; | |
548 | ||
549 | if (!m_windowFont.Ok()) | |
550 | return; | |
551 | // TODO | |
552 | } | |
553 | ||
554 | void wxWindow::OnChar(wxKeyEvent& event) | |
555 | { | |
556 | if ( event.KeyCode() == WXK_TAB ) { | |
557 | // propagate the TABs to the parent - it's up to it to decide what | |
558 | // to do with it | |
559 | if ( GetParent() ) { | |
560 | if ( GetParent()->ProcessEvent(event) ) | |
561 | return; | |
562 | } | |
563 | } | |
564 | } | |
565 | ||
566 | void wxWindow::OnPaint(wxPaintEvent& event) | |
567 | { | |
568 | Default(); | |
569 | } | |
570 | ||
571 | bool wxWindow::IsEnabled() const | |
572 | { | |
573 | // TODO | |
574 | return FALSE; | |
575 | } | |
576 | ||
577 | // Dialog support: override these and call | |
578 | // base class members to add functionality | |
579 | // that can't be done using validators. | |
580 | // NOTE: these functions assume that controls | |
581 | // are direct children of this window, not grandchildren | |
582 | // or other levels of descendant. | |
583 | ||
584 | // Transfer values to controls. If returns FALSE, | |
585 | // it's an application error (pops up a dialog) | |
586 | bool wxWindow::TransferDataToWindow() | |
587 | { | |
588 | wxNode *node = GetChildren()->First(); | |
589 | while ( node ) | |
590 | { | |
591 | wxWindow *child = (wxWindow *)node->Data(); | |
592 | if ( child->GetValidator() && | |
593 | !child->GetValidator()->TransferToWindow() ) | |
594 | { | |
595 | wxMessageBox("Application Error", "Could not transfer data to window", wxOK|wxICON_EXCLAMATION); | |
596 | return FALSE; | |
597 | } | |
598 | ||
599 | node = node->Next(); | |
600 | } | |
601 | return TRUE; | |
602 | } | |
603 | ||
604 | // Transfer values from controls. If returns FALSE, | |
605 | // validation failed: don't quit | |
606 | bool wxWindow::TransferDataFromWindow() | |
607 | { | |
608 | wxNode *node = GetChildren()->First(); | |
609 | while ( node ) | |
610 | { | |
611 | wxWindow *child = (wxWindow *)node->Data(); | |
612 | if ( child->GetValidator() && !child->GetValidator()->TransferFromWindow() ) | |
613 | { | |
614 | return FALSE; | |
615 | } | |
616 | ||
617 | node = node->Next(); | |
618 | } | |
619 | return TRUE; | |
620 | } | |
621 | ||
622 | bool wxWindow::Validate() | |
623 | { | |
624 | wxNode *node = GetChildren()->First(); | |
625 | while ( node ) | |
626 | { | |
627 | wxWindow *child = (wxWindow *)node->Data(); | |
628 | if ( child->GetValidator() && /* child->GetValidator()->Ok() && */ !child->GetValidator()->Validate(this) ) | |
629 | { | |
630 | return FALSE; | |
631 | } | |
632 | ||
633 | node = node->Next(); | |
634 | } | |
635 | return TRUE; | |
636 | } | |
637 | ||
638 | // Get the window with the focus | |
639 | wxWindow *wxWindow::FindFocus() | |
640 | { | |
641 | // TODO | |
642 | return NULL; | |
643 | } | |
644 | ||
645 | void wxWindow::AddChild(wxWindow *child) | |
646 | { | |
647 | GetChildren()->Append(child); | |
648 | child->m_windowParent = this; | |
649 | } | |
650 | ||
651 | void wxWindow::RemoveChild(wxWindow *child) | |
652 | { | |
653 | if (GetChildren()) | |
654 | GetChildren()->DeleteObject(child); | |
655 | child->m_windowParent = NULL; | |
656 | } | |
657 | ||
658 | void wxWindow::DestroyChildren() | |
659 | { | |
660 | if (GetChildren()) { | |
661 | wxNode *node; | |
662 | while ((node = GetChildren()->First()) != (wxNode *)NULL) { | |
663 | wxWindow *child; | |
664 | if ((child = (wxWindow *)node->Data()) != (wxWindow *)NULL) { | |
665 | delete child; | |
666 | if ( GetChildren()->Member(child) ) | |
667 | delete node; | |
668 | } | |
669 | } /* while */ | |
670 | } | |
671 | } | |
672 | ||
673 | void wxWindow::MakeModal(bool modal) | |
674 | { | |
675 | // Disable all other windows | |
676 | if (this->IsKindOf(CLASSINFO(wxDialog)) || this->IsKindOf(CLASSINFO(wxFrame))) | |
677 | { | |
678 | wxNode *node = wxTopLevelWindows.First(); | |
679 | while (node) | |
680 | { | |
681 | wxWindow *win = (wxWindow *)node->Data(); | |
682 | if (win != this) | |
683 | win->Enable(!modal); | |
684 | ||
685 | node = node->Next(); | |
686 | } | |
687 | } | |
688 | } | |
689 | ||
02e8b2f9 JS |
690 | // If nothing defined for this, try the parent. |
691 | // E.g. we may be a button loaded from a resource, with no callback function | |
692 | // defined. | |
693 | void wxWindow::OnCommand(wxWindow& win, wxCommandEvent& event) | |
694 | { | |
695 | if (GetEventHandler()->ProcessEvent(event) ) | |
696 | return; | |
697 | if (m_windowParent) | |
698 | m_windowParent->GetEventHandler()->OnCommand(win, event); | |
699 | } | |
700 | ||
93cf77c0 JS |
701 | void wxWindow::SetConstraints(wxLayoutConstraints *c) |
702 | { | |
703 | if (m_constraints) | |
704 | { | |
705 | UnsetConstraints(m_constraints); | |
706 | delete m_constraints; | |
707 | } | |
708 | m_constraints = c; | |
709 | if (m_constraints) | |
710 | { | |
711 | // Make sure other windows know they're part of a 'meaningful relationship' | |
712 | if (m_constraints->left.GetOtherWindow() && (m_constraints->left.GetOtherWindow() != this)) | |
713 | m_constraints->left.GetOtherWindow()->AddConstraintReference((wxWindow *)this); | |
714 | if (m_constraints->top.GetOtherWindow() && (m_constraints->top.GetOtherWindow() != this)) | |
715 | m_constraints->top.GetOtherWindow()->AddConstraintReference((wxWindow *)this); | |
716 | if (m_constraints->right.GetOtherWindow() && (m_constraints->right.GetOtherWindow() != this)) | |
717 | m_constraints->right.GetOtherWindow()->AddConstraintReference((wxWindow *)this); | |
718 | if (m_constraints->bottom.GetOtherWindow() && (m_constraints->bottom.GetOtherWindow() != this)) | |
719 | m_constraints->bottom.GetOtherWindow()->AddConstraintReference((wxWindow *)this); | |
720 | if (m_constraints->width.GetOtherWindow() && (m_constraints->width.GetOtherWindow() != this)) | |
721 | m_constraints->width.GetOtherWindow()->AddConstraintReference((wxWindow *)this); | |
722 | if (m_constraints->height.GetOtherWindow() && (m_constraints->height.GetOtherWindow() != this)) | |
723 | m_constraints->height.GetOtherWindow()->AddConstraintReference((wxWindow *)this); | |
724 | if (m_constraints->centreX.GetOtherWindow() && (m_constraints->centreX.GetOtherWindow() != this)) | |
725 | m_constraints->centreX.GetOtherWindow()->AddConstraintReference((wxWindow *)this); | |
726 | if (m_constraints->centreY.GetOtherWindow() && (m_constraints->centreY.GetOtherWindow() != this)) | |
727 | m_constraints->centreY.GetOtherWindow()->AddConstraintReference((wxWindow *)this); | |
728 | } | |
729 | } | |
730 | ||
731 | // This removes any dangling pointers to this window | |
732 | // in other windows' constraintsInvolvedIn lists. | |
733 | void wxWindow::UnsetConstraints(wxLayoutConstraints *c) | |
734 | { | |
735 | if (c) | |
736 | { | |
737 | if (c->left.GetOtherWindow() && (c->top.GetOtherWindow() != this)) | |
738 | c->left.GetOtherWindow()->RemoveConstraintReference((wxWindow *)this); | |
739 | if (c->top.GetOtherWindow() && (c->top.GetOtherWindow() != this)) | |
740 | c->top.GetOtherWindow()->RemoveConstraintReference((wxWindow *)this); | |
741 | if (c->right.GetOtherWindow() && (c->right.GetOtherWindow() != this)) | |
742 | c->right.GetOtherWindow()->RemoveConstraintReference((wxWindow *)this); | |
743 | if (c->bottom.GetOtherWindow() && (c->bottom.GetOtherWindow() != this)) | |
744 | c->bottom.GetOtherWindow()->RemoveConstraintReference((wxWindow *)this); | |
745 | if (c->width.GetOtherWindow() && (c->width.GetOtherWindow() != this)) | |
746 | c->width.GetOtherWindow()->RemoveConstraintReference((wxWindow *)this); | |
747 | if (c->height.GetOtherWindow() && (c->height.GetOtherWindow() != this)) | |
748 | c->height.GetOtherWindow()->RemoveConstraintReference((wxWindow *)this); | |
749 | if (c->centreX.GetOtherWindow() && (c->centreX.GetOtherWindow() != this)) | |
750 | c->centreX.GetOtherWindow()->RemoveConstraintReference((wxWindow *)this); | |
751 | if (c->centreY.GetOtherWindow() && (c->centreY.GetOtherWindow() != this)) | |
752 | c->centreY.GetOtherWindow()->RemoveConstraintReference((wxWindow *)this); | |
753 | } | |
754 | } | |
755 | ||
756 | // Back-pointer to other windows we're involved with, so if we delete | |
757 | // this window, we must delete any constraints we're involved with. | |
758 | void wxWindow::AddConstraintReference(wxWindow *otherWin) | |
759 | { | |
760 | if (!m_constraintsInvolvedIn) | |
761 | m_constraintsInvolvedIn = new wxList; | |
762 | if (!m_constraintsInvolvedIn->Member(otherWin)) | |
763 | m_constraintsInvolvedIn->Append(otherWin); | |
764 | } | |
765 | ||
766 | // REMOVE back-pointer to other windows we're involved with. | |
767 | void wxWindow::RemoveConstraintReference(wxWindow *otherWin) | |
768 | { | |
769 | if (m_constraintsInvolvedIn) | |
770 | m_constraintsInvolvedIn->DeleteObject(otherWin); | |
771 | } | |
772 | ||
773 | // Reset any constraints that mention this window | |
774 | void wxWindow::DeleteRelatedConstraints() | |
775 | { | |
776 | if (m_constraintsInvolvedIn) | |
777 | { | |
778 | wxNode *node = m_constraintsInvolvedIn->First(); | |
779 | while (node) | |
780 | { | |
781 | wxWindow *win = (wxWindow *)node->Data(); | |
782 | wxNode *next = node->Next(); | |
783 | wxLayoutConstraints *constr = win->GetConstraints(); | |
784 | ||
785 | // Reset any constraints involving this window | |
786 | if (constr) | |
787 | { | |
788 | constr->left.ResetIfWin((wxWindow *)this); | |
789 | constr->top.ResetIfWin((wxWindow *)this); | |
790 | constr->right.ResetIfWin((wxWindow *)this); | |
791 | constr->bottom.ResetIfWin((wxWindow *)this); | |
792 | constr->width.ResetIfWin((wxWindow *)this); | |
793 | constr->height.ResetIfWin((wxWindow *)this); | |
794 | constr->centreX.ResetIfWin((wxWindow *)this); | |
795 | constr->centreY.ResetIfWin((wxWindow *)this); | |
796 | } | |
797 | delete node; | |
798 | node = next; | |
799 | } | |
800 | delete m_constraintsInvolvedIn; | |
801 | m_constraintsInvolvedIn = NULL; | |
802 | } | |
803 | } | |
804 | ||
805 | void wxWindow::SetSizer(wxSizer *sizer) | |
806 | { | |
807 | m_windowSizer = sizer; | |
808 | if (sizer) | |
809 | sizer->SetSizerParent((wxWindow *)this); | |
810 | } | |
811 | ||
812 | /* | |
813 | * New version | |
814 | */ | |
815 | ||
816 | bool wxWindow::Layout() | |
817 | { | |
818 | if (GetConstraints()) | |
819 | { | |
820 | int w, h; | |
821 | GetClientSize(&w, &h); | |
822 | GetConstraints()->width.SetValue(w); | |
823 | GetConstraints()->height.SetValue(h); | |
824 | } | |
825 | ||
826 | // If top level (one sizer), evaluate the sizer's constraints. | |
827 | if (GetSizer()) | |
828 | { | |
829 | int noChanges; | |
830 | GetSizer()->ResetConstraints(); // Mark all constraints as unevaluated | |
831 | GetSizer()->LayoutPhase1(&noChanges); | |
832 | GetSizer()->LayoutPhase2(&noChanges); | |
833 | GetSizer()->SetConstraintSizes(); // Recursively set the real window sizes | |
834 | return TRUE; | |
835 | } | |
836 | else | |
837 | { | |
838 | // Otherwise, evaluate child constraints | |
839 | ResetConstraints(); // Mark all constraints as unevaluated | |
840 | DoPhase(1); // Just one phase need if no sizers involved | |
841 | DoPhase(2); | |
842 | SetConstraintSizes(); // Recursively set the real window sizes | |
843 | } | |
844 | return TRUE; | |
845 | } | |
846 | ||
847 | ||
848 | // Do a phase of evaluating constraints: | |
849 | // the default behaviour. wxSizers may do a similar | |
850 | // thing, but also impose their own 'constraints' | |
851 | // and order the evaluation differently. | |
852 | bool wxWindow::LayoutPhase1(int *noChanges) | |
853 | { | |
854 | wxLayoutConstraints *constr = GetConstraints(); | |
855 | if (constr) | |
856 | { | |
857 | return constr->SatisfyConstraints((wxWindow *)this, noChanges); | |
858 | } | |
859 | else | |
860 | return TRUE; | |
861 | } | |
862 | ||
863 | bool wxWindow::LayoutPhase2(int *noChanges) | |
864 | { | |
865 | *noChanges = 0; | |
866 | ||
867 | // Layout children | |
868 | DoPhase(1); | |
869 | DoPhase(2); | |
870 | return TRUE; | |
871 | } | |
872 | ||
873 | // Do a phase of evaluating child constraints | |
874 | bool wxWindow::DoPhase(int phase) | |
875 | { | |
876 | int noIterations = 0; | |
877 | int maxIterations = 500; | |
878 | int noChanges = 1; | |
879 | int noFailures = 0; | |
880 | wxList succeeded; | |
881 | while ((noChanges > 0) && (noIterations < maxIterations)) | |
882 | { | |
883 | noChanges = 0; | |
884 | noFailures = 0; | |
885 | wxNode *node = GetChildren()->First(); | |
886 | while (node) | |
887 | { | |
888 | wxWindow *child = (wxWindow *)node->Data(); | |
889 | if (!child->IsKindOf(CLASSINFO(wxFrame)) && !child->IsKindOf(CLASSINFO(wxDialog))) | |
890 | { | |
891 | wxLayoutConstraints *constr = child->GetConstraints(); | |
892 | if (constr) | |
893 | { | |
894 | if (succeeded.Member(child)) | |
895 | { | |
896 | } | |
897 | else | |
898 | { | |
899 | int tempNoChanges = 0; | |
900 | bool success = ( (phase == 1) ? child->LayoutPhase1(&tempNoChanges) : child->LayoutPhase2(&tempNoChanges) ) ; | |
901 | noChanges += tempNoChanges; | |
902 | if (success) | |
903 | { | |
904 | succeeded.Append(child); | |
905 | } | |
906 | } | |
907 | } | |
908 | } | |
909 | node = node->Next(); | |
910 | } | |
911 | noIterations ++; | |
912 | } | |
913 | return TRUE; | |
914 | } | |
915 | ||
916 | void wxWindow::ResetConstraints() | |
917 | { | |
918 | wxLayoutConstraints *constr = GetConstraints(); | |
919 | if (constr) | |
920 | { | |
921 | constr->left.SetDone(FALSE); | |
922 | constr->top.SetDone(FALSE); | |
923 | constr->right.SetDone(FALSE); | |
924 | constr->bottom.SetDone(FALSE); | |
925 | constr->width.SetDone(FALSE); | |
926 | constr->height.SetDone(FALSE); | |
927 | constr->centreX.SetDone(FALSE); | |
928 | constr->centreY.SetDone(FALSE); | |
929 | } | |
930 | wxNode *node = GetChildren()->First(); | |
931 | while (node) | |
932 | { | |
933 | wxWindow *win = (wxWindow *)node->Data(); | |
934 | if (!win->IsKindOf(CLASSINFO(wxFrame)) && !win->IsKindOf(CLASSINFO(wxDialog))) | |
935 | win->ResetConstraints(); | |
936 | node = node->Next(); | |
937 | } | |
938 | } | |
939 | ||
940 | // Need to distinguish between setting the 'fake' size for | |
941 | // windows and sizers, and setting the real values. | |
942 | void wxWindow::SetConstraintSizes(bool recurse) | |
943 | { | |
944 | wxLayoutConstraints *constr = GetConstraints(); | |
945 | if (constr && constr->left.GetDone() && constr->right.GetDone() && | |
946 | constr->width.GetDone() && constr->height.GetDone()) | |
947 | { | |
948 | int x = constr->left.GetValue(); | |
949 | int y = constr->top.GetValue(); | |
950 | int w = constr->width.GetValue(); | |
951 | int h = constr->height.GetValue(); | |
952 | ||
953 | // If we don't want to resize this window, just move it... | |
954 | if ((constr->width.GetRelationship() != wxAsIs) || | |
955 | (constr->height.GetRelationship() != wxAsIs)) | |
956 | { | |
957 | // Calls Layout() recursively. AAAGH. How can we stop that. | |
958 | // Simply take Layout() out of non-top level OnSizes. | |
959 | SizerSetSize(x, y, w, h); | |
960 | } | |
961 | else | |
962 | { | |
963 | SizerMove(x, y); | |
964 | } | |
965 | } | |
966 | else if (constr) | |
967 | { | |
968 | char *windowClass = this->GetClassInfo()->GetClassName(); | |
969 | ||
970 | wxString winName; | |
971 | if (GetName() == "") | |
972 | winName = "unnamed"; | |
973 | else | |
974 | winName = GetName(); | |
975 | wxDebugMsg("Constraint(s) not satisfied for window of type %s, name %s:\n", (const char *)windowClass, (const char *)winName); | |
976 | if (!constr->left.GetDone()) | |
977 | wxDebugMsg(" unsatisfied 'left' constraint.\n"); | |
978 | if (!constr->right.GetDone()) | |
979 | wxDebugMsg(" unsatisfied 'right' constraint.\n"); | |
980 | if (!constr->width.GetDone()) | |
981 | wxDebugMsg(" unsatisfied 'width' constraint.\n"); | |
982 | if (!constr->height.GetDone()) | |
983 | wxDebugMsg(" unsatisfied 'height' constraint.\n"); | |
984 | wxDebugMsg("Please check constraints: try adding AsIs() constraints.\n"); | |
985 | } | |
986 | ||
987 | if (recurse) | |
988 | { | |
989 | wxNode *node = GetChildren()->First(); | |
990 | while (node) | |
991 | { | |
992 | wxWindow *win = (wxWindow *)node->Data(); | |
993 | if (!win->IsKindOf(CLASSINFO(wxFrame)) && !win->IsKindOf(CLASSINFO(wxDialog))) | |
994 | win->SetConstraintSizes(); | |
995 | node = node->Next(); | |
996 | } | |
997 | } | |
998 | } | |
999 | ||
1000 | // This assumes that all sizers are 'on' the same | |
1001 | // window, i.e. the parent of this window. | |
1002 | void wxWindow::TransformSizerToActual(int *x, int *y) const | |
1003 | { | |
1004 | if (!m_sizerParent || m_sizerParent->IsKindOf(CLASSINFO(wxDialog)) || | |
1005 | m_sizerParent->IsKindOf(CLASSINFO(wxFrame)) ) | |
1006 | return; | |
1007 | ||
1008 | int xp, yp; | |
1009 | m_sizerParent->GetPosition(&xp, &yp); | |
1010 | m_sizerParent->TransformSizerToActual(&xp, &yp); | |
1011 | *x += xp; | |
1012 | *y += yp; | |
1013 | } | |
1014 | ||
1015 | void wxWindow::SizerSetSize(int x, int y, int w, int h) | |
1016 | { | |
1017 | int xx = x; | |
1018 | int yy = y; | |
1019 | TransformSizerToActual(&xx, &yy); | |
1020 | SetSize(xx, yy, w, h); | |
1021 | } | |
1022 | ||
1023 | void wxWindow::SizerMove(int x, int y) | |
1024 | { | |
1025 | int xx = x; | |
1026 | int yy = y; | |
1027 | TransformSizerToActual(&xx, &yy); | |
1028 | Move(xx, yy); | |
1029 | } | |
1030 | ||
1031 | // Only set the size/position of the constraint (if any) | |
1032 | void wxWindow::SetSizeConstraint(int x, int y, int w, int h) | |
1033 | { | |
1034 | wxLayoutConstraints *constr = GetConstraints(); | |
1035 | if (constr) | |
1036 | { | |
1037 | if (x != -1) | |
1038 | { | |
1039 | constr->left.SetValue(x); | |
1040 | constr->left.SetDone(TRUE); | |
1041 | } | |
1042 | if (y != -1) | |
1043 | { | |
1044 | constr->top.SetValue(y); | |
1045 | constr->top.SetDone(TRUE); | |
1046 | } | |
1047 | if (w != -1) | |
1048 | { | |
1049 | constr->width.SetValue(w); | |
1050 | constr->width.SetDone(TRUE); | |
1051 | } | |
1052 | if (h != -1) | |
1053 | { | |
1054 | constr->height.SetValue(h); | |
1055 | constr->height.SetDone(TRUE); | |
1056 | } | |
1057 | } | |
1058 | } | |
1059 | ||
1060 | void wxWindow::MoveConstraint(int x, int y) | |
1061 | { | |
1062 | wxLayoutConstraints *constr = GetConstraints(); | |
1063 | if (constr) | |
1064 | { | |
1065 | if (x != -1) | |
1066 | { | |
1067 | constr->left.SetValue(x); | |
1068 | constr->left.SetDone(TRUE); | |
1069 | } | |
1070 | if (y != -1) | |
1071 | { | |
1072 | constr->top.SetValue(y); | |
1073 | constr->top.SetDone(TRUE); | |
1074 | } | |
1075 | } | |
1076 | } | |
1077 | ||
1078 | void wxWindow::GetSizeConstraint(int *w, int *h) const | |
1079 | { | |
1080 | wxLayoutConstraints *constr = GetConstraints(); | |
1081 | if (constr) | |
1082 | { | |
1083 | *w = constr->width.GetValue(); | |
1084 | *h = constr->height.GetValue(); | |
1085 | } | |
1086 | else | |
1087 | GetSize(w, h); | |
1088 | } | |
1089 | ||
1090 | void wxWindow::GetClientSizeConstraint(int *w, int *h) const | |
1091 | { | |
1092 | wxLayoutConstraints *constr = GetConstraints(); | |
1093 | if (constr) | |
1094 | { | |
1095 | *w = constr->width.GetValue(); | |
1096 | *h = constr->height.GetValue(); | |
1097 | } | |
1098 | else | |
1099 | GetClientSize(w, h); | |
1100 | } | |
1101 | ||
1102 | void wxWindow::GetPositionConstraint(int *x, int *y) const | |
1103 | { | |
1104 | wxLayoutConstraints *constr = GetConstraints(); | |
1105 | if (constr) | |
1106 | { | |
1107 | *x = constr->left.GetValue(); | |
1108 | *y = constr->top.GetValue(); | |
1109 | } | |
1110 | else | |
1111 | GetPosition(x, y); | |
1112 | } | |
1113 | ||
1114 | bool wxWindow::Close(bool force) | |
1115 | { | |
1116 | wxCloseEvent event(wxEVT_CLOSE_WINDOW, m_windowId); | |
1117 | event.SetEventObject(this); | |
1118 | event.SetForce(force); | |
1119 | ||
1120 | return GetEventHandler()->ProcessEvent(event); | |
1121 | } | |
1122 | ||
1123 | wxObject* wxWindow::GetChild(int number) const | |
1124 | { | |
1125 | // Return a pointer to the Nth object in the window | |
1126 | if (!GetChildren()) | |
1127 | return(NULL) ; | |
1128 | wxNode *node = GetChildren()->First(); | |
1129 | int n = number; | |
1130 | while (node && n--) | |
1131 | node = node->Next() ; | |
1132 | if (node) | |
1133 | { | |
1134 | wxObject *obj = (wxObject *)node->Data(); | |
1135 | return(obj) ; | |
1136 | } | |
1137 | else | |
1138 | return NULL ; | |
1139 | } | |
1140 | ||
1141 | void wxWindow::OnDefaultAction(wxControl *initiatingItem) | |
1142 | { | |
1143 | // Obsolete function | |
1144 | } | |
1145 | ||
1146 | void wxWindow::Clear() | |
1147 | { | |
1148 | wxClientDC dc(this); | |
1149 | wxBrush brush(GetBackgroundColour(), wxSOLID); | |
1150 | dc.SetBackground(brush); | |
1151 | dc.Clear(); | |
1152 | } | |
1153 | ||
1154 | // Fits the panel around the items | |
1155 | void wxWindow::Fit() | |
1156 | { | |
1157 | int maxX = 0; | |
1158 | int maxY = 0; | |
1159 | wxNode *node = GetChildren()->First(); | |
1160 | while ( node ) | |
1161 | { | |
1162 | wxWindow *win = (wxWindow *)node->Data(); | |
1163 | int wx, wy, ww, wh; | |
1164 | win->GetPosition(&wx, &wy); | |
1165 | win->GetSize(&ww, &wh); | |
1166 | if ( wx + ww > maxX ) | |
1167 | maxX = wx + ww; | |
1168 | if ( wy + wh > maxY ) | |
1169 | maxY = wy + wh; | |
1170 | ||
1171 | node = node->Next(); | |
1172 | } | |
1173 | SetClientSize(maxX + 5, maxY + 5); | |
1174 | } | |
1175 | ||
1176 | void wxWindow::SetValidator(const wxValidator& validator) | |
1177 | { | |
1178 | if ( m_windowValidator ) | |
1179 | delete m_windowValidator; | |
1180 | m_windowValidator = validator.Clone(); | |
1181 | ||
1182 | if ( m_windowValidator ) | |
1183 | m_windowValidator->SetWindow(this) ; | |
1184 | } | |
1185 | ||
46ccb510 JS |
1186 | void wxWindow::SetAcceleratorTable(const wxAcceleratorTable& accel) |
1187 | { | |
1188 | m_acceleratorTable = accel; | |
1189 | } | |
1190 | ||
93cf77c0 JS |
1191 | // Find a window by id or name |
1192 | wxWindow *wxWindow::FindWindow(long id) | |
1193 | { | |
1194 | if ( GetId() == id) | |
1195 | return this; | |
1196 | ||
1197 | wxNode *node = GetChildren()->First(); | |
1198 | while ( node ) | |
1199 | { | |
1200 | wxWindow *child = (wxWindow *)node->Data(); | |
1201 | wxWindow *found = child->FindWindow(id); | |
1202 | if ( found ) | |
1203 | return found; | |
1204 | node = node->Next(); | |
1205 | } | |
1206 | return NULL; | |
1207 | } | |
1208 | ||
1209 | wxWindow *wxWindow::FindWindow(const wxString& name) | |
1210 | { | |
1211 | if ( GetName() == name) | |
1212 | return this; | |
1213 | ||
1214 | wxNode *node = GetChildren()->First(); | |
1215 | while ( node ) | |
1216 | { | |
1217 | wxWindow *child = (wxWindow *)node->Data(); | |
1218 | wxWindow *found = child->FindWindow(name); | |
1219 | if ( found ) | |
1220 | return found; | |
1221 | node = node->Next(); | |
1222 | } | |
1223 | return NULL; | |
1224 | } | |
1225 | ||
1226 | void wxWindow::OnIdle(wxIdleEvent& event) | |
1227 | { | |
1228 | /* TODO: you may need to do something like this | |
1229 | * if your GUI doesn't generate enter/leave events | |
1230 | ||
1231 | // Check if we need to send a LEAVE event | |
1232 | if (m_mouseInWindow) | |
1233 | { | |
1234 | POINT pt; | |
1235 | ::GetCursorPos(&pt); | |
1236 | if (::WindowFromPoint(pt) != (HWND) GetHWND()) | |
1237 | { | |
1238 | // Generate a LEAVE event | |
1239 | m_mouseInWindow = FALSE; | |
1240 | MSWOnMouseLeave(pt.x, pt.y, 0); | |
1241 | } | |
1242 | } | |
1243 | */ | |
1244 | ||
1245 | // This calls the UI-update mechanism (querying windows for | |
1246 | // menu/toolbar/control state information) | |
1247 | UpdateWindowUI(); | |
1248 | } | |
1249 | ||
1250 | // Raise the window to the top of the Z order | |
1251 | void wxWindow::Raise() | |
1252 | { | |
1253 | // TODO | |
1254 | } | |
1255 | ||
1256 | // Lower the window to the bottom of the Z order | |
1257 | void wxWindow::Lower() | |
1258 | { | |
1259 | // TODO | |
1260 | } | |
1261 | ||
1262 | bool wxWindow::AcceptsFocus() const | |
1263 | { | |
1264 | return IsShown() && IsEnabled(); | |
1265 | } | |
1266 | ||
1267 | // Update region access | |
1268 | wxRegion wxWindow::GetUpdateRegion() const | |
1269 | { | |
1270 | return m_updateRegion; | |
1271 | } | |
1272 | ||
1273 | bool wxWindow::IsExposed(int x, int y, int w, int h) const | |
1274 | { | |
1275 | return (m_updateRegion.Contains(x, y, w, h) != wxOutRegion); | |
1276 | } | |
1277 | ||
1278 | bool wxWindow::IsExposed(const wxPoint& pt) const | |
1279 | { | |
1280 | return (m_updateRegion.Contains(pt) != wxOutRegion); | |
1281 | } | |
1282 | ||
1283 | bool wxWindow::IsExposed(const wxRect& rect) const | |
1284 | { | |
1285 | return (m_updateRegion.Contains(rect) != wxOutRegion); | |
1286 | } | |
1287 | ||
34138703 JS |
1288 | /* |
1289 | * Allocates control IDs | |
1290 | */ | |
1291 | ||
1292 | int wxWindow::NewControlId() | |
1293 | { | |
1294 | static int s_controlId = 0; | |
1295 | s_controlId ++; | |
1296 | return s_controlId; | |
1297 | } | |
1298 | ||
93cf77c0 | 1299 |