adj = ui::Adjustment( 1, 1, 32767, 1, 10, 0 );
g_signal_connect( G_OBJECT( adj ), "value_changed", G_CALLBACK( general_random ), NULL );
- spin = gtk_spin_button_new( GTK_ADJUSTMENT( adj ), 1, 0 );
+ spin = ui::SpinButton( adj, 1, 0 );
gtk_widget_show( spin );
gtk_table_attach( GTK_TABLE( table2 ), spin, 1, 2, 3, 4,
(GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ),
adj = ui::Adjustment( 8, 1, MAX_ROWS, 1, 10, 0 );
g_signal_connect( G_OBJECT( adj ), "value_changed", G_CALLBACK( extents_nhnv_spin ), &NH );
- spin = gtk_spin_button_new( GTK_ADJUSTMENT( adj ), 1, 0 );
+ spin = ui::SpinButton( adj, 1, 0 );
gtk_widget_show( spin );
gtk_table_attach( GTK_TABLE( table ), spin, 1, 2, 0, 1,
(GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ),
adj = ui::Adjustment( 8, 1, MAX_ROWS, 1, 10, 0 );
g_signal_connect( G_OBJECT( adj ), "value_changed", G_CALLBACK( extents_nhnv_spin ), &NV );
- spin = gtk_spin_button_new( GTK_ADJUSTMENT( adj ), 1, 0 );
+ spin = ui::SpinButton( adj, 1, 0 );
gtk_widget_show( spin );
gtk_table_attach( GTK_TABLE( table ), spin, 1, 2, 1, 2,
(GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ),
adj = ui::Adjustment( 8, 0, 256, 1, 10, 0 );
g_signal_connect( G_OBJECT( adj ), "value_changed", G_CALLBACK( extents_snaptogrid_spin ), &SP );
- spin = gtk_spin_button_new( GTK_ADJUSTMENT( adj ), 1, 0 );
+ spin = ui::SpinButton( adj, 1, 0 );
gtk_widget_show( spin );
gtk_box_pack_start( GTK_BOX( vbox ), spin, FALSE, TRUE, 0 );
gtk_widget_set_usize( spin, 60, -2 );
adj = ui::Adjustment( 0, -65536, 65536, 1, 16, 0 );
g_signal_connect( G_OBJECT( adj ), "value_changed", G_CALLBACK( fix_value_changed ), NULL );
- spin = gtk_spin_button_new( GTK_ADJUSTMENT( adj ), 1, 0 );
+ spin = ui::SpinButton( adj, 1, 0 );
gtk_widget_show( spin );
gtk_table_attach( GTK_TABLE( table ), spin, 1, 2, 0, 1,
(GtkAttachOptions) ( GTK_EXPAND ),
gtk_box_pack_start( GTK_BOX( hbox2 ), label, FALSE, TRUE, 0 );
adj = ui::Adjustment( 60, 0, 90, 1, 10, 0 );
- spin = gtk_spin_button_new( GTK_ADJUSTMENT( adj ), 1, 0 );
+ spin = ui::SpinButton( adj, 1, 0 );
gtk_widget_show( spin );
gtk_box_pack_start( GTK_BOX( hbox2 ), spin, FALSE, TRUE, 0 );
g_object_set_data( G_OBJECT( dlg ), "tex_slant", spin );
adj = ui::Adjustment( 30, -90, 90, 1, 10, 0 );
gtk_signal_connect( adj, "value_changed", GTK_SIGNAL_FUNC( preview_spin ), &elevation );
- spin = gtk_spin_button_new( GTK_ADJUSTMENT( adj ), 1, 0 );
+ spin = ui::SpinButton( adj, 1, 0 );
gtk_widget_show( spin );
gtk_box_pack_start( GTK_BOX( hbox ), spin, FALSE, TRUE, 0 );
g_signal_connect( G_OBJECT( spin ), "focus_out_event", G_CALLBACK( doublevariable_spinfocusout ), &elevation );
adj = ui::Adjustment( 30, 0, 359, 1, 10, 0 );
gtk_signal_connect( adj, "value_changed", GTK_SIGNAL_FUNC( preview_spin ), &azimuth );
- spin = gtk_spin_button_new( GTK_ADJUSTMENT( adj ), 1, 0 );
+ spin = ui::SpinButton( adj, 1, 0 );
gtk_widget_show( spin );
gtk_spin_button_set_wrap( GTK_SPIN_BUTTON( spin ), TRUE );
gtk_box_pack_end( GTK_BOX( hbox ), spin, FALSE, TRUE, 0 );
// MapCoordinator dialog window
void MapCoordinator(){
GtkWidget *window, *vbox, *table, *label, *spinnerMinX, *spinnerMinY, *spinnerMaxX, *spinnerMaxY, *button;
- GtkAdjustment *spinner_adj_MinX, *spinner_adj_MinY, *spinner_adj_MaxX, *spinner_adj_MaxY;
Entity *theWorldspawn = NULL;
const char *buffer;
char line[20];
globalOutputStream() << "SunPlug: adviced mapcoordsmins=" << minX << " " << maxY << "\n"; // console info about mapcoordsmins
globalOutputStream() << "SunPlug: adviced mapcoordsmaxs=" << maxX << " " << minY << "\n"; // console info about mapcoordsmaxs
- spinner_adj_MinX = ui::Adjustment( map_minX, -65536.0, 65536.0, 1.0, 5.0, 0 ); // create adjustment for value and range of minimum x value
- spinner_adj_MinY = ui::Adjustment( map_minY, -65536.0, 65536.0, 1.0, 5.0, 0 ); // create adjustment for value and range of minimum y value
- spinner_adj_MaxX = ui::Adjustment( map_maxX, -65536.0, 65536.0, 1.0, 5.0, 0 ); // create adjustment for value and range of maximum x value
- spinner_adj_MaxY = ui::Adjustment( map_maxY, -65536.0, 65536.0, 1.0, 5.0, 0 ); // create adjustment for value and range of maximum y value
+ auto spinner_adj_MinX = ui::Adjustment( map_minX, -65536.0, 65536.0, 1.0, 5.0, 0 ); // create adjustment for value and range of minimum x value
+ auto spinner_adj_MinY = ui::Adjustment( map_minY, -65536.0, 65536.0, 1.0, 5.0, 0 ); // create adjustment for value and range of minimum y value
+ auto spinner_adj_MaxX = ui::Adjustment( map_maxX, -65536.0, 65536.0, 1.0, 5.0, 0 ); // create adjustment for value and range of maximum x value
+ auto spinner_adj_MaxY = ui::Adjustment( map_maxY, -65536.0, 65536.0, 1.0, 5.0, 0 ); // create adjustment for value and range of maximum y value
button = ui::Button( "Get optimal mapcoords" ); // create button with text
g_signal_connect( G_OBJECT( button ), "clicked", G_CALLBACK( input_optimal ), NULL ); // connect button with callback function
gtk_label_set_justify( GTK_LABEL( label ), GTK_JUSTIFY_LEFT ); // align text to the left side
gtk_table_attach_defaults( GTK_TABLE( table ), label, 0, 1, 1, 2 ); // insert label into table
- spinnerMinX = gtk_spin_button_new( spinner_adj_MinX, 1.0, 0 ); // create textbox wiht value spin, value and value range
+ spinnerMinX = ui::SpinButton( spinner_adj_MinX, 1.0, 0 ); // create textbox wiht value spin, value and value range
gtk_table_attach_defaults( GTK_TABLE( table ), spinnerMinX, 1, 2, 1, 2 ); // insert spinbox into table
- spinnerMinY = gtk_spin_button_new( spinner_adj_MinY, 1.0, 0 ); // create textbox wiht value spin, value and value range
+ spinnerMinY = ui::SpinButton( spinner_adj_MinY, 1.0, 0 ); // create textbox wiht value spin, value and value range
gtk_table_attach_defaults( GTK_TABLE( table ), spinnerMinY, 2, 3, 1, 2 ); // insert spinbox into table
label = ui::Label( "mapcoordsmaxs" ); // create label
gtk_label_set_justify( GTK_LABEL( label ), GTK_JUSTIFY_LEFT ); // align text to the left side
gtk_table_attach_defaults( GTK_TABLE( table ), label, 0, 1, 2, 3 ); // insert label into table
- spinnerMaxX = gtk_spin_button_new( spinner_adj_MaxX, 1.0, 0 ); // create textbox wiht value spin, value and value range
+ spinnerMaxX = ui::SpinButton( spinner_adj_MaxX, 1.0, 0 ); // create textbox wiht value spin, value and value range
gtk_table_attach_defaults( GTK_TABLE( table ), spinnerMaxX, 1, 2, 2, 3 ); // insert spinbox into table
- spinnerMaxY = gtk_spin_button_new( spinner_adj_MaxY, 1.0, 0 ); // create textbox wiht value spin, value and value range
+ spinnerMaxY = ui::SpinButton( spinner_adj_MaxY, 1.0, 0 ); // create textbox wiht value spin, value and value range
gtk_table_attach_defaults( GTK_TABLE( table ), spinnerMaxY, 2, 3, 2, 3 ); // insert spinbox into table
// put the references to the spinboxes and the worldspawn into the global exchange
ScrolledWindow::ScrolledWindow() : ScrolledWindow(GTK_SCROLLED_WINDOW(gtk_scrolled_window_new(nullptr, nullptr)))
{ }
+ SpinButton::SpinButton(Adjustment adjustment, double climb_rate, std::size_t digits) : SpinButton(GTK_SPIN_BUTTON(gtk_spin_button_new(adjustment, climb_rate, digits)))
+ { }
+
Table::Table(std::size_t rows, std::size_t columns, bool homogenous) : Table(GTK_TABLE(gtk_table_new(rows, columns, homogenous)))
{ }
using ui_modal = struct ModalDialog;
using ui_object = struct _GtkObject;
using ui_scrolledwindow = struct _GtkScrolledWindow;
+using ui_spinbutton = struct _GtkSpinButton;
using ui_table = struct _GtkTable;
using ui_treemodel = struct _GtkTreeModel;
using ui_treeview = struct _GtkTreeView;
ScrolledWindow();
);
+ WRAP(SpinButton, Widget, ui_spinbutton,
+ SpinButton(Adjustment adjustment, double climb_rate, std::size_t digits);
+ );
+
WRAP(Table, Widget, ui_table,
Table(std::size_t rows, std::size_t columns, bool homogenous);
);
- WRAP(SpinButton, Widget, ui_widget,);
-
WRAP(TreeModel, Widget, ui_treemodel,);
WRAP(TreeView, Widget, ui_treeview,
{
++digits;
}
- GtkSpinButton* spin = GTK_SPIN_BUTTON( gtk_spin_button_new( ui::Adjustment( value, lower, upper, step, 10, 0 ), step, digits ) );
+ GtkSpinButton* spin = ui::SpinButton( ui::Adjustment( value, lower, upper, step, 10, 0 ), step, digits );
gtk_widget_show( GTK_WIDGET( spin ) );
gtk_widget_set_size_request( GTK_WIDGET( spin ), 64, -1 );
return spin;
DialogSpinnerRow row( DialogSpinnerRow_new( name, value, lower, upper, 1 ) );
AddIntSpinnerData( *row.m_spin, importViewer, exportViewer );
DialogVBox_packRow( GTK_VBOX( vbox ), row.m_row );
- return ui::SpinButton(row.m_row);
+ return ui::SpinButton(row.m_spin);
}
ui::SpinButton Dialog::addSpinner( ui::Widget vbox, const char* name, int& data, double value, double lower, double upper ){
DialogSpinnerRow row( DialogSpinnerRow_new( name, value, lower, upper, 10 ) );
AddFloatSpinnerData( *row.m_spin, importViewer, exportViewer );
DialogVBox_packRow( GTK_VBOX( vbox ), row.m_row );
- return ui::SpinButton(row.m_row);
+ return ui::SpinButton(row.m_spin);
}
// so we need to have at least one initialisation somewhere
entry_set_float( entry, g_pi_globals.shift[0] );
- GtkAdjustment* adj = ui::Adjustment( 0, -8192, 8192, 1, 1, 0 );
+ auto adj = ui::Adjustment( 0, -8192, 8192, 1, 1, 0 );
g_signal_connect( G_OBJECT( adj ), "value_changed", G_CALLBACK( OnSpinChanged ), entry );
g_object_set_data( G_OBJECT( window ), "hshift_adj", adj );
- GtkSpinButton* spin = GTK_SPIN_BUTTON( gtk_spin_button_new( adj, 1, 0 ) );
+ GtkSpinButton* spin = ui::SpinButton( adj, 1, 0 );
gtk_widget_show( GTK_WIDGET( spin ) );
gtk_table_attach( table, GTK_WIDGET( spin ), 1, 2, 0, 1,
(GtkAttachOptions)( 0 ),
gtk_widget_set_usize( GTK_WIDGET( entry ), 50, -2 );
entry_set_float( entry, g_pi_globals.shift[1] );
- GtkAdjustment* adj = ui::Adjustment( 0, -8192, 8192, 1, 1, 0 );
+ auto adj = ui::Adjustment( 0, -8192, 8192, 1, 1, 0 );
g_signal_connect( G_OBJECT( adj ), "value_changed", G_CALLBACK( OnSpinChanged ), entry );
g_object_set_data( G_OBJECT( window ), "vshift_adj", adj );
- GtkSpinButton* spin = GTK_SPIN_BUTTON( gtk_spin_button_new( adj, 1, 0 ) );
+ GtkSpinButton* spin = ui::SpinButton( adj, 1, 0 );
gtk_widget_show( GTK_WIDGET( spin ) );
gtk_table_attach( table, GTK_WIDGET( spin ), 1, 2, 1, 2,
(GtkAttachOptions)( 0 ),
gtk_widget_set_usize( GTK_WIDGET( entry ), 50, -2 );
entry_set_float( entry, g_pi_globals.scale[0] );
- GtkAdjustment* adj = ui::Adjustment( 0, -1000, 1000, 1, 1, 0 );
+ auto adj = ui::Adjustment( 0, -1000, 1000, 1, 1, 0 );
g_signal_connect( G_OBJECT( adj ), "value_changed", G_CALLBACK( OnSpinChanged ), entry );
g_object_set_data( G_OBJECT( window ), "hscale_adj", adj );
- GtkSpinButton* spin = GTK_SPIN_BUTTON( gtk_spin_button_new( adj, 1, 0 ) );
+ GtkSpinButton* spin = ui::SpinButton( adj, 1, 0 );
gtk_widget_show( GTK_WIDGET( spin ) );
gtk_table_attach( table, GTK_WIDGET( spin ), 1, 2, 2, 3,
(GtkAttachOptions)( 0 ),
gtk_widget_set_usize( GTK_WIDGET( entry ), 50, -2 );
entry_set_float( entry, g_pi_globals.scale[1] );
- GtkAdjustment* adj = ui::Adjustment( 0, -1000, 1000, 1, 1, 0 );
+ auto adj = ui::Adjustment( 0, -1000, 1000, 1, 1, 0 );
g_signal_connect( G_OBJECT( adj ), "value_changed", G_CALLBACK( OnSpinChanged ), entry );
g_object_set_data( G_OBJECT( window ), "vscale_adj", adj );
- GtkSpinButton* spin = GTK_SPIN_BUTTON( gtk_spin_button_new( adj, 1, 0 ) );
+ GtkSpinButton* spin = ui::SpinButton( adj, 1, 0 );
gtk_widget_show( GTK_WIDGET( spin ) );
gtk_table_attach( table, GTK_WIDGET( spin ), 1, 2, 3, 4,
(GtkAttachOptions)( 0 ),
gtk_widget_set_usize( GTK_WIDGET( entry ), 50, -2 );
entry_set_float( entry, g_pi_globals.rotate );
- GtkAdjustment* adj = ui::Adjustment( 0, -1000, 1000, 1, 1, 0 ); // NOTE: Arnout - this really should be 360 but can't change it anymore as it could break existing maps
+ auto adj = ui::Adjustment( 0, -1000, 1000, 1, 1, 0 ); // NOTE: Arnout - this really should be 360 but can't change it anymore as it could break existing maps
g_signal_connect( G_OBJECT( adj ), "value_changed", G_CALLBACK( OnSpinChanged ), entry );
g_object_set_data( G_OBJECT( window ), "rotate_adj", adj );
- GtkSpinButton* spin = GTK_SPIN_BUTTON( gtk_spin_button_new( adj, 1, 0 ) );
+ GtkSpinButton* spin = ui::SpinButton( adj, 1, 0 );
gtk_widget_show( GTK_WIDGET( spin ) );
gtk_table_attach( table, GTK_WIDGET( spin ), 1, 2, 4, 5,
(GtkAttachOptions)( 0 ),
(GtkAttachOptions) ( 0 ), 0, 0 );
}
{
- GtkAdjustment* adj = ui::Adjustment( 0, -359, 359, 1, 10, 0 );
- GtkSpinButton* spin = GTK_SPIN_BUTTON( gtk_spin_button_new( adj, 1, 0 ) );
+ auto adj = ui::Adjustment( 0, -359, 359, 1, 10, 0 );
+ GtkSpinButton* spin = ui::SpinButton( adj, 1, 0 );
gtk_widget_show( GTK_WIDGET( spin ) );
gtk_table_attach( table, GTK_WIDGET( spin ), 1, 2, 0, 1,
(GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ),
g_rotate_dialog.x = spin;
}
{
- GtkAdjustment* adj = ui::Adjustment( 0, -359, 359, 1, 10, 0 );
- GtkSpinButton* spin = GTK_SPIN_BUTTON( gtk_spin_button_new( adj, 1, 0 ) );
+ auto adj = ui::Adjustment( 0, -359, 359, 1, 10, 0 );
+ GtkSpinButton* spin = ui::SpinButton( adj, 1, 0 );
gtk_widget_show( GTK_WIDGET( spin ) );
gtk_table_attach( table, GTK_WIDGET( spin ), 1, 2, 1, 2,
(GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ),
g_rotate_dialog.y = spin;
}
{
- GtkAdjustment* adj = ui::Adjustment( 0, -359, 359, 1, 10, 0 );
- GtkSpinButton* spin = GTK_SPIN_BUTTON( gtk_spin_button_new( adj, 1, 0 ) );
+ auto adj = ui::Adjustment( 0, -359, 359, 1, 10, 0 );
+ GtkSpinButton* spin = ui::SpinButton( adj, 1, 0 );
gtk_widget_show( GTK_WIDGET( spin ) );
gtk_table_attach( table, GTK_WIDGET( spin ), 1, 2, 2, 3,
(GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ),
(GtkAttachOptions) ( 0 ), 0, 0 );
}
{
- GtkSpinButton* spin = GTK_SPIN_BUTTON( gtk_spin_button_new( ui::Adjustment( 0, -8192, 8192, 2, 8, 0 ), 0, 2 ) );
+ GtkSpinButton* spin = ui::SpinButton( ui::Adjustment( 0, -8192, 8192, 2, 8, 0 ), 0, 2 );
m_hshiftIncrement.m_spin = spin;
m_hshiftSpinner.connect( spin );
gtk_widget_show( GTK_WIDGET( spin ) );
(GtkAttachOptions) ( 0 ), 0, 0 );
}
{
- GtkSpinButton* spin = GTK_SPIN_BUTTON( gtk_spin_button_new( ui::Adjustment( 0, -8192, 8192, 2, 8, 0 ), 0, 2 ) );
+ GtkSpinButton* spin = ui::SpinButton( ui::Adjustment( 0, -8192, 8192, 2, 8, 0 ), 0, 2 );
m_vshiftIncrement.m_spin = spin;
m_vshiftSpinner.connect( spin );
gtk_widget_show( GTK_WIDGET( spin ) );
(GtkAttachOptions) ( 0 ), 0, 0 );
}
{
- GtkSpinButton* spin = GTK_SPIN_BUTTON( gtk_spin_button_new( ui::Adjustment( 0, -8192, 8192, 2, 8, 0 ), 0, 5 ) );
+ GtkSpinButton* spin = ui::SpinButton( ui::Adjustment( 0, -8192, 8192, 2, 8, 0 ), 0, 5 );
m_hscaleIncrement.m_spin = spin;
m_hscaleSpinner.connect( spin );
gtk_widget_show( GTK_WIDGET( spin ) );
(GtkAttachOptions) ( 0 ), 0, 0 );
}
{
- GtkSpinButton* spin = GTK_SPIN_BUTTON( gtk_spin_button_new( ui::Adjustment( 0, -8192, 8192, 2, 8, 0 ), 0, 5 ) );
+ GtkSpinButton* spin = ui::SpinButton( ui::Adjustment( 0, -8192, 8192, 2, 8, 0 ), 0, 5 );
m_vscaleIncrement.m_spin = spin;
m_vscaleSpinner.connect( spin );
gtk_widget_show( GTK_WIDGET( spin ) );
(GtkAttachOptions) ( 0 ), 0, 0 );
}
{
- GtkSpinButton* spin = GTK_SPIN_BUTTON( gtk_spin_button_new( ui::Adjustment( 0, -8192, 8192, 2, 8, 0 ), 0, 2 ) );
+ GtkSpinButton* spin = ui::SpinButton( ui::Adjustment( 0, -8192, 8192, 2, 8, 0 ), 0, 2 );
m_rotateIncrement.m_spin = spin;
m_rotateSpinner.connect( spin );
gtk_widget_show( GTK_WIDGET( spin ) );
gtk_widget_set_usize( button, 60, -2 );
}
{
- ui::Widget spin = ui::Widget(gtk_spin_button_new( ui::Adjustment( 1, 0, 1 << 16, 1, 10, 0 ), 0, 6 ));
+ ui::Widget spin = ui::SpinButton( ui::Adjustment( 1, 0, 1 << 16, 1, 10, 0 ), 0, 6 );
gtk_widget_show( spin );
gtk_table_attach( GTK_TABLE( table ), spin, 2, 3, 1, 2,
(GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ),
AddDialogData( *GTK_SPIN_BUTTON( spin ), m_fitHorizontal );
}
{
- ui::Widget spin = ui::Widget(gtk_spin_button_new( ui::Adjustment( 1, 0, 1 << 16, 1, 10, 0 ), 0, 6 ));
+ ui::Widget spin = ui::SpinButton( ui::Adjustment( 1, 0, 1 << 16, 1, 10, 0 ), 0, 6 );
gtk_widget_show( spin );
gtk_table_attach( GTK_TABLE( table ), spin, 3, 4, 1, 2,
(GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ),