Old API clearly deprecated. Source cleaning.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@31265 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Włodzimierz Skiba
2005-01-06 12:41:27 +00:00
parent 39caed1f6d
commit b4efc9b931
8 changed files with 146 additions and 67 deletions

View File

@@ -97,17 +97,16 @@ public:
// for compatibility only, don't use these methods in new code! // for compatibility only, don't use these methods in new code!
#if WXWIN_COMPATIBILITY_2_2 #if WXWIN_COMPATIBILITY_2_2
int Number() const { return GetCount(); } wxDEPRECATED( int Number() const );
wxString GetLabel(int n) const { return GetString(n); } wxDEPRECATED( wxString GetLabel(int n) const );
void SetLabel( int item, const wxString& label ) wxDEPRECATED( void SetLabel( int item, const wxString& label ) );
{ SetString(item, label); }
#endif // WXWIN_COMPATIBILITY_2_2 #endif // WXWIN_COMPATIBILITY_2_2
// we have to override those to avoid virtual function name hiding // we have to override those to avoid virtual function name hiding
virtual wxString GetLabel() const { return wxControl::GetLabel(); } virtual wxString GetLabel() const { return wxControl::GetLabel(); }
virtual void SetLabel( const wxString& label ); virtual void SetLabel( const wxString& label );
virtual bool Show( bool show = TRUE ); virtual bool Show( bool show = true );
virtual bool Enable( bool enable = TRUE ); virtual bool Enable( bool enable = true );
static wxVisualAttributes static wxVisualAttributes
GetClassDefaultAttributes(wxWindowVariant variant = wxWINDOW_VARIANT_NORMAL); GetClassDefaultAttributes(wxWindowVariant variant = wxWINDOW_VARIANT_NORMAL);

View File

@@ -97,17 +97,16 @@ public:
// for compatibility only, don't use these methods in new code! // for compatibility only, don't use these methods in new code!
#if WXWIN_COMPATIBILITY_2_2 #if WXWIN_COMPATIBILITY_2_2
int Number() const { return GetCount(); } wxDEPRECATED( int Number() const );
wxString GetLabel(int n) const { return GetString(n); } wxDEPRECATED( wxString GetLabel(int n) const );
void SetLabel( int item, const wxString& label ) wxDEPRECATED( void SetLabel( int item, const wxString& label ) );
{ SetString(item, label); }
#endif // WXWIN_COMPATIBILITY_2_2 #endif // WXWIN_COMPATIBILITY_2_2
// we have to override those to avoid virtual function name hiding // we have to override those to avoid virtual function name hiding
virtual wxString GetLabel() const { return wxControl::GetLabel(); } virtual wxString GetLabel() const { return wxControl::GetLabel(); }
virtual void SetLabel( const wxString& label ); virtual void SetLabel( const wxString& label );
virtual bool Show( bool show = TRUE ); virtual bool Show( bool show = true );
virtual bool Enable( bool enable = TRUE ); virtual bool Enable( bool enable = true );
static wxVisualAttributes static wxVisualAttributes
GetClassDefaultAttributes(wxWindowVariant variant = wxWINDOW_VARIANT_NORMAL); GetClassDefaultAttributes(wxWindowVariant variant = wxWINDOW_VARIANT_NORMAL);

View File

@@ -97,9 +97,9 @@ public:
// for compatibility only, don't use these methods in new code! // for compatibility only, don't use these methods in new code!
#if WXWIN_COMPATIBILITY_2_2 #if WXWIN_COMPATIBILITY_2_2
int Number() const { return GetCount(); } wxDEPRECATED( int Number() const );
wxString GetLabel(int n) const { return GetString(n); } wxDEPRECATED( wxString GetLabel(int n) const );
void SetLabel(int n, const wxString& label) { SetString(n, label); } wxDEPRECATED( void SetLabel(int n, const wxString& label) );
#endif // WXWIN_COMPATIBILITY_2_2 #endif // WXWIN_COMPATIBILITY_2_2
}; };

View File

