X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/fd71308fc89eac2dd212b715eba68a993fa78f53..16553659df1a8fee8b19cc9a8ff8321711fe983c:/src/msw/listctrl.cpp diff --git a/src/msw/listctrl.cpp b/src/msw/listctrl.cpp index 584df93945..66e3278c0e 100644 --- a/src/msw/listctrl.cpp +++ b/src/msw/listctrl.cpp @@ -97,8 +97,7 @@ bool wxListCtrl::Create(wxWindow *parent, wxWindowID id, const wxPoint& pos, con // 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; @@ -464,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; @@ -619,7 +622,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; @@ -1108,22 +1111,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; @@ -1131,15 +1143,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; @@ -1225,8 +1229,7 @@ bool wxListCtrl::MSWNotify(WXWPARAM wParam, WXLPARAM lParam) } default : - return wxControl::MSWNotify(wParam, lParam); - break; + return wxControl::MSWNotify(wParam, lParam, result); } event.SetEventObject( this ); @@ -1249,7 +1252,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) @@ -1427,8 +1432,8 @@ static void wxConvertToMSWListItem(const wxListCtrl *ctrl, wxListItem& info, LV_ // List event IMPLEMENT_DYNAMIC_CLASS(wxListEvent, wxCommandEvent) -wxListEvent::wxListEvent(wxEventType commandType, int id): - wxCommandEvent(commandType, id) +wxListEvent::wxListEvent(wxEventType commandType, int id) + : wxNotifyEvent(commandType, id) { m_code = 0; m_itemIndex = 0;