]> git.rm.cloudns.org Git - xonotic/netradiant.git/commitdiff
Wrap GtkTreeView
authorTimePath <andrew.hardaker1995@gmail.com>
Wed, 17 Feb 2016 02:36:12 +0000 (13:36 +1100)
committerTimePath <andrew.hardaker1995@gmail.com>
Wed, 17 Feb 2016 02:36:12 +0000 (13:36 +1100)
libs/uilib/uilib.cpp
libs/uilib/uilib.h
radiant/build.cpp
radiant/commands.cpp
radiant/entityinspector.cpp
radiant/feedback.cpp
radiant/map.cpp
radiant/preferences.cpp
radiant/texwindow.cpp

index 0ab8e955865cc72db58b48b90030447e236d8468..08f4b1c7e99d809464a97b8c932bab8179e20b0d 100644 (file)
@@ -94,4 +94,7 @@ namespace ui {
     Label::Label(const char *label) : Label(GTK_LABEL(gtk_label_new(label)))
     { }
 
+    TreeView::TreeView(TreeModel model) : TreeView(GTK_TREE_VIEW(gtk_tree_view_new_with_model(model)))
+    { }
+
 }
index 17a764108bd48d142899dd1fc715207712a3a2ad..fb726994658a9ac0b4e2088d1fba0ef11e4e80f6 100644 (file)
@@ -9,6 +9,8 @@ using ui_evkey = struct _GdkEventKey;
 using ui_label = struct _GtkLabel;
 using ui_menuitem = struct _GtkMenuItem;
 using ui_modal = struct ModalDialog;
+using ui_treemodel = struct _GtkTreeModel;
+using ui_treeview = struct _GtkTreeView;
 using ui_typeinst = struct _GTypeInstance;
 using ui_widget = struct _GtkWidget;
 using ui_window = struct _GtkWindow;
