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
This commit is contained in:
Robert Roebling
1999-05-11 18:28:37 +00:00
parent 1a5594b80f
commit eb082a088a
11 changed files with 39 additions and 50 deletions

View File

@@ -41,7 +41,7 @@ class wxRadioButton: public wxControl
DECLARE_DYNAMIC_CLASS(wxRadioButton) DECLARE_DYNAMIC_CLASS(wxRadioButton)
public: public:
inline wxRadioButton(void) {} inline wxRadioButton() {}
inline wxRadioButton( wxWindow *parent, wxWindowID id, inline wxRadioButton( wxWindow *parent, wxWindowID id,
const wxString& label, const wxString& label,
const wxPoint& pos = wxDefaultPosition, const wxPoint& pos = wxDefaultPosition,
@@ -59,7 +59,7 @@ class wxRadioButton: public wxControl
const wxString& name = wxRadioButtonNameStr ); const wxString& name = wxRadioButtonNameStr );
virtual void SetLabel(const wxString& label); virtual void SetLabel(const wxString& label);
virtual void SetValue(bool val); virtual void SetValue(bool val);
virtual bool GetValue(void) const; virtual bool GetValue() const;
bool Enable( bool enable ); bool Enable( bool enable );
// implementation // implementation

View File

@@ -41,7 +41,7 @@ class wxRadioButton: public wxControl
DECLARE_DYNAMIC_CLASS(wxRadioButton) DECLARE_DYNAMIC_CLASS(wxRadioButton)
public: public:
inline wxRadioButton(void) {} inline wxRadioButton() {}
inline wxRadioButton( wxWindow *parent, wxWindowID id, inline wxRadioButton( wxWindow *parent, wxWindowID id,
const wxString& label, const wxString& label,
const wxPoint& pos = wxDefaultPosition, const wxPoint& pos = wxDefaultPosition,
@@ -59,7 +59,7 @@ class wxRadioButton: public wxControl
const wxString& name = wxRadioButtonNameStr ); const wxString& name = wxRadioButtonNameStr );
virtual void SetLabel(const wxString& label); virtual void SetLabel(const wxString& label);
virtual void SetValue(bool val); virtual void SetValue(bool val);
virtual bool GetValue(void) const; virtual bool GetValue() const;
bool Enable( bool enable ); bool Enable( bool enable );
// implementation // implementation

View File

@@ -37,7 +37,7 @@
class WXDLLEXPORT wxClientData; class WXDLLEXPORT wxClientData;
class WXDLLEXPORT wxControl; class WXDLLEXPORT wxControl;
class WXDLLEXPORT wxCursor; class WXDLLEXPORT wxCursor;
class WXDLLEXPORT wxDc; class WXDLLEXPORT wxDC;
class WXDLLEXPORT wxDropTarget; class WXDLLEXPORT wxDropTarget;
class WXDLLEXPORT wxItemResource; class WXDLLEXPORT wxItemResource;
class WXDLLEXPORT wxLayoutConstraints; class WXDLLEXPORT wxLayoutConstraints;

View File

