mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-07-29 00:59:44 -06:00
Import r67258 of the wxWidgets trunk, which I expect will before
long become wxWidgets 2.9.2, which in turn is expected to be the last 2.9 release before the 3.0 stable release. Since the full wxWidgets distribution is rather large, I have imported only the parts that we use, on a subdirectory basis: art include/wx/*.* include/wx/aui include/wx/cocoa include/wx/generic include/wx/gtk include/wx/meta include/wx/msw include/wx/osx include/wx/persist include/wx/private include/wx/protocol include/wx/unix src/aui src/common src/generic src/gtk src/msw src/osx src/unix git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@7380 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
92
Externals/wxWidgets3/include/wx/tracker.h
vendored
Normal file
92
Externals/wxWidgets3/include/wx/tracker.h
vendored
Normal file
@ -0,0 +1,92 @@
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// Name: wx/tracker.h
|
||||
// Purpose: Support class for object lifetime tracking (wxWeakRef<T>)
|
||||
// Author: Arne Steinarson
|
||||
// Created: 28 Dec 07
|
||||
// RCS-ID: $Id: tracker.h 51448 2008-01-29 17:41:10Z RD $
|
||||
// Copyright: (c) 2007 Arne Steinarson
|
||||
// Licence: wxWindows licence
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef _WX_TRACKER_H_
|
||||
#define _WX_TRACKER_H_
|
||||
|
||||
#include "wx/defs.h"
|
||||
|
||||
class wxEventConnectionRef;
|
||||
|
||||
// This class represents an object tracker and is stored in a linked list
|
||||
// in the tracked object. It is only used in one of its derived forms.
|
||||
class WXDLLIMPEXP_BASE wxTrackerNode
|
||||
{
|
||||
public:
|
||||
wxTrackerNode() : m_nxt(NULL) { }
|
||||
virtual ~wxTrackerNode() { }
|
||||
|
||||
virtual void OnObjectDestroy() = 0;
|
||||
|
||||
virtual wxEventConnectionRef *ToEventConnection() { return NULL; }
|
||||
|
||||
private:
|
||||
wxTrackerNode *m_nxt;
|
||||
|
||||
friend class wxTrackable; // For list access
|
||||
friend class wxEvtHandler; // For list access
|
||||
};
|
||||
|
||||
// Add-on base class for a trackable object.
|
||||
class WXDLLIMPEXP_BASE wxTrackable
|
||||
{
|
||||
public:
|
||||
void AddNode(wxTrackerNode *prn)
|
||||
{
|
||||
prn->m_nxt = m_first;
|
||||
m_first = prn;
|
||||
}
|
||||
|
||||
void RemoveNode(wxTrackerNode *prn)
|
||||
{
|
||||
for ( wxTrackerNode **pprn = &m_first; *pprn; pprn = &(*pprn)->m_nxt )
|
||||
{
|
||||
if ( *pprn == prn )
|
||||
{
|
||||
*pprn = prn->m_nxt;
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
wxFAIL_MSG( "removing invalid tracker node" );
|
||||
}
|
||||
|
||||
wxTrackerNode *GetFirst() const { return m_first; }
|
||||
|
||||
protected:
|
||||
// this class is only supposed to be used as a base class but never be
|
||||
// created nor destroyed directly so all ctors and dtor are protected
|
||||
|
||||
wxTrackable() : m_first(NULL) { }
|
||||
|
||||
// copy ctor and assignment operator intentionally do not copy m_first: the
|
||||
// objects which track the original trackable shouldn't track the new copy
|
||||
wxTrackable(const wxTrackable& WXUNUSED(other)) : m_first(NULL) { }
|
||||
wxTrackable& operator=(const wxTrackable& WXUNUSED(other)) { return *this; }
|
||||
|
||||
// dtor is not virtual: this class is not supposed to be used
|
||||
// polymorphically and adding a virtual table to it would add unwanted
|
||||
// overhead
|
||||
~wxTrackable()
|
||||
{
|
||||
// Notify all registered refs
|
||||
while ( m_first )
|
||||
{
|
||||
wxTrackerNode * const first = m_first;
|
||||
m_first = first->m_nxt;
|
||||
first->OnObjectDestroy();
|
||||
}
|
||||
}
|
||||
|
||||
wxTrackerNode *m_first;
|
||||
};
|
||||
|
||||
#endif // _WX_TRACKER_H_
|
||||
|
Reference in New Issue
Block a user