From: TimePath Date: Wed, 17 Feb 2016 07:36:38 +0000 (+1100) Subject: Wrap GtkTextView X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=510800cba3d4e30631dfbb0e3e549df91b1f5644;p=xonotic%2Fnetradiant.git Wrap GtkTextView --- diff --git a/libs/uilib/uilib.cpp b/libs/uilib/uilib.cpp index 589da73c..3b169faf 100644 --- a/libs/uilib/uilib.cpp +++ b/libs/uilib/uilib.cpp @@ -167,6 +167,9 @@ namespace ui { GTK_TABLE(gtk_table_new(rows, columns, homogenous))) { } + TextView::TextView() : TextView(GTK_TEXT_VIEW(gtk_text_view_new())) + { } + TreePath::TreePath() : TreePath(gtk_tree_path_new()) { } diff --git a/libs/uilib/uilib.h b/libs/uilib/uilib.h index 7e943985..3afaa0cb 100644 --- a/libs/uilib/uilib.h +++ b/libs/uilib/uilib.h @@ -27,6 +27,7 @@ using ui_paned = struct _GtkPaned; using ui_scrolledwindow = struct _GtkScrolledWindow; using ui_spinbutton = struct _GtkSpinButton; using ui_table = struct _GtkTable; +using ui_textview = struct _GtkTextView; using ui_treemodel = struct _GtkTreeModel; using ui_treepath = struct _GtkTreePath; using ui_treeview = struct _GtkTreeView; @@ -220,6 +221,10 @@ namespace ui { Table(std::size_t rows, std::size_t columns, bool homogenous); ); + WRAP(TextView, Widget, ui_textview, + TextView(); + ); + WRAP(TreeModel, Widget, ui_treemodel,); WRAP(TreePath, Object, ui_treepath, diff --git a/radiant/console.cpp b/radiant/console.cpp index 4530bc29..11e56c6d 100644 --- a/radiant/console.cpp +++ b/radiant/console.cpp @@ -116,7 +116,7 @@ ui::Widget Console_constructWindow( ui::Window toplevel ){ gtk_widget_show( scr ); { - ui::Widget text = ui::Widget(gtk_text_view_new()); + ui::Widget text = ui::TextView(); gtk_widget_set_size_request( text, 0, -1 ); // allow shrinking gtk_text_view_set_wrap_mode( GTK_TEXT_VIEW( text ), GTK_WRAP_WORD ); gtk_text_view_set_editable( GTK_TEXT_VIEW( text ), FALSE ); diff --git a/radiant/entityinspector.cpp b/radiant/entityinspector.cpp index 9a0b9ef9..83166da1 100644 --- a/radiant/entityinspector.cpp +++ b/radiant/entityinspector.cpp @@ -1372,7 +1372,7 @@ ui::Widget EntityInspector_constructWindow( ui::Window toplevel ){ gtk_scrolled_window_set_shadow_type( GTK_SCROLLED_WINDOW( scr ), GTK_SHADOW_IN ); { - GtkTextView* text = GTK_TEXT_VIEW( gtk_text_view_new() ); + GtkTextView* text = ui::TextView(); gtk_widget_set_size_request( GTK_WIDGET( text ), 0, -1 ); // allow shrinking gtk_text_view_set_wrap_mode( text, GTK_WRAP_WORD ); gtk_text_view_set_editable( text, FALSE ); diff --git a/radiant/gtkdlgs.cpp b/radiant/gtkdlgs.cpp index 4a333a37..5c76cf61 100644 --- a/radiant/gtkdlgs.cpp +++ b/radiant/gtkdlgs.cpp @@ -570,7 +570,7 @@ void DoAbout(){ GtkScrolledWindow* sc_extensions = create_scrolled_window( GTK_POLICY_AUTOMATIC, GTK_POLICY_ALWAYS, 4 ); gtk_container_add( GTK_CONTAINER( frame ), GTK_WIDGET( sc_extensions ) ); { - ui::Widget text_extensions = ui::Widget(gtk_text_view_new()); + ui::Widget text_extensions = ui::TextView(); gtk_text_view_set_editable( GTK_TEXT_VIEW( text_extensions ), FALSE ); gtk_container_add( GTK_CONTAINER( sc_extensions ), text_extensions ); GtkTextBuffer* buffer = gtk_text_view_get_buffer( GTK_TEXT_VIEW( text_extensions ) ); @@ -766,7 +766,7 @@ static void CreateGtkTextEditor(){ gtk_scrolled_window_set_policy( GTK_SCROLLED_WINDOW( scr ), GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC ); gtk_scrolled_window_set_shadow_type( GTK_SCROLLED_WINDOW( scr ), GTK_SHADOW_IN ); - text = ui::Widget(gtk_text_view_new()); + text = ui::TextView(); gtk_container_add( GTK_CONTAINER( scr ), text ); gtk_widget_show( text ); g_object_set_data( G_OBJECT( dlg ), "text", (gpointer) text );