Merge branch 'listctrl-checkboxes-generic' of https://github.com/MaartenBent/wxWidgets

Implement checkboxes support for the generic version of wxListCtrl too so it's
not available under all platforms.
This commit is contained in:
Vadim Zeitlin
2016-02-06 19:18:58 +01:00
4 changed files with 134 additions and 5 deletions

View File

@@ -200,6 +200,8 @@ public:
// is this item selected? [NB: not used in virtual mode]
bool m_highlighted;
bool m_checked;
// back pointer to the list ctrl
wxListMainWindow *m_owner;
@@ -249,6 +251,9 @@ public:
void SetImage( int index, int image );
int GetImage( int index ) const;
void Check(bool check) { m_checked = check; }
bool IsChecked() { return m_checked; }
bool HasImage() const { return GetImage() != -1; }
bool HasText() const { return !GetText(0).empty(); }
@@ -636,6 +641,11 @@ public:
bool GetItemPosition( long item, wxPoint& pos ) const;
int GetSelectedItemCount() const;
bool HasCheckboxes() const;
bool EnableCheckboxes(bool enable = true);
bool IsItemChecked(long item) const;
void CheckItem(long item, bool check);
wxString GetItemText(long item, int col = 0) const
{
wxListItem info;
@@ -779,6 +789,8 @@ protected:
m_lineBeforeLastClicked,
m_lineSelectSingleOnUp;
bool m_hasCheckboxes;
protected:
wxWindow *GetMainWindowOfCompositeControl() wxOVERRIDE { return GetParent(); }
@@ -838,6 +850,10 @@ private:
// Compute the minimal width needed to fully display the column header.
int ComputeMinHeaderWidth(const wxListHeaderData* header) const;
// Check if the given point is inside the checkbox of this item.
//
// Always returns false if there are no checkboxes.
bool IsInsideCheckbox(long item, int x, int y);
// the height of one line using the current font
wxCoord m_lineHeight;