]> de.git.xonotic.org Git - xonotic/netradiant.git/blobdiff - libs/gtkutil/button.cpp
Wrap gtkutil/button
[xonotic/netradiant.git] / libs / gtkutil / button.cpp
index 08744ff485a39fc8406aefc565c8af4dee3e6b55..778a74a8aa3c2d736753d6625316c59577bf699f 100644 (file)
 #include "image.h"
 #include "pointer.h"
 
-void clicked_closure_callback( GtkWidget* widget, gpointer data ){
+void clicked_closure_callback( ui::Widget widget, gpointer data ){
        ( *reinterpret_cast<Callback*>( data ) )( );
 }
 
-void button_connect_callback( GtkButton* button, const Callback& callback ){
+void button_connect_callback( ui::Button button, const Callback& callback ){
 #if 1
        g_signal_connect_swapped( G_OBJECT( button ), "clicked", G_CALLBACK( callback.getThunk() ), callback.getEnvironment() );
 #else
@@ -42,7 +42,7 @@ void button_connect_callback( GtkButton* button, const Callback& callback ){
 #endif
 }
 
-void button_connect_callback( GtkToolButton* button, const Callback& callback ){
+void button_connect_callback( ui::ToolButton button, const Callback& callback ){
 #if 1
        g_signal_connect_swapped( G_OBJECT( button ), "clicked", G_CALLBACK( callback.getThunk() ), callback.getEnvironment() );
 #else
@@ -50,7 +50,7 @@ void button_connect_callback( GtkToolButton* button, const Callback& callback ){
 #endif
 }
 
-guint toggle_button_connect_callback( GtkToggleButton* button, const Callback& callback ){
+guint toggle_button_connect_callback( ui::ToggleButton button, const Callback& callback ){
 #if 1
        guint handler = g_signal_connect_swapped( G_OBJECT( button ), "toggled", G_CALLBACK( callback.getThunk() ), callback.getEnvironment() );
 #else
@@ -60,7 +60,7 @@ guint toggle_button_connect_callback( GtkToggleButton* button, const Callback& c
        return handler;
 }
 
-guint toggle_button_connect_callback( GtkToggleToolButton* button, const Callback& callback ){
+guint toggle_button_connect_callback( ui::ToggleToolButton button, const Callback& callback ){
 #if 1
        guint handler = g_signal_connect_swapped( G_OBJECT( button ), "toggled", G_CALLBACK( callback.getThunk() ), callback.getEnvironment() );
 #else
@@ -70,13 +70,13 @@ guint toggle_button_connect_callback( GtkToggleToolButton* button, const Callbac
        return handler;
 }
 
-void button_set_icon( GtkButton* button, const char* icon ){
-       GtkImage* image = new_local_image( icon );
-       gtk_widget_show( GTK_WIDGET( image ) );
+void button_set_icon( ui::Button button, const char* icon ){
+       ui::Image image = ui::Image(new_local_image( icon ));
+       image.show();
        gtk_container_add( GTK_CONTAINER( button ), GTK_WIDGET( image ) );
 }
 
-void toggle_button_set_active_no_signal( GtkToggleButton* button, gboolean active ){
+void toggle_button_set_active_no_signal( ui::ToggleButton button, gboolean active ){
        //globalOutputStream() << "set active: " << active << "\n";
        guint handler_id = gpointer_to_int( g_object_get_data( G_OBJECT( button ), "handler" ) );
        //guint signal_id = g_signal_lookup("toggled", G_OBJECT_TYPE (button));
@@ -88,7 +88,7 @@ void toggle_button_set_active_no_signal( GtkToggleButton* button, gboolean activ
        g_signal_handler_unblock( G_OBJECT( button ), handler_id );
 }
 
-void toggle_button_set_active_no_signal( GtkToggleToolButton* button, gboolean active ){
+void toggle_button_set_active_no_signal( ui::ToggleToolButton button, gboolean active ){
        guint handler_id = gpointer_to_int( g_object_get_data( G_OBJECT( button ), "handler" ) );
        g_signal_handler_block( G_OBJECT( button ), handler_id );
        gtk_toggle_tool_button_set_active( button, active );
@@ -96,7 +96,7 @@ void toggle_button_set_active_no_signal( GtkToggleToolButton* button, gboolean a
 }
 
 
-void radio_button_print_state( GtkRadioButton* button ){
+void radio_button_print_state( ui::RadioButton button ){
        globalOutputStream() << "toggle button: ";
        for ( GSList* radio = gtk_radio_button_get_group( button ); radio != 0; radio = g_slist_next( radio ) )
        {
@@ -105,18 +105,18 @@ void radio_button_print_state( GtkRadioButton* button ){
        globalOutputStream() << "\n";
 }
 
-GtkToggleButton* radio_button_get_nth( GtkRadioButton* radio, int index ){
+GtkToggleButton* radio_button_get_nth( ui::RadioButton radio, int index ){
        GSList *group = gtk_radio_button_get_group( radio );
        return GTK_TOGGLE_BUTTON( g_slist_nth_data( group, g_slist_length( group ) - index - 1 ) );
 }
 
-void radio_button_set_active( GtkRadioButton* radio, int index ){
+void radio_button_set_active( ui::RadioButton radio, int index ){
        //radio_button_print_state(radio);
        gtk_toggle_button_set_active( radio_button_get_nth( radio, index ), TRUE );
        //radio_button_print_state(radio);
 }
 
-void radio_button_set_active_no_signal( GtkRadioButton* radio, int index ){
+void radio_button_set_active_no_signal( ui::RadioButton radio, int index ){
        {
                for ( GSList* l = gtk_radio_button_get_group( radio ); l != 0; l = g_slist_next( l ) )
                {
@@ -132,7 +132,7 @@ void radio_button_set_active_no_signal( GtkRadioButton* radio, int index ){
        }
 }
 
-int radio_button_get_active( GtkRadioButton* radio ){
+int radio_button_get_active( ui::RadioButton radio ){
        //radio_button_print_state(radio);
        GSList *group = gtk_radio_button_get_group( radio );
        int index = g_slist_length( group ) - 1;