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_
#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__)
#include "wx/msw/dde.h"
#elif defined(__WXMOTIF__)

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@@ -557,10 +557,10 @@ bool wxMDIParentFrame::HandleCommand(WXWORD id, WXWORD cmd, WXHWND hwnd)
if ( IsMdiCommandId(id) )
{
wxWindowList::Node* node = GetChildren().GetFirst();
wxWindowList::Node *node = GetChildren().GetFirst();
while ( node )
{
wxWindow* child = node->GetData();
wxWindow *child = node->GetData();
if ( child->GetHWND() )
{
long childId = wxGetWindowId(child->GetHWND());
@@ -1245,14 +1245,18 @@ void wxMDIClientWindow::DoSetSize(int x, int y, int width, int height, int sizeF
{
if (GetParent())
{
wxWindowList::Node* node = GetParent()->GetChildren().GetFirst();
wxWindowList::Node *node = GetParent()->GetChildren().GetFirst();
while (node)
{
wxWindow* child = node->GetData();
wxWindow *child = node->GetData();
if (child->IsKindOf(CLASSINFO(wxMDIChildFrame)))
{
HWND hWnd = (HWND) child->GetHWND();
::RedrawWindow(hWnd, NULL, NULL, RDW_FRAME|RDW_ALLCHILDREN|RDW_INVALIDATE );
::RedrawWindow(GetHwndOf(child),
NULL,
NULL,
RDW_FRAME |
RDW_ALLCHILDREN |
RDW_INVALIDATE);
}
node = node->GetNext();
}

View File

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