projects
/
wxWidgets.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
min and max setters added (xti)
[wxWidgets.git]
/
src
/
generic
/
accel.cpp
diff --git
a/src/generic/accel.cpp
b/src/generic/accel.cpp
index d99b55cea6e24ee55fa7bcfb1026674ed0f40c70..50a7f9faaa81fbceb98b002c56fa08babc2637d8 100644
(file)
--- a/
src/generic/accel.cpp
+++ b/
src/generic/accel.cpp
@@
-16,7
+16,7
@@
// headers
// ----------------------------------------------------------------------------
// headers
// ----------------------------------------------------------------------------
-#if
def __GNUG__
+#if
defined(__GNUG__) && !defined(NO_GCC_PRAGMA)
#pragma implementation "accel.h"
#endif
#pragma implementation "accel.h"
#endif
@@
-53,7
+53,20
@@
WX_DEFINE_LIST(wxAccelList);
class wxAccelRefData : public wxObjectRefData
{
public:
class wxAccelRefData : public wxObjectRefData
{
public:
- wxAccelRefData() { m_accels.DeleteContents(TRUE); }
+ wxAccelRefData()
+ {
+ }
+
+ wxAccelRefData(const wxAccelRefData& data)
+ : wxObjectRefData()
+ {
+ m_accels = data.m_accels;
+ }
+
+ virtual ~wxAccelRefData()
+ {
+ WX_CLEAR_LIST(wxAccelList, m_accels);
+ }
wxAccelList m_accels;
};
wxAccelList m_accels;
};
@@
-61,6
+74,7
@@
public:
// macro which can be used to access wxAccelRefData from wxAcceleratorTable
#define M_ACCELDATA ((wxAccelRefData *)m_refData)
// macro which can be used to access wxAccelRefData from wxAcceleratorTable
#define M_ACCELDATA ((wxAccelRefData *)m_refData)
+
// ============================================================================
// implementation
// ============================================================================
// ============================================================================
// implementation
// ============================================================================
@@
-75,7
+89,7
@@
wxAcceleratorTable::wxAcceleratorTable()
{
}
{
}
-wxAcceleratorTable::wxAcceleratorTable(int n, wxAcceleratorEntry entries[])
+wxAcceleratorTable::wxAcceleratorTable(int n,
const
wxAcceleratorEntry entries[])
{
m_refData = new wxAccelRefData;
{
m_refData = new wxAccelRefData;
@@
-108,6
+122,8
@@
bool wxAcceleratorTable::Ok() const
void wxAcceleratorTable::Add(const wxAcceleratorEntry& entry)
{
void wxAcceleratorTable::Add(const wxAcceleratorEntry& entry)
{
+ AllocExclusive();
+
if ( !m_refData )
{
m_refData = new wxAccelRefData;
if ( !m_refData )
{
m_refData = new wxAccelRefData;
@@
-118,14
+134,17
@@
void wxAcceleratorTable::Add(const wxAcceleratorEntry& entry)
void wxAcceleratorTable::Remove(const wxAcceleratorEntry& entry)
{
void wxAcceleratorTable::Remove(const wxAcceleratorEntry& entry)
{
- wxAccelList::Node *node = M_ACCELDATA->m_accels.GetFirst();
+ AllocExclusive();
+
+ wxAccelList::compatibility_iterator node = M_ACCELDATA->m_accels.GetFirst();
while ( node )
{
const wxAcceleratorEntry *entryCur = node->GetData();
if ( *entryCur == entry )
{
while ( node )
{
const wxAcceleratorEntry *entryCur = node->GetData();
if ( *entryCur == entry )
{
- M_ACCELDATA->m_accels.DeleteNode(node);
+ delete node->GetData();
+ M_ACCELDATA->m_accels.Erase(node);
return;
}
return;
}
@@
-149,7
+168,7
@@
wxAcceleratorTable::GetEntry(const wxKeyEvent& event) const
return NULL;
}
return NULL;
}
- wxAccelList::
Node *
node = M_ACCELDATA->m_accels.GetFirst();
+ wxAccelList::
compatibility_iterator
node = M_ACCELDATA->m_accels.GetFirst();
while ( node )
{
const wxAcceleratorEntry *entry = node->GetData();
while ( node )
{
const wxAcceleratorEntry *entry = node->GetData();
@@
-189,5
+208,15
@@
int wxAcceleratorTable::GetCommand(const wxKeyEvent& event) const
return entry ? entry->GetCommand() : -1;
}
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
#endif // wxUSE_ACCEL