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:
@@ -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
|
||||
|
@@ -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
|
||||
|
@@ -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;
|
||||
|
@@ -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 );
|
||||
}
|
||||
|
@@ -179,7 +179,7 @@ wxWindowBase::~wxWindowBase()
|
||||
// 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 )
|
||||
{
|
||||
|
||||
wxASSERT_MSG( child, "m_children contains empty nodes" );
|
||||
|
||||
delete child;
|
||||
}
|
||||
|
||||
wxASSERT_MSG( !GetChildren().Find(child), "child didn't remove itself using RemoveChild()" );
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
|
@@ -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();
|
||||
|
||||
|
@@ -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") );
|
||||
|
||||
|
@@ -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 );
|
||||
}
|
||||
}
|
||||
|
||||
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)
|
||||
{
|
||||
|
@@ -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();
|
||||
|
||||
|
@@ -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") );
|
||||
|
||||
|
@@ -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 );
|
||||
}
|
||||
}
|
||||
|
||||
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)
|
||||
{
|
||||
|
Reference in New Issue
Block a user