Merge branch listctrl-with-checkboxes

Add support for native checkboxes to wxMSW wxListCtrl.

Closes https://github.com/wxWidgets/wxWidgets/pull/153
This commit is contained in:
Vadim Zeitlin
2016-02-06 01:05:01 +01:00
8 changed files with 209 additions and 0 deletions

View File

@@ -256,6 +256,12 @@ enum
@event{EVT_LIST_CACHE_HINT(id, func)}
Prepare cache for a virtual list control.
Processes a @c wxEVT_LIST_CACHE_HINT event type.
@event{EVT_LIST_ITEM_CHECKED(id, func)}
The item has been checked.
Processes a @c wxEVT_LIST_ITEM_CHECKED event type (new since wxWidgets 3.1.0).
@event{EVT_LIST_ITEM_UNCHECKED(id, func)}
The item has been unchecked.
Processes a @c wxEVT_LIST_ITEM_UNCHECKED event type (new since wxWidgets 3.1.0).
@endEventTable
@note Under wxMSW this control uses wxSystemThemedControl for an explorer
@@ -1221,6 +1227,52 @@ public:
*/
bool SortItems(wxListCtrlCompare fnSortCallBack, wxIntPtr data);
/**
Returns true if checkboxes are enabled for list items.
@see EnableCheckboxes()
@since 3.1.0
*/
bool HasCheckboxes() const;
/**
Enable or disable checkboxes for list items.
This method is only implemented for wxMSW native control currently, it
will always simply return false in the other ports.
@param enable If @true, enable checkboxes, otherwise disable checkboxes.
@return @true if checkboxes are supported, @false otherwise.
@since 3.1.0
*/
void EnableCheckboxes(bool enable = true);
/**
Return true if the checkbox for the given wxListItem is checked.
Always returns false if checkboxes support hadn't been enabled.
@param item Item (zero-based) index.
@since 3.1.0
*/
bool IsItemChecked(long item) const;
/**
Check or uncheck a wxListItem in a control using checkboxes.
This method only works if checkboxes support had been successfully
enabled using EnableCheckboxes().
@param item Item (zero-based) index.
@param check If @true, check the item, otherwise uncheck.
@since 3.1.0
*/
void CheckItem(long item, bool check);
protected:
/**
@@ -1343,6 +1395,10 @@ protected:
A column has been resized by the user.
@event{EVT_LIST_CACHE_HINT(id, func)}
Prepare cache for a virtual list control
@event{EVT_LIST_ITEM_CHECKED(id, func)}
The item has been checked (new since wxWidgets 3.1.0).
@event{EVT_LIST_ITEM_UNCHECKED(id, func)}
The item has been unchecked (new since wxWidgets 3.1.0).
@endEventTable
@@ -1456,6 +1512,8 @@ wxEventType wxEVT_LIST_COL_BEGIN_DRAG;
wxEventType wxEVT_LIST_COL_DRAGGING;
wxEventType wxEVT_LIST_COL_END_DRAG;
wxEventType wxEVT_LIST_ITEM_FOCUSED;
wxEventType wxEVT_LIST_ITEM_CHECKED;
wxEventType wxEVT_LIST_ITEM_UNCHECKED;
/**