#include "wx/vector.h"
#include "wx/msw/private.h"
+#include "wx/msw/private/keyboard.h"
#if defined(__WXWINCE__) && !defined(__HANDHELDPC__)
#include <ole2.h>
eventType = wxEVT_COMMAND_LIST_DELETE_ITEM;
event.m_itemIndex = iItem;
- // delete the associated internal data
- if ( wxMSWListItemData *data = MSWGetItemData(iItem) )
- {
- const unsigned count = m_internalData.size();
- for ( unsigned n = 0; n < count; n++ )
- {
- if ( m_internalData[n] == data )
- {
- m_internalData.erase(m_internalData.begin() + n);
- wxDELETE(data);
- break;
- }
- }
-
- wxASSERT_MSG( !data, "invalid internal data pointer?" );
- }
break;
case LVN_INSERTITEM:
{
eventType = wxEVT_COMMAND_LIST_KEY_DOWN;
- event.m_code = wxCharCodeMSWToWX(wVKey);
+ event.m_code = wxMSWKeyboard::VKToWX(wVKey);
+
+ if ( event.m_code == WXK_NONE )
+ {
+ // We can't translate this to a standard key code,
+ // until support for Unicode key codes is added to
+ // wxListEvent we just ignore them.
+ return false;
+ }
}
event.m_itemIndex =
m_count = 0;
return true;
+ case LVN_DELETEITEM:
+ // Delete the associated internal data. Notice that this can be
+ // done only after the event has been handled as the data could be
+ // accessed during the handling of the event.
+ if ( wxMSWListItemData *data = MSWGetItemData(event.m_itemIndex) )
+ {
+ const unsigned count = m_internalData.size();
+ for ( unsigned n = 0; n < count; n++ )
+ {
+ if ( m_internalData[n] == data )
+ {
+ m_internalData.erase(m_internalData.begin() + n);
+ wxDELETE(data);
+ break;
+ }
+ }
+
+ wxASSERT_MSG( !data, "invalid internal data pointer?" );
+ }
+ break;
+
case LVN_ENDLABELEDITA:
case LVN_ENDLABELEDITW:
// logic here is inverted compared to all the other messages