From eb082a088a77e8afb3c5a87880a42b9ec9a487e3 Mon Sep 17 00:00:00 2001 From: Robert Roebling Date: Tue, 11 May 1999 18:28:37 +0000 Subject: [PATCH] Typos fixed. Corrected children's deletion (strict now). Corrected scrolled window's setup upon startup (with/without scrollbars etc.) git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@2417 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- include/wx/gtk/radiobut.h | 4 ++-- include/wx/gtk1/radiobut.h | 4 ++-- include/wx/window.h | 2 +- samples/scroll/scroll.cpp | 21 +++++++++++---------- src/common/wincmn.cpp | 16 +++++++++------- src/gtk/bmpbuttn.cpp | 4 +--- src/gtk/radiobut.cpp | 2 +- src/gtk/window.cpp | 15 +++++---------- src/gtk1/bmpbuttn.cpp | 4 +--- src/gtk1/radiobut.cpp | 2 +- src/gtk1/window.cpp | 15 +++++---------- 11 files changed, 39 insertions(+), 50 deletions(-) diff --git a/include/wx/gtk/radiobut.h b/include/wx/gtk/radiobut.h index 11bf3cedb1..35a610b1ad 100644 --- a/include/wx/gtk/radiobut.h +++ b/include/wx/gtk/radiobut.h @@ -41,7 +41,7 @@ class wxRadioButton: public wxControl DECLARE_DYNAMIC_CLASS(wxRadioButton) public: - inline wxRadioButton(void) {} + inline wxRadioButton() {} inline wxRadioButton( wxWindow *parent, wxWindowID id, const wxString& label, const wxPoint& pos = wxDefaultPosition, @@ -59,7 +59,7 @@ class wxRadioButton: public wxControl const wxString& name = wxRadioButtonNameStr ); virtual void SetLabel(const wxString& label); virtual void SetValue(bool val); - virtual bool GetValue(void) const; + virtual bool GetValue() const; bool Enable( bool enable ); // implementation diff --git a/include/wx/gtk1/radiobut.h b/include/wx/gtk1/radiobut.h index 11bf3cedb1..35a610b1ad 100644 --- a/include/wx/gtk1/radiobut.h +++ b/include/wx/gtk1/radiobut.h @@ -41,7 +41,7 @@ class wxRadioButton: public wxControl DECLARE_DYNAMIC_CLASS(wxRadioButton) public: - inline wxRadioButton(void) {} + inline wxRadioButton() {} inline wxRadioButton( wxWindow *parent, wxWindowID id, const wxString& label, const wxPoint& pos = wxDefaultPosition, @@ -59,7 +59,7 @@ class wxRadioButton: public wxControl const wxString& name = wxRadioButtonNameStr ); virtual void SetLabel(const wxString& label); virtual void SetValue(bool val); - virtual bool GetValue(void) const; + virtual bool GetValue() const; bool Enable( bool enable ); // implementation diff --git a/include/wx/window.h b/include/wx/window.h index 44a4084193..b84b81fb49 100644 --- a/include/wx/window.h +++ b/include/wx/window.h @@ -37,7 +37,7 @@ class WXDLLEXPORT wxClientData; class WXDLLEXPORT wxControl; class WXDLLEXPORT wxCursor; -class WXDLLEXPORT wxDc; +class WXDLLEXPORT wxDC; class WXDLLEXPORT wxDropTarget; class WXDLLEXPORT wxItemResource; class WXDLLEXPORT wxLayoutConstraints; diff --git a/samples/scroll/scroll.cpp b/samples/scroll/scroll.cpp index afb70c1e72..ece802323f 100644 --- a/samples/scroll/scroll.cpp +++ b/samples/scroll/scroll.cpp @@ -79,15 +79,6 @@ MyCanvas::MyCanvas( wxWindow *parent, wxWindowID id, const wxPoint &pos, const wxSize &size ) : wxScrolledWindow( parent, id, pos, size, wxSUNKEN_BORDER | wxTAB_TRAVERSAL ) { - - SetBackgroundColour( *wxWHITE ); - - (void) new wxButton( this, -1, "wxButton", wxPoint(10,10) ); - - (void) new wxTextCtrl( this, -1, "wxTextCtrl", wxPoint(10,50) ); - - (void) new wxRadioButton( this, -1, "Disable", wxPoint(10,90) ); - wxString choices[] = { "This", @@ -97,9 +88,17 @@ MyCanvas::MyCanvas( wxWindow *parent, wxWindowID id, "examples." }; - (void) new wxComboBox( this, -1, "This", wxPoint(10,130), wxDefaultSize, 5, choices ); +// (void) new wxButton( this, -1, "wxButton", wxPoint(10,10) ); + +// (void) new wxTextCtrl( this, -1, "wxTextCtrl", wxPoint(10,50) ); + + (void) new wxRadioButton( this, -1, "Disable", wxPoint(10,90) ); + +// (void) new wxComboBox( this, -1, "This", wxPoint(10,130), wxDefaultSize, 5, choices ); (void) new wxRadioBox( this, -1, "This", wxPoint(10,200), wxDefaultSize, 5, choices ); + + SetBackgroundColour( *wxWHITE ); } MyCanvas::~MyCanvas() @@ -134,6 +133,7 @@ MyFrame::MyFrame() : wxFrame( (wxFrame *)NULL, -1, "wxScrolledWindow sample", wxPoint(20,20), wxSize(470,360) ) { +/* wxMenu *file_menu = new wxMenu(); file_menu->Append( ID_ABOUT, "&About.."); file_menu->Append( ID_QUIT, "E&xit\tAlt-X"); @@ -147,6 +147,7 @@ MyFrame::MyFrame() int widths[] = { -1, 100 }; SetStatusWidths( 2, widths ); +*/ m_canvas = new MyCanvas( this, -1, wxPoint(0,0), wxSize(10,10) ); m_canvas->SetScrollbars( 10, 10, 50, 100 ); } diff --git a/src/common/wincmn.cpp b/src/common/wincmn.cpp index 66390ee06f..611ab2b4c0 100644 --- a/src/common/wincmn.cpp +++ b/src/common/wincmn.cpp @@ -178,8 +178,8 @@ wxWindowBase::~wxWindowBase() // Just in case we've loaded a top-level window via LoadNativeDialog but // we weren't a dialog class wxTopLevelWindows.DeleteObject(this); - - DestroyChildren(); + + wxASSERT_MSG( GetChildren().GetCount() == 0, "children not destroyed" ); if ( m_windowValidator ) delete m_windowValidator; @@ -244,13 +244,15 @@ bool wxWindowBase::Close(bool force) bool wxWindowBase::DestroyChildren() { wxWindowList::Node *node; - for ( node = GetChildren().GetFirst(); node; node = node->GetNext() ) + while ( (node = GetChildren().GetFirst()) ) { wxWindow *child = node->GetData(); - if ( child ) - { - delete child; - } + + wxASSERT_MSG( child, "m_children contains empty nodes" ); + + delete child; + + wxASSERT_MSG( !GetChildren().Find(child), "child didn't remove itself using RemoveChild()" ); } return TRUE; diff --git a/src/gtk/bmpbuttn.cpp b/src/gtk/bmpbuttn.cpp index 783d419baa..7ede0d75a7 100644 --- a/src/gtk/bmpbuttn.cpp +++ b/src/gtk/bmpbuttn.cpp @@ -164,9 +164,7 @@ bool wxBitmapButton::Create( wxWindow *parent, wxWindowID id, const wxBitmap &bi gtk_signal_connect( GTK_OBJECT(m_widget), "released", GTK_SIGNAL_FUNC(gtk_bmpbutton_release_callback), (gpointer*)this ); - m_parent->AddChild( this ); - - m_parent->InsertChild( this ); + m_parent->DoAddChild( this ); PostCreation(); diff --git a/src/gtk/radiobut.cpp b/src/gtk/radiobut.cpp index a3446422f7..8ccd9ef3c0 100644 --- a/src/gtk/radiobut.cpp +++ b/src/gtk/radiobut.cpp @@ -129,7 +129,7 @@ void wxRadioButton::SetValue( bool val ) gtk_toggle_button_set_state( GTK_TOGGLE_BUTTON(m_theOtherRadioButtton), TRUE ); } -bool wxRadioButton::GetValue(void) const +bool wxRadioButton::GetValue() const { wxCHECK_MSG( m_widget != NULL, FALSE, _T("invalid radiobutton") ); diff --git a/src/gtk/window.cpp b/src/gtk/window.cpp index a3ccbc764f..000ff9b424 100644 --- a/src/gtk/window.cpp +++ b/src/gtk/window.cpp @@ -2676,15 +2676,10 @@ void wxWindow::SetScrollbar( int orient, int pos, int thumbVisible, m_vAdjust->page_size = fthumb; } - if (m_wxwindow->window) - { - if (orient == wxHORIZONTAL) - gtk_signal_emit_by_name( GTK_OBJECT(m_hAdjust), "changed" ); - else - gtk_signal_emit_by_name( GTK_OBJECT(m_vAdjust), "changed" ); - - gtk_widget_set_usize( m_widget, m_width, m_height ); - } + if (orient == wxHORIZONTAL) + gtk_signal_emit_by_name( GTK_OBJECT(m_hAdjust), "changed" ); + else + gtk_signal_emit_by_name( GTK_OBJECT(m_vAdjust), "changed" ); } void wxWindow::SetScrollPos( int orient, int pos, bool WXUNUSED(refresh) ) @@ -2714,7 +2709,7 @@ void wxWindow::SetScrollPos( int orient, int pos, bool WXUNUSED(refresh) ) m_vAdjust->value = fpos; } - if (!m_isScrolling) + if (!m_isScrolling) /* prevent recursion */ { if (m_wxwindow->window) { diff --git a/src/gtk1/bmpbuttn.cpp b/src/gtk1/bmpbuttn.cpp index 783d419baa..7ede0d75a7 100644 --- a/src/gtk1/bmpbuttn.cpp +++ b/src/gtk1/bmpbuttn.cpp @@ -164,9 +164,7 @@ bool wxBitmapButton::Create( wxWindow *parent, wxWindowID id, const wxBitmap &bi gtk_signal_connect( GTK_OBJECT(m_widget), "released", GTK_SIGNAL_FUNC(gtk_bmpbutton_release_callback), (gpointer*)this ); - m_parent->AddChild( this ); - - m_parent->InsertChild( this ); + m_parent->DoAddChild( this ); PostCreation(); diff --git a/src/gtk1/radiobut.cpp b/src/gtk1/radiobut.cpp index a3446422f7..8ccd9ef3c0 100644 --- a/src/gtk1/radiobut.cpp +++ b/src/gtk1/radiobut.cpp @@ -129,7 +129,7 @@ void wxRadioButton::SetValue( bool val ) gtk_toggle_button_set_state( GTK_TOGGLE_BUTTON(m_theOtherRadioButtton), TRUE ); } -bool wxRadioButton::GetValue(void) const +bool wxRadioButton::GetValue() const { wxCHECK_MSG( m_widget != NULL, FALSE, _T("invalid radiobutton") ); diff --git a/src/gtk1/window.cpp b/src/gtk1/window.cpp index a3ccbc764f..000ff9b424 100644 --- a/src/gtk1/window.cpp +++ b/src/gtk1/window.cpp @@ -2676,15 +2676,10 @@ void wxWindow::SetScrollbar( int orient, int pos, int thumbVisible, m_vAdjust->page_size = fthumb; } - if (m_wxwindow->window) - { - if (orient == wxHORIZONTAL) - gtk_signal_emit_by_name( GTK_OBJECT(m_hAdjust), "changed" ); - else - gtk_signal_emit_by_name( GTK_OBJECT(m_vAdjust), "changed" ); - - gtk_widget_set_usize( m_widget, m_width, m_height ); - } + if (orient == wxHORIZONTAL) + gtk_signal_emit_by_name( GTK_OBJECT(m_hAdjust), "changed" ); + else + gtk_signal_emit_by_name( GTK_OBJECT(m_vAdjust), "changed" ); } void wxWindow::SetScrollPos( int orient, int pos, bool WXUNUSED(refresh) ) @@ -2714,7 +2709,7 @@ void wxWindow::SetScrollPos( int orient, int pos, bool WXUNUSED(refresh) ) m_vAdjust->value = fpos; } - if (!m_isScrolling) + if (!m_isScrolling) /* prevent recursion */ { if (m_wxwindow->window) { -- 2.45.2