Fix some wxMotif build warnings about deprecated methods.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@18811 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Mattia Barbon
2003-01-18 13:01:17 +00:00
parent 52c71b808f
commit fd304d989b
11 changed files with 63 additions and 46 deletions

View File

@@ -94,7 +94,7 @@ protected:
// common part of all contructors // common part of all contructors
void Init(); void Init();
int m_noStrings; size_t m_noStrings;
WXWidget m_menuWidget; WXWidget m_menuWidget;
WXWidget m_buttonWidget; WXWidget m_buttonWidget;
wxWidgetArray m_widgetArray; wxWidgetArray m_widgetArray;

View File

@@ -18,7 +18,10 @@
#if wxUSE_CLIPBOARD #if wxUSE_CLIPBOARD
class wxDataObject;
#include "wx/list.h" #include "wx/list.h"
WX_DECLARE_LIST(wxDataObject, wxDataObjectList);
bool WXDLLEXPORT wxOpenClipboard(); bool WXDLLEXPORT wxOpenClipboard();
bool WXDLLEXPORT wxClipboardOpen(); bool WXDLLEXPORT wxClipboardOpen();
@@ -71,7 +74,7 @@ public:
// implementation from now on // implementation from now on
bool m_open; bool m_open;
wxList m_data; wxDataObjectList m_data;
bool m_usePrimary; bool m_usePrimary;
private: private:

View File

