1 /////////////////////////////////////////////////////////////////////////////
4 // Author: Julian Smart
8 // Copyright: (c) Julian Smart and Markus Holzem
9 // Licence: wxWindows license
10 /////////////////////////////////////////////////////////////////////////////
12 // ============================================================================
14 // ============================================================================
16 // ----------------------------------------------------------------------------
18 // ----------------------------------------------------------------------------
21 #pragma implementation "listctrl.h"
24 // For compilers that support precompilation, includes "wx.h".
25 #include "wx/wxprec.h"
37 #include "wx/listctrl.h"
40 #include "wx/msw/private.h"
42 #if defined(__GNUWIN32__) && !defined(wxUSE_NORLANDER_HEADERS)
43 #include "wx/msw/gnuwin32/extra.h"
48 // ----------------------------------------------------------------------------
50 // ----------------------------------------------------------------------------
52 static void wxConvertToMSWListItem(const wxListCtrl
*ctrl
, wxListItem
& info
, LV_ITEM
& tvItem
);
53 static void wxConvertFromMSWListItem(const wxListCtrl
*ctrl
, wxListItem
& info
, LV_ITEM
& tvItem
, HWND getFullInfo
= 0);
55 // ----------------------------------------------------------------------------
57 // ----------------------------------------------------------------------------
59 #if !USE_SHARED_LIBRARY
60 IMPLEMENT_DYNAMIC_CLASS(wxListCtrl
, wxControl
)
61 IMPLEMENT_DYNAMIC_CLASS(wxListItem
, wxObject
)
62 #endif // USE_SHARED_LIBRARY
64 // ============================================================================
66 // ============================================================================
68 // ----------------------------------------------------------------------------
69 // wxListCtrl construction
70 // ----------------------------------------------------------------------------
72 wxListCtrl::wxListCtrl()
74 m_imageListNormal
= NULL
;
75 m_imageListSmall
= NULL
;
76 m_imageListState
= NULL
;
82 bool wxListCtrl::Create(wxWindow
*parent
,
87 const wxValidator
& validator
,
90 m_imageListNormal
= NULL
;
91 m_imageListSmall
= NULL
;
92 m_imageListState
= NULL
;
96 SetValidator(validator
);
104 m_windowStyle
= style
;
117 m_windowId
= (id
== -1) ? NewControlId() : id
;
119 DWORD wstyle
= WS_VISIBLE
| WS_CHILD
| WS_TABSTOP
|
120 LVS_SHAREIMAGELISTS
| LVS_SHOWSELALWAYS
;
121 if ( wxStyleHasBorder(m_windowStyle
) )
123 m_baseStyle
= wstyle
;
125 if ( !DoCreateControl(x
, y
, width
, height
) )
129 parent
->AddChild(this);
134 bool wxListCtrl::DoCreateControl(int x
, int y
, int w
, int h
)
136 DWORD wstyle
= m_baseStyle
;
139 WXDWORD exStyle
= Determine3DEffects(WS_EX_CLIENTEDGE
, &want3D
);
141 // Even with extended styles, need to combine with WS_BORDER
142 // for them to look right.
146 long oldStyle
= 0; // Dummy
147 wstyle
|= ConvertToMSWStyle(oldStyle
, m_windowStyle
);
149 // Create the ListView control.
150 m_hWnd
= (WXHWND
)CreateWindowEx(exStyle
,
155 GetWinHwnd(GetParent()),
162 wxLogError(wxT("Can't create list control window."));
167 // for comctl32.dll v 4.70+ we want to have this attribute because it's
168 // prettier (and also because wxGTK does it like this)
169 #ifdef ListView_SetExtendedListViewStyle
170 if ( wstyle
& LVS_REPORT
)
172 ListView_SetExtendedListViewStyle(GetHwnd(),
173 LVS_EX_FULLROWSELECT
);
175 #endif // ListView_SetExtendedListViewStyle
177 SetBackgroundColour(wxSystemSettings::GetSystemColour(wxSYS_COLOUR_WINDOW
));
178 SetForegroundColour(GetParent()->GetForegroundColour());
185 void wxListCtrl::UpdateStyle()
189 // The new window view style
191 DWORD dwStyleNew
= ConvertToMSWStyle(dummy
, m_windowStyle
);
192 dwStyleNew
|= m_baseStyle
;
194 // Get the current window style.
195 DWORD dwStyleOld
= ::GetWindowLong(GetHwnd(), GWL_STYLE
);
197 // Only set the window style if the view bits have changed.
198 if ( dwStyleOld
!= dwStyleNew
)
200 ::SetWindowLong(GetHwnd(), GWL_STYLE
, dwStyleNew
);
205 wxListCtrl::~wxListCtrl()
209 m_textCtrl
->UnsubclassWin();
210 m_textCtrl
->SetHWND(0);
216 // ----------------------------------------------------------------------------
217 // set/get/change style
218 // ----------------------------------------------------------------------------
220 // Add or remove a single window style
221 void wxListCtrl::SetSingleStyle(long style
, bool add
)
223 long flag
= GetWindowStyleFlag();
225 // Get rid of conflicting styles
228 if ( style
& wxLC_MASK_TYPE
)
229 flag
= flag
& ~wxLC_MASK_TYPE
;
230 if ( style
& wxLC_MASK_ALIGN
)
231 flag
= flag
& ~wxLC_MASK_ALIGN
;
232 if ( style
& wxLC_MASK_SORT
)
233 flag
= flag
& ~wxLC_MASK_SORT
;
249 m_windowStyle
= flag
;
254 // Set the whole window style
255 void wxListCtrl::SetWindowStyleFlag(long flag
)
257 m_windowStyle
= flag
;
262 // Can be just a single style, or a bitlist
263 long wxListCtrl::ConvertToMSWStyle(long& oldStyle
, long style
) const
266 if ( style
& wxLC_ICON
)
268 if ( (oldStyle
& LVS_TYPEMASK
) == LVS_SMALLICON
)
269 oldStyle
-= LVS_SMALLICON
;
270 if ( (oldStyle
& LVS_TYPEMASK
) == LVS_REPORT
)
271 oldStyle
-= LVS_REPORT
;
272 if ( (oldStyle
& LVS_TYPEMASK
) == LVS_LIST
)
273 oldStyle
-= LVS_LIST
;
277 if ( style
& wxLC_SMALL_ICON
)
279 if ( (oldStyle
& LVS_TYPEMASK
) == LVS_ICON
)
280 oldStyle
-= LVS_ICON
;
281 if ( (oldStyle
& LVS_TYPEMASK
) == LVS_REPORT
)
282 oldStyle
-= LVS_REPORT
;
283 if ( (oldStyle
& LVS_TYPEMASK
) == LVS_LIST
)
284 oldStyle
-= LVS_LIST
;
285 wstyle
|= LVS_SMALLICON
;
288 if ( style
& wxLC_LIST
)
290 if ( (oldStyle
& LVS_TYPEMASK
) == LVS_ICON
)
291 oldStyle
-= LVS_ICON
;
292 if ( (oldStyle
& LVS_TYPEMASK
) == LVS_REPORT
)
293 oldStyle
-= LVS_REPORT
;
294 if ( (oldStyle
& LVS_TYPEMASK
) == LVS_SMALLICON
)
295 oldStyle
-= LVS_SMALLICON
;
299 if ( style
& wxLC_REPORT
)
301 if ( (oldStyle
& LVS_TYPEMASK
) == LVS_ICON
)
302 oldStyle
-= LVS_ICON
;
303 if ( (oldStyle
& LVS_TYPEMASK
) == LVS_LIST
)
304 oldStyle
-= LVS_LIST
;
305 if ( (oldStyle
& LVS_TYPEMASK
) == LVS_SMALLICON
)
306 oldStyle
-= LVS_SMALLICON
;
308 wstyle
|= LVS_REPORT
;
311 if ( style
& wxLC_ALIGN_LEFT
)
313 if ( oldStyle
& LVS_ALIGNTOP
)
314 oldStyle
-= LVS_ALIGNTOP
;
315 wstyle
|= LVS_ALIGNLEFT
;
318 if ( style
& wxLC_ALIGN_TOP
)
320 if ( oldStyle
& LVS_ALIGNLEFT
)
321 oldStyle
-= LVS_ALIGNLEFT
;
322 wstyle
|= LVS_ALIGNTOP
;
325 if ( style
& wxLC_AUTOARRANGE
)
326 wstyle
|= LVS_AUTOARRANGE
;
328 // Apparently, no such style (documentation wrong?)
330 if ( style & wxLC_BUTTON )
331 wstyle |= LVS_BUTTON;
334 if ( style
& wxLC_NO_SORT_HEADER
)
335 wstyle
|= LVS_NOSORTHEADER
;
337 if ( style
& wxLC_NO_HEADER
)
338 wstyle
|= LVS_NOCOLUMNHEADER
;
340 if ( style
& wxLC_EDIT_LABELS
)
341 wstyle
|= LVS_EDITLABELS
;
343 if ( style
& wxLC_SINGLE_SEL
)
344 wstyle
|= LVS_SINGLESEL
;
346 if ( style
& wxLC_SORT_ASCENDING
)
348 if ( oldStyle
& LVS_SORTDESCENDING
)
349 oldStyle
-= LVS_SORTDESCENDING
;
350 wstyle
|= LVS_SORTASCENDING
;
353 if ( style
& wxLC_SORT_DESCENDING
)
355 if ( oldStyle
& LVS_SORTASCENDING
)
356 oldStyle
-= LVS_SORTASCENDING
;
357 wstyle
|= LVS_SORTDESCENDING
;
363 // ----------------------------------------------------------------------------
365 // ----------------------------------------------------------------------------
367 // Sets the background colour (GetBackgroundColour already implicit in
369 bool wxListCtrl::SetBackgroundColour(const wxColour
& col
)
371 if ( !wxWindow::SetBackgroundColour(col
) )
374 ListView_SetBkColor(GetHwnd(), PALETTERGB(col
.Red(), col
.Green(), col
.Blue()));
379 // Gets information about this column
380 bool wxListCtrl::GetColumn(int col
, wxListItem
& item
) const
385 lvCol
.pszText
= NULL
;
387 if ( item
.m_mask
& wxLIST_MASK_TEXT
)
389 lvCol
.mask
|= LVCF_TEXT
;
390 lvCol
.pszText
= new wxChar
[513];
391 lvCol
.cchTextMax
= 512;
394 bool success
= (ListView_GetColumn(GetHwnd(), col
, & lvCol
) != 0);
396 // item.m_subItem = lvCol.iSubItem;
397 item
.m_width
= lvCol
.cx
;
399 if ( (item
.m_mask
& wxLIST_MASK_TEXT
) && lvCol
.pszText
)
401 item
.m_text
= lvCol
.pszText
;
402 delete[] lvCol
.pszText
;
405 if ( item
.m_mask
& wxLIST_MASK_FORMAT
)
407 if (lvCol
.fmt
== LVCFMT_LEFT
)
408 item
.m_format
= wxLIST_FORMAT_LEFT
;
409 else if (lvCol
.fmt
== LVCFMT_RIGHT
)
410 item
.m_format
= wxLIST_FORMAT_RIGHT
;
411 else if (lvCol
.fmt
== LVCFMT_CENTER
)
412 item
.m_format
= wxLIST_FORMAT_CENTRE
;
418 // Sets information about this column
419 bool wxListCtrl::SetColumn(int col
, wxListItem
& item
)
424 lvCol
.pszText
= NULL
;
426 if ( item
.m_mask
& wxLIST_MASK_TEXT
)
428 lvCol
.mask
|= LVCF_TEXT
;
429 lvCol
.pszText
= WXSTRINGCAST item
.m_text
;
430 lvCol
.cchTextMax
= 0; // Ignored
432 if ( item
.m_mask
& wxLIST_MASK_FORMAT
)
434 lvCol
.mask
|= LVCF_FMT
;
436 if ( item
.m_format
== wxLIST_FORMAT_LEFT
)
437 lvCol
.fmt
= LVCFMT_LEFT
;
438 if ( item
.m_format
== wxLIST_FORMAT_RIGHT
)
439 lvCol
.fmt
= LVCFMT_RIGHT
;
440 if ( item
.m_format
== wxLIST_FORMAT_CENTRE
)
441 lvCol
.fmt
= LVCFMT_CENTER
;
444 if ( item
.m_mask
& wxLIST_MASK_WIDTH
)
446 lvCol
.mask
|= LVCF_WIDTH
;
447 lvCol
.cx
= item
.m_width
;
449 if ( lvCol
.cx
== wxLIST_AUTOSIZE
)
450 lvCol
.cx
= LVSCW_AUTOSIZE
;
451 else if ( lvCol
.cx
== wxLIST_AUTOSIZE_USEHEADER
)
452 lvCol
.cx
= LVSCW_AUTOSIZE_USEHEADER
;
454 lvCol
.mask
|= LVCF_SUBITEM
;
455 lvCol
.iSubItem
= col
;
456 return (ListView_SetColumn(GetHwnd(), col
, & lvCol
) != 0);
459 // Gets the column width
460 int wxListCtrl::GetColumnWidth(int col
) const
462 return ListView_GetColumnWidth(GetHwnd(), col
);
465 // Sets the column width
466 bool wxListCtrl::SetColumnWidth(int col
, int width
)
469 if ( m_windowStyle
& wxLC_LIST
)
473 if ( width2
== wxLIST_AUTOSIZE
)
474 width2
= LVSCW_AUTOSIZE
;
475 else if ( width2
== wxLIST_AUTOSIZE_USEHEADER
)
476 width2
= LVSCW_AUTOSIZE_USEHEADER
;
478 return (ListView_SetColumnWidth(GetHwnd(), col2
, width2
) != 0);
481 // Gets the number of items that can fit vertically in the
482 // visible area of the list control (list or report view)
483 // or the total number of items in the list control (icon
484 // or small icon view)
485 int wxListCtrl::GetCountPerPage(void) const
487 return ListView_GetCountPerPage(GetHwnd());
490 // Gets the edit control for editing labels.
491 wxTextCtrl
* wxListCtrl::GetEditControl(void) const
496 // Gets information about the item
497 bool wxListCtrl::GetItem(wxListItem
& info
) const
500 wxZeroMemory(lvItem
);
502 lvItem
.iItem
= info
.m_itemId
;
503 lvItem
.iSubItem
= info
.m_col
;
505 if ( info
.m_mask
& wxLIST_MASK_TEXT
)
507 lvItem
.mask
|= LVIF_TEXT
;
508 lvItem
.pszText
= new wxChar
[513];
509 lvItem
.cchTextMax
= 512;
513 lvItem
.pszText
= NULL
;
516 if (info
.m_mask
& wxLIST_MASK_DATA
)
517 lvItem
.mask
|= LVIF_PARAM
;
519 if ( info
.m_mask
& wxLIST_MASK_STATE
)
521 lvItem
.mask
|= LVIF_STATE
;
522 // the other bits are hardly interesting anyhow
523 lvItem
.stateMask
= LVIS_SELECTED
| LVIS_FOCUSED
;
526 bool success
= ListView_GetItem((HWND
)GetHWND(), &lvItem
) != 0;
529 wxLogError(_("Couldn't retrieve information about list control item %d."),
534 wxConvertFromMSWListItem(this, info
, lvItem
);
538 delete[] lvItem
.pszText
;
543 // Sets information about the item
544 bool wxListCtrl::SetItem(wxListItem
& info
)
547 wxConvertToMSWListItem(this, info
, item
);
549 bool ok
= ListView_SetItem(GetHwnd(), &item
) != 0;
550 if ( ok
&& (info
.m_mask
& wxLIST_MASK_IMAGE
) )
552 // make the change visible
553 ListView_Update(GetHwnd(), item
.iItem
);
559 long wxListCtrl::SetItem(long index
, int col
, const wxString
& label
, int imageId
)
563 info
.m_mask
= wxLIST_MASK_TEXT
;
564 info
.m_itemId
= index
;
568 info
.m_image
= imageId
;
569 info
.m_mask
|= wxLIST_MASK_IMAGE
;
571 return SetItem(info
);
575 // Gets the item state
576 int wxListCtrl::GetItemState(long item
, long stateMask
) const
580 info
.m_mask
= wxLIST_MASK_STATE
;
581 info
.m_stateMask
= stateMask
;
582 info
.m_itemId
= item
;
590 // Sets the item state
591 bool wxListCtrl::SetItemState(long item
, long state
, long stateMask
)
595 info
.m_mask
= wxLIST_MASK_STATE
;
596 info
.m_state
= state
;
597 info
.m_stateMask
= stateMask
;
598 info
.m_itemId
= item
;
600 return SetItem(info
);
603 // Sets the item image
604 bool wxListCtrl::SetItemImage(long item
, int image
, int selImage
)
608 info
.m_mask
= wxLIST_MASK_IMAGE
;
609 info
.m_image
= image
;
610 info
.m_itemId
= item
;
612 return SetItem(info
);
615 // Gets the item text
616 wxString
wxListCtrl::GetItemText(long item
) const
620 info
.m_mask
= wxLIST_MASK_TEXT
;
621 info
.m_itemId
= item
;
628 // Sets the item text
629 void wxListCtrl::SetItemText(long item
, const wxString
& str
)
633 info
.m_mask
= wxLIST_MASK_TEXT
;
634 info
.m_itemId
= item
;
640 // Gets the item data
641 long wxListCtrl::GetItemData(long item
) const
645 info
.m_mask
= wxLIST_MASK_DATA
;
646 info
.m_itemId
= item
;
653 // Sets the item data
654 bool wxListCtrl::SetItemData(long item
, long data
)
658 info
.m_mask
= wxLIST_MASK_DATA
;
659 info
.m_itemId
= item
;
662 return SetItem(info
);
665 // Gets the item rectangle
666 bool wxListCtrl::GetItemRect(long item
, wxRect
& rect
, int code
) const
670 int code2
= LVIR_BOUNDS
;
671 if ( code
== wxLIST_RECT_BOUNDS
)
673 else if ( code
== wxLIST_RECT_ICON
)
675 else if ( code
== wxLIST_RECT_LABEL
)
679 bool success
= (ListView_GetItemRect(GetHwnd(), (int) item
, &rect2
) != 0);
681 bool success
= (ListView_GetItemRect(GetHwnd(), (int) item
, &rect2
, code2
) != 0);
686 rect
.width
= rect2
.right
- rect2
.left
;
687 rect
.height
= rect2
.bottom
- rect2
.left
;
691 // Gets the item position
692 bool wxListCtrl::GetItemPosition(long item
, wxPoint
& pos
) const
696 bool success
= (ListView_GetItemPosition(GetHwnd(), (int) item
, &pt
) != 0);
698 pos
.x
= pt
.x
; pos
.y
= pt
.y
;
702 // Sets the item position.
703 bool wxListCtrl::SetItemPosition(long item
, const wxPoint
& pos
)
705 return (ListView_SetItemPosition(GetHwnd(), (int) item
, pos
.x
, pos
.y
) != 0);
708 // Gets the number of items in the list control
709 int wxListCtrl::GetItemCount(void) const
711 return ListView_GetItemCount(GetHwnd());
714 // Retrieves the spacing between icons in pixels.
715 // If small is TRUE, gets the spacing for the small icon
716 // view, otherwise the large icon view.
717 int wxListCtrl::GetItemSpacing(bool isSmall
) const
719 return ListView_GetItemSpacing(GetHwnd(), (BOOL
) isSmall
);
722 // Gets the number of selected items in the list control
723 int wxListCtrl::GetSelectedItemCount(void) const
725 return ListView_GetSelectedCount(GetHwnd());
728 // Gets the text colour of the listview
729 wxColour
wxListCtrl::GetTextColour(void) const
731 COLORREF ref
= ListView_GetTextColor(GetHwnd());
732 wxColour
col(GetRValue(ref
), GetGValue(ref
), GetBValue(ref
));
736 // Sets the text colour of the listview
737 void wxListCtrl::SetTextColour(const wxColour
& col
)
739 ListView_SetTextColor(GetHwnd(), PALETTERGB(col
.Red(), col
.Green(), col
.Blue()));
742 // Gets the index of the topmost visible item when in
743 // list or report view
744 long wxListCtrl::GetTopItem(void) const
746 return (long) ListView_GetTopIndex(GetHwnd());
749 // Searches for an item, starting from 'item'.
750 // 'geometry' is one of
751 // wxLIST_NEXT_ABOVE/ALL/BELOW/LEFT/RIGHT.
752 // 'state' is a state bit flag, one or more of
753 // wxLIST_STATE_DROPHILITED/FOCUSED/SELECTED/CUT.
754 // item can be -1 to find the first item that matches the
756 // Returns the item or -1 if unsuccessful.
757 long wxListCtrl::GetNextItem(long item
, int geom
, int state
) const
761 if ( geom
== wxLIST_NEXT_ABOVE
)
763 if ( geom
== wxLIST_NEXT_ALL
)
765 if ( geom
== wxLIST_NEXT_BELOW
)
767 if ( geom
== wxLIST_NEXT_LEFT
)
768 flags
|= LVNI_TOLEFT
;
769 if ( geom
== wxLIST_NEXT_RIGHT
)
770 flags
|= LVNI_TORIGHT
;
772 if ( state
& wxLIST_STATE_CUT
)
774 if ( state
& wxLIST_STATE_DROPHILITED
)
775 flags
|= LVNI_DROPHILITED
;
776 if ( state
& wxLIST_STATE_FOCUSED
)
777 flags
|= LVNI_FOCUSED
;
778 if ( state
& wxLIST_STATE_SELECTED
)
779 flags
|= LVNI_SELECTED
;
781 return (long) ListView_GetNextItem(GetHwnd(), item
, flags
);
785 wxImageList
*wxListCtrl::GetImageList(int which
) const
787 if ( which
== wxIMAGE_LIST_NORMAL
)
789 return m_imageListNormal
;
791 else if ( which
== wxIMAGE_LIST_SMALL
)
793 return m_imageListSmall
;
795 else if ( which
== wxIMAGE_LIST_STATE
)
797 return m_imageListState
;
802 void wxListCtrl::SetImageList(wxImageList
*imageList
, int which
)
805 if ( which
== wxIMAGE_LIST_NORMAL
)
807 flags
= LVSIL_NORMAL
;
808 m_imageListNormal
= imageList
;
810 else if ( which
== wxIMAGE_LIST_SMALL
)
813 m_imageListSmall
= imageList
;
815 else if ( which
== wxIMAGE_LIST_STATE
)
818 m_imageListState
= imageList
;
820 ListView_SetImageList(GetHwnd(), (HIMAGELIST
) imageList
? imageList
->GetHIMAGELIST() : 0, flags
);
823 // ----------------------------------------------------------------------------
825 // ----------------------------------------------------------------------------
827 // Arranges the items
828 bool wxListCtrl::Arrange(int flag
)
831 if ( flag
== wxLIST_ALIGN_LEFT
)
832 code
= LVA_ALIGNLEFT
;
833 else if ( flag
== wxLIST_ALIGN_TOP
)
835 else if ( flag
== wxLIST_ALIGN_DEFAULT
)
837 else if ( flag
== wxLIST_ALIGN_SNAP_TO_GRID
)
838 code
= LVA_SNAPTOGRID
;
840 return (ListView_Arrange(GetHwnd(), code
) != 0);
844 bool wxListCtrl::DeleteItem(long item
)
846 return (ListView_DeleteItem(GetHwnd(), (int) item
) != 0);
850 bool wxListCtrl::DeleteAllItems()
852 return (ListView_DeleteAllItems(GetHwnd()) != 0);
856 bool wxListCtrl::DeleteAllColumns()
858 while ( m_colCount
> 0 )
860 if ( ListView_DeleteColumn(GetHwnd(), 0) == 0 )
862 wxLogLastError("ListView_DeleteColumn");
870 wxASSERT_MSG( m_colCount
== 0, wxT("no columns should be left") );
876 bool wxListCtrl::DeleteColumn(int col
)
878 bool success
= (ListView_DeleteColumn(GetHwnd(), col
) != 0);
880 if ( success
&& (m_colCount
> 0) )
885 // Clears items, and columns if there are any.
886 void wxListCtrl::ClearAll()
889 if ( m_colCount
> 0 )
893 wxTextCtrl
* wxListCtrl::EditLabel(long item
, wxClassInfo
* textControlClass
)
895 wxASSERT( (textControlClass
->IsKindOf(CLASSINFO(wxTextCtrl
))) );
897 HWND hWnd
= (HWND
) ListView_EditLabel(GetHwnd(), item
);
901 m_textCtrl
->UnsubclassWin();
902 m_textCtrl
->SetHWND(0);
907 m_textCtrl
= (wxTextCtrl
*) textControlClass
->CreateObject();
908 m_textCtrl
->SetHWND((WXHWND
) hWnd
);
909 m_textCtrl
->SubclassWin((WXHWND
) hWnd
);
914 // End label editing, optionally cancelling the edit
915 bool wxListCtrl::EndEditLabel(bool cancel
)
919 /* I don't know how to implement this: there's no such macro as ListView_EndEditLabelNow.
921 bool success = (ListView_EndEditLabelNow(GetHwnd(), cancel) != 0);
925 m_textCtrl->UnsubclassWin();
926 m_textCtrl->SetHWND(0);
936 // Ensures this item is visible
937 bool wxListCtrl::EnsureVisible(long item
)
939 return (ListView_EnsureVisible(GetHwnd(), (int) item
, FALSE
) != 0);
942 // Find an item whose label matches this string, starting from the item after 'start'
943 // or the beginning if 'start' is -1.
944 long wxListCtrl::FindItem(long start
, const wxString
& str
, bool partial
)
946 LV_FINDINFO findInfo
;
948 findInfo
.flags
= LVFI_STRING
;
950 findInfo
.flags
|= LVFI_STRING
;
951 findInfo
.psz
= WXSTRINGCAST str
;
953 return ListView_FindItem(GetHwnd(), (int) start
, & findInfo
);
956 // Find an item whose data matches this data, starting from the item after 'start'
957 // or the beginning if 'start' is -1.
958 long wxListCtrl::FindItem(long start
, long data
)
960 LV_FINDINFO findInfo
;
962 findInfo
.flags
= LVFI_PARAM
;
963 findInfo
.lParam
= data
;
965 return ListView_FindItem(GetHwnd(), (int) start
, & findInfo
);
968 // Find an item nearest this position in the specified direction, starting from
969 // the item after 'start' or the beginning if 'start' is -1.
970 long wxListCtrl::FindItem(long start
, const wxPoint
& pt
, int direction
)
972 LV_FINDINFO findInfo
;
974 findInfo
.flags
= LVFI_NEARESTXY
;
975 findInfo
.pt
.x
= pt
.x
;
976 findInfo
.pt
.y
= pt
.y
;
977 findInfo
.vkDirection
= VK_RIGHT
;
979 if ( direction
== wxLIST_FIND_UP
)
980 findInfo
.vkDirection
= VK_UP
;
981 else if ( direction
== wxLIST_FIND_DOWN
)
982 findInfo
.vkDirection
= VK_DOWN
;
983 else if ( direction
== wxLIST_FIND_LEFT
)
984 findInfo
.vkDirection
= VK_LEFT
;
985 else if ( direction
== wxLIST_FIND_RIGHT
)
986 findInfo
.vkDirection
= VK_RIGHT
;
988 return ListView_FindItem(GetHwnd(), (int) start
, & findInfo
);
991 // Determines which item (if any) is at the specified point,
992 // giving details in 'flags' (see wxLIST_HITTEST_... flags above)
993 long wxListCtrl::HitTest(const wxPoint
& point
, int& flags
)
995 LV_HITTESTINFO hitTestInfo
;
996 hitTestInfo
.pt
.x
= (int) point
.x
;
997 hitTestInfo
.pt
.y
= (int) point
.y
;
999 ListView_HitTest(GetHwnd(), & hitTestInfo
);
1002 if ( hitTestInfo
.flags
& LVHT_ABOVE
)
1003 flags
|= wxLIST_HITTEST_ABOVE
;
1004 if ( hitTestInfo
.flags
& LVHT_BELOW
)
1005 flags
|= wxLIST_HITTEST_BELOW
;
1006 if ( hitTestInfo
.flags
& LVHT_NOWHERE
)
1007 flags
|= wxLIST_HITTEST_NOWHERE
;
1008 if ( hitTestInfo
.flags
& LVHT_ONITEMICON
)
1009 flags
|= wxLIST_HITTEST_ONITEMICON
;
1010 if ( hitTestInfo
.flags
& LVHT_ONITEMLABEL
)
1011 flags
|= wxLIST_HITTEST_ONITEMLABEL
;
1012 if ( hitTestInfo
.flags
& LVHT_ONITEMSTATEICON
)
1013 flags
|= wxLIST_HITTEST_ONITEMSTATEICON
;
1014 if ( hitTestInfo
.flags
& LVHT_TOLEFT
)
1015 flags
|= wxLIST_HITTEST_TOLEFT
;
1016 if ( hitTestInfo
.flags
& LVHT_TORIGHT
)
1017 flags
|= wxLIST_HITTEST_TORIGHT
;
1019 return (long) hitTestInfo
.iItem
;
1022 // Inserts an item, returning the index of the new item if successful,
1024 long wxListCtrl::InsertItem(wxListItem
& info
)
1027 wxConvertToMSWListItem(this, info
, item
);
1029 return (long) ListView_InsertItem(GetHwnd(), & item
);
1032 long wxListCtrl::InsertItem(long index
, const wxString
& label
)
1035 info
.m_text
= label
;
1036 info
.m_mask
= wxLIST_MASK_TEXT
;
1037 info
.m_itemId
= index
;
1038 return InsertItem(info
);
1041 // Inserts an image item
1042 long wxListCtrl::InsertItem(long index
, int imageIndex
)
1045 info
.m_image
= imageIndex
;
1046 info
.m_mask
= wxLIST_MASK_IMAGE
;
1047 info
.m_itemId
= index
;
1048 return InsertItem(info
);
1051 // Inserts an image/string item
1052 long wxListCtrl::InsertItem(long index
, const wxString
& label
, int imageIndex
)
1055 info
.m_image
= imageIndex
;
1056 info
.m_text
= label
;
1057 info
.m_mask
= wxLIST_MASK_IMAGE
| wxLIST_MASK_TEXT
;
1058 info
.m_itemId
= index
;
1059 return InsertItem(info
);
1062 // For list view mode (only), inserts a column.
1063 long wxListCtrl::InsertColumn(long col
, wxListItem
& item
)
1068 lvCol
.pszText
= NULL
;
1070 if ( item
.m_mask
& wxLIST_MASK_TEXT
)
1072 lvCol
.mask
|= LVCF_TEXT
;
1073 lvCol
.pszText
= WXSTRINGCAST item
.m_text
;
1074 lvCol
.cchTextMax
= 0; // Ignored
1076 if ( item
.m_mask
& wxLIST_MASK_FORMAT
)
1078 lvCol
.mask
|= LVCF_FMT
;
1080 if ( item
.m_format
== wxLIST_FORMAT_LEFT
)
1081 lvCol
.fmt
= LVCFMT_LEFT
;
1082 if ( item
.m_format
== wxLIST_FORMAT_RIGHT
)
1083 lvCol
.fmt
= LVCFMT_RIGHT
;
1084 if ( item
.m_format
== wxLIST_FORMAT_CENTRE
)
1085 lvCol
.fmt
= LVCFMT_CENTER
;
1088 lvCol
.mask
|= LVCF_WIDTH
;
1089 if ( item
.m_mask
& wxLIST_MASK_WIDTH
)
1091 if ( item
.m_width
== wxLIST_AUTOSIZE
)
1092 lvCol
.cx
= LVSCW_AUTOSIZE
;
1093 else if ( item
.m_width
== wxLIST_AUTOSIZE_USEHEADER
)
1094 lvCol
.cx
= LVSCW_AUTOSIZE_USEHEADER
;
1096 lvCol
.cx
= item
.m_width
;
1100 // always give some width to the new column: this one is compatible
1105 lvCol
.mask
|= LVCF_SUBITEM
;
1106 lvCol
.iSubItem
= col
;
1108 bool success
= ListView_InsertColumn(GetHwnd(), col
, & lvCol
) != -1;
1115 wxLogDebug(wxT("Failed to insert the column '%s' into listview!"),
1122 long wxListCtrl::InsertColumn(long col
, const wxString
& heading
, int format
,
1126 item
.m_mask
= wxLIST_MASK_TEXT
| wxLIST_MASK_FORMAT
;
1127 item
.m_text
= heading
;
1130 item
.m_mask
|= wxLIST_MASK_WIDTH
;
1131 item
.m_width
= width
;
1133 item
.m_format
= format
;
1135 return InsertColumn(col
, item
);
1138 // Scrolls the list control. If in icon, small icon or report view mode,
1139 // x specifies the number of pixels to scroll. If in list view mode, x
1140 // specifies the number of columns to scroll.
1141 // If in icon, small icon or list view mode, y specifies the number of pixels
1142 // to scroll. If in report view mode, y specifies the number of lines to scroll.
1143 bool wxListCtrl::ScrollList(int dx
, int dy
)
1145 return (ListView_Scroll(GetHwnd(), dx
, dy
) != 0);
1150 // fn is a function which takes 3 long arguments: item1, item2, data.
1151 // item1 is the long data associated with a first item (NOT the index).
1152 // item2 is the long data associated with a second item (NOT the index).
1153 // data is the same value as passed to SortItems.
1154 // The return value is a negative number if the first item should precede the second
1155 // item, a positive number of the second item should precede the first,
1156 // or zero if the two items are equivalent.
1158 // data is arbitrary data to be passed to the sort function.
1159 bool wxListCtrl::SortItems(wxListCtrlCompare fn
, long data
)
1161 return (ListView_SortItems(GetHwnd(), (PFNLVCOMPARE
) fn
, data
) != 0);
1164 // ----------------------------------------------------------------------------
1165 // message processing
1166 // ----------------------------------------------------------------------------
1168 bool wxListCtrl::MSWCommand(WXUINT cmd
, WXWORD id
)
1170 if (cmd
== EN_UPDATE
)
1172 wxCommandEvent
event(wxEVT_COMMAND_TEXT_UPDATED
, id
);
1173 event
.SetEventObject( this );
1174 ProcessCommand(event
);
1177 else if (cmd
== EN_KILLFOCUS
)
1179 wxCommandEvent
event(wxEVT_KILL_FOCUS
, id
);
1180 event
.SetEventObject( this );
1181 ProcessCommand(event
);
1188 bool wxListCtrl::MSWOnNotify(int idCtrl
, WXLPARAM lParam
, WXLPARAM
*result
)
1190 wxListEvent
event(wxEVT_NULL
, m_windowId
);
1191 wxEventType eventType
= wxEVT_NULL
;
1192 NMHDR
*hdr1
= (NMHDR
*) lParam
;
1193 switch ( hdr1
->code
)
1195 case LVN_BEGINRDRAG
:
1196 eventType
= wxEVT_COMMAND_LIST_BEGIN_RDRAG
;
1200 if ( eventType
== wxEVT_NULL
)
1202 eventType
= wxEVT_COMMAND_LIST_BEGIN_DRAG
;
1206 NM_LISTVIEW
*hdr
= (NM_LISTVIEW
*)lParam
;
1207 event
.m_itemIndex
= hdr
->iItem
;
1208 event
.m_pointDrag
.x
= hdr
->ptAction
.x
;
1209 event
.m_pointDrag
.y
= hdr
->ptAction
.y
;
1213 case LVN_BEGINLABELEDIT
:
1215 eventType
= wxEVT_COMMAND_LIST_BEGIN_LABEL_EDIT
;
1216 LV_DISPINFO
*info
= (LV_DISPINFO
*)lParam
;
1217 wxConvertFromMSWListItem(this, event
.m_item
, info
->item
, GetHwnd());
1221 case LVN_COLUMNCLICK
:
1223 eventType
= wxEVT_COMMAND_LIST_COL_CLICK
;
1224 NM_LISTVIEW
* hdr
= (NM_LISTVIEW
*)lParam
;
1225 event
.m_itemIndex
= -1;
1226 event
.m_col
= hdr
->iSubItem
;
1230 case LVN_DELETEALLITEMS
:
1231 // what's the sense of generating a wxWin event for this when
1232 // it's absolutely not portable?
1234 eventType
= wxEVT_COMMAND_LIST_DELETE_ALL_ITEMS
;
1235 event
.m_itemIndex
= -1;
1238 // return TRUE to suppress all additional LVN_DELETEITEM
1239 // notifications - this makes deleting all items from a list ctrl
1244 case LVN_DELETEITEM
:
1246 eventType
= wxEVT_COMMAND_LIST_DELETE_ITEM
;
1247 NM_LISTVIEW
* hdr
= (NM_LISTVIEW
*)lParam
;
1248 event
.m_itemIndex
= hdr
->iItem
;
1251 case LVN_ENDLABELEDIT
:
1253 eventType
= wxEVT_COMMAND_LIST_END_LABEL_EDIT
;
1254 LV_DISPINFO
*info
= (LV_DISPINFO
*)lParam
;
1255 wxConvertFromMSWListItem(this, event
.m_item
, info
->item
);
1256 if ( info
->item
.pszText
== NULL
|| info
->item
.iItem
== -1 )
1260 case LVN_GETDISPINFO
:
1263 // this provokes stack overflow: indeed, wxConvertFromMSWListItem()
1264 // sends us WM_NOTIFY! As it doesn't do anything for now, just leave
1268 // TODO: some text buffering here, I think
1269 // TODO: API for getting Windows to retrieve values
1271 eventType
= wxEVT_COMMAND_LIST_GET_INFO
;
1272 LV_DISPINFO
*info
= (LV_DISPINFO
*)lParam
;
1273 wxConvertFromMSWListItem(this, event
.m_item
, info
->item
, GetHwnd());
1278 case LVN_INSERTITEM
:
1280 eventType
= wxEVT_COMMAND_LIST_INSERT_ITEM
;
1281 NM_LISTVIEW
* hdr
= (NM_LISTVIEW
*)lParam
;
1282 event
.m_itemIndex
= hdr
->iItem
;
1285 case LVN_ITEMCHANGED
:
1287 // This needs to be sent to wxListCtrl as a rather more
1288 // concrete event. For now, just detect a selection
1290 NM_LISTVIEW
* hdr
= (NM_LISTVIEW
*)lParam
;
1291 if ( (hdr
->uNewState
& LVIS_SELECTED
) && !(hdr
->uOldState
& LVIS_SELECTED
) )
1293 eventType
= wxEVT_COMMAND_LIST_ITEM_SELECTED
;
1294 event
.m_itemIndex
= hdr
->iItem
;
1296 else if ( !(hdr
->uNewState
& LVIS_SELECTED
) && (hdr
->uOldState
& LVIS_SELECTED
) )
1298 eventType
= wxEVT_COMMAND_LIST_ITEM_DESELECTED
;
1299 event
.m_itemIndex
= hdr
->iItem
;
1308 LV_KEYDOWN
*info
= (LV_KEYDOWN
*)lParam
;
1309 WORD wVKey
= info
->wVKey
;
1311 // get the current selection
1312 long lItem
= GetNextItem(-1,
1314 wxLIST_STATE_SELECTED
);
1316 // <Enter> or <Space> activate the selected item if any
1317 if ( lItem
!= -1 && (wVKey
== VK_RETURN
|| wVKey
== VK_SPACE
) )
1319 // TODO this behaviour probably should be optional
1320 eventType
= wxEVT_COMMAND_LIST_ITEM_ACTIVATED
;
1321 event
.m_itemIndex
= lItem
;
1325 eventType
= wxEVT_COMMAND_LIST_KEY_DOWN
;
1326 event
.m_code
= wxCharCodeMSWToWX(wVKey
);
1332 // if the user processes it in wxEVT_COMMAND_LEFT_CLICK(), don't do
1334 if ( wxControl::MSWOnNotify(idCtrl
, lParam
, result
) )
1339 // else translate it into wxEVT_COMMAND_LIST_ITEM_ACTIVATED event
1341 eventType
= wxEVT_COMMAND_LIST_ITEM_ACTIVATED
;
1342 NM_LISTVIEW
* hdr
= (NM_LISTVIEW
*)lParam
;
1343 event
.m_itemIndex
= hdr
->iItem
;
1348 /* TECH NOTE: NM_RCLICK isn't really good enough here. We want to
1349 subclass and check for the actual WM_RBUTTONDOWN message, because
1350 NM_RCLICK waits for the WM_RBUTTONUP message as well before firing off.
1351 We want to have notify events for both down -and- up. */
1353 // if the user processes it in wxEVT_COMMAND_RIGHT_CLICK(), don't do
1355 if ( wxControl::MSWOnNotify(idCtrl
, lParam
, result
) ) {
1359 // else translate it into wxEVT_COMMAND_LIST_ITEM_RIGHT_CLICK event
1360 LV_HITTESTINFO lvhti
;
1361 wxZeroMemory(lvhti
);
1363 ::GetCursorPos(&(lvhti
.pt
));
1364 ::ScreenToClient(GetHwnd(),&(lvhti
.pt
));
1365 if ( ListView_HitTest(GetHwnd(),&lvhti
) != -1 )
1367 // older headers don't have this symbol
1369 #define LVHT_ONITEM \
1370 (LVHT_ONITEMICON | LVHT_ONITEMLABEL | LVHT_ONITEMSTATEICON)
1372 if ( lvhti
.flags
& LVHT_ONITEM
)
1374 eventType
= wxEVT_COMMAND_LIST_ITEM_RIGHT_CLICK
;
1375 event
.m_itemIndex
= lvhti
.iItem
;
1382 case NM_MCLICK: // ***** THERE IS NO NM_MCLICK. Subclass anyone? ******
1384 // if the user processes it in wxEVT_COMMAND_MIDDLE_CLICK(), don't do
1386 if ( wxControl::MSWOnNotify(idCtrl, lParam, result) )
1391 // else translate it into wxEVT_COMMAND_LIST_ITEM_MIDDLE_CLICK event
1392 eventType = wxEVT_COMMAND_LIST_ITEM_MIDDLE_CLICK;
1393 NMITEMACTIVATE* hdr = (NMITEMACTIVATE*)lParam;
1394 event.m_itemIndex = hdr->iItem;
1399 case LVN_SETDISPINFO
:
1401 eventType
= wxEVT_COMMAND_LIST_SET_INFO
;
1402 LV_DISPINFO
*info
= (LV_DISPINFO
*)lParam
;
1403 wxConvertFromMSWListItem(this, event
.m_item
, info
->item
, GetHwnd());
1408 return wxControl::MSWOnNotify(idCtrl
, lParam
, result
);
1411 event
.SetEventObject( this );
1412 event
.SetEventType(eventType
);
1414 if ( !GetEventHandler()->ProcessEvent(event
) )
1417 switch ((int)hdr1
->code
)
1419 case LVN_GETDISPINFO
:
1421 LV_DISPINFO
*info
= (LV_DISPINFO
*)lParam
;
1422 if ( info
->item
.mask
& LVIF_TEXT
)
1424 if ( !event
.m_item
.m_text
.IsNull() )
1426 info
->item
.pszText
= AddPool(event
.m_item
.m_text
);
1427 info
->item
.cchTextMax
= wxStrlen(info
->item
.pszText
) + 1;
1430 // wxConvertToMSWListItem(this, event.m_item, info->item);
1433 case LVN_ENDLABELEDIT
:
1435 *result
= event
.IsAllowed();
1442 *result
= !event
.IsAllowed();
1447 wxChar
*wxListCtrl::AddPool(const wxString
& str
)
1449 // Remove the first element if 3 strings exist
1450 if ( m_stringPool
.Number() == 3 )
1452 wxNode
*node
= m_stringPool
.First();
1453 delete[] (char *)node
->Data();
1456 wxNode
*node
= m_stringPool
.Add(WXSTRINGCAST str
);
1457 return (wxChar
*)node
->Data();
1460 // ----------------------------------------------------------------------------
1462 // ----------------------------------------------------------------------------
1464 // List item structure
1465 wxListItem::wxListItem()
1475 m_format
= wxLIST_FORMAT_CENTRE
;
1479 static void wxConvertFromMSWListItem(const wxListCtrl
*ctrl
, wxListItem
& info
, LV_ITEM
& lvItem
, HWND getFullInfo
)
1481 info
.m_data
= lvItem
.lParam
;
1484 info
.m_stateMask
= 0;
1485 info
.m_itemId
= lvItem
.iItem
;
1487 long oldMask
= lvItem
.mask
;
1489 bool needText
= FALSE
;
1490 if (getFullInfo
!= 0)
1492 if ( lvItem
.mask
& LVIF_TEXT
)
1499 lvItem
.pszText
= new wxChar
[513];
1500 lvItem
.cchTextMax
= 512;
1502 // lvItem.mask |= TVIF_HANDLE | TVIF_STATE | TVIF_TEXT | TVIF_IMAGE | TVIF_SELECTEDIMAGE | TVIF_CHILDREN | TVIF_PARAM;
1503 lvItem
.mask
|= LVIF_TEXT
| LVIF_IMAGE
| LVIF_PARAM
;
1504 ::SendMessage(getFullInfo
, LVM_GETITEM
, 0, (LPARAM
)& lvItem
);
1507 if ( lvItem
.mask
& LVIF_STATE
)
1509 info
.m_mask
|= wxLIST_MASK_STATE
;
1511 if ( lvItem
.stateMask
& LVIS_CUT
)
1513 info
.m_stateMask
|= wxLIST_STATE_CUT
;
1514 if ( lvItem
.state
& LVIS_CUT
)
1515 info
.m_state
|= wxLIST_STATE_CUT
;
1517 if ( lvItem
.stateMask
& LVIS_DROPHILITED
)
1519 info
.m_stateMask
|= wxLIST_STATE_DROPHILITED
;
1520 if ( lvItem
.state
& LVIS_DROPHILITED
)
1521 info
.m_state
|= wxLIST_STATE_DROPHILITED
;
1523 if ( lvItem
.stateMask
& LVIS_FOCUSED
)
1525 info
.m_stateMask
|= wxLIST_STATE_FOCUSED
;
1526 if ( lvItem
.state
& LVIS_FOCUSED
)
1527 info
.m_state
|= wxLIST_STATE_FOCUSED
;
1529 if ( lvItem
.stateMask
& LVIS_SELECTED
)
1531 info
.m_stateMask
|= wxLIST_STATE_SELECTED
;
1532 if ( lvItem
.state
& LVIS_SELECTED
)
1533 info
.m_state
|= wxLIST_STATE_SELECTED
;
1537 if ( lvItem
.mask
& LVIF_TEXT
)
1539 info
.m_mask
|= wxLIST_MASK_TEXT
;
1540 info
.m_text
= lvItem
.pszText
;
1542 if ( lvItem
.mask
& LVIF_IMAGE
)
1544 info
.m_mask
|= wxLIST_MASK_IMAGE
;
1545 info
.m_image
= lvItem
.iImage
;
1547 if ( lvItem
.mask
& LVIF_PARAM
)
1548 info
.m_mask
|= wxLIST_MASK_DATA
;
1549 if ( lvItem
.mask
& LVIF_DI_SETITEM
)
1550 info
.m_mask
|= wxLIST_SET_ITEM
;
1551 info
.m_col
= lvItem
.iSubItem
;
1556 delete[] lvItem
.pszText
;
1558 lvItem
.mask
= oldMask
;
1561 static void wxConvertToMSWListItem(const wxListCtrl
*ctrl
, wxListItem
& info
, LV_ITEM
& lvItem
)
1563 lvItem
.iItem
= (int) info
.m_itemId
;
1565 lvItem
.iImage
= info
.m_image
;
1566 lvItem
.lParam
= info
.m_data
;
1567 lvItem
.stateMask
= 0;
1570 lvItem
.iSubItem
= info
.m_col
;
1572 if (info
.m_mask
& wxLIST_MASK_STATE
)
1574 lvItem
.mask
|= LVIF_STATE
;
1575 if (info
.m_stateMask
& wxLIST_STATE_CUT
)
1577 lvItem
.stateMask
|= LVIS_CUT
;
1578 if (info
.m_state
& wxLIST_STATE_CUT
)
1579 lvItem
.state
|= LVIS_CUT
;
1581 if (info
.m_stateMask
& wxLIST_STATE_DROPHILITED
)
1583 lvItem
.stateMask
|= LVIS_DROPHILITED
;
1584 if (info
.m_state
& wxLIST_STATE_DROPHILITED
)
1585 lvItem
.state
|= LVIS_DROPHILITED
;
1587 if (info
.m_stateMask
& wxLIST_STATE_FOCUSED
)
1589 lvItem
.stateMask
|= LVIS_FOCUSED
;
1590 if (info
.m_state
& wxLIST_STATE_FOCUSED
)
1591 lvItem
.state
|= LVIS_FOCUSED
;
1593 if (info
.m_stateMask
& wxLIST_STATE_SELECTED
)
1595 lvItem
.stateMask
|= LVIS_SELECTED
;
1596 if (info
.m_state
& wxLIST_STATE_SELECTED
)
1597 lvItem
.state
|= LVIS_SELECTED
;
1601 if (info
.m_mask
& wxLIST_MASK_TEXT
)
1603 lvItem
.mask
|= LVIF_TEXT
;
1604 if ( ctrl
->GetWindowStyleFlag() & wxLC_USER_TEXT
)
1606 lvItem
.pszText
= LPSTR_TEXTCALLBACK
;
1610 lvItem
.pszText
= WXSTRINGCAST info
.m_text
;
1611 if ( lvItem
.pszText
)
1612 lvItem
.cchTextMax
= info
.m_text
.Length();
1614 lvItem
.cchTextMax
= 0;
1617 if (info
.m_mask
& wxLIST_MASK_IMAGE
)
1618 lvItem
.mask
|= LVIF_IMAGE
;
1619 if (info
.m_mask
& wxLIST_MASK_DATA
)
1620 lvItem
.mask
|= LVIF_PARAM
;
1623 // ----------------------------------------------------------------------------
1625 // ----------------------------------------------------------------------------
1627 IMPLEMENT_DYNAMIC_CLASS(wxListEvent
, wxNotifyEvent
)
1629 wxListEvent::wxListEvent(wxEventType commandType
, int id
)
1630 : wxNotifyEvent(commandType
, id
)
1636 m_cancelled
= FALSE
;