X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/c085e333984dc079a001cd3f581aeb1f51a1f227..17dff81c7141e142765b168ab225e5c61475669f:/src/msw/listctrl.cpp?ds=sidebyside diff --git a/src/msw/listctrl.cpp b/src/msw/listctrl.cpp index 6a0e5dec10..ef8ee7abc9 100644 --- a/src/msw/listctrl.cpp +++ b/src/msw/listctrl.cpp @@ -100,7 +100,7 @@ bool wxListCtrl::Create(wxWindow *parent, wxWindowID id, const wxPoint& pos, con if ( want3D || wxStyleHasBorder(m_windowStyle) ) wstyle |= WS_BORDER; - wstyle |= LVS_SHAREIMAGELISTS; + wstyle |= LVS_SHAREIMAGELISTS | LVS_SHOWSELALWAYS ; m_baseStyle = wstyle; long oldStyle = 0; // Dummy @@ -463,7 +463,11 @@ wxTextCtrl* wxListCtrl::GetEditControl(void) const 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; @@ -478,6 +482,9 @@ bool wxListCtrl::GetItem(wxListItem& info) const 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; @@ -618,7 +625,7 @@ bool wxListCtrl::SetItemData(long item, long data) } // 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; @@ -1107,22 +1114,31 @@ bool wxListCtrl::MSWCommand(WXUINT cmd, WXWORD id) 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; @@ -1130,15 +1146,7 @@ bool wxListCtrl::MSWNotify(WXWPARAM wParam, WXLPARAM lParam) 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; @@ -1224,8 +1232,7 @@ bool wxListCtrl::MSWNotify(WXWPARAM wParam, WXLPARAM lParam) } default : - return wxControl::MSWNotify(wParam, lParam); - break; + return wxControl::MSWNotify(wParam, lParam, result); } event.SetEventObject( this ); @@ -1248,7 +1255,9 @@ bool wxListCtrl::MSWNotify(WXWPARAM wParam, WXLPARAM lParam) // wxConvertToMSWListItem(this, event.m_item, info->item); } - return TRUE; + *result = !event.IsAllowed(); + + return TRUE; } char *wxListCtrl::AddPool(const wxString& str) @@ -1424,10 +1433,10 @@ static void wxConvertToMSWListItem(const wxListCtrl *ctrl, wxListItem& info, LV_ } // 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;