gtk_box_pack_start( GTK_BOX( vbox ), w, FALSE, FALSE, 2 );
gtk_widget_show( w );
- check1 = gtk_check_button_new_with_label( "Include Detail Brushes" );
+ check1 = ui::CheckButton( "Include Detail Brushes" );
gtk_box_pack_start( GTK_BOX( vbox ), check1, FALSE, FALSE, 0 );
gtk_widget_show( check1 );
- check2 = gtk_check_button_new_with_label( "Select Duplicate Brushes Only" );
+ check2 = ui::CheckButton( "Select Duplicate Brushes Only" );
gtk_box_pack_start( GTK_BOX( vbox ), check2, FALSE, FALSE, 0 );
gtk_widget_show( check2 );
// ---- vbox2 ----
- check1 = gtk_check_button_new_with_label( "Use Border" );
+ check1 = ui::CheckButton( "Use Border" );
gtk_box_pack_start( GTK_BOX( vbox2 ), check1, FALSE, FALSE, 0 );
gtk_widget_show( check1 );
- check2 = gtk_check_button_new_with_label( "Inverse Polygon" );
+ check2 = ui::CheckButton( "Inverse Polygon" );
gtk_box_pack_start( GTK_BOX( vbox2 ), check2, FALSE, FALSE, 0 );
gtk_widget_show( check2 );
- check3 = gtk_check_button_new_with_label( "Align Top Edge" );
+ check3 = ui::CheckButton( "Align Top Edge" );
gtk_box_pack_start( GTK_BOX( vbox2 ), check3, FALSE, FALSE, 0 );
gtk_widget_show( check3 );
// djbob: think we need some button callback functions or smuffin
// FIXME: actually get around to doing what i suggested!!!!
- checkUseDetail = gtk_check_button_new_with_label( "Use Detail Brushes" );
+ checkUseDetail = ui::CheckButton( "Use Detail Brushes" );
gtk_box_pack_start( GTK_BOX( hbox ), checkUseDetail, FALSE, FALSE, 0 );
gtk_widget_show( checkUseDetail );
// sp: horizontally ????
// djbob: yes mars, u can spell :]
- checkScaleMainH = gtk_check_button_new_with_label( "Scale Main Texture Horizontally" );
+ checkScaleMainH = ui::CheckButton( "Scale Main Texture Horizontally" );
gtk_toggle_button_set_active( GTK_TOGGLE_BUTTON( checkScaleMainH ), TRUE );
gtk_box_pack_start( GTK_BOX( hbox ), checkScaleMainH, FALSE, FALSE, 0 );
gtk_widget_show( checkScaleMainH );
- checkScaleTrimH = gtk_check_button_new_with_label( "Scale Trim Texture Horizontally" );
+ checkScaleTrimH = ui::CheckButton( "Scale Trim Texture Horizontally" );
gtk_toggle_button_set_active( GTK_TOGGLE_BUTTON( checkScaleTrimH ), TRUE );
gtk_box_pack_start( GTK_BOX( hbox ), checkScaleTrimH, FALSE, FALSE, 0 );
gtk_widget_show( checkScaleTrimH );
gtk_box_pack_start( GTK_BOX( vbox ), hbox, FALSE, FALSE, 0 );
gtk_widget_show( hbox );
- checkScaleMainV = gtk_check_button_new_with_label( "Scale Main Texture Vertically" );
+ checkScaleMainV = ui::CheckButton( "Scale Main Texture Vertically" );
gtk_toggle_button_set_active( GTK_TOGGLE_BUTTON( checkScaleMainV ), TRUE );
gtk_box_pack_start( GTK_BOX( hbox ), checkScaleMainV, FALSE, FALSE, 0 );
gtk_widget_show( checkScaleMainV );
- checkScaleTrimV = gtk_check_button_new_with_label( "Scale Trim Texture Vertically" );
+ checkScaleTrimV = ui::CheckButton( "Scale Trim Texture Vertically" );
gtk_box_pack_start( GTK_BOX( hbox ), checkScaleTrimV, FALSE, FALSE, 0 );
gtk_widget_show( checkScaleTrimV );
gtk_box_pack_start( GTK_BOX( vbox ), w, FALSE, FALSE, 0 );
gtk_widget_show( w );
- check1 = gtk_check_button_new_with_label( "No Dynamic Update" );
+ check1 = ui::CheckButton( "No Dynamic Update" );
gtk_box_pack_start( GTK_BOX( vbox ), check1, FALSE, FALSE, 0 );
gtk_widget_show( check1 );
- check2 = gtk_check_button_new_with_label( "Show Bounding Lines" );
+ check2 = ui::CheckButton( "Show Bounding Lines" );
gtk_box_pack_start( GTK_BOX( vbox ), check2, FALSE, FALSE, 0 );
gtk_widget_show( check2 );
// ---- frame ----
- dlgTexReset.cbTexChange = gtk_check_button_new_with_label( "Enabled" );
+ dlgTexReset.cbTexChange = ui::CheckButton( "Enabled" );
gtk_signal_connect( GTK_OBJECT( dlgTexReset.cbTexChange ), "toggled", GTK_SIGNAL_FUNC( dialog_button_callback_texreset_update ), NULL );
gtk_widget_show( dlgTexReset.cbTexChange );
gtk_table_attach( GTK_TABLE( table ), dlgTexReset.cbTexChange, 0, 1, 0, 1,
// ---- frame ----
- dlgTexReset.cbScaleHor = gtk_check_button_new_with_label( "Enabled" );
+ dlgTexReset.cbScaleHor = ui::CheckButton( "Enabled" );
gtk_signal_connect( GTK_OBJECT( dlgTexReset.cbScaleHor ), "toggled", GTK_SIGNAL_FUNC( dialog_button_callback_texreset_update ), NULL );
gtk_widget_show( dlgTexReset.cbScaleHor );
gtk_table_attach( GTK_TABLE( table ), dlgTexReset.cbScaleHor, 0, 1, 0, 1,
gtk_widget_show( dlgTexReset.editScaleHor );
- dlgTexReset.cbScaleVert = gtk_check_button_new_with_label( "Enabled" );
+ dlgTexReset.cbScaleVert = ui::CheckButton( "Enabled" );
gtk_signal_connect( GTK_OBJECT( dlgTexReset.cbScaleVert ), "toggled", GTK_SIGNAL_FUNC( dialog_button_callback_texreset_update ), NULL );
gtk_widget_show( dlgTexReset.cbScaleVert );
gtk_table_attach( GTK_TABLE( table ), dlgTexReset.cbScaleVert, 0, 1, 1, 2,
// ---- frame ----
- dlgTexReset.cbShiftHor = gtk_check_button_new_with_label( "Enabled" );
+ dlgTexReset.cbShiftHor = ui::CheckButton( "Enabled" );
gtk_signal_connect( GTK_OBJECT( dlgTexReset.cbShiftHor ), "toggled", GTK_SIGNAL_FUNC( dialog_button_callback_texreset_update ), NULL );
gtk_widget_show( dlgTexReset.cbShiftHor );
gtk_table_attach( GTK_TABLE( table ), dlgTexReset.cbShiftHor, 0, 1, 0, 1,
gtk_widget_show( dlgTexReset.editShiftHor );
- dlgTexReset.cbShiftVert = gtk_check_button_new_with_label( "Enabled" );
+ dlgTexReset.cbShiftVert = ui::CheckButton( "Enabled" );
gtk_signal_connect( GTK_OBJECT( dlgTexReset.cbShiftVert ), "toggled", GTK_SIGNAL_FUNC( dialog_button_callback_texreset_update ), NULL );
gtk_widget_show( dlgTexReset.cbShiftVert );
gtk_table_attach( GTK_TABLE( table ), dlgTexReset.cbShiftVert, 0, 1, 1, 2,
// ---- frame ----
- dlgTexReset.cbRotation = gtk_check_button_new_with_label( "Enabled" );
+ dlgTexReset.cbRotation = ui::CheckButton( "Enabled" );
gtk_widget_show( dlgTexReset.cbRotation );
gtk_table_attach( GTK_TABLE( table ), dlgTexReset.cbRotation, 0, 1, 0, 1,
(GtkAttachOptions) ( GTK_FILL ),
gtk_box_pack_start( GTK_BOX( vbox ), hbox, FALSE, FALSE, 0 );
gtk_widget_show( hbox );
- g_pTrackCamera = gtk_check_button_new_with_label( "Track Camera" );
+ g_pTrackCamera = ui::CheckButton( "Track Camera" );
gtk_box_pack_start( GTK_BOX( hbox ), g_pTrackCamera, FALSE, FALSE, 0 );
gtk_widget_show( g_pTrackCamera );
gtk_widget_set_usize( spin, 60, -2 );
g_object_set_data( G_OBJECT( dlg ), "nv", spin );
- check = gtk_check_button_new_with_label( "Use Bezier patches" );
+ check = ui::CheckButton( "Use Bezier patches" );
gtk_widget_show( check );
gtk_box_pack_start( GTK_BOX( vbox ), check, FALSE, TRUE, 0 );
g_object_set_data( G_OBJECT( dlg ), "use_patches", check );
g_object_set_data( G_OBJECT( dlg ), "z10", entry );
g_signal_connect( G_OBJECT( entry ), "focus_out_event", G_CALLBACK( doublevariable_entryfocusout ), &Z10 );
- check = gtk_check_button_new_with_label( "Linear borders" );
+ check = ui::CheckButton( "Linear borders" );
gtk_widget_show( check );
gtk_table_attach( GTK_TABLE( table ), check, 0, 4, 2, 3,
(GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ),
- check = gtk_check_button_new_with_label( "Use detail brushes" );
+ check = ui::CheckButton( "Use detail brushes" );
gtk_widget_show( check );
gtk_box_pack_start( GTK_BOX( vbox ), check, FALSE, TRUE, 0 );
g_object_set_data( G_OBJECT( dlg ), "detail", check );
g_signal_connect( G_OBJECT( check ), "toggled", G_CALLBACK( texture_detail ), NULL );
- check = gtk_check_button_new_with_label( "Detail hint brushes" );
+ check = ui::CheckButton( "Detail hint brushes" );
gtk_widget_show( check );
gtk_box_pack_start( GTK_BOX( vbox ), check, FALSE, TRUE, 0 );
g_object_set_data( G_OBJECT( dlg ), "hint", check );
g_signal_connect( G_OBJECT( check ), "toggled", G_CALLBACK( texture_hint ), NULL );
// ^Fishman - Add terrain key to func_group.
- check = gtk_check_button_new_with_label( "Add terrain key" );
+ check = ui::CheckButton( "Add terrain key" );
gtk_widget_show( check );
gtk_box_pack_start( GTK_BOX( vbox ), check, FALSE, TRUE, 0 );
g_object_set_data( G_OBJECT( dlg ), "terrain_ent", check );
gtk_box_pack_start( GTK_BOX( vbox ), button, FALSE, TRUE, 0 );
g_signal_connect( G_OBJECT( button ), "clicked", G_CALLBACK( main_about ), NULL );
- check = gtk_check_button_new_with_label( "Preview" );
+ check = ui::CheckButton( "Preview" );
gtk_widget_show( check );
gtk_box_pack_start( GTK_BOX( vbox ), check, FALSE, TRUE, 0 );
g_signal_connect( G_OBJECT( check ), "toggled", G_CALLBACK( main_preview ), NULL );
g_object_set_data( G_OBJECT( dlg ), "main_preview", check );
// ^Fishman - Antializing for the preview window.
- check = gtk_check_button_new_with_label( "Antialised lines" );
+ check = ui::CheckButton( "Antialised lines" );
gtk_widget_show( check );
gtk_box_pack_start( GTK_BOX( vbox ), check, FALSE, TRUE, 0 );
g_object_set_data( G_OBJECT( dlg ), "main_antialiasing", check );
(GtkAttachOptions) ( 0 ), 0, 0 );
gtk_signal_connect( GTK_OBJECT( button ), "clicked", GTK_SIGNAL_FUNC( OnColorFog ), NULL );
- aa3check = gtk_check_button_new_with_label( "Anti-Alias (May not work on some video cards)" );
+ aa3check = ui::CheckButton( "Anti-Alias (May not work on some video cards)" );
gtk_widget_show( aa3check );
gtk_table_attach( GTK_TABLE( table ), aa3check, 1, 4, 0, 1,
(GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ),
(GtkAttachOptions) ( 0 ), 0, 0 );
gtk_signal_connect( GTK_OBJECT( aa3check ), "toggled", GTK_SIGNAL_FUNC( OnAntiAlias3d ), NULL );
- depthcheck = gtk_check_button_new_with_label( "Depth Cue" );
+ depthcheck = ui::CheckButton( "Depth Cue" );
gtk_widget_show( depthcheck );
gtk_table_attach( GTK_TABLE( table ), depthcheck, 1, 2, 1, 2,
(GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ),
(GtkAttachOptions) ( 0 ), 0, 0 );
gtk_signal_connect( GTK_OBJECT( depthcheck ), "toggled", GTK_SIGNAL_FUNC( OnFog ), NULL );
- linescheck = gtk_check_button_new_with_label( "Lines" );
+ linescheck = ui::CheckButton( "Lines" );
gtk_widget_show( linescheck );
gtk_table_attach( GTK_TABLE( table ), linescheck, 2, 3, 1, 2,
(GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ),
(GtkAttachOptions) ( 0 ), 0, 0 );
gtk_signal_connect( GTK_OBJECT( linescheck ), "toggled", GTK_SIGNAL_FUNC( OnLines ), NULL );
- polyscheck = gtk_check_button_new_with_label( "Polygons" );
+ polyscheck = ui::CheckButton( "Polygons" );
gtk_widget_show( polyscheck );
gtk_table_attach( GTK_TABLE( table ), polyscheck, 3, 4, 1, 2,
(GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ),
gtk_widget_show( hbox );
gtk_box_pack_start( GTK_BOX( vbox2 ), hbox, TRUE, FALSE, 0 );
- show3check = gtk_check_button_new_with_label( "Show" );
+ show3check = ui::CheckButton( "Show" );
gtk_widget_show( show3check );
gtk_box_pack_start( GTK_BOX( hbox ), show3check, TRUE, TRUE, 0 );
gtk_signal_connect( GTK_OBJECT( show3check ), "toggled", GTK_SIGNAL_FUNC( OnConfig3d ), NULL );
- portalcheck = gtk_check_button_new_with_label( "Portal cubic clipper" );
+ portalcheck = ui::CheckButton( "Portal cubic clipper" );
gtk_widget_show( portalcheck );
gtk_box_pack_start( GTK_BOX( hbox ), portalcheck, TRUE, TRUE, 0 );
gtk_signal_connect( GTK_OBJECT( portalcheck ), "toggled", GTK_SIGNAL_FUNC( OnClip ), NULL );
gtk_signal_connect( GTK_OBJECT( button ), "clicked", GTK_SIGNAL_FUNC( OnColor2d ), NULL );
gtk_widget_set_usize( button, 60, -2 );
- aa2check = gtk_check_button_new_with_label( "Anti-Alias (May not work on some video cards)" );
+ aa2check = ui::CheckButton( "Anti-Alias (May not work on some video cards)" );
gtk_widget_show( aa2check );
gtk_box_pack_start( GTK_BOX( hbox ), aa2check, TRUE, TRUE, 0 );
gtk_signal_connect( GTK_OBJECT( aa2check ), "toggled", GTK_SIGNAL_FUNC( OnAntiAlias2d ), NULL );
gtk_widget_show( hbox );
gtk_box_pack_start( GTK_BOX( vbox2 ), hbox, TRUE, FALSE, 0 );
- show2check = gtk_check_button_new_with_label( "Show" );
+ show2check = ui::CheckButton( "Show" );
gtk_widget_show( show2check );
gtk_box_pack_start( GTK_BOX( hbox ), show2check, FALSE, FALSE, 0 );
gtk_signal_connect( GTK_OBJECT( show2check ), "toggled", GTK_SIGNAL_FUNC( OnConfig2d ), NULL );
gtk_widget_show( hbox );
gtk_box_pack_start( GTK_BOX( vbox ), hbox, FALSE, FALSE, 0 );
- check3d = gtk_check_button_new_with_label( "Show 3D" );
+ check3d = ui::CheckButton( "Show 3D" );
gtk_widget_show( check3d );
gtk_box_pack_start( GTK_BOX( hbox ), check3d, FALSE, FALSE, 0 );
- check2d = gtk_check_button_new_with_label( "Show 2D" );
+ check2d = ui::CheckButton( "Show 2D" );
gtk_widget_show( check2d );
gtk_box_pack_start( GTK_BOX( hbox ), check2d, FALSE, FALSE, 0 );
Button::Button(const char *label) : Button(GTK_BUTTON(gtk_button_new_with_label(label)))
{ }
+ CheckButton::CheckButton(const char *label) : CheckButton(GTK_CHECK_BUTTON(gtk_check_button_new_with_label(label)))
+ { }
+
Label::Label(const char *label) : Label(GTK_LABEL(gtk_label_new(label)))
{ }
using ui_alignment = struct _GtkAlignment;
using ui_button = struct _GtkButton;
+using ui_checkbutton = struct _GtkCheckButton;
using ui_evkey = struct _GdkEventKey;
using ui_label = struct _GtkLabel;
using ui_menuitem = struct _GtkMenuItem;
}; \
static_assert(sizeof(name) == sizeof(Widget), "object slicing")
- WRAP(Window, ui_window,
- Window create_dialog_window(const char *title, void func(), void *data, int default_w = -1,
- int default_h = -1);
-
- Window create_modal_dialog_window(const char *title, ui_modal &dialog, int default_w = -1,
- int default_h = -1);
-
- Window create_floating_window(const char *title);
-
- std::uint64_t on_key_press(bool (*f)(Widget widget, ui_evkey *event, void *extra),
- void *extra = nullptr);
+ WRAP(Alignment, ui_alignment,
+ Alignment(float xalign, float yalign, float xscale, float yscale);
);
WRAP(Button, ui_button,
- Button(const char *label);
+ Button(const char *label);
);
- WRAP(CheckButton, ui_widget,);
-
- WRAP(SpinButton, ui_widget,);
-
- WRAP(MenuItem, ui_menuitem,);
+ WRAP(CheckButton, ui_checkbutton,
+ CheckButton(const char *label);
+ );
WRAP(Label, ui_label,
- Label(const char *label);
+ Label(const char *label);
);
- WRAP(Alignment, ui_alignment,
- Alignment(float xalign, float yalign, float xscale, float yscale);
- );
+ WRAP(MenuItem, ui_menuitem,);
- WRAP(TreeModel, ui_treemodel, );
+ WRAP(SpinButton, ui_widget,);
+
+ WRAP(TreeModel, ui_treemodel,);
WRAP(TreeView, ui_treeview,
TreeView(TreeModel model);
VBox(bool homogenous, int spacing);
);
+ WRAP(Window, ui_window,
+ Window create_dialog_window(const char *title, void func(), void *data, int default_w = -1,
+ int default_h = -1);
+
+ Window create_modal_dialog_window(const char *title, ui_modal &dialog, int default_w = -1,
+ int default_h = -1);
+
+ Window create_floating_window(const char *title);
+
+ std::uint64_t on_key_press(bool (*f)(Widget widget, ui_evkey *event, void *extra),
+ void *extra = nullptr);
+ );
+
#undef WRAP
}
ui::CheckButton Dialog::addCheckBox( ui::Widget vbox, const char* name, const char* flag, const BoolImportCallback& importViewer, const BoolExportCallback& exportViewer ){
- ui::Widget check = ui::Widget(gtk_check_button_new_with_label( flag ));
+ auto check = ui::CheckButton( flag );
gtk_widget_show( check );
AddBoolToggleData( *GTK_TOGGLE_BUTTON( check ), importViewer, exportViewer );
DialogVBox_packRow( GTK_VBOX( vbox ), GTK_WIDGET( DialogRow_new( name, check ) ) );
- return ui::CheckButton(check);
+ return check;
}
ui::CheckButton Dialog::addCheckBox( ui::Widget vbox, const char* name, const char* flag, bool& data ){
for ( int i = 0; i < MAX_FLAGS; i++ )
{
- GtkCheckButton* check = GTK_CHECK_BUTTON( gtk_check_button_new_with_label( "" ) );
+ GtkCheckButton* check = ui::CheckButton( "" );
gtk_widget_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_entitySpawnflagsCheck[i] = check;
AddDialogData( *GTK_ENTRY( entry ), m_strReplace );
GlobalTextureEntryCompletion::instance().connect( GTK_ENTRY( entry ) );
- check = ui::Widget(gtk_check_button_new_with_label( "Within selected brushes only" ));
+ check = ui::CheckButton( "Within selected brushes only" );
gtk_widget_show( check );
gtk_box_pack_start( GTK_BOX( vbox ), check, TRUE, TRUE, 0 );
AddDialogData( *GTK_TOGGLE_BUTTON( check ), m_bSelectedOnly );
{
for ( int r = 0; r != 8; ++r )
{
- GtkCheckButton* check = GTK_CHECK_BUTTON( gtk_check_button_new_with_label( getSurfaceFlagName( c * 8 + r ) ) );
+ GtkCheckButton* check = ui::CheckButton( getSurfaceFlagName( c * 8 + r ) );
gtk_widget_show( GTK_WIDGET( check ) );
gtk_table_attach( table, GTK_WIDGET( check ), c, c + 1, r, r + 1,
(GtkAttachOptions)( GTK_EXPAND | GTK_FILL ),
{
for ( int r = 0; r != 8; ++r )
{
- GtkCheckButton* check = GTK_CHECK_BUTTON( gtk_check_button_new_with_label( getContentFlagName( c * 8 + r ) ) );
+ GtkCheckButton* check = ui::CheckButton( getContentFlagName( c * 8 + r ) );
gtk_widget_show( GTK_WIDGET( check ) );
gtk_table_attach( table, GTK_WIDGET( check ), c, c + 1, r, r + 1,
(GtkAttachOptions)( GTK_EXPAND | GTK_FILL ),
gtk_widget_show( hbox );
gtk_box_pack_start( GTK_BOX( vbox ), GTK_WIDGET( hbox ), FALSE, FALSE, 0 );
// Checkboxes go here... (Flip X/Y)
- ui::Widget flipX = gtk_check_button_new_with_label( "Flip X axis" );
- ui::Widget flipY = gtk_check_button_new_with_label( "Flip Y axis" );
+ ui::Widget flipX = ui::CheckButton( "Flip X axis" );
+ ui::Widget flipY = ui::CheckButton( "Flip Y axis" );
gtk_widget_show( flipX );
gtk_widget_show( flipY );
gtk_box_pack_start( GTK_BOX( hbox ), flipX, FALSE, FALSE, 0 );