#include "map.h"
+#include <gtk/gtk.h>
+
#include "debugging/debugging.h"
#include "imap.h"
void DoMapInfo(){
ModalDialog dialog;
- GtkEntry* brushes_entry;
- GtkEntry* entities_entry;
- ui::ListStore EntityBreakdownWalker{nullptr};
+ ui::Entry brushes_entry{ui::null};
+ ui::Entry entities_entry{ui::null};
+ ui::ListStore EntityBreakdownWalker{ui::null};
ui::Window window = MainFrame_getWindow().create_dialog_window("Map Info", G_CALLBACK(dialog_delete_callback ), &dialog );
gtk_box_pack_start( GTK_BOX( hbox ), GTK_WIDGET( table ), TRUE, TRUE, 0 );
{
- 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 ),
brushes_entry = 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 ),
gtk_tree_view_set_headers_clickable( GTK_TREE_VIEW( view ), TRUE );
{
- auto renderer = ui::CellRendererText();
+ auto renderer = ui::CellRendererText(ui::New);
GtkTreeViewColumn* column = ui::TreeViewColumn( "Entity", renderer, {{"text", 0}} );
gtk_tree_view_append_column( GTK_TREE_VIEW( view ), column );
gtk_tree_view_column_set_sort_column_id( column, 0 );
}
{
- auto renderer = ui::CellRendererText();
+ auto renderer = ui::CellRendererText(ui::New);
GtkTreeViewColumn* column = ui::TreeViewColumn( "Count", renderer, {{"text", 1}} );
gtk_tree_view_append_column( GTK_TREE_VIEW( view ), column );
gtk_tree_view_column_set_sort_column_id( column, 1 );
{
char tmp[16];
sprintf( tmp, "%u", Unsigned( ( *i ).second ) );
- GtkTreeIter iter;
- gtk_list_store_append( GTK_LIST_STORE( EntityBreakdownWalker ), &iter );
- gtk_list_store_set( GTK_LIST_STORE( EntityBreakdownWalker ), &iter, 0, ( *i ).first.c_str(), 1, tmp, -1 );
+ EntityBreakdownWalker.append(0, (*i).first.c_str(), 1, tmp);
}
}
- g_object_unref( G_OBJECT( EntityBreakdownWalker ) );
+ EntityBreakdownWalker.unref();
char tmp[16];
sprintf( tmp, "%u", Unsigned( g_brushCount.get() ) );
- gtk_entry_set_text( GTK_ENTRY( brushes_entry ), tmp );
+ brushes_entry.text(tmp);
sprintf( tmp, "%u", Unsigned( g_entityCount.get() ) );
- gtk_entry_set_text( GTK_ENTRY( entities_entry ), tmp );
+ entities_entry.text(tmp);
modal_dialog_show( window, dialog );
// save before exit
window_get_position( window, g_posMapInfoWnd );
- gtk_widget_destroy( GTK_WIDGET( window ) );
+ window.destroy();
}
void DoFind(){
ModalDialog dialog;
- GtkEntry* entity;
- GtkEntry* brush;
+ ui::Entry entity{ui::null};
+ ui::Entry brush{ui::null};
ui::Window window = MainFrame_getWindow().create_dialog_window("Find Brush", G_CALLBACK(dialog_delete_callback ), &dialog );
- auto accel = ui::AccelGroup();
+ auto accel = ui::AccelGroup(ui::New);
window.add_accel_group( accel );
{
(GtkAttachOptions) ( 0 ), 0, 0 );
}
{
- 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 ),
entity = 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 ),
GetSelectionIndex( &ent, &br );
sprintf( buf, "%i", ent );
- gtk_entry_set_text( entity, buf );
+ entity.text(buf);
sprintf( buf, "%i", br );
- gtk_entry_set_text( brush, buf );
+ brush.text(buf);
if ( modal_dialog_show( window, dialog ) == eIDOK ) {
const char *entstr = gtk_entry_get_text( entity );
SelectBrush( atoi( entstr ), atoi( brushstr ) );
}
- gtk_widget_destroy( GTK_WIDGET( window ) );
+ window.destroy();
}
void Map_constructPreferences( PreferencesPage& page ){