X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/fd71308fc89eac2dd212b715eba68a993fa78f53..e5f741e5d467b1ce7105be96e9f3dcb553e8b89d:/src/stubs/window.cpp diff --git a/src/stubs/window.cpp b/src/stubs/window.cpp index 1d51541d8d..0eeda07dfc 100644 --- a/src/stubs/window.cpp +++ b/src/stubs/window.cpp @@ -39,24 +39,25 @@ extern wxList wxPendingDelete; -#if !USE_SHARED_LIBRARY 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) EVT_IDLE(wxWindow::OnIdle) END_EVENT_TABLE() -#endif // Constructor wxWindow::wxWindow() { // Generic + m_isWindow = TRUE; // An optimization m_windowId = 0; m_windowStyle = 0; m_windowParent = NULL; @@ -144,6 +145,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; @@ -370,7 +372,7 @@ void wxWindow::GetTextExtent(const wxString& string, int *x, int *y, // TODO } -void wxWindow::Refresh(bool eraseBack, const wxRectangle *rect) +void wxWindow::Refresh(bool eraseBack, const wxRect *rect) { // TODO } @@ -378,7 +380,7 @@ void wxWindow::Refresh(bool eraseBack, const wxRectangle *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 @@ -534,7 +536,7 @@ void wxWindow::SetScrollbar(int orient, int pos, int thumbVisible, } // Does a physical scroll -void wxWindow::ScrollWindow(int dx, int dy, const wxRectangle *rect) +void wxWindow::ScrollWindow(int dx, int dy, const wxRect *rect) { // TODO return; @@ -551,6 +553,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 +562,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 +598,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 +618,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 +634,7 @@ bool wxWindow::TransferDataFromWindow() bool wxWindow::Validate() { - wxNode *node = GetChildren()->First(); + wxNode *node = GetChildren().First(); while ( node ) { wxWindow *child = (wxWindow *)node->Data(); @@ -642,30 +657,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 +892,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 +937,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 +996,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 +1125,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 +1136,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 +1167,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 +1205,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 +1222,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 +1296,11 @@ bool wxWindow::IsExposed(const wxRect& rect) const return (m_updateRegion.Contains(rect) != wxOutRegion); } +void wxWindow::SetToolTip(const wxString& tooltip) +{ + // TODO +} + /* * Allocates control IDs */