@@ -79,15 +79,6 @@ MyCanvas::MyCanvas( wxWindow *parent, wxWindowID id,
const wxPoint &pos, const wxSize &size ) const wxPoint &pos, const wxSize &size )
: wxScrolledWindow( parent, id, pos, size, wxSUNKEN_BORDER | wxTAB_TRAVERSAL ) : 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[] = wxString choices[] =
{ {
"This", "This",
@@ -97,9 +88,17 @@ MyCanvas::MyCanvas( wxWindow *parent, wxWindowID id,
"examples." "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 ); (void) new wxRadioBox( this, -1, "This", wxPoint(10,200), wxDefaultSize, 5, choices );
SetBackgroundColour( *wxWHITE );
} }
MyCanvas::~MyCanvas() MyCanvas::~MyCanvas()
@@ -134,6 +133,7 @@ MyFrame::MyFrame()
: wxFrame( (wxFrame *)NULL, -1, "wxScrolledWindow sample", : wxFrame( (wxFrame *)NULL, -1, "wxScrolledWindow sample",
wxPoint(20,20), wxSize(470,360) ) wxPoint(20,20), wxSize(470,360) )
{ {
/*
wxMenu *file_menu = new wxMenu(); wxMenu *file_menu = new wxMenu();
file_menu->Append( ID_ABOUT, "&About.."); file_menu->Append( ID_ABOUT, "&About..");
file_menu->Append( ID_QUIT, "E&xit\tAlt-X"); file_menu->Append( ID_QUIT, "E&xit\tAlt-X");
@@ -147,6 +147,7 @@ MyFrame::MyFrame()
int widths[] = { -1, 100 }; int widths[] = { -1, 100 };
SetStatusWidths( 2, widths ); SetStatusWidths( 2, widths );
*/
m_canvas = new MyCanvas( this, -1, wxPoint(0,0), wxSize(10,10) ); m_canvas = new MyCanvas( this, -1, wxPoint(0,0), wxSize(10,10) );
m_canvas->SetScrollbars( 10, 10, 50, 100 ); m_canvas->SetScrollbars( 10, 10, 50, 100 );
} }

View File

@@ -179,7 +179,7 @@ wxWindowBase::~wxWindowBase()
// we weren't a dialog class // we weren't a dialog class
wxTopLevelWindows.DeleteObject(this); wxTopLevelWindows.DeleteObject(this);
DestroyChildren(); wxASSERT_MSG( GetChildren().GetCount() == 0, "children not destroyed" );
if ( m_windowValidator ) if ( m_windowValidator )
delete m_windowValidator; delete m_windowValidator;
@@ -244,13 +244,15 @@ bool wxWindowBase::Close(bool force)
bool wxWindowBase::DestroyChildren() bool wxWindowBase::DestroyChildren()
{ {
wxWindowList::Node *node; wxWindowList::Node *node;
for ( node = GetChildren().GetFirst(); node; node = node->GetNext() ) while ( (node = GetChildren().GetFirst()) )
{ {
wxWindow *child = node->GetData(); wxWindow *child = node->GetData();
if ( child )
{ wxASSERT_MSG( child, "m_children contains empty nodes" );
delete child; delete child;
}
wxASSERT_MSG( !GetChildren().Find(child), "child didn't remove itself using RemoveChild()" );
} }
return TRUE; return TRUE;

View File

@@ -164,9 +164,7 @@ bool wxBitmapButton::Create( wxWindow *parent, wxWindowID id, const wxBitmap &bi
gtk_signal_connect( GTK_OBJECT(m_widget), "released", gtk_signal_connect( GTK_OBJECT(m_widget), "released",
GTK_SIGNAL_FUNC(gtk_bmpbutton_release_callback), (gpointer*)this ); GTK_SIGNAL_FUNC(gtk_bmpbutton_release_callback), (gpointer*)this );
m_parent->AddChild( this ); m_parent->DoAddChild( this );
m_parent->InsertChild( this );
PostCreation(); PostCreation();

View File

@@ -129,7 +129,7 @@ void wxRadioButton::SetValue( bool val )
gtk_toggle_button_set_state( GTK_TOGGLE_BUTTON(m_theOtherRadioButtton), TRUE ); 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") ); wxCHECK_MSG( m_widget != NULL, FALSE, _T("invalid radiobutton") );

View File

@@ -2676,15 +2676,10 @@ void wxWindow::SetScrollbar( int orient, int pos, int thumbVisible,
m_vAdjust->page_size = fthumb; m_vAdjust->page_size = fthumb;
} }
if (m_wxwindow->window)
{
if (orient == wxHORIZONTAL) if (orient == wxHORIZONTAL)
gtk_signal_emit_by_name( GTK_OBJECT(m_hAdjust), "changed" ); gtk_signal_emit_by_name( GTK_OBJECT(m_hAdjust), "changed" );
else else
gtk_signal_emit_by_name( GTK_OBJECT(m_vAdjust), "changed" ); gtk_signal_emit_by_name( GTK_OBJECT(m_vAdjust), "changed" );
gtk_widget_set_usize( m_widget, m_width, m_height );
}
} }
void wxWindow::SetScrollPos( int orient, int pos, bool WXUNUSED(refresh) ) 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; m_vAdjust->value = fpos;
} }
if (!m_isScrolling) if (!m_isScrolling) /* prevent recursion */
{ {
if (m_wxwindow->window) if (m_wxwindow->window)
{ {

View File

@@ -164,9 +164,7 @@ bool wxBitmapButton::Create( wxWindow *parent, wxWindowID id, const wxBitmap &bi
gtk_signal_connect( GTK_OBJECT(m_widget), "released", gtk_signal_connect( GTK_OBJECT(m_widget), "released",
GTK_SIGNAL_FUNC(gtk_bmpbutton_release_callback), (gpointer*)this ); GTK_SIGNAL_FUNC(gtk_bmpbutton_release_callback), (gpointer*)this );
m_parent->AddChild( this ); m_parent->DoAddChild( this );
m_parent->InsertChild( this );
PostCreation(); PostCreation();

View File

@@ -129,7 +129,7 @@ void wxRadioButton::SetValue( bool val )
gtk_toggle_button_set_state( GTK_TOGGLE_BUTTON(m_theOtherRadioButtton), TRUE ); 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") ); wxCHECK_MSG( m_widget != NULL, FALSE, _T("invalid radiobutton") );

View File

@@ -2676,15 +2676,10 @@ void wxWindow::SetScrollbar( int orient, int pos, int thumbVisible,
m_vAdjust->page_size = fthumb; m_vAdjust->page_size = fthumb;
} }
if (m_wxwindow->window)
{
if (orient == wxHORIZONTAL) if (orient == wxHORIZONTAL)
gtk_signal_emit_by_name( GTK_OBJECT(m_hAdjust), "changed" ); gtk_signal_emit_by_name( GTK_OBJECT(m_hAdjust), "changed" );
else else
gtk_signal_emit_by_name( GTK_OBJECT(m_vAdjust), "changed" ); gtk_signal_emit_by_name( GTK_OBJECT(m_vAdjust), "changed" );
gtk_widget_set_usize( m_widget, m_width, m_height );
}
} }
void wxWindow::SetScrollPos( int orient, int pos, bool WXUNUSED(refresh) ) 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; m_vAdjust->value = fpos;
} }
if (!m_isScrolling) if (!m_isScrolling) /* prevent recursion */
{ {
if (m_wxwindow->window) if (m_wxwindow->window)
{ {