X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/16e93305f2bae16652b6750dffe3bcf05c20d839..1363811bb6338fb0dad6c16cfa47f46fb1eb3b99:/src/stubs/window.cpp diff --git a/src/stubs/window.cpp b/src/stubs/window.cpp index fa6aac07b6..6970db0614 100644 --- a/src/stubs/window.cpp +++ b/src/stubs/window.cpp @@ -44,6 +44,8 @@ IMPLEMENT_DYNAMIC_CLASS(wxWindow, wxEvtHandler) BEGIN_EVENT_TABLE(wxWindow, wxEvtHandler) EVT_CHAR(wxWindow::OnChar) + EVT_KEY_DOWN(wxWindow::OnKeyDown) + EVT_KEY_UP(wxWindow::OnKeyUp) EVT_ERASE_BACKGROUND(wxWindow::OnEraseBackground) EVT_SYS_COLOUR_CHANGED(wxWindow::OnSysColourChanged) EVT_INIT_DIALOG(wxWindow::OnInitDialog) @@ -57,6 +59,7 @@ END_EVENT_TABLE() wxWindow::wxWindow() { // Generic + m_isWindow = TRUE; // An optimization m_windowId = 0; m_windowStyle = 0; m_windowParent = NULL; @@ -144,6 +147,7 @@ bool wxWindow::Create(wxWindow *parent, wxWindowID id, const wxString& name) { // Generic + m_isWindow = TRUE; // An optimization m_windowId = 0; m_windowStyle = 0; m_windowParent = NULL; @@ -378,7 +382,7 @@ void wxWindow::Refresh(bool eraseBack, const wxRect *rect) // Responds to colour changes: passes event on to children. void wxWindow::OnSysColourChanged(wxSysColourChangedEvent& event) { - wxNode *node = GetChildren()->First(); + wxNode *node = GetChildren().First(); while ( node ) { // Only propagate to non-top-level windows @@ -551,6 +555,7 @@ void wxWindow::SetFont(const wxFont& font) void wxWindow::OnChar(wxKeyEvent& event) { +/* ?? if ( event.KeyCode() == WXK_TAB ) { // propagate the TABs to the parent - it's up to it to decide what // to do with it @@ -559,6 +564,18 @@ void wxWindow::OnChar(wxKeyEvent& event) return; } } +*/ + Default(); +} + +void wxWindow::OnKeyDown(wxKeyEvent& event) +{ + Default(); +} + +void wxWindow::OnKeyUp(wxKeyEvent& event) +{ + Default(); } void wxWindow::OnPaint(wxPaintEvent& event) @@ -583,7 +600,7 @@ bool wxWindow::IsEnabled() const // it's an application error (pops up a dialog) bool wxWindow::TransferDataToWindow() { - wxNode *node = GetChildren()->First(); + wxNode *node = GetChildren().First(); while ( node ) { wxWindow *child = (wxWindow *)node->Data(); @@ -603,7 +620,7 @@ bool wxWindow::TransferDataToWindow() // validation failed: don't quit bool wxWindow::TransferDataFromWindow() { - wxNode *node = GetChildren()->First(); + wxNode *node = GetChildren().First(); while ( node ) { wxWindow *child = (wxWindow *)node->Data(); @@ -619,7 +636,7 @@ bool wxWindow::TransferDataFromWindow() bool wxWindow::Validate() { - wxNode *node = GetChildren()->First(); + wxNode *node = GetChildren().First(); while ( node ) { wxWindow *child = (wxWindow *)node->Data(); @@ -642,30 +659,27 @@ wxWindow *wxWindow::FindFocus() void wxWindow::AddChild(wxWindow *child) { - GetChildren()->Append(child); + GetChildren().Append(child); child->m_windowParent = this; } void wxWindow::RemoveChild(wxWindow *child) { - if (GetChildren()) - GetChildren()->DeleteObject(child); + GetChildren().DeleteObject(child); child->m_windowParent = NULL; } void wxWindow::DestroyChildren() { - if (GetChildren()) { wxNode *node; - while ((node = GetChildren()->First()) != (wxNode *)NULL) { + while ((node = GetChildren().First()) != (wxNode *)NULL) { wxWindow *child; if ((child = (wxWindow *)node->Data()) != (wxWindow *)NULL) { delete child; - if ( GetChildren()->Member(child) ) + if ( GetChildren().Member(child) ) delete node; } } /* while */ - } } void wxWindow::MakeModal(bool modal) @@ -880,7 +894,7 @@ bool wxWindow::DoPhase(int phase) { noChanges = 0; noFailures = 0; - wxNode *node = GetChildren()->First(); + wxNode *node = GetChildren().First(); while (node) { wxWindow *child = (wxWindow *)node->Data(); @@ -925,7 +939,7 @@ void wxWindow::ResetConstraints() constr->centreX.SetDone(FALSE); constr->centreY.SetDone(FALSE); } - wxNode *node = GetChildren()->First(); + wxNode *node = GetChildren().First(); while (node) { wxWindow *win = (wxWindow *)node->Data(); @@ -984,7 +998,7 @@ void wxWindow::SetConstraintSizes(bool recurse) if (recurse) { - wxNode *node = GetChildren()->First(); + wxNode *node = GetChildren().First(); while (node) { wxWindow *win = (wxWindow *)node->Data(); @@ -1113,7 +1127,10 @@ bool wxWindow::Close(bool force) { wxCloseEvent event(wxEVT_CLOSE_WINDOW, m_windowId); event.SetEventObject(this); +#if WXWIN_COMPATIBILITY event.SetForce(force); +#endif + event.SetCanVeto(!force); return GetEventHandler()->ProcessEvent(event); } @@ -1121,9 +1138,7 @@ bool wxWindow::Close(bool force) wxObject* wxWindow::GetChild(int number) const { // Return a pointer to the Nth object in the window - if (!GetChildren()) - return(NULL) ; - wxNode *node = GetChildren()->First(); + wxNode *node = GetChildren().First(); int n = number; while (node && n--) node = node->Next() ; @@ -1154,7 +1169,7 @@ void wxWindow::Fit() { int maxX = 0; int maxY = 0; - wxNode *node = GetChildren()->First(); + wxNode *node = GetChildren().First(); while ( node ) { wxWindow *win = (wxWindow *)node->Data(); @@ -1192,7 +1207,7 @@ wxWindow *wxWindow::FindWindow(long id) if ( GetId() == id) return this; - wxNode *node = GetChildren()->First(); + wxNode *node = GetChildren().First(); while ( node ) { wxWindow *child = (wxWindow *)node->Data(); @@ -1209,7 +1224,7 @@ wxWindow *wxWindow::FindWindow(const wxString& name) if ( GetName() == name) return this; - wxNode *node = GetChildren()->First(); + wxNode *node = GetChildren().First(); while ( node ) { wxWindow *child = (wxWindow *)node->Data(); @@ -1283,6 +1298,11 @@ bool wxWindow::IsExposed(const wxRect& rect) const return (m_updateRegion.Contains(rect) != wxOutRegion); } +void wxWindow::SetToolTip(const wxString& tooltip) +{ + // TODO +} + /* * Allocates control IDs */