]> de.git.xonotic.org Git - xonotic/netradiant.git/blobdiff - radiant/dialog.cpp
GTK: wrap GTK_WIDGET
[xonotic/netradiant.git] / radiant / dialog.cpp
index 8133cdb0cb07494f1bd4779ff30fa57c29288450..e588f93ff8599d2e0e0552aa77793af936f8afe5 100644 (file)
@@ -50,7 +50,7 @@
 ui::Entry DialogEntry_new(){
        auto entry = ui::Entry(ui::New);
        entry.show();
-       gtk_widget_set_size_request( GTK_WIDGET( entry ), 64, -1 );
+       gtk_widget_set_size_request( entry , 64, -1 );
        return entry;
 }
 
@@ -70,7 +70,7 @@ DialogEntryRow DialogEntryRow_new( const char* name ){
        auto entry = DialogEntry_new();
        alignment.add(entry);
 
-       return DialogEntryRow( ui::Widget(GTK_WIDGET( DialogRow_new( name, alignment ) )), entry );
+       return DialogEntryRow( ui::Widget(DialogRow_new( name, alignment  )), entry );
 }
 
 
@@ -83,7 +83,7 @@ ui::SpinButton DialogSpinner_new( double value, double lower, double upper, int
        }
        auto spin = ui::SpinButton( ui::Adjustment( value, lower, upper, step, 10, 0 ), step, digits );
        spin.show();
-       gtk_widget_set_size_request( GTK_WIDGET( spin ), 64, -1 );
+       gtk_widget_set_size_request( spin , 64, -1 );
        return spin;
 }
 
@@ -103,7 +103,7 @@ DialogSpinnerRow DialogSpinnerRow_new( const char* name, double value, double lo
        auto spin = DialogSpinner_new( value, lower, upper, fraction );
        alignment.add(spin);
 
-       return DialogSpinnerRow( ui::Widget(GTK_WIDGET( DialogRow_new( name, alignment ) )), spin );
+       return DialogSpinnerRow( ui::Widget(DialogRow_new( name, alignment  )), spin );
 }
 
 
@@ -319,7 +319,7 @@ void Dialog::ShowDlg(){
 void Dialog::HideDlg(){
        ASSERT_MESSAGE( m_window, "dialog was not constructed" );
        exportData();
-       gtk_widget_hide( GTK_WIDGET( m_window ) );
+       m_window.hide();
 }
 
 static gint delete_event_callback( ui::Widget widget, GdkEvent* event, gpointer data ){
@@ -338,7 +338,7 @@ void Dialog::Create(){
 void Dialog::Destroy(){
        ASSERT_MESSAGE( m_window, "dialog cannot be destroyed" );
 
-       gtk_widget_destroy( GTK_WIDGET( m_window ) );
+       m_window.destroy();
        m_window = ui::Window{ui::null};
 }
 
@@ -445,7 +445,7 @@ EMessageBoxReturn Dialog::DoModal(){
                exportData();
        }
 
-       gtk_widget_hide( GTK_WIDGET( m_window ) );
+       m_window.hide();
 
        PostModal( m_modal.ret );
 
@@ -458,7 +458,7 @@ ui::CheckButton Dialog::addCheckBox( ui::Widget vbox, const char* name, const ch
        check.show();
        AddBoolToggleData( *GTK_TOGGLE_BUTTON( check ), importViewer, exportViewer );
 
-       DialogVBox_packRow( ui::VBox(GTK_VBOX( vbox )), ui::Widget(GTK_WIDGET( DialogRow_new( name, check ) ) ));
+       DialogVBox_packRow( ui::VBox(GTK_VBOX( vbox )), ui::Widget(DialogRow_new( name, check  ) ));
        return check;
 }
 
@@ -494,18 +494,18 @@ void Dialog::addCombo( ui::Widget vbox, const char* name, int& data, StringArray
 void Dialog::addSlider( ui::Widget vbox, const char* name, int& data, gboolean draw_value, const char* low, const char* high, double value, double lower, double upper, double step_increment, double page_increment ){
 #if 0
        if ( draw_value == FALSE ) {
-               ui::Widget hbox2 = ui::HBox( FALSE, 0 );
+               auto hbox2 = ui::HBox( FALSE, 0 );
                hbox2.show();
-               gtk_box_pack_start( GTK_BOX( vbox ), GTK_WIDGET( hbox2 ), FALSE, FALSE, 0 );
+               vbox.pack_start( hbox2 , FALSE, FALSE, 0 );
                {
                        ui::Widget label = ui::Label( low );
                        label.show();
-                       gtk_box_pack_start( GTK_BOX( hbox2 ), label, FALSE, FALSE, 0 );
+                       hbox2.pack_start( label, FALSE, FALSE, 0 );
                }
                {
                        ui::Widget label = ui::Label( high );
                        label.show();
-                       gtk_box_pack_end( GTK_BOX( hbox2 ), label, FALSE, FALSE, 0 );
+                       hbox2.pack_end(label, FALSE, FALSE, 0);
                }
        }
 #endif
@@ -561,7 +561,7 @@ void Dialog::addRadioIcons( ui::Widget vbox, const char* name, StringArrayRange
                guint pos = static_cast<guint>( icon - icons.first );
                auto image = new_local_image( *icon );
                image.show();
-               gtk_table_attach( GTK_TABLE( table ), GTK_WIDGET( image ), pos, pos + 1, 0, 1,
+               gtk_table_attach( GTK_TABLE( table ), image , pos, pos + 1, 0, 1,
                                                  (GtkAttachOptions) ( 0 ),
                                                  (GtkAttachOptions) ( 0 ), 0, 0 );
 
@@ -610,10 +610,10 @@ ui::Widget Dialog::addPathEntry( ui::Widget vbox, const char* name, bool browse_
 
        AddTextEntryData( *GTK_ENTRY(pathEntry.m_entry), importViewer, exportViewer );
 
-       auto row = DialogRow_new( name, ui::Widget(GTK_WIDGET( pathEntry.m_frame )) );
+       auto row = DialogRow_new( name, ui::Widget(pathEntry.m_frame ) );
        DialogVBox_packRow( ui::VBox(GTK_VBOX( vbox )), row );
 
-       return ui::Widget(GTK_WIDGET( row ));
+       return ui::Widget(row );
 }
 
 ui::Widget Dialog::addPathEntry( ui::Widget vbox, const char* name, CopiedString& data, bool browse_directory ){