]> de.git.xonotic.org Git - xonotic/netradiant.git/blobdiff - libs/uilib/uilib.h
GTK: wrap gtk_list_store_{append,set}
[xonotic/netradiant.git] / libs / uilib / uilib.h
index c6a3bb1fb1ff2bd858b234dbda6338f63ce0e808..482d720af0f2aef8ae831cf203746c7c8641796b 100644 (file)
@@ -31,6 +31,7 @@ struct _GtkImage;
 struct _GtkItem;
 struct _GtkLabel;
 struct _GtkListStore;
+struct _GtkTreeIter;
 struct _GtkMenu;
 struct _GtkMenuBar;
 struct _GtkMenuItem;
@@ -524,6 +525,9 @@ namespace ui {
     WRAP(ListStore, Object, _GtkListStore, (ITreeModel),
     ,
          void clear();
+
+         template<class... T>
+         void append(T... args);
     );
 
     WRAP(TreeSelection, Object, _GtkTreeSelection, (),
@@ -580,6 +584,18 @@ namespace ui {
         gtk_container_foreach(this, cb, &lambda);
     }
 
+    namespace {
+        extern "C" {
+        void gtk_list_store_insert_with_values(_GtkListStore *, _GtkTreeIter *, gint position, ...);
+        }
+    }
+
+    template<class... T>
+    void IListStore::append(T... args) {
+        static_assert(sizeof...(args) % 2 == 0, "received an odd number of arguments");
+        gtk_list_store_insert_with_values(this, NULL, -1, args..., -1);
+    }
+
 #undef this
 
 }