]> git.saurik.com Git - wxWidgets.git/blobdiff - src/mac/carbon/accel.cpp
default button on older systems was not shown with OK, but empty, resulting in wxID_C...
[wxWidgets.git] / src / mac / carbon / accel.cpp
index 181460adf445d2a2ee12e19aca7cb9f0df59f6d8..36ea09768813ba297a38ef80c01401d3491422b0 100644 (file)
@@ -1,33 +1,31 @@
 /////////////////////////////////////////////////////////////////////////////
-// Name:        accel.cpp
+// Name:        src/mac/carbon/accel.cpp
 // Purpose:     wxAcceleratorTable
-// Author:      AUTHOR
+// Author:      Stefan Csomor
 // Modified by:
-// Created:     ??/??/98
+// Created:     1998-01-01
 // RCS-ID:      $Id$
-// Copyright:   (c) AUTHOR
+// Copyright:   (c) Stefan Csomor
 // Licence:     wxWindows licence
 /////////////////////////////////////////////////////////////////////////////
 
-#ifdef __GNUG__
-#pragma implementation "accel.h"
-#endif
+#include "wx/wxprec.h"
 
-#include "wx/setup.h"
 #include "wx/accel.h"
-#include "wx/string.h"
 
-#if !USE_SHARED_LIBRARIES
-IMPLEMENT_DYNAMIC_CLASS(wxAcceleratorTable, wxObject)
+#ifndef WX_PRECOMP
+    #include "wx/string.h"
 #endif
 
+IMPLEMENT_DYNAMIC_CLASS(wxAcceleratorTable, wxObject)
+
 // ----------------------------------------------------------------------------
 // wxAccelList: a list of wxAcceleratorEntries
 // ----------------------------------------------------------------------------
 
 WX_DECLARE_LIST(wxAcceleratorEntry, wxAccelList);
 #include "wx/listimpl.cpp"
-WX_DEFINE_LIST(wxAccelList);
+WX_DEFINE_LIST(wxAccelList)
 
 // ----------------------------------------------------------------------------
 // wxAccelRefData: the data used by wxAcceleratorTable
@@ -46,18 +44,18 @@ public:
 #define M_ACCELDATA ((wxAcceleratorRefData *)m_refData)
 
 wxAcceleratorRefData::wxAcceleratorRefData()
+    : m_accels()
 {
-    m_accels.DeleteContents( TRUE );
 }
 
 wxAcceleratorRefData::~wxAcceleratorRefData()
 {
-    m_accels.DeleteContents( TRUE );
+    WX_CLEAR_LIST( wxAccelList, m_accels );
 }
 
 wxAcceleratorTable::wxAcceleratorTable()
 {
-  m_refData = NULL;
+    m_refData = NULL;
 }
 
 wxAcceleratorTable::~wxAcceleratorTable()
@@ -65,7 +63,7 @@ wxAcceleratorTable::~wxAcceleratorTable()
 }
 
 // Create from an array
-wxAcceleratorTable::wxAcceleratorTable(int n, wxAcceleratorEntry entries[])
+wxAcceleratorTable::wxAcceleratorTable(int n, const wxAcceleratorEntry entries[])
 {
     m_refData = new wxAcceleratorRefData;
 
@@ -88,10 +86,10 @@ int wxAcceleratorTable::GetCommand( wxKeyEvent &event )
 {
     if (!Ok()) return -1;
 
-    wxNode *node = M_ACCELDATA->m_accels.First();
+    wxAccelList::compatibility_iterator node = M_ACCELDATA->m_accels.GetFirst();
     while (node)
     {
-        wxAcceleratorEntry *entry = (wxAcceleratorEntry*)node->Data();
+        wxAcceleratorEntry *entry = node->GetData();
         if ((event.m_keyCode == entry->GetKeyCode()) &&
            (((entry->GetFlags() & wxACCEL_CTRL) == 0) || event.ControlDown()) &&
            (((entry->GetFlags() & wxACCEL_SHIFT) == 0) || event.ShiftDown()) &&
@@ -99,10 +97,8 @@ int wxAcceleratorTable::GetCommand( wxKeyEvent &event )
         {
             return entry->GetCommand();
         }
-        node = node->Next();
+        node = node->GetNext();
     }
 
     return -1;
 }
-
-