From 57563d06e9947380a2cf4a7f97ca5835c4bd8b2b Mon Sep 17 00:00:00 2001 From: Stijn Buys Date: Sun, 10 Mar 2013 14:04:08 +0000 Subject: Improved ui::ListView::sort(). --- src/ui/listview.h | 20 ++++++++------------ 1 file changed, 8 insertions(+), 12 deletions(-) (limited to 'src/ui/listview.h') diff --git a/src/ui/listview.h b/src/ui/listview.h index b4c00dc..7678b8b 100644 --- a/src/ui/listview.h +++ b/src/ui/listview.h @@ -41,6 +41,11 @@ public: } /* -- mutators --------------------------------------------- */ + + /** + * @brief add a new item + * */ + ListItem *add_item(const std::string & text); /// set scroll void set_scroll(float scroll); @@ -51,7 +56,7 @@ public: /// scroll up void dec_scroll(float scroll); - /// clear all listitems + /// delete all listitems void clear(); /// set selection to specified ListItem @@ -61,18 +66,9 @@ public: void deselect(); /** - * @brief sort child ListItems according to their sortkey - * Sort will fail with an assert error if the ListView - * contains any non-ListItem child widgets - * */ - void sort(); - - /** - * @brief reverse sort child ListItems according to their sortkey - * Sort will fail with an assert error if the ListView - * contains any non-ListItem child widgets + * @brief sort listitems according to their sortkey * */ - void sort_reverse(); + void sort(bool ascending = true); protected: virtual void resize(); -- cgit v1.2.3