return hbox;
}
-ui::Frame create_dialog_frame( const char* label, GtkShadowType shadow ){
+ui::Frame create_dialog_frame( const char* label, ui::Shadow shadow ){
auto frame = ui::Frame( label );
frame.show();
- gtk_frame_set_shadow_type( frame, shadow );
+ gtk_frame_set_shadow_type( frame, (GtkShadowType) shadow );
return frame;
}
ui::Button create_dialog_button( const char* label, GCallback func, gpointer data ){
auto button = ui::Button( label );
- gtk_widget_set_size_request( GTK_WIDGET( button ), 64, -1 );
+ button.dimensions(64, -1);
button.show();
- g_signal_connect( G_OBJECT( button ), "clicked", func, data );
+ button.connect( "clicked", func, data );
return button;
}
ui::Window window = create_floating_window( title, parent );
gtk_window_set_default_size( window, default_w, default_h );
gtk_window_set_position( window, GTK_WIN_POS_CENTER_ON_PARENT );
- g_signal_connect( G_OBJECT( window ), "delete_event", func, data );
+ window.connect( "delete_event", func, data );
return window;
}
}
EMessageBoxReturn modal_dialog_show( ui::Window window, ModalDialog& dialog ){
- gtk_grab_add( GTK_WIDGET( window ) );
- gtk_widget_show( GTK_WIDGET( window ) );
+ window.show();
+ g_assert( GTK_IS_WINDOW(window) );
+ gtk_grab_add( GTK_WIDGET(window) );
dialog.loop = true;
while ( dialog.loop )
gtk_main_iteration();
}
- gtk_widget_hide( GTK_WIDGET( window ) );
- gtk_grab_remove( GTK_WIDGET( window ) );
+ window.hide();
+ gtk_grab_remove( window );
return dialog.ret;
}
window_remove_minmax( window );
- //gtk_widget_set_size_request(GTK_WIDGET(window), width, height);
+ //window.dimensions(width, height);
//gtk_window_set_default_size(window, width, height);
//gtk_window_resize(window, width, height);
//GdkGeometry geometry = { width, height, -1, -1, width, height, -1, -1, -1, -1, GDK_GRAVITY_STATIC, };
- //gtk_window_set_geometry_hints(window, GTK_WIDGET(window), &geometry, (GdkWindowHints)(GDK_HINT_POS|GDK_HINT_MIN_SIZE|GDK_HINT_BASE_SIZE));
+ //gtk_window_set_geometry_hints(window, window, &geometry, (GdkWindowHints)(GDK_HINT_POS|GDK_HINT_MIN_SIZE|GDK_HINT_BASE_SIZE));
return window;
}
}
gboolean dialog_delete_callback( ui::Widget widget, GdkEventAny* event, ModalDialog* data ){
- gtk_widget_hide( widget );
+ widget.hide();
data->loop = false;
return TRUE;
}
ui::Window create_simple_modal_dialog_window( const char* title, ModalDialog& dialog, ui::Widget contents ){
- ui::Window window = create_fixedsize_modal_dialog_window(ui::Window(), title, dialog );
+ ui::Window window = create_fixedsize_modal_dialog_window(ui::Window{ui::null}, title, dialog );
- GtkVBox* vbox1 = create_dialog_vbox( 8, 4 );
- gtk_container_add( GTK_CONTAINER( window ), GTK_WIDGET( vbox1 ) );
+ auto vbox1 = create_dialog_vbox( 8, 4 );
+ window.add(vbox1);
- gtk_container_add( GTK_CONTAINER( vbox1 ), contents );
+ vbox1.add(contents);
ui::Alignment alignment = ui::Alignment( 0.5, 0.0, 0.0, 0.0 );
- gtk_widget_show( GTK_WIDGET( alignment ) );
- gtk_box_pack_start( GTK_BOX( vbox1 ), GTK_WIDGET( alignment ), FALSE, FALSE, 0 );
+ alignment.show();
+ vbox1.pack_start( alignment, FALSE, FALSE, 0 );
- GtkButton* button = create_dialog_button( "OK", G_CALLBACK( dialog_button_ok ), &dialog );
- gtk_container_add( GTK_CONTAINER( alignment ), GTK_WIDGET( button ) );
+ auto button = create_dialog_button( "OK", G_CALLBACK( dialog_button_ok ), &dialog );
+ alignment.add(button);
+ gtk_widget_grab_focus (button);
return window;
}
RadioHBox RadioHBox_new( StringArrayRange names ){
- GtkHBox* hbox = ui::HBox( TRUE, 4 );
- gtk_widget_show( GTK_WIDGET( hbox ) );
+ auto hbox = ui::HBox( TRUE, 4 );
+ hbox.show();
GSList* group = 0;
- GtkRadioButton* radio = 0;
+ auto radio = ui::RadioButton(ui::null);
for ( StringArrayRange::Iterator i = names.first; i != names.last; ++i )
{
- radio = GTK_RADIO_BUTTON( gtk_radio_button_new_with_label( group, *i ) );
- gtk_widget_show( GTK_WIDGET( radio ) );
- gtk_box_pack_start( GTK_BOX( hbox ), GTK_WIDGET( radio ), FALSE, FALSE, 0 );
+ radio = ui::RadioButton::from( gtk_radio_button_new_with_label( group, *i ) );
+ radio.show();
+ hbox.pack_start( radio, FALSE, FALSE, 0 );
group = gtk_radio_button_get_group( radio );
}
PathEntry PathEntry_new(){
- GtkFrame* frame = ui::Frame();
- gtk_widget_show( GTK_WIDGET( frame ) );
+ auto frame = ui::Frame();
+ frame.show();
gtk_frame_set_shadow_type( frame, GTK_SHADOW_IN );
// path entry
- GtkHBox* hbox = ui::HBox( FALSE, 0 );
- gtk_widget_show( GTK_WIDGET( hbox ) );
+ auto hbox = ui::HBox( FALSE, 0 );
+ hbox.show();
- auto entry = ui::Entry();
+ auto entry = ui::Entry(ui::New);
gtk_entry_set_has_frame( entry, FALSE );
- gtk_widget_show( GTK_WIDGET( entry ) );
- gtk_box_pack_start( GTK_BOX( hbox ), GTK_WIDGET( entry ), TRUE, TRUE, 0 );
+ entry.show();
+ hbox.pack_start( entry, TRUE, TRUE, 0 );
// browse button
- auto button = ui::Button();
- button_set_icon( button, "ellipsis.bmp" );
- gtk_widget_show( GTK_WIDGET( button ) );
- gtk_box_pack_end( GTK_BOX( hbox ), GTK_WIDGET( button ), FALSE, FALSE, 0 );
+ auto button = ui::Button(ui::New);
+ button_set_icon( button, "ellipsis.png" );
+ button.show();
+ hbox.pack_end(button, FALSE, FALSE, 0);
- gtk_container_add( GTK_CONTAINER( frame ), GTK_WIDGET( hbox ) );
+ frame.add(hbox);
return PathEntry( frame, entry, button );
}
void PathEntry_setPath( PathEntry& self, const char* path ){
gtk_entry_set_text( self.m_entry, path );
}
-typedef ReferenceCaller1<PathEntry, const char*, PathEntry_setPath> PathEntrySetPathCaller;
+typedef ReferenceCaller<PathEntry, void(const char*), PathEntry_setPath> PathEntrySetPathCaller;
void BrowsedPathEntry_clicked( ui::Widget widget, BrowsedPathEntry* self ){
self->m_browse( PathEntrySetPathCaller( self->m_entry ) );
BrowsedPathEntry::BrowsedPathEntry( const BrowseCallback& browse ) :
m_entry( PathEntry_new() ),
m_browse( browse ){
- g_signal_connect( G_OBJECT( m_entry.m_button ), "clicked", G_CALLBACK( BrowsedPathEntry_clicked ), this );
+ m_entry.m_button.connect( "clicked", G_CALLBACK( BrowsedPathEntry_clicked ), this );
}
ui::Label DialogLabel_new( const char* name ){
auto label = ui::Label( name );
- gtk_widget_show(label);
+ label.show();
gtk_misc_set_alignment( GTK_MISC( label ), 1, 0.5 );
gtk_label_set_justify( label, GTK_JUSTIFY_LEFT );
ui::Table DialogRow_new( const char* name, ui::Widget widget ){
auto table = ui::Table( 1, 3, TRUE );
- gtk_widget_show( GTK_WIDGET( table ) );
+ table.show();
gtk_table_set_col_spacings( table, 4 );
gtk_table_set_row_spacings( table, 0 );
- gtk_table_attach( table, GTK_WIDGET( DialogLabel_new( name ) ), 0, 1, 0, 1,
- (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ),
- (GtkAttachOptions) ( 0 ), 0, 0 );
+ table.attach(DialogLabel_new(name), {0, 1, 0, 1}, {GTK_EXPAND | GTK_FILL, 0});
- gtk_table_attach( table, widget, 1, 3, 0, 1,
- (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ),
- (GtkAttachOptions) ( 0 ), 0, 0 );
+ table.attach(widget, {1, 3, 0, 1}, {GTK_EXPAND | GTK_FILL, 0});
return table;
}
-void DialogVBox_packRow( ui::VBox vbox, ui::Widget row ){
- gtk_box_pack_start( GTK_BOX( vbox ), row, FALSE, FALSE, 0 );
+void DialogVBox_packRow( ui::Box vbox, ui::Widget row ){
+ vbox.pack_start( row, FALSE, FALSE, 0 );
}