@@ -88,7 +90,7 @@ namespace ui {
 
     extern Widget root;
 
-#define WIDGET(name, impl, methods) \
+#define WRAP(name, impl, methods) \
     class name : public Widget, public Convertible<name, impl> { \
         public: \
             explicit name(impl *h = nullptr) : Widget(reinterpret_cast<ui_widget *>(h)) {} \
@@ -96,7 +98,7 @@ namespace ui {
     }; \
     static_assert(sizeof(name) == sizeof(Widget), "object slicing")
 
-    WIDGET(Window, ui_window,
+    WRAP(Window, ui_window,
            Window create_dialog_window(const char *title, void func(), void *data, int default_w = -1,
                                        int default_h = -1);
 
@@ -109,24 +111,32 @@ namespace ui {
                                               void *extra = nullptr);
     );
 
-    WIDGET(Button, ui_button,
+    WRAP(Button, ui_button,
            Button(const char *label);
     );
 
-    WIDGET(CheckButton, ui_widget,);
+    WRAP(CheckButton, ui_widget,);
 
-    WIDGET(SpinButton, ui_widget,);
+    WRAP(SpinButton, ui_widget,);
 
-    WIDGET(MenuItem, ui_menuitem,);
+    WRAP(MenuItem, ui_menuitem,);
 
-    WIDGET(Label, ui_label,
+    WRAP(Label, ui_label,
            Label(const char *label);
     );
 
-    WIDGET(Alignment, ui_alignment,
+    WRAP(Alignment, ui_alignment,
            Alignment(float xalign, float yalign, float xscale, float yscale);
     );
 
+    WRAP(TreeModel, ui_treemodel, );
+
+    WRAP(TreeView, ui_treeview,
+         TreeView(TreeModel model);
+    );
+
+#undef WRAP
+
 }
 
 #endif
index 4ba1e9139e8d77733c6c56573de19556b2526e6c..7294df5ca28c3669d570a5ff80c56d9bd3fa58a8 100644 (file)
@@ -879,7 +879,7 @@ ui::Window BuildMenuDialog_construct( ModalDialog& modal, ProjectList& projectLi
                                {
                                        GtkListStore* store = gtk_list_store_new( 1, G_TYPE_STRING );
 
-                                       ui::Widget view = ui::Widget(gtk_tree_view_new_with_model( GTK_TREE_MODEL( store ) ));
+                                       ui::Widget view = ui::TreeView( ui::TreeModel(GTK_TREE_MODEL( store ) ));
                                        gtk_tree_view_set_headers_visible( GTK_TREE_VIEW( view ), FALSE );
 
                                        GtkCellRenderer* renderer = gtk_cell_renderer_text_new();
@@ -916,7 +916,7 @@ ui::Window BuildMenuDialog_construct( ModalDialog& modal, ProjectList& projectLi
                                {
                                        GtkListStore* store = gtk_list_store_new( 1, G_TYPE_STRING );
 
-                                       ui::Widget view = ui::Widget(gtk_tree_view_new_with_model( GTK_TREE_MODEL( store ) ));
+                                       ui::Widget view = ui::TreeView(ui::TreeModel( GTK_TREE_MODEL( store ) ));
                                        gtk_tree_view_set_headers_visible( GTK_TREE_VIEW( view ), FALSE );
 
                                        GtkCellRenderer* renderer = gtk_cell_renderer_text_new();
index 7cf2d3445a8a3376d1deba7414bbc6eeac87e127..eb3afaa4d53ef116b0e75252f577b21676a94c03 100644 (file)
@@ -406,7 +406,7 @@ void DoCommandListDlg(){
                {
                        GtkListStore* store = gtk_list_store_new( 4, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_BOOLEAN, G_TYPE_INT );
 
-                       ui::Widget view = ui::Widget(gtk_tree_view_new_with_model(GTK_TREE_MODEL(store)));
+                       ui::Widget view = ui::TreeView(ui::TreeModel(GTK_TREE_MODEL(store)));
                        dialog.m_list = GTK_TREE_VIEW( view );
 
                        gtk_tree_view_set_enable_search( GTK_TREE_VIEW( view ), false ); // annoying
index 087ea62b93d89b51ec6c8cbb380e4ffa2b591c3c..7eb95ff1d0fdb14ca683755e2588da8ae09212b6 100644 (file)
@@ -1419,7 +1419,7 @@ ui::Widget EntityInspector_constructWindow( ui::Window toplevel ){
                                        {
                                                GtkListStore* store = gtk_list_store_new( 2, G_TYPE_STRING, G_TYPE_STRING );
 
-                                               ui::Widget view = ui::Widget(gtk_tree_view_new_with_model( GTK_TREE_MODEL( store ) ));
+                                               ui::Widget view = ui::TreeView(ui::TreeModel( GTK_TREE_MODEL( store ) ));
                                                gtk_tree_view_set_enable_search( GTK_TREE_VIEW( view ), FALSE );
                                                gtk_tree_view_set_headers_visible( GTK_TREE_VIEW( view ), FALSE );
 
index 0c7632c910d00f11a37017b880e2c22f1ab440ce..e823341b149e20737043436568ee67eff99d0e6c 100644 (file)
@@ -307,7 +307,7 @@ ui::Window CDbgDlg::BuildDialog(){
        {
                GtkListStore* store = gtk_list_store_new( 1, G_TYPE_STRING );
 
-               ui::Widget view = ui::Widget(gtk_tree_view_new_with_model( GTK_TREE_MODEL( store ) ));
+               ui::Widget view = ui::TreeView(ui::TreeModel( GTK_TREE_MODEL( store ) ));
                gtk_tree_view_set_headers_visible( GTK_TREE_VIEW( view ), FALSE );
 
                {
index 0de6707fe37b8bb4fbe28d42928013e2536c09fb..ea6fd8a03b8148fff9e81177fcb56dd3740f5180 100644 (file)
@@ -846,7 +846,7 @@ void DoMapInfo(){
                        {
                                GtkListStore* store = gtk_list_store_new( 2, G_TYPE_STRING, G_TYPE_STRING );
 
-                               ui::Widget view = ui::Widget(gtk_tree_view_new_with_model( GTK_TREE_MODEL( store ) ));
+                               ui::Widget view = ui::TreeView(ui::TreeModel( GTK_TREE_MODEL( store ) ));
                                gtk_tree_view_set_headers_clickable( GTK_TREE_VIEW( view ), TRUE );
 
                                {
index c84538a700f3916935efabc5e9fb1e084abfae8b..f93f6b45e1ac5be75411d1d4be6d15f79e06bf79 100644 (file)
@@ -751,7 +751,7 @@ ui::Window PrefsDlg::BuildDialog(){
                                {
                                        GtkTreeStore* store = gtk_tree_store_new( 2, G_TYPE_STRING, G_TYPE_POINTER );
 
-                                       ui::Widget view = ui::Widget(gtk_tree_view_new_with_model( GTK_TREE_MODEL( store ) ));
+                                       ui::Widget view = ui::TreeView(ui::TreeModel( GTK_TREE_MODEL( store ) ));
                                        gtk_tree_view_set_headers_visible( GTK_TREE_VIEW( view ), FALSE );
 
                                        {
index ae4b57af74af551f18de849121b07f7361916bfa..7c8808df2246883322242a0e73c2eeda146d022e 100644 (file)
@@ -2080,7 +2080,7 @@ ui::Widget TextureBrowser_constructWindow( ui::Window toplevel ){
 
                        GtkCellRenderer* renderer = gtk_cell_renderer_text_new();
 
-                       g_TextureBrowser.m_assigned_tree = ui::Widget(gtk_tree_view_new_with_model( GTK_TREE_MODEL( g_TextureBrowser.m_assigned_store ) ));
+                       g_TextureBrowser.m_assigned_tree = ui::TreeView(ui::TreeModel( GTK_TREE_MODEL( g_TextureBrowser.m_assigned_store ) ));
                        g_object_unref( G_OBJECT( g_TextureBrowser.m_assigned_store ) );
                        g_signal_connect( g_TextureBrowser.m_assigned_tree, "row-activated", (GCallback) TextureBrowser_removeTags, NULL );
                        gtk_tree_view_set_headers_visible( GTK_TREE_VIEW( g_TextureBrowser.m_assigned_tree ), FALSE );
@@ -2108,7 +2108,7 @@ ui::Widget TextureBrowser_constructWindow( ui::Window toplevel ){
 
                        GtkCellRenderer* renderer = gtk_cell_renderer_text_new();
 
-                       g_TextureBrowser.m_available_tree = ui::Widget(gtk_tree_view_new_with_model( GTK_TREE_MODEL( g_TextureBrowser.m_available_store ) ));
+                       g_TextureBrowser.m_available_tree = ui::TreeView(ui::TreeModel( GTK_TREE_MODEL( g_TextureBrowser.m_available_store ) ));
                        g_object_unref( G_OBJECT( g_TextureBrowser.m_available_store ) );
                        g_signal_connect( g_TextureBrowser.m_available_tree, "row-activated", (GCallback) TextureBrowser_assignTags, NULL );
                        gtk_tree_view_set_headers_visible( GTK_TREE_VIEW( g_TextureBrowser.m_available_tree ), FALSE );