class wxAccelRefData : public wxObjectRefData
{
public:
- wxAccelRefData() { m_accels.DeleteContents(TRUE); }
+ wxAccelRefData()
+ {
+ m_accels.DeleteContents(TRUE);
+ }
+
+ wxAccelRefData(const wxAccelRefData& data)
+ : wxObjectRefData()
+ {
+ m_accels.DeleteContents(TRUE);
+ m_accels = data.m_accels;
+ }
wxAccelList m_accels;
};
// macro which can be used to access wxAccelRefData from wxAcceleratorTable
#define M_ACCELDATA ((wxAccelRefData *)m_refData)
+
// ============================================================================
// implementation
// ============================================================================
void wxAcceleratorTable::Add(const wxAcceleratorEntry& entry)
{
+ AllocExclusive();
+
if ( !m_refData )
{
m_refData = new wxAccelRefData;
void wxAcceleratorTable::Remove(const wxAcceleratorEntry& entry)
{
+ AllocExclusive();
+
wxAccelList::Node *node = M_ACCELDATA->m_accels.GetFirst();
while ( node )
{
return entry ? entry->GetCommand() : -1;
}
+wxObjectRefData *wxAcceleratorTable::CreateRefData() const
+{
+ return new wxAccelRefData;
+}
+
+wxObjectRefData *wxAcceleratorTable::CloneRefData(const wxObjectRefData *data) const
+{
+ return new wxAccelRefData(*(wxAccelRefData *)data);
+}
+
#endif // wxUSE_ACCEL