removed warnings about using the deprecated functions and replaced untyped

wxLists with the type safe equivalents (patch 668204 from Dimitri)


git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@18925 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Vadim Zeitlin
2003-01-25 12:28:51 +00:00
parent 5e3841bf80
commit d162a7ee7d
9 changed files with 160 additions and 107 deletions

View File

@@ -1,6 +1,17 @@
#ifndef _WX_DDE_H_BASE_ #ifndef _WX_DDE_H_BASE_
#define _WX_DDE_H_BASE_ #define _WX_DDE_H_BASE_
#include "wx/list.h"
class wxDDEClient;
class wxDDEServer;
class wxDDEConnection;
WX_DECLARE_LIST(wxDDEClient, wxDDEClientList);
WX_DECLARE_LIST(wxDDEServer, wxDDEServerList);
WX_DECLARE_LIST(wxDDEConnection, wxDDEConnectionList);
#if defined(__WXMSW__) #if defined(__WXMSW__)
#include "wx/msw/dde.h" #include "wx/msw/dde.h"
#elif defined(__WXMOTIF__) #elif defined(__WXMOTIF__)

View File

@@ -100,12 +100,15 @@ class WXDLLEXPORT wxDDEServer: public wxServerBase
wxDDEConnection *FindConnection(WXHCONV conv); wxDDEConnection *FindConnection(WXHCONV conv);
bool DeleteConnection(WXHCONV conv); bool DeleteConnection(WXHCONV conv);
inline wxString& GetServiceName(void) const { return (wxString&) m_serviceName; } inline wxString& GetServiceName(void) const { return (wxString&) m_serviceName; }
inline wxList& GetConnections(void) const { return (wxList&) m_connections; } inline wxDDEConnectionList& GetConnections(void) const
{
return (wxDDEConnectionList&) m_connections;
}
protected: protected:
int m_lastError; int m_lastError;
wxString m_serviceName; wxString m_serviceName;
wxList m_connections; wxDDEConnectionList m_connections;
}; };
class WXDLLEXPORT wxDDEClient: public wxClientBase class WXDLLEXPORT wxDDEClient: public wxClientBase
@@ -126,11 +129,15 @@ class WXDLLEXPORT wxDDEClient: public wxClientBase
// Find/delete wxDDEConnection corresponding to the HCONV // Find/delete wxDDEConnection corresponding to the HCONV
wxDDEConnection *FindConnection(WXHCONV conv); wxDDEConnection *FindConnection(WXHCONV conv);
bool DeleteConnection(WXHCONV conv); bool DeleteConnection(WXHCONV conv);
inline wxList& GetConnections(void) const { return (wxList&) m_connections; }
inline wxDDEConnectionList& GetConnections(void) const
{
return (wxDDEConnectionList&) m_connections;
}
protected: protected:
int m_lastError; int m_lastError;
wxList m_connections; wxDDEConnectionList m_connections;
}; };
void WXDLLEXPORT wxDDEInitialize(); void WXDLLEXPORT wxDDEInitialize();

View File

@@ -28,6 +28,8 @@ class WXDLLEXPORT wxGDIImageRefData;
class WXDLLEXPORT wxGDIImageHandler; class WXDLLEXPORT wxGDIImageHandler;
class WXDLLEXPORT wxGDIImage; class WXDLLEXPORT wxGDIImage;
WX_DECLARE_LIST(wxGDIImageHandler, wxGDIImageHandlerList);
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
// wxGDIImageRefData: common data fields for all derived classes // wxGDIImageRefData: common data fields for all derived classes
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
@@ -135,7 +137,7 @@ class WXDLLEXPORT wxGDIImage : public wxGDIObject
{ {
public: public:
// handlers list interface // handlers list interface
static wxList& GetHandlers() { return ms_handlers; } static wxGDIImageHandlerList& GetHandlers() { return ms_handlers; }
static void AddHandler(wxGDIImageHandler *handler); static void AddHandler(wxGDIImageHandler *handler);
static void InsertHandler(wxGDIImageHandler *handler); static void InsertHandler(wxGDIImageHandler *handler);
@@ -186,7 +188,7 @@ protected:
// create the data for the derived class here // create the data for the derived class here
virtual wxGDIImageRefData *CreateData() const = 0; virtual wxGDIImageRefData *CreateData() const = 0;
static wxList ms_handlers; static wxGDIImageHandlerList ms_handlers;
}; };
#endif // _WX_MSW_GDIIMAGE_H_ #endif // _WX_MSW_GDIIMAGE_H_

