]> git.rm.cloudns.org Git - xonotic/netradiant.git/commitdiff
Wrap GtkButton
authorTimePath <andrew.hardaker1995@gmail.com>
Wed, 17 Feb 2016 02:05:49 +0000 (13:05 +1100)
committerTimePath <andrew.hardaker1995@gmail.com>
Wed, 17 Feb 2016 02:05:49 +0000 (13:05 +1100)
contrib/bobtoolz/dialogs/dialogs-gtk.cpp
libs/uilib/uilib.cpp
libs/uilib/uilib.h
radiant/findtexturedialog.cpp
radiant/gtkdlgs.cpp
radiant/surfacedialog.cpp

index 73c8e2fd6935fec862c202be13aec673263e9335..3cbc232b009ab4bca05c6bafe501abbf5be33463 100644 (file)
@@ -243,7 +243,7 @@ EMessageBoxReturn DoMessageBox( const char* lpText, const char* lpCaption, EMess
        gtk_widget_show( hbox );
 
        if ( type == eMB_OK ) {
-               w = ui::Widget(gtk_button_new_with_label( "Ok" ));
+               w = ui::Button( "Ok" );
                gtk_box_pack_start( GTK_BOX( hbox ), w, TRUE, TRUE, 0 );
                gtk_signal_connect( GTK_OBJECT( w ), "clicked",
                                                        GTK_SIGNAL_FUNC( dialog_button_callback ), GINT_TO_POINTER( eIDOK ) );
@@ -253,7 +253,7 @@ EMessageBoxReturn DoMessageBox( const char* lpText, const char* lpCaption, EMess
                ret = eIDOK;
        }
        else if ( type ==  eMB_OKCANCEL ) {
-               w = ui::Widget(gtk_button_new_with_label( "Ok" ));
+               w = ui::Button( "Ok" );
                gtk_box_pack_start( GTK_BOX( hbox ), w, TRUE, TRUE, 0 );
                gtk_signal_connect( GTK_OBJECT( w ), "clicked",
                                                        GTK_SIGNAL_FUNC( dialog_button_callback ), GINT_TO_POINTER( eIDOK ) );
@@ -261,7 +261,7 @@ EMessageBoxReturn DoMessageBox( const char* lpText, const char* lpCaption, EMess
                gtk_widget_grab_default( w );
                gtk_widget_show( w );
 
-               w = ui::Widget(gtk_button_new_with_label( "Cancel" ));
+               w = ui::Button( "Cancel" );
                gtk_box_pack_start( GTK_BOX( hbox ), w, TRUE, TRUE, 0 );
                gtk_signal_connect( GTK_OBJECT( w ), "clicked",
                                                        GTK_SIGNAL_FUNC( dialog_button_callback ), GINT_TO_POINTER( eIDCANCEL ) );
@@ -269,7 +269,7 @@ EMessageBoxReturn DoMessageBox( const char* lpText, const char* lpCaption, EMess
                ret = eIDCANCEL;
        }
        else if ( type == eMB_YESNOCANCEL ) {
-               w = ui::Widget(gtk_button_new_with_label( "Yes" ));
+               w = ui::Button( "Yes" );
                gtk_box_pack_start( GTK_BOX( hbox ), w, TRUE, TRUE, 0 );
                gtk_signal_connect( GTK_OBJECT( w ), "clicked",
                                                        GTK_SIGNAL_FUNC( dialog_button_callback ), GINT_TO_POINTER( eIDYES ) );
@@ -277,13 +277,13 @@ EMessageBoxReturn DoMessageBox( const char* lpText, const char* lpCaption, EMess
                gtk_widget_grab_default( w );
                gtk_widget_show( w );
 
-               w = ui::Widget(gtk_button_new_with_label( "No" ));
+               w = ui::Button( "No" );
                gtk_box_pack_start( GTK_BOX( hbox ), w, TRUE, TRUE, 0 );
                gtk_signal_connect( GTK_OBJECT( w ), "clicked",
                                                        GTK_SIGNAL_FUNC( dialog_button_callback ), GINT_TO_POINTER( eIDNO ) );
                gtk_widget_show( w );
 
-               w = ui::Widget(gtk_button_new_with_label( "Cancel" ));
+               w = ui::Button( "Cancel" );
                gtk_box_pack_start( GTK_BOX( hbox ), w, TRUE, TRUE, 0 );
                gtk_signal_connect( GTK_OBJECT( w ), "clicked",
                                                        GTK_SIGNAL_FUNC( dialog_button_callback ), GINT_TO_POINTER( eIDCANCEL ) );
@@ -292,7 +292,7 @@ EMessageBoxReturn DoMessageBox( const char* lpText, const char* lpCaption, EMess
        }
        else /* if (mode == MB_YESNO) */
        {
-               w = ui::Widget(gtk_button_new_with_label( "Yes" ));
+               w = ui::Button( "Yes" );
                gtk_box_pack_start( GTK_BOX( hbox ), w, TRUE, TRUE, 0 );
                gtk_signal_connect( GTK_OBJECT( w ), "clicked",
                                                        GTK_SIGNAL_FUNC( dialog_button_callback ), GINT_TO_POINTER( eIDYES ) );
@@ -300,7 +300,7 @@ EMessageBoxReturn DoMessageBox( const char* lpText, const char* lpCaption, EMess
                gtk_widget_grab_default( w );
                gtk_widget_show( w );
 
-               w = ui::Widget(gtk_button_new_with_label( "No" ));
+               w = ui::Button( "No" );
                gtk_box_pack_start( GTK_BOX( hbox ), w, TRUE, TRUE, 0 );
                gtk_signal_connect( GTK_OBJECT( w ), "clicked",
                                                        GTK_SIGNAL_FUNC( dialog_button_callback ), GINT_TO_POINTER( eIDNO ) );
index 5ce21dbbb2cba74c8f862889f9663896cf3427fb..16f90e657f998cde49bac2a0a63b65002404dcac 100644 (file)
@@ -84,6 +84,9 @@ namespace ui {
         return g_signal_connect(G_OBJECT(*this), "key-press-event", (GCallback) +func, &pass);
     }
 
+    Button::Button(const char *label) : Button(GTK_BUTTON(gtk_button_new_with_label(label)))
+    { }
+
     Label::Label(const char *label) : Label(GTK_LABEL(gtk_label_new(label)))
     { }
 
index 613868010da68852f5bb0120075c66d8b8563ab1..64a1c6907c45c011809445041a3e3b591cdc81e0 100644 (file)
@@ -6,6 +6,7 @@
 using ui_typeinst = struct _GTypeInstance;
 using ui_widget = struct _GtkWidget;
 using ui_window = struct _GtkWindow;
+using ui_button = struct _GtkButton;
 using ui_menuitem = struct _GtkMenuItem;
 using ui_label = struct _GtkLabel;
 
@@ -109,6 +110,10 @@ namespace ui {
                                               void *extra = nullptr);
     );
 
+    WIDGET(Button, ui_button,
+           Button(const char *label);
+    );
+
     WIDGET(CheckButton, ui_widget,);
 
     WIDGET(SpinButton, ui_widget,);
index 36ccafb14d13cc2073623abfe6a6535c2ef7046f..36db069f86471e9e773c5a1a97e1437b5a2be0a7 100644 (file)
@@ -201,14 +201,14 @@ ui::Window FindTextureDialog::BuildDialog(){
        gtk_widget_show( vbox );
        gtk_box_pack_start( GTK_BOX( hbox ), GTK_WIDGET( vbox ), FALSE, FALSE, 0 );
 
-       button = ui::Widget(gtk_button_new_with_label( "Apply" ));
+       button = ui::Button( "Apply" );
        gtk_widget_show( button );
        gtk_box_pack_start( GTK_BOX( vbox ), button, FALSE, FALSE, 0 );
        g_signal_connect( G_OBJECT( button ), "clicked",
                                          G_CALLBACK( OnApply ), 0 );
        gtk_widget_set_usize( button, 60, -2 );
 
-       button = ui::Widget(gtk_button_new_with_label( "Close" ));
+       button = ui::Button( "Close" );
        gtk_widget_show( button );
        gtk_box_pack_start( GTK_BOX( vbox ), button, FALSE, FALSE, 0 );
        g_signal_connect( G_OBJECT( button ), "clicked",
index c3aba62b185d1a594c73a6622a6098c988762d0e..1536daf75de41d9a8735baf9d4bd7dd880e26ce5 100644 (file)
@@ -776,14 +776,14 @@ static void CreateGtkTextEditor(){
        gtk_widget_show( hbox );
        gtk_box_pack_start( GTK_BOX( vbox ), GTK_WIDGET( hbox ), FALSE, TRUE, 0 );
 
-       button = ui::Widget(gtk_button_new_with_label( "Close" ));
+       button = ui::Button( "Close" );
        gtk_widget_show( button );
        gtk_box_pack_end( GTK_BOX( hbox ), button, FALSE, FALSE, 0 );
        g_signal_connect( G_OBJECT( button ), "clicked",
                                          G_CALLBACK( editor_close ), dlg );
        gtk_widget_set_usize( button, 60, -2 );
 
-       button = ui::Widget(gtk_button_new_with_label( "Save" ));
+       button = ui::Button( "Save" );
        gtk_widget_show( button );
        gtk_box_pack_end( GTK_BOX( hbox ), button, FALSE, FALSE, 0 );
        g_signal_connect( G_OBJECT( button ), "clicked",
index dbd076124ba6ba75de9fd186f69ea6ce94808176..ebd828c4641d0d7f97550b46003c52891c8fa7b3 100644 (file)
@@ -814,7 +814,7 @@ ui::Window SurfaceInspector::BuildDialog(){
                        }
                        {
                                // match grid button
-                               ui::Widget button = ui::Widget(gtk_button_new_with_label( "Match Grid" ));
+                               ui::Widget button = ui::Button( "Match Grid" );
                                gtk_widget_show( button );
                                gtk_table_attach( GTK_TABLE( table ), button, 2, 4, 5, 6,
                                                                  (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ),
@@ -863,7 +863,7 @@ ui::Window SurfaceInspector::BuildDialog(){
                                                                          (GtkAttachOptions) ( 0 ), 0, 0 );
                                }
                                {
-                                       ui::Widget button = ui::Widget(gtk_button_new_with_label( "Axial" ));
+                                       ui::Widget button = ui::Button( "Axial" );
                                        gtk_widget_show( button );
                                        gtk_table_attach( GTK_TABLE( table ), button, 0, 1, 1, 2,
                                                                          (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ),
@@ -873,7 +873,7 @@ ui::Window SurfaceInspector::BuildDialog(){
                                        gtk_widget_set_usize( button, 60, -2 );
                                }
                                {
-                                       ui::Widget button = ui::Widget(gtk_button_new_with_label( "Fit" ));
+                                       ui::Widget button = ui::Button( "Fit" );
                                        gtk_widget_show( button );
                                        gtk_table_attach( GTK_TABLE( table ), button, 1, 2, 1, 2,
                                                                          (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ),
@@ -883,7 +883,7 @@ ui::Window SurfaceInspector::BuildDialog(){
                                        gtk_widget_set_usize( button, 60, -2 );
                                }
                                {
-                                       ui::Widget button = ui::Widget(gtk_button_new_with_label( "CAP" ));
+                                       ui::Widget button = ui::Button( "CAP" );
                                        gtk_widget_show( button );
                                        gtk_table_attach( GTK_TABLE( table ), button, 0, 1, 3, 4,
                                                                          (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ),
@@ -893,7 +893,7 @@ ui::Window SurfaceInspector::BuildDialog(){
                                        gtk_widget_set_usize( button, 60, -2 );
                                }
                                {
-                                       ui::Widget button = ui::Widget(gtk_button_new_with_label( "Set..." ));
+                                       ui::Widget button = ui::Button( "Set..." );
                                        gtk_widget_show( button );
                                        gtk_table_attach( GTK_TABLE( table ), button, 1, 2, 3, 4,
                                                                          (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ),
@@ -903,7 +903,7 @@ ui::Window SurfaceInspector::BuildDialog(){
                                        gtk_widget_set_usize( button, 60, -2 );
                                }
                                {
-                                       ui::Widget button = ui::Widget(gtk_button_new_with_label( "Natural" ));
+                                       ui::Widget button = ui::Button( "Natural" );
                                        gtk_widget_show( button );
                                        gtk_table_attach( GTK_TABLE( table ), button, 2, 3, 3, 4,
                                                                          (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ),
@@ -913,7 +913,7 @@ ui::Window SurfaceInspector::BuildDialog(){
                                        gtk_widget_set_usize( button, 60, -2 );
                                }
                                {
-                                       ui::Widget button = ui::Widget(gtk_button_new_with_label( "Fit" ));
+                                       ui::Widget button = ui::Button( "Fit" );
                                        gtk_widget_show( button );
                                        gtk_table_attach( GTK_TABLE( table ), button, 3, 4, 3, 4,
                                                                          (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ),