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
This commit is contained in:
Włodzimierz Skiba 2005-01-04 19:35:52 +00:00
parent 4aa7ecf1fa
commit ec157c8f95
13 changed files with 84 additions and 68 deletions

View File

@ -423,7 +423,7 @@ bool wxPropertyListView::CreateControls()
if (!panel) if (!panel)
return false; return false;
wxFont guiFont = wxSystemSettings::GetSystemFont(wxSYS_DEFAULT_GUI_FONT); wxFont guiFont = wxSystemSettings::GetFont(wxSYS_DEFAULT_GUI_FONT);
#ifdef __WXMSW__ #ifdef __WXMSW__
wxFont *boringFont = wxFont *boringFont =

View File

@ -164,7 +164,7 @@ void wxToolWindow::OnPaint( wxPaintEvent& WXUNUSED(event) )
int w,h; int w,h;
GetSize( &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( *wxLIGHT_GREY_BRUSH );
dc.SetBrush( backGround ); dc.SetBrush( backGround );
dc.SetPen( *wxTRANSPARENT_PEN ); dc.SetPen( *wxTRANSPARENT_PEN );

View File

@ -221,15 +221,6 @@ public:
// get the parent of this item (may return NULL if root) // get the parent of this item (may return NULL if root)
wxTreeItemId GetItemParent(const wxTreeItemId& item) const; 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 // for this enumeration function you must pass in a "cookie" parameter
// which is opaque for the application but is necessary for the library // which is opaque for the application but is necessary for the library
// to make these functions reentrant (i.e. allow more than one // to make these functions reentrant (i.e. allow more than one

View File

@ -180,7 +180,7 @@ class WXDLLEXPORT wxSystemSettings : public wxSystemSettingsNative
public: public:
#ifdef __WXUNIVERSAL__ #ifdef __WXUNIVERSAL__
// in wxUniversal we want to use the theme standard colours instead of the // 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 // wxSystemSettingsNative
static wxColour GetColour(wxSystemColour index); static wxColour GetColour(wxSystemColour index);
#endif // __WXUNIVERSAL__ #endif // __WXUNIVERSAL__
@ -195,15 +195,13 @@ public:
// Value // Value
static wxSystemScreenType ms_screen; static wxSystemScreenType ms_screen;
#if WXWIN_COMPATIBILITY_2_4
// the backwards compatible versions of wxSystemSettingsNative functions, // the backwards compatible versions of wxSystemSettingsNative functions,
// don't use these methods in the new code! // don't use these methods in the new code!
static wxColour GetSystemColour(int index) wxDEPRECATED(static wxColour GetSystemColour(int index));
{ return GetColour((wxSystemColour)index); } wxDEPRECATED(static wxFont GetSystemFont(int index));
static wxFont GetSystemFont(int index) wxDEPRECATED(static int GetSystemMetric(int index));
{ return GetFont((wxSystemFont)index); } #endif
static int GetSystemMetric(int index)
{ return GetMetric((wxSystemMetric)index); }
}; };
#endif #endif

View File

@ -286,7 +286,7 @@ public:
#if WXWIN_COMPATIBILITY_2_2 #if WXWIN_COMPATIBILITY_2_2
// for compatibility only, don't use // for compatibility only, don't use
int GetCode() const { return m_evtKey.GetKeyCode(); } wxDEPRECATED( int GetCode() const);
#endif // WXWIN_COMPATIBILITY_2_2 #endif // WXWIN_COMPATIBILITY_2_2
private: private:

View File

@ -532,15 +532,15 @@ WXDLLIMPEXP_BASE bool wxYieldIfNeeded();
// Format a message on the standard error (UNIX) or the debugging // Format a message on the standard error (UNIX) or the debugging
// stream (Windows) // 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) // Non-fatal error (continues)
WXDLLIMPEXP_DATA_BASE(extern const wxChar*) wxInternalErrorStr; 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) // Fatal error (exits)
WXDLLIMPEXP_DATA_BASE(extern const wxChar*) wxFatalErrorStr; 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 #endif // WXWIN_COMPATIBILITY_2_2

View File

@ -6,7 +6,7 @@
// Created: 2002/12/15 // Created: 2002/12/15
// RCS-ID: $Id: // RCS-ID: $Id:
// Copyright: 2002 David Elliott // Copyright: 2002 David Elliott
// Licence: wxWidgets licence // Licence: wxWidgets licence
///////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////
#include "wx/wxprec.h" #include "wx/wxprec.h"
@ -43,7 +43,7 @@ WX_IMPLEMENT_COCOA_OWNER(wxDialog,NSPanel,NSWindow,NSWindow)
void wxDialog::Init() void wxDialog::Init()
{ {
m_isModal = false; m_isModal = false;
SetBackgroundColour(wxSystemSettings::GetSystemColour(wxSYS_COLOUR_3DFACE)); SetBackgroundColour(wxSystemSettings::GetColour(wxSYS_COLOUR_3DFACE));
} }
bool wxDialog::Create(wxWindow *parent, wxWindowID winid, bool wxDialog::Create(wxWindow *parent, wxWindowID winid,
@ -222,9 +222,9 @@ void wxDialog::OnOK(wxCommandEvent& event)
void wxDialog::OnApply(wxCommandEvent& event) void wxDialog::OnApply(wxCommandEvent& event)
{ {
if (Validate()) if (Validate())
TransferDataFromWindow(); TransferDataFromWindow();
// TODO probably need to disable the Apply button until things change again // TODO probably need to disable the Apply button until things change again
} }
void wxDialog::OnCancel(wxCommandEvent& event) void wxDialog::OnCancel(wxCommandEvent& event)

View File

@ -526,13 +526,13 @@ wxLibraries::wxLibraries():m_loaded(wxKEY_STRING)
wxLibraries::~wxLibraries() wxLibraries::~wxLibraries()
{ {
wxNode *node = m_loaded.First(); wxNode *node = m_loaded.GetFirst();
while (node) { while (node) {
wxLibrary *lib = (wxLibrary *)node->Data(); wxLibrary *lib = (wxLibrary *)node->GetData();
delete lib; 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()); wxNode *node = m_loaded.Find(name.GetData());
if (node != NULL) if (node != NULL)
return ((wxLibrary *)node->Data()); return ((wxLibrary *)node->GetData());
// If DLL shares data, this is necessary. // If DLL shares data, this is necessary.
old_sm_first = wxClassInfo::sm_first; old_sm_first = wxClassInfo::sm_first;
@ -567,15 +567,15 @@ wxLibrary *wxLibraries::LoadLibrary(const wxString& name)
wxObject *wxLibraries::CreateObject(const wxString& path) wxObject *wxLibraries::CreateObject(const wxString& path)
{ {
wxNode *node = m_loaded.First(); wxNode *node = m_loaded.GetFirst();
wxObject *obj; wxObject *obj;
while (node) { while (node) {
obj = ((wxLibrary *)node->Data())->CreateObject(path); obj = ((wxLibrary *)node->GetData())->CreateObject(path);
if (obj) if (obj)
return obj; return obj;
node = node->Next(); node = node->GetNext();
} }
return NULL; return NULL;
} }

View File

@ -72,3 +72,21 @@ void wxSystemSettings::SetScreenType( wxSystemScreenType screen )
ms_screen = 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

View File

@ -90,5 +90,14 @@ wxTreeEvent::wxTreeEvent(const wxTreeEvent & event)
m_editCancelled = event.m_editCancelled; 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 #endif // wxUSE_TREECTRL

View File

@ -1597,18 +1597,18 @@ void wxGridCellRenderer::Draw(wxGrid& grid,
// grey out fields if the grid is disabled // grey out fields if the grid is disabled
if( grid.IsEnabled() ) if( grid.IsEnabled() )
{ {
if ( isSelected ) if ( isSelected )
{ {
dc.SetBrush( wxBrush(grid.GetSelectionBackground(), wxSOLID) ); dc.SetBrush( wxBrush(grid.GetSelectionBackground(), wxSOLID) );
} }
else else
{ {
dc.SetBrush( wxBrush(attr.GetBackgroundColour(), wxSOLID) ); dc.SetBrush( wxBrush(attr.GetBackgroundColour(), wxSOLID) );
} }
} }
else else
{ {
dc.SetBrush(wxBrush(wxSystemSettings::GetSystemColour(wxSYS_COLOUR_BTNFACE), wxSOLID)); dc.SetBrush(wxBrush(wxSystemSettings::GetColour(wxSYS_COLOUR_BTNFACE), wxSOLID));
} }
dc.SetPen( *wxTRANSPARENT_PEN ); dc.SetPen( *wxTRANSPARENT_PEN );
@ -1644,8 +1644,8 @@ void wxGridCellStringRenderer::SetTextColoursAndFont(wxGrid& grid,
} }
else else
{ {
dc.SetTextBackground(wxSystemSettings::GetSystemColour(wxSYS_COLOUR_BTNFACE)); dc.SetTextBackground(wxSystemSettings::GetColour(wxSYS_COLOUR_BTNFACE));
dc.SetTextForeground(wxSystemSettings::GetSystemColour(wxSYS_COLOUR_GRAYTEXT)); dc.SetTextForeground(wxSystemSettings::GetColour(wxSYS_COLOUR_GRAYTEXT));
} }
dc.SetFont( attr.GetFont() ); dc.SetFont( attr.GetFont() );
@ -1932,7 +1932,7 @@ void wxGridCellFloatRenderer::SetParameters(const wxString& params)
else else
{ {
wxString tmp = params.BeforeFirst(_T(',')); wxString tmp = params.BeforeFirst(_T(','));
if ( !!tmp ) if ( !tmp.empty() )
{ {
long width; long width;
if ( tmp.ToLong(&width) ) if ( tmp.ToLong(&width) )
@ -1946,7 +1946,7 @@ void wxGridCellFloatRenderer::SetParameters(const wxString& params)
} }
tmp = params.AfterFirst(_T(',')); tmp = params.AfterFirst(_T(','));
if ( !!tmp ) if ( !tmp.empty() )
{ {
long precision; long precision;
if ( tmp.ToLong(&precision) ) if ( tmp.ToLong(&precision) )

View File

@ -56,7 +56,7 @@ wxListBoxItem::wxListBoxItem(
const wxString& rsStr const wxString& rsStr
) )
: wxOwnerDrawn( rsStr : wxOwnerDrawn( rsStr
,FALSE ,false
) )
{ {
// //
@ -128,7 +128,7 @@ bool wxListBox::Create(
wxSystemSettings vSettings; wxSystemSettings vSettings;
SetBackgroundColour(vSettings.GetSystemColour(wxSYS_COLOUR_WINDOW)); SetBackgroundColour(vSettings.GetColour(wxSYS_COLOUR_WINDOW));
SetForegroundColour(pParent->GetForegroundColour()); SetForegroundColour(pParent->GetForegroundColour());
m_windowId = (vId == -1) ? (int)NewControlId() : vId; m_windowId = (vId == -1) ? (int)NewControlId() : vId;
@ -172,7 +172,7 @@ bool wxListBox::Create(
); );
if (m_hWnd == 0) if (m_hWnd == 0)
{ {
return FALSE; return false;
} }
// //
@ -221,7 +221,7 @@ bool wxListBox::Create(
,nHeight ,nHeight
); );
delete pTextFont; delete pTextFont;
return TRUE; return true;
} // end of wxListBox::Create } // end of wxListBox::Create
wxListBox::~wxListBox() wxListBox::~wxListBox()
@ -435,7 +435,7 @@ bool wxListBox::IsSelected(
int N int N
) const ) const
{ {
wxCHECK_MSG( N >= 0 && N < m_nNumItems, FALSE, wxCHECK_MSG( N >= 0 && N < m_nNumItems, false,
wxT("invalid index in wxListBox::Selected") ); wxT("invalid index in wxListBox::Selected") );
LONG lItem; LONG lItem;
@ -785,7 +785,7 @@ bool wxListBox::OS2Command(
// //
// Some event we're not interested in // Some event we're not interested in
// //
return FALSE; return false;
} }
wxCommandEvent vEvent( eEvtType wxCommandEvent vEvent( eEvtType
,m_windowId ,m_windowId
@ -873,14 +873,14 @@ bool wxListBox::OS2OnDraw (
// //
// Only owner-drawn control should receive this message // 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 // The item may be -1 for an empty listbox
// //
if (lItemID == -1L) if (lItemID == -1L)
return FALSE; return false;
wxListBoxItem* pData = (wxListBoxItem*)PVOIDFROMMR( ::WinSendMsg( GetHwnd() wxListBoxItem* pData = (wxListBoxItem*)PVOIDFROMMR( ::WinSendMsg( GetHwnd()
,LM_QUERYITEMHANDLE ,LM_QUERYITEMHANDLE
@ -889,7 +889,7 @@ bool wxListBox::OS2OnDraw (
) )
); );
wxCHECK(pData, FALSE ); wxCHECK(pData, false );
wxDC vDc; wxDC vDc;
wxRect vRect( wxPoint( pDrawStruct->rclItem.xLeft wxRect vRect( wxPoint( pDrawStruct->rclItem.xLeft
@ -962,7 +962,7 @@ bool wxListBox::OS2OnDraw (
// For now we don't care about anything else // For now we don't care about anything else
// just ignore the entire message! // just ignore the entire message!
// //
return TRUE; return true;
} }
} }
return pData->OnDrawItem( vDc return pData->OnDrawItem( vDc

View File

@ -103,7 +103,7 @@ bool wxXmlResource::Load(const wxString& filemask)
fnd = wxXmlFindFirst; fnd = wxXmlFindFirst;
else else
fnd = filemask; fnd = filemask;
while (!!fnd) while (!fnd.empty())
{ {
// NB: Load() accepts both filenames and URLs (should probably be // NB: Load() accepts both filenames and URLs (should probably be
// changed to filenames only, but embedded resources currently // changed to filenames only, but embedded resources currently