]> de.git.xonotic.org Git - xonotic/netradiant.git/blobdiff - libs/gtkutil/window.cpp
Wrap more GTK
[xonotic/netradiant.git] / libs / gtkutil / window.cpp
index 7770821695f3eb76a6bae48076d95f4aa72ed8c6..7fc62eae7d6239c0a8ad19f0e4ae7769b223091e 100644 (file)
@@ -34,7 +34,7 @@ inline void CHECK_RESTORE( ui::Widget w ){
 
 inline void CHECK_MINIMIZE( ui::Widget w ){
        g_object_set_data( G_OBJECT( w ), "was_mapped", gint_to_pointer( gtk_widget_get_visible( w ) ) );
-       gtk_widget_hide( w );
+       w.hide();
 }
 
 static gboolean main_window_iconified( ui::Widget widget, GdkEventWindowState* event, gpointer data ){
@@ -51,7 +51,7 @@ static gboolean main_window_iconified( ui::Widget widget, GdkEventWindowState* e
 }
 
 unsigned int connect_floating( ui::Window main_window, ui::Window floating ){
-       return g_signal_connect( G_OBJECT( main_window ), "window_state_event", G_CALLBACK( main_window_iconified ), floating );
+       return main_window.connect( "window_state_event", G_CALLBACK( main_window_iconified ), floating );
 }
 
 gboolean destroy_disconnect_floating( ui::Window widget, gpointer data ){
@@ -67,7 +67,7 @@ gboolean floating_window_delete_present( ui::Window floating, GdkEventFocus *eve
 }
 
 guint connect_floating_window_delete_present( ui::Window floating, ui::Window main_window ){
-       return g_signal_connect( G_OBJECT( floating ), "delete_event", G_CALLBACK( floating_window_delete_present ), main_window );
+       return floating.connect( "delete_event", G_CALLBACK( floating_window_delete_present ), main_window );
 }
 
 gboolean floating_window_destroy_present( ui::Window floating, ui::Window main_window ){
@@ -78,7 +78,7 @@ gboolean floating_window_destroy_present( ui::Window floating, ui::Window main_w
 }
 
 guint connect_floating_window_destroy_present( ui::Window floating, ui::Window main_window ){
-       return g_signal_connect( G_OBJECT( floating ), "destroy", G_CALLBACK( floating_window_destroy_present ), main_window );
+       return floating.connect( "destroy", G_CALLBACK( floating_window_destroy_present ), main_window );
 }
 
 ui::Window create_floating_window( const char* title, ui::Window parent ){
@@ -89,14 +89,14 @@ ui::Window create_floating_window( const char* title, ui::Window parent ){
                gtk_window_set_transient_for( window, parent );
                connect_floating_window_destroy_present( window, parent );
                g_object_set_data( G_OBJECT( window ), "floating_handler", gint_to_pointer( connect_floating( parent, window ) ) );
-               g_signal_connect( G_OBJECT( window ), "destroy", G_CALLBACK( destroy_disconnect_floating ), parent );
+               window.connect( "destroy", G_CALLBACK( destroy_disconnect_floating ), parent );
        }
 
        return window;
 }
 
 void destroy_floating_window( ui::Window window ){
-       gtk_widget_destroy( GTK_WIDGET( window ) );
+       window.destroy();
 }
 
 gint window_realize_remove_sysmenu( ui::Widget widget, gpointer data ){
@@ -105,7 +105,7 @@ gint window_realize_remove_sysmenu( ui::Widget widget, gpointer data ){
 }
 
 gboolean persistent_floating_window_delete( ui::Window floating, GdkEvent *event, ui::Window main_window ){
-       gtk_widget_hide( GTK_WIDGET( floating ) );
+       floating.hide();
        return TRUE;
 }
 
@@ -115,11 +115,11 @@ ui::Window create_persistent_floating_window( const char* title, ui::Window main
        gtk_widget_set_events( GTK_WIDGET( window ), GDK_KEY_PRESS_MASK | GDK_KEY_RELEASE_MASK );
 
        connect_floating_window_delete_present( window, main_window );
-       g_signal_connect( G_OBJECT( window ), "delete_event", G_CALLBACK( persistent_floating_window_delete ), 0 );
+       window.connect( "delete_event", G_CALLBACK( persistent_floating_window_delete ), 0 );
 
 #if 0
        if ( g_multimon_globals.m_bStartOnPrimMon && g_multimon_globals.m_bNoSysMenuPopups ) {
-               g_signal_connect( G_OBJECT( window ), "realize", G_CALLBACK( window_realize_remove_sysmenu ), 0 );
+               window.connect( "realize", G_CALLBACK( window_realize_remove_sysmenu ), 0 );
        }
 #endif
 
@@ -132,12 +132,12 @@ gint window_realize_remove_minmax( ui::Widget widget, gpointer data ){
 }
 
 void window_remove_minmax( ui::Window window ){
-       g_signal_connect( G_OBJECT( window ), "realize", G_CALLBACK( window_realize_remove_minmax ), 0 );
+       window.connect( "realize", G_CALLBACK( window_realize_remove_minmax ), 0 );
 }
 
 
 ui::ScrolledWindow create_scrolled_window( ui::Policy hscrollbar_policy, ui::Policy vscrollbar_policy, int border ){
-       auto scr = ui::ScrolledWindow();
+       auto scr = ui::ScrolledWindow(ui::New);
        gtk_widget_show( GTK_WIDGET( scr ) );
        gtk_scrolled_window_set_policy( scr, (GtkPolicyType) hscrollbar_policy, (GtkPolicyType) vscrollbar_policy );
        gtk_scrolled_window_set_shadow_type( scr, GTK_SHADOW_IN );
@@ -153,7 +153,7 @@ gboolean window_focus_in_clear_focus_widget(ui::Widget widget, GdkEventKey *even
 
 guint window_connect_focus_in_clear_focus_widget(ui::Window window)
 {
-       return g_signal_connect( G_OBJECT( window ), "focus_in_event", G_CALLBACK( window_focus_in_clear_focus_widget ), NULL );
+       return window.connect( "focus_in_event", G_CALLBACK( window_focus_in_clear_focus_widget ), NULL );
 }
 
 void window_get_position(ui::Window window, WindowPosition &position)
@@ -223,7 +223,7 @@ void WindowPositionTracker::sync(ui::Window window)
 void WindowPositionTracker::connect(ui::Window window)
 {
        sync( window );
-       g_signal_connect( G_OBJECT( window ), "configure_event", G_CALLBACK( configure ), this );
+       window.connect( "configure_event", G_CALLBACK( configure ), this );
 }
 
 const WindowPosition &WindowPositionTracker::getPosition() const