From fd304d989b2c5c35ac1a849d508cb21f4d54609e Mon Sep 17 00:00:00 2001 From: Mattia Barbon Date: Sat, 18 Jan 2003 13:01:17 +0000 Subject: [PATCH] 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 --- include/wx/motif/choice.h | 2 +- include/wx/motif/clipbrd.h | 5 ++++- src/motif/app.cpp | 15 +++++++++------ src/motif/button.cpp | 8 +++++--- src/motif/choice.cpp | 12 ++++++------ src/motif/clipbrd.cpp | 9 ++++++--- src/motif/combobox.cpp | 8 ++++---- src/motif/cursor.cpp | 27 +++++++++++++++------------ src/motif/font.cpp | 12 ++++++------ src/motif/frame.cpp | 5 +++-- src/motif/utils.cpp | 6 ++++-- 11 files changed, 63 insertions(+), 46 deletions(-) diff --git a/include/wx/motif/choice.h b/include/wx/motif/choice.h index 070f5191e9..a2d0195418 100644 --- a/include/wx/motif/choice.h +++ b/include/wx/motif/choice.h @@ -94,7 +94,7 @@ protected: // common part of all contructors void Init(); - int m_noStrings; + size_t m_noStrings; WXWidget m_menuWidget; WXWidget m_buttonWidget; wxWidgetArray m_widgetArray; diff --git a/include/wx/motif/clipbrd.h b/include/wx/motif/clipbrd.h index 848bfe6565..6b17de1e9f 100644 --- a/include/wx/motif/clipbrd.h +++ b/include/wx/motif/clipbrd.h @@ -18,7 +18,10 @@ #if wxUSE_CLIPBOARD +class wxDataObject; + #include "wx/list.h" +WX_DECLARE_LIST(wxDataObject, wxDataObjectList); bool WXDLLEXPORT wxOpenClipboard(); bool WXDLLEXPORT wxClipboardOpen(); @@ -71,7 +74,7 @@ public: // implementation from now on bool m_open; - wxList m_data; + wxDataObjectList m_data; bool m_usePrimary; private: diff --git a/src/motif/app.cpp b/src/motif/app.cpp index 34fdebf680..3cfc2853e2 100644 --- a/src/motif/app.cpp +++ b/src/motif/app.cpp @@ -525,24 +525,24 @@ bool wxApp::SendIdleEvents(wxWindow* win) if (event.MoreRequested()) needMore = TRUE; - wxNode* node = win->GetChildren().First(); + wxWindowList::Node* node = win->GetChildren().GetFirst(); while (node) { - wxWindow* win = (wxWindow*) node->Data(); + wxWindow* win = node->GetData(); if (SendIdleEvents(win)) needMore = TRUE; - node = node->Next(); + node = node->GetNext(); } return needMore ; } void wxApp::DeletePendingObjects() { - wxNode *node = wxPendingDelete.First(); + wxNode *node = wxPendingDelete.GetFirst(); while (node) { - wxObject *obj = (wxObject *)node->Data(); + wxObject *obj = node->GetData(); delete obj; @@ -551,7 +551,7 @@ void wxApp::DeletePendingObjects() // Deleting one object may have deleted other pending // 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 bool wxApp::OnInitGui() { + if( !wxAppBase::OnInitGui() ) + return FALSE; + XtToolkitInitialize() ; wxTheApp->m_appContext = (WXAppContext) XtCreateApplicationContext(); XtAppSetFallbackResources((XtAppContext) wxTheApp->m_appContext, fallbackResources); diff --git a/src/motif/button.cpp b/src/motif/button.cpp index 645f99cf44..de02890cb2 100644 --- a/src/motif/button.cpp +++ b/src/motif/button.cpp @@ -119,10 +119,12 @@ void wxButton::SetDefault() // Because it's very hard to find wxButton in the same row, // correction is straighforward: we set resource for all wxButton // 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 (); - if (item->IsKindOf(CLASSINFO(wxButton))) + wxWindow *win = node->GetData (); + wxButton *item = wxDynamicCast(win, wxButton); + if (item) { bool managed = XtIsManaged((Widget) item->GetMainWidget()); if (managed) diff --git a/src/motif/choice.cpp b/src/motif/choice.cpp index bfe6a69b47..a3e57838b9 100644 --- a/src/motif/choice.cpp +++ b/src/motif/choice.cpp @@ -222,7 +222,7 @@ void wxChoice::Delete(int n) void wxChoice::Clear() { m_stringList.Clear (); - int i; + size_t i; for (i = 0; i < m_noStrings; i++) { XtRemoveCallback((Widget) m_widgetArray[i], @@ -286,7 +286,7 @@ void wxChoice::SetSelection(int n) #if 0 Dimension selectionWidth, selectionHeight; #endif - wxXmString text( (char*)node->Data() ); + wxXmString text( node->GetData() ); // MBN: this seems silly, at best, and causes wxChoices to be clipped: // will remove "soon" #if 0 @@ -369,7 +369,7 @@ void wxChoice::DoSetSize(int x, int y, int width, int height, int sizeFlags) if (width > -1) { - int i; + size_t i; for (i = 0; i < m_noStrings; i++) XtVaSetValues ((Widget) m_widgetArray[i], XmNwidth, actualWidth, @@ -379,7 +379,7 @@ void wxChoice::DoSetSize(int x, int y, int width, int height, int sizeFlags) } if (height > -1) { - int i; + size_t i; for (i = 0; i < m_noStrings; i++) XtVaSetValues ((Widget) m_widgetArray[i], XmNheight, actualHeight, @@ -457,7 +457,7 @@ void wxChoice::ChangeBackgroundColour() DoChangeBackgroundColour(m_formWidget, m_backgroundColour); DoChangeBackgroundColour(m_buttonWidget, m_backgroundColour); DoChangeBackgroundColour(m_menuWidget, m_backgroundColour); - int i; + size_t i; for (i = 0; i < m_noStrings; i++) DoChangeBackgroundColour(m_widgetArray[i], m_backgroundColour); } @@ -467,7 +467,7 @@ void wxChoice::ChangeForegroundColour() DoChangeForegroundColour(m_formWidget, m_foregroundColour); DoChangeForegroundColour(m_buttonWidget, m_foregroundColour); DoChangeForegroundColour(m_menuWidget, m_foregroundColour); - int i; + size_t i; for (i = 0; i < m_noStrings; i++) DoChangeForegroundColour(m_widgetArray[i], m_foregroundColour); } diff --git a/src/motif/clipbrd.cpp b/src/motif/clipbrd.cpp index 0ee8acb958..9bd9307194 100644 --- a/src/motif/clipbrd.cpp +++ b/src/motif/clipbrd.cpp @@ -26,6 +26,9 @@ #include "wx/clipbrd.h" #include "wx/dataobj.h" +#include "wx/listimpl.cpp" +WX_DEFINE_LIST(wxDataObjectList); + #ifdef __VMS__ #pragma message disable nosimpint #endif @@ -253,12 +256,12 @@ wxClipboard::~wxClipboard() void wxClipboard::Clear() { - wxNode* node = m_data.First(); + wxDataObjectList::Node* node = m_data.GetFirst(); while (node) { - wxDataObject* data = (wxDataObject*) node->Data(); + wxDataObject* data = node->GetData(); delete data; - node = node->Next(); + node = node->GetNext(); } m_data.Clear(); } diff --git a/src/motif/combobox.cpp b/src/motif/combobox.cpp index 72d2836507..36e322073f 100644 --- a/src/motif/combobox.cpp +++ b/src/motif/combobox.cpp @@ -137,10 +137,10 @@ int wxComboBox::DoAppend(const wxString& item) void wxComboBox::Delete(int n) { XmComboBoxDeletePos((Widget) m_mainWidget, n+1); - wxNode *node = m_stringList.Nth(n); + wxStringList::Node *node = m_stringList.Item(n); if (node) { - delete[] (char *)node->Data(); + delete[] node->GetData(); delete node; } m_clientDataDict.Delete(n, HasClientObjectData()); @@ -173,9 +173,9 @@ int wxComboBox::GetSelection (void) const wxString wxComboBox::GetString(int n) const { - wxNode *node = m_stringList.Nth(n); + wxStringList::Node *node = m_stringList.Item(n); if (node) - return wxString((char *) node->Data ()); + return wxString(node->GetData ()); else return wxEmptyString; } diff --git a/src/motif/cursor.cpp b/src/motif/cursor.cpp index 9709ba21f8..7e7fa61066 100644 --- a/src/motif/cursor.cpp +++ b/src/motif/cursor.cpp @@ -44,14 +44,14 @@ wxCursorRefData::wxCursorRefData() wxCursorRefData::~wxCursorRefData() { - wxNode* node = m_cursors.First(); + wxList::Node* node = m_cursors.GetFirst(); while (node) { - wxXCursor* c = (wxXCursor*) node->Data(); + wxXCursor* c = (wxXCursor*) node->GetData(); // TODO: how to delete cursor? // XDestroyCursor((Display*) c->m_display, (Cursor) c->m_cursor); // ?? delete c; - node = node->Next(); + node = node->GetNext(); } } @@ -402,13 +402,13 @@ WXCursor wxCursor::GetXCursor(WXDisplay* display) { if (!M_CURSORDATA) return (WXCursor) 0; - wxNode* node = M_CURSORDATA->m_cursors.First(); + wxList::Node* node = M_CURSORDATA->m_cursors.GetFirst(); while (node) { - wxXCursor* c = (wxXCursor*) node->Data(); + wxXCursor* c = (wxXCursor*) node->GetData(); if (c->m_display == display) 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. @@ -657,9 +657,10 @@ wxXSetBusyCursor (wxWindow * win, wxCursor * cursor) 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); } } @@ -670,9 +671,10 @@ void wxBeginBusyCursor(wxCursor *cursor) wxBusyCursorCount++; 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); } } @@ -687,9 +689,10 @@ void wxEndBusyCursor() wxBusyCursorCount--; 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); } } diff --git a/src/motif/font.cpp b/src/motif/font.cpp index e63de3bf42..c6e1b6dd2c 100644 --- a/src/motif/font.cpp +++ b/src/motif/font.cpp @@ -177,12 +177,12 @@ void wxFontRefData::Init(int pointSize, wxFontRefData::~wxFontRefData() { - wxNode* node = m_fonts.First(); + wxList::Node* node = m_fonts.GetFirst(); while (node) { - wxXFont* f = (wxXFont*) node->Data(); + wxXFont* f = (wxXFont*) node->GetData(); delete f; - node = node->Next(); + node = node->GetNext(); } m_fonts.Clear(); } @@ -500,13 +500,13 @@ wxXFont* wxFont::GetInternalFont(double scale, WXDisplay* display) const int pointSize = (M_FONTDATA->m_pointSize * 10 * intScale) / 100; // search existing fonts first - wxNode* node = M_FONTDATA->m_fonts.First(); + wxList::Node* node = M_FONTDATA->m_fonts.GetFirst(); while (node) { - wxXFont* f = (wxXFont*) node->Data(); + wxXFont* f = (wxXFont*) node->GetData(); if ((!display || (f->m_display == display)) && (f->m_scale == intScale)) return f; - node = node->Next(); + node = node->GetNext(); } // not found, create a new one diff --git a/src/motif/frame.cpp b/src/motif/frame.cpp index 3e3b6605d9..becd7bf078 100644 --- a/src/motif/frame.cpp +++ b/src/motif/frame.cpp @@ -591,10 +591,11 @@ void wxFrame::OnActivate(wxActivateEvent& event) if (!event.GetActive()) 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. - wxWindow *child = (wxWindow *)node->Data(); + wxWindow *child = node->GetData(); if (!child->IsTopLevel()) { child->SetFocus(); diff --git a/src/motif/utils.cpp b/src/motif/utils.cpp index 179a3a43d6..36df02e7fc 100644 --- a/src/motif/utils.cpp +++ b/src/motif/utils.cpp @@ -81,7 +81,9 @@ #define DEFAULT_XRESOURCE_DIR "/usr/lib/X11/app-defaults" #endif +#if wxUSE_RESOURCES static char *GetIniFile (char *dest, const char *filename); +#endif // ============================================================================ // implementation @@ -226,6 +228,8 @@ int wxGetOsVersion(int *majorVsn, int *minorVsn) // Reading and writing resources (eg WIN.INI, .Xdefaults) // ---------------------------------------------------------------------------- +#if wxUSE_RESOURCES + // Read $HOME for what it says is home, if not // read $USER or $LOGNAME for user name else determine // the Real User, then determine the Real home dir. @@ -256,8 +260,6 @@ static char * GetIniFile (char *dest, const char *filename) return dest; } -#if wxUSE_RESOURCES - static char *GetResourcePath(char *buf, const char *name, bool create = FALSE) { if (create && wxFileExists (name) ) { -- 2.45.2