#endif
#ifndef WX_PRECOMP
-#include "wx.h"
+#include "wx/wx.h"
#endif
#if defined(__WIN95__)
#include "wx/msw/private.h"
-#ifndef __GNUWIN32__
+#if (defined(__WIN95__) && !defined(__GNUWIN32__)) || defined(__TWIN32__)
#include <commctrl.h>
#endif
+#ifndef __TWIN32__
#ifdef __GNUWIN32__
#include "wx/msw/gnuwin32/extra.h"
#endif
+#endif
static void wxConvertToMSWListItem(const wxListCtrl *ctrl, wxListItem& info, LV_ITEM& tvItem);
static void wxConvertFromMSWListItem(const wxListCtrl *ctrl, wxListItem& info, LV_ITEM& tvItem, HWND getFullInfo = 0);
// Even with extended styles, need to combine with WS_BORDER
// for them to look right.
- if (want3D || (m_windowStyle & wxSIMPLE_BORDER) || (m_windowStyle & wxRAISED_BORDER) ||
- (m_windowStyle & wxSUNKEN_BORDER) || (m_windowStyle & wxDOUBLE_BORDER))
+ if ( want3D || wxStyleHasBorder(m_windowStyle) )
wstyle |= WS_BORDER;
- wstyle |= LVS_SHAREIMAGELISTS;
+ wstyle |= LVS_SHAREIMAGELISTS | LVS_SHOWSELALWAYS ;
m_baseStyle = wstyle;
long oldStyle = 0; // Dummy
wxSystemSettings settings;
SetBackgroundColour(settings.GetSystemColour(wxSYS_COLOUR_WINDOW));
- SetForegroundColour(parent->GetDefaultForegroundColour());
+ SetForegroundColour(parent->GetForegroundColour());
if (parent) parent->AddChild(this);
bool wxListCtrl::GetItem(wxListItem& info) const
{
LV_ITEM lvItem;
+#ifdef __MINGW32__
+ memset(&lvItem, 0, sizeof(lvItem));
+#else
ZeroMemory(&lvItem, sizeof(lvItem)); // must set all fields to 0
+#endif
lvItem.iItem = info.m_itemId;
lvItem.pszText = NULL;
}
+ if (info.m_mask & wxLIST_MASK_DATA)
+ lvItem.mask |= LVIF_PARAM ;
+
if ( info.m_mask & wxLIST_MASK_STATE )
{
lvItem.mask |= LVIF_STATE;
}
// Gets the item rectangle
-bool wxListCtrl::GetItemRect(long item, wxRectangle& rect, int code) const
+bool wxListCtrl::GetItemRect(long item, wxRect& rect, int code) const
{
RECT rect2;
// End label editing, optionally cancelling the edit
bool wxListCtrl::EndEditLabel(bool cancel)
{
- wxASSERT( FALSE);
+ wxFAIL;
/* I don't know how to implement this: there's no such macro as ListView_EndEditLabelNow.
* ???
else return FALSE;
}
-bool wxListCtrl::MSWNotify(WXWPARAM wParam, WXLPARAM lParam)
+bool wxListCtrl::MSWNotify(WXWPARAM wParam, WXLPARAM lParam, WXLPARAM *result)
{
wxListEvent event(wxEVT_NULL, m_windowId);
wxEventType eventType = wxEVT_NULL;
NMHDR *hdr1 = (NMHDR *) lParam;
switch ( hdr1->code )
{
+ case LVN_BEGINRDRAG:
+ eventType = wxEVT_COMMAND_LIST_BEGIN_RDRAG;
+ // fall through
+
case LVN_BEGINDRAG:
- {
- eventType = wxEVT_COMMAND_LIST_BEGIN_DRAG;
- NM_LISTVIEW *hdr = (NM_LISTVIEW *)lParam;
- event.m_itemIndex = hdr->iItem;
- event.m_pointDrag.x = hdr->ptAction.x;
- event.m_pointDrag.y = hdr->ptAction.y;
- break;
- }
+ if ( eventType == wxEVT_NULL )
+ {
+ eventType = wxEVT_COMMAND_LIST_BEGIN_DRAG;
+ }
+
+ {
+ NM_LISTVIEW *hdr = (NM_LISTVIEW *)lParam;
+ event.m_itemIndex = hdr->iItem;
+ event.m_pointDrag.x = hdr->ptAction.x;
+ event.m_pointDrag.y = hdr->ptAction.y;
+ }
+ break;
+
case LVN_BEGINLABELEDIT:
{
eventType = wxEVT_COMMAND_LIST_BEGIN_LABEL_EDIT;
wxConvertFromMSWListItem(this, event.m_item, info->item, (HWND) GetHWND());
break;
}
- case LVN_BEGINRDRAG:
- {
- eventType = wxEVT_COMMAND_LIST_BEGIN_RDRAG;
- NM_LISTVIEW* hdr = (NM_LISTVIEW*)lParam;
- event.m_itemIndex = hdr->iItem;
- event.m_pointDrag.x = hdr->ptAction.x;
- event.m_pointDrag.y = hdr->ptAction.y;
- break;
- }
+
case LVN_COLUMNCLICK:
{
eventType = wxEVT_COMMAND_LIST_COL_CLICK;
}
default :
- return wxControl::MSWNotify(wParam, lParam);
- break;
+ return wxControl::MSWNotify(wParam, lParam, result);
}
event.SetEventObject( this );
// wxConvertToMSWListItem(this, event.m_item, info->item);
}
- return TRUE;
+ *result = !event.IsAllowed();
+
+ return TRUE;
}
char *wxListCtrl::AddPool(const wxString& str)
}
// List event
-IMPLEMENT_DYNAMIC_CLASS(wxListEvent, wxCommandEvent)
+IMPLEMENT_DYNAMIC_CLASS(wxListEvent, wxNotifyEvent)
-wxListEvent::wxListEvent(wxEventType commandType, int id):
- wxCommandEvent(commandType, id)
+wxListEvent::wxListEvent(wxEventType commandType, int id)
+ : wxNotifyEvent(commandType, id)
{
m_code = 0;
m_itemIndex = 0;