View File

@@ -17,9 +17,13 @@
#pragma interface "taskbar.h" #pragma interface "taskbar.h"
#endif #endif
#include <wx/event.h> #include "wx/event.h"
#include <wx/list.h> #include "wx/list.h"
#include <wx/icon.h> #include "wx/icon.h"
class wxTaskBarIcon;
WX_DECLARE_LIST(wxTaskBarIcon, wxTaskBarIconList);
class WXDLLEXPORT wxTaskBarIcon: public wxEvtHandler { class WXDLLEXPORT wxTaskBarIcon: public wxEvtHandler {
DECLARE_DYNAMIC_CLASS(wxTaskBarIcon) DECLARE_DYNAMIC_CLASS(wxTaskBarIcon)
@@ -58,7 +62,7 @@ public:
protected: protected:
WXHWND m_hWnd; WXHWND m_hWnd;
bool m_iconAdded; bool m_iconAdded;
static wxList sm_taskBarIcons; static wxTaskBarIconList sm_taskBarIcons;
static bool sm_registeredClass; static bool sm_registeredClass;
static unsigned int sm_taskbarMsg; static unsigned int sm_taskbarMsg;

View File

@@ -1140,14 +1140,11 @@ bool wxApp::SendIdleEvents()
// Send idle event to window and all subwindows // Send idle event to window and all subwindows
bool wxApp::SendIdleEvents(wxWindow* win) bool wxApp::SendIdleEvents(wxWindow* win)
{ {
bool needMore = FALSE;
wxIdleEvent event; wxIdleEvent event;
event.SetEventObject(win); event.SetEventObject(win);
win->GetEventHandler()->ProcessEvent(event); win->GetEventHandler()->ProcessEvent(event);
if (event.MoreRequested()) bool needMore = event.MoreRequested();
needMore = TRUE;
wxWindowList::Node *node = win->GetChildren().GetFirst(); wxWindowList::Node *node = win->GetChildren().GetFirst();
while ( node ) while ( node )
@@ -1158,6 +1155,7 @@ bool wxApp::SendIdleEvents(wxWindow* win)
node = node->GetNext(); node = node->GetNext();
} }
return needMore; return needMore;
} }

View File

@@ -124,10 +124,16 @@ static void DDELogError(const wxString& s, UINT error = DMLERR_NO_ERROR);
static DWORD DDEIdInst = 0L; static DWORD DDEIdInst = 0L;
static wxDDEConnection *DDECurrentlyConnecting = NULL; static wxDDEConnection *DDECurrentlyConnecting = NULL;
static wxList wxAtomTable(wxKEY_STRING); static wxList wxAtomTable(wxKEY_STRING);
static wxList wxDDEClientObjects;
static wxList wxDDEServerObjects; #include "wx/listimpl.cpp"
WX_DEFINE_LIST(wxDDEClientList);
WX_DEFINE_LIST(wxDDEServerList);
WX_DEFINE_LIST(wxDDEConnectionList);
static wxDDEClientList wxDDEClientObjects;
static wxDDEServerList wxDDEServerObjects;
static bool DDEInitialized = false; static bool DDEInitialized = false;
@@ -211,23 +217,26 @@ void wxDDECleanUp()
// Global find connection // Global find connection
static wxDDEConnection *DDEFindConnection(HCONV hConv) static wxDDEConnection *DDEFindConnection(HCONV hConv)
{ {
wxNode *node = wxDDEServerObjects.GetFirst(); wxDDEServerList::Node *serverNode = wxDDEServerObjects.GetFirst();
wxDDEConnection *found = NULL; wxDDEConnection *found = NULL;
while (node && !found) while (serverNode && !found)
{ {
wxDDEServer *object = (wxDDEServer *)node->GetData(); wxDDEServer *object = serverNode->GetData();
found = object->FindConnection((WXHCONV) hConv); found = object->FindConnection((WXHCONV) hConv);
node = node->GetNext(); serverNode = serverNode->GetNext();
} }
if (found)
return found;
node = wxDDEClientObjects.GetFirst(); if (found)
while (node && !found)
{ {
wxDDEClient *object = (wxDDEClient *)node->GetData(); return found;
}
wxDDEClientList::Node *clientNode = wxDDEClientObjects.GetFirst();
while (clientNode && !found)
{
wxDDEClient *object = clientNode->GetData();
found = object->FindConnection((WXHCONV) hConv); found = object->FindConnection((WXHCONV) hConv);
node = node->GetNext(); clientNode = clientNode->GetNext();
} }
return found; return found;
} }
@@ -235,39 +244,47 @@ static wxDDEConnection *DDEFindConnection(HCONV hConv)
// Global delete connection // Global delete connection
static void DDEDeleteConnection(HCONV hConv) static void DDEDeleteConnection(HCONV hConv)
{ {
wxNode *node = wxDDEServerObjects.GetFirst(); wxDDEServerList::Node *serverNode = wxDDEServerObjects.GetFirst();
bool found = false; bool found = false;
while (node && !found) while (serverNode && !found)
{ {
wxDDEServer *object = (wxDDEServer *)node->GetData(); wxDDEServer *object = serverNode->GetData();
found = object->DeleteConnection((WXHCONV) hConv); found = object->DeleteConnection((WXHCONV) hConv);
node = node->GetNext(); serverNode = serverNode->GetNext();
} }
if (found) if (found)
return;
node = wxDDEClientObjects.GetFirst();
while (node && !found)
{ {
wxDDEClient *object = (wxDDEClient *)node->GetData(); return;
}
wxDDEClientList::Node *clientNode = wxDDEClientObjects.GetFirst();
while (clientNode && !found)
{
wxDDEClient *object = clientNode->GetData();
found = object->DeleteConnection((WXHCONV) hConv); found = object->DeleteConnection((WXHCONV) hConv);
node = node->GetNext(); clientNode = clientNode->GetNext();
} }
} }
// Find a server from a service name // Find a server from a service name
static wxDDEServer *DDEFindServer(const wxString& s) static wxDDEServer *DDEFindServer(const wxString& s)
{ {
wxNode *node = wxDDEServerObjects.GetFirst(); wxDDEServerList::Node *node = wxDDEServerObjects.GetFirst();
wxDDEServer *found = NULL; wxDDEServer *found = NULL;
while (node && !found) while (node && !found)
{ {
wxDDEServer *object = (wxDDEServer *)node->GetData(); wxDDEServer *object = node->GetData();
if (object->GetServiceName() == s) if (object->GetServiceName() == s)
{
found = object; found = object;
else node = node->GetNext();
} }
else
{
node = node->GetNext();
}
}
return found; return found;
} }
@@ -311,11 +328,11 @@ wxDDEServer::~wxDDEServer()
wxDDEServerObjects.DeleteObject(this); wxDDEServerObjects.DeleteObject(this);
wxNode *node = m_connections.GetFirst(); wxDDEConnectionList::Node *node = m_connections.GetFirst();
while (node) while (node)
{ {
wxDDEConnection *connection = (wxDDEConnection *)node->GetData(); wxDDEConnection *connection = node->GetData();
wxNode *next = node->GetNext(); wxDDEConnectionList::Node *next = node->GetNext();
connection->SetConnected(false); connection->SetConnected(false);
connection->OnDisconnect(); // May delete the node implicitly connection->OnDisconnect(); // May delete the node implicitly
node = next; node = next;
@@ -325,8 +342,8 @@ wxDDEServer::~wxDDEServer()
node = m_connections.GetFirst(); node = m_connections.GetFirst();
while (node) while (node)
{ {
wxDDEConnection *connection = (wxDDEConnection *)node->GetData(); wxDDEConnection *connection = node->GetData();
wxNode *next = node->GetNext(); wxDDEConnectionList::Node *next = node->GetNext();
delete connection; delete connection;
node = next; node = next;
} }
@@ -339,11 +356,11 @@ wxConnectionBase *wxDDEServer::OnAcceptConnection(const wxString& /* topic */)
wxDDEConnection *wxDDEServer::FindConnection(WXHCONV conv) wxDDEConnection *wxDDEServer::FindConnection(WXHCONV conv)
{ {
wxNode *node = m_connections.GetFirst(); wxDDEConnectionList::Node *node = m_connections.GetFirst();
wxDDEConnection *found = NULL; wxDDEConnection *found = NULL;
while (node && !found) while (node && !found)
{ {
wxDDEConnection *connection = (wxDDEConnection *)node->GetData(); wxDDEConnection *connection = node->GetData();
if (connection->m_hConv == conv) if (connection->m_hConv == conv)
found = connection; found = connection;
else node = node->GetNext(); else node = node->GetNext();
@@ -354,17 +371,20 @@ wxDDEConnection *wxDDEServer::FindConnection(WXHCONV conv)
// Only delete the entry in the map, not the actual connection // Only delete the entry in the map, not the actual connection
bool wxDDEServer::DeleteConnection(WXHCONV conv) bool wxDDEServer::DeleteConnection(WXHCONV conv)
{ {
wxNode *node = m_connections.GetFirst(); wxDDEConnectionList::Node *node = m_connections.GetFirst();
bool found = false; bool found = false;
while (node && !found) while (node && !found)
{ {
wxDDEConnection *connection = (wxDDEConnection *)node->GetData(); wxDDEConnection *connection = node->GetData();
if (connection->m_hConv == conv) if (connection->m_hConv == conv)
{ {
found = true; found = true;
delete node; delete node;
} }
else node = node->GetNext(); else
{
node = node->GetNext();
}
} }
return found; return found;
} }
@@ -383,10 +403,10 @@ wxDDEClient::wxDDEClient()
wxDDEClient::~wxDDEClient() wxDDEClient::~wxDDEClient()
{ {
wxDDEClientObjects.DeleteObject(this); wxDDEClientObjects.DeleteObject(this);
wxNode *node = m_connections.GetFirst(); wxDDEConnectionList::Node *node = m_connections.GetFirst();
while (node) while (node)
{ {
wxDDEConnection *connection = (wxDDEConnection *)node->GetData(); wxDDEConnection *connection = node->GetData();
delete connection; // Deletes the node implicitly (see ~wxDDEConnection) delete connection; // Deletes the node implicitly (see ~wxDDEConnection)
node = m_connections.GetFirst(); node = m_connections.GetFirst();
} }
@@ -431,11 +451,11 @@ wxConnectionBase *wxDDEClient::OnMakeConnection()
wxDDEConnection *wxDDEClient::FindConnection(WXHCONV conv) wxDDEConnection *wxDDEClient::FindConnection(WXHCONV conv)
{ {
wxNode *node = m_connections.GetFirst(); wxDDEConnectionList::Node *node = m_connections.GetFirst();
wxDDEConnection *found = NULL; wxDDEConnection *found = NULL;
while (node && !found) while (node && !found)
{ {
wxDDEConnection *connection = (wxDDEConnection *)node->GetData(); wxDDEConnection *connection = node->GetData();
if (connection->m_hConv == conv) if (connection->m_hConv == conv)
found = connection; found = connection;
else node = node->GetNext(); else node = node->GetNext();
@@ -446,11 +466,11 @@ wxDDEConnection *wxDDEClient::FindConnection(WXHCONV conv)
// Only delete the entry in the map, not the actual connection // Only delete the entry in the map, not the actual connection
bool wxDDEClient::DeleteConnection(WXHCONV conv) bool wxDDEClient::DeleteConnection(WXHCONV conv)
{ {
wxNode *node = m_connections.GetFirst(); wxDDEConnectionList::Node *node = m_connections.GetFirst();
bool found = false; bool found = false;
while (node && !found) while (node && !found)
{ {
wxDDEConnection *connection = (wxDDEConnection *)node->GetData(); wxDDEConnection *connection = node->GetData();
if (connection->m_hConv == conv) if (connection->m_hConv == conv)
{ {
found = true; found = true;

View File

@@ -45,6 +45,10 @@
#include "wx/msw/gdiimage.h" #include "wx/msw/gdiimage.h"
#include "wx/bitmap.h" #include "wx/bitmap.h"
#include "wx/listimpl.cpp"
WX_DEFINE_LIST(wxGDIImageHandlerList);
#ifdef __WIN16__ #ifdef __WIN16__
# include "wx/msw/curico.h" # include "wx/msw/curico.h"
#endif // __WIN16__ #endif // __WIN16__
@@ -191,7 +195,7 @@ IMPLEMENT_DYNAMIC_CLASS(wxICOResourceHandler, wxObject)
// implementation // implementation
// ============================================================================ // ============================================================================
wxList wxGDIImage::ms_handlers; wxGDIImageHandlerList wxGDIImage::ms_handlers;
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
// wxGDIImage functions forwarded to wxGDIImageRefData // wxGDIImage functions forwarded to wxGDIImageRefData
@@ -241,10 +245,10 @@ bool wxGDIImage::RemoveHandler(const wxString& name)
wxGDIImageHandler *wxGDIImage::FindHandler(const wxString& name) wxGDIImageHandler *wxGDIImage::FindHandler(const wxString& name)
{ {
wxNode *node = ms_handlers.GetFirst(); wxGDIImageHandlerList::Node *node = ms_handlers.GetFirst();
while ( node ) while ( node )
{ {
wxGDIImageHandler *handler = (wxGDIImageHandler *)node->GetData(); wxGDIImageHandler *handler = node->GetData();
if ( handler->GetName() == name ) if ( handler->GetName() == name )
return handler; return handler;
node = node->GetNext(); node = node->GetNext();
@@ -256,10 +260,10 @@ wxGDIImageHandler *wxGDIImage::FindHandler(const wxString& name)
wxGDIImageHandler *wxGDIImage::FindHandler(const wxString& extension, wxGDIImageHandler *wxGDIImage::FindHandler(const wxString& extension,
long type) long type)
{ {
wxNode *node = ms_handlers.GetFirst(); wxGDIImageHandlerList::Node *node = ms_handlers.GetFirst();
while ( node ) while ( node )
{ {
wxGDIImageHandler *handler = (wxGDIImageHandler *)node->GetData(); wxGDIImageHandler *handler = node->GetData();
if ( (handler->GetExtension() = extension) && if ( (handler->GetExtension() = extension) &&
(type == -1 || handler->GetType() == type) ) (type == -1 || handler->GetType() == type) )
{ {
@@ -273,10 +277,10 @@ wxGDIImageHandler *wxGDIImage::FindHandler(const wxString& extension,
wxGDIImageHandler *wxGDIImage::FindHandler(long type) wxGDIImageHandler *wxGDIImage::FindHandler(long type)
{ {
wxNode *node = ms_handlers.GetFirst(); wxGDIImageHandlerList::Node *node = ms_handlers.GetFirst();
while ( node ) while ( node )
{ {
wxGDIImageHandler *handler = (wxGDIImageHandler *)node->GetData(); wxGDIImageHandler *handler = node->GetData();
if ( handler->GetType() == type ) if ( handler->GetType() == type )
return handler; return handler;
@@ -288,11 +292,11 @@ wxGDIImageHandler *wxGDIImage::FindHandler(long type)
void wxGDIImage::CleanUpHandlers() void wxGDIImage::CleanUpHandlers()
{ {
wxNode *node = ms_handlers.GetFirst(); wxGDIImageHandlerList::Node *node = ms_handlers.GetFirst();
while ( node ) while ( node )
{ {
wxGDIImageHandler *handler = (wxGDIImageHandler *)node->GetData(); wxGDIImageHandler *handler = node->GetData();
wxNode *next = node->GetNext(); wxGDIImageHandlerList::Node *next = node->GetNext();
delete handler; delete handler;
delete node; delete node;
node = next; node = next;

View File

@@ -1251,8 +1251,12 @@ void wxMDIClientWindow::DoSetSize(int x, int y, int width, int height, int sizeF
wxWindow *child = node->GetData(); wxWindow *child = node->GetData();
if (child->IsKindOf(CLASSINFO(wxMDIChildFrame))) if (child->IsKindOf(CLASSINFO(wxMDIChildFrame)))
{ {
HWND hWnd = (HWND) child->GetHWND(); ::RedrawWindow(GetHwndOf(child),
::RedrawWindow(hWnd, NULL, NULL, RDW_FRAME|RDW_ALLCHILDREN|RDW_INVALIDATE ); NULL,
NULL,
RDW_FRAME |
RDW_ALLCHILDREN |
RDW_INVALIDATE);
} }
node = node->GetNext(); node = node->GetNext();
} }

View File

@@ -49,13 +49,16 @@
#include <shellapi.h> #include <shellapi.h>
#endif #endif
#include "wx/listimpl.cpp"
WX_DEFINE_LIST(wxTaskBarIconList);
LRESULT APIENTRY _EXPORT wxTaskBarIconWindowProc( HWND hWnd, unsigned msg, LRESULT APIENTRY _EXPORT wxTaskBarIconWindowProc( HWND hWnd, unsigned msg,
UINT wParam, LONG lParam ); UINT wParam, LONG lParam );
wxChar *wxTaskBarWindowClass = (wxChar*) wxT("wxTaskBarWindowClass"); wxChar *wxTaskBarWindowClass = (wxChar*) wxT("wxTaskBarWindowClass");
wxList wxTaskBarIcon::sm_taskBarIcons; wxTaskBarIconList wxTaskBarIcon::sm_taskBarIcons;
bool wxTaskBarIcon::sm_registeredClass = false; bool wxTaskBarIcon::sm_registeredClass = FALSE;
UINT wxTaskBarIcon::sm_taskbarMsg = 0; UINT wxTaskBarIcon::sm_taskbarMsg = 0;
DEFINE_EVENT_TYPE( wxEVT_TASKBAR_MOVE ) DEFINE_EVENT_TYPE( wxEVT_TASKBAR_MOVE )
@@ -247,10 +250,10 @@ void wxTaskBarIcon::_OnRButtonDClick(wxEvent& e) { OnRButtonDClick(e); }
wxTaskBarIcon* wxTaskBarIcon::FindObjectForHWND(WXHWND hWnd) wxTaskBarIcon* wxTaskBarIcon::FindObjectForHWND(WXHWND hWnd)
{ {
wxNode *node = sm_taskBarIcons.GetFirst(); wxTaskBarIconList::Node *node = sm_taskBarIcons.GetFirst();
while (node) while (node)
{ {
wxTaskBarIcon* obj = (wxTaskBarIcon*) node->GetData(); wxTaskBarIcon *obj = node->GetData();
if (obj->GetHWND() == hWnd) if (obj->GetHWND() == hWnd)
return obj; return obj;
node = node->GetNext(); node = node->GetNext();