]> de.git.xonotic.org Git - xonotic/netradiant.git/blobdiff - radiant/entityinspector.cpp
Wrap more GTK
[xonotic/netradiant.git] / radiant / entityinspector.cpp
index cc0c2008c1ee3f7929d49a403bb9cfdde094282f..8c67825ebb8419d95b3a3cb467388ab684f39101 100644 (file)
@@ -22,6 +22,7 @@
 #include "entityinspector.h"
 
 #include "debugging/debugging.h"
 #include "entityinspector.h"
 
 #include "debugging/debugging.h"
+#include <gtk/gtk.h>
 
 #include "ientity.h"
 #include "ifilesystem.h"
 
 #include "ientity.h"
 #include "ifilesystem.h"
@@ -64,9 +65,9 @@
 #include "groupdialog.h"
 
 ui::Entry numeric_entry_new(){
 #include "groupdialog.h"
 
 ui::Entry numeric_entry_new(){
-       auto entry = ui::Entry();
+       auto entry = ui::Entry(ui::New);
        entry.show();
        entry.show();
-       gtk_widget_set_size_request( GTK_WIDGET( entry ), 64, -1 );
+       entry.dimensions(64, -1);
        return entry;
 }
 
        return entry;
 }
 
@@ -103,6 +104,7 @@ void Scene_EntitySetKeyValue_Selected_Undoable( const char* key, const char* val
 class EntityAttribute
 {
 public:
 class EntityAttribute
 {
 public:
+virtual ~EntityAttribute() = default;
 virtual ui::Widget getWidget() const = 0;
 virtual void update() = 0;
 virtual void release() = 0;
 virtual ui::Widget getWidget() const = 0;
 virtual void update() = 0;
 virtual void release() = 0;
@@ -111,7 +113,7 @@ virtual void release() = 0;
 class BooleanAttribute : public EntityAttribute
 {
 CopiedString m_key;
 class BooleanAttribute : public EntityAttribute
 {
 CopiedString m_key;
-GtkCheckButton* m_check;
+ui::CheckButton m_check;
 
 static gboolean toggled( ui::Widget widget, BooleanAttribute* self ){
        self->apply();
 
 static gboolean toggled( ui::Widget widget, BooleanAttribute* self ){
        self->apply();
@@ -120,36 +122,36 @@ static gboolean toggled( ui::Widget widget, BooleanAttribute* self ){
 public:
 BooleanAttribute( const char* key ) :
        m_key( key ),
 public:
 BooleanAttribute( const char* key ) :
        m_key( key ),
-       m_check( 0 ){
-       auto check = ui::CheckButton(GTK_CHECK_BUTTON( gtk_check_button_new() ));
+       m_check( ui::null ){
+       auto check = ui::CheckButton(ui::New);
        check.show();
 
        m_check = check;
 
        check.show();
 
        m_check = check;
 
-       guint handler = g_signal_connect( G_OBJECT( check ), "toggled", G_CALLBACK( toggled ), this );
+       guint handler = check.connect( "toggled", G_CALLBACK( toggled ), this );
        g_object_set_data( G_OBJECT( check ), "handler", gint_to_pointer( handler ) );
 
        update();
 }
 ui::Widget getWidget() const {
        g_object_set_data( G_OBJECT( check ), "handler", gint_to_pointer( handler ) );
 
        update();
 }
 ui::Widget getWidget() const {
-       return ui::Widget(GTK_WIDGET( m_check ));
+       return m_check;
 }
 void release(){
        delete this;
 }
 void apply(){
 }
 void release(){
        delete this;
 }
 void apply(){
-       Scene_EntitySetKeyValue_Selected_Undoable( m_key.c_str(), gtk_toggle_button_get_active( GTK_TOGGLE_BUTTON( m_check ) ) ? "1" : "0" );
+       Scene_EntitySetKeyValue_Selected_Undoable( m_key.c_str(), m_check.active() ? "1" : "0" );
 }
 typedef MemberCaller<BooleanAttribute, &BooleanAttribute::apply> ApplyCaller;
 
 void update(){
        const char* value = SelectedEntity_getValueForKey( m_key.c_str() );
        if ( !string_empty( value ) ) {
 }
 typedef MemberCaller<BooleanAttribute, &BooleanAttribute::apply> ApplyCaller;
 
 void update(){
        const char* value = SelectedEntity_getValueForKey( m_key.c_str() );
        if ( !string_empty( value ) ) {
-               toggle_button_set_active_no_signal( ui::ToggleButton(GTK_TOGGLE_BUTTON( m_check )), atoi( value ) != 0 );
+               toggle_button_set_active_no_signal( m_check, atoi( value ) != 0 );
        }
        else
        {
        }
        else
        {
-               toggle_button_set_active_no_signal( ui::ToggleButton(GTK_TOGGLE_BUTTON( m_check )), false );
+               toggle_button_set_active_no_signal( m_check, false );
        }
 }
 typedef MemberCaller<BooleanAttribute, &BooleanAttribute::update> UpdateCaller;
        }
 }
 typedef MemberCaller<BooleanAttribute, &BooleanAttribute::update> UpdateCaller;
@@ -164,17 +166,17 @@ NonModalEntry m_nonModal;
 public:
 StringAttribute( const char* key ) :
        m_key( key ),
 public:
 StringAttribute( const char* key ) :
        m_key( key ),
-       m_entry( nullptr ),
+       m_entry( ui::null ),
        m_nonModal( ApplyCaller( *this ), UpdateCaller( *this ) ){
        m_nonModal( ApplyCaller( *this ), UpdateCaller( *this ) ){
-       auto entry = ui::Entry();
+       auto entry = ui::Entry(ui::New);
        entry.show();
        entry.show();
-       gtk_widget_set_size_request( GTK_WIDGET( entry ), 50, -1 );
+       entry.dimensions(50, -1);
 
        m_entry = entry;
        m_nonModal.connect( m_entry );
 }
 ui::Widget getWidget() const {
 
        m_entry = entry;
        m_nonModal.connect( m_entry );
 }
 ui::Widget getWidget() const {
-       return ui::Widget(GTK_WIDGET( m_entry ));
+       return m_entry;
 }
 ui::Entry getEntry() const {
        return m_entry;
 }
 ui::Entry getEntry() const {
        return m_entry;
@@ -185,7 +187,7 @@ void release(){
 }
 void apply(){
        StringOutputStream value( 64 );
 }
 void apply(){
        StringOutputStream value( 64 );
-       value << gtk_entry_get_text( m_entry );
+       value << m_entry.text();
        Scene_EntitySetKeyValue_Selected_Undoable( m_key.c_str(), value.c_str() );
 }
 typedef MemberCaller<StringAttribute, &StringAttribute::apply> ApplyCaller;
        Scene_EntitySetKeyValue_Selected_Undoable( m_key.c_str(), value.c_str() );
 }
 typedef MemberCaller<StringAttribute, &StringAttribute::apply> ApplyCaller;
@@ -193,7 +195,7 @@ typedef MemberCaller<StringAttribute, &StringAttribute::apply> ApplyCaller;
 void update(){
        StringOutputStream value( 64 );
        value << SelectedEntity_getValueForKey( m_key.c_str() );
 void update(){
        StringOutputStream value( 64 );
        value << SelectedEntity_getValueForKey( m_key.c_str() );
-       gtk_entry_set_text( m_entry, value.c_str() );
+       m_entry.text(value.c_str());
 }
 typedef MemberCaller<StringAttribute, &StringAttribute::update> UpdateCaller;
 };
 }
 typedef MemberCaller<StringAttribute, &StringAttribute::update> UpdateCaller;
 };
@@ -223,18 +225,18 @@ void release(){
        delete this;
 }
 ui::Widget getWidget() const {
        delete this;
 }
 ui::Widget getWidget() const {
-       return ui::Widget(GTK_WIDGET( m_entry.m_entry.m_frame ));
+       return m_entry.m_entry.m_frame;
 }
 void apply(){
        StringOutputStream value( 64 );
 }
 void apply(){
        StringOutputStream value( 64 );
-       value << gtk_entry_get_text( GTK_ENTRY( m_entry.m_entry.m_entry ) );
+       value << m_entry.m_entry.m_entry.text();
        Scene_EntitySetKeyValue_Selected_Undoable( m_key.c_str(), value.c_str() );
 }
 typedef MemberCaller<ModelAttribute, &ModelAttribute::apply> ApplyCaller;
 void update(){
        StringOutputStream value( 64 );
        value << SelectedEntity_getValueForKey( m_key.c_str() );
        Scene_EntitySetKeyValue_Selected_Undoable( m_key.c_str(), value.c_str() );
 }
 typedef MemberCaller<ModelAttribute, &ModelAttribute::apply> ApplyCaller;
 void update(){
        StringOutputStream value( 64 );
        value << SelectedEntity_getValueForKey( m_key.c_str() );
-       gtk_entry_set_text( GTK_ENTRY( m_entry.m_entry.m_entry ), value.c_str() );
+       m_entry.m_entry.m_entry.text(value.c_str());
 }
 typedef MemberCaller<ModelAttribute, &ModelAttribute::update> UpdateCaller;
 void browse( const BrowsedPathEntry::SetPathCallback& setPath ){
 }
 typedef MemberCaller<ModelAttribute, &ModelAttribute::update> UpdateCaller;
 void browse( const BrowsedPathEntry::SetPathCallback& setPath ){
@@ -290,14 +292,14 @@ ui::Widget getWidget() const {
 }
 void apply(){
        StringOutputStream value( 64 );
 }
 void apply(){
        StringOutputStream value( 64 );
-       value << gtk_entry_get_text( GTK_ENTRY( m_entry.m_entry.m_entry ) );
+       value << m_entry.m_entry.m_entry.text();
        Scene_EntitySetKeyValue_Selected_Undoable( m_key.c_str(), value.c_str() );
 }
 typedef MemberCaller<SoundAttribute, &SoundAttribute::apply> ApplyCaller;
 void update(){
        StringOutputStream value( 64 );
        value << SelectedEntity_getValueForKey( m_key.c_str() );
        Scene_EntitySetKeyValue_Selected_Undoable( m_key.c_str(), value.c_str() );
 }
 typedef MemberCaller<SoundAttribute, &SoundAttribute::apply> ApplyCaller;
 void update(){
        StringOutputStream value( 64 );
        value << SelectedEntity_getValueForKey( m_key.c_str() );
-       gtk_entry_set_text( GTK_ENTRY( m_entry.m_entry.m_entry ), value.c_str() );
+       m_entry.m_entry.m_entry.text(value.c_str());
 }
 typedef MemberCaller<SoundAttribute, &SoundAttribute::update> UpdateCaller;
 void browse( const BrowsedPathEntry::SetPathCallback& setPath ){
 }
 typedef MemberCaller<SoundAttribute, &SoundAttribute::update> UpdateCaller;
 void browse( const BrowsedPathEntry::SetPathCallback& setPath ){
@@ -323,7 +325,7 @@ NonModalEntry m_nonModal;
 public:
 AngleAttribute( const char* key ) :
        m_key( key ),
 public:
 AngleAttribute( const char* key ) :
        m_key( key ),
-       m_entry( nullptr ),
+       m_entry( ui::null ),
        m_nonModal( ApplyCaller( *this ), UpdateCaller( *this ) ){
        auto entry = numeric_entry_new();
        m_entry = entry;
        m_nonModal( ApplyCaller( *this ), UpdateCaller( *this ) ){
        auto entry = numeric_entry_new();
        m_entry = entry;
@@ -347,11 +349,11 @@ void update(){
        if ( !string_empty( value ) ) {
                StringOutputStream angle( 32 );
                angle << angle_normalised( atof( value ) );
        if ( !string_empty( value ) ) {
                StringOutputStream angle( 32 );
                angle << angle_normalised( atof( value ) );
-               gtk_entry_set_text( m_entry, angle.c_str() );
+               m_entry.text(angle.c_str());
        }
        else
        {
        }
        else
        {
-               gtk_entry_set_text( m_entry, "0" );
+               m_entry.text("0");
        }
 }
 typedef MemberCaller<AngleAttribute, &AngleAttribute::update> UpdateCaller;
        }
 }
 typedef MemberCaller<AngleAttribute, &AngleAttribute::update> UpdateCaller;
@@ -370,11 +372,11 @@ ui::Entry m_entry;
 NonModalEntry m_nonModal;
 RadioHBox m_radio;
 NonModalRadio m_nonModalRadio;
 NonModalEntry m_nonModal;
 RadioHBox m_radio;
 NonModalRadio m_nonModalRadio;
-ui::HBox m_hbox{nullptr};
+ui::HBox m_hbox{ui::null};
 public:
 DirectionAttribute( const char* key ) :
        m_key( key ),
 public:
 DirectionAttribute( const char* key ) :
        m_key( key ),
-       m_entry( nullptr ),
+       m_entry( ui::null ),
        m_nonModal( ApplyCaller( *this ), UpdateCaller( *this ) ),
        m_radio( RadioHBox_new( STRING_ARRAY_RANGE( buttons ) ) ),
        m_nonModalRadio( ApplyRadioCaller( *this ) ){
        m_nonModal( ApplyCaller( *this ), UpdateCaller( *this ) ),
        m_radio( RadioHBox_new( STRING_ARRAY_RANGE( buttons ) ) ),
        m_nonModalRadio( ApplyRadioCaller( *this ) ){
@@ -410,12 +412,12 @@ void update(){
                if ( f == -1 ) {
                        gtk_widget_set_sensitive( GTK_WIDGET( m_entry ), FALSE );
                        radio_button_set_active_no_signal( m_radio.m_radio, 0 );
                if ( f == -1 ) {
                        gtk_widget_set_sensitive( GTK_WIDGET( m_entry ), FALSE );
                        radio_button_set_active_no_signal( m_radio.m_radio, 0 );
-                       gtk_entry_set_text( m_entry, "" );
+                       m_entry.text("");
                }
                else if ( f == -2 ) {
                        gtk_widget_set_sensitive( GTK_WIDGET( m_entry ), FALSE );
                        radio_button_set_active_no_signal( m_radio.m_radio, 1 );
                }
                else if ( f == -2 ) {
                        gtk_widget_set_sensitive( GTK_WIDGET( m_entry ), FALSE );
                        radio_button_set_active_no_signal( m_radio.m_radio, 1 );
-                       gtk_entry_set_text( m_entry, "" );
+                       m_entry.text("");
                }
                else
                {
                }
                else
                {
@@ -423,12 +425,12 @@ void update(){
                        radio_button_set_active_no_signal( m_radio.m_radio, 2 );
                        StringOutputStream angle( 32 );
                        angle << angle_normalised( f );
                        radio_button_set_active_no_signal( m_radio.m_radio, 2 );
                        StringOutputStream angle( 32 );
                        angle << angle_normalised( f );
-                       gtk_entry_set_text( m_entry, angle.c_str() );
+                       m_entry.text(angle.c_str());
                }
        }
        else
        {
                }
        }
        else
        {
-               gtk_entry_set_text( m_entry, "0" );
+               m_entry.text("0");
        }
 }
 typedef MemberCaller<DirectionAttribute, &DirectionAttribute::update> UpdateCaller;
        }
 }
 typedef MemberCaller<DirectionAttribute, &DirectionAttribute::update> UpdateCaller;
@@ -455,7 +457,7 @@ public:
 ui::Entry m_roll;
 ui::Entry m_pitch;
 ui::Entry m_yaw;
 ui::Entry m_roll;
 ui::Entry m_pitch;
 ui::Entry m_yaw;
-AnglesEntry() : m_roll( nullptr ), m_pitch( nullptr ), m_yaw( nullptr ){
+AnglesEntry() : m_roll( ui::null ), m_pitch( ui::null ), m_yaw( ui::null ){
 }
 };
 
 }
 };
 
@@ -518,22 +520,22 @@ void update(){
                }
 
                angle << angle_normalised( pitch_yaw_roll.x() );
                }
 
                angle << angle_normalised( pitch_yaw_roll.x() );
-               gtk_entry_set_text( m_angles.m_pitch, angle.c_str() );
+               m_angles.m_pitch.text(angle.c_str());
                angle.clear();
 
                angle << angle_normalised( pitch_yaw_roll.y() );
                angle.clear();
 
                angle << angle_normalised( pitch_yaw_roll.y() );
-               gtk_entry_set_text( m_angles.m_yaw, angle.c_str() );
+               m_angles.m_yaw.text(angle.c_str());
                angle.clear();
 
                angle << angle_normalised( pitch_yaw_roll.z() );
                angle.clear();
 
                angle << angle_normalised( pitch_yaw_roll.z() );
-               gtk_entry_set_text( m_angles.m_roll, angle.c_str() );
+               m_angles.m_roll.text(angle.c_str());
                angle.clear();
        }
        else
        {
                angle.clear();
        }
        else
        {
-               gtk_entry_set_text( m_angles.m_pitch, "0" );
-               gtk_entry_set_text( m_angles.m_yaw, "0" );
-               gtk_entry_set_text( m_angles.m_roll, "0" );
+               m_angles.m_pitch.text("0");
+               m_angles.m_yaw.text("0");
+               m_angles.m_roll.text("0");
        }
 }
 typedef MemberCaller<AnglesAttribute, &AnglesAttribute::update> UpdateCaller;
        }
 }
 typedef MemberCaller<AnglesAttribute, &AnglesAttribute::update> UpdateCaller;
@@ -545,7 +547,7 @@ public:
 ui::Entry m_x;
 ui::Entry m_y;
 ui::Entry m_z;
 ui::Entry m_x;
 ui::Entry m_y;
 ui::Entry m_z;
-Vector3Entry() : m_x( nullptr ), m_y( nullptr ), m_z( nullptr ){
+Vector3Entry() : m_x( ui::null ), m_y( ui::null ), m_z( ui::null ){
 }
 };
 
 }
 };
 
@@ -554,7 +556,7 @@ class Vector3Attribute : public EntityAttribute
 CopiedString m_key;
 Vector3Entry m_vector3;
 NonModalEntry m_nonModal;
 CopiedString m_key;
 Vector3Entry m_vector3;
 NonModalEntry m_nonModal;
-ui::Box m_hbox{nullptr};
+ui::Box m_hbox{ui::null};
 public:
 Vector3Attribute( const char* key ) :
        m_key( key ),
 public:
 Vector3Attribute( const char* key ) :
        m_key( key ),
@@ -605,22 +607,22 @@ void update(){
                }
 
                buffer << x_y_z.x();
                }
 
                buffer << x_y_z.x();