@@ -525,24 +525,24 @@ bool wxApp::SendIdleEvents(wxWindow* win)
if (event.MoreRequested()) if (event.MoreRequested())
needMore = TRUE; needMore = TRUE;
wxNode* node = win->GetChildren().First(); wxWindowList::Node* node = win->GetChildren().GetFirst();
while (node) while (node)
{ {
wxWindow* win = (wxWindow*) node->Data(); wxWindow* win = node->GetData();
if (SendIdleEvents(win)) if (SendIdleEvents(win))
needMore = TRUE; needMore = TRUE;
node = node->Next(); node = node->GetNext();
} }
return needMore ; return needMore ;
} }
void wxApp::DeletePendingObjects() void wxApp::DeletePendingObjects()
{ {
wxNode *node = wxPendingDelete.First(); wxNode *node = wxPendingDelete.GetFirst();
while (node) while (node)
{ {
wxObject *obj = (wxObject *)node->Data(); wxObject *obj = node->GetData();
delete obj; delete obj;
@@ -551,7 +551,7 @@ void wxApp::DeletePendingObjects()
// Deleting one object may have deleted other pending // Deleting one object may have deleted other pending
// objects, so start from beginning of list again. // objects, so start from beginning of list again.
node = wxPendingDelete.First(); node = wxPendingDelete.GetFirst();
} }
} }
@@ -566,6 +566,9 @@ static char *fallbackResources[] = {
// Create an application context // Create an application context
bool wxApp::OnInitGui() bool wxApp::OnInitGui()
{ {
if( !wxAppBase::OnInitGui() )
return FALSE;
XtToolkitInitialize() ; XtToolkitInitialize() ;
wxTheApp->m_appContext = (WXAppContext) XtCreateApplicationContext(); wxTheApp->m_appContext = (WXAppContext) XtCreateApplicationContext();
XtAppSetFallbackResources((XtAppContext) wxTheApp->m_appContext, fallbackResources); XtAppSetFallbackResources((XtAppContext) wxTheApp->m_appContext, fallbackResources);

View File

@@ -119,10 +119,12 @@ void wxButton::SetDefault()
// Because it's very hard to find wxButton in the same row, // Because it's very hard to find wxButton in the same row,
// correction is straighforward: we set resource for all wxButton // correction is straighforward: we set resource for all wxButton
// in this parent (but not sub panels) // in this parent (but not sub panels)
for (wxNode * node = parent->GetChildren().First (); node; node = node->Next ()) for (wxWindowList::Node * node = parent->GetChildren().GetFirst ();
node; node = node->GetNext ())
{ {
wxButton *item = (wxButton *) node->Data (); wxWindow *win = node->GetData ();
if (item->IsKindOf(CLASSINFO(wxButton))) wxButton *item = wxDynamicCast(win, wxButton);
if (item)
{ {
bool managed = XtIsManaged((Widget) item->GetMainWidget()); bool managed = XtIsManaged((Widget) item->GetMainWidget());
if (managed) if (managed)

View File

@@ -222,7 +222,7 @@ void wxChoice::Delete(int n)
void wxChoice::Clear() void wxChoice::Clear()
{ {
m_stringList.Clear (); m_stringList.Clear ();
int i; size_t i;
for (i = 0; i < m_noStrings; i++) for (i = 0; i < m_noStrings; i++)
{ {
XtRemoveCallback((Widget) m_widgetArray[i], XtRemoveCallback((Widget) m_widgetArray[i],
@@ -286,7 +286,7 @@ void wxChoice::SetSelection(int n)
#if 0 #if 0
Dimension selectionWidth, selectionHeight; Dimension selectionWidth, selectionHeight;
#endif #endif
wxXmString text( (char*)node->Data() ); wxXmString text( node->GetData() );
// MBN: this seems silly, at best, and causes wxChoices to be clipped: // MBN: this seems silly, at best, and causes wxChoices to be clipped:
// will remove "soon" // will remove "soon"
#if 0 #if 0
@@ -369,7 +369,7 @@ void wxChoice::DoSetSize(int x, int y, int width, int height, int sizeFlags)
if (width > -1) if (width > -1)
{ {
int i; size_t i;
for (i = 0; i < m_noStrings; i++) for (i = 0; i < m_noStrings; i++)
XtVaSetValues ((Widget) m_widgetArray[i], XtVaSetValues ((Widget) m_widgetArray[i],
XmNwidth, actualWidth, XmNwidth, actualWidth,
@@ -379,7 +379,7 @@ void wxChoice::DoSetSize(int x, int y, int width, int height, int sizeFlags)
} }
if (height > -1) if (height > -1)
{ {
int i; size_t i;
for (i = 0; i < m_noStrings; i++) for (i = 0; i < m_noStrings; i++)
XtVaSetValues ((Widget) m_widgetArray[i], XtVaSetValues ((Widget) m_widgetArray[i],
XmNheight, actualHeight, XmNheight, actualHeight,
@@ -457,7 +457,7 @@ void wxChoice::ChangeBackgroundColour()
DoChangeBackgroundColour(m_formWidget, m_backgroundColour); DoChangeBackgroundColour(m_formWidget, m_backgroundColour);
DoChangeBackgroundColour(m_buttonWidget, m_backgroundColour); DoChangeBackgroundColour(m_buttonWidget, m_backgroundColour);
DoChangeBackgroundColour(m_menuWidget, m_backgroundColour); DoChangeBackgroundColour(m_menuWidget, m_backgroundColour);
int i; size_t i;
for (i = 0; i < m_noStrings; i++) for (i = 0; i < m_noStrings; i++)
DoChangeBackgroundColour(m_widgetArray[i], m_backgroundColour); DoChangeBackgroundColour(m_widgetArray[i], m_backgroundColour);
} }
@@ -467,7 +467,7 @@ void wxChoice::ChangeForegroundColour()
DoChangeForegroundColour(m_formWidget, m_foregroundColour); DoChangeForegroundColour(m_formWidget, m_foregroundColour);
DoChangeForegroundColour(m_buttonWidget, m_foregroundColour); DoChangeForegroundColour(m_buttonWidget, m_foregroundColour);
DoChangeForegroundColour(m_menuWidget, m_foregroundColour); DoChangeForegroundColour(m_menuWidget, m_foregroundColour);
int i; size_t i;
for (i = 0; i < m_noStrings; i++) for (i = 0; i < m_noStrings; i++)
DoChangeForegroundColour(m_widgetArray[i], m_foregroundColour); DoChangeForegroundColour(m_widgetArray[i], m_foregroundColour);
} }

View File

@@ -26,6 +26,9 @@
#include "wx/clipbrd.h" #include "wx/clipbrd.h"
#include "wx/dataobj.h" #include "wx/dataobj.h"
#include "wx/listimpl.cpp"
WX_DEFINE_LIST(wxDataObjectList);
#ifdef __VMS__ #ifdef __VMS__
#pragma message disable nosimpint #pragma message disable nosimpint
#endif #endif
@@ -253,12 +256,12 @@ wxClipboard::~wxClipboard()
void wxClipboard::Clear() void wxClipboard::Clear()
{ {
wxNode* node = m_data.First(); wxDataObjectList::Node* node = m_data.GetFirst();
while (node) while (node)
{ {
wxDataObject* data = (wxDataObject*) node->Data(); wxDataObject* data = node->GetData();
delete data; delete data;
node = node->Next(); node = node->GetNext();
} }
m_data.Clear(); m_data.Clear();
} }

View File

@@ -137,10 +137,10 @@ int wxComboBox::DoAppend(const wxString& item)
void wxComboBox::Delete(int n) void wxComboBox::Delete(int n)
{ {
XmComboBoxDeletePos((Widget) m_mainWidget, n+1); XmComboBoxDeletePos((Widget) m_mainWidget, n+1);
wxNode *node = m_stringList.Nth(n); wxStringList::Node *node = m_stringList.Item(n);
if (node) if (node)
{ {
delete[] (char *)node->Data(); delete[] node->GetData();
delete node; delete node;
} }
m_clientDataDict.Delete(n, HasClientObjectData()); m_clientDataDict.Delete(n, HasClientObjectData());
@@ -173,9 +173,9 @@ int wxComboBox::GetSelection (void) const
wxString wxComboBox::GetString(int n) const wxString wxComboBox::GetString(int n) const
{ {
wxNode *node = m_stringList.Nth(n); wxStringList::Node *node = m_stringList.Item(n);
if (node) if (node)
return wxString((char *) node->Data ()); return wxString(node->GetData ());
else else
return wxEmptyString; return wxEmptyString;
} }

View File

@@ -44,14 +44,14 @@ wxCursorRefData::wxCursorRefData()
wxCursorRefData::~wxCursorRefData() wxCursorRefData::~wxCursorRefData()
{ {
wxNode* node = m_cursors.First(); wxList::Node* node = m_cursors.GetFirst();
while (node) while (node)
{ {
wxXCursor* c = (wxXCursor*) node->Data(); wxXCursor* c = (wxXCursor*) node->GetData();
// TODO: how to delete cursor? // TODO: how to delete cursor?
// XDestroyCursor((Display*) c->m_display, (Cursor) c->m_cursor); // ?? // XDestroyCursor((Display*) c->m_display, (Cursor) c->m_cursor); // ??
delete c; delete c;
node = node->Next(); node = node->GetNext();
} }
} }
@@ -402,13 +402,13 @@ WXCursor wxCursor::GetXCursor(WXDisplay* display)
{ {
if (!M_CURSORDATA) if (!M_CURSORDATA)
return (WXCursor) 0; return (WXCursor) 0;
wxNode* node = M_CURSORDATA->m_cursors.First(); wxList::Node* node = M_CURSORDATA->m_cursors.GetFirst();
while (node) while (node)
{ {
wxXCursor* c = (wxXCursor*) node->Data(); wxXCursor* c = (wxXCursor*) node->GetData();
if (c->m_display == display) if (c->m_display == display)
return c->m_cursor; return c->m_cursor;
node = node->Next(); node = node->GetNext();
} }
// No cursor for this display, so let's see if we're an id-type cursor. // No cursor for this display, so let's see if we're an id-type cursor.
@@ -657,9 +657,10 @@ wxXSetBusyCursor (wxWindow * win, wxCursor * cursor)
XFlush (display); XFlush (display);
for(wxNode *node = win->GetChildren().First (); node; node = node->Next()) for(wxWindowList::Node *node = win->GetChildren().GetFirst (); node;
node = node->GetNext())
{ {
wxWindow *child = (wxWindow *) node->Data (); wxWindow *child = node->GetData ();
wxXSetBusyCursor (child, cursor); wxXSetBusyCursor (child, cursor);
} }
} }
@@ -670,9 +671,10 @@ void wxBeginBusyCursor(wxCursor *cursor)
wxBusyCursorCount++; wxBusyCursorCount++;
if (wxBusyCursorCount == 1) if (wxBusyCursorCount == 1)
{ {
for(wxNode *node = wxTopLevelWindows.First (); node; node = node->Next()) for(wxWindowList::Node *node = wxTopLevelWindows.GetFirst (); node;
node = node->GetNext())
{ {
wxWindow *win = (wxWindow *) node->Data (); wxWindow *win = node->GetData ();
wxXSetBusyCursor (win, cursor); wxXSetBusyCursor (win, cursor);
} }
} }
@@ -687,9 +689,10 @@ void wxEndBusyCursor()
wxBusyCursorCount--; wxBusyCursorCount--;
if (wxBusyCursorCount == 0) if (wxBusyCursorCount == 0)
{ {
for(wxNode *node = wxTopLevelWindows.First (); node; node = node->Next()) for(wxWindowList::Node *node = wxTopLevelWindows.GetFirst (); node;
node = node->GetNext())
{ {
wxWindow *win = (wxWindow *) node->Data (); wxWindow *win = node->GetData ();
wxXSetBusyCursor (win, NULL); wxXSetBusyCursor (win, NULL);
} }
} }

View File

@@ -177,12 +177,12 @@ void wxFontRefData::Init(int pointSize,
wxFontRefData::~wxFontRefData() wxFontRefData::~wxFontRefData()
{ {
wxNode* node = m_fonts.First(); wxList::Node* node = m_fonts.GetFirst();
while (node) while (node)
{ {
wxXFont* f = (wxXFont*) node->Data(); wxXFont* f = (wxXFont*) node->GetData();
delete f; delete f;
node = node->Next(); node = node->GetNext();
} }
m_fonts.Clear(); m_fonts.Clear();
} }
@@ -500,13 +500,13 @@ wxXFont* wxFont::GetInternalFont(double scale, WXDisplay* display) const
int pointSize = (M_FONTDATA->m_pointSize * 10 * intScale) / 100; int pointSize = (M_FONTDATA->m_pointSize * 10 * intScale) / 100;
// search existing fonts first // search existing fonts first
wxNode* node = M_FONTDATA->m_fonts.First(); wxList::Node* node = M_FONTDATA->m_fonts.GetFirst();
while (node) while (node)
{ {
wxXFont* f = (wxXFont*) node->Data(); wxXFont* f = (wxXFont*) node->GetData();
if ((!display || (f->m_display == display)) && (f->m_scale == intScale)) if ((!display || (f->m_display == display)) && (f->m_scale == intScale))
return f; return f;
node = node->Next(); node = node->GetNext();
} }
// not found, create a new one // not found, create a new one

View File

@@ -591,10 +591,11 @@ void wxFrame::OnActivate(wxActivateEvent& event)
if (!event.GetActive()) if (!event.GetActive())
return; return;
for(wxNode *node = GetChildren().First(); node; node = node->Next()) for(wxWindowList::Node *node = GetChildren().GetFirst(); node;
node = node->GetNext())
{ {
// Find a child that's a subwindow, but not a dialog box. // Find a child that's a subwindow, but not a dialog box.
wxWindow *child = (wxWindow *)node->Data(); wxWindow *child = node->GetData();
if (!child->IsTopLevel()) if (!child->IsTopLevel())
{ {
child->SetFocus(); child->SetFocus();

View File

@@ -81,7 +81,9 @@
#define DEFAULT_XRESOURCE_DIR "/usr/lib/X11/app-defaults" #define DEFAULT_XRESOURCE_DIR "/usr/lib/X11/app-defaults"
#endif #endif
#if wxUSE_RESOURCES
static char *GetIniFile (char *dest, const char *filename); static char *GetIniFile (char *dest, const char *filename);
#endif
// ============================================================================ // ============================================================================
// implementation // implementation
@@ -226,6 +228,8 @@ int wxGetOsVersion(int *majorVsn, int *minorVsn)
// Reading and writing resources (eg WIN.INI, .Xdefaults) // Reading and writing resources (eg WIN.INI, .Xdefaults)
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
#if wxUSE_RESOURCES
// Read $HOME for what it says is home, if not // Read $HOME for what it says is home, if not
// read $USER or $LOGNAME for user name else determine // read $USER or $LOGNAME for user name else determine
// the Real User, then determine the Real home dir. // the Real User, then determine the Real home dir.
@@ -256,8 +260,6 @@ static char * GetIniFile (char *dest, const char *filename)
return dest; return dest;
} }
#if wxUSE_RESOURCES
static char *GetResourcePath(char *buf, const char *name, bool create = FALSE) static char *GetResourcePath(char *buf, const char *name, bool create = FALSE)
{ {
if (create && wxFileExists (name) ) { if (create && wxFileExists (name) ) {