From ec157c8f95dfa40b19202a320e7a1d60995d2c8e Mon Sep 17 00:00:00 2001 From: =?utf8?q?W=C5=82odzimierz=20Skiba?= Date: Tue, 4 Jan 2005 19:35:52 +0000 Subject: [PATCH] Old API depreciated. Use of new API. Source cleaning. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@31234 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- contrib/src/deprecated/proplist.cpp | 2 +- contrib/src/fl/toolwnd.cpp | 2 +- include/wx/palmos/treectrl.h | 9 -------- include/wx/settings.h | 14 +++++------ include/wx/treebase.h | 2 +- include/wx/utils.h | 6 ++--- src/cocoa/dialog.mm | 18 +++++++-------- src/common/dynload.cpp | 14 +++++------ src/common/settcmn.cpp | 18 +++++++++++++++ src/common/treebase.cpp | 9 ++++++++ src/generic/grid.cpp | 36 ++++++++++++++--------------- src/os2/listbox.cpp | 20 ++++++++-------- src/xrc/xmlres.cpp | 2 +- 13 files changed, 84 insertions(+), 68 deletions(-) diff --git a/contrib/src/deprecated/proplist.cpp b/contrib/src/deprecated/proplist.cpp index 23d75cf99b..e962342691 100644 --- a/contrib/src/deprecated/proplist.cpp +++ b/contrib/src/deprecated/proplist.cpp @@ -423,7 +423,7 @@ bool wxPropertyListView::CreateControls() if (!panel) return false; - wxFont guiFont = wxSystemSettings::GetSystemFont(wxSYS_DEFAULT_GUI_FONT); + wxFont guiFont = wxSystemSettings::GetFont(wxSYS_DEFAULT_GUI_FONT); #ifdef __WXMSW__ wxFont *boringFont = diff --git a/contrib/src/fl/toolwnd.cpp b/contrib/src/fl/toolwnd.cpp index f71ceaab40..c3bd5c8876 100644 --- a/contrib/src/fl/toolwnd.cpp +++ b/contrib/src/fl/toolwnd.cpp @@ -164,7 +164,7 @@ void wxToolWindow::OnPaint( wxPaintEvent& WXUNUSED(event) ) int w,h; GetSize( &w, &h ); - wxBrush backGround( wxSystemSettings::GetSystemColour(wxSYS_COLOUR_BTNFACE), wxSOLID ); + wxBrush backGround( wxSystemSettings::GetColour(wxSYS_COLOUR_BTNFACE), wxSOLID ); //dc.SetBrush( *wxLIGHT_GREY_BRUSH ); dc.SetBrush( backGround ); dc.SetPen( *wxTRANSPARENT_PEN ); diff --git a/include/wx/palmos/treectrl.h b/include/wx/palmos/treectrl.h index 36dedc2a06..c73ffc730e 100644 --- a/include/wx/palmos/treectrl.h +++ b/include/wx/palmos/treectrl.h @@ -221,15 +221,6 @@ public: // get the parent of this item (may return NULL if root) wxTreeItemId GetItemParent(const wxTreeItemId& item) const; -#if WXWIN_COMPATIBILITY_2_2 - // deprecated: Use GetItemParent instead. - wxTreeItemId GetParent(const wxTreeItemId& item) const - { return GetItemParent( item ); } - - // Expose the base class method hidden by the one above. - wxWindow *GetParent() const { return wxControl::GetParent(); } -#endif // WXWIN_COMPATIBILITY_2_2 - // for this enumeration function you must pass in a "cookie" parameter // which is opaque for the application but is necessary for the library // to make these functions reentrant (i.e. allow more than one diff --git a/include/wx/settings.h b/include/wx/settings.h index 4ed8c4c64a..a4dc9145c1 100644 --- a/include/wx/settings.h +++ b/include/wx/settings.h @@ -180,7 +180,7 @@ class WXDLLEXPORT wxSystemSettings : public wxSystemSettingsNative public: #ifdef __WXUNIVERSAL__ // in wxUniversal we want to use the theme standard colours instead of the - // system ones, otherwuse wxSystemSettings is just the same as + // system ones, otherwise wxSystemSettings is just the same as // wxSystemSettingsNative static wxColour GetColour(wxSystemColour index); #endif // __WXUNIVERSAL__ @@ -195,15 +195,13 @@ public: // Value static wxSystemScreenType ms_screen; - +#if WXWIN_COMPATIBILITY_2_4 // the backwards compatible versions of wxSystemSettingsNative functions, // don't use these methods in the new code! - static wxColour GetSystemColour(int index) - { return GetColour((wxSystemColour)index); } - static wxFont GetSystemFont(int index) - { return GetFont((wxSystemFont)index); } - static int GetSystemMetric(int index) - { return GetMetric((wxSystemMetric)index); } + wxDEPRECATED(static wxColour GetSystemColour(int index)); + wxDEPRECATED(static wxFont GetSystemFont(int index)); + wxDEPRECATED(static int GetSystemMetric(int index)); +#endif }; #endif diff --git a/include/wx/treebase.h b/include/wx/treebase.h index 28ec4e5271..7bdc2d2a29 100644 --- a/include/wx/treebase.h +++ b/include/wx/treebase.h @@ -286,7 +286,7 @@ public: #if WXWIN_COMPATIBILITY_2_2 // for compatibility only, don't use - int GetCode() const { return m_evtKey.GetKeyCode(); } + wxDEPRECATED( int GetCode() const); #endif // WXWIN_COMPATIBILITY_2_2 private: diff --git a/include/wx/utils.h b/include/wx/utils.h index b783dc25d6..f71325bce7 100644 --- a/include/wx/utils.h +++ b/include/wx/utils.h @@ -532,15 +532,15 @@ WXDLLIMPEXP_BASE bool wxYieldIfNeeded(); // Format a message on the standard error (UNIX) or the debugging // stream (Windows) -WXDLLIMPEXP_BASE void wxDebugMsg(const wxChar *fmt ...) ATTRIBUTE_PRINTF_1; +wxDEPRECATED( WXDLLIMPEXP_BASE void wxDebugMsg(const wxChar *fmt ...) ATTRIBUTE_PRINTF_1 ); // Non-fatal error (continues) WXDLLIMPEXP_DATA_BASE(extern const wxChar*) wxInternalErrorStr; -WXDLLIMPEXP_BASE void wxError(const wxString& msg, const wxString& title = wxInternalErrorStr); +wxDEPRECATED( WXDLLIMPEXP_BASE void wxError(const wxString& msg, const wxString& title = wxInternalErrorStr) ); // Fatal error (exits) WXDLLIMPEXP_DATA_BASE(extern const wxChar*) wxFatalErrorStr; -WXDLLIMPEXP_BASE void wxFatalError(const wxString& msg, const wxString& title = wxFatalErrorStr); +wxDEPRECATED( WXDLLIMPEXP_BASE void wxFatalError(const wxString& msg, const wxString& title = wxFatalErrorStr) ); #endif // WXWIN_COMPATIBILITY_2_2 diff --git a/src/cocoa/dialog.mm b/src/cocoa/dialog.mm index 59adee3068..e15c2937aa 100644 --- a/src/cocoa/dialog.mm +++ b/src/cocoa/dialog.mm @@ -4,9 +4,9 @@ // Author: David Elliott // Modified by: // Created: 2002/12/15 -// RCS-ID: $Id: +// RCS-ID: $Id: // Copyright: 2002 David Elliott -// Licence: wxWidgets licence +// Licence: wxWidgets licence ///////////////////////////////////////////////////////////////////////////// #include "wx/wxprec.h" @@ -43,7 +43,7 @@ WX_IMPLEMENT_COCOA_OWNER(wxDialog,NSPanel,NSWindow,NSWindow) void wxDialog::Init() { m_isModal = false; - SetBackgroundColour(wxSystemSettings::GetSystemColour(wxSYS_COLOUR_3DFACE)); + SetBackgroundColour(wxSystemSettings::GetColour(wxSYS_COLOUR_3DFACE)); } bool wxDialog::Create(wxWindow *parent, wxWindowID winid, @@ -194,15 +194,15 @@ void wxDialog::OnCloseWindow(wxCloseEvent& event) event.Veto(); static wxList closing; - + if ( closing.Member(this) ) { wxLogDebug(wxT("WARNING: Attempting to recursively call Close for dialog")); return; } - + closing.Append(this); - + wxLogTrace(wxTRACE_COCOA,wxT("Sending Cancel Event")); wxCommandEvent cancelEvent(wxEVT_COMMAND_BUTTON_CLICKED, wxID_CANCEL); cancelEvent.SetEventObject( this ); @@ -222,9 +222,9 @@ void wxDialog::OnOK(wxCommandEvent& event) void wxDialog::OnApply(wxCommandEvent& event) { - if (Validate()) - TransferDataFromWindow(); - // TODO probably need to disable the Apply button until things change again + if (Validate()) + TransferDataFromWindow(); + // TODO probably need to disable the Apply button until things change again } void wxDialog::OnCancel(wxCommandEvent& event) diff --git a/src/common/dynload.cpp b/src/common/dynload.cpp index 854d7c3049..ded5bbd2d6 100644 --- a/src/common/dynload.cpp +++ b/src/common/dynload.cpp @@ -526,13 +526,13 @@ wxLibraries::wxLibraries():m_loaded(wxKEY_STRING) wxLibraries::~wxLibraries() { - wxNode *node = m_loaded.First(); + wxNode *node = m_loaded.GetFirst(); while (node) { - wxLibrary *lib = (wxLibrary *)node->Data(); + wxLibrary *lib = (wxLibrary *)node->GetData(); delete lib; - node = node->Next(); + node = node->GetNext(); } } @@ -543,7 +543,7 @@ wxLibrary *wxLibraries::LoadLibrary(const wxString& name) wxNode *node = m_loaded.Find(name.GetData()); if (node != NULL) - return ((wxLibrary *)node->Data()); + return ((wxLibrary *)node->GetData()); // If DLL shares data, this is necessary. old_sm_first = wxClassInfo::sm_first; @@ -567,15 +567,15 @@ wxLibrary *wxLibraries::LoadLibrary(const wxString& name) wxObject *wxLibraries::CreateObject(const wxString& path) { - wxNode *node = m_loaded.First(); + wxNode *node = m_loaded.GetFirst(); wxObject *obj; while (node) { - obj = ((wxLibrary *)node->Data())->CreateObject(path); + obj = ((wxLibrary *)node->GetData())->CreateObject(path); if (obj) return obj; - node = node->Next(); + node = node->GetNext(); } return NULL; } diff --git a/src/common/settcmn.cpp b/src/common/settcmn.cpp index b0b6faf211..f5862ba7af 100644 --- a/src/common/settcmn.cpp +++ b/src/common/settcmn.cpp @@ -72,3 +72,21 @@ void wxSystemSettings::SetScreenType( wxSystemScreenType screen ) ms_screen = screen; } +#if WXWIN_COMPATIBILITY_2_4 + +wxColour wxSystemSettings::GetSystemColour(int index) +{ + return GetColour((wxSystemColour)index); +} + +wxFont wxSystemSettings::GetSystemFont(int index) +{ + return GetFont((wxSystemFont)index); +} + +int wxSystemSettings::GetSystemMetric(int index) +{ + return GetMetric((wxSystemMetric)index); +} + +#endif // WXWIN_COMPATIBILITY_2_4 diff --git a/src/common/treebase.cpp b/src/common/treebase.cpp index d166c7d705..50a8c96f81 100644 --- a/src/common/treebase.cpp +++ b/src/common/treebase.cpp @@ -90,5 +90,14 @@ wxTreeEvent::wxTreeEvent(const wxTreeEvent & event) m_editCancelled = event.m_editCancelled; } +#if WXWIN_COMPATIBILITY_2_2 + +int wxTreeEvent::GetCode() const +{ + return m_evtKey.GetKeyCode(); +} + +#endif // WXWIN_COMPATIBILITY_2_2 + #endif // wxUSE_TREECTRL diff --git a/src/generic/grid.cpp b/src/generic/grid.cpp index 5e2fdb358c..6f849ff36c 100644 --- a/src/generic/grid.cpp +++ b/src/generic/grid.cpp @@ -1597,18 +1597,18 @@ void wxGridCellRenderer::Draw(wxGrid& grid, // grey out fields if the grid is disabled if( grid.IsEnabled() ) { - if ( isSelected ) - { - dc.SetBrush( wxBrush(grid.GetSelectionBackground(), wxSOLID) ); - } - else - { - dc.SetBrush( wxBrush(attr.GetBackgroundColour(), wxSOLID) ); - } + if ( isSelected ) + { + dc.SetBrush( wxBrush(grid.GetSelectionBackground(), wxSOLID) ); + } + else + { + dc.SetBrush( wxBrush(attr.GetBackgroundColour(), wxSOLID) ); + } } else { - dc.SetBrush(wxBrush(wxSystemSettings::GetSystemColour(wxSYS_COLOUR_BTNFACE), wxSOLID)); + dc.SetBrush(wxBrush(wxSystemSettings::GetColour(wxSYS_COLOUR_BTNFACE), wxSOLID)); } dc.SetPen( *wxTRANSPARENT_PEN ); @@ -1644,8 +1644,8 @@ void wxGridCellStringRenderer::SetTextColoursAndFont(wxGrid& grid, } else { - dc.SetTextBackground(wxSystemSettings::GetSystemColour(wxSYS_COLOUR_BTNFACE)); - dc.SetTextForeground(wxSystemSettings::GetSystemColour(wxSYS_COLOUR_GRAYTEXT)); + dc.SetTextBackground(wxSystemSettings::GetColour(wxSYS_COLOUR_BTNFACE)); + dc.SetTextForeground(wxSystemSettings::GetColour(wxSYS_COLOUR_GRAYTEXT)); } dc.SetFont( attr.GetFont() ); @@ -1932,7 +1932,7 @@ void wxGridCellFloatRenderer::SetParameters(const wxString& params) else { wxString tmp = params.BeforeFirst(_T(',')); - if ( !!tmp ) + if ( !tmp.empty() ) { long width; if ( tmp.ToLong(&width) ) @@ -1946,7 +1946,7 @@ void wxGridCellFloatRenderer::SetParameters(const wxString& params) } tmp = params.AfterFirst(_T(',')); - if ( !!tmp ) + if ( !tmp.empty() ) { long precision; if ( tmp.ToLong(&precision) ) @@ -3653,7 +3653,7 @@ void wxGridCornerLabelWindow::OnPaint( wxPaintEvent& WXUNUSED(event) ) rect.SetY( 1 ); rect.SetWidth( client_width - 2 ); rect.SetHeight( client_height - 2 ); - + wxRendererNative::Get().DrawHeaderButton( this, dc, rect, 0 ); #else dc.SetPen( wxPen(wxSystemSettings::GetColour(wxSYS_COLOUR_3DDKSHADOW),1, wxSOLID) ); @@ -7220,9 +7220,9 @@ void wxGrid::DrawRowLabel( wxDC& dc, int row ) rect.SetY( GetRowTop(row) + 1 ); rect.SetWidth( m_rowLabelWidth - 2 ); rect.SetHeight( GetRowHeight(row) - 2 ); - + CalcScrolledPosition( 0, rect.y, NULL, &rect.y ); - + wxWindowDC *win_dc = (wxWindowDC*) &dc; wxRendererNative::Get().DrawHeaderButton( win_dc->m_owner, dc, rect, 0 ); @@ -7277,14 +7277,14 @@ void wxGrid::DrawColLabel( wxDC& dc, int col ) return; int colLeft = GetColLeft(col); - + wxRect rect; #ifdef __WXGTK__ rect.SetX( colLeft + 1 ); rect.SetY( 1 ); rect.SetWidth( GetColWidth(col) - 2 ); rect.SetHeight( m_colLabelHeight - 2 ); - + wxWindowDC *win_dc = (wxWindowDC*) &dc; wxRendererNative::Get().DrawHeaderButton( win_dc->m_owner, dc, rect, 0 ); diff --git a/src/os2/listbox.cpp b/src/os2/listbox.cpp index 1d8fbd18d3..7cbcb464b9 100644 --- a/src/os2/listbox.cpp +++ b/src/os2/listbox.cpp @@ -56,7 +56,7 @@ wxListBoxItem::wxListBoxItem( const wxString& rsStr ) : wxOwnerDrawn( rsStr - ,FALSE + ,false ) { // @@ -128,7 +128,7 @@ bool wxListBox::Create( wxSystemSettings vSettings; - SetBackgroundColour(vSettings.GetSystemColour(wxSYS_COLOUR_WINDOW)); + SetBackgroundColour(vSettings.GetColour(wxSYS_COLOUR_WINDOW)); SetForegroundColour(pParent->GetForegroundColour()); m_windowId = (vId == -1) ? (int)NewControlId() : vId; @@ -172,7 +172,7 @@ bool wxListBox::Create( ); if (m_hWnd == 0) { - return FALSE; + return false; } // @@ -221,7 +221,7 @@ bool wxListBox::Create( ,nHeight ); delete pTextFont; - return TRUE; + return true; } // end of wxListBox::Create wxListBox::~wxListBox() @@ -435,7 +435,7 @@ bool wxListBox::IsSelected( int N ) const { - wxCHECK_MSG( N >= 0 && N < m_nNumItems, FALSE, + wxCHECK_MSG( N >= 0 && N < m_nNumItems, false, wxT("invalid index in wxListBox::Selected") ); LONG lItem; @@ -785,7 +785,7 @@ bool wxListBox::OS2Command( // // Some event we're not interested in // - return FALSE; + return false; } wxCommandEvent vEvent( eEvtType ,m_windowId @@ -873,14 +873,14 @@ bool wxListBox::OS2OnDraw ( // // Only owner-drawn control should receive this message // - wxCHECK(((m_windowStyle & wxLB_OWNERDRAW) == wxLB_OWNERDRAW), FALSE); + wxCHECK(((m_windowStyle & wxLB_OWNERDRAW) == wxLB_OWNERDRAW), false); // // The item may be -1 for an empty listbox // if (lItemID == -1L) - return FALSE; + return false; wxListBoxItem* pData = (wxListBoxItem*)PVOIDFROMMR( ::WinSendMsg( GetHwnd() ,LM_QUERYITEMHANDLE @@ -889,7 +889,7 @@ bool wxListBox::OS2OnDraw ( ) ); - wxCHECK(pData, FALSE ); + wxCHECK(pData, false ); wxDC vDc; wxRect vRect( wxPoint( pDrawStruct->rclItem.xLeft @@ -962,7 +962,7 @@ bool wxListBox::OS2OnDraw ( // For now we don't care about anything else // just ignore the entire message! // - return TRUE; + return true; } } return pData->OnDrawItem( vDc diff --git a/src/xrc/xmlres.cpp b/src/xrc/xmlres.cpp index 5134702c50..a817ecd7ba 100644 --- a/src/xrc/xmlres.cpp +++ b/src/xrc/xmlres.cpp @@ -103,7 +103,7 @@ bool wxXmlResource::Load(const wxString& filemask) fnd = wxXmlFindFirst; else fnd = filemask; - while (!!fnd) + while (!fnd.empty()) { // NB: Load() accepts both filenames and URLs (should probably be // changed to filenames only, but embedded resources currently -- 2.45.2