diff --git a/include/wx/listbase.h b/include/wx/listbase.h index ca2ead8fce..8b1da7599c 100644 --- a/include/wx/listbase.h +++ b/include/wx/listbase.h @@ -381,6 +381,9 @@ public: // Return the current number of items. virtual int GetItemCount() const = 0; + // Check if the control is empty, i.e. doesn't contain any items. + bool IsEmpty() const { return GetItemCount() == 0; } + // Return the current number of columns. virtual int GetColumnCount() const = 0; diff --git a/interface/wx/listctrl.h b/interface/wx/listctrl.h index 0ce697c8bc..62095187ac 100644 --- a/interface/wx/listctrl.h +++ b/interface/wx/listctrl.h @@ -950,6 +950,16 @@ public: long InsertItem(long index, const wxString& label, int imageIndex); + /** + Returns true if the control doesn't currently contain any items. + + Note that the control with some columns is still considered to be empty + if it has no rows. + + @since 3.1.3 + */ + bool IsEmpty() const; + /** Returns true if the control is currently in virtual report view. */