@@ -200,11 +200,11 @@ public:
// compatibility only, don't use // compatibility only, don't use
#if WXWIN_COMPATIBILITY_2_2 #if WXWIN_COMPATIBILITY_2_2
const wxBitmap& GetBitmap1() const { return GetNormalBitmap(); } wxDEPRECATED( const wxBitmap& GetBitmap1() const );
const wxBitmap& GetBitmap2() const { return GetDisabledBitmap(); } wxDEPRECATED( const wxBitmap& GetBitmap2() const );
void SetBitmap1(const wxBitmap& bmp) { SetNormalBitmap(bmp); } wxDEPRECATED( void SetBitmap1(const wxBitmap& bmp) );
void SetBitmap2(const wxBitmap& bmp) { SetDisabledBitmap(bmp); } wxDEPRECATED( void SetBitmap2(const wxBitmap& bmp) );
#endif // WXWIN_COMPATIBILITY_2_2 #endif // WXWIN_COMPATIBILITY_2_2
protected: protected:

View File

@@ -148,5 +148,24 @@ void wxRadioBoxBase::SetNumberOfRowsOrCols(int WXUNUSED(n))
#endif // WXWIN_COMPATIBILITY_2_4 #endif // WXWIN_COMPATIBILITY_2_4
#if WXWIN_COMPATIBILITY_2_2
int wxRadioBoxBase::Number() const
{
return GetCount();
}
wxString wxRadioBoxBase::GetLabel(int n) const
{
return GetString(n);
}
void wxRadioBoxBase::SetLabel(int n, const wxString& label)
{
SetString(n, label);
}
#endif // WXWIN_COMPATIBILITY_2_2
#endif // wxUSE_RADIOBOX #endif // wxUSE_RADIOBOX

View File

@@ -114,6 +114,30 @@ bool wxToolBarToolBase::SetLongHelp(const wxString& help)
return true; return true;
} }
#if WXWIN_COMPATIBILITY_2_2
const wxBitmap& wxToolBarToolBase::GetBitmap1() const
{
return GetNormalBitmap();
}
const wxBitmap& wxToolBarToolBase::GetBitmap2() const
{
return GetDisabledBitmap();
}
void wxToolBarToolBase::SetBitmap1(const wxBitmap& bmp)
{
SetNormalBitmap(bmp);
}
void wxToolBarToolBase::SetBitmap2(const wxBitmap& bmp)
{
SetDisabledBitmap(bmp);
}
#endif // WXWIN_COMPATIBILITY_2_2
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
// wxToolBarBase adding/deleting items // wxToolBarBase adding/deleting items
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------

View File

