gtk_widget_show( hbox );
if ( type == eMB_OK ) {
- w = ui::Widget(gtk_button_new_with_label( "Ok" ));
+ w = ui::Button( "Ok" );
gtk_box_pack_start( GTK_BOX( hbox ), w, TRUE, TRUE, 0 );
gtk_signal_connect( GTK_OBJECT( w ), "clicked",
GTK_SIGNAL_FUNC( dialog_button_callback ), GINT_TO_POINTER( eIDOK ) );
ret = eIDOK;
}
else if ( type == eMB_OKCANCEL ) {
- w = ui::Widget(gtk_button_new_with_label( "Ok" ));
+ w = ui::Button( "Ok" );
gtk_box_pack_start( GTK_BOX( hbox ), w, TRUE, TRUE, 0 );
gtk_signal_connect( GTK_OBJECT( w ), "clicked",
GTK_SIGNAL_FUNC( dialog_button_callback ), GINT_TO_POINTER( eIDOK ) );
gtk_widget_grab_default( w );
gtk_widget_show( w );
- w = ui::Widget(gtk_button_new_with_label( "Cancel" ));
+ w = ui::Button( "Cancel" );
gtk_box_pack_start( GTK_BOX( hbox ), w, TRUE, TRUE, 0 );
gtk_signal_connect( GTK_OBJECT( w ), "clicked",
GTK_SIGNAL_FUNC( dialog_button_callback ), GINT_TO_POINTER( eIDCANCEL ) );
ret = eIDCANCEL;
}
else if ( type == eMB_YESNOCANCEL ) {
- w = ui::Widget(gtk_button_new_with_label( "Yes" ));
+ w = ui::Button( "Yes" );
gtk_box_pack_start( GTK_BOX( hbox ), w, TRUE, TRUE, 0 );
gtk_signal_connect( GTK_OBJECT( w ), "clicked",
GTK_SIGNAL_FUNC( dialog_button_callback ), GINT_TO_POINTER( eIDYES ) );
gtk_widget_grab_default( w );
gtk_widget_show( w );
- w = ui::Widget(gtk_button_new_with_label( "No" ));
+ w = ui::Button( "No" );
gtk_box_pack_start( GTK_BOX( hbox ), w, TRUE, TRUE, 0 );
gtk_signal_connect( GTK_OBJECT( w ), "clicked",
GTK_SIGNAL_FUNC( dialog_button_callback ), GINT_TO_POINTER( eIDNO ) );
gtk_widget_show( w );
- w = ui::Widget(gtk_button_new_with_label( "Cancel" ));
+ w = ui::Button( "Cancel" );
gtk_box_pack_start( GTK_BOX( hbox ), w, TRUE, TRUE, 0 );
gtk_signal_connect( GTK_OBJECT( w ), "clicked",
GTK_SIGNAL_FUNC( dialog_button_callback ), GINT_TO_POINTER( eIDCANCEL ) );
}
else /* if (mode == MB_YESNO) */
{
- w = ui::Widget(gtk_button_new_with_label( "Yes" ));
+ w = ui::Button( "Yes" );
gtk_box_pack_start( GTK_BOX( hbox ), w, TRUE, TRUE, 0 );
gtk_signal_connect( GTK_OBJECT( w ), "clicked",
GTK_SIGNAL_FUNC( dialog_button_callback ), GINT_TO_POINTER( eIDYES ) );
gtk_widget_grab_default( w );
gtk_widget_show( w );
- w = ui::Widget(gtk_button_new_with_label( "No" ));
+ w = ui::Button( "No" );
gtk_box_pack_start( GTK_BOX( hbox ), w, TRUE, TRUE, 0 );
gtk_signal_connect( GTK_OBJECT( w ), "clicked",
GTK_SIGNAL_FUNC( dialog_button_callback ), GINT_TO_POINTER( eIDNO ) );
return g_signal_connect(G_OBJECT(*this), "key-press-event", (GCallback) +func, &pass);
}
+ Button::Button(const char *label) : Button(GTK_BUTTON(gtk_button_new_with_label(label)))
+ { }
+
Label::Label(const char *label) : Label(GTK_LABEL(gtk_label_new(label)))
{ }
using ui_typeinst = struct _GTypeInstance;
using ui_widget = struct _GtkWidget;
using ui_window = struct _GtkWindow;
+using ui_button = struct _GtkButton;
using ui_menuitem = struct _GtkMenuItem;
using ui_label = struct _GtkLabel;
void *extra = nullptr);
);
+ WIDGET(Button, ui_button,
+ Button(const char *label);
+ );
+
WIDGET(CheckButton, ui_widget,);
WIDGET(SpinButton, ui_widget,);
gtk_widget_show( vbox );
gtk_box_pack_start( GTK_BOX( hbox ), GTK_WIDGET( vbox ), FALSE, FALSE, 0 );
- button = ui::Widget(gtk_button_new_with_label( "Apply" ));
+ button = ui::Button( "Apply" );
gtk_widget_show( button );
gtk_box_pack_start( GTK_BOX( vbox ), button, FALSE, FALSE, 0 );
g_signal_connect( G_OBJECT( button ), "clicked",
G_CALLBACK( OnApply ), 0 );
gtk_widget_set_usize( button, 60, -2 );
- button = ui::Widget(gtk_button_new_with_label( "Close" ));
+ button = ui::Button( "Close" );
gtk_widget_show( button );
gtk_box_pack_start( GTK_BOX( vbox ), button, FALSE, FALSE, 0 );
g_signal_connect( G_OBJECT( button ), "clicked",
gtk_widget_show( hbox );
gtk_box_pack_start( GTK_BOX( vbox ), GTK_WIDGET( hbox ), FALSE, TRUE, 0 );
- button = ui::Widget(gtk_button_new_with_label( "Close" ));
+ button = ui::Button( "Close" );
gtk_widget_show( button );
gtk_box_pack_end( GTK_BOX( hbox ), button, FALSE, FALSE, 0 );
g_signal_connect( G_OBJECT( button ), "clicked",
G_CALLBACK( editor_close ), dlg );
gtk_widget_set_usize( button, 60, -2 );
- button = ui::Widget(gtk_button_new_with_label( "Save" ));
+ button = ui::Button( "Save" );
gtk_widget_show( button );
gtk_box_pack_end( GTK_BOX( hbox ), button, FALSE, FALSE, 0 );
g_signal_connect( G_OBJECT( button ), "clicked",
}
{
// match grid button
- ui::Widget button = ui::Widget(gtk_button_new_with_label( "Match Grid" ));
+ ui::Widget button = ui::Button( "Match Grid" );
gtk_widget_show( button );
gtk_table_attach( GTK_TABLE( table ), button, 2, 4, 5, 6,
(GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ),
(GtkAttachOptions) ( 0 ), 0, 0 );
}
{
- ui::Widget button = ui::Widget(gtk_button_new_with_label( "Axial" ));
+ ui::Widget button = ui::Button( "Axial" );
gtk_widget_show( button );
gtk_table_attach( GTK_TABLE( table ), button, 0, 1, 1, 2,
(GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ),
gtk_widget_set_usize( button, 60, -2 );
}
{
- ui::Widget button = ui::Widget(gtk_button_new_with_label( "Fit" ));
+ ui::Widget button = ui::Button( "Fit" );
gtk_widget_show( button );
gtk_table_attach( GTK_TABLE( table ), button, 1, 2, 1, 2,
(GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ),
gtk_widget_set_usize( button, 60, -2 );
}
{
- ui::Widget button = ui::Widget(gtk_button_new_with_label( "CAP" ));
+ ui::Widget button = ui::Button( "CAP" );
gtk_widget_show( button );
gtk_table_attach( GTK_TABLE( table ), button, 0, 1, 3, 4,
(GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ),
gtk_widget_set_usize( button, 60, -2 );
}
{
- ui::Widget button = ui::Widget(gtk_button_new_with_label( "Set..." ));
+ ui::Widget button = ui::Button( "Set..." );
gtk_widget_show( button );
gtk_table_attach( GTK_TABLE( table ), button, 1, 2, 3, 4,
(GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ),
gtk_widget_set_usize( button, 60, -2 );
}
{
- ui::Widget button = ui::Widget(gtk_button_new_with_label( "Natural" ));
+ ui::Widget button = ui::Button( "Natural" );
gtk_widget_show( button );
gtk_table_attach( GTK_TABLE( table ), button, 2, 3, 3, 4,
(GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ),
gtk_widget_set_usize( button, 60, -2 );
}
{
- ui::Widget button = ui::Widget(gtk_button_new_with_label( "Fit" ));
+ ui::Widget button = ui::Button( "Fit" );
gtk_widget_show( button );
gtk_table_attach( GTK_TABLE( table ), button, 3, 4, 3, 4,
(GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ),