]>
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 | ||
93cf77c0 JS |
690 | void wxWindow::SetConstraints(wxLayoutConstraints *c) |
691 | { | |
692 | if (m_constraints) | |
693 | { | |
694 | UnsetConstraints(m_constraints); | |
695 | delete m_constraints; | |
696 | } | |
697 | m_constraints = c; | |
698 | if (m_constraints) | |
699 | { | |
700 | // Make sure other windows know they're part of a 'meaningful relationship' | |
701 | if (m_constraints->left.GetOtherWindow() && (m_constraints->left.GetOtherWindow() != this)) | |
702 | m_constraints->left.GetOtherWindow()->AddConstraintReference((wxWindow *)this); | |
703 | if (m_constraints->top.GetOtherWindow() && (m_constraints->top.GetOtherWindow() != this)) | |
704 | m_constraints->top.GetOtherWindow()->AddConstraintReference((wxWindow *)this); | |
705 | if (m_constraints->right.GetOtherWindow() && (m_constraints->right.GetOtherWindow() != this)) | |
706 | m_constraints->right.GetOtherWindow()->AddConstraintReference((wxWindow *)this); | |
707 | if (m_constraints->bottom.GetOtherWindow() && (m_constraints->bottom.GetOtherWindow() != this)) | |
708 | m_constraints->bottom.GetOtherWindow()->AddConstraintReference((wxWindow *)this); | |
709 | if (m_constraints->width.GetOtherWindow() && (m_constraints->width.GetOtherWindow() != this)) | |
710 | m_constraints->width.GetOtherWindow()->AddConstraintReference((wxWindow *)this); | |
711 | if (m_constraints->height.GetOtherWindow() && (m_constraints->height.GetOtherWindow() != this)) | |
712 | m_constraints->height.GetOtherWindow()->AddConstraintReference((wxWindow *)this); | |
713 | if (m_constraints->centreX.GetOtherWindow() && (m_constraints->centreX.GetOtherWindow() != this)) | |
714 | m_constraints->centreX.GetOtherWindow()->AddConstraintReference((wxWindow *)this); | |
715 | if (m_constraints->centreY.GetOtherWindow() && (m_constraints->centreY.GetOtherWindow() != this)) | |
716 | m_constraints->centreY.GetOtherWindow()->AddConstraintReference((wxWindow *)this); | |
717 | } | |
718 | } | |
719 | ||
720 | // This removes any dangling pointers to this window | |
721 | // in other windows' constraintsInvolvedIn lists. | |
722 | void wxWindow::UnsetConstraints(wxLayoutConstraints *c) | |
723 | { | |
724 | if (c) | |
725 | { | |
726 | if (c->left.GetOtherWindow() && (c->top.GetOtherWindow() != this)) | |
727 | c->left.GetOtherWindow()->RemoveConstraintReference((wxWindow *)this); | |
728 | if (c->top.GetOtherWindow() && (c->top.GetOtherWindow() != this)) | |
729 | c->top.GetOtherWindow()->RemoveConstraintReference((wxWindow *)this); | |
730 | if (c->right.GetOtherWindow() && (c->right.GetOtherWindow() != this)) | |
731 | c->right.GetOtherWindow()->RemoveConstraintReference((wxWindow *)this); | |
732 | if (c->bottom.GetOtherWindow() && (c->bottom.GetOtherWindow() != this)) | |
733 | c->bottom.GetOtherWindow()->RemoveConstraintReference((wxWindow *)this); | |
734 | if (c->width.GetOtherWindow() && (c->width.GetOtherWindow() != this)) | |
735 | c->width.GetOtherWindow()->RemoveConstraintReference((wxWindow *)this); | |
736 | if (c->height.GetOtherWindow() && (c->height.GetOtherWindow() != this)) | |
737 | c->height.GetOtherWindow()->RemoveConstraintReference((wxWindow *)this); | |
738 | if (c->centreX.GetOtherWindow() && (c->centreX.GetOtherWindow() != this)) | |
739 | c->centreX.GetOtherWindow()->RemoveConstraintReference((wxWindow *)this); | |
740 | if (c->centreY.GetOtherWindow() && (c->centreY.GetOtherWindow() != this)) | |
741 | c->centreY.GetOtherWindow()->RemoveConstraintReference((wxWindow *)this); | |
742 | } | |
743 | } | |
744 | ||
745 | // Back-pointer to other windows we're involved with, so if we delete | |
746 | // this window, we must delete any constraints we're involved with. | |
747 | void wxWindow::AddConstraintReference(wxWindow *otherWin) | |
748 | { | |
749 | if (!m_constraintsInvolvedIn) | |
750 | m_constraintsInvolvedIn = new wxList; | |
751 | if (!m_constraintsInvolvedIn->Member(otherWin)) | |
752 | m_constraintsInvolvedIn->Append(otherWin); | |
753 | } | |
754 | ||
755 | // REMOVE back-pointer to other windows we're involved with. | |
756 | void wxWindow::RemoveConstraintReference(wxWindow *otherWin) | |
757 | { | |
758 | if (m_constraintsInvolvedIn) | |
759 | m_constraintsInvolvedIn->DeleteObject(otherWin); | |
760 | } | |
761 | ||
762 | // Reset any constraints that mention this window | |
763 | void wxWindow::DeleteRelatedConstraints() | |
764 | { | |
765 | if (m_constraintsInvolvedIn) | |
766 | { | |
767 | wxNode *node = m_constraintsInvolvedIn->First(); | |
768 | while (node) | |
769 | { | |
770 | wxWindow *win = (wxWindow *)node->Data(); | |
771 | wxNode *next = node->Next(); | |
772 | wxLayoutConstraints *constr = win->GetConstraints(); | |
773 | ||
774 | // Reset any constraints involving this window | |
775 | if (constr) | |
776 | { | |
777 | constr->left.ResetIfWin((wxWindow *)this); | |
778 | constr->top.ResetIfWin((wxWindow *)this); | |
779 | constr->right.ResetIfWin((wxWindow *)this); | |
780 | constr->bottom.ResetIfWin((wxWindow *)this); | |
781 | constr->width.ResetIfWin((wxWindow *)this); | |
782 | constr->height.ResetIfWin((wxWindow *)this); | |
783 | constr->centreX.ResetIfWin((wxWindow *)this); | |
784 | constr->centreY.ResetIfWin((wxWindow *)this); | |
785 | } | |
786 | delete node; | |
787 | node = next; | |
788 | } | |
789 | delete m_constraintsInvolvedIn; | |
790 | m_constraintsInvolvedIn = NULL; | |
791 | } | |
792 | } | |
793 | ||
794 | void wxWindow::SetSizer(wxSizer *sizer) | |
795 | { | |
796 | m_windowSizer = sizer; | |
797 | if (sizer) | |
798 | sizer->SetSizerParent((wxWindow *)this); | |
799 | } | |
800 | ||
801 | /* | |
802 | * New version | |
803 | */ | |
804 | ||
805 | bool wxWindow::Layout() | |
806 | { | |
807 | if (GetConstraints()) | |
808 | { | |
809 | int w, h; | |
810 | GetClientSize(&w, &h); | |
811 | GetConstraints()->width.SetValue(w); | |
812 | GetConstraints()->height.SetValue(h); | |
813 | } | |
814 | ||
815 | // If top level (one sizer), evaluate the sizer's constraints. | |
816 | if (GetSizer()) | |
817 | { | |
818 | int noChanges; | |
819 | GetSizer()->ResetConstraints(); // Mark all constraints as unevaluated | |
820 | GetSizer()->LayoutPhase1(&noChanges); | |
821 | GetSizer()->LayoutPhase2(&noChanges); | |
822 | GetSizer()->SetConstraintSizes(); // Recursively set the real window sizes | |
823 | return TRUE; | |
824 | } | |
825 | else | |
826 | { | |
827 | // Otherwise, evaluate child constraints | |
828 | ResetConstraints(); // Mark all constraints as unevaluated | |
829 | DoPhase(1); // Just one phase need if no sizers involved | |
830 | DoPhase(2); | |
831 | SetConstraintSizes(); // Recursively set the real window sizes | |
832 | } | |
833 | return TRUE; | |
834 | } | |
835 | ||
836 | ||
837 | // Do a phase of evaluating constraints: | |
838 | // the default behaviour. wxSizers may do a similar | |
839 | // thing, but also impose their own 'constraints' | |
840 | // and order the evaluation differently. | |
841 | bool wxWindow::LayoutPhase1(int *noChanges) | |
842 | { | |
843 | wxLayoutConstraints *constr = GetConstraints(); | |
844 | if (constr) | |
845 | { | |
846 | return constr->SatisfyConstraints((wxWindow *)this, noChanges); | |
847 | } | |
848 | else | |
849 | return TRUE; | |
850 | } | |
851 | ||
852 | bool wxWindow::LayoutPhase2(int *noChanges) | |
853 | { | |
854 | *noChanges = 0; | |
855 | ||
856 | // Layout children | |
857 | DoPhase(1); | |
858 | DoPhase(2); | |
859 | return TRUE; | |
860 | } | |
861 | ||
862 | // Do a phase of evaluating child constraints | |
863 | bool wxWindow::DoPhase(int phase) | |
864 | { | |
865 | int noIterations = 0; | |
866 | int maxIterations = 500; | |
867 | int noChanges = 1; | |
868 | int noFailures = 0; | |
869 | wxList succeeded; | |
870 | while ((noChanges > 0) && (noIterations < maxIterations)) | |
871 | { | |
872 | noChanges = 0; | |
873 | noFailures = 0; | |
874 | wxNode *node = GetChildren()->First(); | |
875 | while (node) | |
876 | { | |
877 | wxWindow *child = (wxWindow *)node->Data(); | |
878 | if (!child->IsKindOf(CLASSINFO(wxFrame)) && !child->IsKindOf(CLASSINFO(wxDialog))) | |
879 | { | |
880 | wxLayoutConstraints *constr = child->GetConstraints(); | |
881 | if (constr) | |
882 | { | |
883 | if (succeeded.Member(child)) | |
884 | { | |
885 | } | |
886 | else | |
887 | { | |
888 | int tempNoChanges = 0; | |
889 | bool success = ( (phase == 1) ? child->LayoutPhase1(&tempNoChanges) : child->LayoutPhase2(&tempNoChanges) ) ; | |
890 | noChanges += tempNoChanges; | |
891 | if (success) | |
892 | { | |
893 | succeeded.Append(child); | |
894 | } | |
895 | } | |
896 | } | |
897 | } | |
898 | node = node->Next(); | |
899 | } | |
900 | noIterations ++; | |
901 | } | |
902 | return TRUE; | |
903 | } | |
904 | ||
905 | void wxWindow::ResetConstraints() | |
906 | { | |
907 | wxLayoutConstraints *constr = GetConstraints(); | |
908 | if (constr) | |
909 | { | |
910 | constr->left.SetDone(FALSE); | |
911 | constr->top.SetDone(FALSE); | |
912 | constr->right.SetDone(FALSE); | |
913 | constr->bottom.SetDone(FALSE); | |
914 | constr->width.SetDone(FALSE); | |
915 | constr->height.SetDone(FALSE); | |
916 | constr->centreX.SetDone(FALSE); | |
917 | constr->centreY.SetDone(FALSE); | |
918 | } | |
919 | wxNode *node = GetChildren()->First(); | |
920 | while (node) | |
921 | { | |
922 | wxWindow *win = (wxWindow *)node->Data(); | |
923 | if (!win->IsKindOf(CLASSINFO(wxFrame)) && !win->IsKindOf(CLASSINFO(wxDialog))) | |
924 | win->ResetConstraints(); | |
925 | node = node->Next(); | |
926 | } | |
927 | } | |
928 | ||
929 | // Need to distinguish between setting the 'fake' size for | |
930 | // windows and sizers, and setting the real values. | |
931 | void wxWindow::SetConstraintSizes(bool recurse) | |
932 | { | |
933 | wxLayoutConstraints *constr = GetConstraints(); | |
934 | if (constr && constr->left.GetDone() && constr->right.GetDone() && | |
935 | constr->width.GetDone() && constr->height.GetDone()) | |
936 | { | |
937 | int x = constr->left.GetValue(); | |
938 | int y = constr->top.GetValue(); | |
939 | int w = constr->width.GetValue(); | |
940 | int h = constr->height.GetValue(); | |
941 | ||
942 | // If we don't want to resize this window, just move it... | |
943 | if ((constr->width.GetRelationship() != wxAsIs) || | |
944 | (constr->height.GetRelationship() != wxAsIs)) | |
945 | { | |
946 | // Calls Layout() recursively. AAAGH. How can we stop that. | |
947 | // Simply take Layout() out of non-top level OnSizes. | |
948 | SizerSetSize(x, y, w, h); | |
949 | } | |
950 | else | |
951 | { | |
952 | SizerMove(x, y); | |
953 | } | |
954 | } | |
955 | else if (constr) | |
956 | { | |
957 | char *windowClass = this->GetClassInfo()->GetClassName(); | |
958 | ||
959 | wxString winName; | |
960 | if (GetName() == "") | |
961 | winName = "unnamed"; | |
962 | else | |
963 | winName = GetName(); | |
964 | wxDebugMsg("Constraint(s) not satisfied for window of type %s, name %s:\n", (const char *)windowClass, (const char *)winName); | |
965 | if (!constr->left.GetDone()) | |
966 | wxDebugMsg(" unsatisfied 'left' constraint.\n"); | |
967 | if (!constr->right.GetDone()) | |
968 | wxDebugMsg(" unsatisfied 'right' constraint.\n"); | |
969 | if (!constr->width.GetDone()) | |
970 | wxDebugMsg(" unsatisfied 'width' constraint.\n"); | |
971 | if (!constr->height.GetDone()) | |
972 | wxDebugMsg(" unsatisfied 'height' constraint.\n"); | |
973 | wxDebugMsg("Please check constraints: try adding AsIs() constraints.\n"); | |
974 | } | |
975 | ||
976 | if (recurse) | |
977 | { | |
978 | wxNode *node = GetChildren()->First(); | |
979 | while (node) | |
980 | { | |
981 | wxWindow *win = (wxWindow *)node->Data(); | |
982 | if (!win->IsKindOf(CLASSINFO(wxFrame)) && !win->IsKindOf(CLASSINFO(wxDialog))) | |
983 | win->SetConstraintSizes(); | |
984 | node = node->Next(); | |
985 | } | |
986 | } | |
987 | } | |
988 | ||
989 | // This assumes that all sizers are 'on' the same | |
990 | // window, i.e. the parent of this window. | |
991 | void wxWindow::TransformSizerToActual(int *x, int *y) const | |
992 | { | |
993 | if (!m_sizerParent || m_sizerParent->IsKindOf(CLASSINFO(wxDialog)) || | |
994 | m_sizerParent->IsKindOf(CLASSINFO(wxFrame)) ) | |
995 | return; | |
996 | ||
997 | int xp, yp; | |
998 | m_sizerParent->GetPosition(&xp, &yp); | |
999 | m_sizerParent->TransformSizerToActual(&xp, &yp); | |
1000 | *x += xp; | |
1001 | *y += yp; | |
1002 | } | |
1003 | ||
1004 | void wxWindow::SizerSetSize(int x, int y, int w, int h) | |
1005 | { | |
1006 | int xx = x; | |
1007 | int yy = y; | |
1008 | TransformSizerToActual(&xx, &yy); | |
1009 | SetSize(xx, yy, w, h); | |
1010 | } | |
1011 | ||
1012 | void wxWindow::SizerMove(int x, int y) | |
1013 | { | |
1014 | int xx = x; | |
1015 | int yy = y; | |
1016 | TransformSizerToActual(&xx, &yy); | |
1017 | Move(xx, yy); | |
1018 | } | |
1019 | ||
1020 | // Only set the size/position of the constraint (if any) | |
1021 | void wxWindow::SetSizeConstraint(int x, int y, int w, int h) | |
1022 | { | |
1023 | wxLayoutConstraints *constr = GetConstraints(); | |
1024 | if (constr) | |
1025 | { | |
1026 | if (x != -1) | |
1027 | { | |
1028 | constr->left.SetValue(x); | |
1029 | constr->left.SetDone(TRUE); | |
1030 | } | |
1031 | if (y != -1) | |
1032 | { | |
1033 | constr->top.SetValue(y); | |
1034 | constr->top.SetDone(TRUE); | |
1035 | } | |
1036 | if (w != -1) | |
1037 | { | |
1038 | constr->width.SetValue(w); | |
1039 | constr->width.SetDone(TRUE); | |
1040 | } | |
1041 | if (h != -1) | |
1042 | { | |
1043 | constr->height.SetValue(h); | |
1044 | constr->height.SetDone(TRUE); | |
1045 | } | |
1046 | } | |
1047 | } | |
1048 | ||
1049 | void wxWindow::MoveConstraint(int x, int y) | |
1050 | { | |
1051 | wxLayoutConstraints *constr = GetConstraints(); | |
1052 | if (constr) | |
1053 | { | |
1054 | if (x != -1) | |
1055 | { | |
1056 | constr->left.SetValue(x); | |
1057 | constr->left.SetDone(TRUE); | |
1058 | } | |
1059 | if (y != -1) | |
1060 | { | |
1061 | constr->top.SetValue(y); | |
1062 | constr->top.SetDone(TRUE); | |
1063 | } | |
1064 | } | |
1065 | } | |
1066 | ||
1067 | void wxWindow::GetSizeConstraint(int *w, int *h) const | |
1068 | { | |
1069 | wxLayoutConstraints *constr = GetConstraints(); | |
1070 | if (constr) | |
1071 | { | |
1072 | *w = constr->width.GetValue(); | |
1073 | *h = constr->height.GetValue(); | |
1074 | } | |
1075 | else | |
1076 | GetSize(w, h); | |
1077 | } | |
1078 | ||
1079 | void wxWindow::GetClientSizeConstraint(int *w, int *h) const | |
1080 | { | |
1081 | wxLayoutConstraints *constr = GetConstraints(); | |
1082 | if (constr) | |
1083 | { | |
1084 | *w = constr->width.GetValue(); | |
1085 | *h = constr->height.GetValue(); | |
1086 | } | |
1087 | else | |
1088 | GetClientSize(w, h); | |
1089 | } | |
1090 | ||
1091 | void wxWindow::GetPositionConstraint(int *x, int *y) const | |
1092 | { | |
1093 | wxLayoutConstraints *constr = GetConstraints(); | |
1094 | if (constr) | |
1095 | { | |
1096 | *x = constr->left.GetValue(); | |
1097 | *y = constr->top.GetValue(); | |
1098 | } | |
1099 | else | |
1100 | GetPosition(x, y); | |
1101 | } | |
1102 | ||
1103 | bool wxWindow::Close(bool force) | |
1104 | { | |
1105 | wxCloseEvent event(wxEVT_CLOSE_WINDOW, m_windowId); | |
1106 | event.SetEventObject(this); | |
1107 | event.SetForce(force); | |
1108 | ||
1109 | return GetEventHandler()->ProcessEvent(event); | |
1110 | } | |
1111 | ||
1112 | wxObject* wxWindow::GetChild(int number) const | |
1113 | { | |
1114 | // Return a pointer to the Nth object in the window | |
1115 | if (!GetChildren()) | |
1116 | return(NULL) ; | |
1117 | wxNode *node = GetChildren()->First(); | |
1118 | int n = number; | |
1119 | while (node && n--) | |
1120 | node = node->Next() ; | |
1121 | if (node) | |
1122 | { | |
1123 | wxObject *obj = (wxObject *)node->Data(); | |
1124 | return(obj) ; | |
1125 | } | |
1126 | else | |
1127 | return NULL ; | |
1128 | } | |
1129 | ||
1130 | void wxWindow::OnDefaultAction(wxControl *initiatingItem) | |
1131 | { | |
1132 | // Obsolete function | |
1133 | } | |
1134 | ||
1135 | void wxWindow::Clear() | |
1136 | { | |
1137 | wxClientDC dc(this); | |
1138 | wxBrush brush(GetBackgroundColour(), wxSOLID); | |
1139 | dc.SetBackground(brush); | |
1140 | dc.Clear(); | |
1141 | } | |
1142 | ||
1143 | // Fits the panel around the items | |
1144 | void wxWindow::Fit() | |
1145 | { | |
1146 | int maxX = 0; | |
1147 | int maxY = 0; | |
1148 | wxNode *node = GetChildren()->First(); | |
1149 | while ( node ) | |
1150 | { | |
1151 | wxWindow *win = (wxWindow *)node->Data(); | |
1152 | int wx, wy, ww, wh; | |
1153 | win->GetPosition(&wx, &wy); | |
1154 | win->GetSize(&ww, &wh); | |
1155 | if ( wx + ww > maxX ) | |
1156 | maxX = wx + ww; | |
1157 | if ( wy + wh > maxY ) | |
1158 | maxY = wy + wh; | |
1159 | ||
1160 | node = node->Next(); | |
1161 | } | |
1162 | SetClientSize(maxX + 5, maxY + 5); | |
1163 | } | |
1164 | ||
1165 | void wxWindow::SetValidator(const wxValidator& validator) | |
1166 | { | |
1167 | if ( m_windowValidator ) | |
1168 | delete m_windowValidator; | |
1169 | m_windowValidator = validator.Clone(); | |
1170 | ||
1171 | if ( m_windowValidator ) | |
1172 | m_windowValidator->SetWindow(this) ; | |
1173 | } | |
1174 | ||
1175 | // Find a window by id or name | |
1176 | wxWindow *wxWindow::FindWindow(long id) | |
1177 | { | |
1178 | if ( GetId() == id) | |
1179 | return this; | |
1180 | ||
1181 | wxNode *node = GetChildren()->First(); | |
1182 | while ( node ) | |
1183 | { | |
1184 | wxWindow *child = (wxWindow *)node->Data(); | |
1185 | wxWindow *found = child->FindWindow(id); | |
1186 | if ( found ) | |
1187 | return found; | |
1188 | node = node->Next(); | |
1189 | } | |
1190 | return NULL; | |
1191 | } | |
1192 | ||
1193 | wxWindow *wxWindow::FindWindow(const wxString& name) | |
1194 | { | |
1195 | if ( GetName() == name) | |
1196 | return this; | |
1197 | ||
1198 | wxNode *node = GetChildren()->First(); | |
1199 | while ( node ) | |
1200 | { | |
1201 | wxWindow *child = (wxWindow *)node->Data(); | |
1202 | wxWindow *found = child->FindWindow(name); | |
1203 | if ( found ) | |
1204 | return found; | |
1205 | node = node->Next(); | |
1206 | } | |
1207 | return NULL; | |
1208 | } | |
1209 | ||
1210 | void wxWindow::OnIdle(wxIdleEvent& event) | |
1211 | { | |
1212 | /* TODO: you may need to do something like this | |
1213 | * if your GUI doesn't generate enter/leave events | |
1214 | ||
1215 | // Check if we need to send a LEAVE event | |
1216 | if (m_mouseInWindow) | |
1217 | { | |
1218 | POINT pt; | |
1219 | ::GetCursorPos(&pt); | |
1220 | if (::WindowFromPoint(pt) != (HWND) GetHWND()) | |
1221 | { | |
1222 | // Generate a LEAVE event | |
1223 | m_mouseInWindow = FALSE; | |
1224 | MSWOnMouseLeave(pt.x, pt.y, 0); | |
1225 | } | |
1226 | } | |
1227 | */ | |
1228 | ||
1229 | // This calls the UI-update mechanism (querying windows for | |
1230 | // menu/toolbar/control state information) | |
1231 | UpdateWindowUI(); | |
1232 | } | |
1233 | ||
1234 | // Raise the window to the top of the Z order | |
1235 | void wxWindow::Raise() | |
1236 | { | |
1237 | // TODO | |
1238 | } | |
1239 | ||
1240 | // Lower the window to the bottom of the Z order | |
1241 | void wxWindow::Lower() | |
1242 | { | |
1243 | // TODO | |
1244 | } | |
1245 | ||
1246 | bool wxWindow::AcceptsFocus() const | |
1247 | { | |
1248 | return IsShown() && IsEnabled(); | |
1249 | } | |
1250 | ||
1251 | // Update region access | |
1252 | wxRegion wxWindow::GetUpdateRegion() const | |
1253 | { | |
1254 | return m_updateRegion; | |
1255 | } | |
1256 | ||
1257 | bool wxWindow::IsExposed(int x, int y, int w, int h) const | |
1258 | { | |
1259 | return (m_updateRegion.Contains(x, y, w, h) != wxOutRegion); | |
1260 | } | |
1261 | ||
1262 | bool wxWindow::IsExposed(const wxPoint& pt) const | |
1263 | { | |
1264 | return (m_updateRegion.Contains(pt) != wxOutRegion); | |
1265 | } | |
1266 | ||
1267 | bool wxWindow::IsExposed(const wxRect& rect) const | |
1268 | { | |
1269 | return (m_updateRegion.Contains(rect) != wxOutRegion); | |
1270 | } | |
1271 | ||
34138703 JS |
1272 | /* |
1273 | * Allocates control IDs | |
1274 | */ | |
1275 | ||
1276 | int wxWindow::NewControlId() | |
1277 | { | |
1278 | static int s_controlId = 0; | |
1279 | s_controlId ++; | |
1280 | return s_controlId; | |
1281 | } | |
1282 | ||
93cf77c0 | 1283 |