@@ -123,7 +123,7 @@ static gint gtk_radiobutton_focus_in( GtkWidget *widget,
} }
else if ( !win->m_hasFocus ) else if ( !win->m_hasFocus )
{ {
win->m_hasFocus = TRUE; win->m_hasFocus = true;
wxFocusEvent event( wxEVT_SET_FOCUS, win->GetId() ); wxFocusEvent event( wxEVT_SET_FOCUS, win->GetId() );
event.SetEventObject( win ); event.SetEventObject( win );
@@ -147,8 +147,8 @@ static gint gtk_radiobutton_focus_out( GtkWidget *widget,
// we might have lost the focus, but may be not - it may have just gone to // we might have lost the focus, but may be not - it may have just gone to
// another button in the same radiobox, so we'll check for it in the next // another button in the same radiobox, so we'll check for it in the next
// idle iteration (leave m_hasFocus == TRUE for now) // idle iteration (leave m_hasFocus == true for now)
win->m_lostFocus = TRUE; win->m_lostFocus = true;
return FALSE; return FALSE;
} }
@@ -161,11 +161,11 @@ IMPLEMENT_DYNAMIC_CLASS(wxRadioBox,wxControl)
void wxRadioBox::Init() void wxRadioBox::Init()
{ {
m_needParent = TRUE; m_needParent = true;
m_acceptsFocus = TRUE; m_acceptsFocus = true;
m_hasFocus = m_hasFocus =
m_lostFocus = FALSE; m_lostFocus = false;
} }
bool wxRadioBox::Create( wxWindow *parent, wxWindowID id, bool wxRadioBox::Create( wxWindow *parent, wxWindowID id,
@@ -191,7 +191,7 @@ bool wxRadioBox::Create( wxWindow *parent, wxWindowID id, const wxString& title,
!CreateBase( parent, id, pos, size, style, validator, name )) !CreateBase( parent, id, pos, size, style, validator, name ))
{ {
wxFAIL_MSG( wxT("wxRadioBox creation failed") ); wxFAIL_MSG( wxT("wxRadioBox creation failed") );
return FALSE; return false;
} }
m_widget = gtk_frame_new( wxGTK_CONV( title ) ); m_widget = gtk_frame_new( wxGTK_CONV( title ) );
@@ -254,7 +254,7 @@ bool wxRadioBox::Create( wxWindow *parent, wxWindowID id, const wxString& title,
if ( wasShown ) if ( wasShown )
Show(); Show();
return TRUE; return true;
} }
wxRadioBox::~wxRadioBox() wxRadioBox::~wxRadioBox()
@@ -409,12 +409,12 @@ wxSize wxRadioBox::LayoutItems(bool justCalc) const
bool wxRadioBox::Show( bool show ) bool wxRadioBox::Show( bool show )
{ {
wxCHECK_MSG( m_widget != NULL, FALSE, wxT("invalid radiobox") ); wxCHECK_MSG( m_widget != NULL, false, wxT("invalid radiobox") );
if (!wxControl::Show(show)) if (!wxControl::Show(show))
{ {
// nothing to do // nothing to do
return FALSE; return false;
} }
if ( HasFlag(wxNO_BORDER) ) if ( HasFlag(wxNO_BORDER) )
@@ -430,7 +430,7 @@ bool wxRadioBox::Show( bool show )
node = node->GetNext(); node = node->GetNext();
} }
return TRUE; return true;
} }
int wxRadioBox::FindString( const wxString &find ) const int wxRadioBox::FindString( const wxString &find ) const
@@ -559,7 +559,7 @@ void wxRadioBox::SetString( int item, const wxString& label )
bool wxRadioBox::Enable( bool enable ) bool wxRadioBox::Enable( bool enable )
{ {
if ( !wxControl::Enable( enable ) ) if ( !wxControl::Enable( enable ) )
return FALSE; return false;
wxList::compatibility_iterator node = m_boxes.GetFirst(); wxList::compatibility_iterator node = m_boxes.GetFirst();
while (node) while (node)
@@ -572,7 +572,7 @@ bool wxRadioBox::Enable( bool enable )
node = node->GetNext(); node = node->GetNext();
} }
return TRUE; return true;
} }
void wxRadioBox::Enable( int item, bool enable ) void wxRadioBox::Enable( int item, bool enable )
@@ -634,13 +634,13 @@ wxString wxRadioBox::GetStringSelection() const
bool wxRadioBox::SetStringSelection( const wxString &s ) bool wxRadioBox::SetStringSelection( const wxString &s )
{ {
wxCHECK_MSG( m_widget != NULL, FALSE, wxT("invalid radiobox") ); wxCHECK_MSG( m_widget != NULL, false, wxT("invalid radiobox") );
int res = FindString( s ); int res = FindString( s );
if (res == -1) return FALSE; if (res == -1) return false;
SetSelection( res ); SetSelection( res );
return TRUE; return true;
} }
int wxRadioBox::GetCount() const int wxRadioBox::GetCount() const
@@ -707,27 +707,27 @@ void wxRadioBox::ApplyToolTip( GtkTooltips *tips, const wxChar *tip )
bool wxRadioBox::IsOwnGtkWindow( GdkWindow *window ) bool wxRadioBox::IsOwnGtkWindow( GdkWindow *window )
{ {
if (window == m_widget->window) return TRUE; if (window == m_widget->window) return true;
wxList::compatibility_iterator node = m_boxes.GetFirst(); wxList::compatibility_iterator node = m_boxes.GetFirst();
while (node) while (node)
{ {
GtkWidget *button = GTK_WIDGET( node->GetData() ); GtkWidget *button = GTK_WIDGET( node->GetData() );
if (window == button->window) return TRUE; if (window == button->window) return true;
node = node->GetNext(); node = node->GetNext();
} }
return FALSE; return false;
} }
void wxRadioBox::OnInternalIdle() void wxRadioBox::OnInternalIdle()
{ {
if ( m_lostFocus ) if ( m_lostFocus )
{ {
m_hasFocus = FALSE; m_hasFocus = false;
m_lostFocus = FALSE; m_lostFocus = false;
wxFocusEvent event( wxEVT_KILL_FOCUS, GetId() ); wxFocusEvent event( wxEVT_KILL_FOCUS, GetId() );
event.SetEventObject( this ); event.SetEventObject( this );
@@ -759,5 +759,24 @@ wxRadioBox::GetClassDefaultAttributes(wxWindowVariant WXUNUSED(variant))
return attr; return attr;
} }
#if WXWIN_COMPATIBILITY_2_2
int wxRadioBox::Number() const
{
return GetCount();
}
wxString wxRadioBox::GetLabel(int n) const
{
return GetString(n);
}
void wxRadioBox::SetLabel( int item, const wxString& label )
{
SetString(item, label);
}
#endif // WXWIN_COMPATIBILITY_2_2
#endif // wxUSE_RADIOBOX #endif // wxUSE_RADIOBOX

View File

@@ -123,7 +123,7 @@ static gint gtk_radiobutton_focus_in( GtkWidget *widget,
} }
else if ( !win->m_hasFocus ) else if ( !win->m_hasFocus )
{ {
win->m_hasFocus = TRUE; win->m_hasFocus = true;
wxFocusEvent event( wxEVT_SET_FOCUS, win->GetId() ); wxFocusEvent event( wxEVT_SET_FOCUS, win->GetId() );
event.SetEventObject( win ); event.SetEventObject( win );
@@ -147,8 +147,8 @@ static gint gtk_radiobutton_focus_out( GtkWidget *widget,
// we might have lost the focus, but may be not - it may have just gone to // we might have lost the focus, but may be not - it may have just gone to
// another button in the same radiobox, so we'll check for it in the next // another button in the same radiobox, so we'll check for it in the next
// idle iteration (leave m_hasFocus == TRUE for now) // idle iteration (leave m_hasFocus == true for now)
win->m_lostFocus = TRUE; win->m_lostFocus = true;
return FALSE; return FALSE;
} }
@@ -161,11 +161,11 @@ IMPLEMENT_DYNAMIC_CLASS(wxRadioBox,wxControl)
void wxRadioBox::Init() void wxRadioBox::Init()
{ {
m_needParent = TRUE; m_needParent = true;
m_acceptsFocus = TRUE; m_acceptsFocus = true;
m_hasFocus = m_hasFocus =
m_lostFocus = FALSE; m_lostFocus = false;
} }
bool wxRadioBox::Create( wxWindow *parent, wxWindowID id, bool wxRadioBox::Create( wxWindow *parent, wxWindowID id,
@@ -191,7 +191,7 @@ bool wxRadioBox::Create( wxWindow *parent, wxWindowID id, const wxString& title,
!CreateBase( parent, id, pos, size, style, validator, name )) !CreateBase( parent, id, pos, size, style, validator, name ))
{ {
wxFAIL_MSG( wxT("wxRadioBox creation failed") ); wxFAIL_MSG( wxT("wxRadioBox creation failed") );
return FALSE; return false;
} }
m_widget = gtk_frame_new( wxGTK_CONV( title ) ); m_widget = gtk_frame_new( wxGTK_CONV( title ) );
@@ -254,7 +254,7 @@ bool wxRadioBox::Create( wxWindow *parent, wxWindowID id, const wxString& title,
if ( wasShown ) if ( wasShown )
Show(); Show();
return TRUE; return true;
} }
wxRadioBox::~wxRadioBox() wxRadioBox::~wxRadioBox()
@@ -409,12 +409,12 @@ wxSize wxRadioBox::LayoutItems(bool justCalc) const
bool wxRadioBox::Show( bool show ) bool wxRadioBox::Show( bool show )
{ {
wxCHECK_MSG( m_widget != NULL, FALSE, wxT("invalid radiobox") ); wxCHECK_MSG( m_widget != NULL, false, wxT("invalid radiobox") );
if (!wxControl::Show(show)) if (!wxControl::Show(show))
{ {
// nothing to do // nothing to do
return FALSE; return false;
} }
if ( HasFlag(wxNO_BORDER) ) if ( HasFlag(wxNO_BORDER) )
@@ -430,7 +430,7 @@ bool wxRadioBox::Show( bool show )
node = node->GetNext(); node = node->GetNext();
} }
return TRUE; return true;
} }
int wxRadioBox::FindString( const wxString &find ) const int wxRadioBox::FindString( const wxString &find ) const
@@ -559,7 +559,7 @@ void wxRadioBox::SetString( int item, const wxString& label )
bool wxRadioBox::Enable( bool enable ) bool wxRadioBox::Enable( bool enable )
{ {
if ( !wxControl::Enable( enable ) ) if ( !wxControl::Enable( enable ) )
return FALSE; return false;
wxList::compatibility_iterator node = m_boxes.GetFirst(); wxList::compatibility_iterator node = m_boxes.GetFirst();
while (node) while (node)
@@ -572,7 +572,7 @@ bool wxRadioBox::Enable( bool enable )
node = node->GetNext(); node = node->GetNext();
} }
return TRUE; return true;
} }
void wxRadioBox::Enable( int item, bool enable ) void wxRadioBox::Enable( int item, bool enable )
@@ -634,13 +634,13 @@ wxString wxRadioBox::GetStringSelection() const
bool wxRadioBox::SetStringSelection( const wxString &s ) bool wxRadioBox::SetStringSelection( const wxString &s )
{ {
wxCHECK_MSG( m_widget != NULL, FALSE, wxT("invalid radiobox") ); wxCHECK_MSG( m_widget != NULL, false, wxT("invalid radiobox") );
int res = FindString( s ); int res = FindString( s );
if (res == -1) return FALSE; if (res == -1) return false;
SetSelection( res ); SetSelection( res );
return TRUE; return true;
} }
int wxRadioBox::GetCount() const int wxRadioBox::GetCount() const
@@ -707,27 +707,27 @@ void wxRadioBox::ApplyToolTip( GtkTooltips *tips, const wxChar *tip )
bool wxRadioBox::IsOwnGtkWindow( GdkWindow *window ) bool wxRadioBox::IsOwnGtkWindow( GdkWindow *window )
{ {
if (window == m_widget->window) return TRUE; if (window == m_widget->window) return true;
wxList::compatibility_iterator node = m_boxes.GetFirst(); wxList::compatibility_iterator node = m_boxes.GetFirst();
while (node) while (node)
{ {
GtkWidget *button = GTK_WIDGET( node->GetData() ); GtkWidget *button = GTK_WIDGET( node->GetData() );
if (window == button->window) return TRUE; if (window == button->window) return true;
node = node->GetNext(); node = node->GetNext();
} }
return FALSE; return false;
} }
void wxRadioBox::OnInternalIdle() void wxRadioBox::OnInternalIdle()
{ {
if ( m_lostFocus ) if ( m_lostFocus )
{ {
m_hasFocus = FALSE; m_hasFocus = false;
m_lostFocus = FALSE; m_lostFocus = false;
wxFocusEvent event( wxEVT_KILL_FOCUS, GetId() ); wxFocusEvent event( wxEVT_KILL_FOCUS, GetId() );
event.SetEventObject( this ); event.SetEventObject( this );
@@ -759,5 +759,24 @@ wxRadioBox::GetClassDefaultAttributes(wxWindowVariant WXUNUSED(variant))
return attr; return attr;
} }
#if WXWIN_COMPATIBILITY_2_2
int wxRadioBox::Number() const
{
return GetCount();
}
wxString wxRadioBox::GetLabel(int n) const
{
return GetString(n);
}
void wxRadioBox::SetLabel( int item, const wxString& label )
{
SetString(item, label);
}
#endif // WXWIN_COMPATIBILITY_2_2
#endif // wxUSE_RADIOBOX #endif // wxUSE_RADIOBOX