-               gtk_entry_set_text( m_vector3.m_x, buffer.c_str() );
+               m_vector3.m_x.text(buffer.c_str());
                buffer.clear();
 
                buffer << x_y_z.y();
                buffer.clear();
 
                buffer << x_y_z.y();
-               gtk_entry_set_text( m_vector3.m_y, buffer.c_str() );
+               m_vector3.m_y.text(buffer.c_str());
                buffer.clear();
 
                buffer << x_y_z.z();
                buffer.clear();
 
                buffer << x_y_z.z();
-               gtk_entry_set_text( m_vector3.m_z, buffer.c_str() );
+               m_vector3.m_z.text(buffer.c_str());
                buffer.clear();
        }
        else
        {
                buffer.clear();
        }
        else
        {
-               gtk_entry_set_text( m_vector3.m_x, "0" );
-               gtk_entry_set_text( m_vector3.m_y, "0" );
-               gtk_entry_set_text( m_vector3.m_z, "0" );
+               m_vector3.m_x.text("0");
+               m_vector3.m_y.text("0");
+               m_vector3.m_z.text("0");
        }
 }
 typedef MemberCaller<Vector3Attribute, &Vector3Attribute::update> UpdateCaller;
        }
 }
 typedef MemberCaller<Vector3Attribute, &Vector3Attribute::update> UpdateCaller;
