From: TimePath Date: Wed, 17 Feb 2016 03:14:34 +0000 (+1100) Subject: Wrap GtkScrolledWindow X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=4a08602d912a60ee4cb65f4520b79df417f6e130;p=xonotic%2Fnetradiant.git Wrap GtkScrolledWindow --- diff --git a/contrib/brushexport/interface.cpp b/contrib/brushexport/interface.cpp index 4cd532c0..28254c79 100644 --- a/contrib/brushexport/interface.cpp +++ b/contrib/brushexport/interface.cpp @@ -116,7 +116,7 @@ create_w_plugplug2( void ){ gtk_widget_show( label1 ); gtk_box_pack_start( GTK_BOX( vbox2 ), label1, FALSE, FALSE, 0 ); - scrolledwindow1 = gtk_scrolled_window_new( NULL, NULL ); + scrolledwindow1 = ui::ScrolledWindow(); gtk_widget_set_name( scrolledwindow1, "scrolledwindow1" ); gtk_widget_show( scrolledwindow1 ); gtk_box_pack_start( GTK_BOX( vbox2 ), scrolledwindow1, TRUE, TRUE, 0 ); diff --git a/contrib/camera/dialogs.cpp b/contrib/camera/dialogs.cpp index 6831c3af..0e6a1a68 100644 --- a/contrib/camera/dialogs.cpp +++ b/contrib/camera/dialogs.cpp @@ -1252,7 +1252,7 @@ GtkWidget *CreateCameraInspectorDialog( void ){ gtk_box_pack_start( GTK_BOX( vbox ), hbox, FALSE, FALSE, 0 ); gtk_widget_show( hbox ); - w = gtk_scrolled_window_new( NULL, NULL ); + w = ui::ScrolledWindow(); gtk_widget_set_usize( w, 0, 150 ); gtk_scrolled_window_set_policy( GTK_SCROLLED_WINDOW( w ), GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC ); gtk_box_pack_start( GTK_BOX( hbox ), w, TRUE, TRUE, 0 ); diff --git a/libs/gtkutil/window.cpp b/libs/gtkutil/window.cpp index 48b174b3..ce400287 100644 --- a/libs/gtkutil/window.cpp +++ b/libs/gtkutil/window.cpp @@ -22,6 +22,7 @@ #include "window.h" #include +#include #include "pointer.h" #include "accelerator.h" @@ -137,7 +138,7 @@ void window_remove_minmax( GtkWindow* window ){ GtkScrolledWindow* create_scrolled_window( GtkPolicyType hscrollbar_policy, GtkPolicyType vscrollbar_policy, int border ){ - GtkScrolledWindow* scr = GTK_SCROLLED_WINDOW( gtk_scrolled_window_new( 0, 0 ) ); + GtkScrolledWindow* scr = ui::ScrolledWindow(); gtk_widget_show( GTK_WIDGET( scr ) ); gtk_scrolled_window_set_policy( scr, hscrollbar_policy, vscrollbar_policy ); gtk_scrolled_window_set_shadow_type( scr, GTK_SHADOW_IN ); diff --git a/libs/uilib/uilib.cpp b/libs/uilib/uilib.cpp index f6b4d222..54b4a3a3 100644 --- a/libs/uilib/uilib.cpp +++ b/libs/uilib/uilib.cpp @@ -94,6 +94,9 @@ namespace ui { CheckButton::CheckButton(const char *label) : CheckButton(GTK_CHECK_BUTTON(gtk_check_button_new_with_label(label))) { } + ScrolledWindow::ScrolledWindow() : ScrolledWindow(GTK_SCROLLED_WINDOW(gtk_scrolled_window_new(nullptr, nullptr))) + { } + Label::Label(const char *label) : Label(GTK_LABEL(gtk_label_new(label))) { } diff --git a/libs/uilib/uilib.h b/libs/uilib/uilib.h index c201b4ad..4d9d252a 100644 --- a/libs/uilib/uilib.h +++ b/libs/uilib/uilib.h @@ -10,6 +10,7 @@ using ui_evkey = struct _GdkEventKey; using ui_label = struct _GtkLabel; using ui_menuitem = struct _GtkMenuItem; using ui_modal = struct ModalDialog; +using ui_scrolledwindow = struct _GtkScrolledWindow; using ui_treemodel = struct _GtkTreeModel; using ui_treeview = struct _GtkTreeView; using ui_typeinst = struct _GTypeInstance; @@ -95,7 +96,7 @@ namespace ui { #define WRAP(name, impl, methods) \ class name : public Widget, public Convertible { \ public: \ - explicit name(impl *h = nullptr) : Widget(reinterpret_cast(h)) {} \ + explicit name(impl *h) : Widget(reinterpret_cast(h)) {} \ methods \ }; \ static_assert(sizeof(name) == sizeof(Widget), "object slicing") @@ -118,6 +119,10 @@ namespace ui { WRAP(MenuItem, ui_menuitem,); + WRAP(ScrolledWindow, ui_scrolledwindow, + ScrolledWindow(); + ); + WRAP(SpinButton, ui_widget,); WRAP(TreeModel, ui_treemodel,); @@ -131,6 +136,8 @@ namespace ui { ); WRAP(Window, ui_window, + Window() : Window(nullptr) {}; + Window create_dialog_window(const char *title, void func(), void *data, int default_w = -1, int default_h = -1); diff --git a/radiant/console.cpp b/radiant/console.cpp index c075152f..bbf99fc8 100644 --- a/radiant/console.cpp +++ b/radiant/console.cpp @@ -110,7 +110,7 @@ gboolean destroy_set_null( ui::Window widget, ui::Widget* p ){ WidgetFocusPrinter g_consoleWidgetFocusPrinter( "console" ); ui::Widget Console_constructWindow( ui::Window toplevel ){ - ui::Widget scr = ui::Widget(gtk_scrolled_window_new( 0, 0 )); + ui::Widget scr = ui::ScrolledWindow(); 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 ); gtk_widget_show( scr ); diff --git a/radiant/entityinspector.cpp b/radiant/entityinspector.cpp index 8fa0a439..f1b9b434 100644 --- a/radiant/entityinspector.cpp +++ b/radiant/entityinspector.cpp @@ -1326,7 +1326,7 @@ ui::Widget EntityInspector_constructWindow( ui::Window toplevel ){ { // class list - ui::Widget scr = ui::Widget(gtk_scrolled_window_new( 0, 0 )); + ui::Widget scr = ui::ScrolledWindow(); gtk_widget_show( scr ); gtk_paned_add1( GTK_PANED( split2 ), scr ); gtk_scrolled_window_set_policy( GTK_SCROLLED_WINDOW( scr ), GTK_POLICY_NEVER, GTK_POLICY_ALWAYS ); @@ -1363,7 +1363,7 @@ ui::Widget EntityInspector_constructWindow( ui::Window toplevel ){ } { - ui::Widget scr = ui::Widget(gtk_scrolled_window_new( 0, 0 )); + ui::Widget scr = ui::ScrolledWindow(); gtk_widget_show( scr ); gtk_paned_add2( GTK_PANED( split2 ), scr ); gtk_scrolled_window_set_policy( GTK_SCROLLED_WINDOW( scr ), GTK_POLICY_NEVER, GTK_POLICY_ALWAYS ); @@ -1410,7 +1410,7 @@ ui::Widget EntityInspector_constructWindow( ui::Window toplevel ){ { // key/value list - ui::Widget scr = ui::Widget(gtk_scrolled_window_new( 0, 0 )); + ui::Widget scr = ui::ScrolledWindow(); gtk_widget_show( scr ); gtk_box_pack_start( GTK_BOX( vbox2 ), scr, TRUE, TRUE, 0 ); gtk_scrolled_window_set_policy( GTK_SCROLLED_WINDOW( scr ), GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC ); @@ -1520,7 +1520,7 @@ ui::Widget EntityInspector_constructWindow( ui::Window toplevel ){ } { - ui::Widget scr = ui::Widget(gtk_scrolled_window_new( 0, 0 )); + ui::Widget scr = ui::ScrolledWindow(); gtk_widget_show( scr ); gtk_scrolled_window_set_policy( GTK_SCROLLED_WINDOW( scr ), GTK_POLICY_NEVER, GTK_POLICY_AUTOMATIC ); diff --git a/radiant/feedback.cpp b/radiant/feedback.cpp index e823341b..a6e6cd65 100644 --- a/radiant/feedback.cpp +++ b/radiant/feedback.cpp @@ -298,7 +298,7 @@ void CDbgDlg::Push( ISAXHandler *pHandler ){ ui::Window CDbgDlg::BuildDialog(){ ui::Window window = MainFrame_getWindow().create_floating_window("Q3Map debug window" ); - ui::Widget scr = ui::Widget(gtk_scrolled_window_new( NULL, NULL )); + ui::Widget scr = ui::ScrolledWindow(); gtk_widget_show( scr ); gtk_container_add( GTK_CONTAINER( window ), GTK_WIDGET( scr ) ); gtk_scrolled_window_set_policy( GTK_SCROLLED_WINDOW( scr ), GTK_POLICY_NEVER, GTK_POLICY_AUTOMATIC ); diff --git a/radiant/gtkdlgs.cpp b/radiant/gtkdlgs.cpp index e5193439..c1682e5e 100644 --- a/radiant/gtkdlgs.cpp +++ b/radiant/gtkdlgs.cpp @@ -760,7 +760,7 @@ static void CreateGtkTextEditor(){ gtk_container_add( GTK_CONTAINER( dlg ), GTK_WIDGET( vbox ) ); gtk_container_set_border_width( GTK_CONTAINER( vbox ), 5 ); - scr = ui::Widget(gtk_scrolled_window_new( 0, 0 )); + scr = ui::ScrolledWindow(); gtk_widget_show( scr ); gtk_box_pack_start( GTK_BOX( vbox ), scr, TRUE, TRUE, 0 ); gtk_scrolled_window_set_policy( GTK_SCROLLED_WINDOW( scr ), GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC ); diff --git a/radiant/preferences.cpp b/radiant/preferences.cpp index 1c02b140..5a3298a6 100644 --- a/radiant/preferences.cpp +++ b/radiant/preferences.cpp @@ -734,7 +734,7 @@ ui::Window PrefsDlg::BuildDialog(){ gtk_widget_show( hbox ); { - ui::Widget sc_win = ui::Widget(gtk_scrolled_window_new( 0, 0 )); + ui::Widget sc_win = ui::ScrolledWindow(); gtk_scrolled_window_set_policy( GTK_SCROLLED_WINDOW( sc_win ), GTK_POLICY_NEVER, GTK_POLICY_AUTOMATIC ); gtk_box_pack_start( GTK_BOX( hbox ), sc_win, FALSE, FALSE, 0 ); gtk_widget_show( sc_win ); diff --git a/radiant/texwindow.cpp b/radiant/texwindow.cpp index 65587fd4..fc3ab0b2 100644 --- a/radiant/texwindow.cpp +++ b/radiant/texwindow.cpp @@ -1973,7 +1973,7 @@ ui::Widget TextureBrowser_constructWindow( ui::Window toplevel ){ gtk_widget_show( menu_bar ); } { // Texture TreeView - g_TextureBrowser.m_scr_win_tree = ui::Widget(gtk_scrolled_window_new( NULL, NULL )); + g_TextureBrowser.m_scr_win_tree = ui::ScrolledWindow(); gtk_container_set_border_width( GTK_CONTAINER( g_TextureBrowser.m_scr_win_tree ), 0 ); // vertical only scrolling for treeview @@ -2033,7 +2033,7 @@ ui::Widget TextureBrowser_constructWindow( ui::Window toplevel ){ gtk_menu_bar_append( GTK_MENU_BAR( menu_bar ), tags_item ); } { // Tag TreeView - g_TextureBrowser.m_scr_win_tags = ui::Widget(gtk_scrolled_window_new( NULL, NULL )); + g_TextureBrowser.m_scr_win_tags = ui::ScrolledWindow(); gtk_container_set_border_width( GTK_CONTAINER( g_TextureBrowser.m_scr_win_tags ), 0 ); // vertical only scrolling for treeview @@ -2069,7 +2069,7 @@ ui::Widget TextureBrowser_constructWindow( ui::Window toplevel ){ gtk_container_add( GTK_CONTAINER( g_TextureBrowser.m_tag_frame ), frame_table ); } { // assigned tag list - ui::Widget scrolled_win = ui::Widget(gtk_scrolled_window_new( NULL, NULL )); + ui::Widget scrolled_win = ui::ScrolledWindow(); gtk_container_set_border_width( GTK_CONTAINER( scrolled_win ), 0 ); gtk_scrolled_window_set_policy( GTK_SCROLLED_WINDOW( scrolled_win ), GTK_POLICY_NEVER, GTK_POLICY_ALWAYS ); @@ -2098,7 +2098,7 @@ ui::Widget TextureBrowser_constructWindow( ui::Window toplevel ){ gtk_table_attach( GTK_TABLE( frame_table ), scrolled_win, 0, 1, 1, 3, GTK_FILL, GTK_FILL, 0, 0 ); } { // available tag list - ui::Widget scrolled_win = ui::Widget(gtk_scrolled_window_new( NULL, NULL )); + ui::Widget scrolled_win = ui::ScrolledWindow(); gtk_container_set_border_width( GTK_CONTAINER( scrolled_win ), 0 ); gtk_scrolled_window_set_policy( GTK_SCROLLED_WINDOW( scrolled_win ), GTK_POLICY_NEVER, GTK_POLICY_ALWAYS );