#include "gtkdlgs.h"
+#include <gtk/gtk.h>
+
#include "debugging/debugging.h"
#include "version.h"
#include "aboutmsg.h"
#include "iselection.h"
#include <gdk/gdkkeysyms.h>
-#include <gtk/gtk.h>
#include <uilib/uilib.h>
#include "os/path.h"
};
ui::Window ProjectSettingsDialog_construct( ProjectSettingsDialog& dialog, ModalDialog& modal ){
- ui::Window window = MainFrame_getWindow().create_dialog_window("Project Settings", G_CALLBACK(dialog_delete_callback ), &modal );
+ auto window = MainFrame_getWindow().create_dialog_window("Project Settings", G_CALLBACK(dialog_delete_callback ), &modal );
{
- GtkTable* table1 = create_dialog_table( 1, 2, 4, 4, 4 );
- gtk_container_add( GTK_CONTAINER( window ), GTK_WIDGET( table1 ) );
+ auto table1 = create_dialog_table( 1, 2, 4, 4, 4 );
+ window.add(table1);
{
GtkVBox* vbox = create_dialog_vbox( 4 );
gtk_table_attach( table1, GTK_WIDGET( vbox ), 1, 2, 0, 1,
}
}
{
- GtkFrame* frame = create_dialog_frame( "Project settings" );
+ auto frame = create_dialog_frame( "Project settings" );
gtk_table_attach( table1, GTK_WIDGET( frame ), 0, 1, 0, 1,
(GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ),
(GtkAttachOptions) ( GTK_FILL ), 0, 0 );
{
- GtkTable* table2 = create_dialog_table( ( globalMappingMode().do_mapping_mode ) ? 4 : 3, 2, 4, 4, 4 );
- gtk_container_add( GTK_CONTAINER( frame ), GTK_WIDGET( table2 ) );
+ auto table2 = create_dialog_table( ( globalMappingMode().do_mapping_mode ) ? 4 : 3, 2, 4, 4, 4 );
+ frame.add(table2);
{
- GtkLabel* label = GTK_LABEL( ui::Label( "Select mod" ) );
- gtk_widget_show( GTK_WIDGET( label ) );
+ auto label = ui::Label( "Select mod" );
+ label.show();
gtk_table_attach( table2, GTK_WIDGET( label ), 0, 1, 0, 1,
(GtkAttachOptions) ( GTK_FILL ),
(GtkAttachOptions) ( 0 ), 0, 0 );
}
gtk_combo_box_text_append_text( dialog.game_combo.game_select, globalGameComboConfiguration().custom );
- gtk_widget_show( GTK_WIDGET( dialog.game_combo.game_select ) );
+ dialog.game_combo.game_select.show();
gtk_table_attach( table2, GTK_WIDGET( dialog.game_combo.game_select ), 1, 2, 0, 1,
(GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ),
(GtkAttachOptions) ( 0 ), 0, 0 );
- g_signal_connect( G_OBJECT( dialog.game_combo.game_select ), "changed", G_CALLBACK( OnSelchangeComboWhatgame ), &dialog.game_combo );
+ dialog.game_combo.game_select.connect( "changed", G_CALLBACK( OnSelchangeComboWhatgame ), &dialog.game_combo );
}
{
- GtkLabel* label = GTK_LABEL( ui::Label( "fs_game" ) );
- gtk_widget_show( GTK_WIDGET( label ) );
+ auto label = ui::Label( "fs_game" );
+ label.show();
gtk_table_attach( table2, GTK_WIDGET( label ), 0, 1, 1, 2,
(GtkAttachOptions) ( GTK_FILL ),
(GtkAttachOptions) ( 0 ), 0, 0 );
gtk_misc_set_alignment( GTK_MISC( label ), 1, 0.5 );
}
{
- GtkEntry* entry = ui::Entry();
- gtk_widget_show( GTK_WIDGET( entry ) );
+ auto entry = ui::Entry();
+ entry.show();
gtk_table_attach( table2, GTK_WIDGET( entry ), 1, 2, 1, 2,
(GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ),
(GtkAttachOptions) ( 0 ), 0, 0 );
}
if ( globalMappingMode().do_mapping_mode ) {
- GtkLabel* label = GTK_LABEL( ui::Label( "Mapping mode" ) );
- gtk_widget_show( GTK_WIDGET( label ) );
+ auto label = ui::Label( "Mapping mode" );
+ label.show();
gtk_table_attach( table2, GTK_WIDGET( label ), 0, 1, 3, 4,
(GtkAttachOptions) ( GTK_FILL ),
(GtkAttachOptions) ( 0 ), 0, 0 );
gtk_combo_box_text_append_text( combo, globalMappingMode().sp_mapping_mode );
gtk_combo_box_text_append_text( combo, globalMappingMode().mp_mapping_mode );
- gtk_widget_show( GTK_WIDGET( combo ) );
+ combo.show();
gtk_table_attach( table2, GTK_WIDGET( combo ), 1, 2, 3, 4,
(GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ),
(GtkAttachOptions) ( 0 ), 0, 0 );
ModalDialog dialog;
GtkEntry* sides_entry;
- ui::Window window = MainFrame_getWindow().create_dialog_window("Arbitrary sides", G_CALLBACK(dialog_delete_callback ), &dialog );
+ auto window = MainFrame_getWindow().create_dialog_window("Arbitrary sides", G_CALLBACK(dialog_delete_callback ), &dialog );
auto accel = ui::AccelGroup();
window.add_accel_group( accel );
{
- GtkHBox* hbox = create_dialog_hbox( 4, 4 );
- gtk_container_add( GTK_CONTAINER( window ), GTK_WIDGET( hbox ) );
+ auto hbox = create_dialog_hbox( 4, 4 );
+ window.add(hbox);
{
- GtkLabel* label = GTK_LABEL( ui::Label( "Sides:" ) );
- gtk_widget_show( GTK_WIDGET( label ) );
+ auto label = ui::Label( "Sides:" );
+ label.show();
gtk_box_pack_start( GTK_BOX( hbox ), GTK_WIDGET( label ), FALSE, FALSE, 0 );
}
{
- GtkEntry* entry = ui::Entry();
- gtk_widget_show( GTK_WIDGET( entry ) );
+ auto entry = ui::Entry();
+ entry.show();
gtk_box_pack_start( GTK_BOX( hbox ), GTK_WIDGET( entry ), FALSE, FALSE, 0 );
sides_entry = entry;
gtk_widget_grab_focus( GTK_WIDGET( entry ) );
GtkVBox* vbox = create_dialog_vbox( 4 );
gtk_box_pack_start( GTK_BOX( hbox ), GTK_WIDGET( vbox ), TRUE, TRUE, 0 );
{
- GtkButton* button = create_dialog_button( "OK", G_CALLBACK( dialog_button_ok ), &dialog );
+ auto button = create_dialog_button( "OK", G_CALLBACK( dialog_button_ok ), &dialog );
gtk_box_pack_start( GTK_BOX( vbox ), GTK_WIDGET( button ), FALSE, FALSE, 0 );
- widget_make_default( GTK_WIDGET( button ) );
- gtk_widget_add_accelerator( GTK_WIDGET( button ), "clicked", accel, GDK_Return, (GdkModifierType)0, (GtkAccelFlags)0 );
+ widget_make_default( button );
+ gtk_widget_add_accelerator( GTK_WIDGET( button ), "clicked", accel, GDK_KEY_Return, (GdkModifierType)0, (GtkAccelFlags)0 );
}
{
GtkButton* button = create_dialog_button( "Cancel", G_CALLBACK( dialog_button_cancel ), &dialog );
gtk_box_pack_start( GTK_BOX( vbox ), GTK_WIDGET( button ), FALSE, FALSE, 0 );
- gtk_widget_add_accelerator( GTK_WIDGET( button ), "clicked", accel, GDK_Escape, (GdkModifierType)0, (GtkAccelFlags)0 );
+ gtk_widget_add_accelerator( GTK_WIDGET( button ), "clicked", accel, GDK_KEY_Escape, (GdkModifierType)0, (GtkAccelFlags)0 );
}
}
}
ModalDialog dialog;
ModalDialogButton ok_button( dialog, eIDOK );
- ui::Window window = MainFrame_getWindow().create_modal_dialog_window("About NetRadiant", dialog );
+ auto window = MainFrame_getWindow().create_modal_dialog_window("About NetRadiant", dialog );
{
- GtkVBox* vbox = create_dialog_vbox( 4, 4 );
- gtk_container_add( GTK_CONTAINER( window ), GTK_WIDGET( vbox ) );
+ auto vbox = create_dialog_vbox( 4, 4 );
+ window.add(vbox);
{
GtkHBox* hbox = create_dialog_hbox( 4 );
GtkVBox* vbox2 = create_dialog_vbox( 4 );
gtk_box_pack_start( GTK_BOX( hbox ), GTK_WIDGET( vbox2 ), TRUE, FALSE, 0 );
{
- GtkFrame* frame = create_dialog_frame( 0, GTK_SHADOW_IN );
+ auto frame = create_dialog_frame( 0, ui::Shadow::IN );
gtk_box_pack_start( GTK_BOX( vbox2 ), GTK_WIDGET( frame ), FALSE, FALSE, 0 );
{
- GtkImage* image = new_local_image( "logo.png" );
- gtk_widget_show( GTK_WIDGET( image ) );
- gtk_container_add( GTK_CONTAINER( frame ), GTK_WIDGET( image ) );
+ auto image = new_local_image( "logo.png" );
+ image.show();
+ frame.add(image);
}
}
}
"you may report your problems at\n"
"https://gitlab.com/xonotic/netradiant/issues";
- GtkLabel* label = GTK_LABEL( ui::Label( label_text ) );
+ auto label = ui::Label( label_text );
- gtk_widget_show( GTK_WIDGET( label ) );
+ label.show();
gtk_box_pack_start( GTK_BOX( hbox ), GTK_WIDGET( label ), FALSE, FALSE, 0 );
gtk_misc_set_alignment( GTK_MISC( label ), 1, 0.5 );
gtk_label_set_justify( label, GTK_JUSTIFY_LEFT );
}
}
{
- GtkFrame* frame = create_dialog_frame( "OpenGL Properties" );
+ auto frame = create_dialog_frame( "OpenGL Properties" );
gtk_box_pack_start( GTK_BOX( vbox ), GTK_WIDGET( frame ), FALSE, FALSE, 0 );
{
- GtkTable* table = create_dialog_table( 3, 2, 4, 4, 4 );
- gtk_container_add( GTK_CONTAINER( frame ), GTK_WIDGET( table ) );
+ auto table = create_dialog_table( 3, 2, 4, 4, 4 );
+ frame.add(table);
{
- GtkLabel* label = GTK_LABEL( ui::Label( "Vendor:" ) );
- gtk_widget_show( GTK_WIDGET( label ) );
+ auto label = ui::Label( "Vendor:" );
+ label.show();
gtk_table_attach( table, GTK_WIDGET( label ), 0, 1, 0, 1,
(GtkAttachOptions) ( GTK_FILL ),
(GtkAttachOptions) ( 0 ), 0, 0 );
gtk_misc_set_alignment( GTK_MISC( label ), 0, 0.5 );
}
{
- GtkLabel* label = GTK_LABEL( ui::Label( "Version:" ) );
- gtk_widget_show( GTK_WIDGET( label ) );
+ auto label = ui::Label( "Version:" );
+ label.show();
gtk_table_attach( table, GTK_WIDGET( label ), 0, 1, 1, 2,
(GtkAttachOptions) ( GTK_FILL ),
(GtkAttachOptions) ( 0 ), 0, 0 );
gtk_misc_set_alignment( GTK_MISC( label ), 0, 0.5 );
}
{
- GtkLabel* label = GTK_LABEL( ui::Label( "Renderer:" ) );
- gtk_widget_show( GTK_WIDGET( label ) );
+ auto label = ui::Label( "Renderer:" );
+ label.show();
gtk_table_attach( table, GTK_WIDGET( label ), 0, 1, 2, 3,
(GtkAttachOptions) ( GTK_FILL ),
(GtkAttachOptions) ( 0 ), 0, 0 );
gtk_misc_set_alignment( GTK_MISC( label ), 0, 0.5 );
}
{
- GtkLabel* label = GTK_LABEL( ui::Label( reinterpret_cast<const char*>( glGetString( GL_VENDOR ) ) ) );
- gtk_widget_show( GTK_WIDGET( label ) );
+ auto label = ui::Label( reinterpret_cast<const char*>( glGetString( GL_VENDOR ) ) );
+ label.show();
gtk_table_attach( table, GTK_WIDGET( label ), 1, 2, 0, 1,
(GtkAttachOptions) ( GTK_FILL ),
(GtkAttachOptions) ( 0 ), 0, 0 );
gtk_misc_set_alignment( GTK_MISC( label ), 0, 0.5 );
}
{
- GtkLabel* label = GTK_LABEL( ui::Label( reinterpret_cast<const char*>( glGetString( GL_VERSION ) ) ) );
- gtk_widget_show( GTK_WIDGET( label ) );
+ auto label = ui::Label( reinterpret_cast<const char*>( glGetString( GL_VERSION ) ) );
+ label.show();
gtk_table_attach( table, GTK_WIDGET( label ), 1, 2, 1, 2,
(GtkAttachOptions) ( GTK_FILL ),
(GtkAttachOptions) ( 0 ), 0, 0 );
gtk_misc_set_alignment( GTK_MISC( label ), 0, 0.5 );
}
{
- GtkLabel* label = GTK_LABEL( ui::Label( reinterpret_cast<const char*>( glGetString( GL_RENDERER ) ) ) );
- gtk_widget_show( GTK_WIDGET( label ) );
+ auto label = ui::Label( reinterpret_cast<const char*>( glGetString( GL_RENDERER ) ) );
+ label.show();
gtk_table_attach( table, GTK_WIDGET( label ), 1, 2, 2, 3,
(GtkAttachOptions) ( GTK_FILL ),
(GtkAttachOptions) ( 0 ), 0, 0 );
}
}
{
- GtkFrame* frame = create_dialog_frame( "OpenGL Extensions" );
+ auto frame = create_dialog_frame( "OpenGL Extensions" );
gtk_box_pack_start( GTK_BOX( vbox ), GTK_WIDGET( frame ), TRUE, TRUE, 0 );
{
- GtkScrolledWindow* sc_extensions = create_scrolled_window( GTK_POLICY_AUTOMATIC, GTK_POLICY_ALWAYS, 4 );
- gtk_container_add( GTK_CONTAINER( frame ), GTK_WIDGET( sc_extensions ) );
+ auto sc_extensions = create_scrolled_window( ui::Policy::AUTOMATIC, ui::Policy::ALWAYS, 4 );
+ frame.add(sc_extensions);
{
- ui::Widget text_extensions = ui::TextView();
+ auto text_extensions = ui::TextView();
gtk_text_view_set_editable( GTK_TEXT_VIEW( text_extensions ), FALSE );
- gtk_container_add( GTK_CONTAINER( sc_extensions ), text_extensions );
+ sc_extensions.add(text_extensions);
GtkTextBuffer* buffer = gtk_text_view_get_buffer( GTK_TEXT_VIEW( text_extensions ) );
gtk_text_buffer_set_text( buffer, reinterpret_cast<const char*>( glGetString( GL_EXTENSIONS ) ), -1 );
gtk_text_view_set_wrap_mode( GTK_TEXT_VIEW( text_extensions ), GTK_WRAP_WORD );
- gtk_widget_show( text_extensions );
+ text_extensions.show();
}
}
}
GtkEntry* x;
GtkEntry* y;
- ui::Window window = MainFrame_getWindow().create_modal_dialog_window("Patch texture layout", dialog );
+ auto window = MainFrame_getWindow().create_modal_dialog_window("Patch texture layout", dialog );
auto accel = ui::AccelGroup();
window.add_accel_group( accel );
{
- GtkHBox* hbox = create_dialog_hbox( 4, 4 );
- gtk_container_add( GTK_CONTAINER( window ), GTK_WIDGET( hbox ) );
+ auto hbox = create_dialog_hbox( 4, 4 );
+ window.add(hbox);
{
GtkVBox* vbox = create_dialog_vbox( 4 );
gtk_box_pack_start( GTK_BOX( hbox ), GTK_WIDGET( vbox ), TRUE, TRUE, 0 );
{
- GtkLabel* label = GTK_LABEL( ui::Label( "Texture will be fit across the patch based\n"
+ auto label = ui::Label( "Texture will be fit across the patch based\n"
"on the x and y values given. Values of 1x1\n"
"will \"fit\" the texture. 2x2 will repeat\n"
- "it twice, etc." ) );
- gtk_widget_show( GTK_WIDGET( label ) );
+ "it twice, etc." );
+ label.show();
gtk_box_pack_start( GTK_BOX( vbox ), GTK_WIDGET( label ), TRUE, TRUE, 0 );
gtk_label_set_justify( label, GTK_JUSTIFY_LEFT );
}
{
- GtkTable* table = create_dialog_table( 2, 2, 4, 4 );
- gtk_widget_show( GTK_WIDGET( table ) );
+ auto table = create_dialog_table( 2, 2, 4, 4 );
+ table.show();
gtk_box_pack_start( GTK_BOX( vbox ), GTK_WIDGET( table ), TRUE, TRUE, 0 );
{
- GtkLabel* label = GTK_LABEL( ui::Label( "Texture x:" ) );
- gtk_widget_show( GTK_WIDGET( label ) );
+ auto label = ui::Label( "Texture x:" );
+ label.show();
gtk_table_attach( table, GTK_WIDGET( label ), 0, 1, 0, 1,
(GtkAttachOptions) ( GTK_FILL ),
(GtkAttachOptions) ( 0 ), 0, 0 );
gtk_misc_set_alignment( GTK_MISC( label ), 0, 0.5 );
}
{
- GtkLabel* label = GTK_LABEL( ui::Label( "Texture y:" ) );
- gtk_widget_show( GTK_WIDGET( label ) );
+ auto label = ui::Label( "Texture y:" );
+ label.show();
gtk_table_attach( table, GTK_WIDGET( label ), 0, 1, 1, 2,
(GtkAttachOptions) ( GTK_FILL ),
(GtkAttachOptions) ( 0 ), 0, 0 );
gtk_misc_set_alignment( GTK_MISC( label ), 0, 0.5 );
}
{
- GtkEntry* entry = ui::Entry();
- gtk_widget_show( GTK_WIDGET( entry ) );
+ auto entry = ui::Entry();
+ entry.show();
gtk_table_attach( table, GTK_WIDGET( entry ), 1, 2, 0, 1,
(GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ),
(GtkAttachOptions) ( 0 ), 0, 0 );
x = entry;
}
{
- GtkEntry* entry = ui::Entry();
- gtk_widget_show( GTK_WIDGET( entry ) );
+ auto entry = ui::Entry();
+ entry.show();
gtk_table_attach( table, GTK_WIDGET( entry ), 1, 2, 1, 2,
(GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ),
(GtkAttachOptions) ( 0 ), 0, 0 );
GtkVBox* vbox = create_dialog_vbox( 4 );
gtk_box_pack_start( GTK_BOX( hbox ), GTK_WIDGET( vbox ), FALSE, FALSE, 0 );
{
- GtkButton* button = create_modal_dialog_button( "OK", ok_button );
+ auto button = create_modal_dialog_button( "OK", ok_button );
gtk_box_pack_start( GTK_BOX( vbox ), GTK_WIDGET( button ), FALSE, FALSE, 0 );
- widget_make_default( GTK_WIDGET( button ) );
- gtk_widget_add_accelerator( GTK_WIDGET( button ), "clicked", accel, GDK_Return, (GdkModifierType)0, (GtkAccelFlags)0 );
+ widget_make_default( button );
+ gtk_widget_add_accelerator( GTK_WIDGET( button ), "clicked", accel, GDK_KEY_Return, (GdkModifierType)0, (GtkAccelFlags)0 );
}
{
GtkButton* button = create_modal_dialog_button( "Cancel", cancel_button );
gtk_box_pack_start( GTK_BOX( vbox ), GTK_WIDGET( button ), FALSE, FALSE, 0 );
- gtk_widget_add_accelerator( GTK_WIDGET( button ), "clicked", accel, GDK_Escape, (GdkModifierType)0, (GtkAccelFlags)0 );
+ gtk_widget_add_accelerator( GTK_WIDGET( button ), "clicked", accel, GDK_KEY_Escape, (GdkModifierType)0, (GtkAccelFlags)0 );
}
}
}
}
static void CreateGtkTextEditor(){
- ui::Widget dlg;
- ui::Widget vbox, hbox, button, scr, text;
+ ui::Widget vbox, hbox, button, text;
- dlg = ui::Window( ui::window_type::TOP );
+ auto dlg = ui::Window( ui::window_type::TOP );
- g_signal_connect( G_OBJECT( dlg ), "delete_event",
+ dlg.connect( "delete_event",
G_CALLBACK( editor_delete ), 0 );
gtk_window_set_default_size( GTK_WINDOW( dlg ), 600, 300 );
vbox = ui::VBox( FALSE, 5 );
- gtk_widget_show( vbox );
- gtk_container_add( GTK_CONTAINER( dlg ), GTK_WIDGET( vbox ) );
+ vbox.show();
+ dlg.add(vbox);
gtk_container_set_border_width( GTK_CONTAINER( vbox ), 5 );
- scr = ui::ScrolledWindow();
- gtk_widget_show( scr );
+ auto scr = ui::ScrolledWindow();
+ scr.show();
gtk_box_pack_start( GTK_BOX( vbox ), scr, TRUE, TRUE, 0 );
gtk_scrolled_window_set_policy( GTK_SCROLLED_WINDOW( scr ), GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC );
gtk_scrolled_window_set_shadow_type( GTK_SCROLLED_WINDOW( scr ), GTK_SHADOW_IN );
text = ui::TextView();
- gtk_container_add( GTK_CONTAINER( scr ), text );
- gtk_widget_show( text );
+ scr.add(text);
+ text.show();
g_object_set_data( G_OBJECT( dlg ), "text", (gpointer) text );
gtk_text_view_set_editable( GTK_TEXT_VIEW( text ), TRUE );
hbox = ui::HBox( FALSE, 5 );
- gtk_widget_show( hbox );
+ hbox.show();
gtk_box_pack_start( GTK_BOX( vbox ), GTK_WIDGET( hbox ), FALSE, TRUE, 0 );
button = ui::Button( "Close" );
- gtk_widget_show( button );
+ button.show();
gtk_box_pack_end( GTK_BOX( hbox ), button, FALSE, FALSE, 0 );
- g_signal_connect( G_OBJECT( button ), "clicked",
+ button.connect( "clicked",
G_CALLBACK( editor_close ), dlg );
gtk_widget_set_size_request( button, 60, -1 );
button = ui::Button( "Save" );
- gtk_widget_show( button );
+ button.show();
gtk_box_pack_end( GTK_BOX( hbox ), button, FALSE, FALSE, 0 );
- g_signal_connect( G_OBJECT( button ), "clicked",
+ button.connect( "clicked",
G_CALLBACK( editor_save ), dlg );
gtk_widget_set_size_request( button, 60, -1 );
g_object_set_data( G_OBJECT( text_editor ), "filename", strdup( filename ) );
// trying to show later
- gtk_widget_show( text_editor );
+ text_editor.show();
#ifdef WIN32
- process_gui();
+ ui::process();
#endif
// only move the cursor if it's not exceeding the size..
window.add_accel_group( accel_group );
{
- GtkHBox* hbox = create_dialog_hbox( 4, 4 );
- gtk_container_add( GTK_CONTAINER( window ), GTK_WIDGET( hbox ) );
+ auto hbox = create_dialog_hbox( 4, 4 );
+ window.add(hbox);
{
GtkVBox* vbox = create_dialog_vbox( 4 );
gtk_box_pack_start( GTK_BOX( hbox ), GTK_WIDGET( vbox ), TRUE, TRUE, 0 );
{
- GtkLabel* label = GTK_LABEL( ui::Label( "ESC for default, ENTER to validate" ) );
- gtk_widget_show( GTK_WIDGET( label ) );
+ auto label = ui::Label( "ESC for default, ENTER to validate" );
+ label.show();
gtk_box_pack_start( GTK_BOX( vbox ), GTK_WIDGET( label ), FALSE, FALSE, 0 );
}
{
- GtkEntry* entry = ui::Entry();
- gtk_widget_show( GTK_WIDGET( entry ) );
+ auto entry = ui::Entry();
+ entry.show();
gtk_box_pack_start( GTK_BOX( vbox ), GTK_WIDGET( entry ), TRUE, TRUE, 0 );
gtk_widget_grab_focus( GTK_WIDGET( entry ) );
gtk_box_pack_start( GTK_BOX( hbox ), GTK_WIDGET( vbox ), FALSE, FALSE, 0 );
{
- GtkButton* button = create_modal_dialog_button( "OK", ok_button );
+ auto button = create_modal_dialog_button( "OK", ok_button );
gtk_box_pack_start( GTK_BOX( vbox ), GTK_WIDGET( button ), FALSE, FALSE, 0 );
- widget_make_default( GTK_WIDGET( button ) );
- gtk_widget_add_accelerator( GTK_WIDGET( button ), "clicked", accel_group, GDK_Return, (GdkModifierType)0, GTK_ACCEL_VISIBLE );
+ widget_make_default( button );
+ gtk_widget_add_accelerator( GTK_WIDGET( button ), "clicked", accel_group, GDK_KEY_Return, (GdkModifierType)0, GTK_ACCEL_VISIBLE );
}
{
GtkButton* button = create_modal_dialog_button( "Cancel", cancel_button );
gtk_box_pack_start( GTK_BOX( vbox ), GTK_WIDGET( button ), FALSE, FALSE, 0 );
- gtk_widget_add_accelerator( GTK_WIDGET( button ), "clicked", accel_group, GDK_Escape, (GdkModifierType)0, GTK_ACCEL_VISIBLE );
+ gtk_widget_add_accelerator( GTK_WIDGET( button ), "clicked", accel_group, GDK_KEY_Escape, (GdkModifierType)0, GTK_ACCEL_VISIBLE );
}
}
}
ModalDialogButton ok_button( dialog, eIDOK );
ModalDialogButton cancel_button( dialog, eIDCANCEL );
- ui::Window window = MainFrame_getWindow().create_modal_dialog_window(title, dialog, -1, -1 );
+ auto window = MainFrame_getWindow().create_modal_dialog_window(title, dialog, -1, -1 );
auto accel_group = ui::AccelGroup();
window.add_accel_group( accel_group );
{
- GtkHBox* hbox = create_dialog_hbox( 4, 4 );
- gtk_container_add( GTK_CONTAINER( window ), GTK_WIDGET( hbox ) );
+ auto hbox = create_dialog_hbox( 4, 4 );
+ window.add(hbox);
{
GtkVBox* vbox = create_dialog_vbox( 4 );
gtk_box_pack_start( GTK_BOX( hbox ), GTK_WIDGET( vbox ), TRUE, TRUE, 0 );
{
//GtkLabel* label = GTK_LABEL(gtk_label_new("Enter one ore more tags separated by spaces"));
- GtkLabel* label = GTK_LABEL( ui::Label( "ESC to cancel, ENTER to validate" ) );
- gtk_widget_show( GTK_WIDGET( label ) );
+ auto label = ui::Label( "ESC to cancel, ENTER to validate" );
+ label.show();
gtk_box_pack_start( GTK_BOX( vbox ), GTK_WIDGET( label ), FALSE, FALSE, 0 );
}
{
- GtkEntry* entry = ui::Entry();
- gtk_widget_show( GTK_WIDGET( entry ) );
+ auto entry = ui::Entry();
+ entry.show();
gtk_box_pack_start( GTK_BOX( vbox ), GTK_WIDGET( entry ), TRUE, TRUE, 0 );
gtk_widget_grab_focus( GTK_WIDGET( entry ) );
gtk_box_pack_start( GTK_BOX( hbox ), GTK_WIDGET( vbox ), FALSE, FALSE, 0 );
{
- GtkButton* button = create_modal_dialog_button( "OK", ok_button );
+ auto button = create_modal_dialog_button( "OK", ok_button );
gtk_box_pack_start( GTK_BOX( vbox ), GTK_WIDGET( button ), FALSE, FALSE, 0 );
- widget_make_default( GTK_WIDGET( button ) );
- gtk_widget_add_accelerator( GTK_WIDGET( button ), "clicked", accel_group, GDK_Return, (GdkModifierType)0, GTK_ACCEL_VISIBLE );
+ widget_make_default( button );
+ gtk_widget_add_accelerator( GTK_WIDGET( button ), "clicked", accel_group, GDK_KEY_Return, (GdkModifierType)0, GTK_ACCEL_VISIBLE );
}
{
GtkButton* button = create_modal_dialog_button( "Cancel", cancel_button );
gtk_box_pack_start( GTK_BOX( vbox ), GTK_WIDGET( button ), FALSE, FALSE, 0 );
- gtk_widget_add_accelerator( GTK_WIDGET( button ), "clicked", accel_group, GDK_Escape, (GdkModifierType)0, GTK_ACCEL_VISIBLE );
+ gtk_widget_add_accelerator( GTK_WIDGET( button ), "clicked", accel_group, GDK_KEY_Escape, (GdkModifierType)0, GTK_ACCEL_VISIBLE );
}
}
}
ModalDialog dialog;
ModalDialogButton ok_button( dialog, eIDOK );
- ui::Window window = MainFrame_getWindow().create_modal_dialog_window(title, dialog, -1, -1 );
+ auto window = MainFrame_getWindow().create_modal_dialog_window(title, dialog, -1, -1 );
auto accel_group = ui::AccelGroup();
window.add_accel_group( accel_group );
{
- GtkHBox* hbox = create_dialog_hbox( 4, 4 );
- gtk_container_add( GTK_CONTAINER( window ), GTK_WIDGET( hbox ) );
+ auto hbox = create_dialog_hbox( 4, 4 );
+ window.add(hbox);
{
GtkVBox* vbox = create_dialog_vbox( 4 );
gtk_box_pack_start( GTK_BOX( hbox ), GTK_WIDGET( vbox ), FALSE, FALSE, 0 );
{
- GtkLabel* label = GTK_LABEL( ui::Label( "The selected shader" ) );
- gtk_widget_show( GTK_WIDGET( label ) );
+ auto label = ui::Label( "The selected shader" );
+ label.show();
gtk_box_pack_start( GTK_BOX( vbox ), GTK_WIDGET( label ), FALSE, FALSE, 0 );
}
{
- GtkLabel* label = GTK_LABEL( ui::Label( name ) );
- gtk_widget_show( GTK_WIDGET( label ) );
+ auto label = ui::Label( name );
+ label.show();
gtk_box_pack_start( GTK_BOX( vbox ), GTK_WIDGET( label ), FALSE, FALSE, 0 );
}
{
- GtkLabel* label = GTK_LABEL( ui::Label( "is located in file" ) );
- gtk_widget_show( GTK_WIDGET( label ) );
+ auto label = ui::Label( "is located in file" );
+ label.show();
gtk_box_pack_start( GTK_BOX( vbox ), GTK_WIDGET( label ), FALSE, FALSE, 0 );
}
{
- GtkLabel* label = GTK_LABEL( ui::Label( filename ) );
- gtk_widget_show( GTK_WIDGET( label ) );
+ auto label = ui::Label( filename );
+ label.show();
gtk_box_pack_start( GTK_BOX( vbox ), GTK_WIDGET( label ), FALSE, FALSE, 0 );
}
{
- GtkButton* button = create_modal_dialog_button( "OK", ok_button );
+ auto button = create_modal_dialog_button( "OK", ok_button );
gtk_box_pack_start( GTK_BOX( vbox ), GTK_WIDGET( button ), FALSE, FALSE, 0 );
- widget_make_default( GTK_WIDGET( button ) );
- gtk_widget_add_accelerator( GTK_WIDGET( button ), "clicked", accel_group, GDK_Return, (GdkModifierType)0, GTK_ACCEL_VISIBLE );
+ widget_make_default( button );
+ gtk_widget_add_accelerator( GTK_WIDGET( button ), "clicked", accel_group, GDK_KEY_Return, (GdkModifierType)0, GTK_ACCEL_VISIBLE );
}
}
}