[gtkmm] ListBox: Add append() for clarity



commit 8ebc2706bdc39fda226ff13ae52c12f7db39fddb
Author: Murray Cumming <murrayc murrayc com>
Date:   Thu Sep 19 13:42:01 2013 +0200

    ListBox: Add append() for clarity
    
    * gtk/src/listbox.[hg|ccg]:
      Even though it is not in the GTK+ API.

 gtk/src/listbox.ccg |    5 +++++
 gtk/src/listbox.hg  |   11 +++++++++++
 2 files changed, 16 insertions(+), 0 deletions(-)
---
diff --git a/gtk/src/listbox.ccg b/gtk/src/listbox.ccg
index d791275..23fbe68 100644
--- a/gtk/src/listbox.ccg
+++ b/gtk/src/listbox.ccg
@@ -145,4 +145,9 @@ void ListBox::unset_header_func()
   gtk_list_box_set_header_func(gobj(), 0, 0, 0);
 }
 
+void ListBox::append(Widget& child)
+{
+  insert(child, -1);
+}
+
 } //namespace Gtk
diff --git a/gtk/src/listbox.hg b/gtk/src/listbox.hg
index 9fc1ecd..09ec21c 100644
--- a/gtk/src/listbox.hg
+++ b/gtk/src/listbox.hg
@@ -95,6 +95,17 @@ public:
 
   _WRAP_METHOD(void prepend(Widget& child), gtk_list_box_prepend)
   _WRAP_METHOD(void insert(Widget& child, int position), gtk_list_box_insert)
+
+  //We added this in the gtkmm API, because this is clearer than the magic -1 value for position with 
insert().
+  /** Append a widget to the list. If a sort function is set, the widget will
+   * actually be inserted at the calculated position and this function has the
+   * same effect of Gtk::Container::add().
+   * 
+   * @newin{3,10}
+   * @param child The Gtk::Widget to add.
+   */
+  void append(Widget& child);
+
   _WRAP_METHOD(ListBoxRow* get_selected_row(), gtk_list_box_get_selected_row)
   _WRAP_METHOD(const ListBoxRow* get_selected_row() const, gtk_list_box_get_selected_row, constversion)
   _WRAP_METHOD(ListBoxRow* get_row_at_index(int index), gtk_list_box_get_row_at_index)



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]