@@ -639,10 +641,10 @@ static gboolean changed( GtkComboBox *widget, NonModalComboBox* self ){
 public:
 NonModalComboBox( const Callback& changed ) : m_changed( changed ), m_changedHandler( 0 ){
 }
 public:
 NonModalComboBox( const Callback& changed ) : m_changed( changed ), m_changedHandler( 0 ){
 }
-void connect( GtkComboBox* combo ){
-       m_changedHandler = g_signal_connect( G_OBJECT( combo ), "changed", G_CALLBACK( changed ), this );
+void connect( ui::ComboBox combo ){
+       m_changedHandler = combo.connect( "changed", G_CALLBACK( changed ), this );
 }
 }
-void setActive( GtkComboBox* combo, int value ){
+void setActive( ui::ComboBox combo, int value ){
        g_signal_handler_disconnect( G_OBJECT( combo ), m_changedHandler );
        gtk_combo_box_set_active( combo, value );
        connect( combo );
        g_signal_handler_disconnect( G_OBJECT( combo ), m_changedHandler );
        gtk_combo_box_set_active( combo, value );
        connect( combo );
@@ -652,7 +654,7 @@ void setActive( GtkComboBox* combo, int value ){
 class ListAttribute : public EntityAttribute
 {
 CopiedString m_key;
 class ListAttribute : public EntityAttribute
 {
 CopiedString m_key;
-GtkComboBox* m_combo;
+ui::ComboBox m_combo;
 NonModalComboBox m_nonModal;
 const ListAttributeType& m_type;
 public:
 NonModalComboBox m_nonModal;
 const ListAttributeType& m_type;
 public:
@@ -661,7 +663,7 @@ ListAttribute( const char* key, const ListAttributeType& type ) :
        m_combo( 0 ),
        m_nonModal( ApplyCaller( *this ) ),
        m_type( type ){
        m_combo( 0 ),
        m_nonModal( ApplyCaller( *this ) ),
        m_type( type ){
-       auto combo = ui::ComboBoxText();
+       auto combo = ui::ComboBoxText(ui::New);
 
        for ( ListAttributeType::const_iterator i = type.begin(); i != type.end(); ++i )
        {
 
        for ( ListAttributeType::const_iterator i = type.begin(); i != type.end(); ++i )
        {
@@ -701,23 +703,23 @@ typedef MemberCaller<ListAttribute, &ListAttribute::update> UpdateCaller;
 
 namespace
 {
 
 namespace
 {
-ui::Widget g_entity_split1;
-ui::Widget g_entity_split2;
+ui::Widget g_entity_split1{ui::null};
+ui::Widget g_entity_split2{ui::null};
 int g_entitysplit1_position;
 int g_entitysplit2_position;
 
 bool g_entityInspector_windowConstructed = false;
 
 GtkTreeView* g_entityClassList;
 int g_entitysplit1_position;
 int g_entitysplit2_position;
 
 bool g_entityInspector_windowConstructed = false;
 
 GtkTreeView* g_entityClassList;
-GtkTextView* g_entityClassComment;
+ui::TextView g_entityClassComment{ui::null};
 
 GtkCheckButton* g_entitySpawnflagsCheck[MAX_FLAGS];
 
 
 GtkCheckButton* g_entitySpawnflagsCheck[MAX_FLAGS];
 
-GtkEntry* g_entityKeyEntry;
-GtkEntry* g_entityValueEntry;
+ui::Entry g_entityKeyEntry{ui::null};
+ui::Entry g_entityValueEntry{ui::null};
 
 
-ui::ListStore g_entlist_store{nullptr};
-ui::ListStore g_entprops_store{nullptr};
+ui::ListStore g_entlist_store{ui::null};
+ui::ListStore g_entprops_store{ui::null};
 const EntityClass* g_current_flags = 0;
 const EntityClass* g_current_comment = 0;
 const EntityClass* g_current_attributes = 0;
 const EntityClass* g_current_flags = 0;
 const EntityClass* g_current_comment = 0;
 const EntityClass* g_current_attributes = 0;
@@ -730,7 +732,7 @@ int spawn_table[MAX_FLAGS];
 // the table is a 4x4 in which we need to put the comment box g_entityClassComment and the spawn flags..
 GtkTable* g_spawnflagsTable;
 
 // the table is a 4x4 in which we need to put the comment box g_entityClassComment and the spawn flags..
 GtkTable* g_spawnflagsTable;
 
-ui::VBox g_attributeBox{nullptr};
+ui::VBox g_attributeBox{ui::null};
 typedef std::vector<EntityAttribute*> EntityAttributes;
 EntityAttributes g_entityAttributes;
 }
 typedef std::vector<EntityAttribute*> EntityAttributes;
 EntityAttributes g_entityAttributes;
 }
@@ -808,9 +810,7 @@ public:
 EntityClassListStoreAppend( ui::ListStore store_ ) : store( store_ ){
 }
 void visit( EntityClass* e ){
 EntityClassListStoreAppend( ui::ListStore store_ ) : store( store_ ){
 }
 void visit( EntityClass* e ){
-       GtkTreeIter iter;
-       gtk_list_store_append( store, &iter );
-       gtk_list_store_set( store, &iter, 0, e->name(), 1, e, -1 );
+       store.append(0, e->name(), 1, e);
 }
 };
 
 }
 };
 
@@ -820,7 +820,7 @@ void EntityClassList_fill(){
 }
 
 void EntityClassList_clear(){
 }
 
 void EntityClassList_clear(){
-       gtk_list_store_clear( g_entlist_store );
+       g_entlist_store.clear();
 }
 
 void SetComment( EntityClass* eclass ){
 }
 
 void SetComment( EntityClass* eclass ){
@@ -830,8 +830,7 @@ void SetComment( EntityClass* eclass ){
 
        g_current_comment = eclass;
 
 
        g_current_comment = eclass;
 
-       GtkTextBuffer* buffer = gtk_text_view_get_buffer( g_entityClassComment );
-       gtk_text_buffer_set_text( buffer, eclass->comments(), -1 );
+       g_entityClassComment.text(eclass->comments());
 }
 
 void SurfaceFlags_setEntityClass( EntityClass* eclass ){
 }
 
 void SurfaceFlags_setEntityClass( EntityClass* eclass ){
@@ -859,11 +858,12 @@ void SurfaceFlags_setEntityClass( EntityClass* eclass ){
        {
                for ( int i = 0; i < g_spawnflag_count; ++i )
                {
        {
                for ( int i = 0; i < g_spawnflag_count; ++i )
                {
-                       ui::Widget widget = ui::Widget(GTK_WIDGET( g_entitySpawnflagsCheck[i] ));
-                       gtk_label_set_text( GTK_LABEL( gtk_bin_get_child(GTK_BIN(widget)) ), " " );
-                       gtk_widget_hide( widget );
+                       auto widget = ui::Widget(GTK_WIDGET(g_entitySpawnflagsCheck[i]));
+                       auto label = ui::Label(GTK_LABEL(gtk_bin_get_child(GTK_BIN(widget))));
+                       label.text(" ");
+                       widget.hide();
                        g_object_ref( widget );
                        g_object_ref( widget );
-                       gtk_container_remove( GTK_CONTAINER( g_spawnflagsTable ), widget );
+                       ui::Container(GTK_CONTAINER(g_spawnflagsTable)).remove(widget);
                }
        }
 
                }
        }
 
@@ -881,9 +881,10 @@ void SurfaceFlags_setEntityClass( EntityClass* eclass ){
                        gtk_table_attach( g_spawnflagsTable, widget, i % 4, i % 4 + 1, i / 4, i / 4 + 1,
                                                          (GtkAttachOptions)( GTK_FILL ),
                                                          (GtkAttachOptions)( GTK_FILL ), 0, 0 );
                        gtk_table_attach( g_spawnflagsTable, widget, i % 4, i % 4 + 1, i / 4, i / 4 + 1,
                                                          (GtkAttachOptions)( GTK_FILL ),
                                                          (GtkAttachOptions)( GTK_FILL ), 0, 0 );
-                       g_object_unref( widget );
+                       widget.unref();
 
 
-                       gtk_label_set_text( GTK_LABEL( gtk_bin_get_child(GTK_BIN(widget)) ), str.c_str() );
+                       auto label = ui::Label(GTK_LABEL(gtk_bin_get_child(GTK_BIN(widget)) ));
+                       label.text(str.c_str());
                }
        }
 }
                }
        }
 }
@@ -1037,24 +1038,22 @@ void EntityInspector_updateKeyValues(){
 
        // save current key/val pair around filling epair box
        // row_select wipes it and sets to first in list
 
        // save current key/val pair around filling epair box
        // row_select wipes it and sets to first in list
-       CopiedString strKey( gtk_entry_get_text( g_entityKeyEntry ) );
-       CopiedString strVal( gtk_entry_get_text( g_entityValueEntry ) );
+       CopiedString strKey( g_entityKeyEntry.text() );
+       CopiedString strVal( g_entityValueEntry.text() );
 
 
-       gtk_list_store_clear( store );
+       store.clear();
        // Walk through list and add pairs
        for ( KeyValues::iterator i = g_selectedKeyValues.begin(); i != g_selectedKeyValues.end(); ++i )
        {
        // Walk through list and add pairs
        for ( KeyValues::iterator i = g_selectedKeyValues.begin(); i != g_selectedKeyValues.end(); ++i )
        {
-               GtkTreeIter iter;
-               gtk_list_store_append( store, &iter );
                StringOutputStream key( 64 );
                key << ( *i ).first.c_str();
                StringOutputStream value( 64 );
                value << ( *i ).second.c_str();
                StringOutputStream key( 64 );
                key << ( *i ).first.c_str();
                StringOutputStream value( 64 );
                value << ( *i ).second.c_str();
-               gtk_list_store_set( store, &iter, 0, key.c_str(), 1, value.c_str(), -1 );
+               store.append(0, key.c_str(), 1, value.c_str());
        }
 
        }
 
-       gtk_entry_set_text( g_entityKeyEntry, strKey.c_str() );
-       gtk_entry_set_text( g_entityValueEntry, strVal.c_str() );
+       g_entityKeyEntry.text( strKey.c_str() );
+       g_entityValueEntry.text( strVal.c_str() );
 
        for ( EntityAttributes::const_iterator i = g_entityAttributes.begin(); i != g_entityAttributes.end(); ++i )
        {
 
        for ( EntityAttributes::const_iterator i = g_entityAttributes.begin(); i != g_entityAttributes.end(); ++i )
        {
@@ -1194,7 +1193,7 @@ static gint EntityClassList_button_press( ui::Widget widget, GdkEventButton *eve
 static gint EntityClassList_keypress( ui::Widget widget, GdkEventKey* event, gpointer data ){
        unsigned int code = gdk_keyval_to_upper( event->keyval );
 
 static gint EntityClassList_keypress( ui::Widget widget, GdkEventKey* event, gpointer data ){
        unsigned int code = gdk_keyval_to_upper( event->keyval );
 
-       if ( event->keyval == GDK_Return ) {
+       if ( event->keyval == GDK_KEY_Return ) {
                EntityClassList_createEntity();
                return TRUE;
        }
                EntityClassList_createEntity();
                return TRUE;
        }
@@ -1248,8 +1247,8 @@ static void EntityProperties_selection_changed( GtkTreeSelection* selection, gpo
        char* val;
        gtk_tree_model_get( model, &iter, 0, &key, 1, &val, -1 );
 
        char* val;
        gtk_tree_model_get( model, &iter, 0, &key, 1, &val, -1 );
 
-       gtk_entry_set_text( g_entityKeyEntry, key );
-       gtk_entry_set_text( g_entityValueEntry, val );
+       g_entityKeyEntry.text( key );
+       g_entityValueEntry.text( val );
 
        g_free( key );
        g_free( val );
 
        g_free( key );
        g_free( val );
@@ -1260,9 +1259,9 @@ static void SpawnflagCheck_toggled( ui::Widget widget, gpointer data ){
 }
 
 static gint EntityEntry_keypress( GtkEntry* widget, GdkEventKey* event, gpointer data ){
 }
 
 static gint EntityEntry_keypress( GtkEntry* widget, GdkEventKey* event, gpointer data ){
-       if ( event->keyval == GDK_Return ) {
+       if ( event->keyval == GDK_KEY_Return ) {
                if ( widget == g_entityKeyEntry ) {
                if ( widget == g_entityKeyEntry ) {
-                       gtk_entry_set_text( g_entityValueEntry, "" );
+                       g_entityValueEntry.text( "" );
                        gtk_window_set_focus( GTK_WINDOW( gtk_widget_get_toplevel( GTK_WIDGET( widget ) ) ), GTK_WIDGET( g_entityValueEntry ) );
                }
                else
                        gtk_window_set_focus( GTK_WINDOW( gtk_widget_get_toplevel( GTK_WIDGET( widget ) ) ), GTK_WIDGET( g_entityValueEntry ) );
                }
                else
@@ -1271,7 +1270,7 @@ static gint EntityEntry_keypress( GtkEntry* widget, GdkEventKey* event, gpointer
                }
                return TRUE;
        }
                }
                return TRUE;
        }
-       if ( event->keyval == GDK_Escape ) {
+       if ( event->keyval == GDK_KEY_Escape ) {
                gtk_window_set_focus( GTK_WINDOW( gtk_widget_get_toplevel( GTK_WIDGET( widget ) ) ), NULL );
                return TRUE;
        }
                gtk_window_set_focus( GTK_WINDOW( gtk_widget_get_toplevel( GTK_WIDGET( widget ) ) ), NULL );
                return TRUE;
        }
@@ -1292,17 +1291,17 @@ ui::Widget EntityInspector_constructWindow( ui::Window toplevel ){
        vbox.show();
        gtk_container_set_border_width( GTK_CONTAINER( vbox ), 2 );
 
        vbox.show();
        gtk_container_set_border_width( GTK_CONTAINER( vbox ), 2 );
 
-       g_signal_connect( G_OBJECT( vbox ), "destroy", G_CALLBACK( EntityInspector_destroyWindow ), 0 );
+       vbox.connect( "destroy", G_CALLBACK( EntityInspector_destroyWindow ), 0 );
 
        {
 
        {
-               ui::Widget split1 = ui::VPaned();
+               ui::Widget split1 = ui::VPaned(ui::New);
                gtk_box_pack_start( GTK_BOX( vbox ), split1, TRUE, TRUE, 0 );
                split1.show();
 
                g_entity_split1 = split1;
 
                {
                gtk_box_pack_start( GTK_BOX( vbox ), split1, TRUE, TRUE, 0 );
                split1.show();
 
                g_entity_split1 = split1;
 
                {
-                       ui::Widget split2 = ui::VPaned();
+                       ui::Widget split2 = ui::VPaned(ui::New);
                        gtk_paned_add1( GTK_PANED( split1 ), split2 );
                        split2.show();
 
                        gtk_paned_add1( GTK_PANED( split1 ), split2 );
                        split2.show();
 
@@ -1310,7 +1309,7 @@ ui::Widget EntityInspector_constructWindow( ui::Window toplevel ){
 
                        {
                                // class list
 
                        {
                                // class list
-                               auto scr = ui::ScrolledWindow();
+                               auto scr = ui::ScrolledWindow(ui::New);
                                scr.show();
                                gtk_paned_add1( GTK_PANED( split2 ), scr );
                                gtk_scrolled_window_set_policy( GTK_SCROLLED_WINDOW( scr ), GTK_POLICY_NEVER, GTK_POLICY_ALWAYS );
                                scr.show();
                                gtk_paned_add1( GTK_PANED( split2 ), scr );
                                gtk_scrolled_window_set_policy( GTK_SCROLLED_WINDOW( scr ), GTK_POLICY_NEVER, GTK_POLICY_ALWAYS );
@@ -1322,39 +1321,39 @@ ui::Widget EntityInspector_constructWindow( ui::Window toplevel ){
                                        auto view = ui::TreeView( ui::TreeModel( GTK_TREE_MODEL( store ) ));
                                        gtk_tree_view_set_enable_search( GTK_TREE_VIEW( view ), FALSE );
                                        gtk_tree_view_set_headers_visible( view, FALSE );
                                        auto view = ui::TreeView( ui::TreeModel( GTK_TREE_MODEL( store ) ));
                                        gtk_tree_view_set_enable_search( GTK_TREE_VIEW( view ), FALSE );
                                        gtk_tree_view_set_headers_visible( view, FALSE );
-                                       g_signal_connect( G_OBJECT( view ), "button_press_event", G_CALLBACK( EntityClassList_button_press ), 0 );
-                                       g_signal_connect( G_OBJECT( view ), "key_press_event", G_CALLBACK( EntityClassList_keypress ), 0 );
+                                       view.connect( "button_press_event", G_CALLBACK( EntityClassList_button_press ), 0 );
+                                       view.connect( "key_press_event", G_CALLBACK( EntityClassList_keypress ), 0 );
 
                                        {
 
                                        {
-                                               auto renderer = ui::CellRendererText();
+                                               auto renderer = ui::CellRendererText(ui::New);
                                                GtkTreeViewColumn* column = ui::TreeViewColumn( "Key", renderer, {{"text", 0}} );
                                                gtk_tree_view_append_column( view, column );
                                        }
 
                                        {
                                                GtkTreeViewColumn* column = ui::TreeViewColumn( "Key", renderer, {{"text", 0}} );
                                                gtk_tree_view_append_column( view, column );
                                        }
 
                                        {
-                                               GtkTreeSelection* selection = gtk_tree_view_get_selection( view );
-                                               g_signal_connect( G_OBJECT( selection ), "changed", G_CALLBACK( EntityClassList_selection_changed ), 0 );
+                                               auto selection = ui::TreeSelection(gtk_tree_view_get_selection( view ));
+                                               selection.connect( "changed", G_CALLBACK( EntityClassList_selection_changed ), 0 );
                                        }
 
                                        view.show();
 
                                        scr.add(view);
 
                                        }
 
                                        view.show();
 
                                        scr.add(view);
 
-                                       g_object_unref( G_OBJECT( store ) );
+                                       store.unref();
                                        g_entityClassList = view;
                                        g_entlist_store = store;
                                }
                        }
 
                        {
                                        g_entityClassList = view;
                                        g_entlist_store = store;
                                }
                        }
 
                        {
-                               auto scr = ui::ScrolledWindow();
+                               auto scr = ui::ScrolledWindow(ui::New);
                                scr.show();
                                gtk_paned_add2( GTK_PANED( split2 ), scr );
                                gtk_scrolled_window_set_policy( GTK_SCROLLED_WINDOW( scr ), GTK_POLICY_NEVER, GTK_POLICY_ALWAYS );
                                gtk_scrolled_window_set_shadow_type( GTK_SCROLLED_WINDOW( scr ), GTK_SHADOW_IN );
 
                                {
                                scr.show();
                                gtk_paned_add2( GTK_PANED( split2 ), scr );
                                gtk_scrolled_window_set_policy( GTK_SCROLLED_WINDOW( scr ), GTK_POLICY_NEVER, GTK_POLICY_ALWAYS );
                                gtk_scrolled_window_set_shadow_type( GTK_SCROLLED_WINDOW( scr ), GTK_SHADOW_IN );
 
                                {
-                                       auto text = ui::TextView();
+                                       auto text = ui::TextView(ui::New);
                                        gtk_widget_set_size_request( GTK_WIDGET( text ), 0, -1 ); // allow shrinking
                                        gtk_text_view_set_wrap_mode( text, GTK_WRAP_WORD );
                                        gtk_text_view_set_editable( text, FALSE );
                                        gtk_widget_set_size_request( GTK_WIDGET( text ), 0, -1 ); // allow shrinking
                                        gtk_text_view_set_wrap_mode( text, GTK_WRAP_WORD );
                                        gtk_text_view_set_editable( text, FALSE );
@@ -1366,7 +1365,7 @@ ui::Widget EntityInspector_constructWindow( ui::Window toplevel ){
                }
 
                {
                }
 
                {
-                       ui::Widget split2 = ui::VPaned();
+                       ui::Widget split2 = ui::VPaned(ui::New);
                        gtk_paned_add2( GTK_PANED( split1 ), split2 );
                        split2.show();
 
                        gtk_paned_add2( GTK_PANED( split1 ), split2 );
                        split2.show();
 
@@ -1385,16 +1384,16 @@ ui::Widget EntityInspector_constructWindow( ui::Window toplevel ){
 
                                        for ( int i = 0; i < MAX_FLAGS; i++ )
                                        {
 
                                        for ( int i = 0; i < MAX_FLAGS; i++ )
                                        {
-                                               GtkCheckButton* check = ui::CheckButton( "" );
+                                               auto check = ui::CheckButton( "" );
                                                g_object_ref( GTK_WIDGET( check ) );
                                                g_object_ref( GTK_WIDGET( check ) );
-                                               g_object_set_data( G_OBJECT( check ), "handler", gint_to_pointer( g_signal_connect( G_OBJECT( check ), "toggled", G_CALLBACK( SpawnflagCheck_toggled ), 0 ) ) );
+                                               g_object_set_data( G_OBJECT( check ), "handler", gint_to_pointer( check.connect( "toggled", G_CALLBACK( SpawnflagCheck_toggled ), 0 ) ) );
                                                g_entitySpawnflagsCheck[i] = check;
                                        }
                                }
 
                                {
                                        // key/value list
                                                g_entitySpawnflagsCheck[i] = check;
                                        }
                                }
 
                                {
                                        // key/value list
-                                       auto scr = ui::ScrolledWindow();
+                                       auto scr = ui::ScrolledWindow(ui::New);
                                        scr.show();
                                        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 );
                                        scr.show();
                                        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 );
@@ -1408,27 +1407,27 @@ ui::Widget EntityInspector_constructWindow( ui::Window toplevel ){
                                                gtk_tree_view_set_headers_visible( GTK_TREE_VIEW( view ), FALSE );
 
                                                {
                                                gtk_tree_view_set_headers_visible( GTK_TREE_VIEW( view ), FALSE );
 
                                                {
-                                                       auto renderer = ui::CellRendererText();
+                                                       auto renderer = ui::CellRendererText(ui::New);
                                                        GtkTreeViewColumn* column = ui::TreeViewColumn( "", renderer, {{"text", 0}} );
                                                        gtk_tree_view_append_column( GTK_TREE_VIEW( view ), column );
                                                }
 
                                                {
                                                        GtkTreeViewColumn* column = ui::TreeViewColumn( "", renderer, {{"text", 0}} );
                                                        gtk_tree_view_append_column( GTK_TREE_VIEW( view ), column );
                                                }
 
                                                {
-                                                       auto renderer = ui::CellRendererText();
+                                                       auto renderer = ui::CellRendererText(ui::New);
                                                        GtkTreeViewColumn* column = ui::TreeViewColumn( "", renderer, {{"text", 1}} );
                                                        gtk_tree_view_append_column( GTK_TREE_VIEW( view ), column );
                                                }
 
                                                {
                                                        GtkTreeViewColumn* column = ui::TreeViewColumn( "", renderer, {{"text", 1}} );
                                                        gtk_tree_view_append_column( GTK_TREE_VIEW( view ), column );
                                                }
 
                                                {
-                                                       GtkTreeSelection* selection = gtk_tree_view_get_selection( GTK_TREE_VIEW( view ) );
-                                                       g_signal_connect( G_OBJECT( selection ), "changed", G_CALLBACK( EntityProperties_selection_changed ), 0 );
+                                                       auto selection = ui::TreeSelection(gtk_tree_view_get_selection( GTK_TREE_VIEW( view ) ));
+                                                       selection.connect( "changed", G_CALLBACK( EntityProperties_selection_changed ), 0 );
                                                }
 
                                                view.show();
 
                                                scr.add(view);
 
                                                }
 
                                                view.show();
 
                                                scr.add(view);
 
-                                               g_object_unref( G_OBJECT( store ) );
+                                               store.unref();
 
                                                g_entprops_store = store;
                                        }
 
                                                g_entprops_store = store;
                                        }
@@ -1443,24 +1442,24 @@ ui::Widget EntityInspector_constructWindow( ui::Window toplevel ){
                                        gtk_table_set_col_spacings( table, 5 );
 
                                        {
                                        gtk_table_set_col_spacings( table, 5 );
 
                                        {
-                                               auto entry = ui::Entry();
+                                               auto entry = ui::Entry(ui::New);
                                                entry.show();
                                                gtk_table_attach( table, GTK_WIDGET( entry ), 1, 2, 0, 1,
                                                                                  (GtkAttachOptions)( GTK_EXPAND | GTK_FILL ),
                                                                                  (GtkAttachOptions)( 0 ), 0, 0 );
                                                gtk_widget_set_events( GTK_WIDGET( entry ), GDK_KEY_PRESS_MASK );
                                                entry.show();
                                                gtk_table_attach( table, GTK_WIDGET( entry ), 1, 2, 0, 1,
                                                                                  (GtkAttachOptions)( GTK_EXPAND | GTK_FILL ),
                                                                                  (GtkAttachOptions)( 0 ), 0, 0 );
                                                gtk_widget_set_events( GTK_WIDGET( entry ), GDK_KEY_PRESS_MASK );
-                                               g_signal_connect( G_OBJECT( entry ), "key_press_event", G_CALLBACK( EntityEntry_keypress ), 0 );
+                                               entry.connect( "key_press_event", G_CALLBACK( EntityEntry_keypress ), 0 );
                                                g_entityKeyEntry = entry;
                                        }
 
                                        {
                                                g_entityKeyEntry = entry;
                                        }
 
                                        {
-                                               auto entry = ui::Entry();
+                                               auto entry = ui::Entry(ui::New);
                                                entry.show();
                                                gtk_table_attach( table, GTK_WIDGET( entry ), 1, 2, 1, 2,
                                                                                  (GtkAttachOptions)( GTK_EXPAND | GTK_FILL ),
                                                                                  (GtkAttachOptions)( 0 ), 0, 0 );
                                                gtk_widget_set_events( GTK_WIDGET( entry ), GDK_KEY_PRESS_MASK );
                                                entry.show();
                                                gtk_table_attach( table, GTK_WIDGET( entry ), 1, 2, 1, 2,
                                                                                  (GtkAttachOptions)( GTK_EXPAND | GTK_FILL ),
                                                                                  (GtkAttachOptions)( 0 ), 0, 0 );
                                                gtk_widget_set_events( GTK_WIDGET( entry ), GDK_KEY_PRESS_MASK );
-                                               g_signal_connect( G_OBJECT( entry ), "key_press_event", G_CALLBACK( EntityEntry_keypress ), 0 );
+                                               entry.connect( "key_press_event", G_CALLBACK( EntityEntry_keypress ), 0 );
                                                g_entityValueEntry = entry;
                                        }
 
                                                g_entityValueEntry = entry;
                                        }
 
@@ -1491,20 +1490,20 @@ ui::Widget EntityInspector_constructWindow( ui::Window toplevel ){
                                        {
                                                auto button = ui::Button( "Clear All" );
                                                button.show();
                                        {
                                                auto button = ui::Button( "Clear All" );
                                                button.show();
-                                               g_signal_connect( G_OBJECT( button ), "clicked", G_CALLBACK( EntityInspector_clearAllKeyValues ), 0 );
+                                               button.connect( "clicked", G_CALLBACK( EntityInspector_clearAllKeyValues ), 0 );
                                                gtk_box_pack_start( hbox, GTK_WIDGET( button ), TRUE, TRUE, 0 );
                                        }
                                        {
                                                auto button = ui::Button( "Delete Key" );
                                                button.show();
                                                gtk_box_pack_start( hbox, GTK_WIDGET( button ), TRUE, TRUE, 0 );
                                        }
                                        {
                                                auto button = ui::Button( "Delete Key" );
                                                button.show();
-                                               g_signal_connect( G_OBJECT( button ), "clicked", G_CALLBACK( EntityInspector_clearKeyValue ), 0 );
+                                               button.connect( "clicked", G_CALLBACK( EntityInspector_clearKeyValue ), 0 );
                                                gtk_box_pack_start( hbox, GTK_WIDGET( button ), TRUE, TRUE, 0 );
                                        }
                                }
                        }
 
                        {
                                                gtk_box_pack_start( hbox, GTK_WIDGET( button ), TRUE, TRUE, 0 );
                                        }
                                }
                        }
 
                        {
-                               auto scr = ui::ScrolledWindow();
+                               auto scr = ui::ScrolledWindow(ui::New);
                                scr.show();
                                gtk_scrolled_window_set_policy( GTK_SCROLLED_WINDOW( scr ), GTK_POLICY_NEVER, GTK_POLICY_AUTOMATIC );
 
                                scr.show();
                                gtk_scrolled_window_set_policy( GTK_SCROLLED_WINDOW( scr ), GTK_POLICY_NEVER, GTK_POLICY_AUTOMATIC );