switch ( m_vt )
{
case XY:
- m_pTabLabel = gtk_label_new( "X/Y" );
+ m_pTabLabel = ui::Label( "X/Y" );
m_pImage = &backgroundXY;
break;
case XZ:
- m_pTabLabel = gtk_label_new( "X/Z" );
+ m_pTabLabel = ui::Label( "X/Z" );
m_pImage = &backgroundXZ;
break;
case YZ:
- m_pTabLabel = gtk_label_new( "Y/Z" );
+ m_pTabLabel = ui::Label( "Y/Z" );
m_pImage = &backgroundYZ;
break;
}
// A vbox to hold everything
- m_pWidget = gtk_vbox_new( FALSE,0 );
+ m_pWidget = ui::VBox( FALSE,0 );
// Frame for file row
- frame = gtk_frame_new( "File" );
+ frame = ui::Frame( "File" );
gtk_box_pack_start( GTK_BOX( m_pWidget ),frame, FALSE, FALSE, 2 );
// hbox for first row
- hbox = gtk_hbox_new( FALSE,5 );
+ hbox = ui::HBox( FALSE,5 );
gtk_container_set_border_width( GTK_CONTAINER( hbox ),4 );
gtk_container_add( GTK_CONTAINER( frame ), hbox );
// label to display filename
- m_pFileLabel = gtk_label_new( NO_FILE_MSG );
+ m_pFileLabel = ui::Label( NO_FILE_MSG );
gtk_label_set_selectable( GTK_LABEL( m_pFileLabel ),TRUE );
//TODO set min size ? done with spaces right now
gtk_box_pack_start( GTK_BOX( hbox ),m_pFileLabel, TRUE, TRUE, 5 );
gtk_widget_show( m_pFileLabel );
- w = gtk_button_new_with_label( "Browse..." );
+ w = ui::Button( "Browse..." );
g_signal_connect( G_OBJECT( w ), "clicked", G_CALLBACK( browse_callback ),
( gpointer ) this );
gtk_box_pack_start( GTK_BOX( hbox ),w, FALSE, FALSE, 5 );
gtk_tooltips_set_tip( pTooltips, w, "Select a file", NULL );
gtk_widget_show( w );
- w = gtk_button_new_with_label( "Reload" );
+ w = ui::Button( "Reload" );
g_signal_connect( G_OBJECT( w ), "clicked", G_CALLBACK( reload_callback ),
( gpointer ) this );
// TODO disable until we have file
gtk_widget_show( frame );
// second row (rendering options)
- frame = gtk_frame_new( "Rendering" );
+ frame = ui::Frame( "Rendering" );
gtk_box_pack_start( GTK_BOX( m_pWidget ),frame, FALSE, FALSE, 2 );
- hbox = gtk_hbox_new( FALSE,5 );
+ hbox = ui::HBox( FALSE,5 );
gtk_container_set_border_width( GTK_CONTAINER( hbox ),4 );
gtk_container_add( GTK_CONTAINER( frame ), hbox );
- w = gtk_label_new( "Vertex alpha:" );
+ w = ui::Label( "Vertex alpha:" );
gtk_box_pack_start( GTK_BOX( hbox ),w, FALSE, FALSE, 5 );
gtk_widget_show( w );
- w = gtk_hscale_new_with_range( 0.0,1.0,0.01 );
+ w = ui::HScale( 0.0, 1.0, 0.01 );
gtk_range_set_value( GTK_RANGE( w ),0.5 );
gtk_scale_set_value_pos( GTK_SCALE( w ),GTK_POS_LEFT );
g_signal_connect( G_OBJECT( w ), "value-changed",
gtk_widget_show( hbox );
gtk_widget_show( frame );
// Third row (size and position)
- frame = gtk_frame_new( "Size/Position (undefined)" );
+ frame = ui::Frame( "Size/Position (undefined)" );
m_pPosLabel = gtk_frame_get_label_widget( GTK_FRAME( frame ) );
gtk_box_pack_start( GTK_BOX( m_pWidget ), frame, FALSE, FALSE, 2 );
- hbox = gtk_hbox_new( FALSE,5 );
+ hbox = ui::HBox( FALSE,5 );
gtk_container_add( GTK_CONTAINER( frame ), hbox );
gtk_container_set_border_width( GTK_CONTAINER( hbox ),4 );
- w = gtk_button_new_with_label( "from selection" );
+ w = ui::Button( "from selection" );
gtk_box_pack_start( GTK_BOX( hbox ),w, TRUE, FALSE, 5 );
g_signal_connect( G_OBJECT( w ), "clicked", G_CALLBACK( size_sel_callback ),
( gpointer ) this );
gtk_widget_show( w );
if ( m_vt == XY ) {
- w = gtk_button_new_with_label( "from map mins/maxs" );
+ w = ui::Button( "from map mins/maxs" );
gtk_box_pack_start( GTK_BOX( hbox ),w, TRUE, FALSE, 2 );
g_signal_connect( G_OBJECT( w ), "clicked", G_CALLBACK( size_mm_callback ),
( gpointer ) this );
// GTK_STOCK_CLOSE,
// GTK_RESPONSE_CLOSE,
NULL );
- gtk_signal_connect( GTK_OBJECT( pDialogWnd ), "delete_event",
- GTK_SIGNAL_FUNC( close_callback ), NULL );
- gtk_signal_connect( GTK_OBJECT( pDialogWnd ), "response",
- GTK_SIGNAL_FUNC( response_callback ), NULL );
-// gtk_signal_connect( GTK_OBJECT (pDialogWnd), "expose_event", GTK_SIGNAL_FUNC( ci_expose ), NULL );
+ g_signal_connect( GTK_OBJECT( pDialogWnd ), "delete_event",
+ G_CALLBACK( close_callback ), NULL );
+ g_signal_connect( GTK_OBJECT( pDialogWnd ), "response",
+ G_CALLBACK( response_callback ), NULL );
+// g_signal_connect( GTK_OBJECT (pDialogWnd), "expose_event", G_CALLBACK( ci_expose ), NULL );
pTooltips = gtk_tooltips_new();
gboolean check;
check = gtk_toggle_button_get_active( GTK_TOGGLE_BUTTON( dlgTexReset.cbTexChange ) );
- gtk_entry_set_editable( GTK_ENTRY( dlgTexReset.editTexNew ), check );
- gtk_entry_set_editable( GTK_ENTRY( dlgTexReset.editTexOld ), check );
+ gtk_editable_set_editable( GTK_EDITABLE( dlgTexReset.editTexNew ), check );
+ gtk_editable_set_editable( GTK_EDITABLE( dlgTexReset.editTexOld ), check );
check = gtk_toggle_button_get_active( GTK_TOGGLE_BUTTON( dlgTexReset.cbScaleHor ) );
- gtk_entry_set_editable( GTK_ENTRY( dlgTexReset.editScaleHor ), check );
+ gtk_editable_set_editable( GTK_EDITABLE( dlgTexReset.editScaleHor ), check );
check = gtk_toggle_button_get_active( GTK_TOGGLE_BUTTON( dlgTexReset.cbScaleVert ) );
- gtk_entry_set_editable( GTK_ENTRY( dlgTexReset.editScaleVert ), check );
+ gtk_editable_set_editable( GTK_EDITABLE( dlgTexReset.editScaleVert ), check );
check = gtk_toggle_button_get_active( GTK_TOGGLE_BUTTON( dlgTexReset.cbShiftHor ) );
- gtk_entry_set_editable( GTK_ENTRY( dlgTexReset.editShiftHor ), check );
+ gtk_editable_set_editable( GTK_EDITABLE( dlgTexReset.editShiftHor ), check );
check = gtk_toggle_button_get_active( GTK_TOGGLE_BUTTON( dlgTexReset.cbShiftVert ) );
- gtk_entry_set_editable( GTK_ENTRY( dlgTexReset.editShiftVert ), check );
+ gtk_editable_set_editable( GTK_EDITABLE( dlgTexReset.editShiftVert ), check );
check = gtk_toggle_button_get_active( GTK_TOGGLE_BUTTON( dlgTexReset.cbRotation ) );
- gtk_entry_set_editable( GTK_ENTRY( dlgTexReset.editRotation ), check );
+ gtk_editable_set_editable( GTK_EDITABLE( dlgTexReset.editRotation ), check );
}
static void dialog_button_callback( GtkWidget *widget, gpointer data ){
TwinWidget* tw = (TwinWidget*)data;
GtkEntry* entry = GTK_ENTRY( tw->one );
- GtkCombo* combo = GTK_COMBO( tw->two );
+ auto* combo = GTK_BIN(tw->two);
- const gchar* tex = gtk_entry_get_text( GTK_ENTRY( combo->entry ) );
+ const gchar *tex = gtk_entry_get_text(GTK_ENTRY (gtk_bin_get_child(combo)));
gtk_entry_set_text( entry, tex );
}
*/
EMessageBoxReturn DoMessageBox( const char* lpText, const char* lpCaption, EMessageBoxType type ){
- GtkWidget *window, *w, *vbox, *hbox;
+ ui::Widget window, w, vbox, hbox;
EMessageBoxReturn ret;
int loop = 1;
- window = gtk_window_new( GTK_WINDOW_TOPLEVEL );
- gtk_signal_connect( GTK_OBJECT( window ), "delete_event",
- GTK_SIGNAL_FUNC( dialog_delete_callback ), NULL );
- gtk_signal_connect( GTK_OBJECT( window ), "destroy",
- GTK_SIGNAL_FUNC( gtk_widget_destroy ), NULL );
+ window = ui::Window( ui::window_type::TOP );
+ g_signal_connect( GTK_OBJECT( window ), "delete_event",
+ G_CALLBACK( dialog_delete_callback ), NULL );
+ g_signal_connect( GTK_OBJECT( window ), "destroy",
+ G_CALLBACK( gtk_widget_destroy ), NULL );
gtk_window_set_title( GTK_WINDOW( window ), lpCaption );
- gtk_container_border_width( GTK_CONTAINER( window ), 10 );
+ gtk_container_set_border_width( GTK_CONTAINER( window ), 10 );
g_object_set_data( G_OBJECT( window ), "loop", &loop );
g_object_set_data( G_OBJECT( window ), "ret", &ret );
gtk_widget_realize( window );
- vbox = gtk_vbox_new( FALSE, 10 );
+ vbox = ui::VBox( FALSE, 10 );
gtk_container_add( GTK_CONTAINER( window ), vbox );
gtk_widget_show( vbox );
- w = gtk_label_new( lpText );
+ w = ui::Label( lpText );
gtk_box_pack_start( GTK_BOX( vbox ), w, FALSE, FALSE, 2 );
gtk_label_set_justify( GTK_LABEL( w ), GTK_JUSTIFY_LEFT );
gtk_widget_show( w );
- w = gtk_hseparator_new();
+ w = ui::Widget(gtk_hseparator_new());
gtk_box_pack_start( GTK_BOX( vbox ), w, FALSE, FALSE, 2 );
gtk_widget_show( w );
- hbox = gtk_hbox_new( FALSE, 10 );
+ hbox = ui::HBox( FALSE, 10 );
gtk_box_pack_start( GTK_BOX( vbox ), hbox, FALSE, FALSE, 2 );
gtk_widget_show( hbox );
if ( type == eMB_OK ) {
- w = 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_SET_FLAGS( w, GTK_CAN_DEFAULT );
+ g_signal_connect( GTK_OBJECT( w ), "clicked",
+ G_CALLBACK( dialog_button_callback ), GINT_TO_POINTER( eIDOK ) );
+ gtk_widget_set_can_default(w, true);
gtk_widget_grab_default( w );
gtk_widget_show( w );
ret = eIDOK;
}
else if ( type == eMB_OKCANCEL ) {
- w = 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_SET_FLAGS( w, GTK_CAN_DEFAULT );
+ g_signal_connect( GTK_OBJECT( w ), "clicked",
+ G_CALLBACK( dialog_button_callback ), GINT_TO_POINTER( eIDOK ) );
+ gtk_widget_set_can_default( w, true );
gtk_widget_grab_default( w );
gtk_widget_show( w );
- w = 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 ) );
+ g_signal_connect( GTK_OBJECT( w ), "clicked",
+ G_CALLBACK( dialog_button_callback ), GINT_TO_POINTER( eIDCANCEL ) );
gtk_widget_show( w );
ret = eIDCANCEL;
}
else if ( type == eMB_YESNOCANCEL ) {
- w = 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_SET_FLAGS( w, GTK_CAN_DEFAULT );
+ g_signal_connect( GTK_OBJECT( w ), "clicked",
+ G_CALLBACK( dialog_button_callback ), GINT_TO_POINTER( eIDYES ) );
+ gtk_widget_set_can_default( w, true );
gtk_widget_grab_default( w );
gtk_widget_show( w );
- w = 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 ) );
+ g_signal_connect( GTK_OBJECT( w ), "clicked",
+ G_CALLBACK( dialog_button_callback ), GINT_TO_POINTER( eIDNO ) );
gtk_widget_show( w );
- w = 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 ) );
+ g_signal_connect( GTK_OBJECT( w ), "clicked",
+ G_CALLBACK( dialog_button_callback ), GINT_TO_POINTER( eIDCANCEL ) );
gtk_widget_show( w );
ret = eIDCANCEL;
}
else /* if (mode == MB_YESNO) */
{
- w = 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_SET_FLAGS( w, GTK_CAN_DEFAULT );
+ g_signal_connect( GTK_OBJECT( w ), "clicked",
+ G_CALLBACK( dialog_button_callback ), GINT_TO_POINTER( eIDYES ) );
+ gtk_widget_set_can_default( w, true );
gtk_widget_grab_default( w );
gtk_widget_show( w );
- w = 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 ) );
+ g_signal_connect( GTK_OBJECT( w ), "clicked",
+ G_CALLBACK( dialog_button_callback ), GINT_TO_POINTER( eIDNO ) );
gtk_widget_show( w );
ret = eIDNO;
}
EMessageBoxReturn DoIntersectBox( IntersectRS* rs ){
GtkWidget *window, *w, *vbox, *hbox;
- GtkWidget *radio1, *radio2;
GtkWidget *check1, *check2;
EMessageBoxReturn ret;
int loop = 1;
- window = gtk_window_new( GTK_WINDOW_TOPLEVEL );
+ window = ui::Window( ui::window_type::TOP );
- gtk_signal_connect( GTK_OBJECT( window ), "delete_event", GTK_SIGNAL_FUNC( dialog_delete_callback ), NULL );
- gtk_signal_connect( GTK_OBJECT( window ), "destroy", GTK_SIGNAL_FUNC( gtk_widget_destroy ), NULL );
+ g_signal_connect( GTK_OBJECT( window ), "delete_event", G_CALLBACK( dialog_delete_callback ), NULL );
+ g_signal_connect( GTK_OBJECT( window ), "destroy", G_CALLBACK( gtk_widget_destroy ), NULL );
gtk_window_set_title( GTK_WINDOW( window ), "Intersect" );
- gtk_container_border_width( GTK_CONTAINER( window ), 10 );
+ gtk_container_set_border_width( GTK_CONTAINER( window ), 10 );
g_object_set_data( G_OBJECT( window ), "loop", &loop );
g_object_set_data( G_OBJECT( window ), "ret", &ret );
- vbox = gtk_vbox_new( FALSE, 10 );
+ vbox = ui::VBox( FALSE, 10 );
gtk_container_add( GTK_CONTAINER( window ), vbox );
gtk_widget_show( vbox );
// ---- vbox ----
- radio1 = gtk_radio_button_new_with_label( NULL, "Use Whole Map" );
+ auto radio1 = gtk_radio_button_new_with_label( NULL, "Use Whole Map" );
gtk_box_pack_start( GTK_BOX( vbox ), radio1, FALSE, FALSE, 2 );
gtk_widget_show( radio1 );
- radio2 = gtk_radio_button_new_with_label( ( (GtkRadioButton*)radio1 )->group, "Use Selected Brushes" );
+ auto radio2 = gtk_radio_button_new_with_label( gtk_radio_button_get_group(GTK_RADIO_BUTTON(radio1)), "Use Selected Brushes" );
gtk_box_pack_start( GTK_BOX( vbox ), radio2, FALSE, FALSE, 2 );
gtk_widget_show( radio2 );
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 );
- hbox = gtk_hbox_new( FALSE, 10 );
+ hbox = ui::HBox( FALSE, 10 );
gtk_box_pack_start( GTK_BOX( vbox ), hbox, FALSE, FALSE, 2 );
gtk_widget_show( hbox );
// ---- hbox ---- ok/cancel buttons
- w = 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 ) );
+ g_signal_connect( GTK_OBJECT( w ), "clicked", G_CALLBACK( dialog_button_callback ), GINT_TO_POINTER( eIDOK ) );
- GTK_WIDGET_SET_FLAGS( w, GTK_CAN_DEFAULT );
+ gtk_widget_set_can_default( w, true );
gtk_widget_grab_default( w );
gtk_widget_show( w );
- w = 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 ) );
+ g_signal_connect( GTK_OBJECT( w ), "clicked", G_CALLBACK( dialog_button_callback ), GINT_TO_POINTER( eIDCANCEL ) );
gtk_widget_show( w );
ret = eIDCANCEL;
EMessageBoxReturn ret;
int loop = 1;
- window = gtk_window_new( GTK_WINDOW_TOPLEVEL );
+ window = ui::Window( ui::window_type::TOP );
- gtk_signal_connect( GTK_OBJECT( window ), "delete_event", GTK_SIGNAL_FUNC( dialog_delete_callback ), NULL );
- gtk_signal_connect( GTK_OBJECT( window ), "destroy", GTK_SIGNAL_FUNC( gtk_widget_destroy ), NULL );
+ g_signal_connect( GTK_OBJECT( window ), "delete_event", G_CALLBACK( dialog_delete_callback ), NULL );
+ g_signal_connect( GTK_OBJECT( window ), "destroy", G_CALLBACK( gtk_widget_destroy ), NULL );
gtk_window_set_title( GTK_WINDOW( window ), "Polygon Builder" );
- gtk_container_border_width( GTK_CONTAINER( window ), 10 );
+ gtk_container_set_border_width( GTK_CONTAINER( window ), 10 );
g_object_set_data( G_OBJECT( window ), "loop", &loop );
g_object_set_data( G_OBJECT( window ), "ret", &ret );
- vbox = gtk_vbox_new( FALSE, 10 );
+ vbox = ui::VBox( FALSE, 10 );
gtk_container_add( GTK_CONTAINER( window ), vbox );
gtk_widget_show( vbox );
// ---- vbox ----
- hbox = gtk_hbox_new( FALSE, 10 );
+ hbox = ui::HBox( FALSE, 10 );
gtk_box_pack_start( GTK_BOX( vbox ), hbox, FALSE, FALSE, 2 );
gtk_widget_show( hbox );
// ---- hbox ----
- vbox2 = gtk_vbox_new( FALSE, 10 );
+ vbox2 = ui::VBox( FALSE, 10 );
gtk_box_pack_start( GTK_BOX( hbox ), vbox2, FALSE, FALSE, 2 );
gtk_widget_show( vbox2 );
// ---- vbox2 ----
- hbox2 = gtk_hbox_new( FALSE, 10 );
+ hbox2 = ui::HBox( FALSE, 10 );
gtk_box_pack_start( GTK_BOX( vbox2 ), hbox2, FALSE, FALSE, 2 );
gtk_widget_show( hbox2 );
// ---- hbox2 ----
- text1 = gtk_entry_new_with_max_length( 256 );
+ text1 = ui::Entry( 256 );
gtk_entry_set_text( (GtkEntry*)text1, "3" );
gtk_box_pack_start( GTK_BOX( hbox2 ), text1, FALSE, FALSE, 2 );
gtk_widget_show( text1 );
- w = gtk_label_new( "Number Of Sides" );
+ w = ui::Label( "Number Of Sides" );
gtk_box_pack_start( GTK_BOX( hbox2 ), w, FALSE, FALSE, 2 );
gtk_label_set_justify( GTK_LABEL( w ), GTK_JUSTIFY_LEFT );
gtk_widget_show( w );
// ---- /hbox2 ----
- hbox2 = gtk_hbox_new( FALSE, 10 );
+ hbox2 = ui::HBox( FALSE, 10 );
gtk_box_pack_start( GTK_BOX( vbox2 ), hbox2, FALSE, FALSE, 2 );
gtk_widget_show( hbox2 );
// ---- hbox2 ----
- text2 = gtk_entry_new_with_max_length( 256 );
+ text2 = ui::Entry( 256 );
gtk_entry_set_text( (GtkEntry*)text2, "8" );
gtk_box_pack_start( GTK_BOX( hbox2 ), text2, FALSE, FALSE, 2 );
gtk_widget_show( text2 );
- w = gtk_label_new( "Border Width" );
+ w = ui::Label( "Border Width" );
gtk_box_pack_start( GTK_BOX( hbox2 ), w, FALSE, FALSE, 2 );
gtk_label_set_justify( GTK_LABEL( w ), GTK_JUSTIFY_LEFT );
gtk_widget_show( w );
- vbox2 = gtk_vbox_new( FALSE, 10 );
+ vbox2 = ui::VBox( FALSE, 10 );
gtk_box_pack_start( GTK_BOX( hbox ), vbox2, FALSE, FALSE, 2 );
gtk_widget_show( vbox2 );
// ---- 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 );
// ---- /hbox ----
- hbox = gtk_hbox_new( FALSE, 10 );
+ hbox = ui::HBox( FALSE, 10 );
gtk_box_pack_start( GTK_BOX( vbox ), hbox, FALSE, FALSE, 2 );
gtk_widget_show( hbox );
// ---- hbox ----
- w = 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 ) );
+ g_signal_connect( GTK_OBJECT( w ), "clicked", G_CALLBACK( dialog_button_callback ), GINT_TO_POINTER( eIDOK ) );
- GTK_WIDGET_SET_FLAGS( w, GTK_CAN_DEFAULT );
+ gtk_widget_set_can_default( w, true );
gtk_widget_grab_default( w );
gtk_widget_show( w );
- w = 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 ) );
+ g_signal_connect( GTK_OBJECT( w ), "clicked", G_CALLBACK( dialog_button_callback ), GINT_TO_POINTER( eIDCANCEL ) );
gtk_widget_show( w );
ret = eIDCANCEL;
EMessageBoxReturn ret;
int loop = 1;
- char *text = "Please set a value in the boxes below and press 'OK' to build the stairs";
+ char *text = "Please set a value in the boxes below and press 'OK' to build the stairs";
- window = gtk_window_new( GTK_WINDOW_TOPLEVEL );
+ window = ui::Window( ui::window_type::TOP );
- gtk_signal_connect( GTK_OBJECT( window ), "delete_event", GTK_SIGNAL_FUNC( dialog_delete_callback ), NULL );
- gtk_signal_connect( GTK_OBJECT( window ), "destroy", GTK_SIGNAL_FUNC( gtk_widget_destroy ), NULL );
+ g_signal_connect( GTK_OBJECT( window ), "delete_event", G_CALLBACK( dialog_delete_callback ), NULL );
+ g_signal_connect( GTK_OBJECT( window ), "destroy", G_CALLBACK( gtk_widget_destroy ), NULL );
gtk_window_set_title( GTK_WINDOW( window ), "Stair Builder" );
- gtk_container_border_width( GTK_CONTAINER( window ), 10 );
+ gtk_container_set_border_width( GTK_CONTAINER( window ), 10 );
g_object_set_data( G_OBJECT( window ), "loop", &loop );
g_object_set_data( G_OBJECT( window ), "ret", &ret );
gtk_widget_realize( window );
// new vbox
- vbox = gtk_vbox_new( FALSE, 10 );
+ vbox = ui::VBox( FALSE, 10 );
gtk_container_add( GTK_CONTAINER( window ), vbox );
gtk_widget_show( vbox );
- hbox = gtk_hbox_new( FALSE, 10 );
+ hbox = ui::HBox( FALSE, 10 );
gtk_container_add( GTK_CONTAINER( vbox ), hbox );
gtk_widget_show( hbox );
// dunno if you want this text or not ...
- w = gtk_label_new( text );
+ w = ui::Label( text );
gtk_box_pack_start( GTK_BOX( hbox ), w, FALSE, FALSE, 0 ); // not entirely sure on all the parameters / what they do ...
gtk_widget_show( w );
// ------------------------- // indenting == good way of keeping track of lines :)
// new hbox
- hbox = gtk_hbox_new( FALSE, 10 );
+ hbox = ui::HBox( FALSE, 10 );
gtk_box_pack_start( GTK_BOX( vbox ), hbox, FALSE, FALSE, 0 );
gtk_widget_show( hbox );
- textStairHeight = gtk_entry_new_with_max_length( 256 );
+ textStairHeight = ui::Entry( 256 );
gtk_box_pack_start( GTK_BOX( hbox ), textStairHeight, FALSE, FALSE, 1 );
gtk_widget_show( textStairHeight );
- w = gtk_label_new( "Stair Height" );
+ w = ui::Label( "Stair Height" );
gtk_box_pack_start( GTK_BOX( hbox ), w, FALSE, FALSE, 1 );
gtk_widget_show( w );
// ------------------------- //
- hbox = gtk_hbox_new( FALSE, 10 );
+ hbox = ui::HBox( FALSE, 10 );
gtk_box_pack_start( GTK_BOX( vbox ), hbox, FALSE, FALSE, 0 );
gtk_widget_show( hbox );
- w = gtk_label_new( "Direction:" );
+ w = ui::Label( "Direction:" );
gtk_box_pack_start( GTK_BOX( hbox ), w, FALSE, FALSE, 5 );
gtk_widget_show( w );
// -------------------------- //
- hbox = gtk_hbox_new( FALSE, 10 );
+ hbox = ui::HBox( FALSE, 10 );
gtk_box_pack_start( GTK_BOX( vbox ), hbox, FALSE, FALSE, 0 );
gtk_widget_show( hbox );
gtk_box_pack_start( GTK_BOX( hbox ), radioNorth, FALSE, FALSE, 3 );
gtk_widget_show( radioNorth );
- radioDirection = gtk_radio_button_group( GTK_RADIO_BUTTON( radioNorth ) );
+ radioDirection = gtk_radio_button_get_group( GTK_RADIO_BUTTON( radioNorth ) );
radioSouth = gtk_radio_button_new_with_label( radioDirection, "South" );
gtk_box_pack_start( GTK_BOX( hbox ), radioSouth, FALSE, FALSE, 2 );
gtk_widget_show( radioSouth );
- radioDirection = gtk_radio_button_group( GTK_RADIO_BUTTON( radioSouth ) );
+ radioDirection = gtk_radio_button_get_group( GTK_RADIO_BUTTON( radioSouth ) );
radioEast = gtk_radio_button_new_with_label( radioDirection, "East" );
gtk_box_pack_start( GTK_BOX( hbox ), radioEast, FALSE, FALSE, 1 );
gtk_widget_show( radioEast );
- radioDirection = gtk_radio_button_group( GTK_RADIO_BUTTON( radioEast ) );
+ radioDirection = gtk_radio_button_get_group( GTK_RADIO_BUTTON( radioEast ) );
radioWest = gtk_radio_button_new_with_label( radioDirection, "West" );
gtk_box_pack_start( GTK_BOX( hbox ), radioWest, FALSE, FALSE, 0 );
// --------------------------- //
- hbox = gtk_hbox_new( FALSE, 10 );
+ hbox = ui::HBox( FALSE, 10 );
gtk_box_pack_start( GTK_BOX( vbox ), hbox, FALSE, FALSE, 0 );
gtk_widget_show( hbox );
- w = gtk_label_new( "Style:" );
+ w = ui::Label( "Style:" );
gtk_box_pack_start( GTK_BOX( hbox ), w, FALSE, FALSE, 5 );
gtk_widget_show( w );
// --------------------------- //
- hbox = gtk_hbox_new( FALSE, 10 );
+ hbox = ui::HBox( FALSE, 10 );
gtk_box_pack_start( GTK_BOX( vbox ), hbox, FALSE, FALSE, 0 );
gtk_widget_show( hbox );
gtk_box_pack_start( GTK_BOX( hbox ), radioOldStyle, FALSE, FALSE, 0 );
gtk_widget_show( radioOldStyle );
- radioStyle = gtk_radio_button_group( GTK_RADIO_BUTTON( radioOldStyle ) );
+ radioStyle = gtk_radio_button_get_group( GTK_RADIO_BUTTON( radioOldStyle ) );
radioBobStyle = gtk_radio_button_new_with_label( radioStyle, "Bob's Style" );
gtk_box_pack_start( GTK_BOX( hbox ), radioBobStyle, FALSE, FALSE, 0 );
gtk_widget_show( radioBobStyle );
- radioStyle = gtk_radio_button_group( GTK_RADIO_BUTTON( radioBobStyle ) );
+ radioStyle = gtk_radio_button_get_group( GTK_RADIO_BUTTON( radioBobStyle ) );
radioCornerStyle = gtk_radio_button_new_with_label( radioStyle, "Corner Style" );
gtk_box_pack_start( GTK_BOX( hbox ), radioCornerStyle, FALSE, FALSE, 0 );
// 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 );
// --------------------------- //
- hbox = gtk_hbox_new( FALSE, 10 );
+ hbox = ui::HBox( FALSE, 10 );
gtk_box_pack_start( GTK_BOX( vbox ), hbox, FALSE, FALSE, 0 );
gtk_widget_show( hbox );
- textMainTex = gtk_entry_new_with_max_length( 512 );
+ textMainTex = ui::Entry( 512 );
gtk_entry_set_text( GTK_ENTRY( textMainTex ), rs->mainTexture );
gtk_box_pack_start( GTK_BOX( hbox ), textMainTex, FALSE, FALSE, 0 );
gtk_widget_show( textMainTex );
- w = gtk_label_new( "Main Texture" );
+ w = ui::Label( "Main Texture" );
gtk_box_pack_start( GTK_BOX( hbox ), w, FALSE, FALSE, 1 );
gtk_widget_show( w );
// -------------------------- //
- hbox = gtk_hbox_new( FALSE, 10 );
+ hbox = ui::HBox( FALSE, 10 );
gtk_box_pack_start( GTK_BOX( vbox ), hbox, FALSE, FALSE, 0 );
gtk_widget_show( hbox );
- textRiserTex = gtk_entry_new_with_max_length( 512 );
+ textRiserTex = ui::Entry( 512 );
gtk_box_pack_start( GTK_BOX( hbox ), textRiserTex, FALSE, FALSE, 0 );
gtk_widget_show( textRiserTex );
- w = gtk_label_new( "Riser Texture" );
+ w = ui::Label( "Riser Texture" );
gtk_box_pack_start( GTK_BOX( hbox ), w, FALSE, FALSE, 1 );
gtk_widget_show( w );
gtk_box_pack_start( GTK_BOX( vbox ), w, FALSE, FALSE, 0 );
gtk_widget_show( w );
- hbox = gtk_hbox_new( FALSE, 10 );
+ hbox = ui::HBox( FALSE, 10 );
gtk_box_pack_start( GTK_BOX( vbox ), hbox, FALSE, FALSE, 0 );
gtk_widget_show( hbox );
- w = 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_SET_FLAGS( w, GTK_CAN_DEFAULT );
+ g_signal_connect( GTK_OBJECT( w ), "clicked", G_CALLBACK( dialog_button_callback ), GINT_TO_POINTER( eIDOK ) );
+ gtk_widget_set_can_default( w, true );
gtk_widget_grab_default( w );
gtk_widget_show( w );
- w = 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 ) );
+ g_signal_connect( GTK_OBJECT( w ), "clicked", G_CALLBACK( dialog_button_callback ), GINT_TO_POINTER( eIDCANCEL ) );
gtk_widget_show( w );
ret = eIDCANCEL;
EMessageBoxReturn ret;
int loop = 1;
- window = gtk_window_new( GTK_WINDOW_TOPLEVEL );
+ window = ui::Window( ui::window_type::TOP );
- gtk_signal_connect( GTK_OBJECT( window ), "delete_event", GTK_SIGNAL_FUNC( dialog_delete_callback ), NULL );
- gtk_signal_connect( GTK_OBJECT( window ), "destroy", GTK_SIGNAL_FUNC( gtk_widget_destroy ), NULL );
+ g_signal_connect( GTK_OBJECT( window ), "delete_event", G_CALLBACK( dialog_delete_callback ), NULL );
+ g_signal_connect( GTK_OBJECT( window ), "destroy", G_CALLBACK( gtk_widget_destroy ), NULL );
gtk_window_set_title( GTK_WINDOW( window ), "Door Builder" );
- gtk_container_border_width( GTK_CONTAINER( window ), 10 );
+ gtk_container_set_border_width( GTK_CONTAINER( window ), 10 );
g_object_set_data( G_OBJECT( window ), "loop", &loop );
g_object_set_data( G_OBJECT( window ), "ret", &ret );
gtk_widget_realize( window );
char buffer[256];
- GList *listMainTextures = NULL;
- GList *listTrimTextures = NULL;
- LoadGList( GetFilename( buffer, "plugins/bt/door-tex.txt" ), &listMainTextures );
- LoadGList( GetFilename( buffer, "plugins/bt/door-tex-trim.txt" ), &listTrimTextures );
+ GtkListStore *listMainTextures = gtk_list_store_new( 1, G_TYPE_STRING );
+ GtkListStore *listTrimTextures = gtk_list_store_new( 1, G_TYPE_STRING );
+ LoadGList( GetFilename( buffer, "plugins/bt/door-tex.txt" ), listMainTextures );
+ LoadGList( GetFilename( buffer, "plugins/bt/door-tex-trim.txt" ), listTrimTextures );
- vbox = gtk_vbox_new( FALSE, 10 );
+ vbox = ui::VBox( FALSE, 10 );
gtk_container_add( GTK_CONTAINER( window ), vbox );
gtk_widget_show( vbox );
// -------------------------- //
- hbox = gtk_hbox_new( FALSE, 10 );
+ hbox = ui::HBox( FALSE, 10 );
gtk_box_pack_start( GTK_BOX( vbox ), hbox, FALSE, FALSE, 0 );
gtk_widget_show( hbox );
- textFrontBackTex = gtk_entry_new_with_max_length( 512 );
+ textFrontBackTex = ui::Entry( 512 );
gtk_entry_set_text( GTK_ENTRY( textFrontBackTex ), rs->mainTexture );
gtk_box_pack_start( GTK_BOX( hbox ), textFrontBackTex, FALSE, FALSE, 0 );
gtk_widget_show( textFrontBackTex );
- w = gtk_label_new( "Door Front/Back Texture" );
+ w = ui::Label( "Door Front/Back Texture" );
gtk_box_pack_start( GTK_BOX( hbox ), w, FALSE, FALSE, 0 );
gtk_widget_show( w );
// ------------------------ //
- hbox = gtk_hbox_new( FALSE, 10 );
+ hbox = ui::HBox( FALSE, 10 );
gtk_box_pack_start( GTK_BOX( vbox ), hbox, FALSE, FALSE, 0 );
gtk_widget_show( hbox );
- textTrimTex = gtk_entry_new_with_max_length( 512 );
+ textTrimTex = ui::Entry( 512 );
gtk_box_pack_start( GTK_BOX( hbox ), textTrimTex, FALSE, FALSE, 0 );
gtk_widget_show( textTrimTex );
- w = gtk_label_new( "Door Trim Texture" );
+ w = ui::Label( "Door Trim Texture" );
gtk_box_pack_start( GTK_BOX( hbox ), w, FALSE, FALSE, 0 );
gtk_widget_show( w );
// ----------------------- //
- hbox = gtk_hbox_new( FALSE, 10 );
+ hbox = ui::HBox( FALSE, 10 );
gtk_box_pack_start( GTK_BOX( vbox ), hbox, FALSE, FALSE, 0 );
gtk_widget_show( hbox );
// 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 );
// ---------------------- //
- hbox = gtk_hbox_new( FALSE, 10 );
+ hbox = ui::HBox( FALSE, 10 );
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 );
// --------------------- //
- hbox = gtk_hbox_new( FALSE, 10 );
+ hbox = ui::HBox( FALSE, 10 );
gtk_box_pack_start( GTK_BOX( vbox ), hbox, FALSE, FALSE, 0 );
gtk_widget_show( hbox );
// djbob: lists added
- comboMain = gtk_combo_new();
+ comboMain = gtk_combo_box_new_with_model_and_entry(GTK_TREE_MODEL(listMainTextures));
+ gtk_combo_box_set_entry_text_column(GTK_COMBO_BOX(comboMain), 0);
gtk_box_pack_start( GTK_BOX( hbox ), comboMain, FALSE, FALSE, 0 );
- gtk_combo_set_popdown_strings( GTK_COMBO( comboMain ), listMainTextures );
- gtk_combo_set_use_arrows( GTK_COMBO( comboMain ), 1 );
gtk_widget_show( comboMain );
tw1.one = textFrontBackTex;
- tw1.two = comboMain;
+ tw1.two = GTK_COMBO_BOX(comboMain);
- buttonSetMain = gtk_button_new_with_label( "Set As Main Texture" );
- gtk_signal_connect( GTK_OBJECT( buttonSetMain ), "clicked", GTK_SIGNAL_FUNC( dialog_button_callback_settex ), &tw1 );
+ buttonSetMain = ui::Button( "Set As Main Texture" );
+ g_signal_connect( GTK_OBJECT( buttonSetMain ), "clicked", G_CALLBACK( dialog_button_callback_settex ), &tw1 );
gtk_box_pack_start( GTK_BOX( hbox ), buttonSetMain, FALSE, FALSE, 0 );
gtk_widget_show( buttonSetMain );
// ------------------- //
- hbox = gtk_hbox_new( FALSE, 10 );
+ hbox = ui::HBox( FALSE, 10 );
gtk_box_pack_start( GTK_BOX( vbox ), hbox, FALSE, FALSE, 0 );
gtk_widget_show( hbox );
- comboTrim = gtk_combo_new();
+ comboTrim = gtk_combo_box_new_with_model_and_entry(GTK_TREE_MODEL(listTrimTextures));
+ gtk_combo_box_set_entry_text_column(GTK_COMBO_BOX(comboMain), 0);
gtk_box_pack_start( GTK_BOX( hbox ), comboTrim, FALSE, FALSE, 0 );
- gtk_combo_set_popdown_strings( GTK_COMBO( comboTrim ), listTrimTextures );
- gtk_combo_set_use_arrows( GTK_COMBO( comboMain ), 1 );
gtk_widget_show( comboTrim );
tw2.one = textTrimTex;
- tw2.two = comboTrim;
+ tw2.two = GTK_COMBO_BOX(comboTrim);
- buttonSetTrim = gtk_button_new_with_label( "Set As Trim Texture" );
- gtk_signal_connect( GTK_OBJECT( buttonSetTrim ), "clicked", GTK_SIGNAL_FUNC( dialog_button_callback_settex ), &tw2 );
+ buttonSetTrim = ui::Button( "Set As Trim Texture" );
+ g_signal_connect( GTK_OBJECT( buttonSetTrim ), "clicked", G_CALLBACK( dialog_button_callback_settex ), &tw2 );
gtk_box_pack_start( GTK_BOX( hbox ), buttonSetTrim, FALSE, FALSE, 0 );
gtk_widget_show( buttonSetTrim );
// ------------------ //
- hbox = gtk_hbox_new( FALSE, 10 );
+ hbox = ui::HBox( FALSE, 10 );
gtk_box_pack_start( GTK_BOX( vbox ), hbox, FALSE, FALSE, 0 );
gtk_widget_show( hbox );
- w = gtk_label_new( "Orientation" );
+ w = ui::Label( "Orientation" );
gtk_box_pack_start( GTK_BOX( hbox ), w, FALSE, FALSE, 0 );
gtk_widget_show( w );
gtk_box_pack_start( GTK_BOX( hbox ), radioNS, FALSE, FALSE, 0 );
gtk_widget_show( radioNS );
- radioOrientation = gtk_radio_button_group( GTK_RADIO_BUTTON( radioNS ) );
+ radioOrientation = gtk_radio_button_get_group( GTK_RADIO_BUTTON( radioNS ) );
radioEW = gtk_radio_button_new_with_label( radioOrientation, "East - West" );
gtk_box_pack_start( GTK_BOX( hbox ), radioEW, FALSE, FALSE, 0 );
// ----------------- //
- hbox = gtk_hbox_new( FALSE, 10 );
+ hbox = ui::HBox( FALSE, 10 );
gtk_box_pack_start( GTK_BOX( vbox ), hbox, FALSE, FALSE, 0 );
gtk_widget_show( hbox );
- w = 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_SET_FLAGS( w, GTK_CAN_DEFAULT );
+ g_signal_connect( GTK_OBJECT( w ), "clicked", G_CALLBACK( dialog_button_callback ), GINT_TO_POINTER( eIDOK ) );
+ gtk_widget_set_can_default( w, true );
gtk_widget_grab_default( w );
gtk_widget_show( w );
- w = 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 ) );
+ g_signal_connect( GTK_OBJECT( w ), "clicked", G_CALLBACK( dialog_button_callback ), GINT_TO_POINTER( eIDCANCEL ) );
gtk_widget_show( w );
ret = eIDCANCEL;
EMessageBoxReturn ret;
int loop = 1;
- window = gtk_window_new( GTK_WINDOW_TOPLEVEL );
+ window = ui::Window( ui::window_type::TOP );
- gtk_signal_connect( GTK_OBJECT( window ), "delete_event", GTK_SIGNAL_FUNC( dialog_delete_callback ), NULL );
- gtk_signal_connect( GTK_OBJECT( window ), "destroy", GTK_SIGNAL_FUNC( gtk_widget_destroy ), NULL );
+ g_signal_connect( GTK_OBJECT( window ), "delete_event", G_CALLBACK( dialog_delete_callback ), NULL );
+ g_signal_connect( GTK_OBJECT( window ), "destroy", G_CALLBACK( gtk_widget_destroy ), NULL );
gtk_window_set_title( GTK_WINDOW( window ), "Texture Reset" );
- gtk_container_border_width( GTK_CONTAINER( window ), 10 );
+ gtk_container_set_border_width( GTK_CONTAINER( window ), 10 );
g_object_set_data( G_OBJECT( window ), "loop", &loop );
g_object_set_data( G_OBJECT( window ), "ret", &ret );
- vbox = gtk_vbox_new( FALSE, 10 );
+ vbox = ui::VBox( FALSE, 10 );
gtk_container_add( GTK_CONTAINER( window ), vbox );
gtk_widget_show( vbox );
// ---- vbox ----
- hbox = gtk_hbox_new( FALSE, 10 );
+ hbox = ui::HBox( FALSE, 10 );
gtk_box_pack_start( GTK_BOX( vbox ), hbox, FALSE, FALSE, 2 );
gtk_widget_show( hbox );
// ---- hbox ----
- text1 = gtk_entry_new_with_max_length( 256 );
+ text1 = ui::Entry( 256 );
gtk_entry_set_text( (GtkEntry*)text1, "25" );
gtk_box_pack_start( GTK_BOX( hbox ), text1, FALSE, FALSE, 2 );
gtk_widget_show( text1 );
- w = gtk_label_new( "Number Of Points" );
+ w = ui::Label( "Number Of Points" );
gtk_box_pack_start( GTK_BOX( hbox ), w, FALSE, FALSE, 2 );
gtk_label_set_justify( GTK_LABEL( w ), GTK_JUSTIFY_LEFT );
gtk_widget_show( w );
// ---- /hbox ----
- hbox = gtk_hbox_new( FALSE, 10 );
+ hbox = ui::HBox( FALSE, 10 );
gtk_box_pack_start( GTK_BOX( vbox ), hbox, FALSE, FALSE, 2 );
gtk_widget_show( hbox );
// ---- hbox ----
- text2 = gtk_entry_new_with_max_length( 256 );
+ text2 = ui::Entry( 256 );
gtk_entry_set_text( (GtkEntry*)text2, "3" );
gtk_box_pack_start( GTK_BOX( hbox ), text2, FALSE, FALSE, 2 );
gtk_widget_show( text2 );
- w = gtk_label_new( "Multipler" );
+ w = ui::Label( "Multipler" );
gtk_box_pack_start( GTK_BOX( hbox ), w, FALSE, FALSE, 2 );
gtk_label_set_justify( GTK_LABEL( w ), GTK_JUSTIFY_LEFT );
gtk_widget_show( w );
// ---- /hbox ----
- w = gtk_label_new( "Path Distance = dist(start -> apex) * multiplier" );
+ w = ui::Label( "Path Distance = dist(start -> apex) * multiplier" );
gtk_box_pack_start( GTK_BOX( vbox ), w, FALSE, FALSE, 0 );
gtk_label_set_justify( GTK_LABEL( w ), GTK_JUSTIFY_LEFT );
gtk_widget_show( w );
- hbox = gtk_hbox_new( FALSE, 10 );
+ hbox = ui::HBox( FALSE, 10 );
gtk_box_pack_start( GTK_BOX( vbox ), hbox, FALSE, FALSE, 2 );
gtk_widget_show( hbox );
// ---- hbox ----
- text3 = gtk_entry_new_with_max_length( 256 );
+ text3 = ui::Entry( 256 );
gtk_entry_set_text( (GtkEntry*)text3, "-800" );
gtk_box_pack_start( GTK_BOX( hbox ), text3, FALSE, FALSE, 2 );
gtk_widget_show( text3 );
- w = gtk_label_new( "Gravity" );
+ w = ui::Label( "Gravity" );
gtk_box_pack_start( GTK_BOX( hbox ), w, FALSE, FALSE, 2 );
gtk_label_set_justify( GTK_LABEL( w ), GTK_JUSTIFY_LEFT );
gtk_widget_show( w );
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 );
// ----------------- //
- hbox = gtk_hbox_new( FALSE, 10 );
+ hbox = ui::HBox( FALSE, 10 );
gtk_box_pack_start( GTK_BOX( vbox ), hbox, FALSE, FALSE, 0 );
gtk_widget_show( hbox );
- w = gtk_button_new_with_label( "Enable" );
+ w = ui::Button( "Enable" );
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 ) );
+ g_signal_connect( GTK_OBJECT( w ), "clicked", G_CALLBACK( dialog_button_callback ), GINT_TO_POINTER( eIDYES ) );
gtk_widget_show( w );
- GTK_WIDGET_SET_FLAGS( w, GTK_CAN_DEFAULT );
+ gtk_widget_set_can_default( w, true );
gtk_widget_grab_default( w );
- w = gtk_button_new_with_label( "Disable" );
+ w = ui::Button( "Disable" );
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 ) );
+ g_signal_connect( GTK_OBJECT( w ), "clicked", G_CALLBACK( dialog_button_callback ), GINT_TO_POINTER( eIDNO ) );
gtk_widget_show( w );
- w = 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 ) );
+ g_signal_connect( GTK_OBJECT( w ), "clicked", G_CALLBACK( dialog_button_callback ), GINT_TO_POINTER( eIDCANCEL ) );
gtk_widget_show( w );
ret = eIDCANCEL;
EMessageBoxReturn ret;
int loop = 1;
- window = gtk_window_new( GTK_WINDOW_TOPLEVEL );
+ window = ui::Window( ui::window_type::TOP );
- gtk_signal_connect( GTK_OBJECT( window ), "delete_event", GTK_SIGNAL_FUNC( dialog_delete_callback ), NULL );
- gtk_signal_connect( GTK_OBJECT( window ), "destroy", GTK_SIGNAL_FUNC( gtk_widget_destroy ), NULL );
+ g_signal_connect( GTK_OBJECT( window ), "delete_event", G_CALLBACK( dialog_delete_callback ), NULL );
+ g_signal_connect( GTK_OBJECT( window ), "destroy", G_CALLBACK( gtk_widget_destroy ), NULL );
gtk_window_set_title( GTK_WINDOW( window ), "CTF Colour Changer" );
- gtk_container_border_width( GTK_CONTAINER( window ), 10 );
+ gtk_container_set_border_width( GTK_CONTAINER( window ), 10 );
g_object_set_data( G_OBJECT( window ), "loop", &loop );
g_object_set_data( G_OBJECT( window ), "ret", &ret );
- vbox = gtk_vbox_new( FALSE, 10 );
+ vbox = ui::VBox( FALSE, 10 );
gtk_container_add( GTK_CONTAINER( window ), vbox );
gtk_widget_show( vbox );
// ---- vbox ----
- hbox = gtk_hbox_new( FALSE, 10 );
+ hbox = ui::HBox( FALSE, 10 );
gtk_box_pack_start( GTK_BOX( vbox ), hbox, TRUE, TRUE, 0 );
gtk_widget_show( hbox );
// ---- hbox ---- ok/cancel buttons
- w = gtk_button_new_with_label( "Red->Blue" );
+ w = ui::Button( "Red->Blue" );
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 ) );
+ g_signal_connect( GTK_OBJECT( w ), "clicked", G_CALLBACK( dialog_button_callback ), GINT_TO_POINTER( eIDOK ) );
- GTK_WIDGET_SET_FLAGS( w, GTK_CAN_DEFAULT );
+ gtk_widget_set_can_default( w, true );
gtk_widget_grab_default( w );
gtk_widget_show( w );
- w = gtk_button_new_with_label( "Blue->Red" );
+ w = ui::Button( "Blue->Red" );
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 ) );
+ g_signal_connect( GTK_OBJECT( w ), "clicked", G_CALLBACK( dialog_button_callback ), GINT_TO_POINTER( eIDYES ) );
gtk_widget_show( w );
- w = 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 ) );
+ g_signal_connect( GTK_OBJECT( w ), "clicked", G_CALLBACK( dialog_button_callback ), GINT_TO_POINTER( eIDCANCEL ) );
gtk_widget_show( w );
ret = eIDCANCEL;
EMessageBoxReturn ret;
int loop = 1;
- window = gtk_window_new( GTK_WINDOW_TOPLEVEL );
+ window = ui::Window( ui::window_type::TOP );
- gtk_signal_connect( GTK_OBJECT( window ), "delete_event", GTK_SIGNAL_FUNC( dialog_delete_callback ), NULL );
- gtk_signal_connect( GTK_OBJECT( window ), "destroy", GTK_SIGNAL_FUNC( gtk_widget_destroy ), NULL );
+ g_signal_connect( GTK_OBJECT( window ), "delete_event", G_CALLBACK( dialog_delete_callback ), NULL );
+ g_signal_connect( GTK_OBJECT( window ), "destroy", G_CALLBACK( gtk_widget_destroy ), NULL );
gtk_window_set_title( GTK_WINDOW( window ), "Texture Reset" );
- gtk_container_border_width( GTK_CONTAINER( window ), 10 );
+ gtk_container_set_border_width( GTK_CONTAINER( window ), 10 );
g_object_set_data( G_OBJECT( window ), "loop", &loop );
g_object_set_data( G_OBJECT( window ), "ret", &ret );
gtk_widget_realize( window );
- vbox = gtk_vbox_new( FALSE, 10 );
+ vbox = ui::VBox( FALSE, 10 );
gtk_container_add( GTK_CONTAINER( window ), vbox );
gtk_widget_show( vbox );
// ---- vbox ----
- hbox = gtk_hbox_new( FALSE, 10 );
+ hbox = ui::HBox( FALSE, 10 );
gtk_box_pack_start( GTK_BOX( vbox ), hbox, FALSE, FALSE, 2 );
gtk_widget_show( hbox );
texSelected = "Currently Selected Texture: ";
texSelected += GetCurrentTexture();
- w = gtk_label_new( texSelected );
+ w = ui::Label( texSelected );
gtk_box_pack_start( GTK_BOX( hbox ), w, FALSE, FALSE, 2 );
gtk_label_set_justify( GTK_LABEL( w ), GTK_JUSTIFY_LEFT );
gtk_widget_show( w );
// ---- /hbox ----
- frame = gtk_frame_new( "Reset Texture Names" );
+ frame = ui::Frame( "Reset Texture Names" );
gtk_widget_show( frame );
gtk_box_pack_start( GTK_BOX( vbox ), frame, FALSE, TRUE, 0 );
- table = gtk_table_new( 2, 3, TRUE );
+ table = ui::Table( 2, 3, TRUE );
gtk_widget_show( table );
gtk_container_add( GTK_CONTAINER( frame ), table );
gtk_table_set_row_spacings( GTK_TABLE( table ), 5 );
// ---- frame ----
- dlgTexReset.cbTexChange = gtk_check_button_new_with_label( "Enabled" );
- gtk_signal_connect( GTK_OBJECT( dlgTexReset.cbTexChange ), "toggled", GTK_SIGNAL_FUNC( dialog_button_callback_texreset_update ), NULL );
+ dlgTexReset.cbTexChange = ui::CheckButton( "Enabled" );
+ g_signal_connect( GTK_OBJECT( dlgTexReset.cbTexChange ), "toggled", G_CALLBACK( dialog_button_callback_texreset_update ), NULL );
gtk_widget_show( dlgTexReset.cbTexChange );
gtk_table_attach( GTK_TABLE( table ), dlgTexReset.cbTexChange, 0, 1, 0, 1,
(GtkAttachOptions) ( GTK_FILL ),
(GtkAttachOptions) ( 0 ), 0, 0 );
- w = gtk_label_new( "Old Name: " );
+ w = ui::Label( "Old Name: " );
gtk_table_attach( GTK_TABLE( table ), w, 1, 2, 0, 1,
(GtkAttachOptions) ( GTK_FILL ),
(GtkAttachOptions) ( 0 ), 0, 0 );
gtk_widget_show( w );
- dlgTexReset.editTexOld = gtk_entry_new_with_max_length( 256 );
+ dlgTexReset.editTexOld = ui::Entry( 256 );
gtk_entry_set_text( GTK_ENTRY( dlgTexReset.editTexOld ), rs->textureName );
gtk_table_attach( GTK_TABLE( table ), dlgTexReset.editTexOld, 2, 3, 0, 1,
(GtkAttachOptions) ( GTK_FILL ),
(GtkAttachOptions) ( 0 ), 0, 0 );
gtk_widget_show( dlgTexReset.editTexOld );
- w = gtk_label_new( "New Name: " );
+ w = ui::Label( "New Name: " );
gtk_table_attach( GTK_TABLE( table ), w, 1, 2, 1, 2,
(GtkAttachOptions) ( GTK_FILL ),
(GtkAttachOptions) ( 0 ), 0, 0 );
gtk_widget_show( w );
- dlgTexReset.editTexNew = gtk_entry_new_with_max_length( 256 );
+ dlgTexReset.editTexNew = ui::Entry( 256 );
gtk_entry_set_text( GTK_ENTRY( dlgTexReset.editTexNew ), rs->textureName );
gtk_table_attach( GTK_TABLE( table ), dlgTexReset.editTexNew, 2, 3, 1, 2,
(GtkAttachOptions) ( GTK_FILL ),
// ---- /frame ----
- frame = gtk_frame_new( "Reset Scales" );
+ frame = ui::Frame( "Reset Scales" );
gtk_widget_show( frame );
gtk_box_pack_start( GTK_BOX( vbox ), frame, FALSE, TRUE, 0 );
- table = gtk_table_new( 2, 3, TRUE );
+ table = ui::Table( 2, 3, TRUE );
gtk_widget_show( table );
gtk_container_add( GTK_CONTAINER( frame ), table );
gtk_table_set_row_spacings( GTK_TABLE( table ), 5 );
// ---- frame ----
- dlgTexReset.cbScaleHor = gtk_check_button_new_with_label( "Enabled" );
- gtk_signal_connect( GTK_OBJECT( dlgTexReset.cbScaleHor ), "toggled", GTK_SIGNAL_FUNC( dialog_button_callback_texreset_update ), NULL );
+ dlgTexReset.cbScaleHor = ui::CheckButton( "Enabled" );
+ g_signal_connect( GTK_OBJECT( dlgTexReset.cbScaleHor ), "toggled", G_CALLBACK( dialog_button_callback_texreset_update ), NULL );
gtk_widget_show( dlgTexReset.cbScaleHor );
gtk_table_attach( GTK_TABLE( table ), dlgTexReset.cbScaleHor, 0, 1, 0, 1,
(GtkAttachOptions) ( GTK_FILL ),
(GtkAttachOptions) ( 0 ), 0, 0 );
- w = gtk_label_new( "New Horizontal Scale: " );
+ w = ui::Label( "New Horizontal Scale: " );
gtk_table_attach( GTK_TABLE( table ), w, 1, 2, 0, 1,
(GtkAttachOptions) ( GTK_FILL ),
(GtkAttachOptions) ( 0 ), 0, 0 );
gtk_widget_show( w );
- dlgTexReset.editScaleHor = gtk_entry_new_with_max_length( 256 );
+ dlgTexReset.editScaleHor = ui::Entry( 256 );
gtk_entry_set_text( GTK_ENTRY( dlgTexReset.editScaleHor ), "0.5" );
gtk_table_attach( GTK_TABLE( table ), dlgTexReset.editScaleHor, 2, 3, 0, 1,
(GtkAttachOptions) ( GTK_FILL ),
gtk_widget_show( dlgTexReset.editScaleHor );
- dlgTexReset.cbScaleVert = gtk_check_button_new_with_label( "Enabled" );
- gtk_signal_connect( GTK_OBJECT( dlgTexReset.cbScaleVert ), "toggled", GTK_SIGNAL_FUNC( dialog_button_callback_texreset_update ), NULL );
+ dlgTexReset.cbScaleVert = ui::CheckButton( "Enabled" );
+ g_signal_connect( GTK_OBJECT( dlgTexReset.cbScaleVert ), "toggled", G_CALLBACK( dialog_button_callback_texreset_update ), NULL );
gtk_widget_show( dlgTexReset.cbScaleVert );
gtk_table_attach( GTK_TABLE( table ), dlgTexReset.cbScaleVert, 0, 1, 1, 2,
(GtkAttachOptions) ( GTK_FILL ),
(GtkAttachOptions) ( 0 ), 0, 0 );
- w = gtk_label_new( "New Vertical Scale: " );
+ w = ui::Label( "New Vertical Scale: " );
gtk_table_attach( GTK_TABLE( table ), w, 1, 2, 1, 2,
(GtkAttachOptions) ( GTK_FILL ),
(GtkAttachOptions) ( 0 ), 0, 0 );
gtk_widget_show( w );
- dlgTexReset.editScaleVert = gtk_entry_new_with_max_length( 256 );
+ dlgTexReset.editScaleVert = ui::Entry( 256 );
gtk_entry_set_text( GTK_ENTRY( dlgTexReset.editScaleVert ), "0.5" );
gtk_table_attach( GTK_TABLE( table ), dlgTexReset.editScaleVert, 2, 3, 1, 2,
(GtkAttachOptions) ( GTK_FILL ),
// ---- /frame ----
- frame = gtk_frame_new( "Reset Shift" );
+ frame = ui::Frame( "Reset Shift" );
gtk_widget_show( frame );
gtk_box_pack_start( GTK_BOX( vbox ), frame, FALSE, TRUE, 0 );
- table = gtk_table_new( 2, 3, TRUE );
+ table = ui::Table( 2, 3, TRUE );
gtk_widget_show( table );
gtk_container_add( GTK_CONTAINER( frame ), table );
gtk_table_set_row_spacings( GTK_TABLE( table ), 5 );
// ---- frame ----
- dlgTexReset.cbShiftHor = gtk_check_button_new_with_label( "Enabled" );
- gtk_signal_connect( GTK_OBJECT( dlgTexReset.cbShiftHor ), "toggled", GTK_SIGNAL_FUNC( dialog_button_callback_texreset_update ), NULL );
+ dlgTexReset.cbShiftHor = ui::CheckButton( "Enabled" );
+ g_signal_connect( GTK_OBJECT( dlgTexReset.cbShiftHor ), "toggled", G_CALLBACK( dialog_button_callback_texreset_update ), NULL );
gtk_widget_show( dlgTexReset.cbShiftHor );
gtk_table_attach( GTK_TABLE( table ), dlgTexReset.cbShiftHor, 0, 1, 0, 1,
(GtkAttachOptions) ( GTK_FILL ),
(GtkAttachOptions) ( 0 ), 0, 0 );
- w = gtk_label_new( "New Horizontal Shift: " );
+ w = ui::Label( "New Horizontal Shift: " );
gtk_table_attach( GTK_TABLE( table ), w, 1, 2, 0, 1,
(GtkAttachOptions) ( GTK_FILL ),
(GtkAttachOptions) ( 0 ), 0, 0 );
gtk_widget_show( w );
- dlgTexReset.editShiftHor = gtk_entry_new_with_max_length( 256 );
+ dlgTexReset.editShiftHor = ui::Entry( 256 );
gtk_entry_set_text( GTK_ENTRY( dlgTexReset.editShiftHor ), "0" );
gtk_table_attach( GTK_TABLE( table ), dlgTexReset.editShiftHor, 2, 3, 0, 1,
(GtkAttachOptions) ( GTK_FILL ),
gtk_widget_show( dlgTexReset.editShiftHor );
- dlgTexReset.cbShiftVert = gtk_check_button_new_with_label( "Enabled" );
- gtk_signal_connect( GTK_OBJECT( dlgTexReset.cbShiftVert ), "toggled", GTK_SIGNAL_FUNC( dialog_button_callback_texreset_update ), NULL );
+ dlgTexReset.cbShiftVert = ui::CheckButton( "Enabled" );
+ g_signal_connect( GTK_OBJECT( dlgTexReset.cbShiftVert ), "toggled", G_CALLBACK( dialog_button_callback_texreset_update ), NULL );
gtk_widget_show( dlgTexReset.cbShiftVert );
gtk_table_attach( GTK_TABLE( table ), dlgTexReset.cbShiftVert, 0, 1, 1, 2,
(GtkAttachOptions) ( GTK_FILL ),
(GtkAttachOptions) ( 0 ), 0, 0 );
- w = gtk_label_new( "New Vertical Shift: " );
+ w = ui::Label( "New Vertical Shift: " );
gtk_table_attach( GTK_TABLE( table ), w, 1, 2, 1, 2,
(GtkAttachOptions) ( GTK_FILL ),
(GtkAttachOptions) ( 0 ), 0, 0 );
gtk_widget_show( w );
- dlgTexReset.editShiftVert = gtk_entry_new_with_max_length( 256 );
+ dlgTexReset.editShiftVert = ui::Entry( 256 );
gtk_entry_set_text( GTK_ENTRY( dlgTexReset.editShiftVert ), "0" );
gtk_table_attach( GTK_TABLE( table ), dlgTexReset.editShiftVert, 2, 3, 1, 2,
(GtkAttachOptions) ( GTK_FILL ),
// ---- /frame ----
- frame = gtk_frame_new( "Reset Rotation" );
+ frame = ui::Frame( "Reset Rotation" );
gtk_widget_show( frame );
gtk_box_pack_start( GTK_BOX( vbox ), frame, FALSE, TRUE, 0 );
- table = gtk_table_new( 1, 3, TRUE );
+ table = ui::Table( 1, 3, TRUE );
gtk_widget_show( table );
gtk_container_add( GTK_CONTAINER( frame ), table );
gtk_table_set_row_spacings( GTK_TABLE( table ), 5 );
// ---- 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 ),
(GtkAttachOptions) ( 0 ), 0, 0 );
- w = gtk_label_new( "New Rotation Value: " );
+ w = ui::Label( "New Rotation Value: " );
gtk_table_attach( GTK_TABLE( table ), w, 1, 2, 0, 1,
(GtkAttachOptions) ( GTK_FILL ),
(GtkAttachOptions) ( 0 ), 0, 0 );
gtk_widget_show( w );
- dlgTexReset.editRotation = gtk_entry_new_with_max_length( 256 );
+ dlgTexReset.editRotation = ui::Entry( 256 );
gtk_entry_set_text( GTK_ENTRY( dlgTexReset.editRotation ), "0" );
gtk_table_attach( GTK_TABLE( table ), dlgTexReset.editRotation, 2, 3, 0, 1,
(GtkAttachOptions) ( GTK_FILL ),
// ---- /frame ----
- hbox = gtk_hbox_new( FALSE, 10 );
+ hbox = ui::HBox( FALSE, 10 );
gtk_box_pack_start( GTK_BOX( vbox ), hbox, FALSE, FALSE, 2 );
gtk_widget_show( hbox );
// ---- hbox ----
- w = gtk_button_new_with_label( "Use Selected Brushes" );
+ w = ui::Button( "Use Selected Brushes" );
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 ) );
+ g_signal_connect( GTK_OBJECT( w ), "clicked", G_CALLBACK( dialog_button_callback ), GINT_TO_POINTER( eIDOK ) );
- GTK_WIDGET_SET_FLAGS( w, GTK_CAN_DEFAULT );
+ gtk_widget_set_can_default( w, true );
gtk_widget_grab_default( w );
gtk_widget_show( w );
- w = gtk_button_new_with_label( "Use All Brushes" );
+ w = ui::Button( "Use All Brushes" );
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 ) );
+ g_signal_connect( GTK_OBJECT( w ), "clicked", G_CALLBACK( dialog_button_callback ), GINT_TO_POINTER( eIDYES ) );
gtk_widget_show( w );
- w = 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 ) );
+ g_signal_connect( GTK_OBJECT( w ), "clicked", G_CALLBACK( dialog_button_callback ), GINT_TO_POINTER( eIDCANCEL ) );
gtk_widget_show( w );
ret = eIDCANCEL;
EMessageBoxReturn ret;
int loop = 1;
- window = gtk_window_new( GTK_WINDOW_TOPLEVEL );
+ window = ui::Window( ui::window_type::TOP );
- gtk_signal_connect( GTK_OBJECT( window ), "delete_event", GTK_SIGNAL_FUNC( dialog_delete_callback ), NULL );
- gtk_signal_connect( GTK_OBJECT( window ), "destroy", GTK_SIGNAL_FUNC( gtk_widget_destroy ), NULL );
+ g_signal_connect( GTK_OBJECT( window ), "delete_event", G_CALLBACK( dialog_delete_callback ), NULL );
+ g_signal_connect( GTK_OBJECT( window ), "destroy", G_CALLBACK( gtk_widget_destroy ), NULL );
gtk_window_set_title( GTK_WINDOW( window ), "Train Thing" );
- gtk_container_border_width( GTK_CONTAINER( window ), 10 );
+ gtk_container_set_border_width( GTK_CONTAINER( window ), 10 );
- gtk_object_set_data( GTK_OBJECT( window ), "loop", &loop );
- gtk_object_set_data( GTK_OBJECT( window ), "ret", &ret );
+ g_object_set_data( G_OBJECT( window ), "loop", &loop );
+ g_object_set_data( G_OBJECT( window ), "ret", &ret );
gtk_widget_realize( window );
- vbox = gtk_vbox_new( FALSE, 10 );
+ vbox = ui::VBox( FALSE, 10 );
gtk_container_add( GTK_CONTAINER( window ), vbox );
gtk_widget_show( vbox );
// ---- vbox ----
- hbox = gtk_hbox_new( FALSE, 10 );
+ hbox = ui::HBox( FALSE, 10 );
gtk_box_pack_start( GTK_BOX( vbox ), hbox, FALSE, FALSE, 2 );
gtk_widget_show( hbox );
// ---- /hbox ----
- frame = gtk_frame_new( "Radii" );
+ frame = ui::Frame( "Radii" );
gtk_widget_show( frame );
gtk_box_pack_start( GTK_BOX( vbox ), frame, FALSE, TRUE, 0 );
- table = gtk_table_new( 2, 3, TRUE );
+ table = ui::Table( 2, 3, TRUE );
gtk_widget_show( table );
gtk_container_add( GTK_CONTAINER( frame ), table );
gtk_table_set_row_spacings( GTK_TABLE( table ), 5 );
// ---- frame ----
- w = gtk_label_new( "X: " );
+ w = ui::Label( "X: " );
gtk_table_attach( GTK_TABLE( table ), w, 0, 1, 0, 1,
(GtkAttachOptions) ( GTK_FILL ),
(GtkAttachOptions) ( 0 ), 0, 0 );
gtk_widget_show( w );
- radiusX = gtk_entry_new_with_max_length( 256 );
+ radiusX = ui::Entry( 256 );
gtk_entry_set_text( GTK_ENTRY( radiusX ), "100" );
gtk_table_attach( GTK_TABLE( table ), radiusX, 1, 2, 0, 1,
(GtkAttachOptions) ( GTK_FILL ),
- w = gtk_label_new( "Y: " );
+ w = ui::Label( "Y: " );
gtk_table_attach( GTK_TABLE( table ), w, 0, 1, 1, 2,
(GtkAttachOptions) ( GTK_FILL ),
(GtkAttachOptions) ( 0 ), 0, 0 );
gtk_widget_show( w );
- radiusY = gtk_entry_new_with_max_length( 256 );
+ radiusY = ui::Entry( 256 );
gtk_entry_set_text( GTK_ENTRY( radiusY ), "100" );
gtk_table_attach( GTK_TABLE( table ), radiusY, 1, 2, 1, 2,
(GtkAttachOptions) ( GTK_FILL ),
- frame = gtk_frame_new( "Angles" );
+ frame = ui::Frame( "Angles" );
gtk_widget_show( frame );
gtk_box_pack_start( GTK_BOX( vbox ), frame, FALSE, TRUE, 0 );
- table = gtk_table_new( 2, 3, TRUE );
+ table = ui::Table( 2, 3, TRUE );
gtk_widget_show( table );
gtk_container_add( GTK_CONTAINER( frame ), table );
gtk_table_set_row_spacings( GTK_TABLE( table ), 5 );
// ---- frame ----
- w = gtk_label_new( "Start: " );
+ w = ui::Label( "Start: " );
gtk_table_attach( GTK_TABLE( table ), w, 0, 1, 0, 1,
(GtkAttachOptions) ( GTK_FILL ),
(GtkAttachOptions) ( 0 ), 0, 0 );
gtk_widget_show( w );
- angleStart = gtk_entry_new_with_max_length( 256 );
+ angleStart = ui::Entry( 256 );
gtk_entry_set_text( GTK_ENTRY( angleStart ), "0" );
gtk_table_attach( GTK_TABLE( table ), angleStart, 1, 2, 0, 1,
(GtkAttachOptions) ( GTK_FILL ),
- w = gtk_label_new( "End: " );
+ w = ui::Label( "End: " );
gtk_table_attach( GTK_TABLE( table ), w, 0, 1, 1, 2,
(GtkAttachOptions) ( GTK_FILL ),
(GtkAttachOptions) ( 0 ), 0, 0 );
gtk_widget_show( w );
- angleEnd = gtk_entry_new_with_max_length( 256 );
+ angleEnd = ui::Entry( 256 );
gtk_entry_set_text( GTK_ENTRY( angleEnd ), "90" );
gtk_table_attach( GTK_TABLE( table ), angleEnd, 1, 2, 1, 2,
(GtkAttachOptions) ( GTK_FILL ),
gtk_widget_show( angleEnd );
- frame = gtk_frame_new( "Height" );
+ frame = ui::Frame( "Height" );
gtk_widget_show( frame );
gtk_box_pack_start( GTK_BOX( vbox ), frame, FALSE, TRUE, 0 );
- table = gtk_table_new( 2, 3, TRUE );
+ table = ui::Table( 2, 3, TRUE );
gtk_widget_show( table );
gtk_container_add( GTK_CONTAINER( frame ), table );
gtk_table_set_row_spacings( GTK_TABLE( table ), 5 );
// ---- frame ----
- w = gtk_label_new( "Start: " );
+ w = ui::Label( "Start: " );
gtk_table_attach( GTK_TABLE( table ), w, 0, 1, 0, 1,
(GtkAttachOptions) ( GTK_FILL ),
(GtkAttachOptions) ( 0 ), 0, 0 );
gtk_widget_show( w );
- heightStart = gtk_entry_new_with_max_length( 256 );
+ heightStart = ui::Entry( 256 );
gtk_entry_set_text( GTK_ENTRY( heightStart ), "0" );
gtk_table_attach( GTK_TABLE( table ), heightStart, 1, 2, 0, 1,
(GtkAttachOptions) ( GTK_FILL ),
- w = gtk_label_new( "End: " );
+ w = ui::Label( "End: " );
gtk_table_attach( GTK_TABLE( table ), w, 0, 1, 1, 2,
(GtkAttachOptions) ( GTK_FILL ),
(GtkAttachOptions) ( 0 ), 0, 0 );
gtk_widget_show( w );
- heightEnd = gtk_entry_new_with_max_length( 256 );
+ heightEnd = ui::Entry( 256 );
gtk_entry_set_text( GTK_ENTRY( heightEnd ), "0" );
gtk_table_attach( GTK_TABLE( table ), heightEnd, 1, 2, 1, 2,
(GtkAttachOptions) ( GTK_FILL ),
- frame = gtk_frame_new( "Points" );
+ frame = ui::Frame( "Points" );
gtk_widget_show( frame );
gtk_box_pack_start( GTK_BOX( vbox ), frame, FALSE, TRUE, 0 );
- table = gtk_table_new( 2, 3, TRUE );
+ table = ui::Table( 2, 3, TRUE );
gtk_widget_show( table );
gtk_container_add( GTK_CONTAINER( frame ), table );
gtk_table_set_row_spacings( GTK_TABLE( table ), 5 );
// ---- frame ----
- w = gtk_label_new( "Number: " );
+ w = ui::Label( "Number: " );
gtk_table_attach( GTK_TABLE( table ), w, 0, 1, 0, 1,
(GtkAttachOptions) ( GTK_FILL ),
(GtkAttachOptions) ( 0 ), 0, 0 );
gtk_widget_show( w );
- numPoints = gtk_entry_new_with_max_length( 256 );
+ numPoints = ui::Entry( 256 );
gtk_entry_set_text( GTK_ENTRY( numPoints ), "0" );
gtk_table_attach( GTK_TABLE( table ), numPoints, 1, 2, 0, 1,
(GtkAttachOptions) ( GTK_FILL ),
gtk_widget_show( numPoints );
- hbox = gtk_hbox_new( FALSE, 10 );
+ hbox = ui::HBox( FALSE, 10 );
gtk_box_pack_start( GTK_BOX( vbox ), hbox, FALSE, FALSE, 2 );
gtk_widget_show( hbox );
// ---- hbox ----
- w = 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 ) );
+ g_signal_connect( GTK_OBJECT( w ), "clicked", G_CALLBACK( dialog_button_callback ), GINT_TO_POINTER( eIDOK ) );
- GTK_WIDGET_SET_FLAGS( w, GTK_CAN_DEFAULT );
+ gtk_widget_set_can_default( w, true );
gtk_widget_grab_default( w );
gtk_widget_show( w );
- w = 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 ) );
+ g_signal_connect( GTK_OBJECT( w ), "clicked", G_CALLBACK( dialog_button_callback ), GINT_TO_POINTER( eIDCANCEL ) );
gtk_widget_show( w );
ret = eIDCANCEL;
char *text = "Please set a value in the boxes below and press 'OK' to make a chain";
- window = gtk_window_new( GTK_WINDOW_TOPLEVEL );
+ window = ui::Window( ui::window_type::TOP );
- gtk_signal_connect( GTK_OBJECT( window ), "delete_event", GTK_SIGNAL_FUNC( dialog_delete_callback ), NULL );
- gtk_signal_connect( GTK_OBJECT( window ), "destroy", GTK_SIGNAL_FUNC( gtk_widget_destroy ), NULL );
+ g_signal_connect( GTK_OBJECT( window ), "delete_event", G_CALLBACK( dialog_delete_callback ), NULL );
+ g_signal_connect( GTK_OBJECT( window ), "destroy", G_CALLBACK( gtk_widget_destroy ), NULL );
gtk_window_set_title( GTK_WINDOW( window ), "Make Chain" );
- gtk_container_border_width( GTK_CONTAINER( window ), 10 );
+ gtk_container_set_border_width( GTK_CONTAINER( window ), 10 );
g_object_set_data( G_OBJECT( window ), "loop", &loop );
g_object_set_data( G_OBJECT( window ), "ret", &ret );
gtk_widget_realize( window );
// new vbox
- vbox = gtk_vbox_new( FALSE, 10 );
+ vbox = ui::VBox( FALSE, 10 );
gtk_container_add( GTK_CONTAINER( window ), vbox );
gtk_widget_show( vbox );
- hbox = gtk_hbox_new( FALSE, 10 );
+ hbox = ui::HBox( FALSE, 10 );
gtk_container_add( GTK_CONTAINER( vbox ), hbox );
gtk_widget_show( hbox );
// dunno if you want this text or not ...
- w = gtk_label_new( text );
+ w = ui::Label( text );
gtk_box_pack_start( GTK_BOX( hbox ), w, FALSE, FALSE, 0 );
gtk_widget_show( w );
// ------------------------- //
// new hbox
- hbox = gtk_hbox_new( FALSE, 10 );
+ hbox = ui::HBox( FALSE, 10 );
gtk_box_pack_start( GTK_BOX( vbox ), hbox, FALSE, FALSE, 0 );
gtk_widget_show( hbox );
- textlinkNum = gtk_entry_new_with_max_length( 256 );
+ textlinkNum = ui::Entry( 256 );
gtk_box_pack_start( GTK_BOX( hbox ), textlinkNum, FALSE, FALSE, 1 );
gtk_widget_show( textlinkNum );
- w = gtk_label_new( "Number of elements in chain" );
+ w = ui::Label( "Number of elements in chain" );
gtk_box_pack_start( GTK_BOX( hbox ), w, FALSE, FALSE, 1 );
gtk_widget_show( w );
// -------------------------- //
- hbox = gtk_hbox_new( FALSE, 10 );
+ hbox = ui::HBox( FALSE, 10 );
gtk_box_pack_start( GTK_BOX( vbox ), hbox, FALSE, FALSE, 0 );
gtk_widget_show( hbox );
- textlinkName = gtk_entry_new_with_max_length( 256 );
+ textlinkName = ui::Entry( 256 );
gtk_box_pack_start( GTK_BOX( hbox ), textlinkName, FALSE, FALSE, 0 );
gtk_widget_show( textlinkName );
- w = gtk_label_new( "Basename for chain's targetnames." );
+ w = ui::Label( "Basename for chain's targetnames." );
gtk_box_pack_start( GTK_BOX( hbox ), w, FALSE, FALSE, 1 );
gtk_widget_show( w );
- w = 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_SET_FLAGS( w, GTK_CAN_DEFAULT );
+ g_signal_connect( GTK_OBJECT( w ), "clicked", G_CALLBACK( dialog_button_callback ), GINT_TO_POINTER( eIDOK ) );
+ gtk_widget_set_can_default( w, true );
gtk_widget_grab_default( w );
gtk_widget_show( w );
- w = 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 ) );
+ g_signal_connect( GTK_OBJECT( w ), "clicked", G_CALLBACK( dialog_button_callback ), GINT_TO_POINTER( eIDCANCEL ) );
gtk_widget_show( w );
ret = eIDCANCEL;
gtk_widget_destroy( window );
return ret;
-}
\ No newline at end of file
+}
#if !defined( INCLUDED_DIALOGS_GTK_H )
#define INCLUDED_DIALOGS_GTK_H
+#include <gtk/gtk.h>
#include "qerplugin.h"
struct BuildStairsRS {
struct TwinWidget {
GtkWidget* one;
- GtkWidget* two;
+ GtkComboBox* two;
};
EMessageBoxReturn DoMessageBox( const char* lpText, const char* lpCaption, EMessageBoxType type );
#endif
#include <glib.h>
+#include <gtk/gtk.h>
#include "misc.h"
return FALSE;
}
-bool LoadGList( char* filename, GList** loadlist ){
+bool LoadGList( char* filename, GtkListStore* loadlist ){
FILE* eFile = fopen( filename, "r" );
if ( eFile ) {
char buffer[256];
if ( strlen( buffer ) > 0 ) {
char* buffer2 = new char[strlen( buffer ) + 1];
strcpy( buffer2, buffer );
- *loadlist = g_list_append( *loadlist, buffer2 );
+ GtkTreeIter iter;
+ gtk_list_store_append(loadlist, &iter);
+ gtk_list_store_set(loadlist, &iter, 0, buffer2, -1);
}
else{
cnt++;
*/
#include <list>
+#include <gtk/gtk.h>
#include "str.h"
typedef struct _GList GList;
bool LoadExclusionList( char* filename, std::list<Str>* exclusionList );
-bool LoadGList( char* filename, GList** loadlist );
+bool LoadGList( char* filename, GtkListStore* loadlist );
/ | / |
/ | / |
4 ----- 6 |
- | 2|_|___|8
- | / | /
- | / | / ----> WEST, definitely
+ | 2|_|___|8
+ | / | /
+ | / | / ----> WEST, definitely
||/ | /
1|_____|/3
}
void OnExportClicked( GtkButton* button, gpointer user_data ){
- GtkWidget* window = lookup_widget( GTK_WIDGET( button ), "w_plugplug2" );
- ASSERT_NOTNULL( window );
+ ui::Widget window = lookup_widget( GTK_WIDGET( button ), "w_plugplug2" );
+ ASSERT_TRUE( window );
const char* cpath = GlobalRadiant().m_pfnFileDialog( window, false, "Save as Obj", 0, 0, false, false, true );
if ( !cpath ) {
return;
{
radio = lookup_widget( GTK_WIDGET( button ), "r_nocollapse" );
ASSERT_NOTNULL( radio );
- ASSERT_NOTNULL( gtk_toggle_button_get_active( GTK_TOGGLE_BUTTON( radio ) ) );
+ ASSERT_TRUE( gtk_toggle_button_get_active( GTK_TOGGLE_BUTTON( radio ) ) );
mode = COLLAPSE_NONE;
}
}
#define GLADE_HOOKUP_OBJECT( component,widget,name ) \
g_object_set_data_full( G_OBJECT( component ), name, \
- gtk_widget_ref( widget ), (GDestroyNotify) gtk_widget_unref )
+ g_object_ref( widget ), (GDestroyNotify) g_object_unref )
#define GLADE_HOOKUP_OBJECT_NO_REF( component,widget,name ) \
g_object_set_data( G_OBJECT( component ), name, widget )
GtkWidget *t_exportmaterials;
GtkWidget *t_limitmatnames;
GtkWidget *t_objects;
- GtkTooltips *tooltips;
- tooltips = gtk_tooltips_new();
-
- w_plugplug2 = gtk_window_new( GTK_WINDOW_TOPLEVEL );
+ w_plugplug2 = ui::Window( ui::window_type::TOP );
gtk_widget_set_name( w_plugplug2, "w_plugplug2" );
gtk_window_set_title( GTK_WINDOW( w_plugplug2 ), "BrushExport-Plugin 3.0 by namespace" );
gtk_window_set_position( GTK_WINDOW( w_plugplug2 ), GTK_WIN_POS_CENTER );
gtk_window_set_destroy_with_parent( GTK_WINDOW( w_plugplug2 ), TRUE );
- vbox1 = gtk_vbox_new( FALSE, 0 );
+ vbox1 = ui::VBox( FALSE, 0 );
gtk_widget_set_name( vbox1, "vbox1" );
gtk_widget_show( vbox1 );
gtk_container_add( GTK_CONTAINER( w_plugplug2 ), vbox1 );
gtk_container_set_border_width( GTK_CONTAINER( vbox1 ), 5 );
- hbox2 = gtk_hbox_new( TRUE, 5 );
+ hbox2 = ui::HBox( TRUE, 5 );
gtk_widget_set_name( hbox2, "hbox2" );
gtk_widget_show( hbox2 );
gtk_box_pack_start( GTK_BOX( vbox1 ), hbox2, FALSE, FALSE, 0 );
gtk_container_set_border_width( GTK_CONTAINER( hbox2 ), 5 );
- vbox4 = gtk_vbox_new( TRUE, 0 );
+ vbox4 = ui::VBox( TRUE, 0 );
gtk_widget_set_name( vbox4, "vbox4" );
gtk_widget_show( vbox4 );
gtk_box_pack_start( GTK_BOX( hbox2 ), vbox4, TRUE, FALSE, 0 );
r_collapse = gtk_radio_button_new_with_mnemonic( NULL, "Collapse mesh" );
gtk_widget_set_name( r_collapse, "r_collapse" );
- gtk_tooltips_set_tip( GTK_TOOLTIPS( tooltips ), r_collapse, "Collapse all brushes into a single group", "Collapse all brushes into a single group" );
+ gtk_widget_set_tooltip_text(r_collapse, "Collapse all brushes into a single group");
gtk_widget_show( r_collapse );
gtk_box_pack_start( GTK_BOX( vbox4 ), r_collapse, FALSE, FALSE, 0 );
gtk_radio_button_set_group( GTK_RADIO_BUTTON( r_collapse ), r_collapse_group );
r_collapsebymaterial = gtk_radio_button_new_with_mnemonic( NULL, "Collapse by material" );
gtk_widget_set_name( r_collapsebymaterial, "r_collapsebymaterial" );
- gtk_tooltips_set_tip( GTK_TOOLTIPS( tooltips ), r_collapsebymaterial, "Collapse into groups by material", "Collapse into groups by material" );
+ gtk_widget_set_tooltip_text(r_collapsebymaterial, "Collapse into groups by material");
gtk_widget_show( r_collapsebymaterial );
gtk_box_pack_start( GTK_BOX( vbox4 ), r_collapsebymaterial, FALSE, FALSE, 0 );
gtk_radio_button_set_group( GTK_RADIO_BUTTON( r_collapsebymaterial ), r_collapse_group );
r_nocollapse = gtk_radio_button_new_with_mnemonic( NULL, "Don't collapse" );
gtk_widget_set_name( r_nocollapse, "r_nocollapse" );
- gtk_tooltips_set_tip( GTK_TOOLTIPS( tooltips ), r_nocollapse, "Every brush is stored in its own group", "Every brush is stored in its own group" );
+ gtk_widget_set_tooltip_text(r_nocollapse, "Every brush is stored in its own group");
gtk_widget_show( r_nocollapse );
gtk_box_pack_start( GTK_BOX( vbox4 ), r_nocollapse, FALSE, FALSE, 0 );
gtk_radio_button_set_group( GTK_RADIO_BUTTON( r_nocollapse ), r_collapse_group );
r_collapse_group = gtk_radio_button_get_group( GTK_RADIO_BUTTON( r_nocollapse ) );
- vbox3 = gtk_vbox_new( FALSE, 0 );
+ vbox3 = ui::VBox( FALSE, 0 );
gtk_widget_set_name( vbox3, "vbox3" );
gtk_widget_show( vbox3 );
gtk_box_pack_start( GTK_BOX( hbox2 ), vbox3, FALSE, FALSE, 0 );
gtk_box_pack_start( GTK_BOX( vbox3 ), b_close, TRUE, FALSE, 0 );
gtk_container_set_border_width( GTK_CONTAINER( b_close ), 5 );
- vbox2 = gtk_vbox_new( FALSE, 5 );
+ vbox2 = ui::VBox( FALSE, 5 );
gtk_widget_set_name( vbox2, "vbox2" );
gtk_widget_show( vbox2 );
gtk_box_pack_start( GTK_BOX( vbox1 ), vbox2, TRUE, TRUE, 0 );
gtk_container_set_border_width( GTK_CONTAINER( vbox2 ), 2 );
- label1 = gtk_label_new( "Ignored materials:" );
+ label1 = ui::Label( "Ignored materials:" );
gtk_widget_set_name( label1, "label1" );
gtk_widget_show( label1 );
gtk_box_pack_start( GTK_BOX( vbox2 ), label1, FALSE, FALSE, 0 );
- scrolledwindow1 = gtk_scrolled_window_new( NULL, NULL );
+ scrolledwindow1 = ui::ScrolledWindow();
gtk_widget_set_name( scrolledwindow1, "scrolledwindow1" );
gtk_widget_show( scrolledwindow1 );
gtk_box_pack_start( GTK_BOX( vbox2 ), scrolledwindow1, TRUE, TRUE, 0 );
gtk_scrolled_window_set_policy( GTK_SCROLLED_WINDOW( scrolledwindow1 ), GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC );
gtk_scrolled_window_set_shadow_type( GTK_SCROLLED_WINDOW( scrolledwindow1 ), GTK_SHADOW_IN );
- t_materialist = gtk_tree_view_new();
+ t_materialist = ui::TreeView();
gtk_widget_set_name( t_materialist, "t_materialist" );
gtk_widget_show( t_materialist );
gtk_container_add( GTK_CONTAINER( scrolledwindow1 ), t_materialist );
gtk_tree_view_set_headers_visible( GTK_TREE_VIEW( t_materialist ), FALSE );
gtk_tree_view_set_enable_search( GTK_TREE_VIEW( t_materialist ), FALSE );
- ed_materialname = gtk_entry_new();
+ ed_materialname = ui::Entry();
gtk_widget_set_name( ed_materialname, "ed_materialname" );
gtk_widget_show( ed_materialname );
gtk_box_pack_start( GTK_BOX( vbox2 ), ed_materialname, FALSE, FALSE, 0 );
- hbox1 = gtk_hbox_new( TRUE, 0 );
+ hbox1 = ui::HBox( TRUE, 0 );
gtk_widget_set_name( hbox1, "hbox1" );
gtk_widget_show( hbox1 );
gtk_box_pack_start( GTK_BOX( vbox2 ), hbox1, FALSE, FALSE, 0 );
// spawn plugin window (and make sure it got destroyed first or never created)
void CreateWindow( void ){
- ASSERT_NOTNULL( !g_brushexp_window );
+ ASSERT_TRUE( !g_brushexp_window );
GtkWidget* wnd = create_w_plugplug2();
GtkTreeViewColumn* col = gtk_tree_view_column_new();
gtk_tree_view_column_set_title( col, "materials" );
gtk_tree_view_append_column( GTK_TREE_VIEW( lookup_widget( wnd, "t_materialist" ) ), col );
- GtkCellRenderer* renderer = gtk_cell_renderer_text_new();
+ auto renderer = ui::CellRendererText();
gtk_tree_view_insert_column_with_attributes( GTK_TREE_VIEW( lookup_widget( wnd, "t_materialist" ) ), -1, "", renderer, "text", 0, NULL );
// list store
#include "qerplugin.h"
#include <gtk/gtk.h>
-#include <gtk/gtktreeview.h>
#include "debugging/debugging.h"
#include "string/string.h"
namespace BrushExport
{
-GtkWindow* g_mainwnd;
+ui::Window g_mainwnd;
const char* init( void* hApp, void* pMainWidget ){
- g_mainwnd = (GtkWindow*)pMainWidget;
- ASSERT_NOTNULL( g_mainwnd );
+ g_mainwnd = ui::Window(GTK_WINDOW(pMainWidget));
+ ASSERT_TRUE( g_mainwnd );
return "";
}
const char* getName(){
void dispatch( const char* command, float* vMin, float* vMax, bool bSingleBrush ){
if ( string_equal( command, "About" ) ) {
- GlobalRadiant().m_pfnMessageBox( GTK_WIDGET( g_mainwnd ), "Brushexport plugin v 2.0 by namespace (www.codecreator.net)\n"
+ GlobalRadiant().m_pfnMessageBox( g_mainwnd, "Brushexport plugin v 2.0 by namespace (www.codecreator.net)\n"
"Enjoy!\n\nSend feedback to spam@codecreator.net", "About me...",
eMB_OK,
eMB_ICONDEFAULT );
#include <gtk/gtk.h>
+#include <uilib/uilib.h>
#include "support.h"
-GtkWidget*
+ui::Widget
lookup_widget( GtkWidget *widget,
const gchar *widget_name ){
GtkWidget *parent, *found_widget;
parent = gtk_menu_get_attach_widget( GTK_MENU( widget ) );
}
else{
- parent = widget->parent;
+ parent = gtk_widget_get_parent(widget);
}
if ( !parent ) {
parent = (GtkWidget*) g_object_get_data( G_OBJECT( widget ), "GladeParentKey" );
if ( !found_widget ) {
g_warning( "Widget not found: %s", widget_name );
}
- return found_widget;
+ return ui::Widget(found_widget);
}
#endif
#include <gtk/gtk.h>
+#include <uilib/uilib.h>
/*
* Public Functions.
* or alternatively any widget in the component, and the name of the widget
* you want returned.
*/
-GtkWidget* lookup_widget( GtkWidget *widget,
+ui::Widget lookup_widget( GtkWidget *widget,
const gchar *widget_name );
// char buf[128];
// create the window
- window = gtk_window_new( GTK_WINDOW_TOPLEVEL );
+ window = ui::Window( ui::window_type::TOP );
gtk_window_set_title( GTK_WINDOW( window ), "New Camera" );
- gtk_signal_connect( GTK_OBJECT( window ), "delete_event", GTK_SIGNAL_FUNC( dialog_delete_callback ), NULL );
- gtk_signal_connect( GTK_OBJECT( window ), "destroy", GTK_SIGNAL_FUNC( gtk_widget_destroy ), NULL );
+ g_signal_connect( GTK_OBJECT( window ), "delete_event", G_CALLBACK( dialog_delete_callback ), NULL );
+ g_signal_connect( GTK_OBJECT( window ), "destroy", G_CALLBACK( gtk_widget_destroy ), NULL );
gtk_window_set_transient_for( GTK_WINDOW( window ), GTK_WINDOW( g_pCameraInspectorWnd ) );
g_object_set_data( G_OBJECT( window ), "loop", &loop );
gtk_widget_realize( window );
// fill the window
- vbox = gtk_vbox_new( FALSE, 5 );
+ vbox = ui::VBox( FALSE, 5 );
gtk_container_add( GTK_CONTAINER( window ), vbox );
gtk_widget_show( vbox );
// -------------------------- //
- hbox = gtk_hbox_new( FALSE, 5 );
+ hbox = ui::HBox( FALSE, 5 );
gtk_box_pack_start( GTK_BOX( vbox ), hbox, FALSE, FALSE, 0 );
gtk_widget_show( hbox );
- frame = gtk_frame_new( "Type" );
+ frame = ui::Frame( "Type" );
gtk_box_pack_start( GTK_BOX( hbox ), frame, TRUE, TRUE, 0 );
gtk_widget_show( frame );
- vbox2 = gtk_vbox_new( FALSE, 5 );
+ vbox2 = ui::VBox( FALSE, 5 );
gtk_container_add( GTK_CONTAINER( frame ), vbox2 );
gtk_container_set_border_width( GTK_CONTAINER( vbox2 ), 5 );
gtk_widget_show( vbox2 );
fixed = gtk_radio_button_new_with_label( targetTypeRadio, "Fixed" );
gtk_box_pack_start( GTK_BOX( vbox2 ), fixed, FALSE, FALSE, 3 );
gtk_widget_show( fixed );
- targetTypeRadio = gtk_radio_button_group( GTK_RADIO_BUTTON( fixed ) );
+ targetTypeRadio = gtk_radio_button_get_group( GTK_RADIO_BUTTON( fixed ) );
interpolated = gtk_radio_button_new_with_label( targetTypeRadio, "Interpolated" );
gtk_box_pack_start( GTK_BOX( vbox2 ), interpolated, FALSE, FALSE, 3 );
gtk_widget_show( interpolated );
- targetTypeRadio = gtk_radio_button_group( GTK_RADIO_BUTTON( interpolated ) );
+ targetTypeRadio = gtk_radio_button_get_group( GTK_RADIO_BUTTON( interpolated ) );
spline = gtk_radio_button_new_with_label( targetTypeRadio, "Spline" );
gtk_box_pack_start( GTK_BOX( vbox2 ), spline, FALSE, FALSE, 3 );
gtk_widget_show( spline );
- targetTypeRadio = gtk_radio_button_group( GTK_RADIO_BUTTON( spline ) );
+ targetTypeRadio = gtk_radio_button_get_group( GTK_RADIO_BUTTON( spline ) );
// -------------------------- //
// -------------------------- //
- hbox = gtk_hbox_new( FALSE, 5 );
+ hbox = ui::HBox( FALSE, 5 );
gtk_box_pack_start( GTK_BOX( vbox ), hbox, FALSE, FALSE, 0 );
gtk_widget_show( hbox );
- w = 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 ) );
+ g_signal_connect( GTK_OBJECT( w ), "clicked", G_CALLBACK( dialog_button_callback ), GINT_TO_POINTER( eIDOK ) );
gtk_widget_show( w );
- GTK_WIDGET_SET_FLAGS( w, GTK_CAN_DEFAULT );
+ gtk_widget_set_can_default( w, true );
gtk_widget_grab_default( w );
- w = 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 ) );
+ g_signal_connect( GTK_OBJECT( w ), "clicked", G_CALLBACK( dialog_button_callback ), GINT_TO_POINTER( eIDCANCEL ) );
gtk_widget_show( w );
ret = eIDCANCEL;
}
// start edit mode
- if ( g_pCameraInspectorWnd && GTK_WIDGET_VISIBLE( g_pCameraInspectorWnd ) ) {
+ if ( g_pCameraInspectorWnd && gtk_widget_get_visible( g_pCameraInspectorWnd ) ) {
DoStartEdit( GetCurrentCam() );
}
}
// create the window
- window = gtk_window_new( GTK_WINDOW_TOPLEVEL );
+ window = ui::Window( ui::window_type::TOP );
gtk_window_set_title( GTK_WINDOW( window ), "Rename Path" );
- gtk_signal_connect( GTK_OBJECT( window ), "delete_event", GTK_SIGNAL_FUNC( dialog_delete_callback ), NULL );
- gtk_signal_connect( GTK_OBJECT( window ), "destroy", GTK_SIGNAL_FUNC( gtk_widget_destroy ), NULL );
+ g_signal_connect( GTK_OBJECT( window ), "delete_event", G_CALLBACK( dialog_delete_callback ), NULL );
+ g_signal_connect( GTK_OBJECT( window ), "destroy", G_CALLBACK( gtk_widget_destroy ), NULL );
gtk_window_set_transient_for( GTK_WINDOW( window ), GTK_WINDOW( g_pCameraInspectorWnd ) );
g_object_set_data( G_OBJECT( window ), "loop", &loop );
gtk_widget_realize( window );
// fill the window
- vbox = gtk_vbox_new( FALSE, 5 );
+ vbox = ui::VBox( FALSE, 5 );
gtk_container_add( GTK_CONTAINER( window ), vbox );
gtk_widget_show( vbox );
// -------------------------- //
- hbox = gtk_hbox_new( FALSE, 5 );
+ hbox = ui::HBox( FALSE, 5 );
gtk_box_pack_start( GTK_BOX( vbox ), hbox, FALSE, FALSE, 0 );
gtk_widget_show( hbox );
- w = gtk_label_new( "Name:" );
+ w = ui::Label( "Name:" );
gtk_box_pack_start( GTK_BOX( hbox ), w, FALSE, FALSE, 0 );
gtk_widget_show( w );
- name = gtk_entry_new();
+ name = ui::Entry();
gtk_box_pack_start( GTK_BOX( hbox ), name, FALSE, FALSE, 0 );
gtk_widget_show( name );
// -------------------------- //
- hbox = gtk_hbox_new( FALSE, 5 );
+ hbox = ui::HBox( FALSE, 5 );
gtk_box_pack_start( GTK_BOX( vbox ), hbox, FALSE, FALSE, 0 );
gtk_widget_show( hbox );
- w = 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 ) );
+ g_signal_connect( GTK_OBJECT( w ), "clicked", G_CALLBACK( dialog_button_callback ), GINT_TO_POINTER( eIDOK ) );
gtk_widget_show( w );
- GTK_WIDGET_SET_FLAGS( w, GTK_CAN_DEFAULT );
+ gtk_widget_set_can_default( w, true );
gtk_widget_grab_default( w );
- w = 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 ) );
+ g_signal_connect( GTK_OBJECT( w ), "clicked", G_CALLBACK( dialog_button_callback ), GINT_TO_POINTER( eIDCANCEL ) );
gtk_widget_show( w );
ret = eIDCANCEL;
}
// create the window
- window = gtk_window_new( GTK_WINDOW_TOPLEVEL );
+ window = ui::Window( ui::window_type::TOP );
gtk_window_set_title( GTK_WINDOW( window ), "Add Target" );
- gtk_signal_connect( GTK_OBJECT( window ), "delete_event", GTK_SIGNAL_FUNC( dialog_delete_callback ), NULL );
- gtk_signal_connect( GTK_OBJECT( window ), "destroy", GTK_SIGNAL_FUNC( gtk_widget_destroy ), NULL );
+ g_signal_connect( GTK_OBJECT( window ), "delete_event", G_CALLBACK( dialog_delete_callback ), NULL );
+ g_signal_connect( GTK_OBJECT( window ), "destroy", G_CALLBACK( gtk_widget_destroy ), NULL );
gtk_window_set_transient_for( GTK_WINDOW( window ), GTK_WINDOW( g_pCameraInspectorWnd ) );
g_object_set_data( G_OBJECT( window ), "loop", &loop );
gtk_widget_realize( window );
// fill the window
- vbox = gtk_vbox_new( FALSE, 5 );
+ vbox = ui::VBox( FALSE, 5 );
gtk_container_add( GTK_CONTAINER( window ), vbox );
gtk_widget_show( vbox );
// -------------------------- //
- hbox = gtk_hbox_new( FALSE, 5 );
+ hbox = ui::HBox( FALSE, 5 );
gtk_box_pack_start( GTK_BOX( vbox ), hbox, FALSE, FALSE, 0 );
gtk_widget_show( hbox );
- w = gtk_label_new( "Name:" );
+ w = ui::Label( "Name:" );
gtk_box_pack_start( GTK_BOX( hbox ), w, FALSE, FALSE, 0 );
gtk_widget_show( w );
- name = gtk_entry_new();
+ name = ui::Entry();
gtk_box_pack_start( GTK_BOX( hbox ), name, TRUE, TRUE, 0 );
gtk_widget_show( name );
// -------------------------- //
- hbox = gtk_hbox_new( FALSE, 5 );
+ hbox = ui::HBox( FALSE, 5 );
gtk_box_pack_start( GTK_BOX( vbox ), hbox, FALSE, FALSE, 0 );
gtk_widget_show( hbox );
- frame = gtk_frame_new( "Type" );
+ frame = ui::Frame( "Type" );
gtk_box_pack_start( GTK_BOX( hbox ), frame, TRUE, TRUE, 0 );
gtk_widget_show( frame );
- vbox2 = gtk_vbox_new( FALSE, 5 );
+ vbox2 = ui::VBox( FALSE, 5 );
gtk_container_add( GTK_CONTAINER( frame ), vbox2 );
gtk_container_set_border_width( GTK_CONTAINER( vbox2 ), 5 );
gtk_widget_show( vbox2 );
fixed = gtk_radio_button_new_with_label( targetTypeRadio, "Fixed" );
gtk_box_pack_start( GTK_BOX( vbox2 ), fixed, FALSE, FALSE, 3 );
gtk_widget_show( fixed );
- targetTypeRadio = gtk_radio_button_group( GTK_RADIO_BUTTON( fixed ) );
+ targetTypeRadio = gtk_radio_button_get_group( GTK_RADIO_BUTTON( fixed ) );
interpolated = gtk_radio_button_new_with_label( targetTypeRadio, "Interpolated" );
gtk_box_pack_start( GTK_BOX( vbox2 ), interpolated, FALSE, FALSE, 3 );
gtk_widget_show( interpolated );
- targetTypeRadio = gtk_radio_button_group( GTK_RADIO_BUTTON( interpolated ) );
+ targetTypeRadio = gtk_radio_button_get_group( GTK_RADIO_BUTTON( interpolated ) );
spline = gtk_radio_button_new_with_label( targetTypeRadio, "Spline" );
gtk_box_pack_start( GTK_BOX( vbox2 ), spline, FALSE, FALSE, 3 );
gtk_widget_show( spline );
- targetTypeRadio = gtk_radio_button_group( GTK_RADIO_BUTTON( spline ) );
+ targetTypeRadio = gtk_radio_button_get_group( GTK_RADIO_BUTTON( spline ) );
// -------------------------- //
// -------------------------- //
- hbox = gtk_hbox_new( FALSE, 5 );
+ hbox = ui::HBox( FALSE, 5 );
gtk_box_pack_start( GTK_BOX( vbox ), hbox, FALSE, FALSE, 0 );
gtk_widget_show( hbox );
- w = 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 ) );
+ g_signal_connect( GTK_OBJECT( w ), "clicked", G_CALLBACK( dialog_button_callback ), GINT_TO_POINTER( eIDOK ) );
gtk_widget_show( w );
- GTK_WIDGET_SET_FLAGS( w, GTK_CAN_DEFAULT );
+ gtk_widget_set_can_default( w, true );
gtk_widget_grab_default( w );
- w = 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 ) );
+ g_signal_connect( GTK_OBJECT( w ), "clicked", G_CALLBACK( dialog_button_callback ), GINT_TO_POINTER( eIDCANCEL ) );
gtk_widget_show( w );
ret = eIDCANCEL;
// start edit mode
g_iActiveTarget = -1;
- if ( g_pCameraInspectorWnd && GTK_WIDGET_VISIBLE( g_pCameraInspectorWnd ) ) {
+ if ( g_pCameraInspectorWnd && gtk_widget_get_visible( g_pCameraInspectorWnd ) ) {
DoStartEdit( GetCurrentCam() );
}
}
// create the window
- window = gtk_window_new( GTK_WINDOW_TOPLEVEL );
+ window = ui::Window( ui::window_type::TOP );
gtk_window_set_title( GTK_WINDOW( window ), "Add Event" );
- gtk_signal_connect( GTK_OBJECT( window ), "delete_event", GTK_SIGNAL_FUNC( dialog_delete_callback ), NULL );
- gtk_signal_connect( GTK_OBJECT( window ), "destroy", GTK_SIGNAL_FUNC( gtk_widget_destroy ), NULL );
+ g_signal_connect( GTK_OBJECT( window ), "delete_event", G_CALLBACK( dialog_delete_callback ), NULL );
+ g_signal_connect( GTK_OBJECT( window ), "destroy", G_CALLBACK( gtk_widget_destroy ), NULL );
gtk_window_set_transient_for( GTK_WINDOW( window ), GTK_WINDOW( g_pCameraInspectorWnd ) );
g_object_set_data( G_OBJECT( window ), "loop", &loop );
gtk_widget_realize( window );
// fill the window
- vbox = gtk_vbox_new( FALSE, 5 );
+ vbox = ui::VBox( FALSE, 5 );
gtk_container_add( GTK_CONTAINER( window ), vbox );
gtk_widget_show( vbox );
// -------------------------- //
- hbox = gtk_hbox_new( FALSE, 5 );
+ hbox = ui::HBox( FALSE, 5 );
gtk_box_pack_start( GTK_BOX( vbox ), hbox, FALSE, FALSE, 0 );
gtk_widget_show( hbox );
- frame = gtk_frame_new( "Type" );
+ frame = ui::Frame( "Type" );
gtk_box_pack_start( GTK_BOX( hbox ), frame, TRUE, TRUE, 0 );
gtk_widget_show( frame );
- vbox2 = gtk_vbox_new( FALSE, 5 );
+ vbox2 = ui::VBox( FALSE, 5 );
gtk_container_add( GTK_CONTAINER( frame ), vbox2 );
gtk_container_set_border_width( GTK_CONTAINER( vbox2 ), 5 );
gtk_widget_show( vbox2 );
eventWidget[i] = gtk_radio_button_new_with_label( eventTypeRadio, camEventStr[i] );
gtk_box_pack_start( GTK_BOX( vbox2 ), eventWidget[i], FALSE, FALSE, 3 );
gtk_widget_show( eventWidget[i] );
- eventTypeRadio = gtk_radio_button_group( GTK_RADIO_BUTTON( eventWidget[i] ) );
+ eventTypeRadio = gtk_radio_button_get_group( GTK_RADIO_BUTTON( eventWidget[i] ) );
if ( camEventFlags[i][1] == false ) {
gtk_widget_set_sensitive( eventWidget[i], FALSE );
}
// -------------------------- //
- hbox = gtk_hbox_new( FALSE, 5 );
+ hbox = ui::HBox( FALSE, 5 );
gtk_box_pack_start( GTK_BOX( vbox ), hbox, FALSE, FALSE, 0 );
gtk_widget_show( hbox );
- w = gtk_label_new( "Parameters:" );
+ w = ui::Label( "Parameters:" );
gtk_box_pack_start( GTK_BOX( hbox ), w, FALSE, FALSE, 0 );
gtk_widget_show( w );
- parameters = gtk_entry_new();
+ parameters = ui::Entry();
gtk_box_pack_start( GTK_BOX( hbox ), parameters, TRUE, TRUE, 0 );
gtk_widget_show( parameters );
// -------------------------- //
- hbox = gtk_hbox_new( FALSE, 5 );
+ hbox = ui::HBox( FALSE, 5 );
gtk_box_pack_start( GTK_BOX( vbox ), hbox, FALSE, FALSE, 0 );
gtk_widget_show( hbox );
- w = 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 ) );
+ g_signal_connect( GTK_OBJECT( w ), "clicked", G_CALLBACK( dialog_button_callback ), GINT_TO_POINTER( eIDOK ) );
gtk_widget_show( w );
- GTK_WIDGET_SET_FLAGS( w, GTK_CAN_DEFAULT );
+ gtk_widget_set_can_default( w, true );
gtk_widget_grab_default( w );
- w = 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 ) );
+ g_signal_connect( GTK_OBJECT( w ), "clicked", G_CALLBACK( dialog_button_callback ), GINT_TO_POINTER( eIDCANCEL ) );
gtk_widget_show( w );
ret = eIDCANCEL;
GtkWidget *window, *w, *vbox, *hbox, *table, *frame;
// create the window
- window = gtk_window_new( GTK_WINDOW_TOPLEVEL );
+ window = ui::Window( ui::window_type::TOP );
gtk_window_set_title( GTK_WINDOW( window ), "Camera Inspector" );
- gtk_signal_connect( GTK_OBJECT( window ), "delete_event", GTK_SIGNAL_FUNC( ci_close ), NULL );
- gtk_signal_connect( GTK_OBJECT( window ), "expose_event", GTK_SIGNAL_FUNC( ci_expose ), NULL );
- // gtk_signal_connect( GTK_OBJECT (window), "destroy", GTK_SIGNAL_FUNC( gtk_widget_destroy ), NULL );
+ g_signal_connect( GTK_OBJECT( window ), "delete_event", G_CALLBACK( ci_close ), NULL );
+ g_signal_connect( GTK_OBJECT( window ), "expose_event", G_CALLBACK( ci_expose ), NULL );
+ // g_signal_connect( GTK_OBJECT (window), "destroy", G_CALLBACK( gtk_widget_destroy ), NULL );
gtk_window_set_transient_for( GTK_WINDOW( window ), GTK_WINDOW( g_pRadiantWnd ) );
// don't use show, as you don't want to have it displayed on startup ;-)
// the table
// -------------------------- //
- table = gtk_table_new( 3, 2, FALSE );
+ table = ui::Table( 3, 2, FALSE );
gtk_widget_show( table );
gtk_container_add( GTK_CONTAINER( window ), table );
gtk_container_set_border_width( GTK_CONTAINER( table ), 5 );
// the properties column
// -------------------------- //
- vbox = gtk_vbox_new( FALSE, 5 );
+ vbox = ui::VBox( FALSE, 5 );
gtk_widget_show( vbox );
gtk_table_attach( GTK_TABLE( table ), vbox, 0, 1, 0, 1,
(GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ),
// -------------------------- //
- hbox = gtk_hbox_new( FALSE, 5 );
+ hbox = ui::HBox( FALSE, 5 );
gtk_box_pack_start( GTK_BOX( vbox ), hbox, FALSE, FALSE, 0 );
gtk_widget_show( hbox );
- w = gtk_label_new( "File:" );
+ w = ui::Label( "File:" );
gtk_box_pack_start( GTK_BOX( hbox ), w, FALSE, FALSE, 0 );
gtk_widget_show( w );
// -------------------------- //
- hbox = gtk_hbox_new( FALSE, 5 );
+ hbox = ui::HBox( FALSE, 5 );
gtk_box_pack_start( GTK_BOX( vbox ), hbox, FALSE, FALSE, 0 );
gtk_widget_show( hbox );
- w = gtk_label_new( "Name:" );
+ w = ui::Label( "Name:" );
gtk_box_pack_start( GTK_BOX( hbox ), w, FALSE, FALSE, 0 );
gtk_widget_show( w );
- g_pCamName = gtk_entry_new();
+ g_pCamName = ui::Entry();
gtk_box_pack_start( GTK_BOX( hbox ), g_pCamName, FALSE, FALSE, 0 );
gtk_widget_show( g_pCamName );
- w = gtk_label_new( "Type: " );
+ w = ui::Label( "Type: " );
gtk_box_pack_start( GTK_BOX( hbox ), w, FALSE, FALSE, 0 );
gtk_widget_show( w );
- w = gtk_label_new( "" );
+ w = ui::Label( "" );
gtk_box_pack_start( GTK_BOX( hbox ), w, FALSE, FALSE, 0 );
gtk_widget_show( w );
g_pCamType = GTK_LABEL( w );
RefreshCamListCombo();
- gtk_entry_set_editable( GTK_ENTRY( GTK_COMBO( g_pCamListCombo )->entry ), FALSE );
- gtk_signal_connect( GTK_OBJECT( GTK_COMBO( g_pCamListCombo )->entry ), "changed", GTK_SIGNAL_FUNC( ci_camlist_changed ), NULL );
+ gtk_editable_set_editable( GTK_EDITABLE( GTK_COMBO( g_pCamListCombo )->entry ), FALSE );
+ g_signal_connect( GTK_OBJECT( GTK_COMBO( g_pCamListCombo )->entry ), "changed", G_CALLBACK( ci_camlist_changed ), NULL );
// -------------------------- //
- frame = gtk_frame_new( "Path and Target editing" );
+ frame = ui::Frame( "Path and Target editing" );
gtk_widget_show( frame );
gtk_table_attach( GTK_TABLE( table ), frame, 0, 1, 1, 2,
(GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ),
(GtkAttachOptions) ( GTK_FILL ), 0, 0 );
- vbox = gtk_vbox_new( FALSE, 5 );
+ vbox = ui::VBox( FALSE, 5 );
gtk_container_add( GTK_CONTAINER( frame ), vbox );
gtk_container_set_border_width( GTK_CONTAINER( vbox ), 5 );
gtk_widget_show( vbox );
// -------------------------- //
- hbox = gtk_hbox_new( FALSE, 5 );
+ hbox = ui::HBox( FALSE, 5 );
gtk_box_pack_start( GTK_BOX( vbox ), hbox, FALSE, FALSE, 0 );
gtk_widget_show( hbox );
- w = gtk_label_new( "Edit:" );
+ w = ui::Label( "Edit:" );
gtk_box_pack_start( GTK_BOX( hbox ), w, FALSE, FALSE, 0 );
gtk_widget_show( w );
RefreshPathListCombo();
- gtk_entry_set_editable( GTK_ENTRY( GTK_COMBO( g_pPathListCombo )->entry ), FALSE );
- gtk_signal_connect( GTK_OBJECT( GTK_COMBO( g_pPathListCombo )->entry ), "changed", GTK_SIGNAL_FUNC( ci_pathlist_changed ), NULL );
+ gtk_editable_set_editable( GTK_EDITABLE( GTK_COMBO( g_pPathListCombo )->entry ), FALSE );
+ g_signal_connect( GTK_OBJECT( GTK_COMBO( g_pPathListCombo )->entry ), "changed", G_CALLBACK( ci_pathlist_changed ), NULL );
// -------------------------- //
- hbox = gtk_hbox_new( FALSE, 5 );
+ hbox = ui::HBox( FALSE, 5 );
gtk_box_pack_start( GTK_BOX( vbox ), hbox, FALSE, FALSE, 0 );
gtk_widget_show( hbox );
g_pEditModeEditRadioButton = gtk_radio_button_new_with_label( g_pEditTypeRadio, "Edit Points" );
gtk_box_pack_start( GTK_BOX( hbox ), g_pEditModeEditRadioButton, FALSE, FALSE, 3 );
gtk_widget_show( g_pEditModeEditRadioButton );
- g_pEditTypeRadio = gtk_radio_button_group( GTK_RADIO_BUTTON( g_pEditModeEditRadioButton ) );
+ g_pEditTypeRadio = gtk_radio_button_get_group( GTK_RADIO_BUTTON( g_pEditModeEditRadioButton ) );
- gtk_signal_connect( GTK_OBJECT( g_pEditModeEditRadioButton ), "clicked", GTK_SIGNAL_FUNC( ci_editmode_edit ), NULL );
+ g_signal_connect( GTK_OBJECT( g_pEditModeEditRadioButton ), "clicked", G_CALLBACK( ci_editmode_edit ), NULL );
g_pEditModeAddRadioButton = gtk_radio_button_new_with_label( g_pEditTypeRadio, "Add Points" );
gtk_box_pack_start( GTK_BOX( hbox ), g_pEditModeAddRadioButton, FALSE, FALSE, 3 );
gtk_widget_show( g_pEditModeAddRadioButton );
- g_pEditTypeRadio = gtk_radio_button_group( GTK_RADIO_BUTTON( g_pEditModeAddRadioButton ) );
+ g_pEditTypeRadio = gtk_radio_button_get_group( GTK_RADIO_BUTTON( g_pEditModeAddRadioButton ) );
- gtk_signal_connect( GTK_OBJECT( g_pEditModeAddRadioButton ), "clicked", GTK_SIGNAL_FUNC( ci_editmode_add ), NULL );
+ g_signal_connect( GTK_OBJECT( g_pEditModeAddRadioButton ), "clicked", G_CALLBACK( ci_editmode_add ), NULL );
// see if we should use a different default
if ( g_iEditMode == 1 ) {
gtk_toggle_button_set_active( GTK_TOGGLE_BUTTON( g_pEditModeAddRadioButton ), TRUE );
}
- w = gtk_label_new( "Type: " );
+ w = ui::Label( "Type: " );
gtk_box_pack_start( GTK_BOX( hbox ), w, FALSE, FALSE, 0 );
gtk_widget_show( w );
- w = gtk_label_new( "" );
+ w = ui::Label( "" );
gtk_box_pack_start( GTK_BOX( hbox ), w, FALSE, FALSE, 0 );
gtk_widget_show( w );
g_pPathType = GTK_LABEL( w );
// -------------------------- //
- hbox = gtk_hbox_new( FALSE, 5 );
+ hbox = ui::HBox( FALSE, 5 );
gtk_box_pack_start( GTK_BOX( vbox ), hbox, FALSE, FALSE, 0 );
gtk_widget_show( hbox );
- w = gtk_button_new_with_label( "Rename..." );
+ w = ui::Button( "Rename..." );
gtk_box_pack_start( GTK_BOX( hbox ), w, FALSE, TRUE, 0 );
- gtk_signal_connect( GTK_OBJECT( w ), "clicked", GTK_SIGNAL_FUNC( ci_rename ), NULL );
+ g_signal_connect( GTK_OBJECT( w ), "clicked", G_CALLBACK( ci_rename ), NULL );
gtk_widget_show( w );
- w = gtk_button_new_with_label( "Add Target..." );
+ w = ui::Button( "Add Target..." );
gtk_box_pack_start( GTK_BOX( hbox ), w, FALSE, TRUE, 0 );
- gtk_signal_connect( GTK_OBJECT( w ), "clicked", GTK_SIGNAL_FUNC( ci_add_target ), NULL );
+ g_signal_connect( GTK_OBJECT( w ), "clicked", G_CALLBACK( ci_add_target ), NULL );
gtk_widget_show( w );
// not available in splines library
/*w = gtk_button_new_with_label( "Delete Selected" );
gtk_box_pack_start( GTK_BOX( hbox ), w, FALSE, TRUE, 0);
- gtk_signal_connect( GTK_OBJECT( w ), "clicked", GTK_SIGNAL_FUNC( ci_delete_selected ), NULL );
+ g_signal_connect( GTK_OBJECT( w ), "clicked", G_CALLBACK( ci_delete_selected ), NULL );
gtk_widget_show( w );
w = gtk_button_new_with_label( "Select All" );
gtk_box_pack_start( GTK_BOX( hbox ), w, FALSE, TRUE, 0);
- gtk_signal_connect( GTK_OBJECT( w ), "clicked", GTK_SIGNAL_FUNC( ci_select_all ), NULL );
+ g_signal_connect( GTK_OBJECT( w ), "clicked", G_CALLBACK( ci_select_all ), NULL );
gtk_widget_show( w );*/
// -------------------------- //
- frame = gtk_frame_new( "Time" );
+ frame = ui::Frame( "Time" );
gtk_widget_show( frame );
gtk_table_attach( GTK_TABLE( table ), frame, 0, 1, 2, 3,
(GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ),
(GtkAttachOptions) ( GTK_FILL ), 0, 0 );
- vbox = gtk_vbox_new( FALSE, 5 );
+ vbox = ui::VBox( FALSE, 5 );
gtk_container_add( GTK_CONTAINER( frame ), vbox );
gtk_container_set_border_width( GTK_CONTAINER( vbox ), 5 );
gtk_widget_show( vbox );
// -------------------------- //
- hbox = gtk_hbox_new( FALSE, 5 );
+ hbox = ui::HBox( FALSE, 5 );
gtk_box_pack_start( GTK_BOX( vbox ), hbox, FALSE, FALSE, 0 );
gtk_widget_show( hbox );
- w = gtk_label_new( "Length (seconds):" );
+ w = ui::Label( "Length (seconds):" );
gtk_box_pack_start( GTK_BOX( hbox ), w, FALSE, FALSE, 0 );
gtk_widget_show( w );
- g_pSecondsEntry = gtk_entry_new();
+ g_pSecondsEntry = ui::Entry();
gtk_box_pack_start( GTK_BOX( hbox ), g_pSecondsEntry, FALSE, FALSE, 0 );
gtk_widget_show( g_pSecondsEntry );
// -------------------------- //
- hbox = gtk_hbox_new( FALSE, 5 );
+ hbox = ui::HBox( FALSE, 5 );
gtk_box_pack_start( GTK_BOX( vbox ), hbox, FALSE, FALSE, 0 );
gtk_widget_show( hbox );
- w = gtk_label_new( "Current Time: " );
+ w = ui::Label( "Current Time: " );
gtk_box_pack_start( GTK_BOX( hbox ), w, FALSE, FALSE, 0 );
gtk_widget_show( w );
- w = gtk_label_new( "0.00" );
+ w = ui::Label( "0.00" );
gtk_box_pack_start( GTK_BOX( hbox ), w, FALSE, FALSE, 0 );
gtk_widget_show( w );
g_pCurrentTime = GTK_LABEL( w );
- w = gtk_label_new( " of " );
+ w = ui::Label( " of " );
gtk_box_pack_start( GTK_BOX( hbox ), w, FALSE, FALSE, 0 );
gtk_widget_show( w );
- w = gtk_label_new( "0.00" );
+ w = ui::Label( "0.00" );
gtk_box_pack_start( GTK_BOX( hbox ), w, FALSE, FALSE, 0 );
gtk_widget_show( w );
g_pTotalTime = GTK_LABEL( w );
// -------------------------- //
- hbox = gtk_hbox_new( FALSE, 5 );
+ hbox = ui::HBox( FALSE, 5 );
gtk_box_pack_start( GTK_BOX( vbox ), hbox, FALSE, FALSE, 0 );
gtk_widget_show( hbox );
- g_pTimeLine = GTK_ADJUSTMENT( gtk_adjustment_new( 0, 0, 30000, 100, 250, 0 ) );
- gtk_signal_connect( GTK_OBJECT( g_pTimeLine ), "value_changed", GTK_SIGNAL_FUNC( ci_timeline_changed ), NULL );
- w = gtk_hscale_new( g_pTimeLine );
+ g_pTimeLine = ui::Adjustment( 0, 0, 30000, 100, 250, 0 );
+ g_signal_connect( GTK_OBJECT( g_pTimeLine ), "value_changed", G_CALLBACK( ci_timeline_changed ), NULL );
+ w = ui::HScale( g_pTimeLine );
gtk_box_pack_start( GTK_BOX( hbox ), w, TRUE, TRUE, 0 );
gtk_widget_show( w );
gtk_scale_set_draw_value( GTK_SCALE( w ), FALSE );
// -------------------------- //
- hbox = gtk_hbox_new( FALSE, 5 );
+ hbox = ui::HBox( FALSE, 5 );
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 );
// -------------------------- //
- hbox = gtk_hbox_new( FALSE, 5 );
+ hbox = ui::HBox( FALSE, 5 );
gtk_box_pack_start( GTK_BOX( vbox ), hbox, FALSE, FALSE, 0 );
gtk_widget_show( hbox );
- w = gtk_label_new( "Events:" );
+ w = ui::Label( "Events:" );
gtk_box_pack_start( GTK_BOX( hbox ), w, FALSE, FALSE, 0 );
gtk_widget_show( w );
// -------------------------- //
- hbox = gtk_hbox_new( FALSE, 5 );
+ hbox = ui::HBox( FALSE, 5 );
gtk_box_pack_start( GTK_BOX( vbox ), hbox, FALSE, FALSE, 0 );
gtk_widget_show( hbox );
- w = gtk_scrolled_window_new( NULL, NULL );
- gtk_widget_set_usize( w, 0, 150 );
+ w = ui::ScrolledWindow();
+ gtk_widget_set_size_request( w, 0, 150 );
gtk_scrolled_window_set_policy( GTK_SCROLLED_WINDOW( w ), GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC );
gtk_box_pack_start( GTK_BOX( hbox ), w, TRUE, TRUE, 0 );
gtk_widget_show( w );
g_pEventsList = gtk_clist_new( 3 );
gtk_container_add( GTK_CONTAINER( w ), g_pEventsList );
- //gtk_signal_connect( GTK_OBJECT(g_pEventsList), "select_row", GTK_SIGNAL_FUNC (proplist_select_row), NULL);
+ //g_signal_connect( GTK_OBJECT(g_pEventsList), "select_row", G_CALLBACK (proplist_select_row), NULL);
gtk_clist_set_selection_mode( GTK_CLIST( g_pEventsList ), GTK_SELECTION_BROWSE );
gtk_clist_column_titles_hide( GTK_CLIST( g_pEventsList ) );
gtk_clist_set_column_auto_resize( GTK_CLIST( g_pEventsList ), 0, TRUE );
gtk_clist_set_column_auto_resize( GTK_CLIST( g_pEventsList ), 2, TRUE );
gtk_widget_show( g_pEventsList );
- vbox = gtk_vbox_new( FALSE, 5 );
+ vbox = ui::VBox( FALSE, 5 );
gtk_box_pack_start( GTK_BOX( hbox ), vbox, FALSE, FALSE, 0 );
gtk_widget_show( vbox );
- w = gtk_button_new_with_label( "Add..." );
+ w = ui::Button( "Add..." );
gtk_box_pack_start( GTK_BOX( vbox ), w, FALSE, FALSE, 0 );
- gtk_signal_connect( GTK_OBJECT( w ), "clicked", GTK_SIGNAL_FUNC( ci_add ), NULL );
+ g_signal_connect( GTK_OBJECT( w ), "clicked", G_CALLBACK( ci_add ), NULL );
gtk_widget_show( w );
- w = gtk_button_new_with_label( "Del" );
+ w = ui::Button( "Del" );
gtk_box_pack_start( GTK_BOX( vbox ), w, FALSE, FALSE, 0 );
- gtk_signal_connect( GTK_OBJECT( w ), "clicked", GTK_SIGNAL_FUNC( ci_del ), NULL );
+ g_signal_connect( GTK_OBJECT( w ), "clicked", G_CALLBACK( ci_del ), NULL );
gtk_widget_show( w );
// -------------------------- //
w = gtk_button_new_with_label( "New..." );
gtk_box_pack_start( GTK_BOX( vbox ), w, FALSE, FALSE, 0 );
- gtk_signal_connect( GTK_OBJECT( w ), "clicked", GTK_SIGNAL_FUNC( ci_new ), NULL );
+ g_signal_connect( GTK_OBJECT( w ), "clicked", G_CALLBACK( ci_new ), NULL );
gtk_widget_show( w );
w = gtk_button_new_with_label( "Load..." );
gtk_box_pack_start( GTK_BOX( vbox ), w, FALSE, FALSE, 0 );
- gtk_signal_connect( GTK_OBJECT( w ), "clicked", GTK_SIGNAL_FUNC( ci_load ), NULL );
+ g_signal_connect( GTK_OBJECT( w ), "clicked", G_CALLBACK( ci_load ), NULL );
gtk_widget_show( w );
// -------------------------- //
w = gtk_button_new_with_label( "Save..." );
gtk_box_pack_start( GTK_BOX( vbox ), w, FALSE, FALSE, 0 );
- gtk_signal_connect( GTK_OBJECT( w ), "clicked", GTK_SIGNAL_FUNC( ci_save ), NULL );
+ g_signal_connect( GTK_OBJECT( w ), "clicked", G_CALLBACK( ci_save ), NULL );
gtk_widget_show( w );
w = gtk_button_new_with_label( "Unload" );
gtk_box_pack_start( GTK_BOX( vbox ), w, FALSE, FALSE, 0 );
- gtk_signal_connect( GTK_OBJECT( w ), "clicked", GTK_SIGNAL_FUNC( ci_unload ), NULL );
+ g_signal_connect( GTK_OBJECT( w ), "clicked", G_CALLBACK( ci_unload ), NULL );
gtk_widget_show( w );
hbox = gtk_hbox_new( FALSE, 5 );
w = gtk_button_new_with_label( "Apply" );
gtk_box_pack_start( GTK_BOX( vbox ), w, FALSE, FALSE, 0 );
- gtk_signal_connect( GTK_OBJECT( w ), "clicked", GTK_SIGNAL_FUNC( ci_apply ), NULL );
+ g_signal_connect( GTK_OBJECT( w ), "clicked", G_CALLBACK( ci_apply ), NULL );
gtk_widget_show( w );
w = gtk_button_new_with_label( "Preview" );
gtk_box_pack_start( GTK_BOX( vbox ), w, FALSE, FALSE, 0 );
- gtk_signal_connect( GTK_OBJECT( w ), "clicked", GTK_SIGNAL_FUNC( ci_preview ), NULL );
+ g_signal_connect( GTK_OBJECT( w ), "clicked", G_CALLBACK( ci_preview ), NULL );
gtk_widget_show( w );
// -------------------------- //
w = gtk_button_new_with_label( "Close" );
gtk_box_pack_start( GTK_BOX( vbox ), w, FALSE, FALSE, 0 );
- gtk_signal_connect( GTK_OBJECT( w ), "clicked", GTK_SIGNAL_FUNC( ci_close ), NULL );
- GTK_WIDGET_SET_FLAGS( w, GTK_CAN_DEFAULT );
+ g_signal_connect( GTK_OBJECT( w ), "clicked", G_CALLBACK( ci_close ), NULL );
+ gtk_widget_set_can_default( w, true );
gtk_widget_grab_default( w );
gtk_widget_show( w );
GtkWidget* create_main_dialog(){
GtkWidget *dlg, *vbox, *hbox, *hbox2, *button, *notebook, *frame, *table, *table2;
GtkWidget *check, *spin, *radio, *label, *entry, *scale;
- GtkObject *adj;
+ ui::Adjustment adj;
GSList *group;
int i;
const char *games[] = { "Quake 2", "Half-Life", "SiN", "Heretic 2", "Kingpin", "Genesis3D", "Quake 3 Arena" };
const char *orientations[] = { "Ground surface", "Ceiling", "Wall facing 0", "Wall facing 90",
"Wall facing 180","Wall facing 270" };
- g_pWnd = dlg = gtk_window_new( GTK_WINDOW_TOPLEVEL );
+ g_pWnd = dlg = ui::Window( ui::window_type::TOP );
gtk_window_set_title( GTK_WINDOW( dlg ), gszCaption );
g_signal_connect( G_OBJECT( dlg ), "delete_event", G_CALLBACK( main_close ), NULL );
// g_signal_connect (G_OBJECT (dlg), "destroy", G_CALLBACK (gtk_widget_destroy), NULL);
gtk_window_set_transient_for( GTK_WINDOW( dlg ), GTK_WINDOW( g_pRadiantWnd ) );
- hbox = gtk_hbox_new( FALSE, 5 );
+ hbox = ui::HBox( FALSE, 5 );
gtk_widget_show( hbox );
gtk_container_add( GTK_CONTAINER( dlg ), hbox );
gtk_container_set_border_width( GTK_CONTAINER( hbox ), 5 );
gtk_notebook_set_tab_pos( GTK_NOTEBOOK( notebook ), GTK_POS_TOP );
g_object_set_data( G_OBJECT( dlg ), "notebook", notebook );
- table = gtk_table_new( 2, 2, FALSE );
+ table = ui::Table( 2, 2, FALSE );
gtk_widget_show( table );
gtk_container_set_border_width( GTK_CONTAINER( table ), 5 );
gtk_table_set_row_spacings( GTK_TABLE( table ), 5 );
gtk_table_set_col_spacings( GTK_TABLE( table ), 5 );
- label = gtk_label_new( "General" );
+ label = ui::Label( "General" );
gtk_widget_show( label );
gtk_notebook_append_page( GTK_NOTEBOOK( notebook ), table, label );
- frame = gtk_frame_new( "Game" );
+ frame = ui::Frame( "Game" );
gtk_widget_show( frame );
gtk_table_attach( GTK_TABLE( table ), frame, 0, 1, 0, 1,
(GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ),
(GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ), 0, 0 );
- vbox = gtk_vbox_new( TRUE, 5 );
+ vbox = ui::VBox( TRUE, 5 );
gtk_widget_show( vbox );
gtk_container_add( GTK_CONTAINER( frame ), vbox );
gtk_container_set_border_width( GTK_CONTAINER( vbox ), 5 );
radio = gtk_radio_button_new_with_label( group, games[i] );
gtk_widget_show( radio );
gtk_box_pack_start( GTK_BOX( vbox ), radio, TRUE, TRUE, 0 );
- group = gtk_radio_button_group( GTK_RADIO_BUTTON( radio ) );
+ group = gtk_radio_button_get_group( GTK_RADIO_BUTTON( radio ) );
game_radios[i] = radio;
g_signal_connect( G_OBJECT( radio ), "toggled", G_CALLBACK( general_game ), GINT_TO_POINTER( i ) );
}
- frame = gtk_frame_new( "Waveform" );
+ frame = ui::Frame( "Waveform" );
gtk_widget_show( frame );
gtk_table_attach( GTK_TABLE( table ), frame, 1, 2, 0, 1,
(GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ),
(GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ), 0, 0 );
- vbox = gtk_vbox_new( TRUE, 5 );
+ vbox = ui::VBox( TRUE, 5 );
gtk_widget_show( vbox );
gtk_container_add( GTK_CONTAINER( frame ), vbox );
gtk_container_set_border_width( GTK_CONTAINER( vbox ), 5 );
radio = gtk_radio_button_new_with_label( group, waveforms[i] );
gtk_widget_show( radio );
gtk_box_pack_start( GTK_BOX( vbox ), radio, TRUE, TRUE, 0 );
- group = gtk_radio_button_group( GTK_RADIO_BUTTON( radio ) );
+ group = gtk_radio_button_get_group( GTK_RADIO_BUTTON( radio ) );
wave_radios[i] = radio;
g_signal_connect( G_OBJECT( radio ), "toggled", G_CALLBACK( general_wave ), GINT_TO_POINTER( i ) );
}
- frame = gtk_frame_new( "Orientation" );
+ frame = ui::Frame( "Orientation" );
gtk_widget_show( frame );
gtk_table_attach( GTK_TABLE( table ), frame, 0, 1, 1, 2,
(GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ),
(GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ), 0, 0 );
- vbox = gtk_vbox_new( TRUE, 5 );
+ vbox = ui::VBox( TRUE, 5 );
gtk_widget_show( vbox );
gtk_container_add( GTK_CONTAINER( frame ), vbox );
gtk_container_set_border_width( GTK_CONTAINER( vbox ), 5 );
radio = gtk_radio_button_new_with_label( group, orientations[i] );
gtk_widget_show( radio );
gtk_box_pack_start( GTK_BOX( vbox ), radio, TRUE, TRUE, 0 );
- group = gtk_radio_button_group( GTK_RADIO_BUTTON( radio ) );
+ group = gtk_radio_button_get_group( GTK_RADIO_BUTTON( radio ) );
plane_radios[i] = radio;
g_signal_connect( G_OBJECT( radio ), "toggled", G_CALLBACK( general_plane ), GINT_TO_POINTER( i ) );
}
- table2 = gtk_table_new( 4, 2, FALSE );
+ table2 = ui::Table( 4, 2, FALSE );
gtk_widget_show( table2 );
gtk_table_set_row_spacings( GTK_TABLE( table2 ), 5 );
gtk_table_set_col_spacings( GTK_TABLE( table2 ), 5 );
(GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ),
(GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ), 0, 0 );
- label = gtk_label_new( "Wavelength:" );
+ label = ui::Label( "Wavelength:" );
gtk_widget_show( label );
gtk_table_attach( GTK_TABLE( table2 ), label, 0, 1, 0, 1,
(GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ),
gtk_misc_set_alignment( GTK_MISC( label ), 1, 0.5 );
gtk_label_set_justify( GTK_LABEL( label ), GTK_JUSTIFY_RIGHT );
- label = gtk_label_new( "Max. amplitude:" );
+ label = ui::Label( "Max. amplitude:" );
gtk_widget_show( label );
gtk_table_attach( GTK_TABLE( table2 ), label, 0, 1, 1, 2,
(GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ),
gtk_misc_set_alignment( GTK_MISC( label ), 1, 0.5 );
gtk_label_set_justify( GTK_LABEL( label ), GTK_JUSTIFY_RIGHT );
- label = gtk_label_new( "Roughness:" );
+ label = ui::Label( "Roughness:" );
gtk_widget_show( label );
gtk_table_attach( GTK_TABLE( table2 ), label, 0, 1, 2, 3,
(GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ),
gtk_misc_set_alignment( GTK_MISC( label ), 1, 0.5 );
gtk_label_set_justify( GTK_LABEL( label ), GTK_JUSTIFY_RIGHT );
- label = gtk_label_new( "Random seed:" );
+ label = ui::Label( "Random seed:" );
gtk_widget_show( label );
gtk_table_attach( GTK_TABLE( table2 ), label, 0, 1, 3, 4,
(GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ),
gtk_misc_set_alignment( GTK_MISC( label ), 1, 0.5 );
gtk_label_set_justify( GTK_LABEL( label ), GTK_JUSTIFY_RIGHT );
- entry = gtk_entry_new();
+ entry = ui::Entry();
gtk_widget_show( entry );
gtk_table_attach( GTK_TABLE( table2 ), entry, 1, 2, 0, 1,
(GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ),
(GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ), 0, 0 );
- gtk_widget_set_usize( entry, 50, -2 );
+ gtk_widget_set_size_request( entry, 50, -1 );
g_object_set_data( G_OBJECT( dlg ), "wavelength", entry );
g_signal_connect( G_OBJECT( entry ), "focus_out_event", G_CALLBACK( doublevariable_entryfocusout ), &WaveLength );
- entry = gtk_entry_new();
+ entry = ui::Entry();
gtk_widget_show( entry );
gtk_table_attach( GTK_TABLE( table2 ), entry, 1, 2, 1, 2,
(GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ),
(GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ), 0, 0 );
- gtk_widget_set_usize( entry, 50, -2 );
+ gtk_widget_set_size_request( entry, 50, -1 );
g_object_set_data( G_OBJECT( dlg ), "amplitude", entry );
g_signal_connect( G_OBJECT( entry ), "focus_out_event", G_CALLBACK( doublevariable_entryfocusout ), &Amplitude );
- entry = gtk_entry_new();
+ entry = ui::Entry();
gtk_widget_show( entry );
gtk_table_attach( GTK_TABLE( table2 ), entry, 1, 2, 2, 3,
(GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ),
(GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ), 0, 0 );
- gtk_widget_set_usize( entry, 50, -2 );
+ gtk_widget_set_size_request( entry, 50, -1 );
g_object_set_data( G_OBJECT( dlg ), "roughness", entry );
g_signal_connect( G_OBJECT( entry ), "focus_out_event", G_CALLBACK( doublevariable_entryfocusout ), &Roughness );
- adj = gtk_adjustment_new( 1, 1, 32767, 1, 10, 0 );
+ 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 ),
(GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ), 0, 0 );
- gtk_widget_set_usize( spin, 60, -2 );
+ gtk_widget_set_size_request( spin, 60, -1 );
g_object_set_data( G_OBJECT( dlg ), "random", spin );
- vbox = gtk_vbox_new( FALSE, 5 );
+ vbox = ui::VBox( FALSE, 5 );
gtk_widget_show( vbox );
gtk_container_set_border_width( GTK_CONTAINER( vbox ), 5 );
- label = gtk_label_new( "Extents" );
+ label = ui::Label( "Extents" );
gtk_widget_show( label );
gtk_notebook_append_page( GTK_NOTEBOOK( notebook ), vbox, label );
- hbox2 = gtk_hbox_new( FALSE, 5 );
+ hbox2 = ui::HBox( FALSE, 5 );
gtk_widget_show( hbox2 );
gtk_box_pack_start( GTK_BOX( vbox ), hbox2, FALSE, TRUE, 0 );
- frame = gtk_frame_new( "Extents" );
+ frame = ui::Frame( "Extents" );
gtk_widget_show( frame );
gtk_box_pack_start( GTK_BOX( hbox2 ), frame, TRUE, TRUE, 0 );
- table = gtk_table_new( 3, 4, FALSE );
+ table = ui::Table( 3, 4, FALSE );
gtk_widget_show( table );
gtk_container_set_border_width( GTK_CONTAINER( table ), 5 );
gtk_container_add( GTK_CONTAINER( frame ), table );
gtk_table_set_row_spacings( GTK_TABLE( table ), 5 );
gtk_table_set_col_spacings( GTK_TABLE( table ), 5 );
- label = gtk_label_new( "X:" );
+ label = ui::Label( "X:" );
gtk_widget_show( label );
gtk_table_attach( GTK_TABLE( table ), label, 0, 1, 1, 2,
(GtkAttachOptions) ( GTK_FILL ),
(GtkAttachOptions) ( GTK_FILL ), 0, 0 );
g_object_set_data( G_OBJECT( dlg ), "hmin_text", label );
- label = gtk_label_new( "X:" );
+ label = ui::Label( "X:" );
gtk_widget_show( label );
gtk_table_attach( GTK_TABLE( table ), label, 2, 3, 1, 2,
(GtkAttachOptions) ( GTK_FILL ),
(GtkAttachOptions) ( GTK_FILL ), 0, 0 );
g_object_set_data( G_OBJECT( dlg ), "hmax_text", label );
- label = gtk_label_new( "Y:" );
+ label = ui::Label( "Y:" );
gtk_widget_show( label );
gtk_table_attach( GTK_TABLE( table ), label, 0, 1, 2, 3,
(GtkAttachOptions) ( GTK_FILL ),
(GtkAttachOptions) ( GTK_FILL ), 0, 0 );
g_object_set_data( G_OBJECT( dlg ), "vmin_text", label );
- label = gtk_label_new( "Y:" );
+ label = ui::Label( "Y:" );
gtk_widget_show( label );
gtk_table_attach( GTK_TABLE( table ), label, 2, 3, 2, 3,
(GtkAttachOptions) ( GTK_FILL ),
(GtkAttachOptions) ( GTK_FILL ), 0, 0 );
g_object_set_data( G_OBJECT( dlg ), "vmax_text", label );
- label = gtk_label_new( "Lower-left" );
+ label = ui::Label( "Lower-left" );
gtk_widget_show( label );
gtk_table_attach( GTK_TABLE( table ), label, 1, 2, 0, 1,
(GtkAttachOptions) ( GTK_FILL ),
(GtkAttachOptions) ( GTK_FILL ), 0, 0 );
- label = gtk_label_new( "Upper-right" );
+ label = ui::Label( "Upper-right" );
gtk_widget_show( label );
gtk_table_attach( GTK_TABLE( table ), label, 3, 4, 0, 1,
(GtkAttachOptions) ( GTK_FILL ),
(GtkAttachOptions) ( GTK_FILL ), 0, 0 );
- entry = gtk_entry_new();
+ entry = ui::Entry();
gtk_widget_show( entry );
gtk_table_attach( GTK_TABLE( table ), entry, 1, 2, 1, 2,
(GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ),
(GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ), 0, 0 );
- gtk_widget_set_usize( entry, 50, -2 );
+ gtk_widget_set_size_request( entry, 50, -1 );
g_object_set_data( G_OBJECT( dlg ), "hmin", entry );
g_signal_connect( G_OBJECT( entry ), "focus_out_event", G_CALLBACK( doublevariable_entryfocusout ), &Hll );
- entry = gtk_entry_new();
+ entry = ui::Entry();
gtk_widget_show( entry );
gtk_table_attach( GTK_TABLE( table ), entry, 3, 4, 1, 2,
(GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ),
(GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ), 0, 0 );
- gtk_widget_set_usize( entry, 50, -2 );
+ gtk_widget_set_size_request( entry, 50, -1 );
g_object_set_data( G_OBJECT( dlg ), "hmax", entry );
g_signal_connect( G_OBJECT( entry ), "focus_out_event", G_CALLBACK( doublevariable_entryfocusout ), &Hur );
- entry = gtk_entry_new();
+ entry = ui::Entry();
gtk_widget_show( entry );
gtk_table_attach( GTK_TABLE( table ), entry, 1, 2, 2, 3,
(GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ),
(GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ), 0, 0 );
- gtk_widget_set_usize( entry, 50, -2 );
+ gtk_widget_set_size_request( entry, 50, -1 );
g_object_set_data( G_OBJECT( dlg ), "vmin", entry );
g_signal_connect( G_OBJECT( entry ), "focus_out_event", G_CALLBACK( doublevariable_entryfocusout ), &Vll );
- entry = gtk_entry_new();
+ entry = ui::Entry();
gtk_widget_show( entry );
gtk_table_attach( GTK_TABLE( table ), entry, 3, 4, 2, 3,
(GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ),
(GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ), 0, 0 );
- gtk_widget_set_usize( entry, 50, -2 );
+ gtk_widget_set_size_request( entry, 50, -1 );
g_object_set_data( G_OBJECT( dlg ), "vmax", entry );
g_signal_connect( G_OBJECT( entry ), "focus_out_event", G_CALLBACK( doublevariable_entryfocusout ), &Vur );
- frame = gtk_frame_new( "Divisions" );
+ frame = ui::Frame( "Divisions" );
gtk_widget_show( frame );
gtk_box_pack_start( GTK_BOX( hbox2 ), frame, TRUE, TRUE, 0 );
- table = gtk_table_new( 2, 2, FALSE );
+ table = ui::Table( 2, 2, FALSE );
gtk_widget_show( table );
gtk_container_set_border_width( GTK_CONTAINER( table ), 5 );
gtk_container_add( GTK_CONTAINER( frame ), table );
gtk_table_set_row_spacings( GTK_TABLE( table ), 5 );
gtk_table_set_col_spacings( GTK_TABLE( table ), 5 );
- label = gtk_label_new( "X:" );
+ label = ui::Label( "X:" );
gtk_widget_show( label );
gtk_table_attach( GTK_TABLE( table ), label, 0, 1, 0, 1,
(GtkAttachOptions) ( GTK_FILL ),
(GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ), 0, 0 );
g_object_set_data( G_OBJECT( dlg ), "nh_text", label );
- label = gtk_label_new( "Y:" );
+ label = ui::Label( "Y:" );
gtk_widget_show( label );
gtk_table_attach( GTK_TABLE( table ), label, 0, 1, 1, 2,
(GtkAttachOptions) ( GTK_FILL ),
(GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ), 0, 0 );
g_object_set_data( G_OBJECT( dlg ), "nv_text", label );
- adj = gtk_adjustment_new( 8, 1, MAX_ROWS, 1, 10, 0 );
+ 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 ),
(GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ), 0, 0 );
- gtk_widget_set_usize( spin, 60, -2 );
+ gtk_widget_set_size_request( spin, 60, -1 );
g_object_set_data( G_OBJECT( dlg ), "nh", spin );
- adj = gtk_adjustment_new( 8, 1, MAX_ROWS, 1, 10, 0 );
+ 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 ),
(GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ), 0, 0 );
- gtk_widget_set_usize( spin, 60, -2 );
+ gtk_widget_set_size_request( spin, 60, -1 );
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_signal_connect( G_OBJECT( check ), "toggled", G_CALLBACK( extents_use_patches ), NULL );
// ^Fishman - Snap to grid, replaced scroll bar with a texbox.
- label = gtk_label_new( "Snap to grid:" );
+ label = ui::Label( "Snap to grid:" );
gtk_widget_show( label );
gtk_box_pack_start( GTK_BOX( vbox ), label, FALSE, TRUE, 0 );
gtk_object_set_data( GTK_OBJECT( dlg ), "snap_text", label );
- adj = gtk_adjustment_new( 8, 0, 256, 1, 10, 0 );
+ 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 );
+ gtk_widget_set_size_request( spin, 60, -1 );
g_object_set_data( G_OBJECT( dlg ), "sp", spin );
// ^Fishman - End of Snap to grid code.
- hbox2 = gtk_hbox_new( FALSE, 5 );
+ hbox2 = ui::HBox( FALSE, 5 );
gtk_widget_show( hbox2 );
gtk_box_pack_start( GTK_BOX( vbox ), hbox2, FALSE, TRUE, 10 );
- label = gtk_label_new( "Decimate:" );
+ label = ui::Label( "Decimate:" );
gtk_widget_show( label );
gtk_box_pack_start( GTK_BOX( hbox2 ), label, FALSE, TRUE, 0 );
- adj = gtk_adjustment_new( 0, 0, 110, 1, 10, 0 );
+ adj = ui::Adjustment( 0, 0, 110, 1, 10, 0 );
g_signal_connect( G_OBJECT( adj ), "value_changed", G_CALLBACK( extents_decimate ), NULL );
g_object_set_data( G_OBJECT( dlg ), "decimate_adj", adj );
- scale = gtk_hscale_new( GTK_ADJUSTMENT( adj ) );
+ scale = ui::HScale( adj );
gtk_widget_show( scale );
gtk_box_pack_start( GTK_BOX( hbox2 ), scale, TRUE, TRUE, 0 );
gtk_scale_set_value_pos( GTK_SCALE( scale ), GTK_POS_RIGHT );
gtk_scale_set_digits( GTK_SCALE( scale ), 0 );
g_object_set_data( G_OBJECT( dlg ), "decimate", scale );
- frame = gtk_frame_new( "Corner values" );
+ frame = ui::Frame( "Corner values" );
gtk_widget_show( frame );
gtk_box_pack_start( GTK_BOX( vbox ), frame, FALSE, TRUE, 0 );
- table = gtk_table_new( 3, 4, FALSE );
+ table = ui::Table( 3, 4, FALSE );
gtk_widget_show( table );
gtk_container_set_border_width( GTK_CONTAINER( table ), 5 );
gtk_container_add( GTK_CONTAINER( frame ), table );
gtk_table_set_row_spacings( GTK_TABLE( table ), 5 );
gtk_table_set_col_spacings( GTK_TABLE( table ), 5 );
- label = gtk_label_new( "Upper-left:" );
+ label = ui::Label( "Upper-left:" );
gtk_widget_show( label );
gtk_table_attach( GTK_TABLE( table ), label, 0, 1, 0, 1,
(GtkAttachOptions) ( GTK_FILL ),
(GtkAttachOptions) ( GTK_FILL ), 0, 0 );
- label = gtk_label_new( "Lower-left:" );
+ label = ui::Label( "Lower-left:" );
gtk_widget_show( label );
gtk_table_attach( GTK_TABLE( table ), label, 0, 1, 1, 2,
(GtkAttachOptions) ( GTK_FILL ),
(GtkAttachOptions) ( GTK_FILL ), 0, 0 );
- label = gtk_label_new( "Upper-right:" );
+ label = ui::Label( "Upper-right:" );
gtk_widget_show( label );
gtk_table_attach( GTK_TABLE( table ), label, 2, 3, 0, 1,
(GtkAttachOptions) ( GTK_FILL ),
(GtkAttachOptions) ( GTK_FILL ), 0, 0 );
- label = gtk_label_new( "Lower-right:" );
+ label = ui::Label( "Lower-right:" );
gtk_widget_show( label );
gtk_table_attach( GTK_TABLE( table ), label, 2, 3, 1, 2,
(GtkAttachOptions) ( GTK_FILL ),
(GtkAttachOptions) ( GTK_FILL ), 0, 0 );
- entry = gtk_entry_new();
+ entry = ui::Entry();
gtk_widget_show( entry );
gtk_table_attach( GTK_TABLE( table ), entry, 1, 2, 0, 1,
(GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ),
(GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ), 0, 0 );
- gtk_widget_set_usize( entry, 50, -2 );
+ gtk_widget_set_size_request( entry, 50, -1 );
g_object_set_data( G_OBJECT( dlg ), "z01", entry );
g_signal_connect( G_OBJECT( entry ), "focus_out_event", G_CALLBACK( doublevariable_entryfocusout ), &Z01 );
- entry = gtk_entry_new();
+ entry = ui::Entry();
gtk_widget_show( entry );
gtk_table_attach( GTK_TABLE( table ), entry, 1, 2, 1, 2,
(GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ),
(GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ), 0, 0 );
- gtk_widget_set_usize( entry, 50, -2 );
+ gtk_widget_set_size_request( entry, 50, -1 );
g_object_set_data( G_OBJECT( dlg ), "z00", entry );
g_signal_connect( G_OBJECT( entry ), "focus_out_event", G_CALLBACK( doublevariable_entryfocusout ), &Z00 );
- entry = gtk_entry_new();
+ entry = ui::Entry();
gtk_widget_show( entry );
gtk_table_attach( GTK_TABLE( table ), entry, 3, 4, 0, 1,
(GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ),
(GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ), 0, 0 );
- gtk_widget_set_usize( entry, 50, -2 );
+ gtk_widget_set_size_request( entry, 50, -1 );
g_object_set_data( G_OBJECT( dlg ), "z11", entry );
g_signal_connect( G_OBJECT( entry ), "focus_out_event", G_CALLBACK( doublevariable_entryfocusout ), &Z11 );
- entry = gtk_entry_new();
+ entry = ui::Entry();
gtk_widget_show( entry );
gtk_table_attach( GTK_TABLE( table ), entry, 3, 4, 1, 2,
(GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ),
(GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ), 0, 0 );
- gtk_widget_set_usize( entry, 50, -2 );
+ gtk_widget_set_size_request( entry, 50, -1 );
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 ),
g_object_set_data( G_OBJECT( dlg ), "linearborder", check );
g_signal_connect( G_OBJECT( check ), "toggled", G_CALLBACK( extents_linearborder ), NULL );
- vbox = gtk_vbox_new( FALSE, 10 );
+ vbox = ui::VBox( FALSE, 10 );
gtk_widget_show( vbox );
gtk_container_set_border_width( GTK_CONTAINER( vbox ), 5 );
- label = gtk_label_new( "Bitmap" );
+ label = ui::Label( "Bitmap" );
gtk_widget_show( label );
gtk_notebook_append_page( GTK_NOTEBOOK( notebook ), vbox, label );
- label = gtk_label_new( "" );
+ label = ui::Label( "" );
gtk_widget_show( label );
gtk_box_pack_start( GTK_BOX( vbox ), label, FALSE, TRUE, 0 );
g_object_set_data( G_OBJECT( dlg ), "bmp_note", label );
- table = gtk_table_new( 2, 2, FALSE );
+ table = ui::Table( 2, 2, FALSE );
gtk_widget_show( table );
gtk_container_set_border_width( GTK_CONTAINER( table ), 5 );
gtk_box_pack_start( GTK_BOX( vbox ), table, FALSE, TRUE, 0 );
gtk_table_set_row_spacings( GTK_TABLE( table ), 5 );
gtk_table_set_col_spacings( GTK_TABLE( table ), 5 );
- label = gtk_label_new( "Filename:" );
+ label = ui::Label( "Filename:" );
gtk_widget_show( label );
gtk_table_attach( GTK_TABLE( table ), label, 0, 1, 0, 1,
(GtkAttachOptions) ( GTK_FILL ),
(GtkAttachOptions) ( GTK_FILL ), 0, 0 );
g_object_set_data( G_OBJECT( dlg ), "bmp_text1", label );
- entry = gtk_entry_new();
+ entry = ui::Entry();
gtk_widget_show( entry );
gtk_table_attach( GTK_TABLE( table ), entry, 1, 2, 0, 1,
(GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ),
g_object_set_data( G_OBJECT( dlg ), "bmp_file", entry );
g_signal_connect( G_OBJECT( entry ), "focus_out_event", G_CALLBACK( bitmap_file_entryfocusout ), NULL );
- hbox2 = gtk_hbox_new( TRUE, 5 );
+ hbox2 = ui::HBox( TRUE, 5 );
gtk_widget_show( hbox2 );
gtk_table_attach( GTK_TABLE( table ), hbox2, 1, 2, 1, 2,
(GtkAttachOptions) ( 0 ),
(GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ), 0, 0 );
- button = gtk_button_new_with_label( "Browse..." );
+ button = ui::Button( "Browse..." );
gtk_widget_show( button );
gtk_box_pack_start( GTK_BOX( hbox2 ), button, FALSE, FALSE, 0 );
- gtk_widget_set_usize( button, 60, -2 );
+ gtk_widget_set_size_request( button, 60, -1 );
g_object_set_data( G_OBJECT( dlg ), "bmp_file_browse", button );
g_signal_connect( G_OBJECT( button ), "clicked", G_CALLBACK( bitmap_browse ), NULL );
- button = gtk_button_new_with_label( "Reload" );
+ button = ui::Button( "Reload" );
gtk_widget_show( button );
gtk_box_pack_start( GTK_BOX( hbox2 ), button, FALSE, FALSE, 0 );
- gtk_widget_set_usize( button, 60, -2 );
+ gtk_widget_set_size_request( button, 60, -1 );
g_object_set_data( G_OBJECT( dlg ), "bmp_reload", button );
g_signal_connect( G_OBJECT( button ), "clicked", G_CALLBACK( bitmap_reload ), NULL );
- table = gtk_table_new( 2, 2, TRUE );
+ table = ui::Table( 2, 2, TRUE );
gtk_widget_show( table );
gtk_container_set_border_width( GTK_CONTAINER( table ), 5 );
gtk_box_pack_start( GTK_BOX( vbox ), table, FALSE, TRUE, 0 );
gtk_table_set_row_spacings( GTK_TABLE( table ), 5 );
gtk_table_set_col_spacings( GTK_TABLE( table ), 5 );
- label = gtk_label_new( "Map color 0 to:" );
+ label = ui::Label( "Map color 0 to:" );
gtk_widget_show( label );
gtk_table_attach( GTK_TABLE( table ), label, 0, 1, 0, 1,
(GtkAttachOptions) ( GTK_FILL | GTK_EXPAND ),
gtk_misc_set_alignment( GTK_MISC( label ), 1, 0.5 );
gtk_label_set_justify( GTK_LABEL( label ), GTK_JUSTIFY_RIGHT );
- label = gtk_label_new( "Map color 255 to:" );
+ label = ui::Label( "Map color 255 to:" );
gtk_widget_show( label );
gtk_table_attach( GTK_TABLE( table ), label, 0, 1, 1, 2,
(GtkAttachOptions) ( GTK_FILL | GTK_EXPAND ),
gtk_misc_set_alignment( GTK_MISC( label ), 1, 0.5 );
gtk_label_set_justify( GTK_LABEL( label ), GTK_JUSTIFY_RIGHT );
- hbox2 = gtk_hbox_new( FALSE, 5 );
+ hbox2 = ui::HBox( FALSE, 5 );
gtk_widget_show( hbox2 );
gtk_table_attach( GTK_TABLE( table ), hbox2, 1, 2, 0, 1,
(GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ),
(GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ), 0, 0 );
- entry = gtk_entry_new();
+ entry = ui::Entry();
gtk_widget_show( entry );
gtk_box_pack_start( GTK_BOX( hbox2 ), entry, FALSE, FALSE, 0 );
- gtk_widget_set_usize( entry, 50, -2 );
+ gtk_widget_set_size_request( entry, 50, -1 );
g_object_set_data( G_OBJECT( dlg ), "bmp_black", entry );
g_signal_connect( G_OBJECT( entry ), "focus_out_event", G_CALLBACK( doublevariable_entryfocusout ), &gbmp.black_value );
- hbox2 = gtk_hbox_new( FALSE, 5 );
+ hbox2 = ui::HBox( FALSE, 5 );
gtk_widget_show( hbox2 );
gtk_table_attach( GTK_TABLE( table ), hbox2, 1, 2, 1, 2,
(GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ),
(GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ), 0, 0 );
- entry = gtk_entry_new();
+ entry = ui::Entry();
gtk_widget_show( entry );
gtk_box_pack_start( GTK_BOX( hbox2 ), entry, FALSE, FALSE, 0 );
- gtk_widget_set_usize( entry, 50, -2 );
+ gtk_widget_set_size_request( entry, 50, -1 );
g_object_set_data( G_OBJECT( dlg ), "bmp_white", entry );
g_signal_connect( G_OBJECT( entry ), "focus_out_event", G_CALLBACK( doublevariable_entryfocusout ), &gbmp.white_value );
- vbox = gtk_vbox_new( FALSE, 10 );
+ vbox = ui::VBox( FALSE, 10 );
gtk_widget_show( vbox );
gtk_container_set_border_width( GTK_CONTAINER( vbox ), 5 );
- label = gtk_label_new( "Fix Points" );
+ label = ui::Label( "Fix Points" );
gtk_widget_show( label );
gtk_notebook_append_page( GTK_NOTEBOOK( notebook ), vbox, label );
- label = gtk_label_new( "Click on a vertex in the lower half of the preview window,\n"
+ label = ui::Label( "Click on a vertex in the lower half of the preview window,\n"
"then use the arrow keys or text box to assign a value.\n"
"Use Ctrl+Click to select multiple vertices/toggle a\n"
"selection. Use Shift+Click to select a range of vertices.\n\n"
gtk_widget_show( label );
gtk_box_pack_start( GTK_BOX( vbox ), label, FALSE, TRUE, 0 );
- table = gtk_table_new( 3, 3, FALSE );
+ table = ui::Table( 3, 3, FALSE );
gtk_widget_show( table );
gtk_container_set_border_width( GTK_CONTAINER( table ), 5 );
gtk_box_pack_start( GTK_BOX( vbox ), table, FALSE, TRUE, 0 );
gtk_table_set_row_spacings( GTK_TABLE( table ), 5 );
gtk_table_set_col_spacings( GTK_TABLE( table ), 5 );
- label = gtk_label_new( "Value:" );
+ label = ui::Label( "Value:" );
gtk_widget_show( label );
gtk_table_attach( GTK_TABLE( table ), label, 0, 1, 0, 1,
(GtkAttachOptions) ( GTK_FILL ),
gtk_misc_set_alignment( GTK_MISC( label ), 1, 0.5 );
g_object_set_data( G_OBJECT( dlg ), "fix_value_text", label );
- label = gtk_label_new( "Range affected:" );
+ label = ui::Label( "Range affected:" );
gtk_widget_show( label );
gtk_table_attach( GTK_TABLE( table ), label, 0, 1, 1, 2,
(GtkAttachOptions) ( GTK_FILL ),
gtk_misc_set_alignment( GTK_MISC( label ), 1, 0.5 );
g_object_set_data( G_OBJECT( dlg ), "fix_range_text", label );
- label = gtk_label_new( "Rate of change:" );
+ label = ui::Label( "Rate of change:" );
gtk_widget_show( label );
gtk_table_attach( GTK_TABLE( table ), label, 0, 1, 2, 3,
(GtkAttachOptions) ( GTK_FILL ),
gtk_misc_set_alignment( GTK_MISC( label ), 1, 0.5 );
g_object_set_data( G_OBJECT( dlg ), "fix_rate_text", label );
- adj = gtk_adjustment_new( 0, -65536, 65536, 1, 16, 0 );
+ 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 ),
(GtkAttachOptions) ( GTK_EXPAND ), 0, 0 );
- gtk_widget_set_usize( spin, 60, -2 );
+ gtk_widget_set_size_request( spin, 60, -1 );
g_object_set_data( G_OBJECT( dlg ), "fix_value", spin );
g_signal_connect( G_OBJECT( spin ), "focus_out_event", G_CALLBACK( fix_value_entryfocusout ), NULL );
- entry = gtk_entry_new();
+ entry = ui::Entry();
gtk_widget_show( entry );
gtk_table_attach( GTK_TABLE( table ), entry, 1, 2, 1, 2,
(GtkAttachOptions) ( GTK_EXPAND ),
(GtkAttachOptions) ( GTK_FILL ), 0, 0 );
- gtk_widget_set_usize( entry, 60, -2 );
+ gtk_widget_set_size_request( entry, 60, -1 );
g_object_set_data( G_OBJECT( dlg ), "fix_range", entry );
g_signal_connect( G_OBJECT( entry ), "focus_out_event", G_CALLBACK( fix_range_entryfocusout ), NULL );
- entry = gtk_entry_new();
+ entry = ui::Entry();
gtk_widget_show( entry );
gtk_table_attach( GTK_TABLE( table ), entry, 1, 2, 2, 3,
(GtkAttachOptions) ( GTK_EXPAND ),
(GtkAttachOptions) ( GTK_FILL ), 0, 0 );
- gtk_widget_set_usize( entry, 60, -2 );
+ gtk_widget_set_size_request( entry, 60, -1 );
g_object_set_data( G_OBJECT( dlg ), "fix_rate", entry );
g_signal_connect( G_OBJECT( entry ), "focus_out_event", G_CALLBACK( fix_rate_entryfocusout ), NULL );
- button = gtk_button_new_with_label( "Free" );
+ button = ui::Button( "Free" );
gtk_widget_show( button );
gtk_table_attach( GTK_TABLE( table ), button, 2, 3, 0, 1,
(GtkAttachOptions) ( GTK_EXPAND ),
(GtkAttachOptions) ( GTK_FILL ), 0, 0 );
- gtk_widget_set_usize( button, 60, -2 );
+ gtk_widget_set_size_request( button, 60, -1 );
g_object_set_data( G_OBJECT( dlg ), "fix_free", button );
g_signal_connect( G_OBJECT( button ), "clicked", G_CALLBACK( fix_free ), NULL );
- button = gtk_button_new_with_label( "Free All" );
+ button = ui::Button( "Free All" );
gtk_widget_show( button );
gtk_table_attach( GTK_TABLE( table ), button, 2, 3, 1, 2,
(GtkAttachOptions) ( GTK_EXPAND ),
(GtkAttachOptions) ( GTK_FILL ), 0, 0 );
- gtk_widget_set_usize( button, 60, -2 );
+ gtk_widget_set_size_request( button, 60, -1 );
g_object_set_data( G_OBJECT( dlg ), "fix_freeall", button );
g_signal_connect( G_OBJECT( button ), "clicked", G_CALLBACK( fix_freeall ), NULL );
- vbox = gtk_vbox_new( FALSE, 10 );
+ vbox = ui::VBox( FALSE, 10 );
gtk_widget_show( vbox );
gtk_container_set_border_width( GTK_CONTAINER( vbox ), 5 );
- label = gtk_label_new( "Texture" );
+ label = ui::Label( "Texture" );
gtk_widget_show( label );
gtk_notebook_append_page( GTK_NOTEBOOK( notebook ), vbox, label );
// ^Fishman - Modified to add more labels and textboxes.
- table = gtk_table_new( 5, 2, FALSE );
+ table = ui::Table( 5, 2, FALSE );
gtk_widget_show( table );
gtk_box_pack_start( GTK_BOX( vbox ), table, FALSE, TRUE, 0 );
gtk_table_set_row_spacings( GTK_TABLE( table ), 5 );
gtk_table_set_col_spacings( GTK_TABLE( table ), 5 );
- label = gtk_label_new( "Surface:" );
+ label = ui::Label( "Surface:" );
gtk_widget_show( label );
gtk_table_attach( GTK_TABLE( table ), label, 0, 1, 0, 1,
(GtkAttachOptions) ( GTK_FILL ),
(GtkAttachOptions) ( GTK_FILL ), 0, 0 );
gtk_misc_set_alignment( GTK_MISC( label ), 1, 0.5 );
- label = gtk_label_new( "Other:" );
+ label = ui::Label( "Other:" );
gtk_widget_show( label );
gtk_table_attach( GTK_TABLE( table ), label, 0, 1, 1, 2,
(GtkAttachOptions) ( GTK_FILL ),
(GtkAttachOptions) ( GTK_FILL ), 0, 0 );
gtk_misc_set_alignment( GTK_MISC( label ), 1, 0.5 );
- label = gtk_label_new( "Steep:" );
+ label = ui::Label( "Steep:" );
gtk_widget_show( label );
gtk_table_attach( GTK_TABLE( table ), label, 0, 1, 2, 3,
(GtkAttachOptions) ( GTK_FILL ),
(GtkAttachOptions) ( GTK_FILL ), 0, 0 );
gtk_misc_set_alignment( GTK_MISC( label ), 1, 0.5 );
- entry = gtk_entry_new();
+ entry = ui::Entry();
gtk_widget_show( entry );
gtk_table_attach( GTK_TABLE( table ), entry, 1, 2, 0, 1,
(GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ),
(GtkAttachOptions) ( GTK_FILL ), 0, 0 );
- gtk_widget_set_usize( entry, 60, -2 );
+ gtk_widget_set_size_request( entry, 60, -1 );
g_object_set_data( G_OBJECT( dlg ), "texture1", entry );
g_signal_connect( G_OBJECT( entry ), "focus_out_event", G_CALLBACK( texture_entryfocusout ), GINT_TO_POINTER( 0 ) );
- entry = gtk_entry_new();
+ entry = ui::Entry();
gtk_widget_show( entry );
gtk_table_attach( GTK_TABLE( table ), entry, 1, 2, 1, 2,
(GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ),
(GtkAttachOptions) ( GTK_FILL ), 0, 0 );
- gtk_widget_set_usize( entry, 60, -2 );
+ gtk_widget_set_size_request( entry, 60, -1 );
g_object_set_data( G_OBJECT( dlg ), "texture2", entry );
g_signal_connect( G_OBJECT( entry ), "focus_out_event", G_CALLBACK( texture_entryfocusout ), GINT_TO_POINTER( 1 ) );
- entry = gtk_entry_new();
+ entry = ui::Entry();
gtk_widget_show( entry );
gtk_table_attach( GTK_TABLE( table ), entry, 1, 2, 2, 3,
(GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ),
(GtkAttachOptions) ( GTK_FILL ), 0, 0 );
- gtk_widget_set_usize( entry, 60, -2 );
+ gtk_widget_set_size_request( entry, 60, -1 );
g_object_set_data( G_OBJECT( dlg ), "texture3", entry );
- hbox2 = gtk_hbox_new( FALSE, 5 );
+ hbox2 = ui::HBox( FALSE, 5 );
gtk_widget_show( hbox2 );
gtk_box_pack_start( GTK_BOX( vbox ), hbox2, FALSE, TRUE, 0 );
- label = gtk_label_new( "\"Steep\" angle:" );
+ label = ui::Label( "\"Steep\" angle:" );
gtk_widget_show( label );
gtk_box_pack_start( GTK_BOX( hbox2 ), label, FALSE, TRUE, 0 );
- adj = gtk_adjustment_new( 60, 0, 90, 1, 10, 0 );
- spin = gtk_spin_button_new( GTK_ADJUSTMENT( adj ), 1, 0 );
+ adj = ui::Adjustment( 60, 0, 90, 1, 10, 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 );
- table = gtk_table_new( 2, 4, TRUE );
+ table = ui::Table( 2, 4, TRUE );
gtk_widget_show( table );
gtk_box_pack_start( GTK_BOX( vbox ), table, FALSE, TRUE, 0 );
gtk_table_set_row_spacings( GTK_TABLE( table ), 5 );
gtk_table_set_col_spacings( GTK_TABLE( table ), 5 );
- label = gtk_label_new( "Offset <h,v>" );
+ label = ui::Label( "Offset <h,v>" );
gtk_widget_show( label );
gtk_table_attach( GTK_TABLE( table ), label, 0, 2, 0, 1,
(GtkAttachOptions) ( GTK_FILL ),
(GtkAttachOptions) ( GTK_FILL ), 0, 0 );
- label = gtk_label_new( "Scale <h,v>" );
+ label = ui::Label( "Scale <h,v>" );
gtk_widget_show( label );
gtk_table_attach( GTK_TABLE( table ), label, 2, 4, 0, 1,
(GtkAttachOptions) ( GTK_FILL ),
(GtkAttachOptions) ( GTK_FILL ), 0, 0 );
- entry = gtk_entry_new();
+ entry = ui::Entry();
gtk_widget_show( entry );
gtk_table_attach( GTK_TABLE( table ), entry, 0, 1, 1, 2,
(GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ),
(GtkAttachOptions) ( GTK_FILL ), 0, 0 );
- gtk_widget_set_usize( entry, 60, -2 );
+ gtk_widget_set_size_request( entry, 60, -1 );
g_object_set_data( G_OBJECT( dlg ), "texoffsetx", entry );
- entry = gtk_entry_new();
+ entry = ui::Entry();
gtk_widget_show( entry );
gtk_table_attach( GTK_TABLE( table ), entry, 1, 2, 1, 2,
(GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ),
(GtkAttachOptions) ( GTK_FILL ), 0, 0 );
- gtk_widget_set_usize( entry, 60, -2 );
+ gtk_widget_set_size_request( entry, 60, -1 );
g_object_set_data( G_OBJECT( dlg ), "texoffsety", entry );
- entry = gtk_entry_new();
+ entry = ui::Entry();
gtk_widget_show( entry );
gtk_table_attach( GTK_TABLE( table ), entry, 2, 3, 1, 2,
(GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ),
(GtkAttachOptions) ( GTK_FILL ), 0, 0 );
- gtk_widget_set_usize( entry, 60, -2 );
+ gtk_widget_set_size_request( entry, 60, -1 );
g_object_set_data( G_OBJECT( dlg ), "texscalex", entry );
- entry = gtk_entry_new();
+ entry = ui::Entry();
gtk_widget_show( entry );
gtk_table_attach( GTK_TABLE( table ), entry, 3, 4, 1, 2,
(GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ),
(GtkAttachOptions) ( GTK_FILL ), 0, 0 );
- gtk_widget_set_usize( entry, 60, -2 );
+ gtk_widget_set_size_request( entry, 60, -1 );
g_object_set_data( G_OBJECT( dlg ), "texscaley", entry );
- 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 );
g_signal_connect( G_OBJECT( check ), "toggled", G_CALLBACK( texture_terrainent ), NULL );
- vbox = gtk_vbox_new( FALSE, 5 );
+ vbox = ui::VBox( FALSE, 5 );
gtk_widget_show( vbox );
gtk_box_pack_start( GTK_BOX( hbox ), vbox, FALSE, TRUE, 0 );
- button = gtk_button_new_with_label( "OK" );
+ button = ui::Button( "OK" );
gtk_widget_show( button );
gtk_box_pack_start( GTK_BOX( vbox ), button, FALSE, TRUE, 0 );
- gtk_widget_set_usize( button, 60, -2 );
+ gtk_widget_set_size_request( button, 60, -1 );
g_object_set_data( G_OBJECT( dlg ), "go", button );
g_signal_connect( G_OBJECT( button ), "clicked", G_CALLBACK( main_go ), NULL );
- label = gtk_label_new( "Settings:" );
+ label = ui::Label( "Settings:" );
gtk_widget_show( label );
gtk_box_pack_start( GTK_BOX( vbox ), label, FALSE, TRUE, 0 );
- button = gtk_button_new_with_label( "Open..." );
+ button = ui::Button( "Open..." );
gtk_widget_show( button );
gtk_box_pack_start( GTK_BOX( vbox ), button, FALSE, TRUE, 0 );
g_object_set_data( G_OBJECT( dlg ), "open", button );
g_signal_connect( G_OBJECT( button ), "clicked", G_CALLBACK( main_open ), NULL );
- button = gtk_button_new_with_label( "Save as..." );
+ button = ui::Button( "Save as..." );
gtk_widget_show( button );
gtk_box_pack_start( GTK_BOX( vbox ), button, FALSE, TRUE, 0 );
g_object_set_data( G_OBJECT( dlg ), "save", button );
g_signal_connect( G_OBJECT( button ), "clicked", G_CALLBACK( main_save ), NULL );
- button = gtk_button_new_with_label( "Defaults" );
+ button = ui::Button( "Defaults" );
gtk_widget_show( button );
gtk_box_pack_start( GTK_BOX( vbox ), button, FALSE, TRUE, 0 );
g_object_set_data( G_OBJECT( dlg ), "defaults", button );
g_signal_connect( G_OBJECT( button ), "clicked", G_CALLBACK( main_defaults ), NULL );
- button = gtk_button_new_with_label( "About..." );
+ button = ui::Button( "About..." );
gtk_widget_show( button );
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 );
}
void UpdatePreview( bool DataChange ){
- if ( g_pWndPreview && GTK_WIDGET_VISIBLE( g_pWndPreview ) ) {
+ if ( g_pWndPreview && gtk_widget_get_visible( g_pWndPreview ) ) {
if ( DataChange ) {
GenerateXYZ();
}
azimuth = PI / 6.;
#endif
- g_pWndPreview = dlg = gtk_window_new( GTK_WINDOW_TOPLEVEL );
+ g_pWndPreview = dlg = ui::Window( ui::window_type::TOP );
gtk_window_set_title( GTK_WINDOW( dlg ), "GtkGenSurf Preview" );
- gtk_signal_connect( GTK_OBJECT( dlg ), "delete_event", GTK_SIGNAL_FUNC( preview_close ), NULL );
- gtk_signal_connect( GTK_OBJECT( dlg ), "destroy", GTK_SIGNAL_FUNC( gtk_widget_destroy ), NULL );
+ g_signal_connect( GTK_OBJECT( dlg ), "delete_event", G_CALLBACK( preview_close ), NULL );
+ g_signal_connect( GTK_OBJECT( dlg ), "destroy", G_CALLBACK( gtk_widget_destroy ), NULL );
gtk_window_set_transient_for( GTK_WINDOW( dlg ), GTK_WINDOW( g_pWnd ) );
gtk_window_set_default_size( GTK_WINDOW( dlg ), 300, 400 );
- vbox = gtk_vbox_new( FALSE, 5 );
+ vbox = ui::VBox( FALSE, 5 );
gtk_widget_show( vbox );
gtk_container_add( GTK_CONTAINER( dlg ), vbox );
#ifndef ISOMETRIC
- hbox = gtk_hbox_new( TRUE, 5 );
+ hbox = ui::HBox( TRUE, 5 );
gtk_widget_show( hbox );
gtk_box_pack_start( GTK_BOX( vbox ), hbox, FALSE, TRUE, 0 );
gtk_container_set_border_width( GTK_CONTAINER( hbox ), 3 );
- label = gtk_label_new( "Elevation" );
+ label = ui::Label( "Elevation" );
gtk_widget_show( label );
gtk_misc_set_alignment( GTK_MISC( label ), 1, 0.5 );
gtk_box_pack_start( GTK_BOX( hbox ), label, FALSE, TRUE, 0 );
- adj = gtk_adjustment_new( 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 );
+ adj = ui::Adjustment( 30, -90, 90, 1, 10, 0 );
+ g_signal_connect( adj, "value_changed", G_CALLBACK( preview_spin ), &elevation );
+ 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 = gtk_adjustment_new( 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 );
+ adj = ui::Adjustment( 30, 0, 359, 1, 10, 0 );
+ g_signal_connect( adj, "value_changed", G_CALLBACK( preview_spin ), &azimuth );
+ 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 );
- label = gtk_label_new( "Azimuth" );
+ label = ui::Label( "Azimuth" );
gtk_widget_show( label );
gtk_misc_set_alignment( GTK_MISC( label ), 1, 0.5 );
gtk_box_pack_end( GTK_BOX( hbox ), label, FALSE, TRUE, 0 );
g_signal_connect( G_OBJECT( spin ), "focus_out_event", G_CALLBACK( doublevariable_spinfocusout ), &azimuth );
#endif
- frame = gtk_frame_new( NULL );
+ frame = ui::Frame( nullptr );
gtk_widget_show( frame );
gtk_frame_set_shadow_type( GTK_FRAME( frame ), GTK_SHADOW_IN );
gtk_box_pack_start( GTK_BOX( vbox ), frame, TRUE, TRUE, 0 );
g_pPreviewWidget = g_UIGtkTable.m_pfn_glwidget_new( FALSE, NULL );
gtk_widget_set_events( g_pPreviewWidget, GDK_EXPOSURE_MASK | GDK_BUTTON_PRESS_MASK | GDK_POINTER_MOTION_MASK );
- gtk_signal_connect( GTK_OBJECT( g_pPreviewWidget ), "expose_event", GTK_SIGNAL_FUNC( expose ), NULL );
- gtk_signal_connect( GTK_OBJECT( g_pPreviewWidget ), "motion_notify_event", GTK_SIGNAL_FUNC( motion ), NULL );
- gtk_signal_connect( GTK_OBJECT( g_pPreviewWidget ), "button_press_event",
- GTK_SIGNAL_FUNC( button_press ), NULL );
+ g_signal_connect( GTK_OBJECT( g_pPreviewWidget ), "expose_event", G_CALLBACK( expose ), NULL );
+ g_signal_connect( GTK_OBJECT( g_pPreviewWidget ), "motion_notify_event", G_CALLBACK( motion ), NULL );
+ g_signal_connect( GTK_OBJECT( g_pPreviewWidget ), "button_press_event",
+ G_CALLBACK( button_press ), NULL );
gtk_widget_show( g_pPreviewWidget );
gtk_container_add( GTK_CONTAINER( frame ), g_pPreviewWidget );
GtkWidget *window, *w, *vbox, *hbox;
int mode = ( uType & MB_TYPEMASK ), ret, loop = 1;
- window = gtk_window_new( GTK_WINDOW_TOPLEVEL );
- gtk_signal_connect( GTK_OBJECT( window ), "delete_event",
- GTK_SIGNAL_FUNC( dialog_delete_callback ), NULL );
- gtk_signal_connect( GTK_OBJECT( window ), "destroy",
- GTK_SIGNAL_FUNC( gtk_widget_destroy ), NULL );
+ window = ui::Window( ui::window_type::TOP );
+ g_signal_connect( GTK_OBJECT( window ), "delete_event",
+ G_CALLBACK( dialog_delete_callback ), NULL );
+ g_signal_connect( GTK_OBJECT( window ), "destroy",
+ G_CALLBACK( gtk_widget_destroy ), NULL );
gtk_window_set_title( GTK_WINDOW( window ), lpCaption );
- gtk_container_border_width( GTK_CONTAINER( window ), 10 );
+ gtk_container_set_border_width( GTK_CONTAINER( window ), 10 );
gtk_object_set_data( GTK_OBJECT( window ), "loop", &loop );
gtk_object_set_data( GTK_OBJECT( window ), "ret", &ret );
gtk_widget_realize( window );
- vbox = gtk_vbox_new( FALSE, 10 );
+ vbox = ui::VBox( FALSE, 10 );
gtk_container_add( GTK_CONTAINER( window ), vbox );
gtk_widget_show( vbox );
- w = gtk_label_new( lpText );
+ w = ui::Label( lpText );
gtk_box_pack_start( GTK_BOX( vbox ), w, FALSE, FALSE, 2 );
gtk_label_set_justify( GTK_LABEL( w ), GTK_JUSTIFY_LEFT );
gtk_widget_show( w );
gtk_box_pack_start( GTK_BOX( vbox ), w, FALSE, FALSE, 2 );
gtk_widget_show( w );
- hbox = gtk_hbox_new( FALSE, 10 );
+ hbox = ui::HBox( FALSE, 10 );
gtk_box_pack_start( GTK_BOX( vbox ), hbox, FALSE, FALSE, 2 );
gtk_widget_show( hbox );
if ( mode == MB_OK ) {
- w = 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( IDOK ) );
- GTK_WIDGET_SET_FLAGS( w, GTK_CAN_DEFAULT );
+ g_signal_connect( GTK_OBJECT( w ), "clicked",
+ G_CALLBACK( dialog_button_callback ), GINT_TO_POINTER( IDOK ) );
+ gtk_widget_set_can_default( w, true );
gtk_widget_grab_default( w );
gtk_widget_show( w );
ret = IDOK;
}
else if ( mode == MB_OKCANCEL ) {
- w = 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( IDOK ) );
- GTK_WIDGET_SET_FLAGS( w, GTK_CAN_DEFAULT );
+ g_signal_connect( GTK_OBJECT( w ), "clicked",
+ G_CALLBACK( dialog_button_callback ), GINT_TO_POINTER( IDOK ) );
+ gtk_widget_set_can_default( w, true );
gtk_widget_grab_default( w );
gtk_widget_show( w );
- w = 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( IDCANCEL ) );
+ g_signal_connect( GTK_OBJECT( w ), "clicked",
+ G_CALLBACK( dialog_button_callback ), GINT_TO_POINTER( IDCANCEL ) );
gtk_widget_show( w );
ret = IDCANCEL;
}
else if ( mode == MB_YESNOCANCEL ) {
- w = 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( IDYES ) );
- GTK_WIDGET_SET_FLAGS( w, GTK_CAN_DEFAULT );
+ g_signal_connect( GTK_OBJECT( w ), "clicked",
+ G_CALLBACK( dialog_button_callback ), GINT_TO_POINTER( IDYES ) );
+ gtk_widget_set_can_default( w, true );
gtk_widget_grab_default( w );
gtk_widget_show( w );
- w = 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( IDNO ) );
+ g_signal_connect( GTK_OBJECT( w ), "clicked",
+ G_CALLBACK( dialog_button_callback ), GINT_TO_POINTER( IDNO ) );
gtk_widget_show( w );
- w = 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( IDCANCEL ) );
+ g_signal_connect( GTK_OBJECT( w ), "clicked",
+ G_CALLBACK( dialog_button_callback ), GINT_TO_POINTER( IDCANCEL ) );
gtk_widget_show( w );
ret = IDCANCEL;
}
else /* if (mode == MB_YESNO) */
{
- w = 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( IDYES ) );
- GTK_WIDGET_SET_FLAGS( w, GTK_CAN_DEFAULT );
+ g_signal_connect( GTK_OBJECT( w ), "clicked",
+ G_CALLBACK( dialog_button_callback ), GINT_TO_POINTER( IDYES ) );
+ gtk_widget_set_can_default( w, true );
gtk_widget_grab_default( w );
gtk_widget_show( w );
- w = 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( IDNO ) );
+ g_signal_connect( GTK_OBJECT( w ), "clicked",
+ G_CALLBACK( dialog_button_callback ), GINT_TO_POINTER( IDNO ) );
gtk_widget_show( w );
ret = IDNO;
}
#include "AboutDialog.h"
#include <gtk/gtk.h>
#include <gtkutil/pointer.h>
+#include <uilib/uilib.h>
#include "version.h"
#include "gtkutil/pointer.h"
GtkWidget *dlg, *hbox, *vbox, *button, *label;
int loop = 1, ret = IDCANCEL;
- dlg = gtk_window_new( GTK_WINDOW_TOPLEVEL );
+ dlg = ui::Window( ui::window_type::TOP );
gtk_window_set_title( GTK_WINDOW( dlg ), "About Portal Viewer" );
- gtk_signal_connect( GTK_OBJECT( dlg ), "delete_event",
- GTK_SIGNAL_FUNC( dialog_delete_callback ), NULL );
- gtk_signal_connect( GTK_OBJECT( dlg ), "destroy",
- GTK_SIGNAL_FUNC( gtk_widget_destroy ), NULL );
+ g_signal_connect( GTK_OBJECT( dlg ), "delete_event",
+ G_CALLBACK( dialog_delete_callback ), NULL );
+ g_signal_connect( GTK_OBJECT( dlg ), "destroy",
+ G_CALLBACK( gtk_widget_destroy ), NULL );
g_object_set_data( G_OBJECT( dlg ), "loop", &loop );
g_object_set_data( G_OBJECT( dlg ), "ret", &ret );
- hbox = gtk_hbox_new( FALSE, 10 );
+ hbox = ui::HBox( FALSE, 10 );
gtk_widget_show( hbox );
gtk_container_add( GTK_CONTAINER( dlg ), hbox );
gtk_container_set_border_width( GTK_CONTAINER( hbox ), 10 );
- label = gtk_label_new( "Version 1.000\n\n"
+ char const *label_text = "Version 1.000\n\n"
"Gtk port by Leonardo Zide\nleo@lokigames.com\n\n"
"Written by Geoffrey DeWan\ngdewan@prairienet.org\n\n"
"Built against NetRadiant " RADIANT_VERSION "\n"
- __DATE__
- );
+ __DATE__;
gtk_widget_show( label );
gtk_box_pack_start( GTK_BOX( hbox ), label, TRUE, TRUE, 0 );
gtk_label_set_justify( GTK_LABEL( label ), GTK_JUSTIFY_LEFT );
- vbox = gtk_vbox_new( FALSE, 0 );
+ vbox = ui::VBox( FALSE, 0 );
gtk_widget_show( vbox );
gtk_box_pack_start( GTK_BOX( hbox ), vbox, FALSE, FALSE, 0 );
- button = gtk_button_new_with_label( "OK" );
+ button = ui::Button( "OK" );
gtk_widget_show( button );
gtk_box_pack_start( GTK_BOX( vbox ), button, FALSE, FALSE, 0 );
- gtk_signal_connect( GTK_OBJECT( button ), "clicked",
- GTK_SIGNAL_FUNC( dialog_button_callback ), GINT_TO_POINTER( IDOK ) );
- gtk_widget_set_usize( button, 60, -2 );
+ g_signal_connect( GTK_OBJECT( button ), "clicked",
+ G_CALLBACK( dialog_button_callback ), GINT_TO_POINTER( IDOK ) );
+ gtk_widget_set_size_request( button, 60, -1 );
gtk_grab_add( dlg );
gtk_widget_show( dlg );
#include "ConfigDialog.h"
#include <stdio.h>
#include <gtk/gtk.h>
+#include <uilib/uilib.h>
#include "gtkutil/pointer.h"
#include "iscenegraph.h"
static int DoColor( PackedColour *c ){
GtkWidget* dlg;
- double clr[4];
+ GdkColor clr;
int loop = 1, ret = IDCANCEL;
- clr[0] = ( (double)GetRValue( *c ) ) / 255.0;
- clr[1] = ( (double)GetGValue( *c ) ) / 255.0;
- clr[2] = ( (double)GetBValue( *c ) ) / 255.0;
+ clr.red = (guint16) (GetRValue(*c) * (65535 / 255));
+ clr.blue = (guint16) (GetGValue(*c) * (65535 / 255));
+ clr.green = (guint16) (GetBValue(*c) * (65535 / 255));
dlg = gtk_color_selection_dialog_new( "Choose Color" );
- gtk_color_selection_set_color( GTK_COLOR_SELECTION( GTK_COLOR_SELECTION_DIALOG( dlg )->colorsel ), clr );
- gtk_signal_connect( GTK_OBJECT( dlg ), "delete_event",
- GTK_SIGNAL_FUNC( dialog_delete_callback ), NULL );
- gtk_signal_connect( GTK_OBJECT( dlg ), "destroy",
- GTK_SIGNAL_FUNC( gtk_widget_destroy ), NULL );
- gtk_signal_connect( GTK_OBJECT( GTK_COLOR_SELECTION_DIALOG( dlg )->ok_button ), "clicked",
- GTK_SIGNAL_FUNC( dialog_button_callback ), GINT_TO_POINTER( IDOK ) );
- gtk_signal_connect( GTK_OBJECT( GTK_COLOR_SELECTION_DIALOG( dlg )->cancel_button ), "clicked",
- GTK_SIGNAL_FUNC( dialog_button_callback ), GINT_TO_POINTER( IDCANCEL ) );
+ gtk_color_selection_set_current_color( GTK_COLOR_SELECTION( gtk_color_selection_dialog_get_color_selection(GTK_COLOR_SELECTION_DIALOG(dlg)) ), &clr );
+ g_signal_connect( GTK_OBJECT( dlg ), "delete_event",
+ G_CALLBACK( dialog_delete_callback ), NULL );
+ g_signal_connect( GTK_OBJECT( dlg ), "destroy",
+ G_CALLBACK( gtk_widget_destroy ), NULL );
+
+ GtkWidget *ok_button, *cancel_button;
+ g_object_get(dlg, "ok-button", &ok_button, "cancel-button", &cancel_button, nullptr);
+
+ g_signal_connect( GTK_OBJECT(ok_button), "clicked",
+ G_CALLBACK( dialog_button_callback ), GINT_TO_POINTER( IDOK ) );
+ g_signal_connect( GTK_OBJECT(cancel_button), "clicked",
+ G_CALLBACK( dialog_button_callback ), GINT_TO_POINTER( IDCANCEL ) );
g_object_set_data( G_OBJECT( dlg ), "loop", &loop );
g_object_set_data( G_OBJECT( dlg ), "ret", &ret );
while ( loop )
gtk_main_iteration();
- gtk_color_selection_get_color( GTK_COLOR_SELECTION( GTK_COLOR_SELECTION_DIALOG( dlg )->colorsel ), clr );
+ gtk_color_selection_get_current_color( GTK_COLOR_SELECTION( gtk_color_selection_dialog_get_color_selection(GTK_COLOR_SELECTION_DIALOG(dlg)) ), &clr );
gtk_grab_remove( dlg );
gtk_widget_destroy( dlg );
if ( ret == IDOK ) {
- *c = RGB( clr[0] * 255, clr[1] * 255, clr[2] * 255 );
+ *c = RGB( clr.red / (65535 / 255), clr.green / (65535 / 255), clr.blue / (65535 / 255));
}
return ret;
}
static void OnScroll2d( GtkAdjustment *adj, gpointer data ){
- portals.width_2d = static_cast<float>( adj->value );
+ portals.width_2d = static_cast<float>( gtk_adjustment_get_value(adj) );
Set2DText( GTK_WIDGET( data ) );
Portals_shadersChanged();
}
static void OnScroll3d( GtkAdjustment *adj, gpointer data ){
- portals.width_3d = static_cast<float>( adj->value );
+ portals.width_3d = static_cast<float>( gtk_adjustment_get_value(adj) );
Set3DText( GTK_WIDGET( data ) );
SceneChangeNotify();
}
static void OnScrollTrans( GtkAdjustment *adj, gpointer data ){
- portals.trans_3d = static_cast<float>( adj->value );
+ portals.trans_3d = static_cast<float>( gtk_adjustment_get_value(adj) );
Set3DTransText( GTK_WIDGET( data ) );
SceneChangeNotify();
}
static void OnScrollClip( GtkAdjustment *adj, gpointer data ){
- portals.clip_range = static_cast<float>( adj->value );
+ portals.clip_range = static_cast<float>( gtk_adjustment_get_value(adj) );
SetClipText( GTK_WIDGET( data ) );
SceneChangeNotify();
void DoConfigDialog(){
GtkWidget *dlg, *hbox, *vbox, *vbox2, *button, *table, *frame;
- GtkWidget *lw3slider, *lw3label, *lw2slider, *lw2label, *zlist, *menu, *item;
+ GtkWidget *lw3slider, *lw3label, *lw2slider, *lw2label, *item;
GtkWidget *aa2check, *aa3check, *depthcheck, *linescheck, *polyscheck;
GtkWidget *transslider, *translabel, *clipslider, *cliplabel;
GtkWidget *show2check, *show3check, *portalcheck;
int loop = 1, ret = IDCANCEL;
- GtkObject *adj;
- dlg = gtk_window_new( GTK_WINDOW_TOPLEVEL );
+ dlg = ui::Window( ui::window_type::TOP );
gtk_window_set_title( GTK_WINDOW( dlg ), "Portal Viewer Configuration" );
- gtk_signal_connect( GTK_OBJECT( dlg ), "delete_event",
- GTK_SIGNAL_FUNC( dialog_delete_callback ), NULL );
- gtk_signal_connect( GTK_OBJECT( dlg ), "destroy",
- GTK_SIGNAL_FUNC( gtk_widget_destroy ), NULL );
+ g_signal_connect( GTK_OBJECT( dlg ), "delete_event",
+ G_CALLBACK( dialog_delete_callback ), NULL );
+ g_signal_connect( GTK_OBJECT( dlg ), "destroy",
+ G_CALLBACK( gtk_widget_destroy ), NULL );
g_object_set_data( G_OBJECT( dlg ), "loop", &loop );
g_object_set_data( G_OBJECT( dlg ), "ret", &ret );
- vbox = gtk_vbox_new( FALSE, 5 );
+ vbox = ui::VBox( FALSE, 5 );
gtk_widget_show( vbox );
gtk_container_add( GTK_CONTAINER( dlg ), vbox );
gtk_container_set_border_width( GTK_CONTAINER( vbox ), 5 );
- frame = gtk_frame_new( "3D View" );
+ frame = ui::Frame( "3D View" );
gtk_widget_show( frame );
gtk_box_pack_start( GTK_BOX( vbox ), frame, TRUE, TRUE, 0 );
- vbox2 = gtk_vbox_new( FALSE, 5 );
+ vbox2 = ui::VBox( FALSE, 5 );
gtk_widget_show( vbox2 );
gtk_container_add( GTK_CONTAINER( frame ), vbox2 );
gtk_container_set_border_width( GTK_CONTAINER( vbox2 ), 5 );
- hbox = gtk_hbox_new( FALSE, 5 );
+ hbox = ui::HBox( FALSE, 5 );
gtk_widget_show( hbox );
gtk_box_pack_start( GTK_BOX( vbox2 ), hbox, TRUE, TRUE, 0 );
- adj = gtk_adjustment_new( portals.width_3d, 2, 40, 1, 1, 0 );
- lw3slider = gtk_hscale_new( GTK_ADJUSTMENT( adj ) );
+ auto adj = ui::Adjustment( portals.width_3d, 2, 40, 1, 1, 0 );
+ lw3slider = ui::HScale( adj );
gtk_widget_show( lw3slider );
gtk_box_pack_start( GTK_BOX( hbox ), lw3slider, TRUE, TRUE, 0 );
gtk_scale_set_draw_value( GTK_SCALE( lw3slider ), FALSE );
- lw3label = gtk_label_new( "" );
+ lw3label = ui::Label( "" );
gtk_widget_show( lw3label );
gtk_box_pack_start( GTK_BOX( hbox ), lw3label, FALSE, TRUE, 0 );
- gtk_signal_connect( adj, "value_changed", GTK_SIGNAL_FUNC( OnScroll3d ), lw3label );
+ g_signal_connect( GTK_OBJECT(adj), "value_changed", G_CALLBACK( OnScroll3d ), lw3label );
- table = gtk_table_new( 2, 4, FALSE );
+ table = ui::Table( 2, 4, FALSE );
gtk_widget_show( table );
gtk_box_pack_start( GTK_BOX( vbox2 ), table, TRUE, TRUE, 0 );
gtk_table_set_row_spacings( GTK_TABLE( table ), 5 );
gtk_table_set_col_spacings( GTK_TABLE( table ), 5 );
- button = gtk_button_new_with_label( "Color" );
+ button = ui::Button( "Color" );
gtk_widget_show( button );
gtk_table_attach( GTK_TABLE( table ), button, 0, 1, 0, 1,
(GtkAttachOptions) ( GTK_FILL ),
(GtkAttachOptions) ( 0 ), 0, 0 );
- gtk_signal_connect( GTK_OBJECT( button ), "clicked", GTK_SIGNAL_FUNC( OnColor3d ), NULL );
+ g_signal_connect( GTK_OBJECT( button ), "clicked", G_CALLBACK( OnColor3d ), NULL );
- button = gtk_button_new_with_label( "Depth Color" );
+ button = ui::Button( "Depth Color" );
gtk_widget_show( button );
gtk_table_attach( GTK_TABLE( table ), button, 0, 1, 1, 2,
(GtkAttachOptions) ( GTK_FILL ),
(GtkAttachOptions) ( 0 ), 0, 0 );
- gtk_signal_connect( GTK_OBJECT( button ), "clicked", GTK_SIGNAL_FUNC( OnColorFog ), NULL );
+ g_signal_connect( GTK_OBJECT( button ), "clicked", G_CALLBACK( 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 );
+ g_signal_connect( GTK_OBJECT( aa3check ), "toggled", G_CALLBACK( 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 );
+ g_signal_connect( GTK_OBJECT( depthcheck ), "toggled", G_CALLBACK( 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 );
+ g_signal_connect( GTK_OBJECT( linescheck ), "toggled", G_CALLBACK( 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 ),
(GtkAttachOptions) ( 0 ), 0, 0 );
- gtk_signal_connect( GTK_OBJECT( polyscheck ), "toggled", GTK_SIGNAL_FUNC( OnPoly ), NULL );
+ g_signal_connect( GTK_OBJECT( polyscheck ), "toggled", G_CALLBACK( OnPoly ), NULL );
- zlist = gtk_option_menu_new();
+ auto zlist = ui::ComboBoxText();
gtk_widget_show( zlist );
gtk_box_pack_start( GTK_BOX( vbox2 ), zlist, TRUE, FALSE, 0 );
- menu = gtk_menu_new();
- gtk_widget_show( menu );
- gtk_option_menu_set_menu( GTK_OPTION_MENU( zlist ), menu );
-
- item = gtk_menu_item_new_with_label( "Z-Buffer Test and Write (recommended for solid or no polygons)" );
- gtk_widget_show( item );
- gtk_signal_connect( GTK_OBJECT( item ), "activate",
- GTK_SIGNAL_FUNC( OnSelchangeZbuffer ), GINT_TO_POINTER( 0 ) );
- gtk_menu_append( GTK_MENU( menu ), item );
-
- item = gtk_menu_item_new_with_label( "Z-Buffer Test Only (recommended for transparent polygons)" );
- gtk_widget_show( item );
- gtk_signal_connect( GTK_OBJECT( item ), "activate",
- GTK_SIGNAL_FUNC( OnSelchangeZbuffer ), GINT_TO_POINTER( 1 ) );
- gtk_menu_append( GTK_MENU( menu ), item );
-
- item = gtk_menu_item_new_with_label( "Z-Buffer Off" );
- gtk_widget_show( item );
- gtk_signal_connect( GTK_OBJECT( item ), "activate",
- GTK_SIGNAL_FUNC( OnSelchangeZbuffer ), GINT_TO_POINTER( 2 ) );
- gtk_menu_append( GTK_MENU( menu ), item );
-
- table = gtk_table_new( 2, 2, FALSE );
+ gtk_combo_box_text_append_text(zlist, "Z-Buffer Test and Write (recommended for solid or no polygons)");
+ gtk_combo_box_text_append_text(zlist, "Z-Buffer Test Only (recommended for transparent polygons)");
+ gtk_combo_box_text_append_text(zlist, "Z-Buffer Off");
+
+ g_signal_connect(G_OBJECT(zlist), "changed", G_CALLBACK(+[](GtkComboBox *self, void *) {
+ OnSelchangeZbuffer(GTK_WIDGET(self), GINT_TO_POINTER(gtk_combo_box_get_active(self)));
+ }), nullptr);
+
+ table = ui::Table( 2, 2, FALSE );
gtk_widget_show( table );
gtk_box_pack_start( GTK_BOX( vbox2 ), table, TRUE, TRUE, 0 );
gtk_table_set_row_spacings( GTK_TABLE( table ), 5 );
gtk_table_set_col_spacings( GTK_TABLE( table ), 5 );
- adj = gtk_adjustment_new( portals.trans_3d, 0, 100, 1, 1, 0 );
- transslider = gtk_hscale_new( GTK_ADJUSTMENT( adj ) );
+ adj = ui::Adjustment( portals.trans_3d, 0, 100, 1, 1, 0 );
+ transslider = ui::HScale( adj );
gtk_widget_show( transslider );
gtk_table_attach( GTK_TABLE( table ), transslider, 0, 1, 0, 1,
(GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ),
(GtkAttachOptions) ( 0 ), 0, 0 );
gtk_scale_set_draw_value( GTK_SCALE( transslider ), FALSE );
- translabel = gtk_label_new( "" );
+ translabel = ui::Label( "" );
gtk_widget_show( translabel );
gtk_table_attach( GTK_TABLE( table ), translabel, 1, 2, 0, 1,
(GtkAttachOptions) ( GTK_FILL ),
(GtkAttachOptions) ( 0 ), 0, 0 );
gtk_misc_set_alignment( GTK_MISC( translabel ), 0.0, 0.0 );
- gtk_signal_connect( adj, "value_changed", GTK_SIGNAL_FUNC( OnScrollTrans ), translabel );
+ g_signal_connect( GTK_OBJECT(adj), "value_changed", G_CALLBACK( OnScrollTrans ), translabel );
- adj = gtk_adjustment_new( portals.clip_range, 1, 128, 1, 1, 0 );
- clipslider = gtk_hscale_new( GTK_ADJUSTMENT( adj ) );
+ adj = ui::Adjustment( portals.clip_range, 1, 128, 1, 1, 0 );
+ clipslider = ui::HScale( adj );
gtk_widget_show( clipslider );
gtk_table_attach( GTK_TABLE( table ), clipslider, 0, 1, 1, 2,
(GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ),
(GtkAttachOptions) ( 0 ), 0, 0 );
gtk_scale_set_draw_value( GTK_SCALE( clipslider ), FALSE );
- cliplabel = gtk_label_new( "" );
+ cliplabel = ui::Label( "" );
gtk_widget_show( cliplabel );
gtk_table_attach( GTK_TABLE( table ), cliplabel, 1, 2, 1, 2,
(GtkAttachOptions) ( GTK_FILL ),
(GtkAttachOptions) ( 0 ), 0, 0 );
gtk_misc_set_alignment( GTK_MISC( cliplabel ), 0.0, 0.0 );
- gtk_signal_connect( adj, "value_changed", GTK_SIGNAL_FUNC( OnScrollClip ), cliplabel );
+ g_signal_connect( GTK_OBJECT(adj), "value_changed", G_CALLBACK( OnScrollClip ), cliplabel );
- hbox = gtk_hbox_new( TRUE, 5 );
+ hbox = ui::HBox( TRUE, 5 );
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 );
+ g_signal_connect( GTK_OBJECT( show3check ), "toggled", G_CALLBACK( 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 );
+ g_signal_connect( GTK_OBJECT( portalcheck ), "toggled", G_CALLBACK( OnClip ), NULL );
- frame = gtk_frame_new( "2D View" );
+ frame = ui::Frame( "2D View" );
gtk_widget_show( frame );
gtk_box_pack_start( GTK_BOX( vbox ), frame, TRUE, TRUE, 0 );
- vbox2 = gtk_vbox_new( FALSE, 5 );
+ vbox2 = ui::VBox( FALSE, 5 );
gtk_widget_show( vbox2 );
gtk_container_add( GTK_CONTAINER( frame ), vbox2 );
gtk_container_set_border_width( GTK_CONTAINER( vbox2 ), 5 );
- hbox = gtk_hbox_new( FALSE, 5 );
+ hbox = ui::HBox( FALSE, 5 );
gtk_widget_show( hbox );
gtk_box_pack_start( GTK_BOX( vbox2 ), hbox, TRUE, FALSE, 0 );
- adj = gtk_adjustment_new( portals.width_2d, 2, 40, 1, 1, 0 );
- lw2slider = gtk_hscale_new( GTK_ADJUSTMENT( adj ) );
+ adj = ui::Adjustment( portals.width_2d, 2, 40, 1, 1, 0 );
+ lw2slider = ui::HScale( adj );
gtk_widget_show( lw2slider );
gtk_box_pack_start( GTK_BOX( hbox ), lw2slider, TRUE, TRUE, 0 );
gtk_scale_set_draw_value( GTK_SCALE( lw2slider ), FALSE );
- lw2label = gtk_label_new( "" );
+ lw2label = ui::Label( "" );
gtk_widget_show( lw2label );
gtk_box_pack_start( GTK_BOX( hbox ), lw2label, FALSE, TRUE, 0 );
- gtk_signal_connect( adj, "value_changed", GTK_SIGNAL_FUNC( OnScroll2d ), lw2label );
+ g_signal_connect( GTK_OBJECT(adj), "value_changed", G_CALLBACK( OnScroll2d ), lw2label );
- hbox = gtk_hbox_new( FALSE, 5 );
+ hbox = ui::HBox( FALSE, 5 );
gtk_widget_show( hbox );
gtk_box_pack_start( GTK_BOX( vbox2 ), hbox, TRUE, FALSE, 0 );
- button = gtk_button_new_with_label( "Color" );
+ button = ui::Button( "Color" );
gtk_widget_show( button );
gtk_box_pack_start( GTK_BOX( hbox ), button, FALSE, FALSE, 0 );
- gtk_signal_connect( GTK_OBJECT( button ), "clicked", GTK_SIGNAL_FUNC( OnColor2d ), NULL );
- gtk_widget_set_usize( button, 60, -2 );
+ g_signal_connect( GTK_OBJECT( button ), "clicked", G_CALLBACK( OnColor2d ), NULL );
+ gtk_widget_set_size_request( button, 60, -1 );
- 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 );
+ g_signal_connect( GTK_OBJECT( aa2check ), "toggled", G_CALLBACK( OnAntiAlias2d ), NULL );
- hbox = gtk_hbox_new( FALSE, 5 );
+ hbox = ui::HBox( FALSE, 5 );
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 );
+ g_signal_connect( GTK_OBJECT( show2check ), "toggled", G_CALLBACK( OnConfig2d ), NULL );
- hbox = gtk_hbox_new( FALSE, 5 );
+ hbox = ui::HBox( FALSE, 5 );
gtk_widget_show( hbox );
gtk_box_pack_start( GTK_BOX( vbox ), hbox, FALSE, FALSE, 0 );
- button = gtk_button_new_with_label( "OK" );
+ button = ui::Button( "OK" );
gtk_widget_show( button );
gtk_box_pack_end( GTK_BOX( hbox ), button, FALSE, FALSE, 0 );
- gtk_signal_connect( GTK_OBJECT( button ), "clicked",
- GTK_SIGNAL_FUNC( dialog_button_callback ), GINT_TO_POINTER( IDOK ) );
- gtk_widget_set_usize( button, 60, -2 );
+ g_signal_connect( GTK_OBJECT( button ), "clicked",
+ G_CALLBACK( dialog_button_callback ), GINT_TO_POINTER( IDOK ) );
+ gtk_widget_set_size_request( button, 60, -1 );
// initialize dialog
gtk_toggle_button_set_active( GTK_TOGGLE_BUTTON( show2check ), portals.show_2d );
gtk_toggle_button_set_active( GTK_TOGGLE_BUTTON( polyscheck ), portals.polygons );
gtk_toggle_button_set_active( GTK_TOGGLE_BUTTON( linescheck ), portals.lines );
gtk_toggle_button_set_active( GTK_TOGGLE_BUTTON( aa3check ), portals.aa_3d );
- gtk_option_menu_set_history( GTK_OPTION_MENU( zlist ), portals.zbuffer );
+ gtk_combo_box_set_active(zlist, portals.zbuffer);
gtk_toggle_button_set_active( GTK_TOGGLE_BUTTON( portalcheck ), portals.clip );
Set3DText( lw3label );
return TRUE;
}
-static void file_sel_callback( GtkWidget *widget, gpointer data ){
- GtkWidget *parent;
- int *loop;
- char **filename;
-
- parent = gtk_widget_get_toplevel( widget );
- loop = (int*)g_object_get_data( G_OBJECT( parent ), "loop" );
- filename = (char**)g_object_get_data( G_OBJECT( parent ), "filename" );
-
- *loop = 0;
- if ( gpointer_to_int( data ) == IDOK ) {
- *filename = g_strdup( gtk_file_selection_get_filename( GTK_FILE_SELECTION( parent ) ) );
- }
-}
-
static void change_clicked( GtkWidget *widget, gpointer data ){
GtkWidget* file_sel;
char* filename = NULL;
- int loop = 1;
- file_sel = gtk_file_selection_new( "Locate portal (.prt) file" );
- gtk_signal_connect( GTK_OBJECT( GTK_FILE_SELECTION( file_sel )->ok_button ), "clicked",
- GTK_SIGNAL_FUNC( file_sel_callback ), GINT_TO_POINTER( IDOK ) );
- gtk_signal_connect( GTK_OBJECT( GTK_FILE_SELECTION( file_sel )->cancel_button ), "clicked",
- GTK_SIGNAL_FUNC( file_sel_callback ), GINT_TO_POINTER( IDCANCEL ) );
- gtk_signal_connect( GTK_OBJECT( file_sel ), "delete_event",
- GTK_SIGNAL_FUNC( dialog_delete_callback ), NULL );
- gtk_file_selection_hide_fileop_buttons( GTK_FILE_SELECTION( file_sel ) );
+ file_sel = gtk_file_chooser_dialog_new ( "Locate portal (.prt) file", nullptr, GTK_FILE_CHOOSER_ACTION_OPEN,
+ GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
+ GTK_STOCK_OPEN, GTK_RESPONSE_ACCEPT,
+ nullptr);
- g_object_set_data( G_OBJECT( file_sel ), "loop", &loop );
- g_object_set_data( G_OBJECT( file_sel ), "filename", &filename );
- gtk_file_selection_set_filename( GTK_FILE_SELECTION( file_sel ), portals.fn );
+ gtk_file_chooser_set_filename( GTK_FILE_CHOOSER(file_sel), portals.fn );
- gtk_grab_add( file_sel );
- gtk_widget_show( file_sel );
-
- while ( loop )
- gtk_main_iteration();
-
- gtk_grab_remove( file_sel );
- gtk_widget_destroy( file_sel );
+ if (gtk_dialog_run (GTK_DIALOG (file_sel)) == GTK_RESPONSE_ACCEPT)
+ {
+ filename = gtk_file_chooser_get_filename (GTK_FILE_CHOOSER (file_sel));
+ }
+ gtk_widget_destroy (file_sel);
if ( filename != NULL ) {
strcpy( portals.fn, filename );
GtkWidget *dlg, *vbox, *hbox, *button, *entry, *check2d, *check3d;
int loop = 1, ret = IDCANCEL;
- dlg = gtk_window_new( GTK_WINDOW_TOPLEVEL );
+ dlg = ui::Window( ui::window_type::TOP );
gtk_window_set_title( GTK_WINDOW( dlg ), "Load .prt" );
- gtk_signal_connect( GTK_OBJECT( dlg ), "delete_event",
- GTK_SIGNAL_FUNC( dialog_delete_callback ), NULL );
- gtk_signal_connect( GTK_OBJECT( dlg ), "destroy",
- GTK_SIGNAL_FUNC( gtk_widget_destroy ), NULL );
+ g_signal_connect( GTK_OBJECT( dlg ), "delete_event",
+ G_CALLBACK( dialog_delete_callback ), NULL );
+ g_signal_connect( GTK_OBJECT( dlg ), "destroy",
+ G_CALLBACK( gtk_widget_destroy ), NULL );
g_object_set_data( G_OBJECT( dlg ), "loop", &loop );
g_object_set_data( G_OBJECT( dlg ), "ret", &ret );
- vbox = gtk_vbox_new( FALSE, 5 );
+ vbox = ui::VBox( FALSE, 5 );
gtk_widget_show( vbox );
gtk_container_add( GTK_CONTAINER( dlg ), vbox );
gtk_container_set_border_width( GTK_CONTAINER( vbox ), 5 );
- entry = gtk_entry_new();
+ entry = ui::Entry();
gtk_widget_show( entry );
- gtk_entry_set_editable( GTK_ENTRY( entry ), FALSE );
+ gtk_editable_set_editable( GTK_EDITABLE( entry ), FALSE );
gtk_box_pack_start( GTK_BOX( vbox ), entry, FALSE, FALSE, 0 );
- hbox = gtk_hbox_new( FALSE, 5 );
+ hbox = ui::HBox( FALSE, 5 );
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 = gtk_button_new_with_label( "Change" );
+ button = ui::Button( "Change" );
gtk_widget_show( button );
gtk_box_pack_end( GTK_BOX( hbox ), button, FALSE, FALSE, 0 );
- gtk_signal_connect( GTK_OBJECT( button ), "clicked", GTK_SIGNAL_FUNC( change_clicked ), entry );
- gtk_widget_set_usize( button, 60, -2 );
+ g_signal_connect( GTK_OBJECT( button ), "clicked", G_CALLBACK( change_clicked ), entry );
+ gtk_widget_set_size_request( button, 60, -1 );
- hbox = gtk_hbox_new( FALSE, 5 );
+ hbox = ui::HBox( FALSE, 5 );
gtk_widget_show( hbox );
gtk_box_pack_start( GTK_BOX( vbox ), hbox, FALSE, FALSE, 0 );
- button = gtk_button_new_with_label( "Cancel" );
+ button = ui::Button( "Cancel" );
gtk_widget_show( button );
gtk_box_pack_end( GTK_BOX( hbox ), button, FALSE, FALSE, 0 );
- gtk_signal_connect( GTK_OBJECT( button ), "clicked",
- GTK_SIGNAL_FUNC( dialog_button_callback ), GINT_TO_POINTER( IDCANCEL ) );
- gtk_widget_set_usize( button, 60, -2 );
+ g_signal_connect( GTK_OBJECT( button ), "clicked",
+ G_CALLBACK( dialog_button_callback ), GINT_TO_POINTER( IDCANCEL ) );
+ gtk_widget_set_size_request( button, 60, -1 );
- button = gtk_button_new_with_label( "OK" );
+ button = ui::Button( "OK" );
gtk_widget_show( button );
gtk_box_pack_end( GTK_BOX( hbox ), button, FALSE, FALSE, 0 );
- gtk_signal_connect( GTK_OBJECT( button ), "clicked",
- GTK_SIGNAL_FUNC( dialog_button_callback ), GINT_TO_POINTER( IDOK ) );
- gtk_widget_set_usize( button, 60, -2 );
+ g_signal_connect( GTK_OBJECT( button ), "clicked",
+ G_CALLBACK( dialog_button_callback ), GINT_TO_POINTER( IDOK ) );
+ gtk_widget_set_size_request( button, 60, -1 );
strcpy( portals.fn, GlobalRadiant().getMapName() );
char* fn = strrchr( portals.fn, '.' );
namespace Shaderplug
{
-GtkWindow* g_window;
+ui::Window g_window;
std::vector<const char*> archives;
std::set<std::string> shaders;
void CreateTagFile();
const char* init( void* hApp, void* pMainWidget ){
- g_window = GTK_WINDOW( pMainWidget );
+ g_window = ui::Window(GTK_WINDOW( pMainWidget ));
return "";
}
const char* getName(){
}
void dispatch( const char* command, float* vMin, float* vMax, bool bSingleBrush ){
if ( string_equal( command, "About" ) ) {
- GlobalRadiant().m_pfnMessageBox( GTK_WIDGET( g_window ), "Shaderplug (1.0)\n\n"
+ GlobalRadiant().m_pfnMessageBox( g_window, "Shaderplug (1.0)\n\n"
"by Shaderman (shaderman@gmx.net)",
"About",
eMB_OK,
strcat( message, "\nPlease restart Radiant now.\n" );
if ( file_exists( tagFile ) ) {
- EMessageBoxReturn result = GlobalRadiant().m_pfnMessageBox( GTK_WIDGET( g_window ),
+ EMessageBoxReturn result = GlobalRadiant().m_pfnMessageBox( g_window ,
"WARNING! A tag file already exists! Overwrite it?", "Overwrite tag file?",
eMB_NOYES,
eMB_ICONWARNING );
if ( result == eIDYES ) {
TagBuilder.SaveXmlDoc( tagFile );
- GlobalRadiant().m_pfnMessageBox( GTK_WIDGET( g_window ), message, "INFO", eMB_OK, eMB_ICONASTERISK );
+ GlobalRadiant().m_pfnMessageBox( g_window, message, "INFO", eMB_OK, eMB_ICONASTERISK );
}
}
else {
TagBuilder.SaveXmlDoc( tagFile );
- GlobalRadiant().m_pfnMessageBox( GTK_WIDGET( g_window ), message, "INFO", eMB_OK, eMB_ICONASTERISK );
+ GlobalRadiant().m_pfnMessageBox( g_window, message, "INFO", eMB_OK, eMB_ICONASTERISK );
}
}
else {
- GlobalRadiant().m_pfnMessageBox( GTK_WIDGET( g_window ),
+ GlobalRadiant().m_pfnMessageBox( g_window,
"No shaders or textures found. No XML tag file created!\n"
"",
"ERROR",
void about_plugin_window(){
GtkWidget *window, *vbox, *label, *button;
- window = gtk_window_new( GTK_WINDOW_TOPLEVEL ); // create a window
+ window = ui::Window( ui::window_type::TOP ); // create a window
gtk_window_set_transient_for( GTK_WINDOW( window ), SunPlug::main_window ); // make the window to stay in front of the main window
g_signal_connect( G_OBJECT( window ), "delete_event", G_CALLBACK( delete_event ), NULL ); // connect the delete event
g_signal_connect( G_OBJECT( window ), "destroy", G_CALLBACK( destroy ), NULL ); // connect the destroy event for the window
gtk_window_set_modal( GTK_WINDOW( window ), TRUE ); // force the user not to do something with the other windows
gtk_container_set_border_width( GTK_CONTAINER( window ), 10 ); // set the border of the window
- vbox = gtk_vbox_new( FALSE, 10 ); // create a box to arrange new objects vertically
+ vbox = ui::VBox( FALSE, 10 ); // create a box to arrange new objects vertically
gtk_container_add( GTK_CONTAINER( window ), vbox ); // add the box to the window
- label = gtk_label_new( "SunPlug v1.0 for NetRadiant 1.5\nby Topsun" ); // create a label
+ label = ui::Label( "SunPlug v1.0 for NetRadiant 1.5\nby Topsun" ); // create a label
gtk_label_set_justify( GTK_LABEL( label ), GTK_JUSTIFY_LEFT ); // text align left
gtk_box_pack_start( GTK_BOX( vbox ), label, FALSE, FALSE, 2 ); // insert the label in the box
- button = gtk_button_new_with_label( "OK" ); // create a button with text
+ button = ui::Button( "OK" ); // create a button with text
g_signal_connect_swapped( G_OBJECT( button ), "clicked", G_CALLBACK( gtk_widget_destroy ), window ); // connect the click event to close the window
gtk_box_pack_start( GTK_BOX( vbox ), button, FALSE, FALSE, 2 ); // insert the button in the box
// 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];
// in any case we need a window to show the user what to do
- window = gtk_window_new( GTK_WINDOW_TOPLEVEL ); // create the window
+ window = ui::Window( ui::window_type::TOP ); // create the window
gtk_window_set_transient_for( GTK_WINDOW( window ), SunPlug::main_window ); // make the window to stay in front of the main window
g_signal_connect( G_OBJECT( window ), "delete_event", G_CALLBACK( delete_event ), NULL ); // connect the delete event for the window
g_signal_connect( G_OBJECT( window ), "destroy", G_CALLBACK( destroy ), NULL ); // connect the destroy event for the window
gtk_window_set_modal( GTK_WINDOW( window ), TRUE ); // force the user not to do something with the other windows
gtk_container_set_border_width( GTK_CONTAINER( window ), 10 ); // set the border of the window
- vbox = gtk_vbox_new( FALSE, 10 ); // create a box to arrange new objects vertically
+ vbox = ui::VBox( FALSE, 10 ); // create a box to arrange new objects vertically
gtk_container_add( GTK_CONTAINER( window ), vbox ); // add the box to the window
scene::Path path = makeReference( GlobalSceneGraph().root() ); // get the path to the root element of the graph
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 = (GtkAdjustment *)gtk_adjustment_new( map_minX, -65536.0, 65536.0, 1.0, 5.0, 0 ); // create adjustment for value and range of minimum x value
- spinner_adj_MinY = (GtkAdjustment *)gtk_adjustment_new( map_minY, -65536.0, 65536.0, 1.0, 5.0, 0 ); // create adjustment for value and range of minimum y value
- spinner_adj_MaxX = (GtkAdjustment *)gtk_adjustment_new( map_maxX, -65536.0, 65536.0, 1.0, 5.0, 0 ); // create adjustment for value and range of maximum x value
- spinner_adj_MaxY = (GtkAdjustment *)gtk_adjustment_new( 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 = gtk_button_new_with_label( "Get optimal mapcoords" ); // create button with text
+ 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_box_pack_start( GTK_BOX( vbox ), button, FALSE, FALSE, 2 ); // insert button into vbox
gtk_box_pack_start( GTK_BOX( vbox ), gtk_hseparator_new(), FALSE, FALSE, 2 ); // insert separator into vbox
- table = gtk_table_new( 4, 3, TRUE ); // create table
+ table = ui::Table( 4, 3, TRUE ); // create table
gtk_table_set_row_spacings( GTK_TABLE( table ), 8 ); // set row spacings
gtk_table_set_col_spacings( GTK_TABLE( table ), 8 ); // set column spacings
gtk_box_pack_start( GTK_BOX( vbox ), table, FALSE, FALSE, 2 ); // insert table into vbox
- label = gtk_label_new( "x" ); // create label
+ label = ui::Label( "x" ); // 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, 1, 2, 0, 1 ); // insert label into table
- label = gtk_label_new( "y" ); // create label
+ label = ui::Label( "y" ); // 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, 2, 3, 0, 1 ); // insert label into table
- label = gtk_label_new( "mapcoordsmins" ); // create label
+ label = ui::Label( "mapcoordsmins" ); // 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, 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 = gtk_label_new( "mapcoordsmaxs" ); // create label
+ 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
msp.spinner4 = GTK_SPIN_BUTTON( spinnerMaxY );
msp.worldspawn = theWorldspawn;
- button = gtk_button_new_with_label( "Set" ); // create button with text
+ button = ui::Button( "Set" ); // create button with text
g_signal_connect( G_OBJECT( button ), "clicked", G_CALLBACK( set_coordinates ), NULL ); // connect button with callback function
gtk_table_attach_defaults( GTK_TABLE( table ), button, 1, 2, 3, 4 ); // insert button into table
- button = gtk_button_new_with_label( "Cancel" ); // create button with text
+ button = ui::Button( "Cancel" ); // create button with text
g_signal_connect( G_OBJECT( button ), "clicked", G_CALLBACK( close_window ), NULL ); // connect button with callback function
gtk_table_attach_defaults( GTK_TABLE( table ), button, 2, 3, 3, 4 ); // insert button into table
}
else {
globalOutputStream() << "SunPlug: no worldspawn found!\n"; // output error to console
- label = gtk_label_new( "ERROR: No worldspawn was found in the map!\nIn order to use this tool the map must have at least one brush in the worldspawn. " ); // create a label
+ label = ui::Label( "ERROR: No worldspawn was found in the map!\nIn order to use this tool the map must have at least one brush in the worldspawn. " ); // create a label
gtk_label_set_justify( GTK_LABEL( label ), GTK_JUSTIFY_LEFT ); // text align left
gtk_box_pack_start( GTK_BOX( vbox ), label, FALSE, FALSE, 2 ); // insert the label in the box
- button = gtk_button_new_with_label( "OK" ); // create a button with text
+ button = ui::Button( "OK" ); // create a button with text
g_signal_connect( G_OBJECT( button ), "clicked", G_CALLBACK( close_window ), NULL ); // connect the click event to close the window
gtk_box_pack_start( GTK_BOX( vbox ), button, FALSE, FALSE, 2 ); // insert the button in the box
}
namespace UFOAI
{
-GtkWindow* g_mainwnd;
+ ui::Window g_mainwnd;
const char* init( void* hApp, void* pMainWidget ){
- g_mainwnd = GTK_WINDOW( pMainWidget );
+ g_mainwnd = ui::Window(GTK_WINDOW( pMainWidget ));
return "Initializing GTKRadiant UFOAI plugin";
}
const char* getName(){
void dispatch( const char* command, float* vMin, float* vMax, bool bSingleBrush ){
char *message = NULL;
if ( string_equal( command, "About" ) ) {
- GlobalRadiant().m_pfnMessageBox( GTK_WIDGET( g_mainwnd ),
- "UFO:AI Plugin (http://ufoai.sf.net)\nBuild: " __DATE__ "\nRadiant version: " RADIANT_VERSION "\nPlugin version: " PLUGIN_VERSION "\nAuthor: Martin Gerhardy (tlh2000/mattn)\n", "About",
+ char const *version_string = "UFO:AI Plugin (http://ufoai.sf.net)\nBuild: " __DATE__
+ "\nRadiant version: " RADIANT_VERSION
+ "\nPlugin version: " PLUGIN_VERSION
+ "\nAuthor: Martin Gerhardy (tlh2000/mattn)\n";
+ GlobalRadiant().m_pfnMessageBox( g_mainwnd,
+ version_string, "About",
eMB_OK, eMB_ICONDEFAULT );
}
else if ( string_equal( command, "Level 1" ) ) {
}
if ( message != NULL ) {
- GlobalRadiant().m_pfnMessageBox( GTK_WIDGET( g_mainwnd ),
+ GlobalRadiant().m_pfnMessageBox( g_mainwnd,
message, "Note",
eMB_OK, eMB_ICONDEFAULT );
}
eSpace,
eButton,
eToggleButton,
- eRadioButton,
};
virtual const char* getImage() const = 0;
#ifndef __QERPLUGIN_H__
#define __QERPLUGIN_H__
+#include "uilib/uilib.h"
#include "generic/constant.h"
// NOTE: parent can be 0 in all functions but it's best to set them
// this API does not depend on gtk+ or glib
-typedef struct _GtkWidget GtkWidget;
enum EMessageBoxType
{
// simple Message Box, see above for the 'type' flags
-typedef EMessageBoxReturn ( *PFN_QERAPP_MESSAGEBOX )( GtkWidget *parent, const char* text, const char* caption /* = "NetRadiant"*/, EMessageBoxType type /* = eMB_OK*/, EMessageBoxIcon icon /* = eMB_ICONDEFAULT*/ );
+typedef EMessageBoxReturn ( *PFN_QERAPP_MESSAGEBOX )( ui::Widget parent, const char* text, const char* caption /* = "NetRadiant"*/, EMessageBoxType type /* = eMB_OK*/, EMessageBoxIcon icon /* = eMB_ICONDEFAULT*/ );
// file and directory selection functions return null if the user hits cancel
// - 'title' is the dialog title (can be null)
// - 'path' is used to set the initial directory (can be null)
// - 'pattern': the first pattern is for the win32 mode, then comes the Gtk pattern list, see Radiant source for samples
-typedef const char* ( *PFN_QERAPP_FILEDIALOG )( GtkWidget *parent, bool open, const char* title, const char* path /* = 0*/, const char* pattern /* = 0*/, bool want_load /* = false*/, bool want_import /* = false*/, bool want_save /* = false*/ );
+typedef const char* ( *PFN_QERAPP_FILEDIALOG )( ui::Widget parent, bool open, const char* title, const char* path /* = 0*/, const char* pattern /* = 0*/, bool want_load /* = false*/, bool want_import /* = false*/, bool want_save /* = false*/ );
// returns a gchar* string that must be g_free'd by the user
-typedef char* ( *PFN_QERAPP_DIRDIALOG )( GtkWidget *parent, const char* title /* = "Choose Directory"*/, const char* path /* = 0*/ );
+typedef char* ( *PFN_QERAPP_DIRDIALOG )( ui::Widget parent, const char* title /* = "Choose Directory"*/, const char* path /* = 0*/ );
// return true if the user closed the dialog with 'Ok'
// 'color' is used to set the initial value and store the selected value
template<typename Element> class BasicVector3;
typedef BasicVector3<float> Vector3;
-typedef bool ( *PFN_QERAPP_COLORDIALOG )( GtkWidget *parent, Vector3& color,
+typedef bool ( *PFN_QERAPP_COLORDIALOG )( ui::Widget parent, Vector3& color,
const char* title /* = "Choose Color"*/ );
// load a .bmp file and create a GtkImage widget from it
self.swap( other );
}
}
-
#endif
template<typename Key, typename Cached, typename Hasher, typename KeyEqual = std::equal_to<Key>, typename CreationPolicy = DefaultCreationPolicy<Cached, Key> >
class HashedCache : public CreationPolicy
{
-typedef SharedValue<Cached> Element;
-typedef HashTable<Key, Element, Hasher, KeyEqual> map_type;
+ typedef SharedValue<Cached> Element;
+ typedef HashTable<Key, Element, Hasher, KeyEqual> map_type;
-map_type m_map;
+ map_type m_map;
public:
-explicit HashedCache( const CreationPolicy& creation = CreationPolicy() )
- : CreationPolicy( creation ), m_map( 256 ){
-}
-~HashedCache(){
- ASSERT_MESSAGE( empty(), "HashedCache::~HashedCache: not empty" );
-}
+ explicit HashedCache( const CreationPolicy& creation = CreationPolicy() )
+ : CreationPolicy( creation ), m_map( 256 ){
+ }
+ ~HashedCache(){
+ ASSERT_MESSAGE( empty(), "HashedCache::~HashedCache: not empty" );
+ }
-typedef typename map_type::iterator iterator;
-typedef typename map_type::value_type value_type;
+ typedef typename map_type::iterator iterator;
+ typedef typename map_type::value_type value_type;
-iterator begin(){
- return m_map.begin();
-}
-iterator end(){
- return m_map.end();
-}
+ iterator begin(){
+ return m_map.begin();
+ }
+ iterator end(){
+ return m_map.end();
+ }
-bool empty() const {
- return m_map.empty();
-}
+ bool empty() const {
+ return m_map.empty();
+ }
-iterator find( const Key& key ){
- return m_map.find( key );
-}
+ iterator find( const Key& key ){
+ return m_map.find( key );
+ }
-void capture( iterator i ){
+ void capture( iterator i ){
( *i ).value.increment();
-}
-void release( iterator i ){
+ }
+ void release( iterator i ){
if ( ( *i ).value.decrement() == 0 ) {
CreationPolicy::destroy( ( *i ).value.get() );
- m_map.erase( i );
+ m_map.erase( i );
+ }
}
-}
#if 1
-Element& capture( const Key& key ){
+ Element& capture( const Key& key ){
#if 0
Element& elem = m_map[key];
- if ( elem.increment() == 1 ) {
- elem.set( CreationPolicy::construct( key ) );
- }
+ if ( elem.increment() == 1 ) {
+ elem.set( CreationPolicy::construct( key ) );
+ }
return elem;
#else
iterator i = m_map.insert( key, Element() );
if ( ( *i ).value.increment() == 1 ) {
( *i ).value.set( CreationPolicy::construct( ( *i ).key ) );
- }
+ }
return ( *i ).value;
#endif
-}
+ }
#else
value_type& capture( const Key& key ){
- iterator i = m_map.find( key );
- if ( i == m_map.end() ) {
- i = m_map.insert( key, Element() );
+ iterator i = m_map.find( key );
+ if ( i == m_map.end() ) {
+ i = m_map.insert( key, Element() );
( *i ).value.set( CreationPolicy::construct( ( *i ).key ) );
- }
+ }
( *i ).value.increment();
- return ( *i );
+ return ( *i );
}
#endif
-void release( const Key& key ){
- iterator i = m_map.find( key );
- ASSERT_MESSAGE( i != m_map.end(), "releasing a non-existent object\n" );
- release( i );
-}
+ void release( const Key& key ){
+ iterator i = m_map.find( key );
+ ASSERT_MESSAGE( i != m_map.end(), "releasing a non-existent object\n" );
+ release( i );
+ }
-void clear(){
- m_map.clear();
-}
+ void clear(){
+ m_map.clear();
+ }
};
#include <memory>
#include "debugging/debugging.h"
-
namespace HashTableDetail
{
inline std::size_t next_power_of_two( std::size_t size ){
if ( !globalDebugMessageHandler().handleMessage() ) { DEBUGGER_BREAKPOINT(); }} while ( 0 )
#define ASSERT_NOTNULL( ptr ) ASSERT_MESSAGE( ptr != 0, "pointer \"" # ptr "\" is null" )
+#define ASSERT_TRUE( flag ) ASSERT_MESSAGE( !!(flag) == true, "condition \"" # flag "\" is false" )
#else
#include <map>
#include <set>
-#include <gtk/gtkwindow.h>
-#include <gtk/gtkaccelgroup.h>
+#include <gtk/gtk.h>
#include "generic/callback.h"
#include "generic/bitfield.h"
{
GtkWindow* toplevel = *i;
ASSERT_MESSAGE( window_has_accel( toplevel ), "ERROR" );
- ASSERT_MESSAGE( GTK_WIDGET_TOPLEVEL( toplevel ), "disabling accel for non-toplevel window" );
+ ASSERT_MESSAGE( gtk_widget_is_toplevel( GTK_WIDGET(toplevel) ), "disabling accel for non-toplevel window" );
gtk_window_remove_accel_group( toplevel, global_accel );
#if 0
globalOutputStream() << reinterpret_cast<unsigned int>( toplevel ) << ": disabled global accelerators\n";
{
GtkWindow* toplevel = *i;
ASSERT_MESSAGE( !window_has_accel( toplevel ), "ERROR" );
- ASSERT_MESSAGE( GTK_WIDGET_TOPLEVEL( toplevel ), "enabling accel for non-toplevel window" );
+ ASSERT_MESSAGE( gtk_widget_is_toplevel( GTK_WIDGET(toplevel) ), "enabling accel for non-toplevel window" );
gtk_window_add_accel_group( toplevel, global_accel );
#if 0
globalOutputStream() << reinterpret_cast<unsigned int>( toplevel ) << ": enabled global accelerators\n";
#include <set>
+#include <uilib/uilib.h>
struct PressedKeys
{
GtkAccelGroup* global_accel = 0;
void global_accel_init(){
- global_accel = gtk_accel_group_new();
+ global_accel = ui::AccelGroup();
}
void global_accel_destroy(){
#if !defined( INCLUDED_GTKUTIL_ACCELERATOR_H )
#define INCLUDED_GTKUTIL_ACCELERATOR_H
-#include <gdk/gdktypes.h>
-#include <gdk/gdkkeysyms.h>
-#include <gdk/gdkkeys.h>
+#include <gdk/gdk.h>
#include "generic/callback.h"
#include "button.h"
-#include <gtk/gtkradiobutton.h>
+#include <gtk/gtk.h>
#include "stream/textstream.h"
#include "stream/stringstream.h"
#endif
}
+void button_connect_callback( GtkToolButton* button, const Callback& callback ){
+#if 1
+ g_signal_connect_swapped( G_OBJECT( button ), "clicked", G_CALLBACK( callback.getThunk() ), callback.getEnvironment() );
+#else
+ g_signal_connect_closure( G_OBJECT( button ), "clicked", create_cclosure( G_CALLBACK( clicked_closure_callback ), callback ), FALSE );
+#endif
+}
+
guint toggle_button_connect_callback( GtkToggleButton* button, const Callback& callback ){
#if 1
guint handler = g_signal_connect_swapped( G_OBJECT( button ), "toggled", G_CALLBACK( callback.getThunk() ), callback.getEnvironment() );
return handler;
}
+guint toggle_button_connect_callback( GtkToggleToolButton* button, const Callback& callback ){
+#if 1
+ guint handler = g_signal_connect_swapped( G_OBJECT( button ), "toggled", G_CALLBACK( callback.getThunk() ), callback.getEnvironment() );
+#else
+ guint handler = g_signal_connect_closure( G_OBJECT( button ), "toggled", create_cclosure( G_CALLBACK( clicked_closure_callback ), callback ), TRUE );
+#endif
+ g_object_set_data( G_OBJECT( button ), "handler", gint_to_pointer( handler ) );
+ return handler;
+}
+
void button_set_icon( GtkButton* button, const char* icon ){
GtkImage* image = new_local_image( icon );
gtk_widget_show( GTK_WIDGET( image ) );
g_signal_handler_unblock( G_OBJECT( button ), handler_id );
}
+void toggle_button_set_active_no_signal( GtkToggleToolButton* button, gboolean active ){
+ guint handler_id = gpointer_to_int( g_object_get_data( G_OBJECT( button ), "handler" ) );
+ g_signal_handler_block( G_OBJECT( button ), handler_id );
+ gtk_toggle_tool_button_set_active( button, active );
+ g_signal_handler_unblock( G_OBJECT( button ), handler_id );
+}
+
void radio_button_print_state( GtkRadioButton* button ){
globalOutputStream() << "toggle button: ";
- for ( GSList* radio = gtk_radio_button_group( button ); radio != 0; radio = g_slist_next( radio ) )
+ for ( GSList* radio = gtk_radio_button_get_group( button ); radio != 0; radio = g_slist_next( radio ) )
{
globalOutputStream() << gtk_toggle_button_get_active( GTK_TOGGLE_BUTTON( radio->data ) );
}
}
GtkToggleButton* radio_button_get_nth( GtkRadioButton* radio, int index ){
- GSList *group = gtk_radio_button_group( radio );
+ GSList *group = gtk_radio_button_get_group( radio );
return GTK_TOGGLE_BUTTON( g_slist_nth_data( group, g_slist_length( group ) - index - 1 ) );
}
int radio_button_get_active( GtkRadioButton* radio ){
//radio_button_print_state(radio);
- GSList *group = gtk_radio_button_group( radio );
+ GSList *group = gtk_radio_button_get_group( radio );
int index = g_slist_length( group ) - 1;
for (; group != 0; group = g_slist_next( group ) )
{
#if !defined( INCLUDED_GTKUTIL_BUTTON_H )
#define INCLUDED_GTKUTIL_BUTTON_H
+#include <gtk/gtk.h>
#include "generic/callbackfwd.h"
typedef struct _GtkButton GtkButton;
typedef unsigned int guint;
void button_connect_callback( GtkButton* button, const Callback& callback );
+void button_connect_callback( GtkToolButton* button, const Callback& callback );
guint toggle_button_connect_callback( GtkToggleButton* button, const Callback& callback );
+guint toggle_button_connect_callback( GtkToggleToolButton* button, const Callback& callback );
void button_set_icon( GtkButton* button, const char* icon );
void toggle_button_set_active_no_signal( GtkToggleButton* item, gboolean active );
+void toggle_button_set_active_no_signal( GtkToggleToolButton* item, gboolean active );
void radio_button_set_active( GtkRadioButton* radio, int index );
void radio_button_set_active_no_signal( GtkRadioButton* radio, int index );
#else
-#include <gtk/gtkclipboard.h>
+#include <gtk/gtk.h>
enum
{
}
static void clipboard_received( GtkClipboard *clipboard, GtkSelectionData *data, gpointer user_data ){
- if ( data->length < 0 ) {
+ if ( gtk_selection_data_get_length(data) < 0 ) {
globalErrorStream() << "Error retrieving selection\n";
}
- else if ( strcmp( gdk_atom_name( data->type ), clipboard_targets[0].target ) == 0 ) {
- BufferInputStream istream( reinterpret_cast<const char*>( data->data ), data->length );
+ else if ( strcmp( gdk_atom_name( gtk_selection_data_get_data_type(data) ), clipboard_targets[0].target ) == 0 ) {
+ BufferInputStream istream( reinterpret_cast<const char*>( gtk_selection_data_get_data(data) ), gtk_selection_data_get_length(data) );
( *reinterpret_cast<ClipboardPasteFunc*>( user_data ) )( istream );
}
}
#if !defined( INCLUDED_GTKUTIL_CONTAINER_H )
#define INCLUDED_GTKUTIL_CONTAINER_H
-#include <gtk/gtkcontainer.h>
+#include <gtk/gtk.h>
inline GtkWidget* container_add_widget( GtkContainer* container, GtkWidget* widget ){
gtk_container_add( container, widget );
#include "stream/textstream.h"
#include <string.h>
-#include <gdk/gdkcursor.h>
-#include <gdk/gdkpixmap.h>
+#include <gdk/gdk.h>
GdkCursor* create_blank_cursor(){
- GdkPixmap *pixmap;
- GdkBitmap *mask;
- char buffer [( 32 * 32 ) / 8];
- memset( buffer, 0, ( 32 * 32 ) / 8 );
- GdkColor white = {0, 0xffff, 0xffff, 0xffff};
- GdkColor black = {0, 0x0000, 0x0000, 0x0000};
- pixmap = gdk_bitmap_create_from_data( 0, buffer, 32, 32 );
- mask = gdk_bitmap_create_from_data( 0, buffer, 32, 32 );
- GdkCursor *cursor = gdk_cursor_new_from_pixmap( pixmap, mask, &white, &black, 1, 1 );
- gdk_drawable_unref( pixmap );
- gdk_drawable_unref( mask );
-
- return cursor;
+ return gdk_cursor_new(GDK_BLANK_CURSOR);
}
void blank_cursor( GtkWidget* widget ){
GdkCursor* cursor = create_blank_cursor();
- gdk_window_set_cursor( widget->window, cursor );
+ gdk_window_set_cursor( gtk_widget_get_window(widget), cursor );
gdk_cursor_unref( cursor );
}
void default_cursor( GtkWidget* widget ){
- gdk_window_set_cursor( widget->window, 0 );
+ gdk_window_set_cursor( gtk_widget_get_window(widget), 0 );
}
#define INCLUDED_GTKUTIL_CURSOR_H
#include <glib.h>
-#include <gdk/gdkevents.h>
-#include <gtk/gtkwidget.h>
-#include <gtk/gtkwindow.h>
+#include <gtk/gtk.h>
#include "debugging/debugging.h"
GdkCursor* cursor = create_blank_cursor();
//GdkGrabStatus status =
- gdk_pointer_grab( GTK_WIDGET( window )->window, TRUE, mask, 0, cursor, GDK_CURRENT_TIME );
+ gdk_pointer_grab( gtk_widget_get_window(GTK_WIDGET(window)), TRUE, mask, 0, cursor, GDK_CURRENT_TIME );
gdk_cursor_unref( cursor );
Sys_GetCursorPos( window, &recorded_x, &recorded_y );
#include "dialog.h"
-#include <gtk/gtkmain.h>
-#include <gtk/gtkalignment.h>
-#include <gtk/gtkhbox.h>
-#include <gtk/gtkvbox.h>
-#include <gtk/gtkradiobutton.h>
-#include <gtk/gtkframe.h>
-#include <gtk/gtktable.h>
-#include <gtk/gtkentry.h>
-#include <gtk/gtkbutton.h>
-#include <gtk/gtklabel.h>
+#include <gtk/gtk.h>
#include "button.h"
#include "window.h"
GtkVBox* create_dialog_vbox( int spacing, int border ){
- GtkVBox* vbox = GTK_VBOX( gtk_vbox_new( FALSE, spacing ) );
+ GtkVBox* vbox = ui::VBox( FALSE, spacing );
gtk_widget_show( GTK_WIDGET( vbox ) );
gtk_container_set_border_width( GTK_CONTAINER( vbox ), border );
return vbox;
}
GtkHBox* create_dialog_hbox( int spacing, int border ){
- GtkHBox* hbox = GTK_HBOX( gtk_hbox_new( FALSE, spacing ) );
+ GtkHBox* hbox = ui::HBox( FALSE, spacing );
gtk_widget_show( GTK_WIDGET( hbox ) );
gtk_container_set_border_width( GTK_CONTAINER( hbox ), border );
return hbox;
}
GtkFrame* create_dialog_frame( const char* label, GtkShadowType shadow ){
- GtkFrame* frame = GTK_FRAME( gtk_frame_new( label ) );
+ GtkFrame* frame = ui::Frame( label );
gtk_widget_show( GTK_WIDGET( frame ) );
gtk_frame_set_shadow_type( frame, shadow );
return frame;
}
GtkTable* create_dialog_table( unsigned int rows, unsigned int columns, unsigned int row_spacing, unsigned int col_spacing, int border ){
- GtkTable* table = GTK_TABLE( gtk_table_new( rows, columns, FALSE ) );
+ GtkTable* table = ui::Table( rows, columns, FALSE );
gtk_widget_show( GTK_WIDGET( table ) );
gtk_table_set_row_spacings( table, row_spacing );
gtk_table_set_col_spacings( table, col_spacing );
}
GtkButton* create_dialog_button( const char* label, GCallback func, gpointer data ){
- GtkButton* button = GTK_BUTTON( gtk_button_new_with_label( label ) );
+ GtkButton* button = ui::Button( label );
gtk_widget_set_size_request( GTK_WIDGET( button ), 64, -1 );
gtk_widget_show( GTK_WIDGET( button ) );
g_signal_connect( G_OBJECT( button ), "clicked", func, data );
gtk_container_add( GTK_CONTAINER( vbox1 ), contents );
- GtkAlignment* alignment = GTK_ALIGNMENT( gtk_alignment_new( 0.5, 0.0, 0.0, 0.0 ) );
+ 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 );
}
RadioHBox RadioHBox_new( StringArrayRange names ){
- GtkHBox* hbox = GTK_HBOX( gtk_hbox_new( TRUE, 4 ) );
+ GtkHBox* hbox = ui::HBox( TRUE, 4 );
gtk_widget_show( GTK_WIDGET( hbox ) );
GSList* group = 0;
PathEntry PathEntry_new(){
- GtkFrame* frame = GTK_FRAME( gtk_frame_new( NULL ) );
+ GtkFrame* frame = ui::Frame();
gtk_widget_show( GTK_WIDGET( frame ) );
gtk_frame_set_shadow_type( frame, GTK_SHADOW_IN );
// path entry
- GtkHBox* hbox = GTK_HBOX( gtk_hbox_new( FALSE, 0 ) );
+ GtkHBox* hbox = ui::HBox( FALSE, 0 );
gtk_widget_show( GTK_WIDGET( hbox ) );
- GtkEntry* entry = GTK_ENTRY( gtk_entry_new() );
+ GtkEntry* entry = ui::Entry();
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 );
// browse button
- GtkButton* button = GTK_BUTTON( gtk_button_new() );
+ GtkButton* 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 );
GtkLabel* DialogLabel_new( const char* name ){
- GtkLabel* label = GTK_LABEL( gtk_label_new( name ) );
- gtk_widget_show( GTK_WIDGET( label ) );
+ ui::Label label = ui::Label( name );
+ gtk_widget_show(label);
gtk_misc_set_alignment( GTK_MISC( label ), 1, 0.5 );
gtk_label_set_justify( label, GTK_JUSTIFY_LEFT );
}
GtkTable* DialogRow_new( const char* name, GtkWidget* widget ){
- GtkTable* table = GTK_TABLE( gtk_table_new( 1, 3, TRUE ) );
+ GtkTable* table = ui::Table( 1, 3, TRUE );
gtk_widget_show( GTK_WIDGET( table ) );
gtk_table_set_col_spacings( table, 4 );
#include "generic/callback.h"
#include "generic/arrayrange.h"
#include "qerplugin.h"
-#include <gtk/gtkenums.h>
+#include <gtk/gtk.h>
typedef int gint;
typedef gint gboolean;
#include <stdio.h>
#include <stdlib.h>
-#include <gtk/gtkentry.h>
+#include <gtk/gtk.h>
inline void entry_set_string( GtkEntry* entry, const char* string ){
gtk_entry_set_text( entry, string );
#include <list>
#include <vector>
-#include <gtk/gtkwidget.h>
-#include <gtk/gtkwindow.h>
-#include <gtk/gtkfilechooser.h>
-#include <gtk/gtkfilechooserdialog.h>
-#include <gtk/gtkstock.h>
+#include <gtk/gtk.h>
+#include <uilib/uilib.h>
#include "string/string.h"
#include "stream/stringstream.h"
return g_file_dialog_file;
}
-char* dir_dialog( GtkWidget* parent, const char* title, const char* path ){
+char* dir_dialog( ui::Widget parent, const char* title, const char* path ){
GtkWidget* dialog = gtk_file_chooser_dialog_new( title,
GTK_WINDOW( parent ),
GTK_FILE_CHOOSER_ACTION_SELECT_FOLDER,
return filename;
}
-const char* file_dialog( GtkWidget* parent, bool open, const char* title, const char* path, const char* pattern, bool want_load, bool want_import, bool want_save ){
+const char* file_dialog( ui::Widget parent, bool open, const char* title, const char* path, const char* pattern, bool want_load, bool want_import, bool want_save ){
for (;; )
{
const char* file = file_dialog_show( parent, open, title, path, pattern, want_load, want_import, want_save );
if ( open
|| file == 0
|| !file_exists( file )
- || gtk_MessageBox( parent, "The file specified already exists.\nDo you want to replace it?", title, eMB_NOYES, eMB_ICONQUESTION ) == eIDYES ) {
+ || parent.alert("The file specified already exists.\nDo you want to replace it?", title, ui::alert_type::NOYES, ui::alert_icon::Question ) == ui::alert_response::YES ) {
return file;
}
}
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
+#include <uilib/uilib.h>
+
#if !defined( INCLUDED_GTKUTIL_FILECHOOSER_H )
#define INCLUDED_GTKUTIL_FILECHOOSER_H
/// \file
/// GTK+ file-chooser dialogs.
-typedef struct _GtkWidget GtkWidget;
-const char* file_dialog( GtkWidget *parent, bool open, const char* title, const char* path = 0, const char* pattern = 0, bool want_load = false, bool want_import = false, bool want_save = false );
+const char* file_dialog( ui::Widget parent, bool open, const char* title, const char* path = 0, const char* pattern = 0, bool want_load = false, bool want_import = false, bool want_save = false );
/// \brief Prompts the user to browse for a directory.
/// The prompt window will be transient to \p parent.
/// The directory will initially default to \p path, which must be an absolute path.
/// The returned string is allocated with \c g_malloc and must be freed with \c g_free.
-char* dir_dialog( GtkWidget *parent, const char* title = "Choose Directory", const char* path = "" );
+char* dir_dialog( ui::Widget parent, const char* title = "Choose Directory", const char* path = "" );
#endif
#include "frame.h"
-#include <gtk/gtkframe.h>
+#include <gtk/gtk.h>
+#include <uilib/uilib.h>
GtkFrame* create_framed_widget( GtkWidget* widget ){
- GtkFrame* frame = GTK_FRAME( gtk_frame_new( 0 ) );
+ GtkFrame* frame = ui::Frame();
gtk_widget_show( GTK_WIDGET( frame ) );
gtk_frame_set_shadow_type( frame, GTK_SHADOW_IN );
gtk_container_add( GTK_CONTAINER( frame ), widget );
#include "igl.h"
-#include <gtk/gtkdrawingarea.h>
+#include <gtk/gtk.h>
#include <gtk/gtkglwidget.h>
#include "pointer.h"
gint glwidget_context_created( GtkWidget* widget, gpointer data ){
if ( ++g_context_count == 1 ) {
g_shared = widget;
- gtk_widget_ref( g_shared );
+ g_object_ref( g_shared );
glwidget_make_current( g_shared );
GlobalOpenGL().contextValid = true;
GLWidget_sharedContextDestroyed();
- gtk_widget_unref( g_shared );
+ g_object_unref( g_shared );
g_shared = 0;
}
return FALSE;
#include "image.h"
-#include <gtk/gtkimage.h>
-#include <gtk/gtkstock.h>
+#include <gtk/gtk.h>
#include "string/string.h"
#include "stream/stringstream.h"
else
{
GdkPixbuf* rgba = gdk_pixbuf_add_alpha( rgb, FALSE, 255, 0, 255 );
- gdk_pixbuf_unref( rgb );
+ g_object_unref( rgb );
return rgba;
}
}
else
{
GtkImage* image = GTK_IMAGE( gtk_image_new_from_pixbuf( rgba ) );
- gdk_pixbuf_unref( rgba );
+ g_object_unref( rgba );
return image;
}
}
#include "menu.h"
#include <ctype.h>
-#include <gtk/gtkmenu.h>
-#include <gtk/gtkmenubar.h>
-#include <gtk/gtkradiomenuitem.h>
-#include <gtk/gtktearoffmenuitem.h>
-#include <gtk/gtkaccellabel.h>
+#include <gtk/gtk.h>
+#include <uilib/uilib.h>
+#include <debugging/debugging.h>
#include "generic/callback.h"
}
GtkMenuItem* new_sub_menu_item_with_mnemonic( const char* mnemonic ){
- GtkMenuItem* item = GTK_MENU_ITEM( gtk_menu_item_new_with_mnemonic( mnemonic ) );
+ GtkMenuItem* item = ui::MenuItem( mnemonic, true );
gtk_widget_show( GTK_WIDGET( item ) );
- GtkWidget* sub_menu = gtk_menu_new();
+ GtkWidget* sub_menu = ui::Menu();
gtk_menu_item_set_submenu( item, sub_menu );
return item;
}
GtkMenuItem* new_menu_item_with_mnemonic( const char *mnemonic, const Callback& callback ){
- GtkMenuItem* item = GTK_MENU_ITEM( gtk_menu_item_new_with_mnemonic( mnemonic ) );
+ GtkMenuItem* item = ui::MenuItem( mnemonic, true );
gtk_widget_show( GTK_WIDGET( item ) );
menu_item_connect_callback( item, callback );
return item;
GtkRadioMenuItem* new_radio_menu_item_with_mnemonic( GSList** group, const char* mnemonic, const Callback& callback ){
GtkRadioMenuItem* item = GTK_RADIO_MENU_ITEM( gtk_radio_menu_item_new_with_mnemonic( *group, mnemonic ) );
if ( *group == 0 ) {
- gtk_check_menu_item_set_state( GTK_CHECK_MENU_ITEM( item ), TRUE );
+ gtk_check_menu_item_set_active( GTK_CHECK_MENU_ITEM( item ), TRUE );
}
- *group = gtk_radio_menu_item_group( item );
+ *group = gtk_radio_menu_item_get_group( item );
gtk_widget_show( GTK_WIDGET( item ) );
check_menu_item_connect_callback( GTK_CHECK_MENU_ITEM( item ), callback );
return item;
}
}
-void menu_item_set_accelerator( GtkMenuItem* item, Accelerator accelerator ){
- GtkAccelLabel* accel_label = GTK_ACCEL_LABEL( gtk_bin_get_child( GTK_BIN( item ) ) );
-
- g_free( accel_label->accel_string );
- accel_label->accel_string = 0;
-
- GString* gstring = g_string_new( accel_label->accel_string );
- g_string_append( gstring, " " );
-
- accelerator_name( accelerator, gstring );
-
- g_free( accel_label->accel_string );
- accel_label->accel_string = gstring->str;
- g_string_free( gstring, FALSE );
-
- if ( !accel_label->accel_string ) {
- accel_label->accel_string = g_strdup( "" );
- }
-
- gtk_widget_queue_resize( GTK_WIDGET( accel_label ) );
-}
-
void menu_item_add_accelerator( GtkMenuItem* item, Accelerator accelerator ){
if ( accelerator.key != 0 ) {
GClosure* closure = global_accel_group_find( accelerator );
- if ( closure != 0 ) {
- menu_item_set_accelerator( item, closure );
- }
- else
- {
- menu_item_set_accelerator( item, accelerator );
- }
+ ASSERT_NOTNULL(closure);
+ menu_item_set_accelerator( item, closure );
}
}
#include "messagebox.h"
#include <gdk/gdkkeysyms.h>
-#include <gtk/gtkmain.h>
-#include <gtk/gtkwindow.h>
-#include <gtk/gtkhbox.h>
-#include <gtk/gtkvbox.h>
-#include <gtk/gtklabel.h>
-#include <gtk/gtkalignment.h>
-#include <gtk/gtkbutton.h>
-#include <gtk/gtkimage.h>
-#include <gtk/gtkstock.h>
+#include <gtk/gtk.h>
#include "dialog.h"
#include "widget.h"
GtkWidget* create_padding( int width, int height ){
- GtkWidget* widget = gtk_alignment_new( 0.0, 0.0, 0.0, 0.0 );
+ ui::Alignment widget = ui::Alignment( 0.0, 0.0, 0.0, 0.0 );
gtk_widget_show( widget );
gtk_widget_set_size_request( widget, width, height );
return widget;
}
}
-EMessageBoxReturn gtk_MessageBox( GtkWidget *parent, const char* text, const char* title, EMessageBoxType type, EMessageBoxIcon icon ){
+EMessageBoxReturn gtk_MessageBox( ui::Widget parent, const char* text, const char* title, EMessageBoxType type, EMessageBoxIcon icon ){
ModalDialog dialog;
ModalDialogButton ok_button( dialog, eIDOK );
ModalDialogButton cancel_button( dialog, eIDCANCEL );
ModalDialogButton yes_button( dialog, eIDYES );
ModalDialogButton no_button( dialog, eIDNO );
- GtkWindow* parentWindow = parent != 0 ? GTK_WINDOW( parent ) : 0;
+ GtkWindow* parentWindow = parent ? GTK_WINDOW( parent ) : 0;
GtkWindow* window = create_fixedsize_modal_dialog_window( parentWindow, title, dialog, 400, 100 );
gtk_window_deiconify( parentWindow );
}
- GtkAccelGroup* accel = gtk_accel_group_new();
+ GtkAccelGroup* accel = ui::AccelGroup();
gtk_window_add_accel_group( window, accel );
GtkVBox* vbox = create_dialog_vbox( 8, 8 );
gtk_widget_show( GTK_WIDGET( image ) );
gtk_box_pack_start( GTK_BOX( iconBox ), GTK_WIDGET( image ), FALSE, FALSE, 0 );
- GtkLabel* label = GTK_LABEL( gtk_label_new( text ) );
+ GtkLabel* label = GTK_LABEL( ui::Label( text ) );
gtk_widget_show( GTK_WIDGET( label ) );
gtk_misc_set_alignment( GTK_MISC( label ), 0, 0.5 );
gtk_label_set_justify( label, GTK_JUSTIFY_LEFT );
GtkVBox* vboxDummy = create_dialog_vbox( 0, 0 );
gtk_box_pack_start( GTK_BOX( vbox ), GTK_WIDGET( vboxDummy ), FALSE, FALSE, 0 );
- GtkAlignment* alignment = GTK_ALIGNMENT( gtk_alignment_new( 0.5, 0.0, 0.0, 0.0 ) );
+ GtkAlignment* alignment = ui::Alignment( 0.5, 0.0, 0.0, 0.0 );
gtk_widget_show( GTK_WIDGET( alignment ) );
gtk_box_pack_start( GTK_BOX( vboxDummy ), GTK_WIDGET( alignment ), FALSE, FALSE, 0 );
#include "qerplugin.h"
-typedef struct _GtkWidget GtkWidget;
/// \brief Shows a modal message-box.
-EMessageBoxReturn gtk_MessageBox( GtkWidget *parent, const char* text, const char* title = "NetRadiant", EMessageBoxType type = eMB_OK, EMessageBoxIcon icon = eMB_ICONDEFAULT );
+EMessageBoxReturn gtk_MessageBox( ui::Widget parent, const char* text, const char* title = "NetRadiant", EMessageBoxType type = eMB_OK, EMessageBoxIcon icon = eMB_ICONDEFAULT );
#endif
#if !defined( INCLUDED_GTKUTIL_NONMODAL_H )
#define INCLUDED_GTKUTIL_NONMODAL_H
-#include <gtk/gtkwindow.h>
-#include <gtk/gtkspinbutton.h>
-#include <gtk/gtkradiobutton.h>
+#include <gtk/gtk.h>
#include <gdk/gdkkeysyms.h>
#include "generic/callback.h"
inline gboolean escape_clear_focus_widget( GtkWidget* widget, GdkEventKey* event, gpointer data ){
- if ( event->keyval == GDK_Escape ) {
+ if ( event->keyval == GDK_KEY_Escape ) {
gtk_window_set_focus( GTK_WINDOW( gtk_widget_get_toplevel( GTK_WIDGET( widget ) ) ), NULL );
return TRUE;
}
}
static gboolean focus_out( GtkEntry* entry, GdkEventFocus *event, NonModalEntry* self ){
- if ( self->m_editing && GTK_WIDGET_VISIBLE( entry ) ) {
+ if ( self->m_editing && gtk_widget_get_visible( GTK_WIDGET(entry) ) ) {
self->m_apply();
}
self->m_editing = false;
NonModalRadio( const Callback& changed ) : m_changed( changed ){
}
void connect( GtkRadioButton* radio ){
- GSList* group = gtk_radio_button_group( radio );
+ GSList* group = gtk_radio_button_get_group( radio );
for (; group != 0; group = g_slist_next( group ) )
{
toggle_button_connect_callback( GTK_TOGGLE_BUTTON( group->data ), m_changed );
#include "paned.h"
-#include <gtk/gtkhpaned.h>
-#include <gtk/gtkvpaned.h>
+#include <gtk/gtk.h>
+#include <uilib/uilib.h>
#include "frame.h"
PanedState g_vpaned2 = { 0.5f, -1, };
GtkHPaned* create_split_views( GtkWidget* topleft, GtkWidget* topright, GtkWidget* botleft, GtkWidget* botright ){
- GtkHPaned* hsplit = GTK_HPANED( gtk_hpaned_new() );
+ GtkHPaned* hsplit = ui::HPaned();
gtk_widget_show( GTK_WIDGET( hsplit ) );
g_signal_connect( G_OBJECT( hsplit ), "size_allocate", G_CALLBACK( hpaned_allocate ), &g_hpaned );
g_signal_connect( G_OBJECT( hsplit ), "notify::position", G_CALLBACK( paned_position ), &g_hpaned );
{
- GtkVPaned* vsplit = GTK_VPANED( gtk_vpaned_new() );
+ GtkVPaned* vsplit = ui::VPaned();
gtk_paned_add1( GTK_PANED( hsplit ), GTK_WIDGET( vsplit ) );
gtk_widget_show( GTK_WIDGET( vsplit ) );
gtk_paned_add2( GTK_PANED( vsplit ), GTK_WIDGET( create_framed_widget( topright ) ) );
}
{
- GtkVPaned* vsplit = GTK_VPANED( gtk_vpaned_new() );
+ GtkVPaned* vsplit = ui::VPaned();
gtk_paned_add2( GTK_PANED( hsplit ), GTK_WIDGET( vsplit ) );
gtk_widget_show( GTK_WIDGET( vsplit ) );
#include "toolbar.h"
-#include <gtk/gtktoolbar.h>
-#include <gtk/gtktogglebutton.h>
+#include <uilib/uilib.h>
#include "generic/callback.h"
#include "accelerator.h"
#include "button.h"
-#include "closure.h"
-#include "pointer.h"
+#include "image.h"
-void toolbar_append( GtkToolbar* toolbar, GtkButton* button, const char* description ){
- gtk_widget_show( GTK_WIDGET( button ) );
- gtk_button_set_relief( button, GTK_RELIEF_NONE );
- GTK_WIDGET_UNSET_FLAGS( GTK_WIDGET( button ), GTK_CAN_FOCUS );
- GTK_WIDGET_UNSET_FLAGS( GTK_WIDGET( button ), GTK_CAN_DEFAULT );
- gtk_toolbar_append_element( toolbar, GTK_TOOLBAR_CHILD_WIDGET, GTK_WIDGET( button ), "", description, "", 0, 0, 0 );
+void toolbar_append( GtkToolbar* toolbar, GtkToolItem* button, const char* description ){
+ gtk_widget_show_all(GTK_WIDGET(button));
+ gtk_widget_set_tooltip_text(GTK_WIDGET(button), description);
+ gtk_container_add(GTK_CONTAINER(toolbar), GTK_WIDGET(button));
}
-GtkButton* toolbar_append_button( GtkToolbar* toolbar, const char* description, const char* icon, const Callback& callback ){
- GtkButton* button = GTK_BUTTON( gtk_button_new() );
- button_set_icon( button, icon );
- button_connect_callback( button, callback );
- toolbar_append( toolbar, button, description );
+GtkToolButton* toolbar_append_button( GtkToolbar* toolbar, const char* description, const char* icon, const Callback& callback ){
+ auto button = GTK_TOOL_BUTTON(gtk_tool_button_new(GTK_WIDGET(new_local_image(icon)), nullptr));
+ button_connect_callback(button, callback);
+ toolbar_append(toolbar, GTK_TOOL_ITEM(button), description);
return button;
}
-GtkToggleButton* toolbar_append_toggle_button( GtkToolbar* toolbar, const char* description, const char* icon, const Callback& callback ){
- GtkToggleButton* button = GTK_TOGGLE_BUTTON( gtk_toggle_button_new() );
- button_set_icon( GTK_BUTTON( button ), icon );
- toggle_button_connect_callback( button, callback );
- toolbar_append( toolbar, GTK_BUTTON( button ), description );
+GtkToggleToolButton* toolbar_append_toggle_button( GtkToolbar* toolbar, const char* description, const char* icon, const Callback& callback ){
+ auto button = GTK_TOGGLE_TOOL_BUTTON(gtk_toggle_tool_button_new());
+ toggle_button_connect_callback(button, callback);
+ gtk_tool_button_set_icon_widget(GTK_TOOL_BUTTON(button), GTK_WIDGET(new_local_image(icon)));
+ gtk_tool_button_set_label(GTK_TOOL_BUTTON(button), description);
+ toolbar_append(toolbar, GTK_TOOL_ITEM(button), description);
return button;
}
-GtkButton* toolbar_append_button( GtkToolbar* toolbar, const char* description, const char* icon, const Command& command ){
+GtkToolButton* toolbar_append_button( GtkToolbar* toolbar, const char* description, const char* icon, const Command& command ){
return toolbar_append_button( toolbar, description, icon, command.m_callback );
}
-void toggle_button_set_active_callback( GtkToggleButton& button, bool active ){
+void toggle_button_set_active_callback( GtkToggleToolButton& button, bool active ){
toggle_button_set_active_no_signal( &button, active );
}
-typedef ReferenceCaller1<GtkToggleButton, bool, toggle_button_set_active_callback> ToggleButtonSetActiveCaller;
+using ToggleButtonSetActiveCaller = ReferenceCaller1<GtkToggleToolButton, bool, toggle_button_set_active_callback>;
-GtkToggleButton* toolbar_append_toggle_button( GtkToolbar* toolbar, const char* description, const char* icon, const Toggle& toggle ){
- GtkToggleButton* button = toolbar_append_toggle_button( toolbar, description, icon, toggle.m_command.m_callback );
+GtkToggleToolButton* toolbar_append_toggle_button( GtkToolbar* toolbar, const char* description, const char* icon, const Toggle& toggle ){
+ auto button = toolbar_append_toggle_button( toolbar, description, icon, toggle.m_command.m_callback );
toggle.m_exportCallback( ToggleButtonSetActiveCaller( *button ) );
return button;
}
#if !defined( INCLUDED_GTKUTIL_TOOLBAR_H )
#define INCLUDED_GTKUTIL_TOOLBAR_H
+#include <gtk/gtk.h>
#include "generic/callbackfwd.h"
typedef struct _GtkButton GtkButton;
class Command;
class Toggle;
-GtkButton* toolbar_append_button( GtkToolbar* toolbar, const char* description, const char* icon, const Callback& callback );
-GtkButton* toolbar_append_button( GtkToolbar* toolbar, const char* description, const char* icon, const Command& command );
-GtkToggleButton* toolbar_append_toggle_button( GtkToolbar* toolbar, const char* description, const char* icon, const Callback& callback );
-GtkToggleButton* toolbar_append_toggle_button( GtkToolbar* toolbar, const char* description, const char* icon, const Toggle& toggle );
+GtkToolButton* toolbar_append_button( GtkToolbar* toolbar, const char* description, const char* icon, const Callback& callback );
+GtkToolButton* toolbar_append_button( GtkToolbar* toolbar, const char* description, const char* icon, const Command& command );
+GtkToggleToolButton* toolbar_append_toggle_button( GtkToolbar* toolbar, const char* description, const char* icon, const Callback& callback );
+GtkToggleToolButton* toolbar_append_toggle_button( GtkToolbar* toolbar, const char* description, const char* icon, const Toggle& toggle );
#endif
#define INCLUDED_GTKUTIL_WIDGET_H
#include <list>
-#include <gtk/gtkwidget.h>
+#include <gtk/gtk.h>
#include "generic/callback.h"
#include "warnings.h"
#include "debugging/debugging.h"
}
inline bool widget_is_visible( GtkWidget* widget ){
- return GTK_WIDGET_VISIBLE( widget ) != FALSE;
+ return gtk_widget_get_visible( widget ) != FALSE;
}
inline void widget_toggle_visible( GtkWidget* widget ){
return FALSE;
}
static gboolean destroy( GtkWidget* widget, ToggleShown* self ){
- self->m_shownDeferred = GTK_WIDGET_VISIBLE( self->m_widget ) != FALSE;
+ self->m_shownDeferred = gtk_widget_get_visible( self->m_widget ) != FALSE;
self->m_widget = 0;
return FALSE;
}
}
else
{
- return GTK_WIDGET_VISIBLE( m_widget ) != FALSE;
+ return gtk_widget_get_visible( m_widget ) != FALSE;
}
}
void exportActive( const BoolImportCallback& importCallback ){
inline void widget_make_default( GtkWidget* widget ){
- GTK_WIDGET_SET_FLAGS( widget, GTK_CAN_DEFAULT );
+ gtk_widget_set_can_default( widget, true );
gtk_widget_grab_default( widget );
}
#include "window.h"
-#include <gtk/gtkscrolledwindow.h>
+#include <gtk/gtk.h>
+#include <uilib/uilib.h>
#include "pointer.h"
#include "accelerator.h"
}
inline void CHECK_MINIMIZE( GtkWidget* w ){
- g_object_set_data( G_OBJECT( w ), "was_mapped", gint_to_pointer( GTK_WIDGET_VISIBLE( w ) ) );
+ g_object_set_data( G_OBJECT( w ), "was_mapped", gint_to_pointer( gtk_widget_get_visible( w ) ) );
gtk_widget_hide( w );
}
}
GtkWindow* create_floating_window( const char* title, GtkWindow* parent ){
- GtkWindow* window = GTK_WINDOW( gtk_window_new( GTK_WINDOW_TOPLEVEL ) );
+ GtkWindow* window = ui::Window( ui::window_type::TOP );
gtk_window_set_title( window, title );
if ( parent != 0 ) {
}
gint window_realize_remove_sysmenu( GtkWidget* widget, gpointer data ){
- gdk_window_set_decorations( widget->window, (GdkWMDecoration)( GDK_DECOR_ALL | GDK_DECOR_MENU ) );
+ gdk_window_set_decorations( gtk_widget_get_window(widget), (GdkWMDecoration)( GDK_DECOR_ALL | GDK_DECOR_MENU ) );
return FALSE;
}
}
gint window_realize_remove_minmax( GtkWidget* widget, gpointer data ){
- gdk_window_set_decorations( widget->window, (GdkWMDecoration)( GDK_DECOR_ALL | GDK_DECOR_MINIMIZE | GDK_DECOR_MAXIMIZE ) );
+ gdk_window_set_decorations( gtk_widget_get_window(widget), (GdkWMDecoration)( GDK_DECOR_ALL | GDK_DECOR_MINIMIZE | GDK_DECOR_MAXIMIZE ) );
return FALSE;
}
GtkScrolledWindow* create_scrolled_window( GtkPolicyType hscrollbar_policy, GtkPolicyType vscrollbar_policy, int border ){
- GtkScrolledWindow* scr = GTK_SCROLLED_WINDOW( gtk_scrolled_window_new( 0, 0 ) );
+ GtkScrolledWindow* scr = ui::ScrolledWindow();
gtk_widget_show( GTK_WIDGET( scr ) );
gtk_scrolled_window_set_policy( scr, hscrollbar_policy, vscrollbar_policy );
gtk_scrolled_window_set_shadow_type( scr, GTK_SHADOW_IN );
#if !defined( INCLUDED_GTKUTIL_WINDOW_H )
#define INCLUDED_GTKUTIL_WINDOW_H
-#include <gtk/gtkwindow.h>
+#include <gtk/gtk.h>
#include "debugging/debugging.h"
#include "generic/callback.h"
#if !defined ( INCLUDED_XORRECTANGLE_H )
#define INCLUDED_XORRECTANGLE_H
-#include <gtk/gtkwidget.h>
+#include <gtk/gtk.h>
+#include <uilib/uilib.h>
#include "math/vector.h"
class rectangle_t
rectangle_t m_rectangle;
GtkWidget* m_widget;
-GdkGC* m_gc;
+cairo_t *cr;
bool initialised() const {
- return m_gc != 0;
+ return cr != nullptr;
}
void lazy_init(){
if ( !initialised() ) {
- m_gc = gdk_gc_new( m_widget->window );
-
- GdkColor color = { 0, 0xffff, 0xffff, 0xffff, };
- GdkColormap* colormap = gdk_window_get_colormap( m_widget->window );
- gdk_colormap_alloc_color( colormap, &color, FALSE, TRUE );
- gdk_gc_copy( m_gc, m_widget->style->white_gc );
- gdk_gc_set_foreground( m_gc, &color );
- gdk_gc_set_background( m_gc, &color );
-
- gdk_gc_set_function( m_gc, GDK_INVERT );
+ cr = gdk_cairo_create(gtk_widget_get_window(m_widget));
}
}
void draw() const {
const int y = float_to_integer( m_rectangle.y );
const int w = float_to_integer( m_rectangle.w );
const int h = float_to_integer( m_rectangle.h );
- gdk_draw_rectangle( m_widget->window, m_gc, FALSE, x, -( h ) - ( y - m_widget->allocation.height ), w, h );
+ GtkAllocation allocation;
+ gtk_widget_get_allocation(m_widget, &allocation);
+ cairo_rectangle(cr, x, -(h) - (y - allocation.height), w, h);
+ cairo_set_source_rgb(cr, 1, 1, 1);
+ cairo_set_operator(cr, CAIRO_OPERATOR_DIFFERENCE);
+ cairo_stroke(cr);
}
public:
-XORRectangle( GtkWidget* widget ) : m_widget( widget ), m_gc( 0 ){
+XORRectangle( ui::Widget widget ) : m_widget( widget ), cr( 0 ) {
}
~XORRectangle(){
if ( initialised() ) {
- gdk_gc_unref( m_gc );
+ cairo_destroy(cr);
}
}
void set( rectangle_t rectangle ){
- if ( GTK_WIDGET_REALIZED( m_widget ) ) {
+ if ( gtk_widget_get_realized( m_widget ) ) {
lazy_init();
draw();
m_rectangle = rectangle;
class ModuleRegisterable
{
public:
-virtual void selfRegister() = 0;
+ virtual void selfRegister() = 0;
};
class ModuleRegistryList
{
-typedef std::list<ModuleRegisterable*> RegisterableModules;
-RegisterableModules m_modules;
+ typedef std::list<ModuleRegisterable*> RegisterableModules;
+ RegisterableModules m_modules;
public:
-void addModule( ModuleRegisterable& module ){
- m_modules.push_back( &module );
-}
-void registerModules() const {
- for ( RegisterableModules::const_iterator i = m_modules.begin(); i != m_modules.end(); ++i )
- {
- ( *i )->selfRegister();
+ void addModule( ModuleRegisterable& module ){
+ m_modules.push_back( &module );
+ }
+ void registerModules() const {
+ for ( RegisterableModules::const_iterator i = m_modules.begin(); i != m_modules.end(); ++i )
+ {
+ ( *i )->selfRegister();
+ }
}
-}
};
typedef SmartStatic<ModuleRegistryList> StaticModuleRegistryList;
class StaticRegisterModule : public StaticModuleRegistryList
{
public:
-StaticRegisterModule( ModuleRegisterable& module ){
- StaticModuleRegistryList::instance().addModule( module );
-}
+ StaticRegisterModule( ModuleRegisterable& module ){
+ StaticModuleRegistryList::instance().addModule( module );
+ }
};
void selfRegister(){
globalModuleServer().registerModule( typename Type::Name(), typename Type::Version(), APIConstructor::getName(), *this );
-}
+ }
Dependencies& getDependencies(){
return *m_dependencies;
+#include "uilib.h"
+
+#include <tuple>
+
+#include <gtk/gtk.h>
+
+#include "gtkutil/dialog.h"
+#include "gtkutil/filechooser.h"
+#include "gtkutil/messagebox.h"
+#include "gtkutil/window.h"
+
+namespace ui {
+
+ void init(int argc, char *argv[])
+ {
+ gtk_disable_setlocale();
+ gtk_init(&argc, &argv);
+ }
+
+ void main()
+ {
+ gtk_main();
+ }
+
+ Widget root;
+
+ alert_response Widget::alert(std::string text, std::string title, alert_type type, alert_icon icon)
+ {
+ auto ret = gtk_MessageBox(*this, text.c_str(),
+ title.c_str(),
+ type == alert_type::OK ? eMB_OK :
+ type == alert_type::OKCANCEL ? eMB_OKCANCEL :
+ type == alert_type::YESNO ? eMB_YESNO :
+ type == alert_type::YESNOCANCEL ? eMB_YESNOCANCEL :
+ type == alert_type::NOYES ? eMB_NOYES :
+ eMB_OK,
+ icon == alert_icon::Default ? eMB_ICONDEFAULT :
+ icon == alert_icon::Error ? eMB_ICONERROR :
+ icon == alert_icon::Warning ? eMB_ICONWARNING :
+ icon == alert_icon::Question ? eMB_ICONQUESTION :
+ icon == alert_icon::Asterisk ? eMB_ICONASTERISK :
+ eMB_ICONDEFAULT
+ );
+ return
+ ret == eIDOK ? alert_response::OK :
+ ret == eIDCANCEL ? alert_response::CANCEL :
+ ret == eIDYES ? alert_response::YES :
+ ret == eIDNO ? alert_response::NO :
+ alert_response::OK;
+ }
+
+ const char *Widget::file_dialog(bool open, const char *title, const char *path,
+ const char *pattern, bool want_load, bool want_import,
+ bool want_save)
+ {
+ return ::file_dialog(*this, open, title, path, pattern, want_load, want_import, want_save);
+ }
+
+ Window::Window(window_type type)
+ : Window(GTK_WINDOW(gtk_window_new(
+ type == window_type::TOP ? GTK_WINDOW_TOPLEVEL :
+ type == window_type::POPUP ? GTK_WINDOW_POPUP :
+ GTK_WINDOW_TOPLEVEL)))
+ { };
+
+ Window Window::create_dialog_window(const char *title, void func(), void *data, int default_w, int default_h)
+ {
+ return Window(::create_dialog_window(*this, title, func, data, default_w, default_h));
+ }
+
+ Window Window::create_modal_dialog_window(const char *title, ui_modal &dialog, int default_w, int default_h)
+ {
+ return Window(::create_modal_dialog_window(*this, title, dialog, default_w, default_h));
+ }
+
+ Window Window::create_floating_window(const char *title)
+ {
+ return Window(::create_floating_window(title, *this));
+ }
+
+ std::uint64_t Window::on_key_press(bool (*f)(Widget widget, ui_evkey *event, void *extra), void *extra)
+ {
+ using f_t = decltype(f);
+ struct user_data {
+ f_t f;
+ void *extra;
+ } *pass = new user_data{f, extra};
+ auto dtor = [](user_data *data, GClosure *) {
+ delete data;
+ };
+ auto func = [](ui_widget *widget, GdkEventKey *event, user_data *args) -> bool {
+ return args->f(Widget(widget), event, args->extra);
+ };
+ auto clos = g_cclosure_new(G_CALLBACK(+func), pass, reinterpret_cast<GClosureNotify>(+dtor));
+ return g_signal_connect_closure(G_OBJECT(*this), "key-press-event", clos, false);
+ }
+
+ AccelGroup::AccelGroup() : AccelGroup(GTK_ACCEL_GROUP(gtk_accel_group_new()))
+ { }
+
+ Adjustment::Adjustment(double value,
+ double lower, double upper,
+ double step_increment, double page_increment,
+ double page_size)
+ : Adjustment(
+ GTK_ADJUSTMENT(gtk_adjustment_new(value, lower, upper, step_increment, page_increment, page_size)))
+ { }
+
+ Alignment::Alignment(float xalign, float yalign, float xscale, float yscale)
+ : Alignment(GTK_ALIGNMENT(gtk_alignment_new(xalign, yalign, xscale, yscale)))
+ { }
+
+ Button::Button() : Button(GTK_BUTTON(gtk_button_new()))
+ { }
+
+ Button::Button(const char *label) : Button(GTK_BUTTON(gtk_button_new_with_label(label)))
+ { }
+
+ CellRendererText::CellRendererText() : CellRendererText(GTK_CELL_RENDERER_TEXT(gtk_cell_renderer_text_new()))
+ { }
+
+ ComboBoxText::ComboBoxText() : ComboBoxText(GTK_COMBO_BOX_TEXT(gtk_combo_box_text_new()))
+ { }
+
+ CheckButton::CheckButton(const char *label) : CheckButton(GTK_CHECK_BUTTON(gtk_check_button_new_with_label(label)))
+ { }
+
+ Entry::Entry() : Entry(GTK_ENTRY(gtk_entry_new()))
+ { }
+
+ Entry::Entry(std::size_t max_length) : Entry()
+ {
+ gtk_entry_set_max_length(*this, static_cast<gint>(max_length));
+ }
+
+ Frame::Frame(const char *label) : Frame(GTK_FRAME(gtk_frame_new(label)))
+ { }
+
+ HBox::HBox(bool homogenous, int spacing) : HBox(GTK_HBOX(gtk_hbox_new(homogenous, spacing)))
+ { }
+
+ HScale::HScale(Adjustment adjustment) : HScale(GTK_HSCALE(gtk_hscale_new(adjustment)))
+ { }
+
+ HScale::HScale(double min, double max, double step) : HScale(GTK_HSCALE(gtk_hscale_new_with_range(min, max, step)))
+ { }
+
+ Image::Image() : Image(GTK_IMAGE(gtk_image_new()))
+ { }
+
+ Label::Label(const char *label) : Label(GTK_LABEL(gtk_label_new(label)))
+ { }
+
+ Menu::Menu() : Menu(GTK_MENU(gtk_menu_new()))
+ { }
+
+ MenuItem::MenuItem(const char *label, bool mnemonic) : MenuItem(
+ GTK_MENU_ITEM((mnemonic ? gtk_menu_item_new_with_mnemonic : gtk_menu_item_new_with_label)(label)))
+ { }
+
+ HPaned::HPaned() : HPaned(GTK_HPANED(gtk_hpaned_new()))
+ { }
+
+ VPaned::VPaned() : VPaned(GTK_VPANED(gtk_vpaned_new()))
+ { }
+
+ 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)))
+ { }
+
+ TextView::TextView() : TextView(GTK_TEXT_VIEW(gtk_text_view_new()))
+ { }
+
+ TreePath::TreePath() : TreePath(gtk_tree_path_new())
+ { }
+
+ TreePath::TreePath(const char *path) : TreePath(gtk_tree_path_new_from_string(path))
+ { }
+
+ TreeView::TreeView() : TreeView(GTK_TREE_VIEW(gtk_tree_view_new()))
+ { }
+
+ TreeView::TreeView(TreeModel model) : TreeView(GTK_TREE_VIEW(gtk_tree_view_new_with_model(model)))
+ { }
+
+ TreeViewColumn::TreeViewColumn(const char *title, CellRenderer renderer,
+ std::initializer_list<TreeViewColumnAttribute> attributes)
+ : TreeViewColumn(gtk_tree_view_column_new_with_attributes(title, renderer, nullptr))
+ {
+ for (auto &it : attributes) {
+ gtk_tree_view_column_add_attribute(*this, renderer, it.attribute, it.column);
+ }
+ };
+
+ VBox::VBox(bool homogenous, int spacing) : VBox(GTK_VBOX(gtk_vbox_new(homogenous, spacing)))
+ { }
+
+}
--- /dev/null
+#ifndef INCLUDED_UILIB_H
+#define INCLUDED_UILIB_H
+
+#include <string>
+
+using ui_accelgroup = struct _GtkAccelGroup;
+using ui_adjustment = struct _GtkAdjustment;
+using ui_alignment = struct _GtkAlignment;
+using ui_box = struct _GtkBox;
+using ui_button = struct _GtkButton;
+using ui_checkbutton = struct _GtkCheckButton;
+using ui_combobox = struct _GtkComboBox;
+using ui_comboboxtext = struct _GtkComboBoxText;
+using ui_cellrenderer = struct _GtkCellRenderer;
+using ui_cellrenderertext = struct _GtkCellRendererText;
+using ui_entry = struct _GtkEntry;
+using ui_evkey = struct _GdkEventKey;
+using ui_frame = struct _GtkFrame;
+using ui_hbox = struct _GtkHBox;
+using ui_hscale = struct _GtkHScale;
+using ui_hpaned = struct _GtkHPaned;
+using ui_image = struct _GtkImage;
+using ui_label = struct _GtkLabel;
+using ui_menu = struct _GtkMenu;
+using ui_menuitem = struct _GtkMenuItem;
+using ui_modal = struct ModalDialog;
+using ui_object = struct _GtkObject;
+using ui_paned = struct _GtkPaned;
+using ui_scrolledwindow = struct _GtkScrolledWindow;
+using ui_spinbutton = struct _GtkSpinButton;
+using ui_table = struct _GtkTable;
+using ui_textview = struct _GtkTextView;
+using ui_treemodel = struct _GtkTreeModel;
+using ui_treepath = struct _GtkTreePath;
+using ui_treeview = struct _GtkTreeView;
+using ui_treeviewcolumn = struct _GtkTreeViewColumn;
+using ui_typeinst = struct _GTypeInstance;
+using ui_vbox = struct _GtkVBox;
+using ui_vpaned = struct _GtkVPaned;
+using ui_widget = struct _GtkWidget;
+using ui_window = struct _GtkWindow;
+
+namespace ui {
+
+ void init(int argc, char *argv[]);
+
+ void main();
+
+ enum class alert_type {
+ OK,
+ OKCANCEL,
+ YESNO,
+ YESNOCANCEL,
+ NOYES,
+ };
+
+ enum class alert_icon {
+ Default,
+ Error,
+ Warning,
+ Question,
+ Asterisk,
+ };
+
+ enum class alert_response {
+ OK,
+ CANCEL,
+ YES,
+ NO,
+ };
+
+ enum class window_type {
+ TOP,
+ POPUP
+ };
+
+ template<class Self, class T, bool implicit = true>
+ struct Convertible;
+
+ template<class Self, class T>
+ struct Convertible<Self, T, true> {
+ operator T *() const
+ { return reinterpret_cast<T *>(static_cast<const Self *>(this)->_handle); }
+ };
+
+ template<class Self, class T>
+ struct Convertible<Self, T, false> {
+ explicit operator T *() const
+ { return reinterpret_cast<T *>(static_cast<const Self *>(this)->_handle); }
+ };
+
+ class Object : public Convertible<Object, ui_object, false> {
+ public:
+ using native = ui_object;
+ void *_handle;
+
+ Object(void *h) : _handle(h)
+ { }
+
+ explicit operator bool() const
+ { return _handle != nullptr; }
+
+ explicit operator ui_typeinst *() const
+ { return (ui_typeinst *) _handle; }
+
+ explicit operator void *() const
+ { return _handle; }
+ };
+
+ static_assert(sizeof(Object) == sizeof(ui_widget *), "object slicing");
+
+ class Widget : public Object, public Convertible<Widget, ui_widget> {
+ public:
+ using native = ui_widget;
+ explicit Widget(ui_widget *h = nullptr) : Object((void *) h)
+ { }
+
+ alert_response alert(std::string text, std::string title = "NetRadiant",
+ alert_type type = alert_type::OK, alert_icon icon = alert_icon::Default);
+
+ const char *file_dialog(bool open, const char *title, const char *path = nullptr,
+ const char *pattern = nullptr, bool want_load = false, bool want_import = false,
+ bool want_save = false);
+ };
+
+ static_assert(sizeof(Widget) == sizeof(Object), "object slicing");
+
+ extern Widget root;
+
+#define WRAP(name, super, impl, methods) \
+ class name : public super, public Convertible<name, impl> { \
+ public: \
+ using native = impl; \
+ explicit name(impl *h) : super(reinterpret_cast<super::native *>(h)) {} \
+ methods \
+ }; \
+ static_assert(sizeof(name) == sizeof(super), "object slicing")
+
+ WRAP(AccelGroup, Object, ui_accelgroup,
+ AccelGroup();
+ );
+
+ WRAP(Adjustment, Widget, ui_adjustment,
+ Adjustment(double value,
+ double lower, double upper,
+ double step_increment, double page_increment,
+ double page_size);
+ );
+
+ WRAP(Alignment, Widget, ui_alignment,
+ Alignment(float xalign, float yalign, float xscale, float yscale);
+ );
+
+ WRAP(Box, Widget, ui_box,);
+
+ WRAP(Button, Widget, ui_button,
+ Button();
+ Button(const char *label);
+ );
+
+ WRAP(CellRenderer, Object, ui_cellrenderer,);
+
+ WRAP(CellRendererText, CellRenderer, ui_cellrenderertext,
+ CellRendererText();
+ );
+
+ WRAP(CheckButton, Widget, ui_checkbutton,
+ CheckButton(const char *label);
+ );
+
+ WRAP(ComboBox, Widget, ui_combobox,);
+
+ WRAP(ComboBoxText, ComboBox, ui_comboboxtext,
+ ComboBoxText();
+ );
+
+ WRAP(Entry, Widget, ui_entry,
+ Entry();
+ Entry(std::size_t max_length);
+ );
+
+ WRAP(Frame, Widget, ui_frame,
+ Frame(const char *label = nullptr);
+ );
+
+ WRAP(HBox, Box, ui_hbox,
+ HBox(bool homogenous, int spacing);
+ );
+
+ WRAP(HScale, Widget, ui_hscale,
+ HScale(Adjustment adjustment);
+ HScale(double min, double max, double step);
+ );
+
+ WRAP(Image, Widget, ui_image,
+ Image();
+ );
+
+ WRAP(Label, Widget, ui_label,
+ Label(const char *label);
+ );
+
+ WRAP(Menu, Widget, ui_menu,
+ Menu();
+ );
+
+ WRAP(MenuItem, Widget, ui_menuitem,
+ MenuItem(const char *label, bool mnemonic = false);
+ );
+
+ WRAP(Paned, Widget, ui_paned,);
+
+ WRAP(HPaned, Paned, ui_hpaned,
+ HPaned();
+ );
+
+ WRAP(VPaned, Paned, ui_vpaned,
+ VPaned();
+ );
+
+ WRAP(ScrolledWindow, Widget, ui_scrolledwindow,
+ 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(TextView, Widget, ui_textview,
+ TextView();
+ );
+
+ WRAP(TreeModel, Widget, ui_treemodel,);
+
+ WRAP(TreePath, Object, ui_treepath,
+ TreePath();
+ TreePath(const char *path);
+ );
+
+ WRAP(TreeView, Widget, ui_treeview,
+ TreeView();
+ TreeView(TreeModel model);
+ );
+
+ struct TreeViewColumnAttribute {
+ const char *attribute;
+ int column;
+ };
+ WRAP(TreeViewColumn, Widget, ui_treeviewcolumn,
+ TreeViewColumn(const char *title, CellRenderer renderer, std::initializer_list<TreeViewColumnAttribute> attributes);
+ );
+
+ WRAP(VBox, Box, ui_vbox,
+ VBox(bool homogenous, int spacing);
+ );
+
+ WRAP(Window, Widget, ui_window,
+ Window() : Window(nullptr) {};
+ Window(window_type type);
+
+ 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
+
+}
+
+#endif
if ( m_bPopup ) {
GtkWidget *menu, *item;
- menu = gtk_menu_new();
+ menu = ui::Menu();
- item = gtk_menu_item_new_with_label( "Validate (RETURN)" );
- gtk_signal_connect( GTK_OBJECT( item ), "activate", GTK_SIGNAL_FUNC( Textool_Validate ), NULL );
+ item = ui::MenuItem( "Validate (RETURN)" );
+ g_signal_connect( GTK_OBJECT( item ), "activate", G_CALLBACK( Textool_Validate ), NULL );
gtk_widget_show( item );
gtk_menu_append( GTK_MENU( menu ), item );
- item = gtk_menu_item_new_with_label( "Zoom in (INSERT)" );
- gtk_signal_connect( GTK_OBJECT( item ), "activate", GTK_SIGNAL_FUNC( view_ZoomIn ), this );
+ item = ui::MenuItem( "Zoom in (INSERT)" );
+ g_signal_connect( GTK_OBJECT( item ), "activate", G_CALLBACK( view_ZoomIn ), this );
gtk_widget_show( item );
gtk_menu_append( GTK_MENU( menu ), item );
- item = gtk_menu_item_new_with_label( "Zoom out (DELETE)" );
- gtk_signal_connect( GTK_OBJECT( item ), "activate", GTK_SIGNAL_FUNC( view_ZoomOut ), this );
+ item = ui::MenuItem( "Zoom out (DELETE)" );
+ g_signal_connect( GTK_OBJECT( item ), "activate", G_CALLBACK( view_ZoomOut ), this );
gtk_widget_show( item );
gtk_menu_append( GTK_MENU( menu ), item );
- item = gtk_menu_item_new_with_label( "Cancel (ESC)" );
- gtk_signal_connect( GTK_OBJECT( item ), "activate", GTK_SIGNAL_FUNC( Textool_Cancel ), NULL );
+ item = ui::MenuItem( "Cancel (ESC)" );
+ g_signal_connect( GTK_OBJECT( item ), "activate", G_CALLBACK( Textool_Cancel ), NULL );
gtk_widget_show( item );
gtk_menu_append( GTK_MENU( menu ), item );
GtkWidget *window, *w, *vbox, *hbox;
int mode = ( uType & MB_TYPEMASK ), ret, loop = 1;
- window = gtk_window_new( GTK_WINDOW_TOPLEVEL );
- gtk_signal_connect( GTK_OBJECT( window ), "delete_event",
- GTK_SIGNAL_FUNC( dialog_delete_callback ), NULL );
- gtk_signal_connect( GTK_OBJECT( window ), "destroy",
- GTK_SIGNAL_FUNC( gtk_widget_destroy ), NULL );
+ window = ui::Window( ui::window_type::TOP );
+ g_signal_connect( GTK_OBJECT( window ), "delete_event",
+ G_CALLBACK( dialog_delete_callback ), NULL );
+ g_signal_connect( GTK_OBJECT( window ), "destroy",
+ G_CALLBACK( gtk_widget_destroy ), NULL );
gtk_window_set_title( GTK_WINDOW( window ), lpCaption );
- gtk_container_border_width( GTK_CONTAINER( window ), 10 );
+ gtk_container_set_border_width( GTK_CONTAINER( window ), 10 );
g_object_set_data( G_OBJECT( window ), "loop", &loop );
g_object_set_data( G_OBJECT( window ), "ret", &ret );
gtk_widget_realize( window );
- vbox = gtk_vbox_new( FALSE, 10 );
+ vbox = ui::VBox( FALSE, 10 );
gtk_container_add( GTK_CONTAINER( window ), vbox );
gtk_widget_show( vbox );
- w = gtk_label_new( lpText );
+ w = ui::Label( lpText );
gtk_box_pack_start( GTK_BOX( vbox ), w, FALSE, FALSE, 2 );
gtk_label_set_justify( GTK_LABEL( w ), GTK_JUSTIFY_LEFT );
gtk_widget_show( w );
gtk_box_pack_start( GTK_BOX( vbox ), w, FALSE, FALSE, 2 );
gtk_widget_show( w );
- hbox = gtk_hbox_new( FALSE, 10 );
+ hbox = ui::HBox( FALSE, 10 );
gtk_box_pack_start( GTK_BOX( vbox ), hbox, FALSE, FALSE, 2 );
gtk_widget_show( hbox );
if ( mode == MB_OK ) {
- w = 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( IDOK ) );
- GTK_WIDGET_SET_FLAGS( w, GTK_CAN_DEFAULT );
+ g_signal_connect( GTK_OBJECT( w ), "clicked",
+ G_CALLBACK( dialog_button_callback ), GINT_TO_POINTER( IDOK ) );
+ gtk_widget_set_can_default( w, true );
gtk_widget_grab_default( w );
gtk_widget_show( w );
ret = IDOK;
}
else if ( mode == MB_OKCANCEL ) {
- w = 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( IDOK ) );
- GTK_WIDGET_SET_FLAGS( w, GTK_CAN_DEFAULT );
+ g_signal_connect( GTK_OBJECT( w ), "clicked",
+ G_CALLBACK( dialog_button_callback ), GINT_TO_POINTER( IDOK ) );
+ gtk_widget_set_can_default( w, true );
gtk_widget_grab_default( w );
gtk_widget_show( w );
- w = 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( IDCANCEL ) );
+ g_signal_connect( GTK_OBJECT( w ), "clicked",
+ G_CALLBACK( dialog_button_callback ), GINT_TO_POINTER( IDCANCEL ) );
gtk_widget_show( w );
ret = IDCANCEL;
}
else if ( mode == MB_YESNOCANCEL ) {
- w = 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( IDYES ) );
- GTK_WIDGET_SET_FLAGS( w, GTK_CAN_DEFAULT );
+ g_signal_connect( GTK_OBJECT( w ), "clicked",
+ G_CALLBACK( dialog_button_callback ), GINT_TO_POINTER( IDYES ) );
+ gtk_widget_set_can_default( w, true );
gtk_widget_grab_default( w );
gtk_widget_show( w );
- w = 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( IDNO ) );
+ g_signal_connect( GTK_OBJECT( w ), "clicked",
+ G_CALLBACK( dialog_button_callback ), GINT_TO_POINTER( IDNO ) );
gtk_widget_show( w );
- w = 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( IDCANCEL ) );
+ g_signal_connect( GTK_OBJECT( w ), "clicked",
+ G_CALLBACK( dialog_button_callback ), GINT_TO_POINTER( IDCANCEL ) );
gtk_widget_show( w );
ret = IDCANCEL;
}
else /* if (mode == MB_YESNO) */
{
- w = 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( IDYES ) );
- GTK_WIDGET_SET_FLAGS( w, GTK_CAN_DEFAULT );
+ g_signal_connect( GTK_OBJECT( w ), "clicked",
+ G_CALLBACK( dialog_button_callback ), GINT_TO_POINTER( IDYES ) );
+ gtk_widget_set_can_default( w, true );
gtk_widget_grab_default( w );
gtk_widget_show( w );
- w = 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( IDNO ) );
+ g_signal_connect( GTK_OBJECT( w ), "clicked",
+ G_CALLBACK( dialog_button_callback ), GINT_TO_POINTER( IDNO ) );
gtk_widget_show( w );
ret = IDNO;
}
GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK | GDK_POINTER_MOTION_MASK );
// Connect signal handlers
- gtk_signal_connect( GTK_OBJECT( g_pToolWidget ), "expose_event", GTK_SIGNAL_FUNC( expose ), NULL );
- gtk_signal_connect( GTK_OBJECT( g_pToolWidget ), "motion_notify_event",
- GTK_SIGNAL_FUNC( motion ), NULL );
- gtk_signal_connect( GTK_OBJECT( g_pToolWidget ), "button_press_event",
- GTK_SIGNAL_FUNC( button_press ), NULL );
- gtk_signal_connect( GTK_OBJECT( g_pToolWidget ), "button_release_event",
- GTK_SIGNAL_FUNC( button_release ), NULL );
-
- gtk_signal_connect( GTK_OBJECT( g_pToolWnd ), "delete_event", GTK_SIGNAL_FUNC( close ), NULL );
- gtk_signal_connect( GTK_OBJECT( g_pToolWnd ), "key_press_event",
- GTK_SIGNAL_FUNC( keypress ), NULL );
+ g_signal_connect( GTK_OBJECT( g_pToolWidget ), "expose_event", G_CALLBACK( expose ), NULL );
+ g_signal_connect( GTK_OBJECT( g_pToolWidget ), "motion_notify_event",
+ G_CALLBACK( motion ), NULL );
+ g_signal_connect( GTK_OBJECT( g_pToolWidget ), "button_press_event",
+ G_CALLBACK( button_press ), NULL );
+ g_signal_connect( GTK_OBJECT( g_pToolWidget ), "button_release_event",
+ G_CALLBACK( button_release ), NULL );
+
+ g_signal_connect( GTK_OBJECT( g_pToolWnd ), "delete_event", G_CALLBACK( close ), NULL );
+ g_signal_connect( GTK_OBJECT( g_pToolWnd ), "key_press_event",
+ G_CALLBACK( keypress ), NULL );
return g_pToolWidget;
}
#include "archivelib.h"
#include "fs_path.h"
+
class DirectoryArchive : public Archive
{
CopiedString m_root;
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
+#include <uilib/uilib.h>
#include "autosave.h"
#include "os/file.h"
{
StringOutputStream strMsg( 256 );
strMsg << "Snapshot save failed.. unabled to create directory\n" << snapshotsDir.c_str();
- gtk_MessageBox( GTK_WIDGET( MainFrame_getWindow() ), strMsg.c_str() );
+ MainFrame_getWindow().alert( strMsg.c_str() );
}
}
/*
}
void Autosave_constructPreferences( PreferencesPage& page ){
- GtkWidget* autosave_enabled = page.appendCheckBox( "Autosave", "Enable Autosave", g_AutoSave_Enabled );
- GtkWidget* autosave_frequency = page.appendSpinner( "Autosave Frequency (minutes)", m_AutoSave_Frequency, 1, 1, 60 );
+ ui::CheckButton autosave_enabled = page.appendCheckBox( "Autosave", "Enable Autosave", g_AutoSave_Enabled );
+ ui::SpinButton autosave_frequency = page.appendSpinner( "Autosave Frequency (minutes)", m_AutoSave_Frequency, 1, 1, 60 );
Widget_connectToggleDependency( autosave_frequency, autosave_enabled );
page.appendCheckBox( "", "Save Snapshots", g_SnapShots_Enabled );
}
#include "preferences.h"
#include <list>
+#include <gdk/gdkkeysyms.h>
void Brush_ConstructCuboid( Brush& brush, const AABB& bounds, const char* shader, const TextureProjection& projection ){
const unsigned char box[3][2] = { { 0, 1 }, { 2, 0 }, { 1, 2 } };
GlobalCommands_insert( "Brush8Sided", BrushMakeSided::SetCaller( g_brushmakesided8 ), Accelerator( '8', (GdkModifierType)GDK_CONTROL_MASK ) );
GlobalCommands_insert( "Brush9Sided", BrushMakeSided::SetCaller( g_brushmakesided9 ), Accelerator( '9', (GdkModifierType)GDK_CONTROL_MASK ) );
- GlobalCommands_insert( "ClipSelected", FreeCaller<ClipSelected>(), Accelerator( GDK_Return ) );
- GlobalCommands_insert( "SplitSelected", FreeCaller<SplitSelected>(), Accelerator( GDK_Return, (GdkModifierType)GDK_SHIFT_MASK ) );
- GlobalCommands_insert( "FlipClip", FreeCaller<FlipClipper>(), Accelerator( GDK_Return, (GdkModifierType)GDK_CONTROL_MASK ) );
+ GlobalCommands_insert( "ClipSelected", FreeCaller<ClipSelected>(), Accelerator( GDK_KEY_Return ) );
+ GlobalCommands_insert( "SplitSelected", FreeCaller<SplitSelected>(), Accelerator( GDK_KEY_Return, (GdkModifierType)GDK_SHIFT_MASK ) );
+ GlobalCommands_insert( "FlipClip", FreeCaller<FlipClipper>(), Accelerator( GDK_KEY_Return, (GdkModifierType)GDK_CONTROL_MASK ) );
GlobalCommands_insert( "MakeDetail", FreeCaller<Select_MakeDetail>(), Accelerator( 'M', (GdkModifierType)GDK_CONTROL_MASK ) );
GlobalCommands_insert( "MakeStructural", FreeCaller<Select_MakeStructural>(), Accelerator( 'S', (GdkModifierType)( GDK_SHIFT_MASK | GDK_CONTROL_MASK ) ) );
#include <gdk/gdkkeysyms.h>
-#include <gtk/gtkmain.h>
-#include <gtk/gtkbox.h>
-#include <gtk/gtktable.h>
-#include <gtk/gtktreeview.h>
-#include <gtk/gtkcellrenderertext.h>
-#include <gtk/gtktreeselection.h>
-#include <gtk/gtkliststore.h>
-#include <gtk/gtkscrolledwindow.h>
+#include <gtk/gtk.h>
#include "gtkutil/dialog.h"
#include "gtkutil/closure.h"
gboolean project_cell_edited( GtkCellRendererText* cell, gchar* path_string, gchar* new_text, ProjectList* projectList ){
Project& project = projectList->m_project;
- GtkTreePath* path = gtk_tree_path_new_from_string( path_string );
+ GtkTreePath* path = ui::TreePath( path_string );
ASSERT_MESSAGE( gtk_tree_path_get_depth( path ) == 1, "invalid path length" );
return FALSE;
}
-gboolean project_key_press( GtkWidget* widget, GdkEventKey* event, ProjectList* projectList ){
+gboolean project_key_press( ui::Widget widget, GdkEventKey* event, ProjectList* projectList ){
Project& project = projectList->m_project;
if ( event->keyval == GDK_Delete ) {
}
Build& build = *g_current_build;
- GtkTreePath* path = gtk_tree_path_new_from_string( path_string );
+ GtkTreePath* path = ui::TreePath( path_string );
ASSERT_MESSAGE( gtk_tree_path_get_depth( path ) == 1, "invalid path length" );
return FALSE;
}
-gboolean commands_key_press( GtkWidget* widget, GdkEventKey* event, GtkListStore* store ){
+gboolean commands_key_press( ui::Widget widget, GdkEventKey* event, GtkListStore* store ){
if ( g_current_build == 0 ) {
return FALSE;
}
}
-GtkWindow* BuildMenuDialog_construct( ModalDialog& modal, ProjectList& projectList ){
- GtkWindow* window = create_dialog_window( MainFrame_getWindow(), "Build Menu", G_CALLBACK( dialog_delete_callback ), &modal, -1, 400 );
+ui::Window BuildMenuDialog_construct( ModalDialog& modal, ProjectList& projectList ){
+ ui::Window window = MainFrame_getWindow().create_dialog_window("Build Menu", G_CALLBACK(dialog_delete_callback ), &modal, -1, 400 );
- GtkWidget* buildView = 0;
+ ui::Widget buildView;
{
GtkTable* table1 = create_dialog_table( 2, 2, 4, 4, 4 );
{
GtkListStore* store = gtk_list_store_new( 1, G_TYPE_STRING );
- GtkWidget* view = gtk_tree_view_new_with_model( GTK_TREE_MODEL( store ) );
+ ui::Widget view = ui::TreeView( ui::TreeModel(GTK_TREE_MODEL( store ) ));
gtk_tree_view_set_headers_visible( GTK_TREE_VIEW( view ), FALSE );
- GtkCellRenderer* renderer = gtk_cell_renderer_text_new();
+ auto renderer = ui::CellRendererText();
object_set_boolean_property( G_OBJECT( renderer ), "editable", TRUE );
- g_signal_connect( renderer, "edited", G_CALLBACK( project_cell_edited ), &projectList );
+ g_signal_connect( G_OBJECT(renderer), "edited", G_CALLBACK( project_cell_edited ), &projectList );
- GtkTreeViewColumn* column = gtk_tree_view_column_new_with_attributes( "", renderer, "text", 0, 0 );
+ GtkTreeViewColumn* column = ui::TreeViewColumn( "", renderer, {{"text", 0}} );
gtk_tree_view_append_column( GTK_TREE_VIEW( view ), column );
GtkTreeSelection* selection = gtk_tree_view_get_selection( GTK_TREE_VIEW( view ) );
{
GtkListStore* store = gtk_list_store_new( 1, G_TYPE_STRING );
- GtkWidget* view = gtk_tree_view_new_with_model( GTK_TREE_MODEL( store ) );
+ ui::Widget view = ui::TreeView(ui::TreeModel( GTK_TREE_MODEL( store ) ));
gtk_tree_view_set_headers_visible( GTK_TREE_VIEW( view ), FALSE );
- GtkCellRenderer* renderer = gtk_cell_renderer_text_new();
+ auto renderer = ui::CellRendererText();
object_set_boolean_property( G_OBJECT( renderer ), "editable", TRUE );
- g_signal_connect( renderer, "edited", G_CALLBACK( commands_cell_edited ), store );
+ g_signal_connect( G_OBJECT(renderer), "edited", G_CALLBACK( commands_cell_edited ), store );
- GtkTreeViewColumn* column = gtk_tree_view_column_new_with_attributes( "", renderer, "text", 0, 0 );
+ GtkTreeViewColumn* column = ui::TreeViewColumn( "", renderer, {{"text", 0}} );
gtk_tree_view_append_column( GTK_TREE_VIEW( view ), column );
GtkTreeSelection* selection = gtk_tree_view_get_selection( GTK_TREE_VIEW( view ) );
ProjectList projectList( g_build_project );
- GtkWindow* window = BuildMenuDialog_construct( modal, projectList );
+ ui::Window window = BuildMenuDialog_construct( modal, projectList );
if ( modal_dialog_show( window, modal ) == eIDCANCEL ) {
build_commands_clear();
// Leonardo Zide (leo@lokigames.com)
//
+#include <gdk/gdkkeysyms.h>
#include "camwindow.h"
#include "debugging/debugging.h"
FreezePointer m_freezePointer;
public:
-GtkWidget* m_gl_widget;
-GtkWindow* m_parent;
+ui::Widget m_gl_widget;
+ui::Window m_parent;
SelectionSystemWindowObserver* m_window_observer;
XORRectangle m_XORRectangle;
}
-GtkWidget* CamWnd_getWidget( CamWnd& camwnd ){
+ui::Widget CamWnd_getWidget( CamWnd& camwnd ){
return camwnd.m_gl_widget;
}
-GtkWindow* CamWnd_getParent( CamWnd& camwnd ){
+ui::Window CamWnd_getParent( CamWnd& camwnd ){
return camwnd.m_parent;
}
ToggleShown g_camera_shown( true );
-void CamWnd_setParent( CamWnd& camwnd, GtkWindow* parent ){
+void CamWnd_setParent( CamWnd& camwnd, ui::Window parent ){
camwnd.m_parent = parent;
g_camera_shown.connect( GTK_WIDGET( camwnd.m_parent ) );
}
// =============================================================================
// CamWnd class
-gboolean enable_freelook_button_press( GtkWidget* widget, GdkEventButton* event, CamWnd* camwnd ){
+gboolean enable_freelook_button_press( ui::Widget widget, GdkEventButton* event, CamWnd* camwnd ){
if ( event->type == GDK_BUTTON_PRESS && event->button == 3 ) {
camwnd->EnableFreeMove();
return TRUE;
return FALSE;
}
-gboolean disable_freelook_button_press( GtkWidget* widget, GdkEventButton* event, CamWnd* camwnd ){
+gboolean disable_freelook_button_press( ui::Widget widget, GdkEventButton* event, CamWnd* camwnd ){
if ( event->type == GDK_BUTTON_PRESS && event->button == 3 ) {
camwnd->DisableFreeMove();
return TRUE;
}
#if 0
-gboolean mousecontrol_button_press( GtkWidget* widget, GdkEventButton* event, CamWnd* camwnd ){
+gboolean mousecontrol_button_press( ui::Widget widget, GdkEventButton* event, CamWnd* camwnd ){
if ( event->type == GDK_BUTTON_PRESS && event->button == 3 ) {
Cam_MouseControl( camwnd->getCamera(), event->x, widget->allocation.height - 1 - event->y );
}
#endif
void camwnd_update_xor_rectangle( CamWnd& self, rect_t area ){
- if ( GTK_WIDGET_VISIBLE( self.m_gl_widget ) ) {
+ if ( gtk_widget_get_visible( self.m_gl_widget ) ) {
self.m_XORRectangle.set( rectangle_from_area( area.min, area.max, self.getCamera().width, self.getCamera().height ) );
}
}
-gboolean selection_button_press( GtkWidget* widget, GdkEventButton* event, WindowObserver* observer ){
+gboolean selection_button_press( ui::Widget widget, GdkEventButton* event, WindowObserver* observer ){
if ( event->type == GDK_BUTTON_PRESS ) {
observer->onMouseDown( WindowVector_forDouble( event->x, event->y ), button_for_button( event->button ), modifiers_for_state( event->state ) );
}
return FALSE;
}
-gboolean selection_button_release( GtkWidget* widget, GdkEventButton* event, WindowObserver* observer ){
+gboolean selection_button_release( ui::Widget widget, GdkEventButton* event, WindowObserver* observer ){
if ( event->type == GDK_BUTTON_RELEASE ) {
observer->onMouseUp( WindowVector_forDouble( event->x, event->y ), button_for_button( event->button ), modifiers_for_state( event->state ) );
}
reinterpret_cast<WindowObserver*>( data )->onMouseMotion( WindowVector_forDouble( x, y ), modifiers_for_state( state ) );
}
-inline WindowVector windowvector_for_widget_centre( GtkWidget* widget ){
- return WindowVector( static_cast<float>( widget->allocation.width / 2 ), static_cast<float>( widget->allocation.height / 2 ) );
+inline WindowVector windowvector_for_widget_centre( ui::Widget widget ){
+ GtkAllocation allocation;
+ gtk_widget_get_allocation(widget, &allocation);
+ return WindowVector( static_cast<float>( allocation.width / 2 ), static_cast<float>(allocation.height / 2 ) );
}
-gboolean selection_button_press_freemove( GtkWidget* widget, GdkEventButton* event, WindowObserver* observer ){
+gboolean selection_button_press_freemove( ui::Widget widget, GdkEventButton* event, WindowObserver* observer ){
if ( event->type == GDK_BUTTON_PRESS ) {
observer->onMouseDown( windowvector_for_widget_centre( widget ), button_for_button( event->button ), modifiers_for_state( event->state ) );
}
return FALSE;
}
-gboolean selection_button_release_freemove( GtkWidget* widget, GdkEventButton* event, WindowObserver* observer ){
+gboolean selection_button_release_freemove( ui::Widget widget, GdkEventButton* event, WindowObserver* observer ){
if ( event->type == GDK_BUTTON_RELEASE ) {
observer->onMouseUp( windowvector_for_widget_centre( widget ), button_for_button( event->button ), modifiers_for_state( event->state ) );
}
return FALSE;
}
-gboolean selection_motion_freemove( GtkWidget *widget, GdkEventMotion *event, WindowObserver* observer ){
+gboolean selection_motion_freemove( ui::Widget widget, GdkEventMotion *event, WindowObserver* observer ){
observer->onMouseMotion( windowvector_for_widget_centre( widget ), modifiers_for_state( event->state ) );
return FALSE;
}
-gboolean wheelmove_scroll( GtkWidget* widget, GdkEventScroll* event, CamWnd* camwnd ){
+gboolean wheelmove_scroll( ui::Widget widget, GdkEventScroll* event, CamWnd* camwnd ){
if ( event->direction == GDK_SCROLL_UP ) {
Camera_Freemove_updateAxes( camwnd->getCamera() );
Camera_setOrigin( *camwnd, vector3_added( Camera_getOrigin( *camwnd ), vector3_scaled( camwnd->getCamera().forward, static_cast<float>( g_camwindow_globals_private.m_nMoveSpeed ) ) ) );
return FALSE;
}
-gboolean camera_size_allocate( GtkWidget* widget, GtkAllocation* allocation, CamWnd* camwnd ){
+gboolean camera_size_allocate( ui::Widget widget, GtkAllocation* allocation, CamWnd* camwnd ){
camwnd->getCamera().width = allocation->width;
camwnd->getCamera().height = allocation->height;
Camera_updateProjection( camwnd->getCamera() );
return FALSE;
}
-gboolean camera_expose( GtkWidget* widget, GdkEventExpose* event, gpointer data ){
+gboolean camera_expose( ui::Widget widget, GdkEventExpose* event, gpointer data ){
reinterpret_cast<CamWnd*>( data )->draw();
return FALSE;
}
}
void CamWnd_registerCommands( CamWnd& camwnd ){
- GlobalKeyEvents_insert( "CameraForward", Accelerator( GDK_Up ),
+ GlobalKeyEvents_insert( "CameraForward", Accelerator( GDK_KEY_Up ),
ReferenceCaller<camera_t, Camera_MoveForward_KeyDown>( camwnd.getCamera() ),
ReferenceCaller<camera_t, Camera_MoveForward_KeyUp>( camwnd.getCamera() )
);
- GlobalKeyEvents_insert( "CameraBack", Accelerator( GDK_Down ),
+ GlobalKeyEvents_insert( "CameraBack", Accelerator( GDK_KEY_Down ),
ReferenceCaller<camera_t, Camera_MoveBack_KeyDown>( camwnd.getCamera() ),
ReferenceCaller<camera_t, Camera_MoveBack_KeyUp>( camwnd.getCamera() )
);
- GlobalKeyEvents_insert( "CameraLeft", Accelerator( GDK_Left ),
+ GlobalKeyEvents_insert( "CameraLeft", Accelerator( GDK_KEY_Left ),
ReferenceCaller<camera_t, Camera_RotateLeft_KeyDown>( camwnd.getCamera() ),
ReferenceCaller<camera_t, Camera_RotateLeft_KeyUp>( camwnd.getCamera() )
);
- GlobalKeyEvents_insert( "CameraRight", Accelerator( GDK_Right ),
+ GlobalKeyEvents_insert( "CameraRight", Accelerator( GDK_KEY_Right ),
ReferenceCaller<camera_t, Camera_RotateRight_KeyDown>( camwnd.getCamera() ),
ReferenceCaller<camera_t, Camera_RotateRight_KeyUp>( camwnd.getCamera() )
);
- GlobalKeyEvents_insert( "CameraStrafeRight", Accelerator( GDK_period ),
+ GlobalKeyEvents_insert( "CameraStrafeRight", Accelerator( GDK_KEY_period ),
ReferenceCaller<camera_t, Camera_MoveRight_KeyDown>( camwnd.getCamera() ),
ReferenceCaller<camera_t, Camera_MoveRight_KeyUp>( camwnd.getCamera() )
);
- GlobalKeyEvents_insert( "CameraStrafeLeft", Accelerator( GDK_comma ),
+ GlobalKeyEvents_insert( "CameraStrafeLeft", Accelerator( GDK_KEY_comma ),
ReferenceCaller<camera_t, Camera_MoveLeft_KeyDown>( camwnd.getCamera() ),
ReferenceCaller<camera_t, Camera_MoveLeft_KeyUp>( camwnd.getCamera() )
);
m_view( true ),
m_Camera( &m_view, CamWndQueueDraw( *this ) ),
m_cameraview( m_Camera, &m_view, ReferenceCaller<CamWnd, CamWnd_Update>( *this ) ),
- m_gl_widget( glwidget_new( TRUE ) ),
+ m_gl_widget( ui::Widget(glwidget_new( TRUE )) ),
m_window_observer( NewWindowObserver() ),
m_XORRectangle( m_gl_widget ),
m_deferredDraw( WidgetQueueDrawCaller( *m_gl_widget ) ),
m_window_observer->setRectangleDrawCallback( ReferenceCaller1<CamWnd, rect_t, camwnd_update_xor_rectangle>( *this ) );
m_window_observer->setView( m_view );
- gtk_widget_ref( m_gl_widget );
+ g_object_ref( m_gl_widget );
gtk_widget_set_events( m_gl_widget, GDK_DESTROY | GDK_EXPOSURE_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK | GDK_POINTER_MOTION_MASK | GDK_SCROLL_MASK );
- GTK_WIDGET_SET_FLAGS( m_gl_widget, GTK_CAN_FOCUS );
+ gtk_widget_set_can_focus( m_gl_widget, true );
m_sizeHandler = g_signal_connect( G_OBJECT( m_gl_widget ), "size_allocate", G_CALLBACK( camera_size_allocate ), this );
m_exposeHandler = g_signal_connect( G_OBJECT( m_gl_widget ), "expose_event", G_CALLBACK( camera_expose ), this );
g_signal_handler_disconnect( G_OBJECT( m_gl_widget ), m_sizeHandler );
g_signal_handler_disconnect( G_OBJECT( m_gl_widget ), m_exposeHandler );
- gtk_widget_unref( m_gl_widget );
+ g_object_unref( m_gl_widget );
m_window_observer->release();
}
// NOTE TTimo if there's an OS-level focus out of the application
// then we can release the camera cursor grab
-static gboolean camwindow_freemove_focusout( GtkWidget* widget, GdkEventFocus* event, gpointer data ){
+static gboolean camwindow_freemove_focusout( ui::Widget widget, GdkEventFocus* event, gpointer data ){
reinterpret_cast<CamWnd*>( data )->DisableFreeMove();
return FALSE;
}
#if !defined( INCLUDED_CAMWINDOW_H )
#define INCLUDED_CAMWINDOW_H
+#include <uilib/uilib.h>
#include "math/vector.h"
#include "signal/signalfwd.h"
-typedef struct _GtkWidget GtkWidget;
-typedef struct _GtkWindow GtkWindow;
-
class CamWnd;
CamWnd* NewCamWnd();
void DeleteCamWnd( CamWnd* camwnd );
void CamWnd_Update( CamWnd& camwnd );
-GtkWidget* CamWnd_getWidget( CamWnd& camwnd );
-void CamWnd_setParent( CamWnd& camwnd, GtkWindow* parent );
+ui::Widget CamWnd_getWidget( CamWnd& camwnd );
+void CamWnd_setParent( CamWnd& camwnd, ui::Window parent );
void GlobalCamera_setCamWnd( CamWnd& camwnd );
#include <map>
#include "string/string.h"
#include "versionlib.h"
-#include "gtkutil/accelerator.h"
#include "gtkutil/messagebox.h"
-#include <gtk/gtktreeselection.h>
-#include <gtk/gtkbutton.h>
+#include <gtk/gtk.h>
#include "gtkmisc.h"
typedef std::pair<Accelerator, int> ShortcutValue; // accelerator, isRegistered
}
-#include <cctype>
-
-#include <gtk/gtkbox.h>
-#include <gtk/gtkliststore.h>
-#include <gtk/gtktreemodel.h>
-#include <gtk/gtktreeview.h>
-#include <gtk/gtkcellrenderertext.h>
+#include <uilib/uilib.h>
+#include <gdk/gdkkeysyms.h>
#include "gtkutil/dialog.h"
#include "mainframe.h"
dialog.m_waiting_for_key = true;
}
-gboolean accelerator_window_key_press( GtkWidget *widget, GdkEventKey *event, gpointer dialogptr ){
+bool accelerator_window_key_press( ui::Widget widget, GdkEventKey *event, gpointer dialogptr ){
command_list_dialog_t &dialog = *(command_list_dialog_t *) dialogptr;
if ( !dialog.m_waiting_for_key ) {
#else
switch ( event->keyval )
{
- case GDK_Shift_L:
- case GDK_Shift_R:
- case GDK_Control_L:
- case GDK_Control_R:
- case GDK_Caps_Lock:
- case GDK_Shift_Lock:
- case GDK_Meta_L:
- case GDK_Meta_R:
- case GDK_Alt_L:
- case GDK_Alt_R:
- case GDK_Super_L:
- case GDK_Super_R:
- case GDK_Hyper_L:
- case GDK_Hyper_R:
+ case GDK_KEY_Shift_L:
+ case GDK_KEY_Shift_R:
+ case GDK_KEY_Control_L:
+ case GDK_KEY_Control_R:
+ case GDK_KEY_Caps_Lock:
+ case GDK_KEY_Shift_Lock:
+ case GDK_KEY_Meta_L:
+ case GDK_KEY_Meta_R:
+ case GDK_KEY_Alt_L:
+ case GDK_KEY_Alt_R:
+ case GDK_KEY_Super_L:
+ case GDK_KEY_Super_R:
+ case GDK_KEY_Hyper_L:
+ case GDK_KEY_Hyper_R:
return false;
}
#endif
{
const char *commandName;
const Accelerator &newAccel;
- GtkWidget *widget;
+ ui::Widget widget;
GtkTreeModel *model;
public:
bool allow;
- VerifyAcceleratorNotTaken( const char *name, const Accelerator &accelerator, GtkWidget *w, GtkTreeModel *m ) : commandName( name ), newAccel( accelerator ), widget( w ), model( m ), allow( true ){
+ VerifyAcceleratorNotTaken( const char *name, const Accelerator &accelerator, ui::Widget w, GtkTreeModel *m ) : commandName( name ), newAccel( accelerator ), widget( w ), model( m ), allow( true ){
}
void visit( const char* name, Accelerator& accelerator ){
if ( !strcmp( name, commandName ) ) {
StringOutputStream msg;
msg << "The command " << name << " is already assigned to the key " << accelerator << ".\n\n"
<< "Do you want to unassign " << name << " first?";
- EMessageBoxReturn r = gtk_MessageBox( widget, msg.c_str(), "Key already used", eMB_YESNOCANCEL );
- if ( r == eIDYES ) {
+ auto r = widget.alert( msg.c_str(), "Key already used", ui::alert_type::YESNOCANCEL );
+ if ( r == ui::alert_response::YES ) {
// clear the ACTUAL accelerator too!
disconnect_accelerator( name );
// delete the modifier
}
}
}
- else if ( r == eIDCANCEL ) {
+ else if ( r == ui::alert_response::CANCEL ) {
// aborted
allow = false;
}
void DoCommandListDlg(){
command_list_dialog_t dialog;
- GtkWindow* window = create_modal_dialog_window( MainFrame_getWindow(), "Mapped Commands", dialog, -1, 400 );
- g_signal_connect( G_OBJECT( window ), "key-press-event", (GCallback) accelerator_window_key_press, &dialog );
+ ui::Window window = MainFrame_getWindow().create_modal_dialog_window("Mapped Commands", dialog, -1, 400);
+ window.on_key_press([](ui::Widget widget, GdkEventKey *event, gpointer dialogptr) {
+ return accelerator_window_key_press(widget, event, dialogptr);
+ }, &dialog);
- GtkAccelGroup* accel = gtk_accel_group_new();
+ GtkAccelGroup* accel = ui::AccelGroup();
gtk_window_add_accel_group( window, accel );
GtkHBox* hbox = create_dialog_hbox( 4, 4 );
{
GtkListStore* store = gtk_list_store_new( 4, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_BOOLEAN, G_TYPE_INT );
- GtkWidget* view = gtk_tree_view_new_with_model( GTK_TREE_MODEL( store ) );
+ ui::Widget view = ui::TreeView(ui::TreeModel(GTK_TREE_MODEL(store)));
dialog.m_list = GTK_TREE_VIEW( view );
gtk_tree_view_set_enable_search( GTK_TREE_VIEW( view ), false ); // annoying
{
- GtkCellRenderer* renderer = gtk_cell_renderer_text_new();
- GtkTreeViewColumn* column = gtk_tree_view_column_new_with_attributes( "Command", renderer, "text", 0, "weight-set", 2, "weight", 3, NULL );
+ auto renderer = ui::CellRendererText();
+ GtkTreeViewColumn* column = ui::TreeViewColumn( "Command", renderer, {{"text", 0}, {"weight-set", 2}, {"weight", 3}} );
gtk_tree_view_append_column( GTK_TREE_VIEW( view ), column );
}
{
- GtkCellRenderer* renderer = gtk_cell_renderer_text_new();
- GtkTreeViewColumn* column = gtk_tree_view_column_new_with_attributes( "Key", renderer, "text", 1, "weight-set", 2, "weight", 3, NULL );
+ auto renderer = ui::CellRendererText();
+ GtkTreeViewColumn* column = ui::TreeViewColumn( "Key", renderer, {{"text", 1}, {"weight-set", 2}, {"weight", 3}} );
gtk_tree_view_append_column( GTK_TREE_VIEW( view ), column );
}
GtkButton* clearbutton = create_dialog_button( "Clear", (GCallback) accelerator_clear_button_clicked, &dialog );
gtk_box_pack_start( GTK_BOX( vbox ), GTK_WIDGET( clearbutton ), FALSE, FALSE, 0 );
- GtkWidget *spacer = gtk_image_new();
+ ui::Widget spacer = ui::Image();
gtk_widget_show( spacer );
gtk_box_pack_start( GTK_BOX( vbox ), GTK_WIDGET( spacer ), TRUE, TRUE, 0 );
#include "console.h"
#include <time.h>
-#include <gtk/gtktextbuffer.h>
-#include <gtk/gtktextview.h>
-#include <gtk/gtkmenuitem.h>
-#include <gtk/gtkscrolledwindow.h>
+#include <gtk/gtk.h>
+#include <uilib/uilib.h>
#include "gtkutil/accelerator.h"
#include "gtkutil/messagebox.h"
<< "This is NetRadiant '" RADIANT_VERSION "' compiled " __DATE__ "\n" RADIANT_ABOUTMSG "\n";
}
else{
- gtk_MessageBox( 0, "Failed to create log file, check write permissions in Radiant directory.\n",
- "Console logging", eMB_OK, eMB_ICONERROR );
+ ui::root.alert( "Failed to create log file, check write permissions in Radiant directory.\n",
+ "Console logging", ui::alert_type::OK, ui::alert_icon::Error );
}
}
else if ( !enable && g_hLogFile != 0 ) {
}
}
-GtkWidget* g_console = 0;
+ui::Widget g_console;
void console_clear(){
GtkTextBuffer* buffer = gtk_text_view_get_buffer( GTK_TEXT_VIEW( g_console ) );
void console_populate_popup( GtkTextView* textview, GtkMenu* menu, gpointer user_data ){
menu_separator( menu );
- GtkWidget* item = gtk_menu_item_new_with_label( "Clear" );
+ ui::Widget item(ui::MenuItem( "Clear" ));
g_signal_connect( G_OBJECT( item ), "activate", G_CALLBACK( console_clear ), 0 );
gtk_widget_show( item );
container_add_widget( GTK_CONTAINER( menu ), item );
}
-gboolean destroy_set_null( GtkWindow* widget, GtkWidget** p ){
- *p = 0;
+gboolean destroy_set_null( ui::Window widget, ui::Widget* p ){
+ *p = ui::Widget();
return FALSE;
}
WidgetFocusPrinter g_consoleWidgetFocusPrinter( "console" );
-GtkWidget* Console_constructWindow( GtkWindow* toplevel ){
- GtkWidget* scr = gtk_scrolled_window_new( 0, 0 );
+ui::Widget Console_constructWindow( ui::Window toplevel ){
+ ui::Widget scr = ui::ScrolledWindow();
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 );
gtk_widget_show( scr );
{
- GtkWidget* text = gtk_text_view_new();
+ ui::Widget text = ui::TextView();
gtk_widget_set_size_request( text, 0, -1 ); // allow shrinking
gtk_text_view_set_wrap_mode( GTK_TEXT_VIEW( text ), GTK_WRAP_WORD );
gtk_text_view_set_editable( GTK_TEXT_VIEW( text ), FALSE );
if ( contains_newline ) {
gtk_text_view_scroll_mark_onscreen( GTK_TEXT_VIEW( g_console ), end );
- if ( !ScreenUpdates_Enabled() && GTK_WIDGET_REALIZED( g_console ) ) {
+ if ( !ScreenUpdates_Enabled() && gtk_widget_get_realized( g_console ) ) {
ScreenUpdates_process();
}
}
#define INCLUDED_CONSOLE_H
#include <cstddef>
+#include <uilib/uilib.h>
#define SYS_VRB 0 ///< verbose support (on/off)
#define SYS_STD 1 ///< standard print level - this is the default
TextOutputStream& getSysPrintOutputStream();
TextOutputStream& getSysPrintErrorStream();
-typedef struct _GtkWidget GtkWidget;
-typedef struct _GtkWindow GtkWindow;
-GtkWidget* Console_constructWindow( GtkWindow* toplevel );
+ui::Widget Console_constructWindow( ui::Window toplevel );
// will open/close the log file based on the parameter
void Sys_LogFile( bool enable );
#include <stdlib.h>
-#include <gtk/gtkmain.h>
-#include <gtk/gtkvbox.h>
-#include <gtk/gtkhbox.h>
-#include <gtk/gtktogglebutton.h>
-#include <gtk/gtkspinbutton.h>
-#include <gtk/gtkradiobutton.h>
-#include <gtk/gtkentry.h>
-#include <gtk/gtkcombobox.h>
-#include <gtk/gtklabel.h>
-#include <gtk/gtktable.h>
-#include <gtk/gtkhscale.h>
-#include <gtk/gtkalignment.h>
+#include <gtk/gtk.h>
#include "stream/stringstream.h"
#include "convert.h"
GtkEntry* DialogEntry_new(){
- GtkEntry* entry = GTK_ENTRY( gtk_entry_new() );
+ GtkEntry* entry = ui::Entry();
gtk_widget_show( GTK_WIDGET( entry ) );
gtk_widget_set_size_request( GTK_WIDGET( entry ), 64, -1 );
return entry;
class DialogEntryRow
{
public:
-DialogEntryRow( GtkWidget* row, GtkEntry* entry ) : m_row( row ), m_entry( entry ){
+DialogEntryRow( ui::Widget row, GtkEntry* entry ) : m_row( row ), m_entry( entry ){
}
-GtkWidget* m_row;
+ui::Widget m_row;
GtkEntry* m_entry;
};
DialogEntryRow DialogEntryRow_new( const char* name ){
- GtkWidget* alignment = gtk_alignment_new( 0.0, 0.5, 0.0, 0.0 );
+ ui::Widget alignment = ui::Alignment( 0.0, 0.5, 0.0, 0.0 );
gtk_widget_show( alignment );
GtkEntry* entry = DialogEntry_new();
gtk_container_add( GTK_CONTAINER( alignment ), GTK_WIDGET( entry ) );
- return DialogEntryRow( GTK_WIDGET( DialogRow_new( name, alignment ) ), entry );
+ return DialogEntryRow( ui::Widget(GTK_WIDGET( DialogRow_new( name, alignment ) )), entry );
}
{
++digits;
}
- GtkSpinButton* spin = GTK_SPIN_BUTTON( gtk_spin_button_new( GTK_ADJUSTMENT( gtk_adjustment_new( 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;
class DialogSpinnerRow
{
public:
-DialogSpinnerRow( GtkWidget* row, GtkSpinButton* spin ) : m_row( row ), m_spin( spin ){
+DialogSpinnerRow( ui::Widget row, GtkSpinButton* spin ) : m_row( row ), m_spin( spin ){
}
-GtkWidget* m_row;
+ui::Widget m_row;
GtkSpinButton* m_spin;
};
DialogSpinnerRow DialogSpinnerRow_new( const char* name, double value, double lower, double upper, int fraction ){
- GtkWidget* alignment = gtk_alignment_new( 0.0, 0.5, 0.0, 0.0 );
+ ui::Widget alignment = ui::Alignment( 0.0, 0.5, 0.0, 0.0 );
gtk_widget_show( alignment );
GtkSpinButton* spin = DialogSpinner_new( value, lower, upper, fraction );
gtk_container_add( GTK_CONTAINER( alignment ), GTK_WIDGET( spin ) );
- return DialogSpinnerRow( GTK_WIDGET( DialogRow_new( name, alignment ) ), spin );
+ return DialogSpinnerRow( ui::Widget(GTK_WIDGET( DialogRow_new( name, alignment ) )), spin );
}
gtk_spin_button_set_value( &widget, value );
}
void FloatSpinnerExport( GtkSpinButton& widget, const FloatImportCallback& importCallback ){
- importCallback( float(gtk_spin_button_get_value_as_float( &widget ) ) );
+ importCallback( float(gtk_spin_button_get_value( &widget ) ) );
}
typedef ImportExport<GtkSpinButton, float, FloatSpinnerImport, FloatSpinnerExport> FloatSpinnerImportExport;
( *i )->release();
}
- ASSERT_MESSAGE( m_window == 0, "dialog window not destroyed" );
+ ASSERT_MESSAGE( !m_window, "dialog window not destroyed" );
}
void Dialog::ShowDlg(){
- ASSERT_MESSAGE( m_window != 0, "dialog was not constructed" );
+ ASSERT_MESSAGE( m_window, "dialog was not constructed" );
importData();
gtk_widget_show( GTK_WIDGET( m_window ) );
}
void Dialog::HideDlg(){
- ASSERT_MESSAGE( m_window != 0, "dialog was not constructed" );
+ ASSERT_MESSAGE( m_window, "dialog was not constructed" );
exportData();
gtk_widget_hide( GTK_WIDGET( m_window ) );
}
-static gint delete_event_callback( GtkWidget *widget, GdkEvent* event, gpointer data ){
+static gint delete_event_callback( ui::Widget widget, GdkEvent* event, gpointer data ){
reinterpret_cast<Dialog*>( data )->HideDlg();
reinterpret_cast<Dialog*>( data )->EndModal( eIDCANCEL );
return TRUE;
}
void Dialog::Create(){
- ASSERT_MESSAGE( m_window == 0, "dialog cannot be constructed" );
+ ASSERT_MESSAGE( !m_window, "dialog cannot be constructed" );
m_window = BuildDialog();
g_signal_connect( G_OBJECT( m_window ), "delete_event", G_CALLBACK( delete_event_callback ), this );
}
void Dialog::Destroy(){
- ASSERT_MESSAGE( m_window != 0, "dialog cannot be destroyed" );
+ ASSERT_MESSAGE( m_window, "dialog cannot be destroyed" );
gtk_widget_destroy( GTK_WIDGET( m_window ) );
- m_window = 0;
+ m_window = ui::Window();
}
PreModal();
EMessageBoxReturn ret = modal_dialog_show( m_window, m_modal );
- ASSERT_NOTNULL( m_window );
+ ASSERT_TRUE( (bool) m_window );
if ( ret == eIDOK ) {
exportData();
}
}
-GtkWidget* Dialog::addCheckBox( GtkWidget* vbox, const char* name, const char* flag, const BoolImportCallback& importViewer, const BoolExportCallback& exportViewer ){
- GtkWidget* check = gtk_check_button_new_with_label( flag );
+ui::CheckButton Dialog::addCheckBox( ui::Widget vbox, const char* name, const char* flag, const BoolImportCallback& importViewer, const BoolExportCallback& exportViewer ){
+ auto check = ui::CheckButton( flag );
gtk_widget_show( check );
AddBoolToggleData( *GTK_TOGGLE_BUTTON( check ), importViewer, exportViewer );
return check;
}
-GtkWidget* Dialog::addCheckBox( GtkWidget* vbox, const char* name, const char* flag, bool& data ){
+ui::CheckButton Dialog::addCheckBox( ui::Widget vbox, const char* name, const char* flag, bool& data ){
return addCheckBox( vbox, name, flag, BoolImportCaller( data ), BoolExportCaller( data ) );
}
-void Dialog::addCombo( GtkWidget* vbox, const char* name, StringArrayRange values, const IntImportCallback& importViewer, const IntExportCallback& exportViewer ){
- GtkWidget* alignment = gtk_alignment_new( 0.0, 0.5, 0.0, 0.0 );
+void Dialog::addCombo( ui::Widget vbox, const char* name, StringArrayRange values, const IntImportCallback& importViewer, const IntExportCallback& exportViewer ){
+ ui::Widget alignment = ui::Alignment( 0.0, 0.5, 0.0, 0.0 );
gtk_widget_show( alignment );
{
- GtkWidget* combo = gtk_combo_box_new_text();
+ ui::Widget combo = ui::ComboBoxText();
for ( StringArrayRange::Iterator i = values.first; i != values.last; ++i )
{
- gtk_combo_box_append_text( GTK_COMBO_BOX( combo ), *i );
+ gtk_combo_box_text_append_text( GTK_COMBO_BOX_TEXT( combo ), *i );
}
AddIntComboData( *GTK_COMBO_BOX( combo ), importViewer, exportViewer );
DialogVBox_packRow( GTK_VBOX( vbox ), GTK_WIDGET( row ) );
}
-void Dialog::addCombo( GtkWidget* vbox, const char* name, int& data, StringArrayRange values ){
+void Dialog::addCombo( ui::Widget vbox, const char* name, int& data, StringArrayRange values ){
addCombo( vbox, name, values, IntImportCaller( data ), IntExportCaller( data ) );
}
-void Dialog::addSlider( GtkWidget* vbox, const char* name, int& data, gboolean draw_value, const char* low, const char* high, double value, double lower, double upper, double step_increment, double page_increment ){
+void Dialog::addSlider( ui::Widget vbox, const char* name, int& data, gboolean draw_value, const char* low, const char* high, double value, double lower, double upper, double step_increment, double page_increment ){
#if 0
if ( draw_value == FALSE ) {
- GtkWidget* hbox2 = gtk_hbox_new( FALSE, 0 );
+ ui::Widget hbox2 = ui::HBox( FALSE, 0 );
gtk_widget_show( hbox2 );
gtk_box_pack_start( GTK_BOX( vbox ), GTK_WIDGET( hbox2 ), FALSE, FALSE, 0 );
{
- GtkWidget* label = gtk_label_new( low );
+ ui::Widget label = ui::Label( low );
gtk_widget_show( label );
gtk_box_pack_start( GTK_BOX( hbox2 ), label, FALSE, FALSE, 0 );
}
{
- GtkWidget* label = gtk_label_new( high );
+ ui::Widget label = ui::Label( high );
gtk_widget_show( label );
gtk_box_pack_end( GTK_BOX( hbox2 ), label, FALSE, FALSE, 0 );
}
#endif
// adjustment
- GtkObject* adj = gtk_adjustment_new( value, lower, upper, step_increment, page_increment, 0 );
- AddIntAdjustmentData( *GTK_ADJUSTMENT( adj ), IntImportCaller( data ), IntExportCaller( data ) );
+ auto adj = ui::Adjustment( value, lower, upper, step_increment, page_increment, 0 );
+ AddIntAdjustmentData( *GTK_ADJUSTMENT(adj), IntImportCaller( data ), IntExportCaller( data ) );
// scale
- GtkWidget* alignment = gtk_alignment_new( 0.0, 0.5, 1.0, 0.0 );
+ ui::Widget alignment = ui::Alignment( 0.0, 0.5, 1.0, 0.0 );
gtk_widget_show( alignment );
- GtkWidget* scale = gtk_hscale_new( GTK_ADJUSTMENT( adj ) );
+ ui::Widget scale = ui::HScale( adj );
gtk_scale_set_value_pos( GTK_SCALE( scale ), GTK_POS_LEFT );
gtk_widget_show( scale );
gtk_container_add( GTK_CONTAINER( alignment ), scale );
DialogVBox_packRow( GTK_VBOX( vbox ), GTK_WIDGET( row ) );
}
-void Dialog::addRadio( GtkWidget* vbox, const char* name, StringArrayRange names, const IntImportCallback& importViewer, const IntExportCallback& exportViewer ){
- GtkWidget* alignment = gtk_alignment_new( 0.0, 0.5, 0.0, 0.0 );
+void Dialog::addRadio( ui::Widget vbox, const char* name, StringArrayRange names, const IntImportCallback& importViewer, const IntExportCallback& exportViewer ){
+ ui::Widget alignment = ui::Alignment( 0.0, 0.5, 0.0, 0.0 );
gtk_widget_show( alignment );
{
RadioHBox radioBox = RadioHBox_new( names );
DialogVBox_packRow( GTK_VBOX( vbox ), GTK_WIDGET( row ) );
}
-void Dialog::addRadio( GtkWidget* vbox, const char* name, int& data, StringArrayRange names ){
+void Dialog::addRadio( ui::Widget vbox, const char* name, int& data, StringArrayRange names ){
addRadio( vbox, name, names, IntImportCaller( data ), IntExportCaller( data ) );
}
-void Dialog::addRadioIcons( GtkWidget* vbox, const char* name, StringArrayRange icons, const IntImportCallback& importViewer, const IntExportCallback& exportViewer ){
- GtkWidget* table = gtk_table_new( 2, static_cast<guint>( icons.last - icons.first ), FALSE );
+void Dialog::addRadioIcons( ui::Widget vbox, const char* name, StringArrayRange icons, const IntImportCallback& importViewer, const IntExportCallback& exportViewer ){
+ ui::Widget table = ui::Table( 2, icons.last - icons.first, FALSE );
gtk_widget_show( table );
gtk_table_set_row_spacings( GTK_TABLE( table ), 5 );
gtk_table_set_col_spacings( GTK_TABLE( table ), 5 );
GSList* group = 0;
- GtkWidget* radio = 0;
+ ui::Widget radio;
for ( StringArrayRange::Iterator icon = icons.first; icon != icons.last; ++icon )
{
guint pos = static_cast<guint>( icon - icons.first );
(GtkAttachOptions) ( 0 ),
(GtkAttachOptions) ( 0 ), 0, 0 );
- radio = gtk_radio_button_new( group );
+ radio = ui::Widget(gtk_radio_button_new( group ));
gtk_widget_show( radio );
gtk_table_attach( GTK_TABLE( table ), radio, pos, pos + 1, 1, 2,
(GtkAttachOptions) ( 0 ),
DialogVBox_packRow( GTK_VBOX( vbox ), GTK_WIDGET( DialogRow_new( name, table ) ) );
}
-void Dialog::addRadioIcons( GtkWidget* vbox, const char* name, int& data, StringArrayRange icons ){
+void Dialog::addRadioIcons( ui::Widget vbox, const char* name, int& data, StringArrayRange icons ){
addRadioIcons( vbox, name, icons, IntImportCaller( data ), IntExportCaller( data ) );
}
-GtkWidget* Dialog::addIntEntry( GtkWidget* vbox, const char* name, const IntImportCallback& importViewer, const IntExportCallback& exportViewer ){
+ui::Widget Dialog::addIntEntry( ui::Widget vbox, const char* name, const IntImportCallback& importViewer, const IntExportCallback& exportViewer ){
DialogEntryRow row( DialogEntryRow_new( name ) );
AddIntEntryData( *row.m_entry, importViewer, exportViewer );
DialogVBox_packRow( GTK_VBOX( vbox ), row.m_row );
return row.m_row;
}
-GtkWidget* Dialog::addSizeEntry( GtkWidget* vbox, const char* name, const SizeImportCallback& importViewer, const SizeExportCallback& exportViewer ){
+ui::Widget Dialog::addSizeEntry( ui::Widget vbox, const char* name, const SizeImportCallback& importViewer, const SizeExportCallback& exportViewer ){
DialogEntryRow row( DialogEntryRow_new( name ) );
AddSizeEntryData( *row.m_entry, importViewer, exportViewer );
DialogVBox_packRow( GTK_VBOX( vbox ), row.m_row );
return row.m_row;
}
-GtkWidget* Dialog::addFloatEntry( GtkWidget* vbox, const char* name, const FloatImportCallback& importViewer, const FloatExportCallback& exportViewer ){
+ui::Widget Dialog::addFloatEntry( ui::Widget vbox, const char* name, const FloatImportCallback& importViewer, const FloatExportCallback& exportViewer ){
DialogEntryRow row( DialogEntryRow_new( name ) );
AddFloatEntryData( *row.m_entry, importViewer, exportViewer );
DialogVBox_packRow( GTK_VBOX( vbox ), row.m_row );
return row.m_row;
}
-GtkWidget* Dialog::addPathEntry( GtkWidget* vbox, const char* name, bool browse_directory, const StringImportCallback& importViewer, const StringExportCallback& exportViewer ){
+ui::Widget Dialog::addPathEntry( ui::Widget vbox, const char* name, bool browse_directory, const StringImportCallback& importViewer, const StringExportCallback& exportViewer ){
PathEntry pathEntry = PathEntry_new();
g_signal_connect( G_OBJECT( pathEntry.m_button ), "clicked", G_CALLBACK( browse_directory ? button_clicked_entry_browse_directory : button_clicked_entry_browse_file ), pathEntry.m_entry );
GtkTable* row = DialogRow_new( name, GTK_WIDGET( pathEntry.m_frame ) );
DialogVBox_packRow( GTK_VBOX( vbox ), GTK_WIDGET( row ) );
- return GTK_WIDGET( row );
+ return ui::Widget(GTK_WIDGET( row ));
}
-GtkWidget* Dialog::addPathEntry( GtkWidget* vbox, const char* name, CopiedString& data, bool browse_directory ){
+ui::Widget Dialog::addPathEntry( ui::Widget vbox, const char* name, CopiedString& data, bool browse_directory ){
return addPathEntry( vbox, name, browse_directory, StringImportCallback( StringImportCaller( data ) ), StringExportCallback( StringExportCaller( data ) ) );
}
-GtkWidget* Dialog::addSpinner( GtkWidget* vbox, const char* name, double value, double lower, double upper, const IntImportCallback& importViewer, const IntExportCallback& exportViewer ){
+ui::SpinButton Dialog::addSpinner( ui::Widget vbox, const char* name, double value, double lower, double upper, const IntImportCallback& importViewer, const IntExportCallback& exportViewer ){
DialogSpinnerRow row( DialogSpinnerRow_new( name, value, lower, upper, 1 ) );
AddIntSpinnerData( *row.m_spin, importViewer, exportViewer );
DialogVBox_packRow( GTK_VBOX( vbox ), row.m_row );
- return row.m_row;
+ return ui::SpinButton(row.m_spin);
}
-GtkWidget* Dialog::addSpinner( GtkWidget* vbox, const char* name, int& data, double value, double lower, double upper ){
+ui::SpinButton Dialog::addSpinner( ui::Widget vbox, const char* name, int& data, double value, double lower, double upper ){
return addSpinner( vbox, name, value, lower, upper, IntImportCallback( IntImportCaller( data ) ), IntExportCallback( IntExportCaller( data ) ) );
}
-GtkWidget* Dialog::addSpinner( GtkWidget* vbox, const char* name, double value, double lower, double upper, const FloatImportCallback& importViewer, const FloatExportCallback& exportViewer ){
+ui::SpinButton Dialog::addSpinner( ui::Widget vbox, const char* name, double value, double lower, double upper, const FloatImportCallback& importViewer, const FloatExportCallback& exportViewer ){
DialogSpinnerRow row( DialogSpinnerRow_new( name, value, lower, upper, 10 ) );
AddFloatSpinnerData( *row.m_spin, importViewer, exportViewer );
DialogVBox_packRow( GTK_VBOX( vbox ), row.m_row );
- return row.m_row;
+ return ui::SpinButton(row.m_spin);
}
#define INCLUDED_DIALOG_H
#include <list>
+#include <uilib/uilib.h>
#include "gtkutil/dialog.h"
#include "generic/callback.h"
class Dialog
{
-GtkWindow* m_window;
+ui::Window m_window;
DialogDataList m_data;
public:
ModalDialog m_modal;
-GtkWindow* m_parent;
+ui::Window m_parent;
Dialog();
virtual ~Dialog();
*/
EMessageBoxReturn DoModal();
void EndModal( EMessageBoxReturn code );
-virtual GtkWindow* BuildDialog() = 0;
+virtual ui::Window BuildDialog() = 0;
virtual void exportData();
virtual void importData();
virtual void PreModal() { };
virtual void HideDlg();
void Create();
void Destroy();
-GtkWindow* GetWidget(){
+ui::Window GetWidget(){
return m_window;
}
-const GtkWindow* GetWidget() const {
+const ui::Window GetWidget() const {
return m_window;
}
-GtkWidget* addCheckBox( GtkWidget* vbox, const char* name, const char* flag, const BoolImportCallback& importCallback, const BoolExportCallback& exportCallback );
-GtkWidget* addCheckBox( GtkWidget* vbox, const char* name, const char* flag, bool& data );
-void addCombo( GtkWidget* vbox, const char* name, StringArrayRange values, const IntImportCallback& importCallback, const IntExportCallback& exportCallback );
-void addCombo( GtkWidget* vbox, const char* name, int& data, StringArrayRange values );
-void addSlider( GtkWidget* vbox, const char* name, int& data, gboolean draw_value, const char* low, const char* high, double value, double lower, double upper, double step_increment, double page_increment );
-void addRadio( GtkWidget* vbox, const char* name, StringArrayRange names, const IntImportCallback& importCallback, const IntExportCallback& exportCallback );
-void addRadio( GtkWidget* vbox, const char* name, int& data, StringArrayRange names );
-void addRadioIcons( GtkWidget* vbox, const char* name, StringArrayRange icons, const IntImportCallback& importCallback, const IntExportCallback& exportCallback );
-void addRadioIcons( GtkWidget* vbox, const char* name, int& data, StringArrayRange icons );
-GtkWidget* addIntEntry( GtkWidget* vbox, const char* name, const IntImportCallback& importCallback, const IntExportCallback& exportCallback );
-GtkWidget* addEntry( GtkWidget* vbox, const char* name, int& data ){
+ui::CheckButton addCheckBox( ui::Widget vbox, const char* name, const char* flag, const BoolImportCallback& importCallback, const BoolExportCallback& exportCallback );
+ui::CheckButton addCheckBox( ui::Widget vbox, const char* name, const char* flag, bool& data );
+void addCombo( ui::Widget vbox, const char* name, StringArrayRange values, const IntImportCallback& importCallback, const IntExportCallback& exportCallback );
+void addCombo( ui::Widget vbox, const char* name, int& data, StringArrayRange values );
+void addSlider( ui::Widget vbox, const char* name, int& data, gboolean draw_value, const char* low, const char* high, double value, double lower, double upper, double step_increment, double page_increment );
+void addRadio( ui::Widget vbox, const char* name, StringArrayRange names, const IntImportCallback& importCallback, const IntExportCallback& exportCallback );
+void addRadio( ui::Widget vbox, const char* name, int& data, StringArrayRange names );
+void addRadioIcons( ui::Widget vbox, const char* name, StringArrayRange icons, const IntImportCallback& importCallback, const IntExportCallback& exportCallback );
+void addRadioIcons( ui::Widget vbox, const char* name, int& data, StringArrayRange icons );
+ui::Widget addIntEntry( ui::Widget vbox, const char* name, const IntImportCallback& importCallback, const IntExportCallback& exportCallback );
+ui::Widget addEntry( ui::Widget vbox, const char* name, int& data ){
return addIntEntry( vbox, name, IntImportCaller( data ), IntExportCaller( data ) );
}
-GtkWidget* addSizeEntry( GtkWidget* vbox, const char* name, const SizeImportCallback& importCallback, const SizeExportCallback& exportCallback );
-GtkWidget* addEntry( GtkWidget* vbox, const char* name, std::size_t& data ){
+ui::Widget addSizeEntry( ui::Widget vbox, const char* name, const SizeImportCallback& importCallback, const SizeExportCallback& exportCallback );
+ui::Widget addEntry( ui::Widget vbox, const char* name, std::size_t& data ){
return addSizeEntry( vbox, name, SizeImportCaller( data ), SizeExportCaller( data ) );
}
-GtkWidget* addFloatEntry( GtkWidget* vbox, const char* name, const FloatImportCallback& importCallback, const FloatExportCallback& exportCallback );
-GtkWidget* addEntry( GtkWidget* vbox, const char* name, float& data ){
+ui::Widget addFloatEntry( ui::Widget vbox, const char* name, const FloatImportCallback& importCallback, const FloatExportCallback& exportCallback );
+ui::Widget addEntry( ui::Widget vbox, const char* name, float& data ){
return addFloatEntry( vbox, name, FloatImportCaller( data ), FloatExportCaller( data ) );
}
-GtkWidget* addPathEntry( GtkWidget* vbox, const char* name, bool browse_directory, const StringImportCallback& importCallback, const StringExportCallback& exportCallback );
-GtkWidget* addPathEntry( GtkWidget* vbox, const char* name, CopiedString& data, bool directory );
-GtkWidget* addSpinner( GtkWidget* vbox, const char* name, int& data, double value, double lower, double upper );
-GtkWidget* addSpinner( GtkWidget* vbox, const char* name, double value, double lower, double upper, const IntImportCallback& importCallback, const IntExportCallback& exportCallback );
-GtkWidget* addSpinner( GtkWidget* vbox, const char* name, double value, double lower, double upper, const FloatImportCallback& importCallback, const FloatExportCallback& exportCallback );
+ui::Widget addPathEntry( ui::Widget vbox, const char* name, bool browse_directory, const StringImportCallback& importCallback, const StringExportCallback& exportCallback );
+ui::Widget addPathEntry( ui::Widget vbox, const char* name, CopiedString& data, bool directory );
+ui::SpinButton addSpinner( ui::Widget vbox, const char* name, int& data, double value, double lower, double upper );
+ui::SpinButton addSpinner( ui::Widget vbox, const char* name, double value, double lower, double upper, const IntImportCallback& importCallback, const IntExportCallback& exportCallback );
+ui::SpinButton addSpinner( ui::Widget vbox, const char* name, double value, double lower, double upper, const FloatImportCallback& importCallback, const FloatExportCallback& exportCallback );
protected:
#include "qe3.h"
#include "commands.h"
+#include "uilib/uilib.h"
+
struct entity_globals_t
{
Vector3 color_entity;
void Entity_createFromSelection( const char* name, const Vector3& origin ){
#if 0
if ( string_equal_nocase( name, "worldspawn" ) ) {
- gtk_MessageBox( GTK_WIDGET( MainFrame_getWindow() ), "Can't create an entity with worldspawn.", "info" );
+ ui::alert( GTK_WIDGET( MainFrame_getWindow() ), "Can't create an entity with worldspawn.", "info" );
return;
}
#endif
}
if ( isModel ) {
- const char* model = misc_model_dialog( GTK_WIDGET( MainFrame_getWindow() ) );
+ const char* model = misc_model_dialog(MainFrame_getWindow());
if ( model != 0 ) {
Node_getEntity( node )->setKeyValue( "model", model );
}
normalize = false;
}
- if ( color_dialog( GTK_WIDGET( MainFrame_getWindow() ), g_entity_globals.color_entity ) ) {
+ if ( color_dialog( MainFrame_getWindow(), g_entity_globals.color_entity ) ) {
if ( normalize ) {
NormalizeColor( g_entity_globals.color_entity );
}
}
}
-const char* misc_model_dialog( GtkWidget* parent ){
+const char* misc_model_dialog( ui::Widget parent ){
StringOutputStream buffer( 1024 );
buffer << g_qeglobals.m_userGamePath.c_str() << "models/";
buffer << g_qeglobals.m_userGamePath.c_str() << "/";
}
- const char *filename = file_dialog( parent, TRUE, "Choose Model", buffer.c_str(), ModelLoader::Name() );
+ const char *filename = parent.file_dialog( TRUE, "Choose Model", buffer.c_str(), ModelLoader::Name() );
if ( filename != 0 ) {
// use VFS to get the correct relative path
const char* relative = path_make_relative( filename, GlobalFileSystem().findRoot( filename ) );
#if !defined( INCLUDED_ENTITY_H )
#define INCLUDED_ENTITY_H
+#include <uilib/uilib.h>
+
template<typename Element> class BasicVector3;
typedef BasicVector3<float> Vector3;
void Entity_createFromSelection( const char* name, const Vector3& origin );
void Scene_EntitySetClassname_Selected( const char* classname );
-typedef struct _GtkWidget GtkWidget;
-const char* misc_model_dialog( GtkWidget* parent );
+const char* misc_model_dialog( ui::Widget parent );
typedef struct _GtkMenu GtkMenu;
void Entity_constructMenu( GtkMenu* menu );
#include <map>
#include <set>
#include <gdk/gdkkeysyms.h>
-#include <gtk/gtktreemodel.h>
-#include <gtk/gtktreeview.h>
-#include <gtk/gtkcellrenderertext.h>
-#include <gtk/gtktreeselection.h>
-#include <gtk/gtkliststore.h>
-#include <gtk/gtktextview.h>
-#include <gtk/gtklabel.h>
-#include <gtk/gtktable.h>
-#include <gtk/gtktogglebutton.h>
-#include <gtk/gtkcheckbutton.h>
-#include <gtk/gtkhbox.h>
-#include <gtk/gtkvbox.h>
-#include <gtk/gtkvpaned.h>
-#include <gtk/gtkscrolledwindow.h>
-#include <gtk/gtkentry.h>
-#include <gtk/gtkcombobox.h>
+#include <gtk/gtk.h>
+#include <uilib/uilib.h>
#include "os/path.h"
#include "groupdialog.h"
GtkEntry* numeric_entry_new(){
- GtkEntry* entry = GTK_ENTRY( gtk_entry_new() );
+ GtkEntry* entry = ui::Entry();
gtk_widget_show( GTK_WIDGET( entry ) );
gtk_widget_set_size_request( GTK_WIDGET( entry ), 64, -1 );
return entry;
class EntityAttribute
{
public:
-virtual GtkWidget* getWidget() const = 0;
+virtual ui::Widget getWidget() const = 0;
virtual void update() = 0;
virtual void release() = 0;
};
CopiedString m_key;
GtkCheckButton* m_check;
-static gboolean toggled( GtkWidget *widget, BooleanAttribute* self ){
+static gboolean toggled( ui::Widget widget, BooleanAttribute* self ){
self->apply();
return FALSE;
}
update();
}
-GtkWidget* getWidget() const {
- return GTK_WIDGET( m_check );
+ui::Widget getWidget() const {
+ return ui::Widget(GTK_WIDGET( m_check ));
}
void release(){
delete this;
m_key( key ),
m_entry( 0 ),
m_nonModal( ApplyCaller( *this ), UpdateCaller( *this ) ){
- GtkEntry* entry = GTK_ENTRY( gtk_entry_new() );
+ GtkEntry* entry = ui::Entry();
gtk_widget_show( GTK_WIDGET( entry ) );
gtk_widget_set_size_request( GTK_WIDGET( entry ), 50, -1 );
m_entry = entry;
m_nonModal.connect( m_entry );
}
-GtkWidget* getWidget() const {
- return GTK_WIDGET( m_entry );
+ui::Widget getWidget() const {
+ return ui::Widget(GTK_WIDGET( m_entry ));
}
GtkEntry* getEntry() const {
return m_entry;
void release(){
delete this;
}
-GtkWidget* getWidget() const {
- return GTK_WIDGET( m_entry.m_entry.m_frame );
+ui::Widget getWidget() const {
+ return ui::Widget(GTK_WIDGET( m_entry.m_entry.m_frame ));
}
void apply(){
StringOutputStream value( 64 );
}
typedef MemberCaller<ModelAttribute, &ModelAttribute::update> UpdateCaller;
void browse( const BrowsedPathEntry::SetPathCallback& setPath ){
- const char *filename = misc_model_dialog( gtk_widget_get_toplevel( GTK_WIDGET( m_entry.m_entry.m_frame ) ) );
+ const char *filename = misc_model_dialog( ui::Widget(gtk_widget_get_toplevel( GTK_WIDGET( m_entry.m_entry.m_frame ) ) ));
if ( filename != 0 ) {
setPath( filename );
typedef MemberCaller1<ModelAttribute, const BrowsedPathEntry::SetPathCallback&, &ModelAttribute::browse> BrowseCaller;
};
-const char* browse_sound( GtkWidget* parent ){
+const char* browse_sound( ui::Widget parent ){
StringOutputStream buffer( 1024 );
buffer << g_qeglobals.m_userGamePath.c_str() << "sound/";
buffer << g_qeglobals.m_userGamePath.c_str() << "/";
}
- const char* filename = file_dialog( parent, TRUE, "Open Wav File", buffer.c_str(), "sound" );
+ const char* filename = parent.file_dialog(TRUE, "Open Wav File", buffer.c_str(), "sound" );
if ( filename != 0 ) {
const char* relative = path_make_relative( filename, GlobalFileSystem().findRoot( filename ) );
if ( relative == filename ) {
void release(){
delete this;
}
-GtkWidget* getWidget() const {
- return GTK_WIDGET( m_entry.m_entry.m_frame );
+ui::Widget getWidget() const {
+ return ui::Widget(GTK_WIDGET( m_entry.m_entry.m_frame ));
}
void apply(){
StringOutputStream value( 64 );
}
typedef MemberCaller<SoundAttribute, &SoundAttribute::update> UpdateCaller;
void browse( const BrowsedPathEntry::SetPathCallback& setPath ){
- const char *filename = browse_sound( gtk_widget_get_toplevel( GTK_WIDGET( m_entry.m_entry.m_frame ) ) );
+ const char *filename = browse_sound( ui::Widget(gtk_widget_get_toplevel( GTK_WIDGET( m_entry.m_entry.m_frame ) )) );
if ( filename != 0 ) {
setPath( filename );
void release(){
delete this;
}
-GtkWidget* getWidget() const {
- return GTK_WIDGET( m_entry );
+ui::Widget getWidget() const {
+ return ui::Widget(GTK_WIDGET( m_entry ));
}
void apply(){
StringOutputStream angle( 32 );
m_nonModalRadio.connect( m_radio.m_radio );
- m_hbox = GTK_HBOX( gtk_hbox_new( FALSE, 4 ) );
+ m_hbox = ui::HBox( FALSE, 4 );
gtk_widget_show( GTK_WIDGET( m_hbox ) );
gtk_box_pack_start( GTK_BOX( m_hbox ), GTK_WIDGET( m_radio.m_hbox ), TRUE, TRUE, 0 );
void release(){
delete this;
}
-GtkWidget* getWidget() const {
- return GTK_WIDGET( m_hbox );
+ui::Widget getWidget() const {
+ return ui::Widget(GTK_WIDGET( m_hbox ));
}
void apply(){
StringOutputStream angle( 32 );
CopiedString m_key;
AnglesEntry m_angles;
NonModalEntry m_nonModal;
-GtkBox* m_hbox;
+ui::HBox m_hbox;
public:
AnglesAttribute( const char* key ) :
m_key( key ),
- m_nonModal( ApplyCaller( *this ), UpdateCaller( *this ) ){
- m_hbox = GTK_BOX( gtk_hbox_new( TRUE, 4 ) );
+ m_nonModal( ApplyCaller( *this ), UpdateCaller( *this ) ),
+ m_hbox(ui::HBox( TRUE, 4 ))
+{
gtk_widget_show( GTK_WIDGET( m_hbox ) );
{
GtkEntry* entry = numeric_entry_new();
void release(){
delete this;
}
-GtkWidget* getWidget() const {
- return GTK_WIDGET( m_hbox );
+ui::Widget getWidget() const {
+ return ui::Widget(GTK_WIDGET( m_hbox ));
}
void apply(){
StringOutputStream angles( 64 );
Vector3Attribute( const char* key ) :
m_key( key ),
m_nonModal( ApplyCaller( *this ), UpdateCaller( *this ) ){
- m_hbox = GTK_BOX( gtk_hbox_new( TRUE, 4 ) );
+ m_hbox = ui::HBox( TRUE, 4 );
gtk_widget_show( GTK_WIDGET( m_hbox ) );
{
GtkEntry* entry = numeric_entry_new();
void release(){
delete this;
}
-GtkWidget* getWidget() const {
- return GTK_WIDGET( m_hbox );
+ui::Widget getWidget() const {
+ return ui::Widget(GTK_WIDGET( m_hbox ));
}
void apply(){
StringOutputStream vector3( 64 );
m_combo( 0 ),
m_nonModal( ApplyCaller( *this ) ),
m_type( type ){
- GtkComboBox* combo = GTK_COMBO_BOX( gtk_combo_box_new_text() );
+ auto combo = ui::ComboBoxText();
for ( ListAttributeType::const_iterator i = type.begin(); i != type.end(); ++i )
{
- gtk_combo_box_append_text( GTK_COMBO_BOX( combo ), ( *i ).first.c_str() );
+ gtk_combo_box_text_append_text( GTK_COMBO_BOX_TEXT( combo ), ( *i ).first.c_str() );
}
gtk_widget_show( GTK_WIDGET( combo ) );
void release(){
delete this;
}
-GtkWidget* getWidget() const {
- return GTK_WIDGET( m_combo );
+ui::Widget getWidget() const {
+ return ui::Widget(GTK_WIDGET( m_combo ));
}
void apply(){
Scene_EntitySetKeyValue_Selected_Undoable( m_key.c_str(), m_type[gtk_combo_box_get_active( m_combo )].second.c_str() );
namespace
{
-GtkWidget* g_entity_split1 = 0;
-GtkWidget* g_entity_split2 = 0;
+ui::Widget g_entity_split1;
+ui::Widget g_entity_split2;
int g_entitysplit1_position;
int g_entitysplit2_position;
{
for ( int i = 0; i < g_spawnflag_count; ++i )
{
- GtkWidget* widget = GTK_WIDGET( g_entitySpawnflagsCheck[i] );
- gtk_label_set_text( GTK_LABEL( GTK_BIN( widget )->child ), " " );
+ ui::Widget widget = ui::Widget(GTK_WIDGET( g_entitySpawnflagsCheck[i] ));
+ gtk_label_set_text( GTK_LABEL( gtk_bin_get_child(GTK_BIN(widget)) ), " " );
gtk_widget_hide( widget );
- gtk_widget_ref( widget );
+ g_object_ref( widget );
gtk_container_remove( GTK_CONTAINER( g_spawnflagsTable ), widget );
}
}
{
for ( int i = 0; i < g_spawnflag_count; ++i )
{
- GtkWidget* widget = GTK_WIDGET( g_entitySpawnflagsCheck[i] );
+ ui::Widget widget = ui::Widget(GTK_WIDGET( g_entitySpawnflagsCheck[i] ));
gtk_widget_show( widget );
StringOutputStream str( 16 );
gtk_table_attach( g_spawnflagsTable, widget, i % 4, i % 4 + 1, i / 4, i / 4 + 1,
(GtkAttachOptions)( GTK_FILL ),
(GtkAttachOptions)( GTK_FILL ), 0, 0 );
- gtk_widget_unref( widget );
+ g_object_unref( widget );
- gtk_label_set_text( GTK_LABEL( GTK_BIN( widget )->child ), str.c_str() );
+ gtk_label_set_text( GTK_LABEL( gtk_bin_get_child(GTK_BIN(widget)) ), str.c_str() );
}
}
}
GtkTreeView* view = g_entityClassList;
GtkTreePath* path = gtk_tree_model_get_path( model, &iter );
gtk_tree_selection_select_path( gtk_tree_view_get_selection( view ), path );
- if ( GTK_WIDGET_REALIZED( view ) ) {
+ if ( gtk_widget_get_realized( GTK_WIDGET(view) ) ) {
gtk_tree_view_scroll_to_cell( view, path, 0, FALSE, 0, 0 );
}
gtk_tree_path_free( path );
GtkTreeModel* model;
GtkTreeIter iter;
if ( gtk_tree_selection_get_selected( gtk_tree_view_get_selection( view ), &model, &iter ) == FALSE ) {
- gtk_MessageBox( gtk_widget_get_toplevel( GTK_WIDGET( g_entityClassList ) ), "You must have a selected class to create an entity", "info" );
+ ui::Widget(gtk_widget_get_toplevel( GTK_WIDGET( g_entityClassList ) )).alert( "You must have a selected class to create an entity", "info" );
return;
}
// TTimo: if you change the classname to worldspawn you won't merge back in the structural brushes but create a parasite entity
if ( !strcmp( key.c_str(), "classname" ) && !strcmp( value.c_str(), "worldspawn" ) ) {
- gtk_MessageBox( gtk_widget_get_toplevel( GTK_WIDGET( g_entityKeyEntry ) ), "Cannot change \"classname\" key back to worldspawn.", 0, eMB_OK );
+ ui::Widget(gtk_widget_get_toplevel( GTK_WIDGET( g_entityKeyEntry )) ).alert( "Cannot change \"classname\" key back to worldspawn.", 0, ui::alert_type::OK );
return;
}
// RR2DO2: we don't want spaces in entity keys
if ( strstr( key.c_str(), " " ) ) {
- gtk_MessageBox( gtk_widget_get_toplevel( GTK_WIDGET( g_entityKeyEntry ) ), "No spaces are allowed in entity keys.", 0, eMB_OK );
+ ui::Widget(gtk_widget_get_toplevel( GTK_WIDGET( g_entityKeyEntry )) ).alert( "No spaces are allowed in entity keys.", 0, ui::alert_type::OK );
return;
}
}
}
-static gint EntityClassList_button_press( GtkWidget *widget, GdkEventButton *event, gpointer data ){
+static gint EntityClassList_button_press( ui::Widget widget, GdkEventButton *event, gpointer data ){
if ( event->type == GDK_2BUTTON_PRESS ) {
EntityClassList_createEntity();
return TRUE;
return FALSE;
}
-static gint EntityClassList_keypress( GtkWidget* widget, GdkEventKey* event, gpointer data ){
+static gint EntityClassList_keypress( ui::Widget widget, GdkEventKey* event, gpointer data ){
unsigned int code = gdk_keyval_to_upper( event->keyval );
if ( event->keyval == GDK_Return ) {
if ( toupper( text[0] ) == (int)code ) {
GtkTreePath* path = gtk_tree_model_get_path( model, &iter );
gtk_tree_selection_select_path( gtk_tree_view_get_selection( view ), path );
- if ( GTK_WIDGET_REALIZED( view ) ) {
+ if ( gtk_widget_get_realized( GTK_WIDGET(view) ) ) {
gtk_tree_view_scroll_to_cell( view, path, 0, FALSE, 0, 0 );
}
gtk_tree_path_free( path );
g_free( val );
}
-static void SpawnflagCheck_toggled( GtkWidget *widget, gpointer data ){
+static void SpawnflagCheck_toggled( ui::Widget widget, gpointer data ){
EntityInspector_applySpawnflags();
}
return FALSE;
}
-void EntityInspector_destroyWindow( GtkWidget* widget, gpointer data ){
+void EntityInspector_destroyWindow( ui::Widget widget, gpointer data ){
g_entitysplit1_position = gtk_paned_get_position( GTK_PANED( g_entity_split1 ) );
g_entitysplit2_position = gtk_paned_get_position( GTK_PANED( g_entity_split2 ) );
GlobalEntityAttributes_clear();
}
-GtkWidget* EntityInspector_constructWindow( GtkWindow* toplevel ){
- GtkWidget* vbox = gtk_vbox_new( FALSE, 2 );
+ui::Widget EntityInspector_constructWindow( ui::Window toplevel ){
+ ui::Widget vbox = ui::VBox( FALSE, 2 );
gtk_widget_show( vbox );
gtk_container_set_border_width( GTK_CONTAINER( vbox ), 2 );
g_signal_connect( G_OBJECT( vbox ), "destroy", G_CALLBACK( EntityInspector_destroyWindow ), 0 );
{
- GtkWidget* split1 = gtk_vpaned_new();
+ ui::Widget split1 = ui::VPaned();
gtk_box_pack_start( GTK_BOX( vbox ), split1, TRUE, TRUE, 0 );
gtk_widget_show( split1 );
g_entity_split1 = split1;
{
- GtkWidget* split2 = gtk_vpaned_new();
+ ui::Widget split2 = ui::VPaned();
gtk_paned_add1( GTK_PANED( split1 ), split2 );
gtk_widget_show( split2 );
{
// class list
- GtkWidget* scr = gtk_scrolled_window_new( 0, 0 );
+ ui::Widget scr = ui::ScrolledWindow();
gtk_widget_show( scr );
gtk_paned_add1( GTK_PANED( split2 ), scr );
gtk_scrolled_window_set_policy( GTK_SCROLLED_WINDOW( scr ), GTK_POLICY_NEVER, GTK_POLICY_ALWAYS );
{
GtkListStore* store = gtk_list_store_new( 2, G_TYPE_STRING, G_TYPE_POINTER );
- GtkTreeView* view = GTK_TREE_VIEW( gtk_tree_view_new_with_model( GTK_TREE_MODEL( store ) ) );
+ GtkTreeView* view = ui::TreeView( ui::TreeModel( GTK_TREE_MODEL( store ) ));
gtk_tree_view_set_enable_search( GTK_TREE_VIEW( view ), FALSE );
gtk_tree_view_set_headers_visible( view, FALSE );
g_signal_connect( G_OBJECT( view ), "button_press_event", G_CALLBACK( EntityClassList_button_press ), 0 );
g_signal_connect( G_OBJECT( view ), "key_press_event", G_CALLBACK( EntityClassList_keypress ), 0 );
{
- GtkCellRenderer* renderer = gtk_cell_renderer_text_new();
- GtkTreeViewColumn* column = gtk_tree_view_column_new_with_attributes( "Key", renderer, "text", 0, 0 );
+ auto renderer = ui::CellRendererText();
+ GtkTreeViewColumn* column = ui::TreeViewColumn( "Key", renderer, {{"text", 0}} );
gtk_tree_view_append_column( view, column );
}
}
{
- GtkWidget* scr = gtk_scrolled_window_new( 0, 0 );
+ ui::Widget scr = ui::ScrolledWindow();
gtk_widget_show( scr );
gtk_paned_add2( GTK_PANED( split2 ), scr );
gtk_scrolled_window_set_policy( GTK_SCROLLED_WINDOW( scr ), GTK_POLICY_NEVER, GTK_POLICY_ALWAYS );
gtk_scrolled_window_set_shadow_type( GTK_SCROLLED_WINDOW( scr ), GTK_SHADOW_IN );
{
- GtkTextView* text = GTK_TEXT_VIEW( gtk_text_view_new() );
+ GtkTextView* text = ui::TextView();
gtk_widget_set_size_request( GTK_WIDGET( text ), 0, -1 ); // allow shrinking
gtk_text_view_set_wrap_mode( text, GTK_WRAP_WORD );
gtk_text_view_set_editable( text, FALSE );
}
{
- GtkWidget* split2 = gtk_vpaned_new();
+ ui::Widget split2 = ui::VPaned();
gtk_paned_add2( GTK_PANED( split1 ), split2 );
gtk_widget_show( split2 );
{
- GtkWidget* vbox2 = gtk_vbox_new( FALSE, 2 );
+ ui::Widget vbox2 = ui::VBox( FALSE, 2 );
gtk_widget_show( vbox2 );
gtk_paned_pack1( GTK_PANED( split2 ), vbox2, FALSE, FALSE );
{
// Spawnflags (4 colums wide max, or window gets too wide.)
- GtkTable* table = GTK_TABLE( gtk_table_new( 4, 4, FALSE ) );
+ GtkTable* table = ui::Table( 4, 4, FALSE );
gtk_box_pack_start( GTK_BOX( vbox2 ), GTK_WIDGET( table ), FALSE, TRUE, 0 );
gtk_widget_show( GTK_WIDGET( table ) );
for ( int i = 0; i < MAX_FLAGS; i++ )
{
- GtkCheckButton* check = GTK_CHECK_BUTTON( gtk_check_button_new_with_label( "" ) );
- gtk_widget_ref( GTK_WIDGET( check ) );
+ GtkCheckButton* check = ui::CheckButton( "" );
+ g_object_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;
}
{
// key/value list
- GtkWidget* scr = gtk_scrolled_window_new( 0, 0 );
+ ui::Widget scr = ui::ScrolledWindow();
gtk_widget_show( scr );
gtk_box_pack_start( GTK_BOX( vbox2 ), scr, TRUE, TRUE, 0 );
gtk_scrolled_window_set_policy( GTK_SCROLLED_WINDOW( scr ), GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC );
{
GtkListStore* store = gtk_list_store_new( 2, G_TYPE_STRING, G_TYPE_STRING );
- GtkWidget* view = gtk_tree_view_new_with_model( GTK_TREE_MODEL( store ) );
+ ui::Widget view = ui::TreeView(ui::TreeModel( GTK_TREE_MODEL( store ) ));
gtk_tree_view_set_enable_search( GTK_TREE_VIEW( view ), FALSE );
gtk_tree_view_set_headers_visible( GTK_TREE_VIEW( view ), FALSE );
{
- GtkCellRenderer* renderer = gtk_cell_renderer_text_new();
- GtkTreeViewColumn* column = gtk_tree_view_column_new_with_attributes( "", renderer, "text", 0, 0 );
+ auto renderer = ui::CellRendererText();
+ GtkTreeViewColumn* column = ui::TreeViewColumn( "", renderer, {{"text", 0}} );
gtk_tree_view_append_column( GTK_TREE_VIEW( view ), column );
}
{
- GtkCellRenderer* renderer = gtk_cell_renderer_text_new();
- GtkTreeViewColumn* column = gtk_tree_view_column_new_with_attributes( "", renderer, "text", 1, 0 );
+ auto renderer = ui::CellRendererText();
+ GtkTreeViewColumn* column = ui::TreeViewColumn( "", renderer, {{"text", 1}} );
gtk_tree_view_append_column( GTK_TREE_VIEW( view ), column );
}
{
// key/value entry
- GtkTable* table = GTK_TABLE( gtk_table_new( 2, 2, FALSE ) );
+ GtkTable* table = ui::Table( 2, 2, FALSE );
gtk_widget_show( GTK_WIDGET( table ) );
gtk_box_pack_start( GTK_BOX( vbox2 ), GTK_WIDGET( table ), FALSE, TRUE, 0 );
gtk_table_set_row_spacings( table, 3 );
gtk_table_set_col_spacings( table, 5 );
{
- GtkEntry* entry = GTK_ENTRY( gtk_entry_new() );
+ GtkEntry* entry = ui::Entry();
gtk_widget_show( GTK_WIDGET( entry ) );
gtk_table_attach( table, GTK_WIDGET( entry ), 1, 2, 0, 1,
(GtkAttachOptions)( GTK_EXPAND | GTK_FILL ),
}
{
- GtkEntry* entry = GTK_ENTRY( gtk_entry_new() );
+ GtkEntry* entry = ui::Entry();
gtk_widget_show( GTK_WIDGET( entry ) );
gtk_table_attach( table, GTK_WIDGET( entry ), 1, 2, 1, 2,
(GtkAttachOptions)( GTK_EXPAND | GTK_FILL ),
}
{
- GtkLabel* label = GTK_LABEL( gtk_label_new( "Value" ) );
+ GtkLabel* label = GTK_LABEL( ui::Label( "Value" ) );
gtk_widget_show( GTK_WIDGET( label ) );
gtk_table_attach( table, GTK_WIDGET( label ), 0, 1, 1, 2,
(GtkAttachOptions)( GTK_FILL ),
}
{
- GtkLabel* label = GTK_LABEL( gtk_label_new( "Key" ) );
+ GtkLabel* label = GTK_LABEL( ui::Label( "Key" ) );
gtk_widget_show( GTK_WIDGET( label ) );
gtk_table_attach( table, GTK_WIDGET( label ), 0, 1, 0, 1,
(GtkAttachOptions)( GTK_FILL ),
}
{
- GtkBox* hbox = GTK_BOX( gtk_hbox_new( TRUE, 4 ) );
+ GtkBox* hbox = ui::HBox( TRUE, 4 );
gtk_widget_show( GTK_WIDGET( hbox ) );
gtk_box_pack_start( GTK_BOX( vbox2 ), GTK_WIDGET( hbox ), FALSE, TRUE, 0 );
{
- GtkButton* button = GTK_BUTTON( gtk_button_new_with_label( "Clear All" ) );
+ GtkButton* button = ui::Button( "Clear All" );
gtk_widget_show( GTK_WIDGET( button ) );
g_signal_connect( G_OBJECT( button ), "clicked", G_CALLBACK( EntityInspector_clearAllKeyValues ), 0 );
gtk_box_pack_start( hbox, GTK_WIDGET( button ), TRUE, TRUE, 0 );
}
{
- GtkButton* button = GTK_BUTTON( gtk_button_new_with_label( "Delete Key" ) );
+ GtkButton* button = ui::Button( "Delete Key" );
gtk_widget_show( GTK_WIDGET( button ) );
g_signal_connect( G_OBJECT( button ), "clicked", G_CALLBACK( EntityInspector_clearKeyValue ), 0 );
gtk_box_pack_start( hbox, GTK_WIDGET( button ), TRUE, TRUE, 0 );
}
{
- GtkWidget* scr = gtk_scrolled_window_new( 0, 0 );
+ ui::Widget scr = ui::ScrolledWindow();
gtk_widget_show( scr );
gtk_scrolled_window_set_policy( GTK_SCROLLED_WINDOW( scr ), GTK_POLICY_NEVER, GTK_POLICY_AUTOMATIC );
- GtkWidget* viewport = gtk_viewport_new( 0, 0 );
+ ui::Widget viewport = ui::Widget(gtk_viewport_new( 0, 0 ));
gtk_widget_show( viewport );
gtk_viewport_set_shadow_type( GTK_VIEWPORT( viewport ), GTK_SHADOW_NONE );
- g_attributeBox = GTK_VBOX( gtk_vbox_new( FALSE, 2 ) );
+ g_attributeBox = ui::VBox( FALSE, 2 );
gtk_widget_show( GTK_WIDGET( g_attributeBox ) );
gtk_container_add( GTK_CONTAINER( viewport ), GTK_WIDGET( g_attributeBox ) );
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
+#include <uilib/uilib.h>
+
#if !defined( INCLUDED_ENTITYINSPECTOR_H )
#define INCLUDED_ENTITYINSPECTOR_H
-typedef struct _GtkWidget GtkWidget;
-typedef struct _GtkWindow GtkWindow;
-GtkWidget* EntityInspector_constructWindow( GtkWindow* parent );
+ui::Widget EntityInspector_constructWindow( ui::Window parent );
void EntityInspector_construct();
void EntityInspector_destroy();
const char *EntityInspector_getCurrentKey();
#include "iselection.h"
-#include <gtk/gtktreemodel.h>
-#include <gtk/gtktreeview.h>
-#include <gtk/gtktreeselection.h>
-#include <gtk/gtkcellrenderertext.h>
+#include <gtk/gtk.h>
+#include <uilib/uilib.h>
#include "string/string.h"
#include "scenelib.h"
IdleDraw m_idleDraw;
WindowPositionTracker m_positionTracker;
-GtkWindow* m_window;
+ui::Window m_window;
GtkTreeView* m_tree_view;
GraphTreeModel* m_tree_model;
bool m_selection_disabled;
}
bool visible() const {
- return GTK_WIDGET_VISIBLE( GTK_WIDGET( m_window ) );
+ return gtk_widget_get_visible( m_window );
}
};
gtk_tree_view_set_model( getEntityList().m_tree_view, 0 );
}
-void EntityList_constructWindow( GtkWindow* main_window ){
- ASSERT_MESSAGE( getEntityList().m_window == 0, "error" );
+void EntityList_constructWindow( ui::Window main_window ){
+ ASSERT_TRUE( !getEntityList().m_window );
- GtkWindow* window = create_persistent_floating_window( "Entity List", main_window );
+ ui::Window window = ui::Window(create_persistent_floating_window( "Entity List", main_window ));
gtk_window_add_accel_group( window, global_accel );
gtk_container_add( GTK_CONTAINER( window ), GTK_WIDGET( scr ) );
{
- GtkWidget* view = gtk_tree_view_new();
+ ui::Widget view = ui::TreeView();
gtk_tree_view_set_headers_visible( GTK_TREE_VIEW( view ), FALSE );
- GtkCellRenderer* renderer = gtk_cell_renderer_text_new();
+ auto renderer = ui::CellRendererText();
GtkTreeViewColumn* column = gtk_tree_view_column_new();
gtk_tree_view_column_pack_start( column, renderer, TRUE );
gtk_tree_view_column_set_cell_data_func( column, renderer, entitylist_treeviewcolumn_celldatafunc, 0, 0 );
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
+#include <uilib/uilib.h>
+
#if !defined( INCLUDED_ENTITYLIST_H )
#define INCLUDED_ENTITYLIST_H
void EntityList_Construct();
void EntityList_Destroy();
-typedef struct _GtkWindow GtkWindow;
-void EntityList_constructWindow( GtkWindow* main_window );
+void EntityList_constructWindow( ui::Window main_window );
void EntityList_destroyWindow();
void EntityList_toggleShown();
#include "igl.h"
#include "iselection.h"
-#include <gtk/gtktreeview.h>
-#include <gtk/gtktreeselection.h>
-#include <gtk/gtkliststore.h>
-#include <gtk/gtkcellrenderertext.h>
-#include <gtk/gtkwindow.h>
-#include <gtk/gtkscrolledwindow.h>
+#include <gtk/gtk.h>
#include "map.h"
#include "dialog.h"
// push in the list
g_ptr_array_add( m_pFeedbackElements, (void *)pHandler );
- if ( GetWidget() == 0 ) {
+ if ( !GetWidget() ) {
Create();
}
ShowDlg();
}
-GtkWindow* CDbgDlg::BuildDialog(){
- GtkWindow* window = create_floating_window( "Q3Map debug window", MainFrame_getWindow() );
+ui::Window CDbgDlg::BuildDialog(){
+ ui::Window window = MainFrame_getWindow().create_floating_window("Q3Map debug window" );
- GtkWidget* scr = gtk_scrolled_window_new( NULL, NULL );
+ ui::Widget scr = ui::ScrolledWindow();
gtk_widget_show( scr );
gtk_container_add( GTK_CONTAINER( window ), GTK_WIDGET( scr ) );
gtk_scrolled_window_set_policy( GTK_SCROLLED_WINDOW( scr ), GTK_POLICY_NEVER, GTK_POLICY_AUTOMATIC );
{
GtkListStore* store = gtk_list_store_new( 1, G_TYPE_STRING );
- GtkWidget* view = gtk_tree_view_new_with_model( GTK_TREE_MODEL( store ) );
+ ui::Widget view = ui::TreeView(ui::TreeModel( GTK_TREE_MODEL( store ) ));
gtk_tree_view_set_headers_visible( GTK_TREE_VIEW( view ), FALSE );
{
- GtkCellRenderer* renderer = gtk_cell_renderer_text_new();
- GtkTreeViewColumn* column = gtk_tree_view_column_new_with_attributes( "", renderer, "text", 0, NULL );
+ auto renderer = ui::CellRendererText();
+ GtkTreeViewColumn* column = ui::TreeViewColumn( "", renderer, {{"text", 0}} );
gtk_tree_view_append_column( GTK_TREE_VIEW( view ), column );
}
}
}
void destroyWindow(){
- if ( GetWidget() != 0 ) {
+ if ( GetWidget() ) {
Destroy();
}
}
// void HideDlg();
protected:
-GtkWindow* BuildDialog();
+ui::Window BuildDialog();
};
extern CDbgDlg g_DbgDlg;
#include "ishaders.h"
-#include <gtk/gtkhbox.h>
-#include <gtk/gtkentry.h>
-#include <gtk/gtkvbox.h>
-#include <gtk/gtkframe.h>
-#include <gtk/gtklabel.h>
-#include <gtk/gtktable.h>
-#include <gtk/gtkbutton.h>
-#include <gtk/gtktogglebutton.h>
-#include <gtk/gtkcheckbutton.h>
-#include <gtk/gtkmenuitem.h>
-#include <gtk/gtkarrow.h>
+#include <gtk/gtk.h>
#include "gtkutil/window.h"
#include "stream/stringstream.h"
FindTextureDialog();
virtual ~FindTextureDialog();
-GtkWindow* BuildDialog();
+ui::Window BuildDialog();
-void constructWindow( GtkWindow* parent ){
+void constructWindow( ui::Window parent ){
m_parent = parent;
Create();
}
FindReplaceTextures( find.c_str(), replace.c_str(), g_FindTextureDialog.m_bSelectedOnly );
}
-static void OnApply( GtkWidget* widget, gpointer data ){
+static void OnApply( ui::Widget widget, gpointer data ){
g_FindTextureDialog.exportData();
FindTextureDialog_apply();
}
g_FindTextureDialog.HideDlg();
}
-static void OnClose( GtkWidget* widget, gpointer data ){
+static void OnClose( ui::Widget widget, gpointer data ){
g_FindTextureDialog.HideDlg();
}
-static gint find_focus_in( GtkWidget* widget, GdkEventFocus *event, gpointer data ){
+static gint find_focus_in( ui::Widget widget, GdkEventFocus *event, gpointer data ){
g_bFindActive = true;
return FALSE;
}
-static gint replace_focus_in( GtkWidget* widget, GdkEventFocus *event, gpointer data ){
+static gint replace_focus_in( ui::Widget widget, GdkEventFocus *event, gpointer data ){
g_bFindActive = false;
return FALSE;
}
FindTextureDialog::~FindTextureDialog(){
}
-GtkWindow* FindTextureDialog::BuildDialog(){
- GtkWidget* vbox, *hbox, *table, *label;
- GtkWidget* button, *check, *entry;
+ui::Window FindTextureDialog::BuildDialog(){
+ ui::Widget vbox, hbox, table, label;
+ ui::Widget button, check, entry;
- GtkWindow* dlg = create_floating_window( "Find / Replace Texture(s)", m_parent );
+ ui::Window dlg = ui::Window(create_floating_window( "Find / Replace Texture(s)", m_parent ));
- hbox = gtk_hbox_new( FALSE, 5 );
+ hbox = ui::HBox( FALSE, 5 );
gtk_widget_show( hbox );
gtk_container_add( GTK_CONTAINER( dlg ), GTK_WIDGET( hbox ) );
gtk_container_set_border_width( GTK_CONTAINER( hbox ), 5 );
- vbox = gtk_vbox_new( FALSE, 5 );
+ vbox = ui::VBox( FALSE, 5 );
gtk_widget_show( vbox );
gtk_box_pack_start( GTK_BOX( hbox ), GTK_WIDGET( vbox ), TRUE, TRUE, 0 );
- table = gtk_table_new( 2, 2, FALSE );
+ table = ui::Table( 2, 2, FALSE );
gtk_widget_show( table );
gtk_box_pack_start( GTK_BOX( vbox ), GTK_WIDGET( table ), TRUE, TRUE, 0 );
gtk_table_set_row_spacings( GTK_TABLE( table ), 5 );
gtk_table_set_col_spacings( GTK_TABLE( table ), 5 );
- label = gtk_label_new( "Find:" );
+ label = ui::Label( "Find:" );
gtk_widget_show( label );
gtk_table_attach( GTK_TABLE( table ), label, 0, 1, 0, 1,
(GtkAttachOptions) ( GTK_FILL ),
(GtkAttachOptions) ( 0 ), 0, 0 );
gtk_misc_set_alignment( GTK_MISC( label ), 0, 0.5 );
- label = gtk_label_new( "Replace:" );
+ label = ui::Label( "Replace:" );
gtk_widget_show( label );
gtk_table_attach( GTK_TABLE( table ), label, 0, 1, 1, 2,
(GtkAttachOptions) ( GTK_FILL ),
(GtkAttachOptions) ( 0 ), 0, 0 );
gtk_misc_set_alignment( GTK_MISC( label ), 0, 0.5 );
- entry = gtk_entry_new();
+ entry = ui::Entry();
gtk_widget_show( entry );
gtk_table_attach( GTK_TABLE( table ), entry, 1, 2, 0, 1,
(GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ),
AddDialogData( *GTK_ENTRY( entry ), m_strFind );
GlobalTextureEntryCompletion::instance().connect( GTK_ENTRY( entry ) );
- entry = gtk_entry_new();
+ entry = ui::Entry();
gtk_widget_show( entry );
gtk_table_attach( GTK_TABLE( table ), entry, 1, 2, 1, 2,
(GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ),
AddDialogData( *GTK_ENTRY( entry ), m_strReplace );
GlobalTextureEntryCompletion::instance().connect( GTK_ENTRY( entry ) );
- check = 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 );
- vbox = gtk_vbox_new( FALSE, 5 );
+ vbox = ui::VBox( FALSE, 5 );
gtk_widget_show( vbox );
gtk_box_pack_start( GTK_BOX( hbox ), GTK_WIDGET( vbox ), FALSE, FALSE, 0 );
- button = 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 );
+ gtk_widget_set_size_request( button, 60, -1 );
- button = 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",
G_CALLBACK( OnClose ), 0 );
- gtk_widget_set_usize( button, 60, -2 );
+ gtk_widget_set_size_request( button, 60, -1 );
return dlg;
}
}
bool FindTextureDialog::isOpen(){
- return GTK_WIDGET_VISIBLE( g_FindTextureDialog.GetWidget() ) == TRUE;
+ return gtk_widget_get_visible( g_FindTextureDialog.GetWidget() ) == TRUE;
}
void FindTextureDialog::setFindStr( const char* name ){
}
-void FindTextureDialog_constructWindow( GtkWindow* main_window ){
+void FindTextureDialog_constructWindow( ui::Window main_window ){
g_FindTextureDialog.constructWindow( main_window );
}
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
+#include <uilib/uilib.h>
+
#if !defined( INCLUDED_FINDTEXTUREDIALOG_H )
#define INCLUDED_FINDTEXTUREDIALOG_H
void FindTextureDialog_Construct();
void FindTextureDialog_Destroy();
-typedef struct _GtkWindow GtkWindow;
-void FindTextureDialog_constructWindow( GtkWindow* main_window );
+void FindTextureDialog_constructWindow( ui::Window main_window );
void FindTextureDialog_destroyWindow();
bool FindTextureDialog_isOpen();
void FindTextureDialog_selectTexture( const char* name );
#include <vector>
-#include <gtk/gtknotebook.h>
-#include <gtk/gtktextview.h>
-#include <gtk/gtklabel.h>
-#include <gtk/gtkscrolledwindow.h>
+#include <gtk/gtk.h>
#include "gtkutil/widget.h"
#include "gtkutil/accelerator.h"
#include "commands.h"
-#include <gtk/gtkwidget.h>
#include "gtkutil/window.h"
class GroupDlg
{
public:
-GtkWidget* m_pNotebook;
-GtkWindow* m_window;
+ui::Widget m_pNotebook;
+ui::Window m_window;
GroupDlg();
-void Create( GtkWindow* parent );
+void Create( ui::Window parent );
void Show(){
// workaround for strange gtk behaviour - modifying the contents of a window while it is not visible causes the window position to change without sending a configure_event
std::vector<StringExportCallback> g_pages;
}
-void GroupDialog_updatePageTitle( GtkWindow* window, std::size_t pageIndex ){
+void GroupDialog_updatePageTitle( ui::Window window, std::size_t pageIndex ){
if ( pageIndex < g_pages.size() ) {
g_pages[pageIndex]( PointerCaller1<GtkWindow, const char*, gtk_window_set_title>( window ) );
}
}
-static gboolean switch_page( GtkNotebook *notebook, GtkNotebookPage *page, guint page_num, gpointer data ){
- GroupDialog_updatePageTitle( GTK_WINDOW( data ), page_num );
+static gboolean switch_page( GtkNotebook *notebook, gpointer page, guint page_num, gpointer data ){
+ GroupDialog_updatePageTitle( ui::Window(GTK_WINDOW( data )), page_num );
g_current_page = page_num;
return FALSE;
m_position_tracker.setPosition( c_default_window_pos );
}
-void GroupDlg::Create( GtkWindow* parent ){
- ASSERT_MESSAGE( m_window == 0, "dialog already created" );
+void GroupDlg::Create( ui::Window parent ){
+ ASSERT_MESSAGE( !m_window, "dialog already created" );
- GtkWindow* window = create_persistent_floating_window( "Entities", parent );
+ ui::Window window = ui::Window(create_persistent_floating_window( "Entities", parent ));
global_accel_connect_window( window );
m_position_tracker.connect( window );
{
- GtkWidget* notebook = gtk_notebook_new();
+ ui::Widget notebook = ui::Widget(gtk_notebook_new());
gtk_widget_show( notebook );
gtk_container_add( GTK_CONTAINER( window ), notebook );
gtk_notebook_set_tab_pos( GTK_NOTEBOOK( notebook ), GTK_POS_BOTTOM );
m_pNotebook = notebook;
- g_signal_connect( G_OBJECT( notebook ), "switch_page", G_CALLBACK( switch_page ), window );
+ g_signal_connect( G_OBJECT(notebook), "switch_page", G_CALLBACK( switch_page ), (gpointer) window );
}
}
-GtkWidget* GroupDialog_addPage( const char* tabLabel, GtkWidget* widget, const StringExportCallback& title ){
- GtkWidget* w = gtk_label_new( tabLabel );
+ui::Widget GroupDialog_addPage( const char* tabLabel, ui::Widget widget, const StringExportCallback& title ){
+ ui::Widget w = ui::Label( tabLabel );
gtk_widget_show( w );
- GtkWidget* page = gtk_notebook_get_nth_page( GTK_NOTEBOOK( g_GroupDlg.m_pNotebook ), gtk_notebook_insert_page( GTK_NOTEBOOK( g_GroupDlg.m_pNotebook ), widget, w, -1 ) );
+ ui::Widget page = ui::Widget(gtk_notebook_get_nth_page( GTK_NOTEBOOK( g_GroupDlg.m_pNotebook ), gtk_notebook_insert_page( GTK_NOTEBOOK( g_GroupDlg.m_pNotebook ), widget, w, -1 ) ));
g_pages.push_back( title );
return page;
GroupDialog_setShown( !GroupDialog_isShown() );
}
-void GroupDialog_constructWindow( GtkWindow* main_window ){
+void GroupDialog_constructWindow( ui::Window main_window ){
g_GroupDlg.Create( main_window );
}
void GroupDialog_destroyWindow(){
- ASSERT_NOTNULL( g_GroupDlg.m_window );
+ ASSERT_TRUE( g_GroupDlg.m_window );
destroy_floating_window( g_GroupDlg.m_window );
- g_GroupDlg.m_window = 0;
+ g_GroupDlg.m_window = ui::Window();
}
-GtkWindow* GroupDialog_getWindow(){
- return g_GroupDlg.m_window;
+ui::Window GroupDialog_getWindow(){
+ return ui::Window(g_GroupDlg.m_window);
}
void GroupDialog_show(){
g_GroupDlg.Show();
}
-GtkWidget* GroupDialog_getPage(){
- return gtk_notebook_get_nth_page( GTK_NOTEBOOK( g_GroupDlg.m_pNotebook ), gint( g_current_page ) );
+ui::Widget GroupDialog_getPage(){
+ return ui::Widget(gtk_notebook_get_nth_page( GTK_NOTEBOOK( g_GroupDlg.m_pNotebook ), gint( g_current_page ) ));
}
-void GroupDialog_setPage( GtkWidget* page ){
+void GroupDialog_setPage( ui::Widget page ){
g_current_page = gtk_notebook_page_num( GTK_NOTEBOOK( g_GroupDlg.m_pNotebook ), page );
gtk_notebook_set_current_page( GTK_NOTEBOOK( g_GroupDlg.m_pNotebook ), gint( g_current_page ) );
}
-void GroupDialog_showPage( GtkWidget* page ){
+void GroupDialog_showPage( ui::Widget page ){
if ( GroupDialog_getPage() == page ) {
GroupDialog_ToggleShow();
}
gtk_notebook_set_current_page( GTK_NOTEBOOK( g_GroupDlg.m_pNotebook ), gint( g_current_page ) );
}
-void GroupDialog_updatePageTitle( GtkWidget* page ){
+void GroupDialog_updatePageTitle( ui::Widget page ){
if ( GroupDialog_getPage() == page ) {
GroupDialog_updatePageTitle( g_GroupDlg.m_window, g_current_page );
}
#if !defined( INCLUDED_GROUPDIALOG_H )
#define INCLUDED_GROUPDIALOG_H
+#include <uilib/uilib.h>
#include "generic/callback.h"
-typedef struct _GtkWidget GtkWidget;
-typedef struct _GtkWindow GtkWindow;
-
void GroupDialog_Construct();
void GroupDialog_Destroy();
-void GroupDialog_constructWindow( GtkWindow* main_window );
+void GroupDialog_constructWindow( ui::Window main_window );
void GroupDialog_destroyWindow();
-GtkWindow* GroupDialog_getWindow();
+ui::Window GroupDialog_getWindow();
void GroupDialog_show();
inline void RawStringExport( const char* string, const StringImportCallback& importer ){
importer( string );
}
typedef ConstPointerCaller1<char, const StringImportCallback&, RawStringExport> RawStringExportCaller;
-GtkWidget* GroupDialog_addPage( const char* tabLabel, GtkWidget* widget, const StringExportCallback& title );
+ui::Widget GroupDialog_addPage( const char* tabLabel, ui::Widget widget, const StringExportCallback& title );
-void GroupDialog_showPage( GtkWidget* page );
-void GroupDialog_updatePageTitle( GtkWidget* page );
+void GroupDialog_showPage( ui::Widget page );
+void GroupDialog_updatePageTitle( ui::Widget page );
bool GroupDialog_isShown();
-GtkWidget* GroupDialog_getPage();
+ui::Widget GroupDialog_getPage();
#endif
#include "iselection.h"
#include <gdk/gdkkeysyms.h>
-#include <gtk/gtkmain.h>
-#include <gtk/gtkentry.h>
-#include <gtk/gtkhbox.h>
-#include <gtk/gtkvbox.h>
-#include <gtk/gtkframe.h>
-#include <gtk/gtklabel.h>
-#include <gtk/gtktable.h>
-#include <gtk/gtkbutton.h>
-#include <gtk/gtkcombobox.h>
-#include <gtk/gtkscrolledwindow.h>
-#include <gtk/gtktextview.h>
-#include <gtk/gtktextbuffer.h>
-#include <gtk/gtktreeview.h>
-#include <gtk/gtkcellrenderertext.h>
-#include <gtk/gtktreeselection.h>
-#include <gtk/gtkliststore.h>
+#include <gtk/gtk.h>
+#include <uilib/uilib.h>
#include "os/path.h"
#include "math/aabb.h"
struct GameCombo
{
- GtkComboBox* game_select;
+ ui::ComboBoxText game_select;
GtkEntry* fsgame_entry;
};
-gboolean OnSelchangeComboWhatgame( GtkWidget *widget, GameCombo* combo ){
+gboolean OnSelchangeComboWhatgame( ui::Widget widget, GameCombo* combo ){
const char *gamename;
{
GtkTreeIter iter;
GtkComboBox* gamemode_combo;
};
-GtkWindow* ProjectSettingsDialog_construct( ProjectSettingsDialog& dialog, ModalDialog& modal ){
- GtkWindow* window = create_dialog_window( MainFrame_getWindow(), "Project Settings", G_CALLBACK( dialog_delete_callback ), &modal );
+ui::Window ProjectSettingsDialog_construct( ProjectSettingsDialog& dialog, ModalDialog& modal ){
+ ui::Window 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( frame ), GTK_WIDGET( table2 ) );
{
- GtkLabel* label = GTK_LABEL( gtk_label_new( "Select mod" ) );
+ GtkLabel* label = GTK_LABEL( ui::Label( "Select mod" ) );
gtk_widget_show( GTK_WIDGET( label ) );
gtk_table_attach( table2, GTK_WIDGET( label ), 0, 1, 0, 1,
(GtkAttachOptions) ( GTK_FILL ),
gtk_misc_set_alignment( GTK_MISC( label ), 1, 0.5 );
}
{
- dialog.game_combo.game_select = GTK_COMBO_BOX( gtk_combo_box_new_text() );
+ dialog.game_combo.game_select = ui::ComboBoxText();
- gtk_combo_box_append_text( dialog.game_combo.game_select, globalGameComboConfiguration().basegame );
+ gtk_combo_box_text_append_text( dialog.game_combo.game_select, globalGameComboConfiguration().basegame );
if ( globalGameComboConfiguration().known[0] != '\0' ) {
- gtk_combo_box_append_text( dialog.game_combo.game_select, globalGameComboConfiguration().known );
+ gtk_combo_box_text_append_text( dialog.game_combo.game_select, globalGameComboConfiguration().known );
}
- gtk_combo_box_append_text( dialog.game_combo.game_select, globalGameComboConfiguration().custom );
+ gtk_combo_box_text_append_text( dialog.game_combo.game_select, globalGameComboConfiguration().custom );
gtk_widget_show( GTK_WIDGET( dialog.game_combo.game_select ) );
gtk_table_attach( table2, GTK_WIDGET( dialog.game_combo.game_select ), 1, 2, 0, 1,
}
{
- GtkLabel* label = GTK_LABEL( gtk_label_new( "fs_game" ) );
+ GtkLabel* label = GTK_LABEL( ui::Label( "fs_game" ) );
gtk_widget_show( GTK_WIDGET( label ) );
gtk_table_attach( table2, GTK_WIDGET( label ), 0, 1, 1, 2,
(GtkAttachOptions) ( GTK_FILL ),
gtk_misc_set_alignment( GTK_MISC( label ), 1, 0.5 );
}
{
- GtkEntry* entry = GTK_ENTRY( gtk_entry_new() );
+ GtkEntry* entry = ui::Entry();
gtk_widget_show( GTK_WIDGET( entry ) );
gtk_table_attach( table2, GTK_WIDGET( entry ), 1, 2, 1, 2,
(GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ),
}
if ( globalMappingMode().do_mapping_mode ) {
- GtkLabel* label = GTK_LABEL( gtk_label_new( "Mapping mode" ) );
+ GtkLabel* label = GTK_LABEL( ui::Label( "Mapping mode" ) );
gtk_widget_show( GTK_WIDGET( label ) );
gtk_table_attach( table2, GTK_WIDGET( label ), 0, 1, 3, 4,
(GtkAttachOptions) ( GTK_FILL ),
(GtkAttachOptions) ( 0 ), 0, 0 );
gtk_misc_set_alignment( GTK_MISC( label ), 1, 0.5 );
- GtkComboBox* combo = GTK_COMBO_BOX( gtk_combo_box_new_text() );
- gtk_combo_box_append_text( combo, globalMappingMode().sp_mapping_mode );
- gtk_combo_box_append_text( combo, globalMappingMode().mp_mapping_mode );
+ auto combo = ui::ComboBoxText();
+ 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 ) );
gtk_table_attach( table2, GTK_WIDGET( combo ), 1, 2, 3, 4,
ModalDialog modal;
ProjectSettingsDialog dialog;
- GtkWindow* window = ProjectSettingsDialog_construct( dialog, modal );
+ ui::Window window = ProjectSettingsDialog_construct( dialog, modal );
if ( modal_dialog_show( window, modal ) == eIDOK ) {
ProjectSettingsDialog_ok( dialog );
ModalDialog dialog;
GtkEntry* sides_entry;
- GtkWindow* window = create_dialog_window( MainFrame_getWindow(), "Arbitrary sides", G_CALLBACK( dialog_delete_callback ), &dialog );
+ ui::Window window = MainFrame_getWindow().create_dialog_window("Arbitrary sides", G_CALLBACK(dialog_delete_callback ), &dialog );
- GtkAccelGroup* accel = gtk_accel_group_new();
+ GtkAccelGroup* accel = ui::AccelGroup();
gtk_window_add_accel_group( window, accel );
{
GtkHBox* hbox = create_dialog_hbox( 4, 4 );
gtk_container_add( GTK_CONTAINER( window ), GTK_WIDGET( hbox ) );
{
- GtkLabel* label = GTK_LABEL( gtk_label_new( "Sides:" ) );
+ GtkLabel* label = GTK_LABEL( ui::Label( "Sides:" ) );
gtk_widget_show( GTK_WIDGET( label ) );
gtk_box_pack_start( GTK_BOX( hbox ), GTK_WIDGET( label ), FALSE, FALSE, 0 );
}
{
- GtkEntry* entry = GTK_ENTRY( gtk_entry_new() );
+ GtkEntry* entry = ui::Entry();
gtk_widget_show( GTK_WIDGET( entry ) );
gtk_box_pack_start( GTK_BOX( hbox ), GTK_WIDGET( entry ), FALSE, FALSE, 0 );
sides_entry = entry;
// =============================================================================
// About dialog (no program is complete without one)
-void about_button_changelog( GtkWidget *widget, gpointer data ){
+void about_button_changelog( ui::Widget widget, gpointer data ){
StringOutputStream log( 256 );
log << "https://gitlab.com/xonotic/netradiant/commits/master";
OpenURL( log.c_str() );
}
-void about_button_credits( GtkWidget *widget, gpointer data ){
+void about_button_credits( ui::Widget widget, gpointer data ){
StringOutputStream cred( 256 );
cred << "https://gitlab.com/xonotic/netradiant/graphs/master";
OpenURL( cred.c_str() );
ModalDialog dialog;
ModalDialogButton ok_button( dialog, eIDOK );
- GtkWindow* window = create_modal_dialog_window( MainFrame_getWindow(), "About NetRadiant", dialog );
+ ui::Window window = MainFrame_getWindow().create_modal_dialog_window("About NetRadiant", dialog );
{
GtkVBox* vbox = create_dialog_vbox( 4, 4 );
}
{
- GtkLabel* label = GTK_LABEL( gtk_label_new( "NetRadiant " RADIANT_VERSION "\n"
- __DATE__ "\n\n"
- RADIANT_ABOUTMSG "\n\n"
- "By xonotic.org\n\n"
- "This program is free software\n"
- "licensed under the GNU GPL.\n\n"
- "NetRadiant is unsupported, however\n"
- "you may report your problems on issue tracker.\n"
- ) );
+ char const *label_text = "NetRadiant " RADIANT_VERSION "\n"
+ __DATE__ "\n\n"
+ RADIANT_ABOUTMSG "\n\n"
+ "This program is free software\n"
+ "licensed under the GNU GPL.\n\n"
+ "NetRadiant is unsupported, however\n"
+ "you may report your problems at\n"
+ "https://gitlab.com/xonotic/netradiant/issues";
+
+ GtkLabel* label = GTK_LABEL( ui::Label( label_text ) );
gtk_widget_show( GTK_WIDGET( label ) );
gtk_box_pack_start( GTK_BOX( hbox ), GTK_WIDGET( label ), FALSE, FALSE, 0 );
GtkTable* table = create_dialog_table( 3, 2, 4, 4, 4 );
gtk_container_add( GTK_CONTAINER( frame ), GTK_WIDGET( table ) );
{
- GtkLabel* label = GTK_LABEL( gtk_label_new( "Vendor:" ) );
+ GtkLabel* label = GTK_LABEL( ui::Label( "Vendor:" ) );
gtk_widget_show( GTK_WIDGET( label ) );
gtk_table_attach( table, GTK_WIDGET( label ), 0, 1, 0, 1,
(GtkAttachOptions) ( GTK_FILL ),
gtk_misc_set_alignment( GTK_MISC( label ), 0, 0.5 );
}
{
- GtkLabel* label = GTK_LABEL( gtk_label_new( "Version:" ) );
+ GtkLabel* label = GTK_LABEL( ui::Label( "Version:" ) );
gtk_widget_show( GTK_WIDGET( label ) );
gtk_table_attach( table, GTK_WIDGET( label ), 0, 1, 1, 2,
(GtkAttachOptions) ( GTK_FILL ),
gtk_misc_set_alignment( GTK_MISC( label ), 0, 0.5 );
}
{
- GtkLabel* label = GTK_LABEL( gtk_label_new( "Renderer:" ) );
+ GtkLabel* label = GTK_LABEL( ui::Label( "Renderer:" ) );
gtk_widget_show( GTK_WIDGET( label ) );
gtk_table_attach( table, GTK_WIDGET( label ), 0, 1, 2, 3,
(GtkAttachOptions) ( GTK_FILL ),
gtk_misc_set_alignment( GTK_MISC( label ), 0, 0.5 );
}
{
- GtkLabel* label = GTK_LABEL( gtk_label_new( reinterpret_cast<const char*>( glGetString( GL_VENDOR ) ) ) );
+ GtkLabel* label = GTK_LABEL( ui::Label( reinterpret_cast<const char*>( glGetString( GL_VENDOR ) ) ) );
gtk_widget_show( GTK_WIDGET( label ) );
gtk_table_attach( table, GTK_WIDGET( label ), 1, 2, 0, 1,
(GtkAttachOptions) ( GTK_FILL ),
gtk_misc_set_alignment( GTK_MISC( label ), 0, 0.5 );
}
{
- GtkLabel* label = GTK_LABEL( gtk_label_new( reinterpret_cast<const char*>( glGetString( GL_VERSION ) ) ) );
+ GtkLabel* label = GTK_LABEL( ui::Label( reinterpret_cast<const char*>( glGetString( GL_VERSION ) ) ) );
gtk_widget_show( GTK_WIDGET( label ) );
gtk_table_attach( table, GTK_WIDGET( label ), 1, 2, 1, 2,
(GtkAttachOptions) ( GTK_FILL ),
gtk_misc_set_alignment( GTK_MISC( label ), 0, 0.5 );
}
{
- GtkLabel* label = GTK_LABEL( gtk_label_new( reinterpret_cast<const char*>( glGetString( GL_RENDERER ) ) ) );
+ GtkLabel* label = GTK_LABEL( ui::Label( reinterpret_cast<const char*>( glGetString( GL_RENDERER ) ) ) );
gtk_widget_show( GTK_WIDGET( label ) );
gtk_table_attach( table, GTK_WIDGET( label ), 1, 2, 2, 3,
(GtkAttachOptions) ( GTK_FILL ),
GtkScrolledWindow* sc_extensions = create_scrolled_window( GTK_POLICY_AUTOMATIC, GTK_POLICY_ALWAYS, 4 );
gtk_container_add( GTK_CONTAINER( frame ), GTK_WIDGET( sc_extensions ) );
{
- GtkWidget* text_extensions = gtk_text_view_new();
+ ui::Widget text_extensions = ui::TextView();
gtk_text_view_set_editable( GTK_TEXT_VIEW( text_extensions ), FALSE );
gtk_container_add( GTK_CONTAINER( sc_extensions ), text_extensions );
GtkTextBuffer* buffer = gtk_text_view_get_buffer( GTK_TEXT_VIEW( text_extensions ) );
GtkEntry* x;
GtkEntry* y;
- GtkWindow* window = create_modal_dialog_window( MainFrame_getWindow(), "Patch texture layout", dialog );
+ ui::Window window = MainFrame_getWindow().create_modal_dialog_window("Patch texture layout", dialog );
- GtkAccelGroup* accel = gtk_accel_group_new();
+ GtkAccelGroup* accel = ui::AccelGroup();
gtk_window_add_accel_group( window, accel );
{
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( "Texture will be fit across the patch based\n"
+ GtkLabel* label = GTK_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( table ) );
gtk_box_pack_start( GTK_BOX( vbox ), GTK_WIDGET( table ), TRUE, TRUE, 0 );
{
- GtkLabel* label = GTK_LABEL( gtk_label_new( "Texture x:" ) );
+ GtkLabel* label = GTK_LABEL( ui::Label( "Texture x:" ) );
gtk_widget_show( GTK_WIDGET( label ) );
gtk_table_attach( table, GTK_WIDGET( label ), 0, 1, 0, 1,
(GtkAttachOptions) ( GTK_FILL ),
gtk_misc_set_alignment( GTK_MISC( label ), 0, 0.5 );
}
{
- GtkLabel* label = GTK_LABEL( gtk_label_new( "Texture y:" ) );
+ GtkLabel* label = GTK_LABEL( ui::Label( "Texture y:" ) );
gtk_widget_show( GTK_WIDGET( label ) );
gtk_table_attach( table, GTK_WIDGET( label ), 0, 1, 1, 2,
(GtkAttachOptions) ( GTK_FILL ),
gtk_misc_set_alignment( GTK_MISC( label ), 0, 0.5 );
}
{
- GtkEntry* entry = GTK_ENTRY( gtk_entry_new() );
+ GtkEntry* entry = ui::Entry();
gtk_widget_show( GTK_WIDGET( entry ) );
gtk_table_attach( table, GTK_WIDGET( entry ), 1, 2, 0, 1,
(GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ),
x = entry;
}
{
- GtkEntry* entry = GTK_ENTRY( gtk_entry_new() );
+ GtkEntry* entry = ui::Entry();
gtk_widget_show( GTK_WIDGET( entry ) );
gtk_table_attach( table, GTK_WIDGET( entry ), 1, 2, 1, 2,
(GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ),
// Text Editor dialog
// master window widget
-static GtkWidget *text_editor = 0;
-static GtkWidget *text_widget; // slave, text widget from the gtk editor
+static ui::Widget text_editor;
+static ui::Widget text_widget; // slave, text widget from the gtk editor
-static gint editor_delete( GtkWidget *widget, gpointer data ){
- if ( gtk_MessageBox( widget, "Close the shader editor ?", "Radiant", eMB_YESNO, eMB_ICONQUESTION ) == eIDNO ) {
+static gint editor_delete( ui::Widget widget, gpointer data ){
+ if ( widget.alert( "Close the shader editor ?", "Radiant", ui::alert_type::YESNO, ui::alert_icon::Question ) == ui::alert_response::NO ) {
return TRUE;
}
return TRUE;
}
-static void editor_save( GtkWidget *widget, gpointer data ){
+static void editor_save( ui::Widget widget, gpointer data ){
FILE *f = fopen( (char*)g_object_get_data( G_OBJECT( data ), "filename" ), "w" );
gpointer text = g_object_get_data( G_OBJECT( data ), "text" );
if ( f == 0 ) {
- gtk_MessageBox( GTK_WIDGET( data ), "Error saving file !" );
+ ui::Widget(GTK_WIDGET( data )).alert( "Error saving file !" );
return;
}
fclose( f );
}
-static void editor_close( GtkWidget *widget, gpointer data ){
- if ( gtk_MessageBox( text_editor, "Close the shader editor ?", "Radiant", eMB_YESNO, eMB_ICONQUESTION ) == eIDNO ) {
+static void editor_close( ui::Widget widget, gpointer data ){
+ if ( text_editor.alert( "Close the shader editor ?", "Radiant", ui::alert_type::YESNO, ui::alert_icon::Question ) == ui::alert_response::NO ) {
return;
}
}
static void CreateGtkTextEditor(){
- GtkWidget *dlg;
- GtkWidget *vbox, *hbox, *button, *scr, *text;
+ ui::Widget dlg;
+ ui::Widget vbox, hbox, button, scr, text;
- dlg = gtk_window_new( GTK_WINDOW_TOPLEVEL );
+ dlg = ui::Window( ui::window_type::TOP );
g_signal_connect( G_OBJECT( dlg ), "delete_event",
G_CALLBACK( editor_delete ), 0 );
gtk_window_set_default_size( GTK_WINDOW( dlg ), 600, 300 );
- vbox = gtk_vbox_new( FALSE, 5 );
+ vbox = ui::VBox( FALSE, 5 );
gtk_widget_show( vbox );
gtk_container_add( GTK_CONTAINER( dlg ), GTK_WIDGET( vbox ) );
gtk_container_set_border_width( GTK_CONTAINER( vbox ), 5 );
- scr = gtk_scrolled_window_new( 0, 0 );
+ scr = ui::ScrolledWindow();
gtk_widget_show( scr );
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 = gtk_text_view_new();
+ text = ui::TextView();
gtk_container_add( GTK_CONTAINER( scr ), text );
gtk_widget_show( text );
- g_object_set_data( G_OBJECT( dlg ), "text", text );
+ g_object_set_data( G_OBJECT( dlg ), "text", (gpointer) text );
gtk_text_view_set_editable( GTK_TEXT_VIEW( text ), TRUE );
- hbox = gtk_hbox_new( FALSE, 5 );
+ hbox = ui::HBox( FALSE, 5 );
gtk_widget_show( hbox );
gtk_box_pack_start( GTK_BOX( vbox ), GTK_WIDGET( hbox ), FALSE, TRUE, 0 );
- button = 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 );
+ gtk_widget_set_size_request( button, 60, -1 );
- button = 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",
G_CALLBACK( editor_save ), dlg );
- gtk_widget_set_usize( button, 60, -2 );
+ gtk_widget_set_size_request( button, 60, -1 );
text_editor = dlg;
text_widget = text;
ModalDialogButton ok_button( dialog, eIDOK );
ModalDialogButton cancel_button( dialog, eIDCANCEL );
- GtkWindow* window = create_modal_dialog_window( MainFrame_getWindow(), "Light intensity", dialog, -1, -1 );
+ ui::Window window = MainFrame_getWindow().create_modal_dialog_window("Light intensity", dialog, -1, -1 );
- GtkAccelGroup *accel_group = gtk_accel_group_new();
+ GtkAccelGroup *accel_group = ui::AccelGroup();
gtk_window_add_accel_group( window, accel_group );
{
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( "ESC for default, ENTER to validate" ) );
+ GtkLabel* label = GTK_LABEL( ui::Label( "ESC for default, ENTER to validate" ) );
gtk_widget_show( GTK_WIDGET( label ) );
gtk_box_pack_start( GTK_BOX( vbox ), GTK_WIDGET( label ), FALSE, FALSE, 0 );
}
{
- GtkEntry* entry = GTK_ENTRY( gtk_entry_new() );
+ GtkEntry* entry = ui::Entry();
gtk_widget_show( GTK_WIDGET( entry ) );
gtk_box_pack_start( GTK_BOX( vbox ), GTK_WIDGET( entry ), TRUE, TRUE, 0 );
ModalDialogButton ok_button( dialog, eIDOK );
ModalDialogButton cancel_button( dialog, eIDCANCEL );
- GtkWindow* window = create_modal_dialog_window( MainFrame_getWindow(), title, dialog, -1, -1 );
+ ui::Window window = MainFrame_getWindow().create_modal_dialog_window(title, dialog, -1, -1 );
- GtkAccelGroup *accel_group = gtk_accel_group_new();
+ GtkAccelGroup *accel_group = ui::AccelGroup();
gtk_window_add_accel_group( window, accel_group );
{
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( gtk_label_new( "ESC to cancel, ENTER to validate" ) );
+ GtkLabel* label = GTK_LABEL( ui::Label( "ESC to cancel, ENTER to validate" ) );
gtk_widget_show( GTK_WIDGET( label ) );
gtk_box_pack_start( GTK_BOX( vbox ), GTK_WIDGET( label ), FALSE, FALSE, 0 );
}
{
- GtkEntry* entry = GTK_ENTRY( gtk_entry_new() );
+ GtkEntry* entry = ui::Entry();
gtk_widget_show( GTK_WIDGET( entry ) );
gtk_box_pack_start( GTK_BOX( vbox ), GTK_WIDGET( entry ), TRUE, TRUE, 0 );
ModalDialog dialog;
ModalDialogButton ok_button( dialog, eIDOK );
- GtkWindow* window = create_modal_dialog_window( MainFrame_getWindow(), title, dialog, -1, -1 );
+ ui::Window window = MainFrame_getWindow().create_modal_dialog_window(title, dialog, -1, -1 );
- GtkAccelGroup *accel_group = gtk_accel_group_new();
+ GtkAccelGroup *accel_group = ui::AccelGroup();
gtk_window_add_accel_group( window, accel_group );
{
GtkVBox* vbox = create_dialog_vbox( 4 );
gtk_box_pack_start( GTK_BOX( hbox ), GTK_WIDGET( vbox ), FALSE, FALSE, 0 );
{
- GtkLabel* label = GTK_LABEL( gtk_label_new( "The selected shader" ) );
+ GtkLabel* label = GTK_LABEL( ui::Label( "The selected shader" ) );
gtk_widget_show( GTK_WIDGET( label ) );
gtk_box_pack_start( GTK_BOX( vbox ), GTK_WIDGET( label ), FALSE, FALSE, 0 );
}
{
- GtkLabel* label = GTK_LABEL( gtk_label_new( name ) );
+ GtkLabel* label = GTK_LABEL( ui::Label( name ) );
gtk_widget_show( GTK_WIDGET( label ) );
gtk_box_pack_start( GTK_BOX( vbox ), GTK_WIDGET( label ), FALSE, FALSE, 0 );
}
{
- GtkLabel* label = GTK_LABEL( gtk_label_new( "is located in file" ) );
+ GtkLabel* label = GTK_LABEL( ui::Label( "is located in file" ) );
gtk_widget_show( GTK_WIDGET( label ) );
gtk_box_pack_start( GTK_BOX( vbox ), GTK_WIDGET( label ), FALSE, FALSE, 0 );
}
{
- GtkLabel* label = GTK_LABEL( gtk_label_new( filename ) );
+ GtkLabel* label = GTK_LABEL( ui::Label( filename ) );
gtk_widget_show( GTK_WIDGET( label ) );
gtk_box_pack_start( GTK_BOX( vbox ), GTK_WIDGET( label ), FALSE, FALSE, 0 );
}
#ifdef WIN32
if ( g_TextEditor_useWin32Editor ) {
globalOutputStream() << "opening file '" << filename << "' (line " << cursorpos << " info ignored)\n";
- ShellExecute( (HWND)GDK_WINDOW_HWND( GTK_WIDGET( MainFrame_getWindow() )->window ), "open", filename, 0, 0, SW_SHOW );
+ ShellExecute( (HWND)GDK_WINDOW_HWND( gtk_widget_get_window( MainFrame_getWindow() ) ), "open", filename, 0, 0, SW_SHOW );
return;
}
#else
#include "gtkmisc.h"
-#include <gtk/gtkcolorseldialog.h>
-#include <gtk/gtkentry.h>
+#include <gtk/gtk.h>
+#include "uilib/uilib.h"
#include "math/vector.h"
#include "os/path.h"
return create_menu_item_with_mnemonic( menu, mnemonic, command );
}
-GtkButton* toolbar_append_button( GtkToolbar* toolbar, const char* description, const char* icon, const char* commandName ){
+GtkToolButton* toolbar_append_button( GtkToolbar* toolbar, const char* description, const char* icon, const char* commandName ){
return toolbar_append_button( toolbar, description, icon, GlobalCommands_find( commandName ) );
}
-GtkToggleButton* toolbar_append_toggle_button( GtkToolbar* toolbar, const char* description, const char* icon, const char* commandName ){
+GtkToggleToolButton* toolbar_append_toggle_button( GtkToolbar* toolbar, const char* description, const char* icon, const char* commandName ){
return toolbar_append_toggle_button( toolbar, description, icon, GlobalToggles_find( commandName ) );
}
// =============================================================================
// File dialog
-bool color_dialog( GtkWidget *parent, Vector3& color, const char* title ){
- GtkWidget* dlg;
- double clr[3];
+bool color_dialog( ui::Widget parent, Vector3& color, const char* title ){
+ ui::Widget dlg;
+ GdkColor clr = { 0, guint16(color[0] * 65535), guint16(color[1] * 65535), guint16(color[2] * 65535) };
ModalDialog dialog;
- clr[0] = color[0];
- clr[1] = color[1];
- clr[2] = color[2];
-
- dlg = gtk_color_selection_dialog_new( title );
- gtk_color_selection_set_color( GTK_COLOR_SELECTION( GTK_COLOR_SELECTION_DIALOG( dlg )->colorsel ), clr );
+ dlg = ui::Widget(gtk_color_selection_dialog_new( title ));
+ gtk_color_selection_set_current_color( GTK_COLOR_SELECTION( gtk_color_selection_dialog_get_color_selection(GTK_COLOR_SELECTION_DIALOG( dlg )) ), &clr );
g_signal_connect( G_OBJECT( dlg ), "delete_event", G_CALLBACK( dialog_delete_callback ), &dialog );
- g_signal_connect( G_OBJECT( GTK_COLOR_SELECTION_DIALOG( dlg )->ok_button ), "clicked", G_CALLBACK( dialog_button_ok ), &dialog );
- g_signal_connect( G_OBJECT( GTK_COLOR_SELECTION_DIALOG( dlg )->cancel_button ), "clicked", G_CALLBACK( dialog_button_cancel ), &dialog );
+ GtkWidget *ok_button, *cancel_button;
+ g_object_get(dlg, "ok-button", &ok_button, "cancel-button", &cancel_button, nullptr);
+ g_signal_connect( ok_button, "clicked", G_CALLBACK( dialog_button_ok ), &dialog );
+ g_signal_connect( cancel_button, "clicked", G_CALLBACK( dialog_button_cancel ), &dialog );
- if ( parent != 0 ) {
+ if ( parent ) {
gtk_window_set_transient_for( GTK_WINDOW( dlg ), GTK_WINDOW( parent ) );
}
bool ok = modal_dialog_show( GTK_WINDOW( dlg ), dialog ) == eIDOK;
if ( ok ) {
- GdkColor gdkcolor;
- gtk_color_selection_get_current_color( GTK_COLOR_SELECTION( GTK_COLOR_SELECTION_DIALOG( dlg )->colorsel ), &gdkcolor );
- clr[0] = gdkcolor.red / 65535.0;
- clr[1] = gdkcolor.green / 65535.0;
- clr[2] = gdkcolor.blue / 65535.0;
-
- color[0] = (float)clr[0];
- color[1] = (float)clr[1];
- color[2] = (float)clr[2];
+ gtk_color_selection_get_current_color( GTK_COLOR_SELECTION( gtk_color_selection_dialog_get_color_selection(GTK_COLOR_SELECTION_DIALOG( dlg )) ), &clr );
+ color[0] = clr.red / 65535.0f;
+ color[1] = clr.green / 65535.0f;
+ color[2] = clr.blue / 65535.0f;
}
gtk_widget_destroy( dlg );
return ok;
}
-void button_clicked_entry_browse_file( GtkWidget* widget, GtkEntry* entry ){
- const char *filename = file_dialog( gtk_widget_get_toplevel( widget ), TRUE, "Choose File", gtk_entry_get_text( entry ) );
+void button_clicked_entry_browse_file( ui::Widget widget, GtkEntry* entry ){
+ const char *filename = ui::Widget(gtk_widget_get_toplevel( widget )).file_dialog( TRUE, "Choose File", gtk_entry_get_text( entry ) );
if ( filename != 0 ) {
gtk_entry_set_text( entry, filename );
}
}
-void button_clicked_entry_browse_directory( GtkWidget* widget, GtkEntry* entry ){
+void button_clicked_entry_browse_directory( ui::Widget widget, GtkEntry* entry ){
const char* text = gtk_entry_get_text( entry );
- char *dir = dir_dialog( gtk_widget_get_toplevel( widget ), "Choose Directory", path_is_absolute( text ) ? text : "" );
+ char *dir = dir_dialog( ui::Widget(gtk_widget_get_toplevel( widget )), "Choose Directory", path_is_absolute( text ) ? text : "" );
if ( dir != 0 ) {
gchar* converted = g_filename_to_utf8( dir, -1, 0, 0, 0 );
#if !defined( INCLUDED_GTKMISC_H )
#define INCLUDED_GTKMISC_H
-#include <gtk/gtkmain.h>
+#include <gtk/gtk.h>
+#include <uilib/uilib.h>
inline void process_gui(){
while ( gtk_events_pending() )
typedef struct _GtkToolbar GtkToolbar;
// this DOES NOT set up the shortcut using command_connect_accelerator
-GtkButton* toolbar_append_button( GtkToolbar* toolbar, const char* description, const char* icon, const char* commandName );
+GtkToolButton* toolbar_append_button( GtkToolbar* toolbar, const char* description, const char* icon, const char* commandName );
// this DOES NOT set up the shortcut using command_connect_accelerator
-GtkToggleButton* toolbar_append_toggle_button( GtkToolbar* toolbar, const char* description, const char* icon, const char* commandName );
+GtkToggleToolButton* toolbar_append_toggle_button( GtkToolbar* toolbar, const char* description, const char* icon, const char* commandName );
template<typename Element> class BasicVector3;
typedef BasicVector3<float> Vector3;
-bool color_dialog( GtkWidget *parent, Vector3& color, const char* title = "Choose Color" );
+bool color_dialog( ui::Widget parent, Vector3& color, const char* title = "Choose Color" );
typedef struct _GtkEntry GtkEntry;
-void button_clicked_entry_browse_file( GtkWidget* widget, GtkEntry* entry );
-void button_clicked_entry_browse_directory( GtkWidget* widget, GtkEntry* entry );
+void button_clicked_entry_browse_file( ui::Widget widget, GtkEntry* entry );
+void button_clicked_entry_browse_directory( ui::Widget widget, GtkEntry* entry );
#endif
#include "iundo.h"
-#include <gtk/gtkmain.h>
+#include "uilib/uilib.h"
+#include <gtk/gtk.h>
#include "cmdlib.h"
#include "os/file.h"
ScopedLock lock( m_lock );
#if defined _DEBUG
m_buffer << "Break into the debugger?\n";
- bool handled = gtk_MessageBox( 0, m_buffer.c_str(), "Radiant - Runtime Error", eMB_YESNO, eMB_ICONERROR ) == eIDNO;
+ bool handled = ui::root.alert( m_buffer.c_str(), "Radiant - Runtime Error", ui::alert_type::YESNO, ui::alert_icon::Error ) == ui::alert_response::NO;
m_buffer.clear();
return handled;
#else
m_buffer << "Please report this error to the developers\n";
- gtk_MessageBox( 0, m_buffer.c_str(), "Radiant - Runtime Error", eMB_OK, eMB_ICONERROR );
+ ui::root.alert( m_buffer.c_str(), "Radiant - Runtime Error", ui::alert_type::OK, ui::alert_icon::Error );
m_buffer.clear();
#endif
}
if ( !bVerIsGood ) {
StringOutputStream msg( 256 );
msg << "This editor binary (" RADIANT_VERSION ") doesn't match what the latest setup has configured in this directory\n"
- "Make sure you run the right/latest editor binary you installed\n"
+ "Make sure you run the right/latest editor binary you installed\n"
<< AppPath_get();
- gtk_MessageBox( 0, msg.c_str(), "Radiant", eMB_OK, eMB_ICONDEFAULT );
+ ui::alert( 0, msg.c_str(), "Radiant", eMB_OK, eMB_ICONDEFAULT );
}
return bVerIsGood;
#else
if ( remove( g_pidFile.c_str() ) == -1 ) {
StringOutputStream msg( 256 );
msg << "WARNING: Could not delete " << g_pidFile.c_str();
- gtk_MessageBox( 0, msg.c_str(), "Radiant", eMB_OK, eMB_ICONERROR );
+ ui::root.alert( msg.c_str(), "Radiant", ui::alert_type::OK, ui::alert_icon::Error );
}
// in debug, never prompt to clean registry, turn console logging auto after a failed start
"The failure may be related to current global preferences.\n"
"Do you want to reset global preferences to defaults?";
- if ( gtk_MessageBox( 0, msg.c_str(), "Radiant - Startup Failure", eMB_YESNO, eMB_ICONQUESTION ) == eIDYES ) {
+ if ( ui::root.alert( msg.c_str(), "Radiant - Startup Failure", ui::alert_type::YESNO, ui::alert_icon::QUESTION ) == ui::alert_response::YES ) {
g_GamesDialog.Reset();
}
msg.clear();
msg << "Logging console output to " << SettingsPath_get() << "radiant.log\nRefer to the log if Radiant fails to start again.";
- gtk_MessageBox( 0, msg.c_str(), "Radiant - Console Log", eMB_OK );
+ ui::root.alert( msg.c_str(), "Radiant - Console Log", ui::alert_type::OK );
#endif
// set without saving, the class is not in a coherent state yet
if ( remove( g_pidFile.c_str() ) == -1 ) {
StringOutputStream msg( 256 );
msg << "WARNING: Could not delete " << g_pidFile.c_str();
- gtk_MessageBox( 0, msg.c_str(), "Radiant", eMB_OK, eMB_ICONERROR );
+ ui::root.alert( msg.c_str(), "Radiant", ui::alert_type::OK, ui::alert_icon::Error );
}
}
if ( remove( g_pidGameFile.c_str() ) == -1 ) {
StringOutputStream msg;
msg << "WARNING: Could not delete " << g_pidGameFile.c_str();
- gtk_MessageBox( 0, msg.c_str(), "Radiant", eMB_OK, eMB_ICONERROR );
+ ui::root.alert( msg.c_str(), "Radiant", ui::alert_type::OK, ui::alert_icon::Error );
}
// in debug, never prompt to clean registry, turn console logging auto after a failed start
"The failure may be caused by current preferences.\n"
"Do you want to reset all preferences to defaults?";
- if ( gtk_MessageBox( 0, msg.c_str(), "Radiant - Startup Failure", eMB_YESNO, eMB_ICONQUESTION ) == eIDYES ) {
+ if ( ui::root.alert( msg.c_str(), "Radiant - Startup Failure", ui::alert_type::YESNO, ui::alert_icon::QUESTION ) == ui::alert_response::YES ) {
Preferences_Reset();
}
msg.clear();
msg << "Logging console output to " << SettingsPath_get() << "radiant.log\nRefer to the log if Radiant fails to start again.";
- gtk_MessageBox( 0, msg.c_str(), "Radiant - Console Log", eMB_OK );
+ ui::root.alert( msg.c_str(), "Radiant - Console Log", ui::alert_type::OK );
#endif
// force console logging on! (will go in prefs too)
remove_local_pid();
- gtk_main();
+ ui::main();
// avoid saving prefs when the app is minimized
if ( g_pParentWnd->IsSleeping() ) {
#include <ctime>
#include <gdk/gdkkeysyms.h>
-#include <gtk/gtkhbox.h>
-#include <gtk/gtkvbox.h>
-#include <gtk/gtkframe.h>
-#include <gtk/gtklabel.h>
-#include <gtk/gtkhpaned.h>
-#include <gtk/gtkvpaned.h>
-#include <gtk/gtktoolbar.h>
-#include <gtk/gtkmenubar.h>
-#include <gtk/gtkimage.h>
-#include <gtk/gtktable.h>
+#include <gtk/gtk.h>
#include "cmdlib.h"
class PathsDialog : public Dialog
{
public:
-GtkWindow* BuildDialog(){
+ui::Window BuildDialog(){
GtkFrame* frame = create_dialog_frame( "Path settings", GTK_SHADOW_ETCHED_IN );
GtkVBox* vbox2 = create_dialog_vbox( 0, 4 );
gtk_container_add( GTK_CONTAINER( frame ), GTK_WIDGET( vbox2 ) );
{
- PreferencesPage preferencesPage( *this, GTK_WIDGET( vbox2 ) );
+ PreferencesPage preferencesPage( *this, ui::Widget(GTK_WIDGET( vbox2 )) );
Paths_constructPreferences( preferencesPage );
}
- return create_simple_modal_dialog_window( "Engine Path Not Found", m_modal, GTK_WIDGET( frame ) );
+ return ui::Window(create_simple_modal_dialog_window( "Engine Path Not Found", m_modal, GTK_WIDGET( frame ) ));
}
};
void operator()(){
Vector3 colour;
m_get( colour );
- color_dialog( GTK_WIDGET( MainFrame_getWindow() ), colour );
+ color_dialog( MainFrame_getWindow(), colour );
m_set( colour );
}
};
}
-GtkWidget* g_page_console;
+ui::Widget g_page_console;
void Console_ToggleShow(){
GroupDialog_showPage( g_page_console );
}
-GtkWidget* g_page_entity;
+ui::Widget g_page_entity;
void EntityInspector_ToggleShow(){
GroupDialog_showPage( g_page_entity );
void EverySecondTimer_enable(){
if ( s_qe_every_second_id == 0 ) {
- s_qe_every_second_id = gtk_timeout_add( 1000, qe_every_second, 0 );
+ s_qe_every_second_id = g_timeout_add( 1000, qe_every_second, 0 );
}
}
void EverySecondTimer_disable(){
if ( s_qe_every_second_id != 0 ) {
- gtk_timeout_remove( s_qe_every_second_id );
+ g_source_remove( s_qe_every_second_id );
s_qe_every_second_id = 0;
}
}
-gint window_realize_remove_decoration( GtkWidget* widget, gpointer data ){
- gdk_window_set_decorations( widget->window, (GdkWMDecoration)( GDK_DECOR_ALL | GDK_DECOR_MENU | GDK_DECOR_MINIMIZE | GDK_DECOR_MAXIMIZE ) );
+gint window_realize_remove_decoration( ui::Widget widget, gpointer data ){
+ gdk_window_set_decorations( gtk_widget_get_window(widget), (GdkWMDecoration)( GDK_DECOR_ALL | GDK_DECOR_MENU | GDK_DECOR_MINIMIZE | GDK_DECOR_MAXIMIZE ) );
return FALSE;
}
class WaitDialog
{
public:
-GtkWindow* m_window;
+ui::Window m_window;
GtkLabel* m_label;
};
WaitDialog create_wait_dialog( const char* title, const char* text ){
WaitDialog dialog;
- dialog.m_window = create_floating_window( title, MainFrame_getWindow() );
+ dialog.m_window = MainFrame_getWindow().create_floating_window(title);
gtk_window_set_resizable( dialog.m_window, FALSE );
gtk_container_set_border_width( GTK_CONTAINER( dialog.m_window ), 0 );
gtk_window_set_position( dialog.m_window, GTK_WIN_POS_CENTER_ON_PARENT );
g_signal_connect( G_OBJECT( dialog.m_window ), "realize", G_CALLBACK( window_realize_remove_decoration ), 0 );
{
- dialog.m_label = GTK_LABEL( gtk_label_new( text ) );
+ dialog.m_label = GTK_LABEL( ui::Label( text ) );
gtk_misc_set_alignment( GTK_MISC( dialog.m_label ), 0.0, 0.5 );
gtk_label_set_justify( dialog.m_label, GTK_JUSTIFY_LEFT );
gtk_widget_show( GTK_WIDGET( dialog.m_label ) );
}
void ScreenUpdates_process(){
- if ( redrawRequired() && GTK_WIDGET_VISIBLE( g_wait.m_window ) ) {
+ if ( redrawRequired() && gtk_widget_get_visible( g_wait.m_window ) ) {
process_gui();
}
}
ScreenUpdates_process();
}
}
- else if ( GTK_WIDGET_VISIBLE( g_wait.m_window ) ) {
+ else if ( gtk_widget_get_visible( g_wait.m_window ) ) {
gtk_label_set_text( g_wait.m_label, message );
ScreenUpdates_process();
}
gtk_grab_remove( GTK_WIDGET( g_wait.m_window ) );
destroy_floating_window( g_wait.m_window );
- g_wait.m_window = 0;
+ g_wait.m_window = ui::Window();
//gtk_window_present(MainFrame_getWindow());
}
- else if ( GTK_WIDGET_VISIBLE( g_wait.m_window ) ) {
+ else if ( gtk_widget_get_visible( g_wait.m_window ) ) {
gtk_label_set_text( g_wait.m_label, g_wait_stack.back().c_str() );
ScreenUpdates_process();
}
}
-GtkWidget* g_toggle_z_item = 0;
-GtkWidget* g_toggle_console_item = 0;
-GtkWidget* g_toggle_entity_item = 0;
-GtkWidget* g_toggle_entitylist_item = 0;
+ui::Widget g_toggle_z_item;
+ui::Widget g_toggle_console_item;
+ui::Widget g_toggle_entity_item;
+ui::Widget g_toggle_entitylist_item;
GtkMenuItem* create_view_menu( MainFrame::EViewStyle style ){
// View menu
GtkToolbar* create_main_toolbar( MainFrame::EViewStyle style ){
GtkToolbar* toolbar = GTK_TOOLBAR( gtk_toolbar_new() );
- gtk_toolbar_set_orientation( toolbar, GTK_ORIENTATION_HORIZONTAL );
+ gtk_orientable_set_orientation( GTK_ORIENTABLE(toolbar), GTK_ORIENTATION_HORIZONTAL );
gtk_toolbar_set_style( toolbar, GTK_TOOLBAR_ICONS );
gtk_widget_show( GTK_WIDGET( toolbar ) );
+ auto space = [&]() {
+ auto btn = gtk_separator_tool_item_new();
+ gtk_widget_show(GTK_WIDGET(btn));
+ gtk_container_add(GTK_CONTAINER(toolbar), GTK_WIDGET(btn));
+ };
+
File_constructToolbar( toolbar );
- gtk_toolbar_append_space( GTK_TOOLBAR( toolbar ) );
+ space();
UndoRedo_constructToolbar( toolbar );
- gtk_toolbar_append_space( GTK_TOOLBAR( toolbar ) );
+ space();
RotateFlip_constructToolbar( toolbar );
- gtk_toolbar_append_space( GTK_TOOLBAR( toolbar ) );
+ space();
Select_constructToolbar( toolbar );
- gtk_toolbar_append_space( GTK_TOOLBAR( toolbar ) );
+ space();
CSG_constructToolbar( toolbar );
- gtk_toolbar_append_space( GTK_TOOLBAR( toolbar ) );
+ space();
ComponentModes_constructToolbar( toolbar );
if ( style == MainFrame::eRegular || style == MainFrame::eRegularLeft || style == MainFrame::eFloating ) {
- gtk_toolbar_append_space( GTK_TOOLBAR( toolbar ) );
+ space();
XYWnd_constructToolbar( toolbar );
}
- gtk_toolbar_append_space( GTK_TOOLBAR( toolbar ) );
+ space();
CamWnd_constructToolbar( toolbar );
- gtk_toolbar_append_space( GTK_TOOLBAR( toolbar ) );
+ space();
Manipulators_constructToolbar( toolbar );
if ( g_Layout_enablePatchToolbar.m_value ) {
- gtk_toolbar_append_space( GTK_TOOLBAR( toolbar ) );
+ space();
Patch_constructToolbar( toolbar );
}
- gtk_toolbar_append_space( GTK_TOOLBAR( toolbar ) );
+ space();
toolbar_append_toggle_button( toolbar, "Texture Lock (SHIFT +T)", "texture_lock.png", "TogTexLock" );
- gtk_toolbar_append_space( GTK_TOOLBAR( toolbar ) );
+ space();
- GtkButton* g_view_entities_button = toolbar_append_button( toolbar, "Entities (N)", "entities.png", "ToggleEntityInspector" );
- GtkButton* g_view_console_button = toolbar_append_button( toolbar, "Console (O)", "console.png", "ToggleConsole" );
- GtkButton* g_view_textures_button = toolbar_append_button( toolbar, "Texture Browser (T)", "texture_browser.png", "ToggleTextures" );
+ /*auto g_view_entities_button =*/ toolbar_append_button( toolbar, "Entities (N)", "entities.png", "ToggleEntityInspector" );
+ auto g_view_console_button = toolbar_append_button( toolbar, "Console (O)", "console.png", "ToggleConsole" );
+ auto g_view_textures_button = toolbar_append_button( toolbar, "Texture Browser (T)", "texture_browser.png", "ToggleTextures" );
// TODO: call light inspector
//GtkButton* g_view_lightinspector_button = toolbar_append_button(toolbar, "Light Inspector", "lightinspector.png", "ToggleLightInspector");
- gtk_toolbar_append_space( GTK_TOOLBAR( toolbar ) );
- GtkButton* g_refresh_models_button = toolbar_append_button( toolbar, "Refresh Models", "refresh_models.png", "RefreshReferences" );
+ space();
+ /*auto g_refresh_models_button =*/ toolbar_append_button( toolbar, "Refresh Models", "refresh_models.png", "RefreshReferences" );
// disable the console and texture button in the regular layouts
return toolbar;
}
-GtkWidget* create_main_statusbar( GtkWidget *pStatusLabel[c_count_status] ){
- GtkTable* table = GTK_TABLE( gtk_table_new( 1, c_count_status, FALSE ) );
+ui::Widget create_main_statusbar( ui::Widget pStatusLabel[c_count_status] ){
+ GtkTable* table = ui::Table( 1, c_count_status, FALSE );
gtk_widget_show( GTK_WIDGET( table ) );
{
- GtkLabel* label = GTK_LABEL( gtk_label_new( "Label" ) );
+ GtkLabel* label = GTK_LABEL( ui::Label( "Label" ) );
gtk_misc_set_alignment( GTK_MISC( label ), 0, 0.5 );
gtk_misc_set_padding( GTK_MISC( label ), 4, 2 );
gtk_widget_show( GTK_WIDGET( label ) );
gtk_table_attach_defaults( table, GTK_WIDGET( label ), 0, 1, 0, 1 );
- pStatusLabel[c_command_status] = GTK_WIDGET( label );
+ pStatusLabel[c_command_status] = ui::Widget(GTK_WIDGET( label ));
}
for ( int i = 1; i < c_count_status; ++i )
{
- GtkFrame* frame = GTK_FRAME( gtk_frame_new( 0 ) );
+ GtkFrame* frame = ui::Frame();
gtk_widget_show( GTK_WIDGET( frame ) );
gtk_table_attach_defaults( table, GTK_WIDGET( frame ), i, i + 1, 0, 1 );
gtk_frame_set_shadow_type( frame, GTK_SHADOW_IN );
- GtkLabel* label = GTK_LABEL( gtk_label_new( "Label" ) );
+ GtkLabel* label = GTK_LABEL( ui::Label( "Label" ) );
gtk_label_set_ellipsize( label, PANGO_ELLIPSIZE_END );
gtk_misc_set_alignment( GTK_MISC( label ), 0, 0.5 );
gtk_misc_set_padding( GTK_MISC( label ), 4, 2 );
gtk_widget_show( GTK_WIDGET( label ) );
gtk_container_add( GTK_CONTAINER( frame ), GTK_WIDGET( label ) );
- pStatusLabel[i] = GTK_WIDGET( label );
+ pStatusLabel[i] = ui::Widget(GTK_WIDGET( label ));
}
- return GTK_WIDGET( table );
+ return ui::Widget(GTK_WIDGET( table ));
}
#if 0
{
const char* m_name;
-static gboolean frame_event( GtkWidget *widget, GdkEvent* event, WindowFocusPrinter* self ){
+static gboolean frame_event( ui::Widget widget, GdkEvent* event, WindowFocusPrinter* self ){
globalOutputStream() << self->m_name << " frame_event\n";
return FALSE;
}
-static gboolean keys_changed( GtkWidget *widget, WindowFocusPrinter* self ){
+static gboolean keys_changed( ui::Widget widget, WindowFocusPrinter* self ){
globalOutputStream() << self->m_name << " keys_changed\n";
return FALSE;
}
-static gboolean notify( GtkWindow* window, gpointer dummy, WindowFocusPrinter* self ){
+static gboolean notify( ui::Window window, gpointer dummy, WindowFocusPrinter* self ){
if ( gtk_window_is_active( window ) ) {
globalOutputStream() << self->m_name << " takes toplevel focus\n";
}
public:
WindowFocusPrinter( const char* name ) : m_name( name ){
}
-void connect( GtkWindow* toplevel_window ){
+void connect( ui::Window toplevel_window ){
g_signal_connect( G_OBJECT( toplevel_window ), "notify::has_toplevel_focus", G_CALLBACK( notify ), this );
g_signal_connect( G_OBJECT( toplevel_window ), "notify::is_active", G_CALLBACK( notify ), this );
g_signal_connect( G_OBJECT( toplevel_window ), "keys_changed", G_CALLBACK( keys_changed ), this );
class MainWindowActive
{
-static gboolean notify( GtkWindow* window, gpointer dummy, MainWindowActive* self ){
- if ( g_wait.m_window != 0 && gtk_window_is_active( window ) && !GTK_WIDGET_VISIBLE( g_wait.m_window ) ) {
+static gboolean notify( ui::Window window, gpointer dummy, MainWindowActive* self ){
+ if ( g_wait.m_window && gtk_window_is_active( window ) && !gtk_widget_get_visible( g_wait.m_window ) ) {
gtk_widget_show( GTK_WIDGET( g_wait.m_window ) );
}
return FALSE;
}
public:
-void connect( GtkWindow* toplevel_window ){
+void connect( ui::Window toplevel_window ){
g_signal_connect( G_OBJECT( toplevel_window ), "notify::is-active", G_CALLBACK( notify ), this );
}
};
MainFrame* g_pParentWnd = 0;
-GtkWindow* MainFrame_getWindow(){
- if ( g_pParentWnd == 0 ) {
- return 0;
- }
- return g_pParentWnd->m_window;
+ui::Window MainFrame_getWindow()
+{
+ return g_pParentWnd ? g_pParentWnd->m_window : ui::Window();
}
-std::vector<GtkWidget*> g_floating_windows;
+std::vector<ui::Widget> g_floating_windows;
MainFrame::MainFrame() : m_window( 0 ), m_idleRedrawStatusText( RedrawStatusTextCaller( *this ) ){
m_pXYWnd = 0;
for ( int n = 0; n < c_count_status; n++ )
{
- m_pStatusLabel[n] = 0;
+ m_pStatusLabel[n] = ui::root;
}
m_bSleeping = false;
Shutdown();
- for ( std::vector<GtkWidget*>::iterator i = g_floating_windows.begin(); i != g_floating_windows.end(); ++i )
+ for ( std::vector<ui::Widget>::iterator i = g_floating_windows.begin(); i != g_floating_windows.end(); ++i )
{
gtk_widget_destroy( *i );
}
}
-GtkWindow* create_splash(){
- GtkWindow* window = GTK_WINDOW( gtk_window_new( GTK_WINDOW_TOPLEVEL ) );
+ui::Window create_splash(){
+ ui::Window window = ui::Window( ui::window_type::TOP );
gtk_window_set_decorated( window, FALSE );
gtk_window_set_resizable( window, FALSE );
gtk_window_set_modal( window, TRUE );
return window;
}
-static GtkWindow *splash_screen = 0;
+static ui::Window splash_screen;
void show_splash(){
splash_screen = create_splash();
WindowPositionTracker g_posXZWnd;
WindowPositionTracker g_posYZWnd;
-static gint mainframe_delete( GtkWidget *widget, GdkEvent *event, gpointer data ){
+static gint mainframe_delete( ui::Widget widget, GdkEvent *event, gpointer data ){
if ( ConfirmModified( "Exit Radiant" ) ) {
gtk_main_quit();
}
}
void MainFrame::Create(){
- GtkWindow* window = GTK_WINDOW( gtk_window_new( GTK_WINDOW_TOPLEVEL ) );
+ ui::Window window = ui::Window( ui::window_type::TOP );
GlobalWindowObservers_connectTopLevel( window );
GdkPixbuf* pixbuf = pixbuf_new_from_file_with_mask( "bitmaps/icon.png" );
if ( pixbuf != 0 ) {
gtk_window_set_icon( window, pixbuf );
- gdk_pixbuf_unref( pixbuf );
+ g_object_unref( pixbuf );
}
}
#endif
g_MainWindowActive.connect( window );
- GetPlugInMgr().Init( GTK_WIDGET( window ) );
+ GetPlugInMgr().Init( window );
- GtkWidget* vbox = gtk_vbox_new( FALSE, 0 );
+ ui::Widget vbox = ui::VBox( FALSE, 0 );
gtk_container_add( GTK_CONTAINER( window ), vbox );
gtk_widget_show( vbox );
}
gtk_box_pack_start( GTK_BOX( vbox ), GTK_WIDGET( plugin_toolbar ), FALSE, FALSE, 0 );
- GtkWidget* main_statusbar = create_main_statusbar( m_pStatusLabel );
+ ui::Widget main_statusbar = create_main_statusbar( m_pStatusLabel );
gtk_box_pack_end( GTK_BOX( vbox ), main_statusbar, FALSE, TRUE, 2 );
GroupDialog_constructWindow( window );
if ( CurrentStyle() == eRegular || CurrentStyle() == eRegularLeft ) {
{
- GtkWidget* vsplit = gtk_vpaned_new();
+ ui::Widget vsplit = ui::VPaned();
m_vSplit = vsplit;
gtk_box_pack_start( GTK_BOX( vbox ), vsplit, TRUE, TRUE, 0 );
gtk_widget_show( vsplit );
// console
- GtkWidget* console_window = Console_constructWindow( window );
+ ui::Widget console_window = Console_constructWindow( window );
gtk_paned_pack2( GTK_PANED( vsplit ), console_window, FALSE, TRUE );
{
- GtkWidget* hsplit = gtk_hpaned_new();
+ ui::Widget hsplit = ui::HPaned();
gtk_widget_show( hsplit );
m_hSplit = hsplit;
gtk_paned_add1( GTK_PANED( vsplit ), hsplit );
// xy
m_pXYWnd = new XYWnd();
m_pXYWnd->SetViewType( XY );
- GtkWidget* xy_window = GTK_WIDGET( create_framed_widget( m_pXYWnd->GetWidget() ) );
+ ui::Widget xy_window = ui::Widget(GTK_WIDGET( create_framed_widget( m_pXYWnd->GetWidget() ) ));
{
- GtkWidget* vsplit2 = gtk_vpaned_new();
+ ui::Widget vsplit2 = ui::VPaned();
gtk_widget_show( vsplit2 );
m_vSplit2 = vsplit2;
}
else if ( CurrentStyle() == eFloating ) {
{
- GtkWindow* window = create_persistent_floating_window( "Camera", m_window );
+ ui::Window window = ui::Window(create_persistent_floating_window( "Camera", m_window ));
global_accel_connect_window( window );
g_posCamWnd.connect( window );
}
CamWnd_setParent( *m_pCamWnd, window );
- g_floating_windows.push_back( GTK_WIDGET( window ) );
+ g_floating_windows.push_back( window );
}
{
- GtkWindow* window = create_persistent_floating_window( ViewType_getTitle( XY ), m_window );
+ ui::Window window = ui::Window(create_persistent_floating_window( ViewType_getTitle( XY ), m_window ));
global_accel_connect_window( window );
g_posXYWnd.connect( window );
}
XY_Top_Shown_Construct( window );
- g_floating_windows.push_back( GTK_WIDGET( window ) );
+ g_floating_windows.push_back( window );
}
{
- GtkWindow* window = create_persistent_floating_window( ViewType_getTitle( XZ ), m_window );
+ ui::Window window = ui::Window(create_persistent_floating_window( ViewType_getTitle( XZ ), m_window ));
global_accel_connect_window( window );
g_posXZWnd.connect( window );
XZ_Front_Shown_Construct( window );
- g_floating_windows.push_back( GTK_WIDGET( window ) );
+ g_floating_windows.push_back( window );
}
{
- GtkWindow* window = create_persistent_floating_window( ViewType_getTitle( YZ ), m_window );
+ ui::Window window = ui::Window(create_persistent_floating_window( ViewType_getTitle( YZ ), m_window ));
global_accel_connect_window( window );
g_posYZWnd.connect( window );
YZ_Side_Shown_Construct( window );
- g_floating_windows.push_back( GTK_WIDGET( window ) );
+ g_floating_windows.push_back( window );
}
{
GtkFrame* frame = create_framed_widget( TextureBrowser_constructWindow( GroupDialog_getWindow() ) );
- g_page_textures = GroupDialog_addPage( "Textures", GTK_WIDGET( frame ), TextureBrowserExportTitleCaller() );
+ g_page_textures = GroupDialog_addPage( "Textures", ui::Widget(GTK_WIDGET( frame )), TextureBrowserExportTitleCaller() );
}
GroupDialog_show();
GlobalCamera_setCamWnd( *m_pCamWnd );
CamWnd_setParent( *m_pCamWnd, window );
- GtkWidget* camera = CamWnd_getWidget( *m_pCamWnd );
+ ui::Widget camera = CamWnd_getWidget( *m_pCamWnd );
m_pYZWnd = new XYWnd();
m_pYZWnd->SetViewType( YZ );
- GtkWidget* yz = m_pYZWnd->GetWidget();
+ ui::Widget yz = m_pYZWnd->GetWidget();
m_pXYWnd = new XYWnd();
m_pXYWnd->SetViewType( XY );
- GtkWidget* xy = m_pXYWnd->GetWidget();
+ ui::Widget xy = m_pXYWnd->GetWidget();
m_pXZWnd = new XYWnd();
m_pXZWnd->SetViewType( XZ );
- GtkWidget* xz = m_pXZWnd->GetWidget();
+ ui::Widget xz = m_pXZWnd->GetWidget();
GtkHPaned* split = create_split_views( camera, yz, xy, xz );
gtk_box_pack_start( GTK_BOX( vbox ), GTK_WIDGET( split ), TRUE, TRUE, 0 );
{
GtkFrame* frame = create_framed_widget( TextureBrowser_constructWindow( window ) );
- g_page_textures = GroupDialog_addPage( "Textures", GTK_WIDGET( frame ), TextureBrowserExportTitleCaller() );
+ g_page_textures = GroupDialog_addPage( "Textures", ui::Widget(GTK_WIDGET( frame )), TextureBrowserExportTitleCaller() );
}
}
g_layout_globals.m_position = m_position_tracker.getPosition();
- g_layout_globals.nState = gdk_window_get_state( GTK_WIDGET( m_window )->window );
+ g_layout_globals.nState = gdk_window_get_state( gtk_widget_get_window(GTK_WIDGET( m_window )) );
}
void MainFrame::Shutdown(){
#if !defined( INCLUDED_MAINFRAME_H )
#define INCLUDED_MAINFRAME_H
+#include <uilib/uilib.h>
#include "gtkutil/window.h"
#include "gtkutil/idledraw.h"
#include "gtkutil/widget.h"
MainFrame();
~MainFrame();
-GtkWindow* m_window;
+ui::Window m_window;
CopiedString m_command_status;
CopiedString m_position_status;
void SaveWindowInfo();
void Shutdown();
-GtkWidget* m_vSplit;
-GtkWidget* m_hSplit;
-GtkWidget* m_vSplit2;
+ui::Widget m_vSplit;
+ui::Widget m_hSplit;
+ui::Widget m_vSplit2;
XYWnd* m_pXYWnd;
XYWnd* m_pYZWnd;
bool m_bSleeping;
-GtkWidget *m_pStatusLabel[c_count_status];
+ui::Widget m_pStatusLabel[c_count_status];
EViewStyle m_nCurrentStyle;
extern MainFrame* g_pParentWnd;
-GtkWindow* MainFrame_getWindow();
+ui::Window MainFrame_getWindow();
enum EMouseButtonMode
{
MouseEventHandlerId XYWindowMouseDown_connect( const MouseEventHandler& handler );
void XYWindowMouseDown_disconnect( MouseEventHandlerId id );
-extern GtkWidget* g_page_entity;
+extern ui::Widget g_page_entity;
#endif
#include <set>
-#include <gtk/gtkmain.h>
-#include <gtk/gtkbox.h>
-#include <gtk/gtkentry.h>
-#include <gtk/gtklabel.h>
-#include <gtk/gtktable.h>
-#include <gtk/gtktreemodel.h>
-#include <gtk/gtktreeview.h>
-#include <gtk/gtkliststore.h>
-#include <gtk/gtkcellrenderertext.h>
+#include <gtk/gtk.h>
+#include <gdk/gdkkeysyms.h>
+#include "uilib/uilib.h"
#include "scenelib.h"
#include "transformlib.h"
GtkEntry* entities_entry;
GtkListStore* EntityBreakdownWalker;
- GtkWindow* window = create_dialog_window( MainFrame_getWindow(), "Map Info", G_CALLBACK( dialog_delete_callback ), &dialog );
+ ui::Window window = MainFrame_getWindow().create_dialog_window("Map Info", G_CALLBACK(dialog_delete_callback ), &dialog );
window_set_position( window, g_posMapInfoWnd );
gtk_box_pack_start( GTK_BOX( hbox ), GTK_WIDGET( table ), TRUE, TRUE, 0 );
{
- GtkEntry* entry = GTK_ENTRY( gtk_entry_new() );
+ GtkEntry* entry = ui::Entry();
gtk_widget_show( GTK_WIDGET( entry ) );
gtk_table_attach( table, GTK_WIDGET( entry ), 1, 2, 0, 1,
(GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ),
(GtkAttachOptions) ( 0 ), 0, 0 );
- gtk_entry_set_editable( entry, FALSE );
+ gtk_editable_set_editable( GTK_EDITABLE(entry), FALSE );
brushes_entry = entry;
}
{
- GtkEntry* entry = GTK_ENTRY( gtk_entry_new() );
+ GtkEntry* entry = ui::Entry();
gtk_widget_show( GTK_WIDGET( entry ) );
gtk_table_attach( table, GTK_WIDGET( entry ), 1, 2, 1, 2,
(GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ),
(GtkAttachOptions) ( 0 ), 0, 0 );
- gtk_entry_set_editable( entry, FALSE );
+ gtk_editable_set_editable( GTK_EDITABLE(entry), FALSE );
entities_entry = entry;
}
{
- GtkWidget* label = gtk_label_new( "Total Brushes" );
+ ui::Widget label = ui::Label( "Total Brushes" );
gtk_widget_show( label );
gtk_table_attach( GTK_TABLE( table ), label, 0, 1, 0, 1,
(GtkAttachOptions) ( GTK_FILL ),
gtk_misc_set_alignment( GTK_MISC( label ), 0, 0.5 );
}
{
- GtkWidget* label = gtk_label_new( "Total Entities" );
+ ui::Widget label = ui::Label( "Total Entities" );
gtk_widget_show( label );
gtk_table_attach( GTK_TABLE( table ), label, 0, 1, 1, 2,
(GtkAttachOptions) ( GTK_FILL ),
}
}
{
- GtkWidget* label = gtk_label_new( "Entity breakdown" );
+ ui::Widget label = ui::Label( "Entity breakdown" );
gtk_widget_show( label );
gtk_box_pack_start( GTK_BOX( vbox ), GTK_WIDGET( label ), FALSE, TRUE, 0 );
gtk_misc_set_alignment( GTK_MISC( label ), 0, 0.5 );
{
GtkListStore* store = gtk_list_store_new( 2, G_TYPE_STRING, G_TYPE_STRING );
- GtkWidget* view = gtk_tree_view_new_with_model( GTK_TREE_MODEL( store ) );
+ ui::Widget view = ui::TreeView(ui::TreeModel( GTK_TREE_MODEL( store ) ));
gtk_tree_view_set_headers_clickable( GTK_TREE_VIEW( view ), TRUE );
{
- GtkCellRenderer* renderer = gtk_cell_renderer_text_new();
- GtkTreeViewColumn* column = gtk_tree_view_column_new_with_attributes( "Entity", renderer, "text", 0, 0 );
+ auto renderer = ui::CellRendererText();
+ GtkTreeViewColumn* column = ui::TreeViewColumn( "Entity", renderer, {{"text", 0}} );
gtk_tree_view_append_column( GTK_TREE_VIEW( view ), column );
gtk_tree_view_column_set_sort_column_id( column, 0 );
}
{
- GtkCellRenderer* renderer = gtk_cell_renderer_text_new();
- GtkTreeViewColumn* column = gtk_tree_view_column_new_with_attributes( "Count", renderer, "text", 1, 0 );
+ auto renderer = ui::CellRendererText();
+ GtkTreeViewColumn* column = ui::TreeViewColumn( "Count", renderer, {{"text", 1}} );
gtk_tree_view_append_column( GTK_TREE_VIEW( view ), column );
gtk_tree_view_column_set_sort_column_id( column, 1 );
}
}
const char* map_open( const char* title ){
- return file_dialog( GTK_WIDGET( MainFrame_getWindow() ), TRUE, title, getLastFolderPath(), MapFormat::Name(), false, true, false );
+ return MainFrame_getWindow().file_dialog( TRUE, title, getLastFolderPath(), MapFormat::Name(), true, false, false );
}
const char* map_import( const char* title ){
- return file_dialog( GTK_WIDGET( MainFrame_getWindow() ), TRUE, title, getLastFolderPath(), MapFormat::Name(), false, true, false );
+ return MainFrame_getWindow().file_dialog( TRUE, title, getLastFolderPath(), MapFormat::Name(), false, true, false );
}
const char* map_save( const char* title ){
- return file_dialog( GTK_WIDGET( MainFrame_getWindow() ), FALSE, title, getLastFolderPath(), MapFormat::Name(), false, false, true );
+ return MainFrame_getWindow().file_dialog( FALSE, title, getLastFolderPath(), MapFormat::Name(), false, false, true );
}
void OpenMap(){
GtkEntry* entity;
GtkEntry* brush;
- GtkWindow* window = create_dialog_window( MainFrame_getWindow(), "Find Brush", G_CALLBACK( dialog_delete_callback ), &dialog );
+ ui::Window window = MainFrame_getWindow().create_dialog_window("Find Brush", G_CALLBACK(dialog_delete_callback ), &dialog );
- GtkAccelGroup* accel = gtk_accel_group_new();
+ GtkAccelGroup* accel = ui::AccelGroup();
gtk_window_add_accel_group( window, accel );
{
GtkTable* table = create_dialog_table( 2, 2, 4, 4 );
gtk_box_pack_start( GTK_BOX( vbox ), GTK_WIDGET( table ), TRUE, TRUE, 0 );
{
- GtkWidget* label = gtk_label_new( "Entity number" );
+ ui::Widget label = ui::Label( "Entity number" );
gtk_widget_show( label );
gtk_table_attach( GTK_TABLE( table ), label, 0, 1, 0, 1,
(GtkAttachOptions) ( 0 ),
(GtkAttachOptions) ( 0 ), 0, 0 );
}
{
- GtkWidget* label = gtk_label_new( "Brush number" );
+ ui::Widget label = ui::Label( "Brush number" );
gtk_widget_show( label );
gtk_table_attach( GTK_TABLE( table ), label, 0, 1, 1, 2,
(GtkAttachOptions) ( 0 ),
(GtkAttachOptions) ( 0 ), 0, 0 );
}
{
- GtkEntry* entry = GTK_ENTRY( gtk_entry_new() );
+ GtkEntry* entry = ui::Entry();
gtk_widget_show( GTK_WIDGET( entry ) );
gtk_table_attach( table, GTK_WIDGET( entry ), 1, 2, 0, 1,
(GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ),
entity = entry;
}
{
- GtkEntry* entry = GTK_ENTRY( gtk_entry_new() );
+ GtkEntry* entry = ui::Entry();
gtk_widget_show( GTK_WIDGET( entry ) );
gtk_table_attach( table, GTK_WIDGET( entry ), 1, 2, 1, 2,
(GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ),
GtkButton* button = create_dialog_button( "Find", G_CALLBACK( dialog_button_ok ), &dialog );
gtk_box_pack_start( GTK_BOX( hbox ), 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 );
+ gtk_widget_add_accelerator( GTK_WIDGET( button ), "clicked", accel, GDK_KEY_Return, (GdkModifierType)0, (GtkAccelFlags)0 );
}
{
GtkButton* button = create_dialog_button( "Close", G_CALLBACK( dialog_button_cancel ), &dialog );
gtk_box_pack_start( GTK_BOX( hbox ), 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 );
}
}
}
#include <string.h>
#include <stdio.h>
-#include <gtk/gtklabel.h>
+#include <gtk/gtk.h>
#include "os/file.h"
#include "generic/callback.h"
MRU_SetText( i, MRU_GetText( i + 1 ) );
if ( MRU_used == 0 ) {
- gtk_label_set_text( GTK_LABEL( GTK_BIN( MRU_items[0] )->child ), "Recent Files" );
+ gtk_label_set_text( GTK_LABEL( gtk_bin_get_child(GTK_BIN( MRU_items[0] )) ), "Recent Files" );
gtk_widget_set_sensitive( GTK_WIDGET( MRU_items[0] ), FALSE );
}
else
LatchedBool g_Multimon_enableSysMenuPopups( false, "Floating windows sysmenu icons" );
void MultiMonitor_constructPreferences( PreferencesPage& page ){
- GtkWidget* primary_monitor = page.appendCheckBox( "Multi Monitor", "Start on Primary Monitor", g_multimon_globals.m_bStartOnPrimMon );
- GtkWidget* popup = page.appendCheckBox(
+ ui::CheckButton primary_monitor = page.appendCheckBox( "Multi Monitor", "Start on Primary Monitor", g_multimon_globals.m_bStartOnPrimMon );
+ ui::CheckButton popup = page.appendCheckBox(
"", "Disable system menu on popup windows",
LatchedBoolImportCaller( g_Multimon_enableSysMenuPopups ),
BoolExportCaller( g_Multimon_enableSysMenuPopups.m_latched )
#include "preferencesystem.h"
#include "stringio.h"
-#include <gdk/gdkdisplay.h>
+#include <gdk/gdk.h>
namespace
{
#include "debugging/debugging.h"
-#include <gtk/gtkvbox.h>
-#include <gtk/gtkhbox.h>
-#include <gtk/gtkframe.h>
-#include <gtk/gtklabel.h>
-#include <gtk/gtktable.h>
-#include <gtk/gtkcombobox.h>
-#include <gtk/gtkbutton.h>
-#include <gtk/gtkspinbutton.h>
-#include <gtk/gtkcheckbutton.h>
+#include <gtk/gtk.h>
#include "gtkutil/idledraw.h"
#include "gtkutil/entry.h"
class PatchInspector : public Dialog
{
-GtkWindow* BuildDialog();
+ui::Window BuildDialog();
Subdivisions m_subdivisions;
NonModalEntry m_horizontalSubdivisionsEntry;
NonModalEntry m_verticalSubdivisionsEntry;
float m_fVShift; */
int m_nCol;
int m_nRow;
-GtkComboBox *m_pRowCombo;
-GtkComboBox *m_pColCombo;
+ui::ComboBoxText m_pRowCombo{nullptr};
+ui::ComboBoxText m_pColCombo{nullptr};
std::size_t m_countRows;
std::size_t m_countCols;
}
bool visible(){
- return GTK_WIDGET_VISIBLE( GetWidget() );
+ return gtk_widget_get_visible( GetWidget() );
}
// void UpdateInfo();
PatchInspector g_PatchInspector;
-void PatchInspector_constructWindow( GtkWindow* main_window ){
+void PatchInspector_constructWindow( ui::Window main_window ){
g_PatchInspector.m_parent = main_window;
g_PatchInspector.Create();
}
// static functions
// memorize the current state (that is don't try to undo our do before changing something else)
-static void OnApply( GtkWidget *widget, gpointer data ){
+static void OnApply( ui::Widget widget, gpointer data ){
g_PatchInspector.exportData();
if ( g_PatchInspector.m_Patch != 0 ) {
UndoableCommand command( "patchSetTexture" );
}
}
-static void OnSelchangeComboColRow( GtkWidget *widget, gpointer data ){
+static void OnSelchangeComboColRow( ui::Widget widget, gpointer data ){
if ( !g_PatchInspector.m_bListenChanged ) {
return;
}
SceneChangeNotify();
}
-static void OnBtnPatchdetails( GtkWidget *widget, gpointer data ){
+static void OnBtnPatchdetails( ui::Widget widget, gpointer data ){
Patch_CapTexture();
}
-static void OnBtnPatchfit( GtkWidget *widget, gpointer data ){
+static void OnBtnPatchfit( ui::Widget widget, gpointer data ){
Patch_FitTexture();
}
-static void OnBtnPatchnatural( GtkWidget *widget, gpointer data ){
+static void OnBtnPatchnatural( ui::Widget widget, gpointer data ){
Patch_NaturalTexture();
}
-static void OnBtnPatchreset( GtkWidget *widget, gpointer data ){
+static void OnBtnPatchreset( ui::Widget widget, gpointer data ){
Patch_ResetTexture();
}
-static void OnBtnPatchFlipX( GtkWidget *widget, gpointer data ){
+static void OnBtnPatchFlipX( ui::Widget widget, gpointer data ){
Patch_FlipTextureX();
}
-static void OnBtnPatchFlipY( GtkWidget *widget, gpointer data ){
+static void OnBtnPatchFlipY( ui::Widget widget, gpointer data ){
Patch_FlipTextureY();
}
Scene_forEachVisibleSelectedPatch( PatchTranslateTexture( s, t ) );
}
-static void OnBtnPatchAutoCap( GtkWidget *widget, gpointer data ){
+static void OnBtnPatchAutoCap( ui::Widget widget, gpointer data ){
Patch_AutoCapTexture();
}
td.scale[0] = td.scale[1] = 0;
td.shift[0] = td.shift[1] = 0;
- if ( adj->value == 0 ) {
+ if ( gtk_adjustment_get_value(adj) == 0 ) {
return;
}
if ( adj == g_object_get_data( G_OBJECT( g_PatchInspector.GetWidget() ), "hshift_adj" ) ) {
g_pi_globals.shift[0] = static_cast<float>( atof( gtk_entry_get_text( GTK_ENTRY( data ) ) ) );
- if ( adj->value > 0 ) {
+ if ( gtk_adjustment_get_value(adj) > 0 ) {
td.shift[0] = g_pi_globals.shift[0];
}
else{
else if ( adj == g_object_get_data( G_OBJECT( g_PatchInspector.GetWidget() ), "vshift_adj" ) ) {
g_pi_globals.shift[1] = static_cast<float>( atof( gtk_entry_get_text( GTK_ENTRY( data ) ) ) );
- if ( adj->value > 0 ) {
+ if ( gtk_adjustment_get_value(adj) > 0 ) {
td.shift[1] = g_pi_globals.shift[1];
}
else{
if ( g_pi_globals.scale[0] == 0.0f ) {
return;
}
- if ( adj->value > 0 ) {
+ if ( gtk_adjustment_get_value(adj) > 0 ) {
td.scale[0] = g_pi_globals.scale[0];
}
else{
if ( g_pi_globals.scale[1] == 0.0f ) {
return;
}
- if ( adj->value > 0 ) {
+ if ( gtk_adjustment_get_value(adj) > 0 ) {
td.scale[1] = g_pi_globals.scale[1];
}
else{
else if ( adj == g_object_get_data( G_OBJECT( g_PatchInspector.GetWidget() ), "rotate_adj" ) ) {
g_pi_globals.rotate = static_cast<float>( atof( gtk_entry_get_text( GTK_ENTRY( data ) ) ) );
- if ( adj->value > 0 ) {
+ if ( gtk_adjustment_get_value(adj) > 0 ) {
td.rotate = g_pi_globals.rotate;
}
else{
}
}
- adj->value = 0;
+ gtk_adjustment_set_value(adj, 0);
// will scale shift rotate the patch accordingly
}
// update the point-by-point view
- OnSelchangeComboColRow( 0,0 );
+ OnSelchangeComboColRow( ui::root ,0 );
}
-static gint OnDialogKey( GtkWidget* widget, GdkEventKey* event, gpointer data ){
+static gint OnDialogKey( ui::Widget widget, GdkEventKey* event, gpointer data ){
if ( event->keyval == GDK_Return ) {
- OnApply( 0, 0 );
+ OnApply( ui::root, 0 );
return TRUE;
}
else if ( event->keyval == GDK_Escape ) {
// =============================================================================
// PatchInspector class
-GtkWindow* PatchInspector::BuildDialog(){
- GtkWindow* window = create_floating_window( "Patch Properties", m_parent );
+ui::Window PatchInspector::BuildDialog(){
+ ui::Window window = ui::Window(create_floating_window( "Patch Properties", m_parent ));
m_position_tracker.connect( window );
{
- GtkVBox* vbox = GTK_VBOX( gtk_vbox_new( FALSE, 5 ) );
+ GtkVBox* vbox = ui::VBox( FALSE, 5 );
gtk_container_set_border_width( GTK_CONTAINER( vbox ), 5 );
gtk_widget_show( GTK_WIDGET( vbox ) );
gtk_container_add( GTK_CONTAINER( window ), GTK_WIDGET( vbox ) );
{
- GtkHBox* hbox = GTK_HBOX( gtk_hbox_new( FALSE, 5 ) );
+ GtkHBox* hbox = ui::HBox( FALSE, 5 );
gtk_widget_show( GTK_WIDGET( hbox ) );
gtk_box_pack_start( GTK_BOX( vbox ), GTK_WIDGET( hbox ), TRUE, TRUE, 0 );
{
- GtkVBox* vbox2 = GTK_VBOX( gtk_vbox_new( FALSE, 0 ) );
+ GtkVBox* vbox2 = ui::VBox( FALSE, 0 );
gtk_container_set_border_width( GTK_CONTAINER( vbox2 ), 0 );
gtk_widget_show( GTK_WIDGET( vbox2 ) );
gtk_box_pack_start( GTK_BOX( hbox ), GTK_WIDGET( vbox2 ), TRUE, TRUE, 0 );
{
- GtkFrame* frame = GTK_FRAME( gtk_frame_new( "Details" ) );
+ GtkFrame* frame = ui::Frame( "Details" );
gtk_widget_show( GTK_WIDGET( frame ) );
gtk_box_pack_start( GTK_BOX( vbox2 ), GTK_WIDGET( frame ), TRUE, TRUE, 0 );
{
- GtkVBox* vbox3 = GTK_VBOX( gtk_vbox_new( FALSE, 5 ) );
+ GtkVBox* vbox3 = ui::VBox( FALSE, 5 );
gtk_container_set_border_width( GTK_CONTAINER( vbox3 ), 5 );
gtk_widget_show( GTK_WIDGET( vbox3 ) );
gtk_container_add( GTK_CONTAINER( frame ), GTK_WIDGET( vbox3 ) );
{
- GtkTable* table = GTK_TABLE( gtk_table_new( 2, 2, FALSE ) );
+ GtkTable* table = ui::Table( 2, 2, FALSE );
gtk_widget_show( GTK_WIDGET( table ) );
gtk_box_pack_start( GTK_BOX( vbox3 ), GTK_WIDGET( table ), TRUE, TRUE, 0 );
gtk_table_set_row_spacings( table, 5 );
gtk_table_set_col_spacings( table, 5 );
{
- GtkLabel* label = GTK_LABEL( gtk_label_new( "Row:" ) );
+ GtkLabel* label = GTK_LABEL( ui::Label( "Row:" ) );
gtk_widget_show( GTK_WIDGET( label ) );
gtk_table_attach( table, GTK_WIDGET( label ), 0, 1, 0, 1,
(GtkAttachOptions)( GTK_EXPAND | GTK_FILL ),
(GtkAttachOptions)( 0 ), 0, 0 );
}
{
- GtkLabel* label = GTK_LABEL( gtk_label_new( "Column:" ) );
+ GtkLabel* label = GTK_LABEL( ui::Label( "Column:" ) );
gtk_widget_show( GTK_WIDGET( label ) );
gtk_table_attach( table, GTK_WIDGET( label ), 1, 2, 0, 1,
(GtkAttachOptions)( GTK_EXPAND | GTK_FILL ),
(GtkAttachOptions)( 0 ), 0, 0 );
}
{
- GtkComboBox* combo = GTK_COMBO_BOX( gtk_combo_box_new_text() );
+ auto combo = ui::ComboBoxText();
g_signal_connect( G_OBJECT( combo ), "changed", G_CALLBACK( OnSelchangeComboColRow ), this );
- AddDialogData( *combo, m_nRow );
+ AddDialogData( *GTK_COMBO_BOX(combo), m_nRow );
gtk_widget_show( GTK_WIDGET( combo ) );
gtk_table_attach( table, GTK_WIDGET( combo ), 0, 1, 1, 2,
(GtkAttachOptions)( GTK_EXPAND | GTK_FILL ),
(GtkAttachOptions)( 0 ), 0, 0 );
- gtk_widget_set_usize( GTK_WIDGET( combo ), 60, -1 );
+ gtk_widget_set_size_request( GTK_WIDGET( combo ), 60, -1 );
m_pRowCombo = combo;
}
{
- GtkComboBox* combo = GTK_COMBO_BOX( gtk_combo_box_new_text() );
+ auto combo = ui::ComboBoxText();
g_signal_connect( G_OBJECT( combo ), "changed", G_CALLBACK( OnSelchangeComboColRow ), this );
- AddDialogData( *combo, m_nCol );
+ AddDialogData( *GTK_COMBO_BOX(combo), m_nCol );
gtk_widget_show( GTK_WIDGET( combo ) );
gtk_table_attach( table, GTK_WIDGET( combo ), 1, 2, 1, 2,
(GtkAttachOptions)( GTK_EXPAND | GTK_FILL ),
(GtkAttachOptions)( 0 ), 0, 0 );
- gtk_widget_set_usize( GTK_WIDGET( combo ), 60, -1 );
+ gtk_widget_set_size_request( GTK_WIDGET( combo ), 60, -1 );
m_pColCombo = combo;
}
}
- GtkTable* table = GTK_TABLE( gtk_table_new( 5, 2, FALSE ) );
+ GtkTable* table = ui::Table( 5, 2, FALSE );
gtk_widget_show( GTK_WIDGET( table ) );
gtk_box_pack_start( GTK_BOX( vbox3 ), GTK_WIDGET( table ), TRUE, TRUE, 0 );
gtk_table_set_row_spacings( table, 5 );
gtk_table_set_col_spacings( table, 5 );
{
- GtkLabel* label = GTK_LABEL( gtk_label_new( "X:" ) );
+ GtkLabel* label = GTK_LABEL( ui::Label( "X:" ) );
gtk_widget_show( GTK_WIDGET( label ) );
gtk_table_attach( table, GTK_WIDGET( label ), 0, 1, 0, 1,
(GtkAttachOptions)( GTK_EXPAND | GTK_FILL ),
(GtkAttachOptions)( 0 ), 0, 0 );
}
{
- GtkLabel* label = GTK_LABEL( gtk_label_new( "Y:" ) );
+ GtkLabel* label = GTK_LABEL( ui::Label( "Y:" ) );
gtk_widget_show( GTK_WIDGET( label ) );
gtk_table_attach( table, GTK_WIDGET( label ), 0, 1, 1, 2,
(GtkAttachOptions)( GTK_EXPAND | GTK_FILL ),
(GtkAttachOptions)( 0 ), 0, 0 );
}
{
- GtkLabel* label = GTK_LABEL( gtk_label_new( "Z:" ) );
+ GtkLabel* label = GTK_LABEL( ui::Label( "Z:" ) );
gtk_widget_show( GTK_WIDGET( label ) );
gtk_table_attach( table, GTK_WIDGET( label ), 0, 1, 2, 3,
(GtkAttachOptions)( GTK_EXPAND | GTK_FILL ),
(GtkAttachOptions)( 0 ), 0, 0 );
}
{
- GtkLabel* label = GTK_LABEL( gtk_label_new( "S:" ) );
+ GtkLabel* label = GTK_LABEL( ui::Label( "S:" ) );
gtk_widget_show( GTK_WIDGET( label ) );
gtk_table_attach( table, GTK_WIDGET( label ), 0, 1, 3, 4,
(GtkAttachOptions)( GTK_EXPAND | GTK_FILL ),
(GtkAttachOptions)( 0 ), 0, 0 );
}
{
- GtkLabel* label = GTK_LABEL( gtk_label_new( "T:" ) );
+ GtkLabel* label = GTK_LABEL( ui::Label( "T:" ) );
gtk_widget_show( GTK_WIDGET( label ) );
gtk_table_attach( table, GTK_WIDGET( label ), 0, 1, 4, 5,
(GtkAttachOptions)( GTK_EXPAND | GTK_FILL ),
(GtkAttachOptions)( 0 ), 0, 0 );
}
{
- GtkEntry* entry = GTK_ENTRY( gtk_entry_new() );
+ GtkEntry* entry = ui::Entry();
gtk_widget_show( GTK_WIDGET( entry ) );
gtk_table_attach( table, GTK_WIDGET( entry ), 1, 2, 0, 1,
(GtkAttachOptions)( GTK_EXPAND | GTK_FILL ),
g_signal_connect( G_OBJECT( entry ), "key_press_event", G_CALLBACK( OnDialogKey ), 0 );
}
{
- GtkEntry* entry = GTK_ENTRY( gtk_entry_new() );
+ GtkEntry* entry = ui::Entry();
gtk_widget_show( GTK_WIDGET( entry ) );
gtk_table_attach( table, GTK_WIDGET( entry ), 1, 2, 1, 2,
(GtkAttachOptions)( GTK_EXPAND | GTK_FILL ),
g_signal_connect( G_OBJECT( entry ), "key_press_event", G_CALLBACK( OnDialogKey ), 0 );
}
{
- GtkEntry* entry = GTK_ENTRY( gtk_entry_new() );
+ GtkEntry* entry = ui::Entry();
gtk_widget_show( GTK_WIDGET( entry ) );
gtk_table_attach( table, GTK_WIDGET( entry ), 1, 2, 2, 3,
(GtkAttachOptions)( GTK_EXPAND | GTK_FILL ),
g_signal_connect( G_OBJECT( entry ), "key_press_event", G_CALLBACK( OnDialogKey ), 0 );
}
{
- GtkEntry* entry = GTK_ENTRY( gtk_entry_new() );
+ GtkEntry* entry = ui::Entry();
gtk_widget_show( GTK_WIDGET( entry ) );
gtk_table_attach( table, GTK_WIDGET( entry ), 1, 2, 3, 4,
(GtkAttachOptions)( GTK_EXPAND | GTK_FILL ),
g_signal_connect( G_OBJECT( entry ), "key_press_event", G_CALLBACK( OnDialogKey ), 0 );
}
{
- GtkEntry* entry = GTK_ENTRY( gtk_entry_new() );
+ GtkEntry* entry = ui::Entry();
gtk_widget_show( GTK_WIDGET( entry ) );
gtk_table_attach( table, GTK_WIDGET( entry ), 1, 2, 4, 5,
(GtkAttachOptions)( GTK_EXPAND | GTK_FILL ),
}
}
if ( g_pGameDescription->mGameType == "doom3" ) {
- GtkFrame* frame = GTK_FRAME( gtk_frame_new( "Tesselation" ) );
+ GtkFrame* frame = ui::Frame( "Tesselation" );
gtk_widget_show( GTK_WIDGET( frame ) );
gtk_box_pack_start( GTK_BOX( vbox2 ), GTK_WIDGET( frame ), TRUE, TRUE, 0 );
{
- GtkVBox* vbox3 = GTK_VBOX( gtk_vbox_new( FALSE, 5 ) );
+ GtkVBox* vbox3 = ui::VBox( FALSE, 5 );
gtk_container_set_border_width( GTK_CONTAINER( vbox3 ), 5 );
gtk_widget_show( GTK_WIDGET( vbox3 ) );
gtk_container_add( GTK_CONTAINER( frame ), GTK_WIDGET( vbox3 ) );
{
- GtkTable* table = GTK_TABLE( gtk_table_new( 3, 2, FALSE ) );
+ GtkTable* table = ui::Table( 3, 2, FALSE );
gtk_widget_show( GTK_WIDGET( table ) );
gtk_box_pack_start( GTK_BOX( vbox3 ), GTK_WIDGET( table ), TRUE, TRUE, 0 );
gtk_table_set_row_spacings( table, 5 );
gtk_table_set_col_spacings( table, 5 );
{
- GtkLabel* label = GTK_LABEL( gtk_label_new( "Fixed" ) );
+ GtkLabel* label = GTK_LABEL( ui::Label( "Fixed" ) );
gtk_widget_show( GTK_WIDGET( label ) );
gtk_table_attach( table, GTK_WIDGET( label ), 0, 1, 0, 1,
(GtkAttachOptions)( GTK_EXPAND | GTK_FILL ),
g_object_set_data( G_OBJECT( check ), "handler", gint_to_pointer( handler_id ) );
}
{
- GtkLabel* label = GTK_LABEL( gtk_label_new( "Horizontal" ) );
+ GtkLabel* label = GTK_LABEL( ui::Label( "Horizontal" ) );
gtk_widget_show( GTK_WIDGET( label ) );
gtk_table_attach( table, GTK_WIDGET( label ), 0, 1, 1, 2,
(GtkAttachOptions)( GTK_EXPAND | GTK_FILL ),
(GtkAttachOptions)( 0 ), 0, 0 );
}
{
- GtkEntry* entry = GTK_ENTRY( gtk_entry_new() );
+ GtkEntry* entry = ui::Entry();
gtk_widget_show( GTK_WIDGET( entry ) );
gtk_table_attach( table, GTK_WIDGET( entry ), 1, 2, 1, 2,
(GtkAttachOptions)( GTK_EXPAND | GTK_FILL ),
m_horizontalSubdivisionsEntry.connect( entry );
}
{
- GtkLabel* label = GTK_LABEL( gtk_label_new( "Vertical" ) );
+ GtkLabel* label = GTK_LABEL( ui::Label( "Vertical" ) );
gtk_widget_show( GTK_WIDGET( label ) );
gtk_table_attach( table, GTK_WIDGET( label ), 0, 1, 2, 3,
(GtkAttachOptions)( GTK_EXPAND | GTK_FILL ),
(GtkAttachOptions)( 0 ), 0, 0 );
}
{
- GtkEntry* entry = GTK_ENTRY( gtk_entry_new() );
+ GtkEntry* entry = ui::Entry();
gtk_widget_show( GTK_WIDGET( entry ) );
gtk_table_attach( table, GTK_WIDGET( entry ), 1, 2, 2, 3,
(GtkAttachOptions)( GTK_EXPAND | GTK_FILL ),
}
}
{
- GtkFrame* frame = GTK_FRAME( gtk_frame_new( "Texturing" ) );
+ GtkFrame* frame = ui::Frame( "Texturing" );
gtk_widget_show( GTK_WIDGET( frame ) );
gtk_box_pack_start( GTK_BOX( hbox ), GTK_WIDGET( frame ), TRUE, TRUE, 0 );
{
- GtkVBox* vbox2 = GTK_VBOX( gtk_vbox_new( FALSE, 5 ) );
+ GtkVBox* vbox2 = ui::VBox( FALSE, 5 );
gtk_widget_show( GTK_WIDGET( vbox2 ) );
gtk_container_add( GTK_CONTAINER( frame ), GTK_WIDGET( vbox2 ) );
gtk_container_set_border_width( GTK_CONTAINER( vbox2 ), 5 );
{
- GtkLabel* label = GTK_LABEL( gtk_label_new( "Name:" ) );
+ GtkLabel* label = GTK_LABEL( ui::Label( "Name:" ) );
gtk_widget_show( GTK_WIDGET( label ) );
gtk_box_pack_start( GTK_BOX( vbox2 ), GTK_WIDGET( label ), TRUE, TRUE, 0 );
gtk_label_set_justify( label, GTK_JUSTIFY_LEFT );
gtk_misc_set_alignment( GTK_MISC( label ), 0, 0.5 );
}
{
- GtkEntry* entry = GTK_ENTRY( gtk_entry_new() );
- // gtk_entry_set_editable (GTK_ENTRY (entry), false);
+ GtkEntry* entry = ui::Entry();
+ // gtk_editable_set_editable (GTK_ENTRY (entry), false);
gtk_widget_show( GTK_WIDGET( entry ) );
gtk_box_pack_start( GTK_BOX( vbox2 ), GTK_WIDGET( entry ), TRUE, TRUE, 0 );
AddDialogData( *entry, m_strName );
g_signal_connect( G_OBJECT( entry ), "key_press_event", G_CALLBACK( OnDialogKey ), 0 );
}
{
- GtkTable* table = GTK_TABLE( gtk_table_new( 5, 4, FALSE ) );
+ GtkTable* table = ui::Table( 5, 4, FALSE );
gtk_widget_show( GTK_WIDGET( table ) );
gtk_box_pack_start( GTK_BOX( vbox2 ), GTK_WIDGET( table ), TRUE, TRUE, 0 );
gtk_table_set_row_spacings( table, 5 );
gtk_table_set_col_spacings( table, 5 );
{
- GtkLabel* label = GTK_LABEL( gtk_label_new( "Horizontal Shift Step" ) );
+ GtkLabel* label = GTK_LABEL( ui::Label( "Horizontal Shift Step" ) );
gtk_widget_show( GTK_WIDGET( label ) );
gtk_table_attach( table, GTK_WIDGET( label ), 2, 4, 0, 1,
(GtkAttachOptions)( GTK_FILL|GTK_EXPAND ),
gtk_misc_set_alignment( GTK_MISC( label ), 0, 0.5 );
}
{
- GtkLabel* label = GTK_LABEL( gtk_label_new( "Vertical Shift Step" ) );
+ GtkLabel* label = GTK_LABEL( ui::Label( "Vertical Shift Step" ) );
gtk_widget_show( GTK_WIDGET( label ) );
gtk_table_attach( table, GTK_WIDGET( label ), 2, 4, 1, 2,
(GtkAttachOptions)( GTK_FILL|GTK_EXPAND ),
gtk_misc_set_alignment( GTK_MISC( label ), 0, 0.5 );
}
{
- GtkLabel* label = GTK_LABEL( gtk_label_new( "Horizontal Stretch Step" ) );
+ GtkLabel* label = GTK_LABEL( ui::Label( "Horizontal Stretch Step" ) );
gtk_widget_show( GTK_WIDGET( label ) );
gtk_table_attach( table, GTK_WIDGET( label ), 2, 3, 2, 3,
(GtkAttachOptions)( GTK_FILL|GTK_EXPAND ),
gtk_misc_set_alignment( GTK_MISC( label ), 0, 0.5 );
}
{
- GtkButton* button = GTK_BUTTON( gtk_button_new_with_label( "Flip" ) );
+ GtkButton* button = ui::Button( "Flip" );
gtk_widget_show( GTK_WIDGET( button ) );
gtk_table_attach( table, GTK_WIDGET( button ), 3, 4, 2, 3,
(GtkAttachOptions)( GTK_FILL ),
(GtkAttachOptions)( 0 ), 0, 0 );
g_signal_connect( G_OBJECT( button ), "clicked", G_CALLBACK( OnBtnPatchFlipX ), 0 );
- gtk_widget_set_usize( GTK_WIDGET( button ), 60, -1 );
+ gtk_widget_set_size_request( GTK_WIDGET( button ), 60, -1 );
}
{
- GtkLabel* label = GTK_LABEL( gtk_label_new( "Vertical Stretch Step" ) );
+ GtkLabel* label = GTK_LABEL( ui::Label( "Vertical Stretch Step" ) );
gtk_widget_show( GTK_WIDGET( label ) );
gtk_table_attach( table, GTK_WIDGET( label ), 2, 3, 3, 4,
(GtkAttachOptions)( GTK_FILL|GTK_EXPAND ),
gtk_misc_set_alignment( GTK_MISC( label ), 0, 0.5 );
}
{
- GtkButton* button = GTK_BUTTON( gtk_button_new_with_label( "Flip" ) );
+ GtkButton* button = ui::Button( "Flip" );
gtk_widget_show( GTK_WIDGET( button ) );
gtk_table_attach( table, GTK_WIDGET( button ), 3, 4, 3, 4,
(GtkAttachOptions)( GTK_FILL ),
(GtkAttachOptions)( 0 ), 0, 0 );
g_signal_connect( G_OBJECT( button ), "clicked", G_CALLBACK( OnBtnPatchFlipY ), 0 );
- gtk_widget_set_usize( GTK_WIDGET( button ), 60, -1 );
+ gtk_widget_set_size_request( GTK_WIDGET( button ), 60, -1 );
}
{
- GtkLabel* label = GTK_LABEL( gtk_label_new( "Rotate Step" ) );
+ GtkLabel* label = GTK_LABEL( ui::Label( "Rotate Step" ) );
gtk_widget_show( GTK_WIDGET( label ) );
gtk_table_attach( table, GTK_WIDGET( label ), 2, 4, 4, 5,
(GtkAttachOptions)( GTK_FILL|GTK_EXPAND ),
gtk_misc_set_alignment( GTK_MISC( label ), 0, 0.5 );
}
{
- GtkEntry* entry = GTK_ENTRY( gtk_entry_new() );
+ GtkEntry* entry = ui::Entry();
gtk_widget_show( GTK_WIDGET( entry ) );
gtk_table_attach( table, GTK_WIDGET( entry ), 0, 1, 0, 1,
(GtkAttachOptions)( GTK_FILL ),
(GtkAttachOptions)( 0 ), 0, 0 );
- gtk_widget_set_usize( GTK_WIDGET( entry ), 50, -2 );
+ gtk_widget_set_size_request( GTK_WIDGET( entry ), 50, -1 );
g_object_set_data( G_OBJECT( window ), "hshift_entry", entry );
// we fill in this data, if no patch is selected the widgets are unmodified when the inspector is raised
// so we need to have at least one initialisation somewhere
entry_set_float( entry, g_pi_globals.shift[0] );
- GtkAdjustment* adj = GTK_ADJUSTMENT( gtk_adjustment_new( 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 );
+ auto adj = ui::Adjustment( 0, -8192, 8192, 1, 1, 0 );
+ g_signal_connect( G_OBJECT( adj ), "value_changed", G_CALLBACK( OnSpinChanged ), (gpointer) entry );
+ g_object_set_data( G_OBJECT( window ), "hshift_adj", (gpointer) adj );
- GtkSpinButton* spin = GTK_SPIN_BUTTON( gtk_spin_button_new( adj, 1, 0 ) );
+ auto 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 ),
(GtkAttachOptions)( 0 ), 0, 0 );
- gtk_widget_set_usize( GTK_WIDGET( spin ), 10, -2 );
- GTK_WIDGET_UNSET_FLAGS( spin, GTK_CAN_FOCUS );
+ gtk_widget_set_size_request( GTK_WIDGET( spin ), 10, -1 );
+ gtk_widget_set_can_focus( spin, false );
}
{
- GtkEntry* entry = GTK_ENTRY( gtk_entry_new() );
+ GtkEntry* entry = ui::Entry();
gtk_widget_show( GTK_WIDGET( entry ) );
gtk_table_attach( table, GTK_WIDGET( entry ), 0, 1, 1, 2,
(GtkAttachOptions)( GTK_FILL ),
(GtkAttachOptions)( 0 ), 0, 0 );
- gtk_widget_set_usize( GTK_WIDGET( entry ), 50, -2 );
+ gtk_widget_set_size_request( GTK_WIDGET( entry ), 50, -1 );
entry_set_float( entry, g_pi_globals.shift[1] );
- GtkAdjustment* adj = GTK_ADJUSTMENT( gtk_adjustment_new( 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 );
+ g_object_set_data( G_OBJECT( window ), "vshift_adj", (gpointer) adj );
- GtkSpinButton* spin = GTK_SPIN_BUTTON( gtk_spin_button_new( adj, 1, 0 ) );
+ auto 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 ),
(GtkAttachOptions)( 0 ), 0, 0 );
- gtk_widget_set_usize( GTK_WIDGET( spin ), 10, -2 );
- GTK_WIDGET_UNSET_FLAGS( spin, GTK_CAN_FOCUS );
+ gtk_widget_set_size_request( GTK_WIDGET( spin ), 10, -1 );
+ gtk_widget_set_can_focus( spin, false );
}
{
- GtkEntry* entry = GTK_ENTRY( gtk_entry_new() );
+ GtkEntry* entry = ui::Entry();
gtk_widget_show( GTK_WIDGET( entry ) );
gtk_table_attach( table, GTK_WIDGET( entry ), 0, 1, 2, 3,
(GtkAttachOptions)( GTK_FILL ),
(GtkAttachOptions)( 0 ), 0, 0 );
- gtk_widget_set_usize( GTK_WIDGET( entry ), 50, -2 );
+ gtk_widget_set_size_request( GTK_WIDGET( entry ), 50, -1 );
entry_set_float( entry, g_pi_globals.scale[0] );
- GtkAdjustment* adj = GTK_ADJUSTMENT( gtk_adjustment_new( 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 );
+ g_object_set_data( G_OBJECT( window ), "hscale_adj", (gpointer) adj );
- GtkSpinButton* spin = GTK_SPIN_BUTTON( gtk_spin_button_new( adj, 1, 0 ) );
+ auto 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 ),
(GtkAttachOptions)( 0 ), 0, 0 );
- gtk_widget_set_usize( GTK_WIDGET( spin ), 10, -2 );
- GTK_WIDGET_UNSET_FLAGS( spin, GTK_CAN_FOCUS );
+ gtk_widget_set_size_request( GTK_WIDGET( spin ), 10, -1 );
+ gtk_widget_set_can_focus( spin, false );
}
{
- GtkEntry* entry = GTK_ENTRY( gtk_entry_new() );
+ GtkEntry* entry = ui::Entry();
gtk_widget_show( GTK_WIDGET( entry ) );
gtk_table_attach( table, GTK_WIDGET( entry ), 0, 1, 3, 4,
(GtkAttachOptions)( GTK_FILL ),
(GtkAttachOptions)( 0 ), 0, 0 );
- gtk_widget_set_usize( GTK_WIDGET( entry ), 50, -2 );
+ gtk_widget_set_size_request( GTK_WIDGET( entry ), 50, -1 );
entry_set_float( entry, g_pi_globals.scale[1] );
- GtkAdjustment* adj = GTK_ADJUSTMENT( gtk_adjustment_new( 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 );
+ g_object_set_data( G_OBJECT( window ), "vscale_adj", (gpointer) adj );
- GtkSpinButton* spin = GTK_SPIN_BUTTON( gtk_spin_button_new( adj, 1, 0 ) );
+ auto 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 ),
(GtkAttachOptions)( 0 ), 0, 0 );
- gtk_widget_set_usize( GTK_WIDGET( spin ), 10, -2 );
- GTK_WIDGET_UNSET_FLAGS( spin, GTK_CAN_FOCUS );
+ gtk_widget_set_size_request( GTK_WIDGET( spin ), 10, -1 );
+ gtk_widget_set_can_focus( spin, false );
}
{
- GtkEntry* entry = GTK_ENTRY( gtk_entry_new() );
+ GtkEntry* entry = ui::Entry();
gtk_widget_show( GTK_WIDGET( entry ) );
gtk_table_attach( table, GTK_WIDGET( entry ), 0, 1, 4, 5,
(GtkAttachOptions)( GTK_FILL ),
(GtkAttachOptions)( 0 ), 0, 0 );
- gtk_widget_set_usize( GTK_WIDGET( entry ), 50, -2 );
+ gtk_widget_set_size_request( GTK_WIDGET( entry ), 50, -1 );
entry_set_float( entry, g_pi_globals.rotate );
- GtkAdjustment* adj = GTK_ADJUSTMENT( gtk_adjustment_new( 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 );
+ g_object_set_data( G_OBJECT( window ), "rotate_adj", (gpointer) adj );
- GtkSpinButton* spin = GTK_SPIN_BUTTON( gtk_spin_button_new( adj, 1, 0 ) );
+ auto 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 );
- gtk_widget_set_usize( GTK_WIDGET( spin ), 10, -2 );
- GTK_WIDGET_UNSET_FLAGS( spin, GTK_CAN_FOCUS );
+ gtk_widget_set_size_request( GTK_WIDGET( spin ), 10, -1 );
+ gtk_widget_set_can_focus( spin, false );
}
}
- GtkHBox* hbox2 = GTK_HBOX( gtk_hbox_new( TRUE, 5 ) );
+ GtkHBox* hbox2 = ui::HBox( TRUE, 5 );
gtk_widget_show( GTK_WIDGET( hbox2 ) );
gtk_box_pack_start( GTK_BOX( vbox2 ), GTK_WIDGET( hbox2 ), TRUE, FALSE, 0 );
{
- GtkButton* button = GTK_BUTTON( gtk_button_new_with_label( "Auto Cap" ) );
+ GtkButton* button = ui::Button( "Auto Cap" );
gtk_widget_show( GTK_WIDGET( button ) );
gtk_box_pack_end( GTK_BOX( hbox2 ), GTK_WIDGET( button ), TRUE, FALSE, 0 );
g_signal_connect( G_OBJECT( button ), "clicked", G_CALLBACK( OnBtnPatchAutoCap ), 0 );
- gtk_widget_set_usize( GTK_WIDGET( button ), 60, -1 );
+ gtk_widget_set_size_request( GTK_WIDGET( button ), 60, -1 );
}
{
- GtkButton* button = GTK_BUTTON( gtk_button_new_with_label( "CAP" ) );
+ GtkButton* button = ui::Button( "CAP" );
gtk_widget_show( GTK_WIDGET( button ) );
gtk_box_pack_end( GTK_BOX( hbox2 ), GTK_WIDGET( button ), TRUE, FALSE, 0 );
g_signal_connect( G_OBJECT( button ), "clicked", G_CALLBACK( OnBtnPatchdetails ), 0 );
- gtk_widget_set_usize( GTK_WIDGET( button ), 60, -1 );
+ gtk_widget_set_size_request( GTK_WIDGET( button ), 60, -1 );
}
{
- GtkButton* button = GTK_BUTTON( gtk_button_new_with_label( "Set..." ) );
+ GtkButton* button = ui::Button( "Set..." );
gtk_widget_show( GTK_WIDGET( button ) );
gtk_box_pack_end( GTK_BOX( hbox2 ), GTK_WIDGET( button ), TRUE, FALSE, 0 );
g_signal_connect( G_OBJECT( button ), "clicked", G_CALLBACK( OnBtnPatchreset ), 0 );
- gtk_widget_set_usize( GTK_WIDGET( button ), 60, -1 );
+ gtk_widget_set_size_request( GTK_WIDGET( button ), 60, -1 );
}
{
- GtkButton* button = GTK_BUTTON( gtk_button_new_with_label( "Natural" ) );
+ GtkButton* button = ui::Button( "Natural" );
gtk_widget_show( GTK_WIDGET( button ) );
gtk_box_pack_end( GTK_BOX( hbox2 ), GTK_WIDGET( button ), TRUE, FALSE, 0 );
g_signal_connect( G_OBJECT( button ), "clicked", G_CALLBACK( OnBtnPatchnatural ), 0 );
- gtk_widget_set_usize( GTK_WIDGET( button ), 60, -1 );
+ gtk_widget_set_size_request( GTK_WIDGET( button ), 60, -1 );
}
{
- GtkButton* button = GTK_BUTTON( gtk_button_new_with_label( "Fit" ) );
+ GtkButton* button = ui::Button( "Fit" );
gtk_widget_show( GTK_WIDGET( button ) );
gtk_box_pack_end( GTK_BOX( hbox2 ), GTK_WIDGET( button ), TRUE, FALSE, 0 );
g_signal_connect( G_OBJECT( button ), "clicked", G_CALLBACK( OnBtnPatchfit ), 0 );
- gtk_widget_set_usize( GTK_WIDGET( button ), 60, -1 );
+ gtk_widget_set_size_request( GTK_WIDGET( button ), 60, -1 );
}
}
}
for ( std::size_t i = 0; i < m_countRows; ++i )
{
- gtk_combo_box_remove_text( m_pRowCombo, gint( m_countRows - i - 1 ) );
+ gtk_combo_box_text_remove( m_pRowCombo, gint( m_countRows - i - 1 ) );
}
m_countRows = m_Patch->getHeight();
{
char buffer[16];
sprintf( buffer, "%u", Unsigned( i ) );
- gtk_combo_box_append_text( m_pRowCombo, buffer );
+ gtk_combo_box_text_append_text( m_pRowCombo, buffer );
}
gtk_combo_box_set_active( m_pRowCombo, 0 );
for ( std::size_t i = 0; i < m_countCols; ++i )
{
- gtk_combo_box_remove_text( m_pColCombo, gint( m_countCols - i - 1 ) );
+ gtk_combo_box_text_remove( m_pColCombo, gint( m_countCols - i - 1 ) );
}
m_countCols = m_Patch->getWidth();
{
char buffer[16];
sprintf( buffer, "%u", Unsigned( i ) );
- gtk_combo_box_append_text( m_pColCombo, buffer );
+ gtk_combo_box_text_append_text( m_pColCombo, buffer );
}
gtk_combo_box_set_active( m_pColCombo, 0 );
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
+#include <uilib/uilib.h>
+
#if !defined( INCLUDED_PATCHDIALOG_H )
#define INCLUDED_PATCHDIALOG_H
void PatchInspector_Construct();
void PatchInspector_Destroy();
-typedef struct _GtkWidget GtkWidget;
-typedef struct _GtkWindow GtkWindow;
-void PatchInspector_constructWindow( GtkWindow* main_window );
+void PatchInspector_constructWindow( ui::Window main_window );
void PatchInspector_destroyWindow();
namespace scene
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
+#include <gdk/gdkkeysyms.h>
#include "patchmanip.h"
#include "debugging/debugging.h"
GlobalCommands_insert( "PatchCone", FreeCaller<Patch_Cone>() );
GlobalCommands_insert( "PatchSphere", FreeCaller<Patch_Sphere>() );
GlobalCommands_insert( "SimplePatchMesh", FreeCaller<Patch_Plane>(), Accelerator( 'P', (GdkModifierType)GDK_SHIFT_MASK ) );
- GlobalCommands_insert( "PatchInsertInsertColumn", FreeCaller<Patch_InsertInsertColumn>(), Accelerator( GDK_KP_Add, (GdkModifierType)( GDK_SHIFT_MASK | GDK_CONTROL_MASK ) ) );
+ GlobalCommands_insert( "PatchInsertInsertColumn", FreeCaller<Patch_InsertInsertColumn>(), Accelerator( GDK_KEY_KP_Add, (GdkModifierType)( GDK_SHIFT_MASK | GDK_CONTROL_MASK ) ) );
GlobalCommands_insert( "PatchInsertAddColumn", FreeCaller<Patch_InsertAddColumn>() );
- GlobalCommands_insert( "PatchInsertInsertRow", FreeCaller<Patch_InsertInsertRow>(), Accelerator( GDK_KP_Add, (GdkModifierType)GDK_CONTROL_MASK ) );
+ GlobalCommands_insert( "PatchInsertInsertRow", FreeCaller<Patch_InsertInsertRow>(), Accelerator( GDK_KEY_KP_Add, (GdkModifierType)GDK_CONTROL_MASK ) );
GlobalCommands_insert( "PatchInsertAddRow", FreeCaller<Patch_InsertAddRow>() );
GlobalCommands_insert( "PatchDeleteFirstColumn", FreeCaller<Patch_DeleteFirstColumn>() );
- GlobalCommands_insert( "PatchDeleteLastColumn", FreeCaller<Patch_DeleteLastColumn>(), Accelerator( GDK_KP_Subtract, (GdkModifierType)( GDK_SHIFT_MASK | GDK_CONTROL_MASK ) ) );
- GlobalCommands_insert( "PatchDeleteFirstRow", FreeCaller<Patch_DeleteFirstRow>(), Accelerator( GDK_KP_Subtract, (GdkModifierType)GDK_CONTROL_MASK ) );
+ GlobalCommands_insert( "PatchDeleteLastColumn", FreeCaller<Patch_DeleteLastColumn>(), Accelerator( GDK_KEY_KP_Subtract, (GdkModifierType)( GDK_SHIFT_MASK | GDK_CONTROL_MASK ) ) );
+ GlobalCommands_insert( "PatchDeleteFirstRow", FreeCaller<Patch_DeleteFirstRow>(), Accelerator( GDK_KEY_KP_Subtract, (GdkModifierType)GDK_CONTROL_MASK ) );
GlobalCommands_insert( "PatchDeleteLastRow", FreeCaller<Patch_DeleteLastRow>() );
GlobalCommands_insert( "InvertCurve", FreeCaller<Patch_Invert>(), Accelerator( 'I', (GdkModifierType)GDK_CONTROL_MASK ) );
GlobalCommands_insert( "RedisperseRows", FreeCaller<Patch_RedisperseRows>(), Accelerator( 'E', (GdkModifierType)GDK_CONTROL_MASK ) );
}
-#include <gtk/gtkbox.h>
-#include <gtk/gtktable.h>
-#include <gtk/gtktogglebutton.h>
-#include <gtk/gtkradiobutton.h>
-#include <gtk/gtkcombobox.h>
-#include <gtk/gtklabel.h>
+#include <gtk/gtk.h>
#include "gtkutil/dialog.h"
#include "gtkutil/widget.h"
GtkComboBox* width;
GtkComboBox* height;
- GtkWindow* window = create_dialog_window( MainFrame_getWindow(), "Patch density", G_CALLBACK( dialog_delete_callback ), &dialog );
+ ui::Window window = MainFrame_getWindow().create_dialog_window("Patch density", G_CALLBACK(dialog_delete_callback ), &dialog );
- GtkAccelGroup* accel = gtk_accel_group_new();
+ GtkAccelGroup* accel = ui::AccelGroup();
gtk_window_add_accel_group( window, accel );
{
GtkTable* table = create_dialog_table( 2, 2, 4, 4 );
gtk_box_pack_start( GTK_BOX( hbox ), GTK_WIDGET( table ), TRUE, TRUE, 0 );
{
- GtkLabel* label = GTK_LABEL( gtk_label_new( "Width:" ) );
+ GtkLabel* label = GTK_LABEL( ui::Label( "Width:" ) );
gtk_widget_show( GTK_WIDGET( label ) );
gtk_table_attach( table, GTK_WIDGET( label ), 0, 1, 0, 1,
(GtkAttachOptions) ( GTK_FILL ),
gtk_misc_set_alignment( GTK_MISC( label ), 0, 0.5 );
}
{
- GtkLabel* label = GTK_LABEL( gtk_label_new( "Height:" ) );
+ GtkLabel* label = GTK_LABEL( ui::Label( "Height:" ) );
gtk_widget_show( GTK_WIDGET( label ) );
gtk_table_attach( table, GTK_WIDGET( label ), 0, 1, 1, 2,
(GtkAttachOptions) ( GTK_FILL ),
}
{
- GtkComboBox* combo = GTK_COMBO_BOX( gtk_combo_box_new_text() );
-#define D_ITEM( x ) if ( x >= mincols && ( !maxcols || x <= maxcols ) ) gtk_combo_box_append_text( combo, # x )
+ auto combo = ui::ComboBoxText();
+#define D_ITEM( x ) if ( x >= mincols && ( !maxcols || x <= maxcols ) ) gtk_combo_box_text_append_text( combo, # x )
D_ITEM( 3 );
D_ITEM( 5 );
D_ITEM( 7 );
width = combo;
}
{
- GtkComboBox* combo = GTK_COMBO_BOX( gtk_combo_box_new_text() );
-#define D_ITEM( x ) if ( x >= minrows && ( !maxrows || x <= maxrows ) ) gtk_combo_box_append_text( combo, # x )
+ auto combo = ui::ComboBoxText();
+#define D_ITEM( x ) if ( x >= minrows && ( !maxrows || x <= maxrows ) ) gtk_combo_box_text_append_text( combo, # x )
D_ITEM( 3 );
D_ITEM( 5 );
D_ITEM( 7 );
ModalDialog dialog;
ModalDialogButton ok_button( dialog, eIDOK );
ModalDialogButton cancel_button( dialog, eIDCANCEL );
- GtkWidget* bevel;
- GtkWidget* ibevel;
- GtkWidget* endcap;
- GtkWidget* iendcap;
- GtkWidget* cylinder;
+ ui::Widget bevel;
+ ui::Widget ibevel;
+ ui::Widget endcap;
+ ui::Widget iendcap;
+ ui::Widget cylinder;
- GtkWindow* window = create_modal_dialog_window( MainFrame_getWindow(), "Cap", dialog );
+ ui::Window window = MainFrame_getWindow().create_modal_dialog_window( "Cap", dialog );
- GtkAccelGroup *accel_group = gtk_accel_group_new();
+ GtkAccelGroup *accel_group = ui::AccelGroup();
gtk_window_add_accel_group( window, accel_group );
{
gtk_container_add( GTK_CONTAINER( hbox ), GTK_WIDGET( radio_vbox ) );
{
- GtkTable* table = GTK_TABLE( gtk_table_new( 5, 2, FALSE ) );
+ GtkTable* table = ui::Table( 5, 2, FALSE );
gtk_widget_show( GTK_WIDGET( table ) );
gtk_box_pack_start( GTK_BOX( radio_vbox ), GTK_WIDGET( table ), TRUE, TRUE, 0 );
gtk_table_set_row_spacings( table, 5 );
GSList* group = 0;
{
- GtkWidget* button = gtk_radio_button_new_with_label( group, "Bevel" );
+ ui::Widget button = ui::Widget(gtk_radio_button_new_with_label( group, "Bevel" ));
gtk_widget_show( button );
gtk_table_attach( table, button, 1, 2, 0, 1,
(GtkAttachOptions) ( GTK_FILL | GTK_EXPAND ),
(GtkAttachOptions) ( 0 ), 0, 0 );
- group = gtk_radio_button_group( GTK_RADIO_BUTTON( button ) );
+ group = gtk_radio_button_get_group( GTK_RADIO_BUTTON( button ) );
bevel = button;
}
{
- GtkWidget* button = gtk_radio_button_new_with_label( group, "Endcap" );
+ ui::Widget button = ui::Widget(gtk_radio_button_new_with_label( group, "Endcap" ));
gtk_widget_show( button );
gtk_table_attach( table, button, 1, 2, 1, 2,
(GtkAttachOptions) ( GTK_FILL | GTK_EXPAND ),
(GtkAttachOptions) ( 0 ), 0, 0 );
- group = gtk_radio_button_group( GTK_RADIO_BUTTON( button ) );
+ group = gtk_radio_button_get_group( GTK_RADIO_BUTTON( button ) );
endcap = button;
}
{
- GtkWidget* button = gtk_radio_button_new_with_label( group, "Inverted Bevel" );
+ ui::Widget button = ui::Widget(gtk_radio_button_new_with_label( group, "Inverted Bevel" ));
gtk_widget_show( button );
gtk_table_attach( table, button, 1, 2, 2, 3,
(GtkAttachOptions) ( GTK_FILL | GTK_EXPAND ),
(GtkAttachOptions) ( 0 ), 0, 0 );
- group = gtk_radio_button_group( GTK_RADIO_BUTTON( button ) );
+ group = gtk_radio_button_get_group( GTK_RADIO_BUTTON( button ) );
ibevel = button;
}
{
- GtkWidget* button = gtk_radio_button_new_with_label( group, "Inverted Endcap" );
+ ui::Widget button = ui::Widget(gtk_radio_button_new_with_label( group, "Inverted Endcap" ));
gtk_widget_show( button );
gtk_table_attach( table, button, 1, 2, 3, 4,
(GtkAttachOptions) ( GTK_FILL | GTK_EXPAND ),
(GtkAttachOptions) ( 0 ), 0, 0 );
- group = gtk_radio_button_group( GTK_RADIO_BUTTON( button ) );
+ group = gtk_radio_button_get_group( GTK_RADIO_BUTTON( button ) );
iendcap = button;
}
{
- GtkWidget* button = gtk_radio_button_new_with_label( group, "Cylinder" );
+ ui::Widget button = ui::Widget(gtk_radio_button_new_with_label( group, "Cylinder" ));
gtk_widget_show( button );
gtk_table_attach( table, button, 1, 2, 4, 5,
(GtkAttachOptions) ( GTK_FILL | GTK_EXPAND ),
(GtkAttachOptions) ( 0 ), 0, 0 );
- group = gtk_radio_button_group( GTK_RADIO_BUTTON( button ) );
+ group = gtk_radio_button_get_group( GTK_RADIO_BUTTON( button ) );
cylinder = button;
}
/*!
build directly from a SYN_PROVIDE interface
*/
-CPluginSlot( GtkWidget* main_window, const char* name, const _QERPluginTable& table );
+CPluginSlot( ui::Widget main_window, const char* name, const _QERPluginTable& table );
/*!
dispatching a command by name to the plugin
*/
};
-CPluginSlot::CPluginSlot( GtkWidget* main_window, const char* name, const _QERPluginTable& table ){
+CPluginSlot::CPluginSlot( ui::Widget main_window, const char* name, const _QERPluginTable& table ){
mpTable = &table;
m_menu_name = name;
public:
virtual ~CPluginSlots();
-void AddPluginSlot( GtkWidget* main_window, const char* name, const _QERPluginTable& table ){
+void AddPluginSlot( ui::Widget main_window, const char* name, const _QERPluginTable& table ){
mSlots.push_back( new CPluginSlot( main_window, name, table ) );
}
CPluginSlots g_plugin_slots;
-void FillPluginSlots( CPluginSlots& slots, GtkWidget* main_window ){
+void FillPluginSlots( CPluginSlots& slots, ui::Widget main_window ){
class AddPluginVisitor : public PluginModules::Visitor
{
CPluginSlots& m_slots;
- GtkWidget* m_main_window;
+ ui::Widget m_main_window;
public:
- AddPluginVisitor( CPluginSlots& slots, GtkWidget* main_window )
+ AddPluginVisitor( CPluginSlots& slots, ui::Widget main_window )
: m_slots( slots ), m_main_window( main_window ){
}
void visit( const char* name, const _QERPluginTable& table ) const {
g_plugin_slots.Dispatch( n, p );
}
-void CPlugInManager::Init( GtkWidget* main_window ){
+void CPlugInManager::Init( ui::Widget main_window ){
FillPluginSlots( g_plugin_slots, main_window );
}
#define INCLUDED_PLUGINMANAGER_H
#include <cstddef>
+#include <uilib/uilib.h>
-typedef struct _GtkWidget GtkWidget;
/*!
\class IPlugin
{
public:
void Dispatch( std::size_t n, const char *p );
-void Init( GtkWidget* main_window );
+void Init( ui::Widget main_window );
void constructMenu( PluginsVisitor& menu );
void Shutdown();
};
#include "stream/textstream.h"
-#include <gtk/gtkmenu.h>
-#include <gtk/gtkmenuitem.h>
+#include <gtk/gtk.h>
#include "gtkutil/pointer.h"
#include "gtkutil/menu.h"
int m_nNextPlugInID = 0;
-void plugin_activated( GtkWidget* widget, gpointer data ){
+void plugin_activated( ui::Widget widget, gpointer data ){
const char* str = (const char*)g_object_get_data( G_OBJECT( widget ),"command" );
GetPlugInMgr().Dispatch( gpointer_to_int( data ), str );
}
#include <stack>
-typedef std::stack<GtkWidget*> WidgetStack;
+typedef std::stack<ui::Widget> WidgetStack;
void PlugInMenu_Add( GtkMenu* plugin_menu, IPlugIn* pPlugIn ){
- GtkWidget *menu, *item, *parent, *subMenu;
+ ui::Widget menu, item, parent, subMenu;
const char *menuText, *menuCommand;
WidgetStack menuStack;
- parent = gtk_menu_item_new_with_label( pPlugIn->getMenuName() );
+ parent = ui::MenuItem( pPlugIn->getMenuName() );
gtk_widget_show( parent );
gtk_container_add( GTK_CONTAINER( plugin_menu ), parent );
std::size_t nCount = pPlugIn->getCommandCount();
if ( nCount > 0 ) {
- menu = gtk_menu_new();
+ menu = ui::Menu();
if ( g_Layout_enableDetachableMenus.m_value ) {
menu_tearoff( GTK_MENU( menu ) );
}
if ( menuText != 0 && strlen( menuText ) > 0 ) {
if ( !strcmp( menuText, "-" ) ) {
- item = gtk_menu_item_new();
+ item = ui::Widget(gtk_menu_item_new());
gtk_widget_set_sensitive( item, FALSE );
}
else if ( !strcmp( menuText, ">" ) ) {
continue;
}
- item = gtk_menu_item_new_with_label( menuText );
+ item = ui::MenuItem( menuText );
gtk_widget_show( item );
gtk_container_add( GTK_CONTAINER( menu ), item );
- subMenu = gtk_menu_new();
+ subMenu = ui::Menu();
gtk_menu_item_set_submenu( GTK_MENU_ITEM( item ), subMenu );
menuStack.push( menu );
menu = subMenu;
}
else
{
- item = gtk_menu_item_new_with_label( menuText );
+ item = ui::MenuItem( menuText );
g_object_set_data( G_OBJECT( item ),"command", const_cast<gpointer>( static_cast<const void*>( menuCommand ) ) );
g_signal_connect( G_OBJECT( item ), "activate", G_CALLBACK( plugin_activated ), gint_to_pointer( m_nNextPlugInID ) );
}
void PluginsMenu_clear(){
m_nNextPlugInID = 0;
- GList* lst = g_list_find( gtk_container_children( GTK_CONTAINER( g_plugins_menu ) ), GTK_WIDGET( g_plugins_menu_separator ) );
+ GList* lst = g_list_find( gtk_container_get_children( GTK_CONTAINER( g_plugins_menu ) ), GTK_WIDGET( g_plugins_menu_separator ) );
while ( lst->next )
{
gtk_container_remove( GTK_CONTAINER( g_plugins_menu ), GTK_WIDGET( lst->next->data ) );
- lst = g_list_find( gtk_container_children( GTK_CONTAINER( g_plugins_menu ) ), GTK_WIDGET( g_plugins_menu_separator ) );
+ lst = g_list_find( gtk_container_get_children( GTK_CONTAINER( g_plugins_menu ) ), GTK_WIDGET( g_plugins_menu_separator ) );
}
}
#include "itoolbar.h"
#include "modulesystem.h"
-#include <gtk/gtktoolbar.h>
+#include <gtk/gtk.h>
#include "stream/stringstream.h"
#include "gtkutil/image.h"
{
StringOutputStream fullpath( 256 );
fullpath << GameToolsPath_get() << g_pluginsDir << "bitmaps/" << filename;
- GtkImage* image = image_new_from_file_with_mask( fullpath.c_str() );
- if ( image != 0 ) {
- return image;
- }
+ if ( auto image = image_new_from_file_with_mask(fullpath.c_str()) ) return image;
}
{
StringOutputStream fullpath( 256 );
fullpath << AppPath_get() << g_pluginsDir << "bitmaps/" << filename;
- GtkImage* image = image_new_from_file_with_mask( fullpath.c_str() );
- if ( image != 0 ) {
- return image;
- }
+ if ( auto image = image_new_from_file_with_mask(fullpath.c_str()) ) return image;
}
{
StringOutputStream fullpath( 256 );
fullpath << AppPath_get() << g_modulesDir << "bitmaps/" << filename;
- GtkImage* image = image_new_from_file_with_mask( fullpath.c_str() );
- if ( image != 0 ) {
- return image;
- }
+ if ( auto image = image_new_from_file_with_mask(fullpath.c_str()) ) return image;
}
return image_new_missing();
}
-inline GtkToolbarChildType gtktoolbarchildtype_for_toolbarbuttontype( IToolbarButton::EType type ){
- switch ( type )
- {
- case IToolbarButton::eSpace:
- return GTK_TOOLBAR_CHILD_SPACE;
- case IToolbarButton::eButton:
- return GTK_TOOLBAR_CHILD_BUTTON;
- case IToolbarButton::eToggleButton:
- return GTK_TOOLBAR_CHILD_TOGGLEBUTTON;
- case IToolbarButton::eRadioButton:
- return GTK_TOOLBAR_CHILD_RADIOBUTTON;
+void toolbar_insert( GtkToolbar *toolbar, const char* icon, const char* text, const char* tooltip, IToolbarButton::EType type, GCallback handler, gpointer data ){
+ if (type == IToolbarButton::eSpace) {
+ auto it = gtk_separator_tool_item_new();
+ gtk_widget_show(GTK_WIDGET(it));
+ gtk_container_add(GTK_CONTAINER(toolbar), GTK_WIDGET(it));
+ return;
+ }
+ if (type == IToolbarButton::eButton) {
+ auto button = gtk_tool_button_new(GTK_WIDGET(new_plugin_image(icon)), text);
+ gtk_widget_set_tooltip_text(GTK_WIDGET(button), tooltip);
+ gtk_widget_show_all(GTK_WIDGET(button));
+ g_signal_connect(G_OBJECT(button), "clicked", G_CALLBACK(handler), data);
+ gtk_container_add(GTK_CONTAINER(toolbar), GTK_WIDGET(button));
+ return;
+ }
+ if (type == IToolbarButton::eToggleButton) {
+ auto button = gtk_toggle_tool_button_new();
+ gtk_tool_button_set_icon_widget(GTK_TOOL_BUTTON(button), GTK_WIDGET(new_plugin_image(icon)));
+ gtk_tool_button_set_label(GTK_TOOL_BUTTON(button), text);
+ gtk_widget_set_tooltip_text(GTK_WIDGET(button), tooltip);
+ gtk_widget_show_all(GTK_WIDGET(button));
+ g_signal_connect(G_OBJECT(button), "toggled", G_CALLBACK(handler), data);
+ gtk_container_add(GTK_CONTAINER(toolbar), GTK_WIDGET(button));
+ return;
}
ERROR_MESSAGE( "invalid toolbar button type" );
- return (GtkToolbarChildType)0;
-}
-
-void toolbar_insert( GtkToolbar *toolbar, const char* icon, const char* text, const char* tooltip, IToolbarButton::EType type, GtkSignalFunc handler, gpointer data ){
- gtk_toolbar_append_element( toolbar, gtktoolbarchildtype_for_toolbarbuttontype( type ), 0, text, tooltip, "", GTK_WIDGET( new_plugin_image( icon ) ), handler, data );
}
-void ActivateToolbarButton( GtkWidget *widget, gpointer data ){
- const_cast<const IToolbarButton*>( reinterpret_cast<IToolbarButton*>( data ) )->activate();
+void ActivateToolbarButton( GtkToolButton *widget, gpointer data ){
+ (const_cast<const IToolbarButton *>( reinterpret_cast<IToolbarButton *>( data )))->activate();
}
void PlugInToolbar_AddButton( GtkToolbar* toolbar, const IToolbarButton* button ){
- toolbar_insert( toolbar, button->getImage(), button->getText(), button->getTooltip(), button->getType(), GTK_SIGNAL_FUNC( ActivateToolbarButton ), reinterpret_cast<gpointer>( const_cast<IToolbarButton*>( button ) ) );
+ toolbar_insert( toolbar, button->getImage(), button->getText(), button->getTooltip(), button->getType(), G_CALLBACK( ActivateToolbarButton ), reinterpret_cast<gpointer>( const_cast<IToolbarButton*>( button ) ) );
}
GtkToolbar* g_plugin_toolbar = 0;
GtkToolbar *toolbar;
toolbar = GTK_TOOLBAR( gtk_toolbar_new() );
- gtk_toolbar_set_orientation( toolbar, GTK_ORIENTATION_HORIZONTAL );
+ gtk_orientable_set_orientation( GTK_ORIENTABLE(toolbar), GTK_ORIENTATION_HORIZONTAL );
gtk_toolbar_set_style( toolbar, GTK_TOOLBAR_ICONS );
gtk_widget_show( GTK_WIDGET( toolbar ) );
#include "debugging/debugging.h"
-#include <gtk/gtkmain.h>
-#include <gtk/gtkvbox.h>
-#include <gtk/gtkhbox.h>
-#include <gtk/gtkframe.h>
-#include <gtk/gtklabel.h>
-#include <gtk/gtktogglebutton.h>
-#include <gtk/gtkspinbutton.h>
-#include <gtk/gtkscrolledwindow.h>
-#include <gtk/gtktreemodel.h>
-#include <gtk/gtktreeview.h>
-#include <gtk/gtktreestore.h>
-#include <gtk/gtktreeselection.h>
-#include <gtk/gtkcellrenderertext.h>
-#include <gtk/gtknotebook.h>
+#include <gtk/gtk.h>
#include "generic/callback.h"
#include "math/vector.h"
page.appendCheckBox( "", "Default Text Editor", g_TextEditor_useWin32Editor );
#else
{
- GtkWidget* use_custom = page.appendCheckBox( "Text Editor", "Custom", g_TextEditor_useCustomEditor );
- GtkWidget* custom_editor = page.appendPathEntry( "Text Editor Command", g_TextEditor_editorCommand, true );
+ ui::CheckButton use_custom = page.appendCheckBox( "Text Editor", "Custom", g_TextEditor_useCustomEditor );
+ ui::Widget custom_editor = page.appendPathEntry( "Text Editor Command", g_TextEditor_editorCommand, true );
Widget_connectToggleDependency( custom_editor, use_custom );
}
#endif
*/
#include <map>
+#include <uilib/uilib.h>
inline const char* xmlAttr_getName( xmlAttrPtr attr ){
return reinterpret_cast<const char*>( attr->name );
page.appendCheckBox( "Startup", "Show Global Preferences", m_bGamePrompt );
}
-GtkWindow* CGameDialog::BuildDialog(){
+ui::Window CGameDialog::BuildDialog(){
GtkFrame* frame = create_dialog_frame( "Game settings", GTK_SHADOW_ETCHED_IN );
GtkVBox* vbox2 = create_dialog_vbox( 0, 4 );
gtk_container_add( GTK_CONTAINER( frame ), GTK_WIDGET( vbox2 ) );
{
- PreferencesPage preferencesPage( *this, GTK_WIDGET( vbox2 ) );
+ PreferencesPage preferencesPage( *this, ui::Widget(GTK_WIDGET( vbox2 )) );
Global_constructPreferences( preferencesPage );
CreateGlobalFrame( preferencesPage );
}
- return create_simple_modal_dialog_window( "Global Preferences", m_modal, GTK_WIDGET( frame ) );
+ return ui::Window(create_simple_modal_dialog_window( "Global Preferences", m_modal, GTK_WIDGET( frame ) ));
}
class LoadGameFile
delete ( *iGame );
*iGame = 0;
}
- if ( GetWidget() != 0 ) {
+ if ( GetWidget() ) {
Destroy();
}
}
// =============================================================================
// Widget callbacks for PrefsDlg
-static void OnButtonClean( GtkWidget *widget, gpointer data ){
+static void OnButtonClean( ui::Widget widget, gpointer data ){
// make sure this is what the user wants
- if ( gtk_MessageBox( GTK_WIDGET( g_Preferences.GetWidget() ), "This will close Radiant and clean the corresponding registry entries.\n"
+ if ( ui::Widget(GTK_WIDGET( g_Preferences.GetWidget() )).alert( "This will close Radiant and clean the corresponding registry entries.\n"
"Next time you start Radiant it will be good as new. Do you wish to continue?",
- "Reset Registry", eMB_YESNO, eMB_ICONASTERISK ) == eIDYES ) {
+ "Reset Registry", ui::alert_type::YESNO, ui::alert_icon::Asterisk ) == ui::alert_response::YES ) {
PrefsDlg *dlg = (PrefsDlg*)data;
dlg->EndModal( eIDCANCEL );
g_string_append( m_inipath, PREFS_LOCAL_FILENAME );
}
-void notebook_set_page( GtkWidget* notebook, GtkWidget* page ){
+void notebook_set_page( ui::Widget notebook, ui::Widget page ){
int pagenum = gtk_notebook_page_num( GTK_NOTEBOOK( notebook ), page );
if ( gtk_notebook_get_current_page( GTK_NOTEBOOK( notebook ) ) != pagenum ) {
gtk_notebook_set_current_page( GTK_NOTEBOOK( notebook ), pagenum );
}
}
-void PrefsDlg::showPrefPage( GtkWidget* prefpage ){
+void PrefsDlg::showPrefPage( ui::Widget prefpage ){
notebook_set_page( m_notebook, prefpage );
return;
}
GtkTreeModel* model;
GtkTreeIter selected;
if ( gtk_tree_selection_get_selected( selection, &model, &selected ) ) {
- GtkWidget* prefpage;
+ ui::Widget prefpage;
gtk_tree_model_get( model, &selected, 1, (gpointer*)&prefpage, -1 );
dlg->showPrefPage( prefpage );
}
PreferenceGroupCallbacks_pushBack( g_settingsCallbacks, callback );
}
-void Widget_updateDependency( GtkWidget* self, GtkWidget* toggleButton ){
- gtk_widget_set_sensitive( self, gtk_toggle_button_get_active( GTK_TOGGLE_BUTTON( toggleButton ) ) && GTK_WIDGET_IS_SENSITIVE( toggleButton ) );
+void Widget_updateDependency( ui::Widget self, ui::Widget toggleButton ){
+ gtk_widget_set_sensitive( self, gtk_toggle_button_get_active( GTK_TOGGLE_BUTTON( toggleButton ) ) && gtk_widget_is_sensitive( toggleButton ) );
}
-void ToggleButton_toggled_Widget_updateDependency( GtkWidget *toggleButton, GtkWidget* self ){
+void ToggleButton_toggled_Widget_updateDependency( ui::Widget toggleButton, ui::Widget self ){
Widget_updateDependency( self, toggleButton );
}
-void ToggleButton_state_changed_Widget_updateDependency( GtkWidget* toggleButton, GtkStateType state, GtkWidget* self ){
+void ToggleButton_state_changed_Widget_updateDependency( ui::Widget toggleButton, GtkStateType state, ui::Widget self ){
if ( state == GTK_STATE_INSENSITIVE ) {
Widget_updateDependency( self, toggleButton );
}
}
-void Widget_connectToggleDependency( GtkWidget* self, GtkWidget* toggleButton ){
+void Widget_connectToggleDependency( ui::Widget self, ui::Widget toggleButton ){
g_signal_connect( G_OBJECT( toggleButton ), "state_changed", G_CALLBACK( ToggleButton_state_changed_Widget_updateDependency ), self );
g_signal_connect( G_OBJECT( toggleButton ), "toggled", G_CALLBACK( ToggleButton_toggled_Widget_updateDependency ), self );
Widget_updateDependency( self, toggleButton );
}
-inline GtkWidget* getVBox( GtkWidget* page ){
- return gtk_bin_get_child( GTK_BIN( page ) );
+inline ui::Widget getVBox( ui::Widget page ){
+ return ui::Widget(gtk_bin_get_child( GTK_BIN( page ) ));
}
-GtkTreeIter PreferenceTree_appendPage( GtkTreeStore* store, GtkTreeIter* parent, const char* name, GtkWidget* page ){
+GtkTreeIter PreferenceTree_appendPage( GtkTreeStore* store, GtkTreeIter* parent, const char* name, ui::Widget page ){
GtkTreeIter group;
gtk_tree_store_append( store, &group, parent );
gtk_tree_store_set( store, &group, 0, name, 1, page, -1 );
return group;
}
-GtkWidget* PreferencePages_addPage( GtkWidget* notebook, const char* name ){
- GtkWidget* preflabel = gtk_label_new( name );
+ui::Widget PreferencePages_addPage( ui::Widget notebook, const char* name ){
+ ui::Widget preflabel = ui::Label( name );
gtk_widget_show( preflabel );
- GtkWidget* pageframe = gtk_frame_new( name );
+ ui::Widget pageframe = ui::Frame( name );
gtk_container_set_border_width( GTK_CONTAINER( pageframe ), 4 );
gtk_widget_show( pageframe );
- GtkWidget* vbox = gtk_vbox_new( FALSE, 4 );
+ ui::Widget vbox = ui::VBox( FALSE, 4 );
gtk_widget_show( vbox );
gtk_container_set_border_width( GTK_CONTAINER( vbox ), 4 );
gtk_container_add( GTK_CONTAINER( pageframe ), vbox );
class PreferenceTreeGroup : public PreferenceGroup
{
Dialog& m_dialog;
-GtkWidget* m_notebook;
+ui::Widget m_notebook;
GtkTreeStore* m_store;
GtkTreeIter m_group;
public:
-PreferenceTreeGroup( Dialog& dialog, GtkWidget* notebook, GtkTreeStore* store, GtkTreeIter group ) :
+PreferenceTreeGroup( Dialog& dialog, ui::Widget notebook, GtkTreeStore* store, GtkTreeIter group ) :
m_dialog( dialog ),
m_notebook( notebook ),
m_store( store ),
m_group( group ){
}
PreferencesPage createPage( const char* treeName, const char* frameName ){
- GtkWidget* page = PreferencePages_addPage( m_notebook, frameName );
+ ui::Widget page = PreferencePages_addPage( m_notebook, frameName );
PreferenceTree_appendPage( m_store, &m_group, treeName, page );
return PreferencesPage( m_dialog, getVBox( page ) );
}
};
-GtkWindow* PrefsDlg::BuildDialog(){
+ui::Window PrefsDlg::BuildDialog(){
PreferencesDialog_addInterfacePreferences( FreeCaller1<PreferencesPage&, Interface_constructPreferences>() );
Mouse_registerPreferencesPage();
- GtkWindow* dialog = create_floating_window( "NetRadiant Preferences", m_parent );
+ ui::Window dialog = ui::Window(create_floating_window( "NetRadiant Preferences", m_parent ));
{
- GtkWidget* mainvbox = gtk_vbox_new( FALSE, 5 );
+ ui::Widget mainvbox = ui::VBox( FALSE, 5 );
gtk_container_add( GTK_CONTAINER( dialog ), mainvbox );
gtk_container_set_border_width( GTK_CONTAINER( mainvbox ), 5 );
gtk_widget_show( mainvbox );
{
- GtkWidget* hbox = gtk_hbox_new( FALSE, 5 );
+ ui::Widget hbox = ui::HBox( FALSE, 5 );
gtk_widget_show( hbox );
gtk_box_pack_end( GTK_BOX( mainvbox ), hbox, FALSE, TRUE, 0 );
}
{
- GtkWidget* hbox = gtk_hbox_new( FALSE, 5 );
+ ui::Widget hbox = ui::HBox( FALSE, 5 );
gtk_box_pack_start( GTK_BOX( mainvbox ), hbox, TRUE, TRUE, 0 );
gtk_widget_show( hbox );
{
- GtkWidget* sc_win = gtk_scrolled_window_new( 0, 0 );
+ ui::Widget sc_win = ui::ScrolledWindow();
gtk_scrolled_window_set_policy( GTK_SCROLLED_WINDOW( sc_win ), GTK_POLICY_NEVER, GTK_POLICY_AUTOMATIC );
gtk_box_pack_start( GTK_BOX( hbox ), sc_win, FALSE, FALSE, 0 );
gtk_widget_show( sc_win );
gtk_scrolled_window_set_shadow_type( GTK_SCROLLED_WINDOW( sc_win ), GTK_SHADOW_IN );
// prefs pages notebook
- m_notebook = gtk_notebook_new();
+ m_notebook = ui::Widget(gtk_notebook_new());
// hide the notebook tabs since its not supposed to look like a notebook
gtk_notebook_set_show_tabs( GTK_NOTEBOOK( m_notebook ), FALSE );
gtk_box_pack_start( GTK_BOX( hbox ), m_notebook, TRUE, TRUE, 0 );
{
GtkTreeStore* store = gtk_tree_store_new( 2, G_TYPE_STRING, G_TYPE_POINTER );
- GtkWidget* view = gtk_tree_view_new_with_model( GTK_TREE_MODEL( store ) );
+ ui::Widget view = ui::TreeView(ui::TreeModel( GTK_TREE_MODEL( store ) ));
gtk_tree_view_set_headers_visible( GTK_TREE_VIEW( view ), FALSE );
{
- GtkCellRenderer* renderer = gtk_cell_renderer_text_new();
- GtkTreeViewColumn* column = gtk_tree_view_column_new_with_attributes( "Preferences", renderer, "text", 0, NULL );
+ auto renderer = ui::CellRendererText();
+ GtkTreeViewColumn* column = ui::TreeViewColumn( "Preferences", renderer, {{"text", 0}} );
gtk_tree_view_append_column( GTK_TREE_VIEW( view ), column );
}
PreferencePages_addPage( m_notebook, "Front Page" );
{
- GtkWidget* global = PreferencePages_addPage( m_notebook, "Global Preferences" );
+ ui::Widget global = PreferencePages_addPage( m_notebook, "Global Preferences" );
{
PreferencesPage preferencesPage( *this, getVBox( global ) );
Global_constructPreferences( preferencesPage );
}
GtkTreeIter group = PreferenceTree_appendPage( store, 0, "Global", global );
{
- GtkWidget* game = PreferencePages_addPage( m_notebook, "Game" );
+ ui::Widget game = PreferencePages_addPage( m_notebook, "Game" );
PreferencesPage preferencesPage( *this, getVBox( game ) );
g_GamesDialog.CreateGlobalFrame( preferencesPage );
}
{
- GtkWidget* interfacePage = PreferencePages_addPage( m_notebook, "Interface Preferences" );
+ ui::Widget interfacePage = PreferencePages_addPage( m_notebook, "Interface Preferences" );
{
PreferencesPage preferencesPage( *this, getVBox( interfacePage ) );
PreferencesPageCallbacks_constructPage( g_interfacePreferences, preferencesPage );
}
{
- GtkWidget* display = PreferencePages_addPage( m_notebook, "Display Preferences" );
+ ui::Widget display = PreferencePages_addPage( m_notebook, "Display Preferences" );
{
PreferencesPage preferencesPage( *this, getVBox( display ) );
PreferencesPageCallbacks_constructPage( g_displayPreferences, preferencesPage );
}
{
- GtkWidget* settings = PreferencePages_addPage( m_notebook, "General Settings" );
+ ui::Widget settings = PreferencePages_addPage( m_notebook, "General Settings" );
{
PreferencesPage preferencesPage( *this, getVBox( settings ) );
PreferencesPageCallbacks_constructPage( g_settingsPreferences, preferencesPage );
}
}
- gtk_notebook_set_page( GTK_NOTEBOOK( m_notebook ), 0 );
+ gtk_notebook_set_current_page( GTK_NOTEBOOK( m_notebook ), 0 );
return dialog;
}
PrefsDlg g_Preferences; // global prefs instance
-void PreferencesDialog_constructWindow( GtkWindow* main_window ){
+void PreferencesDialog_constructWindow( ui::Window main_window ){
g_Preferences.m_parent = main_window;
g_Preferences.Create();
}
{
message << ( *i ) << '\n';
}
- gtk_MessageBox( GTK_WIDGET( MainFrame_getWindow() ), message.c_str() );
+ MainFrame_getWindow().alert( message.c_str() );
g_restart_required.clear();
}
}
#include <list>
#include <map>
-void Widget_connectToggleDependency( GtkWidget* self, GtkWidget* toggleButton );
+void Widget_connectToggleDependency( ui::Widget self, ui::Widget toggleButton );
class PreferencesPage
{
Dialog& m_dialog;
-GtkWidget* m_vbox;
+ui::Widget m_vbox;
public:
-PreferencesPage( Dialog& dialog, GtkWidget* vbox ) : m_dialog( dialog ), m_vbox( vbox ){
+PreferencesPage( Dialog& dialog, ui::Widget vbox ) : m_dialog( dialog ), m_vbox( vbox ){
}
-GtkWidget* appendCheckBox( const char* name, const char* flag, bool& data ){
+ui::CheckButton appendCheckBox( const char* name, const char* flag, bool& data ){
return m_dialog.addCheckBox( m_vbox, name, flag, data );
}
-GtkWidget* appendCheckBox( const char* name, const char* flag, const BoolImportCallback& importCallback, const BoolExportCallback& exportCallback ){
+ui::CheckButton appendCheckBox( const char* name, const char* flag, const BoolImportCallback& importCallback, const BoolExportCallback& exportCallback ){
return m_dialog.addCheckBox( m_vbox, name, flag, importCallback, exportCallback );
}
void appendCombo( const char* name, StringArrayRange values, const IntImportCallback& importCallback, const IntExportCallback& exportCallback ){
void appendRadioIcons( const char* name, int& data, StringArrayRange icons ){
m_dialog.addRadioIcons( m_vbox, name, data, icons );
}
-GtkWidget* appendEntry( const char* name, const IntImportCallback& importCallback, const IntExportCallback& exportCallback ){
+ui::Widget appendEntry( const char* name, const IntImportCallback& importCallback, const IntExportCallback& exportCallback ){
return m_dialog.addIntEntry( m_vbox, name, importCallback, exportCallback );
}
-GtkWidget* appendEntry( const char* name, int& data ){
+ui::Widget appendEntry( const char* name, int& data ){
return m_dialog.addEntry( m_vbox, name, data );
}
-GtkWidget* appendEntry( const char* name, const SizeImportCallback& importCallback, const SizeExportCallback& exportCallback ){
+ui::Widget appendEntry( const char* name, const SizeImportCallback& importCallback, const SizeExportCallback& exportCallback ){
return m_dialog.addSizeEntry( m_vbox, name, importCallback, exportCallback );
}
-GtkWidget* appendEntry( const char* name, std::size_t& data ){
+ui::Widget appendEntry( const char* name, std::size_t& data ){
return m_dialog.addEntry( m_vbox, name, data );
}
-GtkWidget* appendEntry( const char* name, const FloatImportCallback& importCallback, const FloatExportCallback& exportCallback ){
+ui::Widget appendEntry( const char* name, const FloatImportCallback& importCallback, const FloatExportCallback& exportCallback ){
return m_dialog.addFloatEntry( m_vbox, name, importCallback, exportCallback );
}
-GtkWidget* appendEntry( const char* name, float& data ){
+ui::Widget appendEntry( const char* name, float& data ){
return m_dialog.addEntry( m_vbox, name, data );
}
-GtkWidget* appendPathEntry( const char* name, bool browse_directory, const StringImportCallback& importCallback, const StringExportCallback& exportCallback ){
+ui::Widget appendPathEntry( const char* name, bool browse_directory, const StringImportCallback& importCallback, const StringExportCallback& exportCallback ){
return m_dialog.addPathEntry( m_vbox, name, browse_directory, importCallback, exportCallback );
}
-GtkWidget* appendPathEntry( const char* name, CopiedString& data, bool directory ){
+ui::Widget appendPathEntry( const char* name, CopiedString& data, bool directory ){
return m_dialog.addPathEntry( m_vbox, name, data, directory );
}
-GtkWidget* appendSpinner( const char* name, int& data, double value, double lower, double upper ){
+ui::SpinButton appendSpinner( const char* name, int& data, double value, double lower, double upper ){
return m_dialog.addSpinner( m_vbox, name, data, value, lower, upper );
}
-GtkWidget* appendSpinner( const char* name, double value, double lower, double upper, const IntImportCallback& importCallback, const IntExportCallback& exportCallback ){
+ui::SpinButton appendSpinner( const char* name, double value, double lower, double upper, const IntImportCallback& importCallback, const IntExportCallback& exportCallback ){
return m_dialog.addSpinner( m_vbox, name, value, lower, upper, importCallback, exportCallback );
}
-GtkWidget* appendSpinner( const char* name, double value, double lower, double upper, const FloatImportCallback& importCallback, const FloatExportCallback& exportCallback ){
+ui::SpinButton appendSpinner( const char* name, double value, double lower, double upper, const FloatImportCallback& importCallback, const FloatExportCallback& exportCallback ){
return m_dialog.addSpinner( m_vbox, name, value, lower, upper, importCallback, exportCallback );
}
};
extern CGameDescription *g_pGameDescription;
-typedef struct _GtkWidget GtkWidget;
class PrefsDlg;
class PreferencesPage;
Dialog API
this is only called when the dialog is built at startup for main engine select
*/
-GtkWindow* BuildDialog();
+ui::Window BuildDialog();
void GameFileImport( int value );
void GameFileExport( const IntImportCallback& importCallback ) const;
public:
-GtkWidget *m_notebook;
+ui::Widget m_notebook;
virtual ~PrefsDlg(){
g_string_free( m_rc_path, true );
void Init();
/*! Utility function for swapping notebook pages for tree list selections */
-void showPrefPage( GtkWidget* prefpage );
+void showPrefPage( ui::Widget prefpage );
protected:
/*! Dialog API */
-GtkWindow* BuildDialog();
+ui::Window BuildDialog();
void PostModal( EMessageBoxReturn code );
};
};
extern preferences_globals_t g_preferences_globals;
-typedef struct _GtkWindow GtkWindow;
-void PreferencesDialog_constructWindow( GtkWindow* main_window );
+void PreferencesDialog_constructWindow( ui::Window main_window );
void PreferencesDialog_destroyWindow();
void PreferencesDialog_showDialog();
#include <map>
-#include <gtk/gtktearoffmenuitem.h>
+#include <gtk/gtk.h>
+#include <uilib/uilib.h>
#include "stream/textfilestream.h"
#include "cmdlib.h"
return true;
}
- EMessageBoxReturn result = gtk_MessageBox( GTK_WIDGET( MainFrame_getWindow() ), "The current map has changed since it was last saved.\nDo you want to save the current map before continuing?", title, eMB_YESNOCANCEL, eMB_ICONQUESTION );
- if ( result == eIDCANCEL ) {
+ auto result = MainFrame_getWindow().alert( "The current map has changed since it was last saved.\nDo you want to save the current map before continuing?", title, ui::alert_type::YESNOCANCEL, ui::alert_icon::Question );
+ if ( result == ui::alert_response::CANCEL ) {
return false;
}
- if ( result == eIDYES ) {
+ if ( result == ui::alert_response::YES ) {
if ( Map_Unnamed( g_map ) ) {
return Map_SaveAs();
}
title << " *";
}
- gtk_window_set_title( MainFrame_getWindow(), title.c_str() );
+ gtk_window_set_title(MainFrame_getWindow(), title.c_str() );
}
bool g_bWaitCursor = false;
void Sys_BeginWait( void ){
ScreenUpdates_Disable( "Processing...", "Please Wait" );
GdkCursor *cursor = gdk_cursor_new( GDK_WATCH );
- gdk_window_set_cursor( GTK_WIDGET( MainFrame_getWindow() )->window, cursor );
+ gdk_window_set_cursor( gtk_widget_get_window(MainFrame_getWindow()), cursor );
gdk_cursor_unref( cursor );
g_bWaitCursor = true;
}
void Sys_EndWait( void ){
ScreenUpdates_Enable();
- gdk_window_set_cursor( GTK_WIDGET( MainFrame_getWindow() )->window, 0 );
+ gdk_window_set_cursor(gtk_widget_get_window(MainFrame_getWindow()), 0 );
g_bWaitCursor = false;
}
#include <GL/glx.h>
#include <dlfcn.h>
-#include <gdk/gdkx.h>
Bool ( *qglXQueryExtension )( Display *dpy, int *errorb, int *event );
void* ( *qglXGetProcAddressARB )( const GLubyte * procName );
qwglGetProcAddress = wglGetProcAddress;
#elif defined( XWINDOWS )
qglXGetProcAddressARB = (glXGetProcAddressARBProc)dlsym( RTLD_DEFAULT, "glXGetProcAddressARB" );
- if ( ( qglXQueryExtension == 0 ) || ( qglXQueryExtension( GDK_DISPLAY(),0,0 ) != True ) ) {
+ if ( ( qglXQueryExtension == 0 ) || ( qglXQueryExtension(XOpenDisplay(nullptr), 0, 0) != True ) ) {
return 0;
}
#elif defined (__APPLE__)
#include "gtkdlgs.h"
-#include <gtk/gtkbox.h>
-#include <gtk/gtkspinbutton.h>
-#include <gtk/gtktable.h>
-#include <gtk/gtklabel.h>
+#include <gtk/gtk.h>
#include <gdk/gdkkeysyms.h>
GtkSpinButton* x;
GtkSpinButton* y;
GtkSpinButton* z;
- GtkWindow *window;
+ ui::Window window;
};
-static gboolean rotatedlg_apply( GtkWidget *widget, RotateDialog* rotateDialog ){
+static gboolean rotatedlg_apply( ui::Widget widget, RotateDialog* rotateDialog ){
Vector3 eulerXYZ;
eulerXYZ[0] = static_cast<float>( gtk_spin_button_get_value( rotateDialog->x ) );
return TRUE;
}
-static gboolean rotatedlg_cancel( GtkWidget *widget, RotateDialog* rotateDialog ){
+static gboolean rotatedlg_cancel( ui::Widget widget, RotateDialog* rotateDialog ){
gtk_widget_hide( GTK_WIDGET( rotateDialog->window ) );
gtk_spin_button_set_value( rotateDialog->x, 0.0f ); // reset to 0 on close
return TRUE;
}
-static gboolean rotatedlg_ok( GtkWidget *widget, RotateDialog* rotateDialog ){
+static gboolean rotatedlg_ok( ui::Widget widget, RotateDialog* rotateDialog ){
rotatedlg_apply( widget, rotateDialog );
gtk_widget_hide( GTK_WIDGET( rotateDialog->window ) );
return TRUE;
}
-static gboolean rotatedlg_delete( GtkWidget *widget, GdkEventAny *event, RotateDialog* rotateDialog ){
+static gboolean rotatedlg_delete( ui::Widget widget, GdkEventAny *event, RotateDialog* rotateDialog ){
rotatedlg_cancel( widget, rotateDialog );
return TRUE;
}
RotateDialog g_rotate_dialog;
void DoRotateDlg(){
- if ( g_rotate_dialog.window == NULL ) {
- g_rotate_dialog.window = create_dialog_window( MainFrame_getWindow(), "Arbitrary rotation", G_CALLBACK( rotatedlg_delete ), &g_rotate_dialog );
+ if ( !g_rotate_dialog.window ) {
+ g_rotate_dialog.window = MainFrame_getWindow().create_dialog_window("Arbitrary rotation", G_CALLBACK(rotatedlg_delete ), &g_rotate_dialog );
- GtkAccelGroup* accel = gtk_accel_group_new();
+ GtkAccelGroup* accel = ui::AccelGroup();
gtk_window_add_accel_group( g_rotate_dialog.window, accel );
{
GtkTable* table = create_dialog_table( 3, 2, 4, 4 );
gtk_box_pack_start( GTK_BOX( hbox ), GTK_WIDGET( table ), TRUE, TRUE, 0 );
{
- GtkWidget* label = gtk_label_new( " X " );
+ ui::Widget label = ui::Label( " X " );
gtk_widget_show( label );
gtk_table_attach( table, label, 0, 1, 0, 1,
(GtkAttachOptions) ( 0 ),
(GtkAttachOptions) ( 0 ), 0, 0 );
}
{
- GtkWidget* label = gtk_label_new( " Y " );
+ ui::Widget label = ui::Label( " Y " );
gtk_widget_show( label );
gtk_table_attach( table, label, 0, 1, 1, 2,
(GtkAttachOptions) ( 0 ),
(GtkAttachOptions) ( 0 ), 0, 0 );
}
{
- GtkWidget* label = gtk_label_new( " Z " );
+ ui::Widget label = ui::Label( " Z " );
gtk_widget_show( label );
gtk_table_attach( table, label, 0, 1, 2, 3,
(GtkAttachOptions) ( 0 ),
(GtkAttachOptions) ( 0 ), 0, 0 );
}
{
- GtkAdjustment* adj = GTK_ADJUSTMENT( gtk_adjustment_new( 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 = GTK_ADJUSTMENT( gtk_adjustment_new( 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 = GTK_ADJUSTMENT( gtk_adjustment_new( 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 ),
struct ScaleDialog
{
- GtkWidget* x;
- GtkWidget* y;
- GtkWidget* z;
- GtkWindow *window;
+ ui::Widget x;
+ ui::Widget y;
+ ui::Widget z;
+ ui::Window window;
};
-static gboolean scaledlg_apply( GtkWidget *widget, ScaleDialog* scaleDialog ){
+static gboolean scaledlg_apply( ui::Widget widget, ScaleDialog* scaleDialog ){
float sx, sy, sz;
sx = static_cast<float>( atof( gtk_entry_get_text( GTK_ENTRY( scaleDialog->x ) ) ) );
return TRUE;
}
-static gboolean scaledlg_cancel( GtkWidget *widget, ScaleDialog* scaleDialog ){
+static gboolean scaledlg_cancel( ui::Widget widget, ScaleDialog* scaleDialog ){
gtk_widget_hide( GTK_WIDGET( scaleDialog->window ) );
gtk_entry_set_text( GTK_ENTRY( scaleDialog->x ), "1.0" );
return TRUE;
}
-static gboolean scaledlg_ok( GtkWidget *widget, ScaleDialog* scaleDialog ){
+static gboolean scaledlg_ok( ui::Widget widget, ScaleDialog* scaleDialog ){
scaledlg_apply( widget, scaleDialog );
gtk_widget_hide( GTK_WIDGET( scaleDialog->window ) );
return TRUE;
}
-static gboolean scaledlg_delete( GtkWidget *widget, GdkEventAny *event, ScaleDialog* scaleDialog ){
+static gboolean scaledlg_delete( ui::Widget widget, GdkEventAny *event, ScaleDialog* scaleDialog ){
scaledlg_cancel( widget, scaleDialog );
return TRUE;
}
ScaleDialog g_scale_dialog;
void DoScaleDlg(){
- if ( g_scale_dialog.window == NULL ) {
- g_scale_dialog.window = create_dialog_window( MainFrame_getWindow(), "Arbitrary scale", G_CALLBACK( scaledlg_delete ), &g_scale_dialog );
+ if ( !g_scale_dialog.window ) {
+ g_scale_dialog.window = MainFrame_getWindow().create_dialog_window("Arbitrary scale", G_CALLBACK(scaledlg_delete ), &g_scale_dialog );
- GtkAccelGroup* accel = gtk_accel_group_new();
+ GtkAccelGroup* accel = ui::AccelGroup();
gtk_window_add_accel_group( g_scale_dialog.window, accel );
{
GtkTable* table = create_dialog_table( 3, 2, 4, 4 );
gtk_box_pack_start( GTK_BOX( hbox ), GTK_WIDGET( table ), TRUE, TRUE, 0 );
{
- GtkWidget* label = gtk_label_new( " X " );
+ ui::Widget label = ui::Label( " X " );
gtk_widget_show( label );
gtk_table_attach( table, label, 0, 1, 0, 1,
(GtkAttachOptions) ( 0 ),
(GtkAttachOptions) ( 0 ), 0, 0 );
}
{
- GtkWidget* label = gtk_label_new( " Y " );
+ ui::Widget label = ui::Label( " Y " );
gtk_widget_show( label );
gtk_table_attach( table, label, 0, 1, 1, 2,
(GtkAttachOptions) ( 0 ),
(GtkAttachOptions) ( 0 ), 0, 0 );
}
{
- GtkWidget* label = gtk_label_new( " Z " );
+ ui::Widget label = ui::Label( " Z " );
gtk_widget_show( label );
gtk_table_attach( table, label, 0, 1, 2, 3,
(GtkAttachOptions) ( 0 ),
(GtkAttachOptions) ( 0 ), 0, 0 );
}
{
- GtkWidget* entry = gtk_entry_new();
+ ui::Widget entry = ui::Entry();
gtk_entry_set_text( GTK_ENTRY( entry ), "1.0" );
gtk_widget_show( entry );
gtk_table_attach( table, entry, 1, 2, 0, 1,
g_scale_dialog.x = entry;
}
{
- GtkWidget* entry = gtk_entry_new();
+ ui::Widget entry = ui::Entry();
gtk_entry_set_text( GTK_ENTRY( entry ), "1.0" );
gtk_widget_show( entry );
gtk_table_attach( table, entry, 1, 2, 1, 2,
g_scale_dialog.y = entry;
}
{
- GtkWidget* entry = gtk_entry_new();
+ ui::Widget entry = ui::Entry();
gtk_entry_set_text( GTK_ENTRY( entry ), "1.0" );
gtk_widget_show( entry );
gtk_table_attach( table, entry, 1, 2, 2, 3,
#include <dlfcn.h>
-class DynamicLibrary
-{
-void* m_library;
+class DynamicLibrary {
+ void *m_library;
public:
typedef int ( *FunctionPointer )();
#include "iundo.h"
#include "iselection.h"
-#include <gtk/gtkhbox.h>
-#include <gtk/gtkvbox.h>
-#include <gtk/gtkframe.h>
-#include <gtk/gtklabel.h>
-#include <gtk/gtktable.h>
-#include <gtk/gtkbutton.h>
-#include <gtk/gtkspinbutton.h>
+#include <gtk/gtk.h>
#include <gdk/gdkkeysyms.h>
-#include <gtk/gtkcheckbutton.h> //Shamus: For Textool
#include "signal/isignal.h"
#include "generic/object.h"
{
//Shamus: Textool function prototypes
-gboolean size_allocate( GtkWidget *, GtkAllocation *, gpointer );
-gboolean expose( GtkWidget *, GdkEventExpose *, gpointer );
-gboolean button_press( GtkWidget *, GdkEventButton *, gpointer );
-gboolean button_release( GtkWidget *, GdkEventButton *, gpointer );
-gboolean motion( GtkWidget *, GdkEventMotion *, gpointer );
+gboolean size_allocate( ui::Widget, GtkAllocation *, gpointer );
+gboolean expose( ui::Widget, GdkEventExpose *, gpointer );
+gboolean button_press( ui::Widget, GdkEventButton *, gpointer );
+gboolean button_release( ui::Widget, GdkEventButton *, gpointer );
+gboolean motion( ui::Widget, GdkEventMotion *, gpointer );
void flipX( GtkToggleButton *, gpointer );
void flipY( GtkToggleButton *, gpointer );
//End Textool function prototypes
//Shamus: Textool globals
-GtkWidget * g_textoolWin;
+ui::Widget g_textoolWin;
//End Textool globals
void queueDraw(){
inline void spin_button_set_step( GtkSpinButton* spin, gfloat step ){
#if 1
- gtk_spin_button_get_adjustment( spin )->step_increment = step;
+ gtk_adjustment_set_step_increment(gtk_spin_button_get_adjustment( spin ), step);
#else
GValue gvalue = GValue_default();
g_value_init( &gvalue, G_TYPE_DOUBLE );
class SurfaceInspector : public Dialog
{
-GtkWindow* BuildDialog();
+ui::Window BuildDialog();
NonModalEntry m_textureEntry;
NonModalSpinner m_hshiftSpinner;
m_positionTracker.setPosition( c_default_window_pos );
}
-void constructWindow( GtkWindow* main_window ){
+void constructWindow( ui::Window main_window ){
m_parent = main_window;
Create();
AddGridChangeCallback( FreeCaller<SurfaceInspector_GridChange>() );
Destroy();
}
bool visible() const {
- return GTK_WIDGET_VISIBLE( const_cast<GtkWindow*>( GetWidget() ) );
+ return gtk_widget_get_visible( GetWidget() );
}
void queueDraw(){
if ( visible() ) {
}
}
-void SurfaceInspector_constructWindow( GtkWindow* main_window ){
+void SurfaceInspector_constructWindow( ui::Window main_window ){
getSurfaceInspector().constructWindow( main_window );
}
void SurfaceInspector_destroyWindow(){
// we move the textures in pixels, not world units. (i.e. increment values are in pixel)
// depending on the texture scale it doesn't take the same amount of pixels to move of GetGridSize()
// increment * scale = gridsize
-static void OnBtnMatchGrid( GtkWidget *widget, gpointer data ){
+static void OnBtnMatchGrid( ui::Widget widget, gpointer data ){
float hscale, vscale;
- hscale = static_cast<float>( gtk_spin_button_get_value_as_float( getSurfaceInspector().m_hscaleIncrement.m_spin ) );
- vscale = static_cast<float>( gtk_spin_button_get_value_as_float( getSurfaceInspector().m_vscaleIncrement.m_spin ) );
+ hscale = static_cast<float>( gtk_spin_button_get_value( getSurfaceInspector().m_hscaleIncrement.m_spin ) );
+ vscale = static_cast<float>( gtk_spin_button_get_value( getSurfaceInspector().m_vscaleIncrement.m_spin ) );
if ( hscale == 0.0f || vscale == 0.0f ) {
globalOutputStream() << "ERROR: unexpected scale == 0.0f\n";
// or update it because something new has been selected
// Shamus: It does get called when the SI is hidden, but not when you select something new. ;-)
void DoSurface( void ){
- if ( getSurfaceInspector().GetWidget() == 0 ) {
+ if ( !getSurfaceInspector().GetWidget() ) {
getSurfaceInspector().Create();
}
Select_FitTexture( getSurfaceInspector().m_fitHorizontal, getSurfaceInspector().m_fitVertical );
}
-static void OnBtnPatchdetails( GtkWidget *widget, gpointer data ){
+static void OnBtnPatchdetails( ui::Widget widget, gpointer data ){
Patch_CapTexture();
}
-static void OnBtnPatchnatural( GtkWidget *widget, gpointer data ){
+static void OnBtnPatchnatural( ui::Widget widget, gpointer data ){
Patch_NaturalTexture();
}
-static void OnBtnPatchreset( GtkWidget *widget, gpointer data ){
+static void OnBtnPatchreset( ui::Widget widget, gpointer data ){
Patch_ResetTexture();
}
-static void OnBtnPatchFit( GtkWidget *widget, gpointer data ){
+static void OnBtnPatchFit( ui::Widget widget, gpointer data ){
Patch_FitTexture();
}
-static void OnBtnAxial( GtkWidget *widget, gpointer data ){
+static void OnBtnAxial( ui::Widget widget, gpointer data ){
//globalOutputStream() << "--> [OnBtnAxial]...\n";
UndoableCommand undo( "textureDefault" );
TextureProjection projection;
Select_SetTexdef( projection );
}
-static void OnBtnFaceFit( GtkWidget *widget, gpointer data ){
+static void OnBtnFaceFit( ui::Widget widget, gpointer data ){
getSurfaceInspector().exportData();
SurfaceInspector_FitTexture();
}
return g_signal_connect_swapped( G_OBJECT( button ), "toggled", G_CALLBACK( callback.getThunk() ), callback.getEnvironment() );
}
-GtkWindow* SurfaceInspector::BuildDialog(){
- GtkWindow* window = create_floating_window( "Surface Inspector", m_parent );
+ui::Window SurfaceInspector::BuildDialog(){
+ ui::Window window = ui::Window(create_floating_window( "Surface Inspector", m_parent ));
m_positionTracker.connect( window );
{
// replaced by only the vbox:
- GtkWidget* vbox = gtk_vbox_new( FALSE, 5 );
+ ui::Widget vbox = ui::VBox( FALSE, 5 );
gtk_widget_show( vbox );
gtk_container_add( GTK_CONTAINER( window ), GTK_WIDGET( vbox ) );
gtk_container_set_border_width( GTK_CONTAINER( vbox ), 5 );
{
- GtkWidget* hbox2 = gtk_hbox_new( FALSE, 5 );
+ ui::Widget hbox2 = ui::HBox( FALSE, 5 );
gtk_widget_show( hbox2 );
gtk_box_pack_start( GTK_BOX( vbox ), GTK_WIDGET( hbox2 ), FALSE, FALSE, 0 );
{
- GtkWidget* label = gtk_label_new( "Texture" );
+ ui::Widget label = ui::Label( "Texture" );
gtk_widget_show( label );
gtk_box_pack_start( GTK_BOX( hbox2 ), label, FALSE, TRUE, 0 );
}
{
- GtkEntry* entry = GTK_ENTRY( gtk_entry_new() );
+ GtkEntry* entry = ui::Entry();
gtk_widget_show( GTK_WIDGET( entry ) );
gtk_box_pack_start( GTK_BOX( hbox2 ), GTK_WIDGET( entry ), TRUE, TRUE, 0 );
m_texture = entry;
{
- GtkWidget* table = gtk_table_new( 6, 4, FALSE );
+ ui::Widget table = ui::Table( 6, 4, FALSE );
gtk_widget_show( table );
gtk_box_pack_start( GTK_BOX( vbox ), GTK_WIDGET( table ), FALSE, FALSE, 0 );
gtk_table_set_row_spacings( GTK_TABLE( table ), 5 );
gtk_table_set_col_spacings( GTK_TABLE( table ), 5 );
{
- GtkWidget* label = gtk_label_new( "Horizontal shift" );
+ ui::Widget label = ui::Label( "Horizontal shift" );
gtk_widget_show( label );
gtk_misc_set_alignment( GTK_MISC( label ), 0, 0 );
gtk_table_attach( GTK_TABLE( table ), label, 0, 1, 0, 1,
(GtkAttachOptions) ( 0 ), 0, 0 );
}
{
- GtkSpinButton* spin = GTK_SPIN_BUTTON( gtk_spin_button_new( GTK_ADJUSTMENT( gtk_adjustment_new( 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 ) );
gtk_table_attach( GTK_TABLE( table ), GTK_WIDGET( spin ), 1, 2, 0, 1,
(GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ),
(GtkAttachOptions) ( 0 ), 0, 0 );
- gtk_widget_set_usize( GTK_WIDGET( spin ), 60, -2 );
+ gtk_widget_set_size_request( GTK_WIDGET( spin ), 60, -1 );
}
{
- GtkWidget* label = gtk_label_new( "Step" );
+ ui::Widget label = ui::Label( "Step" );
gtk_widget_show( label );
gtk_misc_set_alignment( GTK_MISC( label ), 0, 0 );
gtk_table_attach( GTK_TABLE( table ), label, 2, 3, 0, 1,
(GtkAttachOptions) ( 0 ), 0, 0 );
}
{
- GtkEntry* entry = GTK_ENTRY( gtk_entry_new() );
+ GtkEntry* entry = ui::Entry();
gtk_widget_show( GTK_WIDGET( entry ) );
gtk_table_attach( GTK_TABLE( table ), GTK_WIDGET( entry ), 3, 4, 0, 1,
(GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ),
(GtkAttachOptions) ( 0 ), 0, 0 );
- gtk_widget_set_usize( GTK_WIDGET( entry ), 50, -2 );
+ gtk_widget_set_size_request( GTK_WIDGET( entry ), 50, -1 );
m_hshiftIncrement.m_entry = entry;
m_hshiftEntry.connect( entry );
}
{
- GtkWidget* label = gtk_label_new( "Vertical shift" );
+ ui::Widget label = ui::Label( "Vertical shift" );
gtk_widget_show( label );
gtk_misc_set_alignment( GTK_MISC( label ), 0, 0 );
gtk_table_attach( GTK_TABLE( table ), label, 0, 1, 1, 2,
(GtkAttachOptions) ( 0 ), 0, 0 );
}
{
- GtkSpinButton* spin = GTK_SPIN_BUTTON( gtk_spin_button_new( GTK_ADJUSTMENT( gtk_adjustment_new( 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 ) );
gtk_table_attach( GTK_TABLE( table ), GTK_WIDGET( spin ), 1, 2, 1, 2,
(GtkAttachOptions) ( GTK_FILL ),
(GtkAttachOptions) ( 0 ), 0, 0 );
- gtk_widget_set_usize( GTK_WIDGET( spin ), 60, -2 );
+ gtk_widget_set_size_request( GTK_WIDGET( spin ), 60, -1 );
}
{
- GtkWidget* label = gtk_label_new( "Step" );
+ ui::Widget label = ui::Label( "Step" );
gtk_widget_show( label );
gtk_misc_set_alignment( GTK_MISC( label ), 0, 0 );
gtk_table_attach( GTK_TABLE( table ), label, 2, 3, 1, 2,
(GtkAttachOptions) ( 0 ), 0, 0 );
}
{
- GtkEntry* entry = GTK_ENTRY( gtk_entry_new() );
+ GtkEntry* entry = ui::Entry();
gtk_widget_show( GTK_WIDGET( entry ) );
gtk_table_attach( GTK_TABLE( table ), GTK_WIDGET( entry ), 3, 4, 1, 2,
(GtkAttachOptions) ( GTK_FILL ),
(GtkAttachOptions) ( 0 ), 0, 0 );
- gtk_widget_set_usize( GTK_WIDGET( entry ), 50, -2 );
+ gtk_widget_set_size_request( GTK_WIDGET( entry ), 50, -1 );
m_vshiftIncrement.m_entry = entry;
m_vshiftEntry.connect( entry );
}
{
- GtkWidget* label = gtk_label_new( "Horizontal stretch" );
+ ui::Widget label = ui::Label( "Horizontal stretch" );
gtk_widget_show( label );
gtk_misc_set_alignment( GTK_MISC( label ), 0, 0 );
gtk_table_attach( GTK_TABLE( table ), label, 0, 1, 2, 3,
(GtkAttachOptions) ( 0 ), 0, 0 );
}
{
- GtkSpinButton* spin = GTK_SPIN_BUTTON( gtk_spin_button_new( GTK_ADJUSTMENT( gtk_adjustment_new( 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 ) );
gtk_table_attach( GTK_TABLE( table ), GTK_WIDGET( spin ), 1, 2, 2, 3,
(GtkAttachOptions) ( GTK_FILL ),
(GtkAttachOptions) ( 0 ), 0, 0 );
- gtk_widget_set_usize( GTK_WIDGET( spin ), 60, -2 );
+ gtk_widget_set_size_request( GTK_WIDGET( spin ), 60, -1 );
}
{
- GtkWidget* label = gtk_label_new( "Step" );
+ ui::Widget label = ui::Label( "Step" );
gtk_widget_show( label );
gtk_misc_set_alignment( GTK_MISC( label ), 0, 0 );
gtk_table_attach( GTK_TABLE( table ), label, 2, 3, 2, 3,
(GtkAttachOptions) ( 0 ), 2, 3 );
}
{
- GtkEntry* entry = GTK_ENTRY( gtk_entry_new() );
+ GtkEntry* entry = ui::Entry();
gtk_widget_show( GTK_WIDGET( entry ) );
gtk_table_attach( GTK_TABLE( table ), GTK_WIDGET( entry ), 3, 4, 2, 3,
(GtkAttachOptions) ( GTK_FILL ),
(GtkAttachOptions) ( 0 ), 2, 3 );
- gtk_widget_set_usize( GTK_WIDGET( entry ), 50, -2 );
+ gtk_widget_set_size_request( GTK_WIDGET( entry ), 50, -1 );
m_hscaleIncrement.m_entry = entry;
m_hscaleEntry.connect( entry );
}
{
- GtkWidget* label = gtk_label_new( "Vertical stretch" );
+ ui::Widget label = ui::Label( "Vertical stretch" );
gtk_widget_show( label );
gtk_misc_set_alignment( GTK_MISC( label ), 0, 0 );
gtk_table_attach( GTK_TABLE( table ), label, 0, 1, 3, 4,
(GtkAttachOptions) ( 0 ), 0, 0 );
}
{
- GtkSpinButton* spin = GTK_SPIN_BUTTON( gtk_spin_button_new( GTK_ADJUSTMENT( gtk_adjustment_new( 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 ) );
gtk_table_attach( GTK_TABLE( table ), GTK_WIDGET( spin ), 1, 2, 3, 4,
(GtkAttachOptions) ( GTK_FILL ),
(GtkAttachOptions) ( 0 ), 0, 0 );
- gtk_widget_set_usize( GTK_WIDGET( spin ), 60, -2 );
+ gtk_widget_set_size_request( GTK_WIDGET( spin ), 60, -1 );
}
{
- GtkWidget* label = gtk_label_new( "Step" );
+ ui::Widget label = ui::Label( "Step" );
gtk_widget_show( label );
gtk_misc_set_alignment( GTK_MISC( label ), 0, 0 );
gtk_table_attach( GTK_TABLE( table ), label, 2, 3, 3, 4,
(GtkAttachOptions) ( 0 ), 0, 0 );
}
{
- GtkEntry* entry = GTK_ENTRY( gtk_entry_new() );
+ GtkEntry* entry = ui::Entry();
gtk_widget_show( GTK_WIDGET( entry ) );
gtk_table_attach( GTK_TABLE( table ), GTK_WIDGET( entry ), 3, 4, 3, 4,
(GtkAttachOptions) ( GTK_FILL ),
(GtkAttachOptions) ( 0 ), 0, 0 );
- gtk_widget_set_usize( GTK_WIDGET( entry ), 50, -2 );
+ gtk_widget_set_size_request( GTK_WIDGET( entry ), 50, -1 );
m_vscaleIncrement.m_entry = entry;
m_vscaleEntry.connect( entry );
}
{
- GtkWidget* label = gtk_label_new( "Rotate" );
+ ui::Widget label = ui::Label( "Rotate" );
gtk_widget_show( label );
gtk_misc_set_alignment( GTK_MISC( label ), 0, 0 );
gtk_table_attach( GTK_TABLE( table ), label, 0, 1, 4, 5,
(GtkAttachOptions) ( 0 ), 0, 0 );
}
{
- GtkSpinButton* spin = GTK_SPIN_BUTTON( gtk_spin_button_new( GTK_ADJUSTMENT( gtk_adjustment_new( 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_table_attach( GTK_TABLE( table ), GTK_WIDGET( spin ), 1, 2, 4, 5,
(GtkAttachOptions) ( GTK_FILL ),
(GtkAttachOptions) ( 0 ), 0, 0 );
- gtk_widget_set_usize( GTK_WIDGET( spin ), 60, -2 );
+ gtk_widget_set_size_request( GTK_WIDGET( spin ), 60, -1 );
gtk_spin_button_set_wrap( spin, TRUE );
}
{
- GtkWidget* label = gtk_label_new( "Step" );
+ ui::Widget label = ui::Label( "Step" );
gtk_widget_show( label );
gtk_misc_set_alignment( GTK_MISC( label ), 0, 0 );
gtk_table_attach( GTK_TABLE( table ), label, 2, 3, 4, 5,
(GtkAttachOptions) ( 0 ), 0, 0 );
}
{
- GtkEntry* entry = GTK_ENTRY( gtk_entry_new() );
+ GtkEntry* entry = ui::Entry();
gtk_widget_show( GTK_WIDGET( entry ) );
gtk_table_attach( GTK_TABLE( table ), GTK_WIDGET( entry ), 3, 4, 4, 5,
(GtkAttachOptions) ( GTK_FILL ),
(GtkAttachOptions) ( 0 ), 0, 0 );
- gtk_widget_set_usize( GTK_WIDGET( entry ), 50, -2 );
+ gtk_widget_set_size_request( GTK_WIDGET( entry ), 50, -1 );
m_rotateIncrement.m_entry = entry;
m_rotateEntry.connect( entry );
}
{
// match grid button
- GtkWidget* button = 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 ),
}
{
- GtkWidget* frame = gtk_frame_new( "Texturing" );
+ ui::Widget frame = ui::Frame( "Texturing" );
gtk_widget_show( frame );
gtk_box_pack_start( GTK_BOX( vbox ), GTK_WIDGET( frame ), FALSE, FALSE, 0 );
{
- GtkWidget* table = gtk_table_new( 4, 4, FALSE );
+ ui::Widget table = ui::Table( 4, 4, FALSE );
gtk_widget_show( table );
gtk_container_add( GTK_CONTAINER( frame ), table );
gtk_table_set_row_spacings( GTK_TABLE( table ), 5 );
gtk_table_set_col_spacings( GTK_TABLE( table ), 5 );
gtk_container_set_border_width( GTK_CONTAINER( table ), 5 );
{
- GtkWidget* label = gtk_label_new( "Brush" );
+ ui::Widget label = ui::Label( "Brush" );
gtk_widget_show( label );
gtk_table_attach( GTK_TABLE( table ), label, 0, 1, 0, 1,
(GtkAttachOptions) ( GTK_FILL ),
(GtkAttachOptions) ( 0 ), 0, 0 );
}
{
- GtkWidget* label = gtk_label_new( "Patch" );
+ ui::Widget label = ui::Label( "Patch" );
gtk_widget_show( label );
gtk_table_attach( GTK_TABLE( table ), label, 0, 1, 2, 3,
(GtkAttachOptions) ( GTK_FILL ),
(GtkAttachOptions) ( 0 ), 0, 0 );
}
{
- GtkWidget* label = gtk_label_new( "Width" );
+ ui::Widget label = ui::Label( "Width" );
gtk_widget_show( label );
gtk_table_attach( GTK_TABLE( table ), label, 2, 3, 0, 1,
(GtkAttachOptions) ( GTK_FILL ),
(GtkAttachOptions) ( 0 ), 0, 0 );
}
{
- GtkWidget* label = gtk_label_new( "Height" );
+ ui::Widget label = ui::Label( "Height" );
gtk_widget_show( label );
gtk_table_attach( GTK_TABLE( table ), label, 3, 4, 0, 1,
(GtkAttachOptions) ( GTK_FILL ),
(GtkAttachOptions) ( 0 ), 0, 0 );
}
{
- GtkWidget* button = 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 ),
(GtkAttachOptions) ( 0 ), 0, 0 );
g_signal_connect( G_OBJECT( button ), "clicked",
G_CALLBACK( OnBtnAxial ), 0 );
- gtk_widget_set_usize( button, 60, -2 );
+ gtk_widget_set_size_request( button, 60, -1 );
}
{
- GtkWidget* button = 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 ),
(GtkAttachOptions) ( 0 ), 0, 0 );
g_signal_connect( G_OBJECT( button ), "clicked",
G_CALLBACK( OnBtnFaceFit ), 0 );
- gtk_widget_set_usize( button, 60, -2 );
+ gtk_widget_set_size_request( button, 60, -1 );
}
{
- GtkWidget* button = 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 ),
(GtkAttachOptions) ( 0 ), 0, 0 );
g_signal_connect( G_OBJECT( button ), "clicked",
G_CALLBACK( OnBtnPatchdetails ), 0 );
- gtk_widget_set_usize( button, 60, -2 );
+ gtk_widget_set_size_request( button, 60, -1 );
}
{
- GtkWidget* button = 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 ),
(GtkAttachOptions) ( 0 ), 0, 0 );
g_signal_connect( G_OBJECT( button ), "clicked",
G_CALLBACK( OnBtnPatchreset ), 0 );
- gtk_widget_set_usize( button, 60, -2 );
+ gtk_widget_set_size_request( button, 60, -1 );
}
{
- GtkWidget* button = 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 ),
(GtkAttachOptions) ( 0 ), 0, 0 );
g_signal_connect( G_OBJECT( button ), "clicked",
G_CALLBACK( OnBtnPatchnatural ), 0 );
- gtk_widget_set_usize( button, 60, -2 );
+ gtk_widget_set_size_request( button, 60, -1 );
}
{
- GtkWidget* button = 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 ),
(GtkAttachOptions) ( 0 ), 0, 0 );
g_signal_connect( G_OBJECT( button ), "clicked",
G_CALLBACK( OnBtnPatchFit ), 0 );
- gtk_widget_set_usize( button, 60, -2 );
+ gtk_widget_set_size_request( button, 60, -1 );
}
{
- GtkWidget* spin = gtk_spin_button_new( GTK_ADJUSTMENT( gtk_adjustment_new( 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 ),
(GtkAttachOptions) ( 0 ), 0, 0 );
- gtk_widget_set_usize( spin, 60, -2 );
+ gtk_widget_set_size_request( spin, 60, -1 );
AddDialogData( *GTK_SPIN_BUTTON( spin ), m_fitHorizontal );
}
{
- GtkWidget* spin = gtk_spin_button_new( GTK_ADJUSTMENT( gtk_adjustment_new( 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 ),
(GtkAttachOptions) ( 0 ), 0, 0 );
- gtk_widget_set_usize( spin, 60, -2 );
+ gtk_widget_set_size_request( spin, 60, -1 );
AddDialogData( *GTK_SPIN_BUTTON( spin ), m_fitVertical );
}
}
}
if ( !string_empty( g_pGameDescription->getKeyValue( "si_flags" ) ) ) {
{
- GtkFrame* frame = GTK_FRAME( gtk_frame_new( "Surface Flags" ) );
+ GtkFrame* frame = ui::Frame( "Surface Flags" );
gtk_widget_show( GTK_WIDGET( frame ) );
gtk_box_pack_start( GTK_BOX( vbox ), GTK_WIDGET( frame ), TRUE, TRUE, 0 );
{
- GtkVBox* vbox3 = GTK_VBOX( gtk_vbox_new( FALSE, 4 ) );
+ GtkVBox* vbox3 = ui::VBox( FALSE, 4 );
//gtk_container_set_border_width(GTK_CONTAINER(vbox3), 4);
gtk_widget_show( GTK_WIDGET( vbox3 ) );
gtk_container_add( GTK_CONTAINER( frame ), GTK_WIDGET( vbox3 ) );
{
- GtkTable* table = GTK_TABLE( gtk_table_new( 8, 4, FALSE ) );
+ GtkTable* table = ui::Table( 8, 4, FALSE );
gtk_widget_show( GTK_WIDGET( table ) );
gtk_box_pack_start( GTK_BOX( vbox3 ), GTK_WIDGET( table ), TRUE, TRUE, 0 );
gtk_table_set_row_spacings( table, 0 );
{
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 ),
}
}
{
- GtkFrame* frame = GTK_FRAME( gtk_frame_new( "Content Flags" ) );
+ GtkFrame* frame = ui::Frame( "Content Flags" );
gtk_widget_show( GTK_WIDGET( frame ) );
gtk_box_pack_start( GTK_BOX( vbox ), GTK_WIDGET( frame ), TRUE, TRUE, 0 );
{
- GtkVBox* vbox3 = GTK_VBOX( gtk_vbox_new( FALSE, 4 ) );
+ GtkVBox* vbox3 = ui::VBox( FALSE, 4 );
//gtk_container_set_border_width(GTK_CONTAINER(vbox3), 4);
gtk_widget_show( GTK_WIDGET( vbox3 ) );
gtk_container_add( GTK_CONTAINER( frame ), GTK_WIDGET( vbox3 ) );
{
- GtkTable* table = GTK_TABLE( gtk_table_new( 8, 4, FALSE ) );
+ GtkTable* table = ui::Table( 8, 4, FALSE );
gtk_widget_show( GTK_WIDGET( table ) );
gtk_box_pack_start( GTK_BOX( vbox3 ), GTK_WIDGET( table ), TRUE, TRUE, 0 );
gtk_table_set_row_spacings( table, 0 );
{
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 ),
}
}
{
- GtkFrame* frame = GTK_FRAME( gtk_frame_new( "Value" ) );
+ GtkFrame* frame = ui::Frame( "Value" );
gtk_widget_show( GTK_WIDGET( frame ) );
gtk_box_pack_start( GTK_BOX( vbox ), GTK_WIDGET( frame ), TRUE, TRUE, 0 );
{
- GtkVBox* vbox3 = GTK_VBOX( gtk_vbox_new( FALSE, 4 ) );
+ GtkVBox* vbox3 = ui::VBox( FALSE, 4 );
gtk_container_set_border_width( GTK_CONTAINER( vbox3 ), 4 );
gtk_widget_show( GTK_WIDGET( vbox3 ) );
gtk_container_add( GTK_CONTAINER( frame ), GTK_WIDGET( vbox3 ) );
{
- GtkEntry* entry = GTK_ENTRY( gtk_entry_new() );
+ GtkEntry* entry = ui::Entry();
gtk_widget_show( GTK_WIDGET( entry ) );
gtk_box_pack_start( GTK_BOX( vbox3 ), GTK_WIDGET( entry ), TRUE, TRUE, 0 );
m_valueEntryWidget = entry;
#if TEXTOOL_ENABLED
if ( g_bp_globals.m_texdefTypeId == TEXDEFTYPEID_BRUSHPRIMITIVES ) {
// Shamus: Textool goodies...
- GtkWidget * frame = gtk_frame_new( "Textool" );
+ ui::Widget frame = ui::Frame( "Textool" );
gtk_widget_show( frame );
gtk_box_pack_start( GTK_BOX( vbox ), GTK_WIDGET( frame ), FALSE, FALSE, 0 );
{
//Prolly should make this a member or global var, so the SI can draw on it...
TexTool::g_textoolWin = glwidget_new( FALSE );
// --> Dunno, but this stuff may be necessary... (Looks like it!)
- gtk_widget_ref( TexTool::g_textoolWin );
+ g_object_ref( TexTool::g_textoolWin );
gtk_widget_set_events( TexTool::g_textoolWin, GDK_DESTROY | GDK_EXPOSURE_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK | GDK_POINTER_MOTION_MASK );
- GTK_WIDGET_SET_FLAGS( TexTool::g_textoolWin, GTK_CAN_FOCUS );
+ gtk_widget_set_can_focus( TexTool::g_textoolWin, true );
// <-- end stuff...
gtk_widget_show( TexTool::g_textoolWin );
- gtk_widget_set_usize( TexTool::g_textoolWin, -1, 240 ); //Yeah!
+ gtk_widget_set_size_request( TexTool::g_textoolWin, -1, 240 ); //Yeah!
gtk_container_add( GTK_CONTAINER( frame ), TexTool::g_textoolWin );
g_signal_connect( G_OBJECT( TexTool::g_textoolWin ), "size_allocate", G_CALLBACK( TexTool::size_allocate ), NULL );
g_signal_connect( G_OBJECT( TexTool::g_textoolWin ), "motion_notify_event", G_CALLBACK( TexTool::motion ), NULL );
}
{
- GtkWidget * hbox = gtk_hbox_new( FALSE, 5 );
+ ui::Widget hbox = ui::HBox( FALSE, 5 );
gtk_widget_show( hbox );
gtk_box_pack_start( GTK_BOX( vbox ), GTK_WIDGET( hbox ), FALSE, FALSE, 0 );
// Checkboxes go here... (Flip X/Y)
- GtkWidget * flipX = gtk_check_button_new_with_label( "Flip X axis" );
- GtkWidget * 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 );
void spin_button_set_step_increment( GtkSpinButton* spin, gdouble value ){
GtkAdjustment* adjust = gtk_spin_button_get_adjustment( spin );
- adjust->step_increment = value;
+ gtk_adjustment_set_step_increment(adjust, value);
}
void SurfaceInspector::Update(){
void SurfaceInspector::ApplyTexdef(){
texdef_t shiftScaleRotate;
- shiftScaleRotate.shift[0] = static_cast<float>( gtk_spin_button_get_value_as_float( m_hshiftIncrement.m_spin ) );
- shiftScaleRotate.shift[1] = static_cast<float>( gtk_spin_button_get_value_as_float( m_vshiftIncrement.m_spin ) );
- shiftScaleRotate.scale[0] = static_cast<float>( gtk_spin_button_get_value_as_float( m_hscaleIncrement.m_spin ) );
- shiftScaleRotate.scale[1] = static_cast<float>( gtk_spin_button_get_value_as_float( m_vscaleIncrement.m_spin ) );
- shiftScaleRotate.rotate = static_cast<float>( gtk_spin_button_get_value_as_float( m_rotateIncrement.m_spin ) );
+ shiftScaleRotate.shift[0] = static_cast<float>( gtk_spin_button_get_value( m_hshiftIncrement.m_spin ) );
+ shiftScaleRotate.shift[1] = static_cast<float>( gtk_spin_button_get_value( m_vshiftIncrement.m_spin ) );
+ shiftScaleRotate.scale[0] = static_cast<float>( gtk_spin_button_get_value( m_hscaleIncrement.m_spin ) );
+ shiftScaleRotate.scale[1] = static_cast<float>( gtk_spin_button_get_value( m_vscaleIncrement.m_spin ) );
+ shiftScaleRotate.rotate = static_cast<float>( gtk_spin_button_get_value( m_rotateIncrement.m_spin ) );
TextureProjection projection;
//Shamus: This is the other place that screws up, it seems, since it doesn't seem to do the
// << extents.maxX << ", " << extents.minY << ", " << extents.maxY << "\n";
}
-gboolean size_allocate( GtkWidget * win, GtkAllocation * a, gpointer ){
+gboolean size_allocate( ui::Widget win, GtkAllocation * a, gpointer ){
windowSize.x() = a->width;
windowSize.y() = a->height;
queueDraw();
return false;
}
-gboolean expose( GtkWidget * win, GdkEventExpose * e, gpointer ){
+gboolean expose( ui::Widget win, GdkEventExpose * e, gpointer ){
// globalOutputStream() << "--> Textool Window was exposed!\n";
// globalOutputStream() << " (window width/height: " << cc << "/" << e->area.height << ")\n";
Vector2 trans2;
Vector2 dragPoint; // Defined in terms of window space (+x/-y)
Vector2 oldTrans;
-gboolean button_press( GtkWidget * win, GdkEventButton * e, gpointer ){
+gboolean button_press( ui::Widget win, GdkEventButton * e, gpointer ){
// globalOutputStream() << "--> Textool button press...\n";
if ( e->button == 1 ) {
return false;
}
-gboolean button_release( GtkWidget * win, GdkEventButton * e, gpointer ){
+gboolean button_release( ui::Widget win, GdkEventButton * e, gpointer ){
// globalOutputStream() << "--> Textool button release...\n";
if ( e->button == 1 ) {
c[1] = ((float)(y))/((float)(m_rect.bottom-m_rect.top))*(m_Maxs[1]-m_Mins[1])+m_Mins[1];
}
*/
-gboolean motion( GtkWidget * win, GdkEventMotion * e, gpointer ){
+gboolean motion( ui::Widget win, GdkEventMotion * e, gpointer ){
// globalOutputStream() << "--> Textool motion...\n";
if ( lButtonDown ) {
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
+#include <uilib/uilib.h>
+
#if !defined( INCLUDED_SURFACEDIALOG_H )
#define INCLUDED_SURFACEDIALOG_H
void SurfaceInspector_Construct();
void SurfaceInspector_Destroy();
-typedef struct _GtkWidget GtkWidget;
-typedef struct _GtkWindow GtkWindow;
-void SurfaceInspector_constructWindow( GtkWindow* widget );
+void SurfaceInspector_constructWindow( ui::Window widget );
void SurfaceInspector_destroyWindow();
bool SelectedFaces_empty();
#define INCLUDED_TEXTUREENTRY_H
-#include <gtk/gtkentry.h>
-#include <gtk/gtkliststore.h>
+#include <gtk/gtk.h>
#include "gtkutil/idledraw.h"
#include "generic/static.h"
#include <vector>
#include <gtk/gtk.h>
-#include <gtk/gtkrange.h>
-#include <gtk/gtkframe.h>
-#include <gtk/gtkhbox.h>
-#include <gtk/gtkvbox.h>
-#include <gtk/gtkvscrollbar.h>
+#include <uilib/uilib.h>
#include "signal/signal.h"
#include "math/vector.h"
}
}
static void adjustment_value_changed( GtkAdjustment *adjustment, DeferredAdjustment* self ){
- self->value_changed( adjustment->value );
+ self->value_changed( gtk_adjustment_get_value(adjustment) );
}
};
CopiedString shader;
-GtkWindow* m_parent;
-GtkWidget* m_gl_widget;
-GtkWidget* m_texture_scroll;
-GtkWidget* m_treeViewTree;
-GtkWidget* m_treeViewTags;
-GtkWidget* m_tag_frame;
+ui::Window m_parent;
+ui::Widget m_gl_widget;
+ui::Widget m_texture_scroll;
+ui::Widget m_treeViewTree;
+ui::Widget m_treeViewTags;
+ui::Widget m_tag_frame;
GtkListStore* m_assigned_store;
GtkListStore* m_available_store;
-GtkWidget* m_assigned_tree;
-GtkWidget* m_available_tree;
-GtkWidget* m_scr_win_tree;
-GtkWidget* m_scr_win_tags;
-GtkWidget* m_tag_notebook;
-GtkWidget* m_search_button;
-GtkWidget* m_shader_info_item;
+ui::Widget m_assigned_tree;
+ui::Widget m_available_tree;
+ui::Widget m_scr_win_tree;
+ui::Widget m_scr_win_tags;
+ui::Widget m_tag_notebook;
+ui::Widget m_search_button;
+ui::Widget m_shader_info_item;
std::set<CopiedString> m_all_tags;
GtkListStore* m_all_tags_list;
void TextureBrowser_SetHideUnused( TextureBrowser& textureBrowser, bool hideUnused );
-GtkWidget* g_page_textures;
+ui::Widget g_page_textures;
void TextureBrowser_toggleShow(){
GroupDialog_showPage( g_page_textures );
}
}
-gboolean TextureBrowser_button_press( GtkWidget* widget, GdkEventButton* event, TextureBrowser* textureBrowser ){
+gboolean TextureBrowser_button_press( ui::Widget widget, GdkEventButton* event, TextureBrowser* textureBrowser ){
if ( event->type == GDK_BUTTON_PRESS ) {
if ( event->button == 3 ) {
if ( GlobalTextureBrowser().m_tags ) {
return FALSE;
}
-gboolean TextureBrowser_button_release( GtkWidget* widget, GdkEventButton* event, TextureBrowser* textureBrowser ){
+gboolean TextureBrowser_button_release( ui::Widget widget, GdkEventButton* event, TextureBrowser* textureBrowser ){
if ( event->type == GDK_BUTTON_RELEASE ) {
if ( event->button == 3 ) {
if ( !GlobalTextureBrowser().m_tags ) {
return FALSE;
}
-gboolean TextureBrowser_motion( GtkWidget *widget, GdkEventMotion *event, TextureBrowser* textureBrowser ){
+gboolean TextureBrowser_motion( ui::Widget widget, GdkEventMotion *event, TextureBrowser* textureBrowser ){
return FALSE;
}
-gboolean TextureBrowser_scroll( GtkWidget* widget, GdkEventScroll* event, TextureBrowser* textureBrowser ){
+gboolean TextureBrowser_scroll( ui::Widget widget, GdkEventScroll* event, TextureBrowser* textureBrowser ){
if ( event->direction == GDK_SCROLL_UP ) {
TextureBrowser_MouseWheel( *textureBrowser, true );
}
}
static void TextureBrowser_verticalScroll( GtkAdjustment *adjustment, TextureBrowser* textureBrowser ){
- textureBrowser->m_scrollAdjustment.value_changed( adjustment->value );
+ textureBrowser->m_scrollAdjustment.value_changed( gtk_adjustment_get_value(adjustment) );
}
void TextureBrowser_updateScroll( TextureBrowser& textureBrowser ){
GtkAdjustment *vadjustment = gtk_range_get_adjustment( GTK_RANGE( textureBrowser.m_texture_scroll ) );
- vadjustment->value = -TextureBrowser_getOriginY( textureBrowser );
- vadjustment->page_size = textureBrowser.height;
- vadjustment->page_increment = textureBrowser.height / 2;
- vadjustment->step_increment = 20;
- vadjustment->lower = 0;
- vadjustment->upper = totalHeight;
+ gtk_adjustment_set_value(vadjustment, -TextureBrowser_getOriginY( textureBrowser ));
+ gtk_adjustment_set_page_size(vadjustment, textureBrowser.height);
+ gtk_adjustment_set_page_increment(vadjustment, textureBrowser.height / 2);
+ gtk_adjustment_set_step_increment(vadjustment, 20);
+ gtk_adjustment_set_lower(vadjustment, 0);
+ gtk_adjustment_set_upper(vadjustment, totalHeight);
g_signal_emit_by_name( G_OBJECT( vadjustment ), "changed" );
}
}
-gboolean TextureBrowser_size_allocate( GtkWidget* widget, GtkAllocation* allocation, TextureBrowser* textureBrowser ){
+gboolean TextureBrowser_size_allocate( ui::Widget widget, GtkAllocation* allocation, TextureBrowser* textureBrowser ){
textureBrowser->width = allocation->width;
textureBrowser->height = allocation->height;
TextureBrowser_heightChanged( *textureBrowser );
return FALSE;
}
-gboolean TextureBrowser_expose( GtkWidget* widget, GdkEventExpose* event, TextureBrowser* textureBrowser ){
+gboolean TextureBrowser_expose( ui::Widget widget, GdkEventExpose* event, TextureBrowser* textureBrowser ){
if ( glwidget_make_current( textureBrowser->m_gl_widget ) != FALSE ) {
GlobalOpenGL_debugAssertNoErrors();
TextureBrowser_evaluateHeight( *textureBrowser );
}
void TextureBrowser_createTreeViewTree(){
- GtkCellRenderer* renderer;
- g_TextureBrowser.m_treeViewTree = GTK_WIDGET( gtk_tree_view_new() );
+ g_TextureBrowser.m_treeViewTree = ui::TreeView();
gtk_tree_view_set_enable_search( GTK_TREE_VIEW( g_TextureBrowser.m_treeViewTree ), FALSE );
gtk_tree_view_set_headers_visible( GTK_TREE_VIEW( g_TextureBrowser.m_treeViewTree ), FALSE );
g_signal_connect( g_TextureBrowser.m_treeViewTree, "row-activated", (GCallback) TreeView_onRowActivated, NULL );
- renderer = gtk_cell_renderer_text_new();
+ auto renderer = ui::CellRendererText();
gtk_tree_view_insert_column_with_attributes( GTK_TREE_VIEW( g_TextureBrowser.m_treeViewTree ), -1, "", renderer, "text", 0, NULL );
TextureBrowser_constructTreeStore();
void TextureBrowser_renameTag();
void TextureBrowser_deleteTag();
-void TextureBrowser_createContextMenu( GtkWidget *treeview, GdkEventButton *event ){
- GtkWidget* menu = gtk_menu_new();
+void TextureBrowser_createContextMenu( ui::Widget treeview, GdkEventButton *event ){
+ ui::Widget menu = ui::Menu();
- GtkWidget* menuitem = gtk_menu_item_new_with_label( "Add tag" );
+ ui::Widget menuitem = ui::MenuItem( "Add tag" );
g_signal_connect( menuitem, "activate", (GCallback)TextureBrowser_addTag, treeview );
gtk_menu_shell_append( GTK_MENU_SHELL( menu ), menuitem );
- menuitem = gtk_menu_item_new_with_label( "Rename tag" );
+ menuitem = ui::MenuItem( "Rename tag" );
g_signal_connect( menuitem, "activate", (GCallback)TextureBrowser_renameTag, treeview );
gtk_menu_shell_append( GTK_MENU_SHELL( menu ), menuitem );
- menuitem = gtk_menu_item_new_with_label( "Delete tag" );
+ menuitem = ui::MenuItem( "Delete tag" );
g_signal_connect( menuitem, "activate", (GCallback)TextureBrowser_deleteTag, treeview );
gtk_menu_shell_append( GTK_MENU_SHELL( menu ), menuitem );
gdk_event_get_time( (GdkEvent*)event ) );
}
-gboolean TreeViewTags_onButtonPressed( GtkWidget *treeview, GdkEventButton *event ){
+gboolean TreeViewTags_onButtonPressed( ui::Widget treeview, GdkEventButton *event ){
if ( event->type == GDK_BUTTON_PRESS && event->button == 3 ) {
GtkTreePath *path;
GtkTreeSelection* selection = gtk_tree_view_get_selection( GTK_TREE_VIEW( treeview ) );
}
void TextureBrowser_createTreeViewTags(){
- GtkCellRenderer* renderer;
- g_TextureBrowser.m_treeViewTags = GTK_WIDGET( gtk_tree_view_new() );
+ g_TextureBrowser.m_treeViewTags = ui::TreeView();
gtk_tree_view_set_enable_search( GTK_TREE_VIEW( g_TextureBrowser.m_treeViewTags ), FALSE );
g_signal_connect( GTK_TREE_VIEW( g_TextureBrowser.m_treeViewTags ), "button-press-event", (GCallback)TreeViewTags_onButtonPressed, NULL );
gtk_tree_view_set_headers_visible( GTK_TREE_VIEW( g_TextureBrowser.m_treeViewTags ), FALSE );
- renderer = gtk_cell_renderer_text_new();
+ auto renderer = ui::CellRendererText();
gtk_tree_view_insert_column_with_attributes( GTK_TREE_VIEW( g_TextureBrowser.m_treeViewTags ), -1, "", renderer, "text", 0, NULL );
TextureBrowser_constructTreeStoreTags();
}
-GtkMenuItem* TextureBrowser_constructViewMenu( GtkMenu* menu ){
- GtkMenuItem* textures_menu_item = new_sub_menu_item_with_mnemonic( "_View" );
+ui::MenuItem TextureBrowser_constructViewMenu( GtkMenu* menu ){
+ ui::MenuItem textures_menu_item = ui::MenuItem(new_sub_menu_item_with_mnemonic( "_View" ));
if ( g_Layout_enableDetachableMenus.m_value ) {
menu_tearoff( menu );
if ( string_empty( g_pGameDescription->getKeyValue( "show_wads" ) ) ) {
menu_separator( menu );
- g_TextureBrowser.m_shader_info_item = GTK_WIDGET( create_menu_item_with_mnemonic( menu, "Shader Info", "ShaderInfo" ) );
+ g_TextureBrowser.m_shader_info_item = ui::Widget(GTK_WIDGET( create_menu_item_with_mnemonic( menu, "Shader Info", "ShaderInfo" ) ));
gtk_widget_set_sensitive( g_TextureBrowser.m_shader_info_item, FALSE );
}
return textures_menu_item;
}
-GtkMenuItem* TextureBrowser_constructToolsMenu( GtkMenu* menu ){
- GtkMenuItem* textures_menu_item = new_sub_menu_item_with_mnemonic( "_Tools" );
+ui::MenuItem TextureBrowser_constructToolsMenu( GtkMenu* menu ){
+ ui::MenuItem textures_menu_item = ui::MenuItem(new_sub_menu_item_with_mnemonic( "_Tools" ));
if ( g_Layout_enableDetachableMenus.m_value ) {
menu_tearoff( menu );
return textures_menu_item;
}
-GtkMenuItem* TextureBrowser_constructTagsMenu( GtkMenu* menu ){
- GtkMenuItem* textures_menu_item = new_sub_menu_item_with_mnemonic( "T_ags" );
+ui::MenuItem TextureBrowser_constructTagsMenu( GtkMenu* menu ){
+ ui::MenuItem textures_menu_item = ui::MenuItem(new_sub_menu_item_with_mnemonic( "T_ags" ));
if ( g_Layout_enableDetachableMenus.m_value ) {
menu_tearoff( menu );
gtk_widget_show_all( g_TextureBrowser.m_search_button );
}
else {
- gtk_widget_hide_all( g_TextureBrowser.m_search_button );
+ gtk_widget_hide( g_TextureBrowser.m_search_button );
}
}
void TextureBrowser_constructTagNotebook(){
- g_TextureBrowser.m_tag_notebook = gtk_notebook_new();
- GtkWidget* labelTags = gtk_label_new( "Tags" );
- GtkWidget* labelTextures = gtk_label_new( "Textures" );
+ g_TextureBrowser.m_tag_notebook = ui::Widget(gtk_notebook_new());
+ ui::Widget labelTags = ui::Label( "Tags" );
+ ui::Widget labelTextures = ui::Label( "Textures" );
gtk_notebook_append_page( GTK_NOTEBOOK( g_TextureBrowser.m_tag_notebook ), g_TextureBrowser.m_scr_win_tree, labelTextures );
gtk_notebook_append_page( GTK_NOTEBOOK( g_TextureBrowser.m_tag_notebook ), g_TextureBrowser.m_scr_win_tags, labelTags );
}
void TextureBrowser_constructSearchButton(){
- GtkTooltips* tooltips = gtk_tooltips_new();
-
- GtkWidget* image = gtk_image_new_from_stock( GTK_STOCK_FIND, GTK_ICON_SIZE_SMALL_TOOLBAR );
- g_TextureBrowser.m_search_button = gtk_button_new();
+ ui::Widget image = ui::Widget(gtk_image_new_from_stock( GTK_STOCK_FIND, GTK_ICON_SIZE_SMALL_TOOLBAR ));
+ g_TextureBrowser.m_search_button = ui::Button();
g_signal_connect( G_OBJECT( g_TextureBrowser.m_search_button ), "clicked", G_CALLBACK( TextureBrowser_searchTags ), NULL );
- gtk_tooltips_set_tip( GTK_TOOLTIPS( tooltips ), g_TextureBrowser.m_search_button, "Search with selected tags", "Search with selected tags" );
+ gtk_widget_set_tooltip_text(g_TextureBrowser.m_search_button, "Search with selected tags");
gtk_container_add( GTK_CONTAINER( g_TextureBrowser.m_search_button ), image );
}
g_shadernotex = name.c_str();
}
-GtkWidget* TextureBrowser_constructWindow( GtkWindow* toplevel ){
+ui::Widget TextureBrowser_constructWindow( ui::Window toplevel ){
// The gl_widget and the tag assignment frame should be packed into a GtkVPaned with the slider
// position stored in local.pref. gtk_paned_get_position() and gtk_paned_set_position() don't
// seem to work in gtk 2.4 and the arrow buttons don't handle GTK_FILL, so here's another thing
g_TextureBrowser.m_parent = toplevel;
- GtkWidget* table = gtk_table_new( 3, 3, FALSE );
- GtkWidget* frame_table = NULL;
- GtkWidget* vbox = gtk_vbox_new( FALSE, 0 );
+ ui::Widget table = ui::Table( 3, 3, FALSE );
+ ui::Widget frame_table;
+ ui::Widget vbox = ui::VBox( FALSE, 0 );
gtk_table_attach( GTK_TABLE( table ), vbox, 0, 1, 1, 3, GTK_FILL, GTK_FILL, 0, 0 );
gtk_widget_show( vbox );
- GtkWidget* menu_bar;
+ ui::Widget menu_bar;
{ // menu bar
- menu_bar = gtk_menu_bar_new();
- GtkWidget* menu_view = gtk_menu_new();
- GtkWidget* view_item = (GtkWidget*)TextureBrowser_constructViewMenu( GTK_MENU( menu_view ) );
+ menu_bar = ui::Widget(gtk_menu_bar_new());
+ ui::Widget menu_view = ui::Menu();
+ auto view_item = TextureBrowser_constructViewMenu( GTK_MENU( menu_view ) );
gtk_menu_item_set_submenu( GTK_MENU_ITEM( view_item ), menu_view );
- gtk_menu_bar_append( GTK_MENU_BAR( menu_bar ), view_item );
+ gtk_menu_shell_append( GTK_MENU_SHELL( menu_bar ), view_item );
- GtkWidget* menu_tools = gtk_menu_new();
- GtkWidget* tools_item = (GtkWidget*)TextureBrowser_constructToolsMenu( GTK_MENU( menu_tools ) );
+ ui::Widget menu_tools = ui::Menu();
+ auto tools_item = TextureBrowser_constructToolsMenu( GTK_MENU( menu_tools ) );
gtk_menu_item_set_submenu( GTK_MENU_ITEM( tools_item ), menu_tools );
- gtk_menu_bar_append( GTK_MENU_BAR( menu_bar ), tools_item );
+ gtk_menu_shell_append( GTK_MENU_SHELL( menu_bar ), tools_item );
gtk_table_attach( GTK_TABLE( table ), menu_bar, 0, 3, 0, 1, GTK_FILL, GTK_SHRINK, 0, 0 );
gtk_widget_show( menu_bar );
}
{ // Texture TreeView
- g_TextureBrowser.m_scr_win_tree = gtk_scrolled_window_new( NULL, NULL );
+ g_TextureBrowser.m_scr_win_tree = ui::ScrolledWindow();
gtk_container_set_border_width( GTK_CONTAINER( g_TextureBrowser.m_scr_win_tree ), 0 );
// vertical only scrolling for treeview
gtk_widget_show( GTK_WIDGET( g_TextureBrowser.m_treeViewTree ) );
}
{ // gl_widget scrollbar
- GtkWidget* w = gtk_vscrollbar_new( GTK_ADJUSTMENT( gtk_adjustment_new( 0,0,0,1,1,0 ) ) );
+ ui::Widget w = ui::Widget(gtk_vscrollbar_new( ui::Adjustment( 0,0,0,1,1,0 ) ));
gtk_table_attach( GTK_TABLE( table ), w, 2, 3, 1, 2, GTK_SHRINK, GTK_FILL, 0, 0 );
gtk_widget_show( w );
g_TextureBrowser.m_texture_scroll = w;
widget_set_visible( g_TextureBrowser.m_texture_scroll, g_TextureBrowser.m_showTextureScrollbar );
}
{ // gl_widget
- g_TextureBrowser.m_gl_widget = glwidget_new( FALSE );
- gtk_widget_ref( g_TextureBrowser.m_gl_widget );
+ g_TextureBrowser.m_gl_widget = ui::Widget(glwidget_new( FALSE ));
+ g_object_ref( g_TextureBrowser.m_gl_widget );
gtk_widget_set_events( g_TextureBrowser.m_gl_widget, GDK_DESTROY | GDK_EXPOSURE_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK | GDK_POINTER_MOTION_MASK | GDK_SCROLL_MASK );
- GTK_WIDGET_SET_FLAGS( g_TextureBrowser.m_gl_widget, GTK_CAN_FOCUS );
+ gtk_widget_set_can_focus( g_TextureBrowser.m_gl_widget, true );
gtk_table_attach_defaults( GTK_TABLE( table ), g_TextureBrowser.m_gl_widget, 1, 2, 1, 2 );
gtk_widget_show( g_TextureBrowser.m_gl_widget );
TextureBrowser_buildTagList();
}
{ // tag menu bar
- GtkWidget* menu_tags = gtk_menu_new();
- GtkWidget* tags_item = (GtkWidget*)TextureBrowser_constructTagsMenu( GTK_MENU( menu_tags ) );
+ ui::Widget menu_tags = ui::Menu();
+ auto tags_item = TextureBrowser_constructTagsMenu( GTK_MENU( menu_tags ) );
gtk_menu_item_set_submenu( GTK_MENU_ITEM( tags_item ), menu_tags );
- gtk_menu_bar_append( GTK_MENU_BAR( menu_bar ), tags_item );
+ gtk_menu_shell_append( GTK_MENU_SHELL( menu_bar ), tags_item );
}
{ // Tag TreeView
- g_TextureBrowser.m_scr_win_tags = gtk_scrolled_window_new( NULL, NULL );
+ g_TextureBrowser.m_scr_win_tags = ui::ScrolledWindow();
gtk_container_set_border_width( GTK_CONTAINER( g_TextureBrowser.m_scr_win_tags ), 0 );
// vertical only scrolling for treeview
gtk_box_pack_end( GTK_BOX( vbox ), g_TextureBrowser.m_search_button, FALSE, FALSE, 0 );
}
{ // Tag frame
- frame_table = gtk_table_new( 3, 3, FALSE );
+ frame_table = ui::Table( 3, 3, FALSE );
- g_TextureBrowser.m_tag_frame = gtk_frame_new( "Tag assignment" );
+ g_TextureBrowser.m_tag_frame = ui::Frame( "Tag assignment" );
gtk_frame_set_label_align( GTK_FRAME( g_TextureBrowser.m_tag_frame ), 0.5, 0.5 );
gtk_frame_set_shadow_type( GTK_FRAME( g_TextureBrowser.m_tag_frame ), GTK_SHADOW_NONE );
gtk_container_add( GTK_CONTAINER( g_TextureBrowser.m_tag_frame ), frame_table );
}
{ // assigned tag list
- GtkWidget* scrolled_win = gtk_scrolled_window_new( NULL, NULL );
+ ui::Widget scrolled_win = ui::ScrolledWindow();
gtk_container_set_border_width( GTK_CONTAINER( scrolled_win ), 0 );
gtk_scrolled_window_set_policy( GTK_SCROLLED_WINDOW( scrolled_win ), GTK_POLICY_NEVER, GTK_POLICY_ALWAYS );
GtkTreeSortable* sortable = GTK_TREE_SORTABLE( g_TextureBrowser.m_assigned_store );
gtk_tree_sortable_set_sort_column_id( sortable, TAG_COLUMN, GTK_SORT_ASCENDING );
- GtkCellRenderer* renderer = gtk_cell_renderer_text_new();
+ auto renderer = ui::CellRendererText();
- g_TextureBrowser.m_assigned_tree = gtk_tree_view_new_with_model( GTK_TREE_MODEL( g_TextureBrowser.m_assigned_store ) );
+ g_TextureBrowser.m_assigned_tree = ui::TreeView(ui::TreeModel( GTK_TREE_MODEL( g_TextureBrowser.m_assigned_store ) ));
g_object_unref( G_OBJECT( g_TextureBrowser.m_assigned_store ) );
g_signal_connect( g_TextureBrowser.m_assigned_tree, "row-activated", (GCallback) TextureBrowser_removeTags, NULL );
gtk_tree_view_set_headers_visible( GTK_TREE_VIEW( g_TextureBrowser.m_assigned_tree ), FALSE );
GtkTreeSelection* selection = gtk_tree_view_get_selection( GTK_TREE_VIEW( g_TextureBrowser.m_assigned_tree ) );
gtk_tree_selection_set_mode( selection, GTK_SELECTION_MULTIPLE );
- GtkTreeViewColumn* column = gtk_tree_view_column_new_with_attributes( "", renderer, "text", TAG_COLUMN, NULL );
+ GtkTreeViewColumn* column = ui::TreeViewColumn( "", renderer, {{"text", TAG_COLUMN}} );
gtk_tree_view_append_column( GTK_TREE_VIEW( g_TextureBrowser.m_assigned_tree ), column );
gtk_widget_show( g_TextureBrowser.m_assigned_tree );
gtk_table_attach( GTK_TABLE( frame_table ), scrolled_win, 0, 1, 1, 3, GTK_FILL, GTK_FILL, 0, 0 );
}
{ // available tag list
- GtkWidget* scrolled_win = gtk_scrolled_window_new( NULL, NULL );
+ ui::Widget scrolled_win = ui::ScrolledWindow();
gtk_container_set_border_width( GTK_CONTAINER( scrolled_win ), 0 );
gtk_scrolled_window_set_policy( GTK_SCROLLED_WINDOW( scrolled_win ), GTK_POLICY_NEVER, GTK_POLICY_ALWAYS );
GtkTreeSortable* sortable = GTK_TREE_SORTABLE( g_TextureBrowser.m_available_store );
gtk_tree_sortable_set_sort_column_id( sortable, TAG_COLUMN, GTK_SORT_ASCENDING );
- GtkCellRenderer* renderer = gtk_cell_renderer_text_new();
+ auto renderer = ui::CellRendererText();
- g_TextureBrowser.m_available_tree = gtk_tree_view_new_with_model( GTK_TREE_MODEL( g_TextureBrowser.m_available_store ) );
+ g_TextureBrowser.m_available_tree = ui::TreeView(ui::TreeModel( GTK_TREE_MODEL( g_TextureBrowser.m_available_store ) ));
g_object_unref( G_OBJECT( g_TextureBrowser.m_available_store ) );
g_signal_connect( g_TextureBrowser.m_available_tree, "row-activated", (GCallback) TextureBrowser_assignTags, NULL );
gtk_tree_view_set_headers_visible( GTK_TREE_VIEW( g_TextureBrowser.m_available_tree ), FALSE );
GtkTreeSelection* selection = gtk_tree_view_get_selection( GTK_TREE_VIEW( g_TextureBrowser.m_available_tree ) );
gtk_tree_selection_set_mode( selection, GTK_SELECTION_MULTIPLE );
- GtkTreeViewColumn* column = gtk_tree_view_column_new_with_attributes( "", renderer, "text", TAG_COLUMN, NULL );
+ GtkTreeViewColumn* column = ui::TreeViewColumn( "", renderer, {{"text", TAG_COLUMN}} );
gtk_tree_view_append_column( GTK_TREE_VIEW( g_TextureBrowser.m_available_tree ), column );
gtk_widget_show( g_TextureBrowser.m_available_tree );
gtk_table_attach( GTK_TABLE( frame_table ), scrolled_win, 2, 3, 1, 3, GTK_FILL, GTK_FILL, 0, 0 );
}
{ // tag arrow buttons
- GtkWidget* m_btn_left = gtk_button_new();
- GtkWidget* m_btn_right = gtk_button_new();
- GtkWidget* m_arrow_left = gtk_arrow_new( GTK_ARROW_LEFT, GTK_SHADOW_OUT );
- GtkWidget* m_arrow_right = gtk_arrow_new( GTK_ARROW_RIGHT, GTK_SHADOW_OUT );
+ ui::Widget m_btn_left = ui::Button();
+ ui::Widget m_btn_right = ui::Button();
+ ui::Widget m_arrow_left = ui::Widget(gtk_arrow_new( GTK_ARROW_LEFT, GTK_SHADOW_OUT ));
+ ui::Widget m_arrow_right = ui::Widget(gtk_arrow_new( GTK_ARROW_RIGHT, GTK_SHADOW_OUT ));
gtk_container_add( GTK_CONTAINER( m_btn_left ), m_arrow_left );
gtk_container_add( GTK_CONTAINER( m_btn_right ), m_arrow_right );
gtk_widget_show( m_arrow_right );
}
{ // tag fram labels
- GtkWidget* m_lbl_assigned = gtk_label_new( "Assigned" );
- GtkWidget* m_lbl_unassigned = gtk_label_new( "Available" );
+ ui::Widget m_lbl_assigned = ui::Label( "Assigned" );
+ ui::Widget m_lbl_unassigned = ui::Label( "Available" );
gtk_table_attach( GTK_TABLE( frame_table ), m_lbl_assigned, 0, 1, 0, 1, GTK_EXPAND, GTK_SHRINK, 0, 0 );
gtk_table_attach( GTK_TABLE( frame_table ), m_lbl_unassigned, 2, 3, 0, 1, GTK_EXPAND, GTK_SHRINK, 0, 0 );
g_signal_handler_disconnect( G_OBJECT( g_TextureBrowser.m_gl_widget ), g_TextureBrowser.m_sizeHandler );
g_signal_handler_disconnect( G_OBJECT( g_TextureBrowser.m_gl_widget ), g_TextureBrowser.m_exposeHandler );
- gtk_widget_unref( g_TextureBrowser.m_gl_widget );
+ g_object_unref( g_TextureBrowser.m_gl_widget );
}
const Vector3& TextureBrowser_getBackgroundColour( TextureBrowser& textureBrowser ){
}
else
{
- gtk_MessageBox( GTK_WIDGET( g_TextureBrowser.m_parent ), "Select a single tag for renaming." );
+ ui::Widget(GTK_WIDGET( g_TextureBrowser.m_parent )).alert( "Select a single tag for renaming." );
}
}
gtk_tree_selection_selected_foreach( selection, GtkTreeSelectionForeachFunc( TextureBrowser_selectionHelper ), &selected );
if ( g_slist_length( selected ) == 1 ) { // we only delete a single tag
- EMessageBoxReturn result = gtk_MessageBox( GTK_WIDGET( g_TextureBrowser.m_parent ), "Are you sure you want to delete the selected tag?", "Delete Tag", eMB_YESNO, eMB_ICONQUESTION );
+ auto result = ui::Widget(GTK_WIDGET( g_TextureBrowser.m_parent )).alert( "Are you sure you want to delete the selected tag?", "Delete Tag", ui::alert_type::YESNO, ui::alert_icon::Question );
- if ( result == eIDYES ) {
+ if ( result == ui::alert_response::YES ) {
GtkTreeIter iterSelected;
gchar *rowTag;
}
}
else {
- gtk_MessageBox( GTK_WIDGET( g_TextureBrowser.m_parent ), "Select a single tag for deletion." );
+ ui::Widget(GTK_WIDGET( g_TextureBrowser.m_parent )).alert( "Select a single tag for deletion." );
}
}
ScopeDisableScreenUpdates disableScreenUpdates( "Processing...", "Loading Shaders" );
GlobalShaderSystem().refresh();
UpdateAllWindows();
- GtkTreeSelection* selection = gtk_tree_view_get_selection((GtkTreeView*)GlobalTextureBrowser().m_treeViewTree);
+ GtkTreeSelection* selection = gtk_tree_view_get_selection(GTK_TREE_VIEW(GlobalTextureBrowser().m_treeViewTree));
GtkTreeModel* model = NULL;
GtkTreeIter iter;
if ( gtk_tree_selection_get_selected (selection, &model, &iter) )
}
void TextureBrowser_showUntagged(){
- EMessageBoxReturn result = gtk_MessageBox( GTK_WIDGET( g_TextureBrowser.m_parent ), "WARNING! This function might need a lot of memory and time. Are you sure you want to use it?", "Show Untagged", eMB_YESNO, eMB_ICONWARNING );
+ auto result = ui::Widget(GTK_WIDGET( g_TextureBrowser.m_parent )).alert( "WARNING! This function might need a lot of memory and time. Are you sure you want to use it?", "Show Untagged", ui::alert_type::YESNO, ui::alert_icon::Warning );
- if ( result == eIDYES ) {
+ if ( result == ui::alert_response::YES ) {
g_TextureBrowser.m_found_shaders.clear();
TagBuilder.GetUntagged( g_TextureBrowser.m_found_shaders );
std::set<CopiedString>::iterator iter;
#if !defined( INCLUDED_TEXWINDOW_H )
#define INCLUDED_TEXWINDOW_H
+#include <uilib/uilib.h>
#include "math/vector.h"
#include "generic/callbackfwd.h"
#include "signal/signalfwd.h"
#include "xml/xmltextags.h"
-typedef struct _GtkWidget GtkWidget;
-
class TextureBrowser;
TextureBrowser& GlobalTextureBrowser();
-typedef struct _GtkWindow GtkWindow;
-GtkWidget* TextureBrowser_constructWindow( GtkWindow* toplevel );
+ui::Widget TextureBrowser_constructWindow( ui::Window toplevel );
void TextureBrowser_destroyWindow();
template<typename FirstArgument, void( *func ) (FirstArgument)>
class FreeCaller1;
-extern GtkWidget* g_page_textures;
+extern ui::Widget g_page_textures;
void TextureBrowser_exportTitle( const StringImportCallback& importer );
typedef FreeCaller1<const StringImportCallback&, TextureBrowser_exportTitle> TextureBrowserExportTitleCaller;
#include "debugging/debugging.h"
#include <map>
-#include <gtk/gtktreemodel.h>
-#include <gtk/gtktreednd.h>
-#include <gtk/gtkmain.h>
+#include <gtk/gtk.h>
+#include <uilib/uilib.h>
#include "iscenegraph.h"
#include "nameable.h"
graph_type& graph = *GRAPH_TREE_MODEL( tree_model )->graph;
graph_type::iterator i = graph_iterator_read_tree_iter( iter );
- GtkTreePath* path = gtk_tree_path_new();
+ GtkTreePath* path = ui::TreePath();
for ( std::size_t depth = ( *i ).first.get().size(); depth != 0; --depth )
{
ASSERT_MESSAGE( tree_model != 0, "RUNTIME ERROR" );
GraphTreeNode* graph = GRAPH_TREE_MODEL( tree_model )->m_graph;
- GtkTreePath* path = gtk_tree_path_new();
+ GtkTreePath* path = ui::TreePath();
for ( GraphTreeNode* node = ( *graph_iterator_read_tree_iter( iter ) ).second; node != graph; node = node->m_parent )
{
{
GtkTreeIter iter;
- GtkTreePath* path = gtk_tree_path_new_from_string( "0" );
+ GtkTreePath* path = ui::TreePath( "0" );
gtk_tree_model_get_iter( model, &iter, path );
gtk_tree_path_free( path );
{
GtkTreeIter iter;
- GtkTreePath* path = gtk_tree_path_new_from_string( "1" );
+ GtkTreePath* path = ui::TreePath( "1" );
gtk_tree_model_get_iter( model, &iter, path );
gtk_tree_path_free( path );
#include <gdk/gdkwin32.h>
#include <shellapi.h>
bool open_url( const char* url ){
- return ShellExecute( (HWND)GDK_WINDOW_HWND( GTK_WIDGET( MainFrame_getWindow() )->window ), "open", url, 0, 0, SW_SHOW ) > (HINSTANCE)32;
+ return ShellExecute( (HWND)GDK_WINDOW_HWND( gtk_widget_get_window( MainFrame_getWindow() ) ), "open", url, 0, 0, SW_SHOW ) > (HINSTANCE)32;
}
#endif
// let's put a little comment
globalOutputStream() << "OpenURL: " << url << "\n";
if ( !open_url( url ) ) {
- gtk_MessageBox( GTK_WIDGET( MainFrame_getWindow() ), "Failed to launch browser!" );
+ MainFrame_getWindow().alert( "Failed to launch browser!" );
}
}
#include "watchbsp.h"
#include <algorithm>
-#include <gtk/gtkmain.h>
+#include <gtk/gtk.h>
#include "cmdlib.h"
#include "convert.h"
#include <glib.h>
+#include <uilib/uilib.h>
#include "xmlstuff.h"
class CWatchBSP
{
private:
-// a flag we have set to true when using an external BSP plugin
-// the resulting code with that is a bit dirty, cleaner solution would be to seperate the succession of commands from the listening loop
-// (in two seperate classes probably)
-bool m_bBSPPlugin;
-
-// EIdle: we are not listening
-// DoMonitoringLoop will change state to EBeginStep
-// EBeginStep: the socket is up for listening, we are expecting incoming connection
-// incoming connection will change state to EWatching
-// EWatching: we have a connection, monitor it
-// connection closed will see if we start a new step (EBeginStep) or launch Quake3 and end (EIdle)
-enum EWatchBSPState { EIdle, EBeginStep, EWatching } m_eState;
-socket_t *m_pListenSocket;
-socket_t *m_pInSocket;
-netmessage_t msg;
-GPtrArray *m_pCmd;
-// used to timeout EBeginStep
-GTimer *m_pTimer;
-std::size_t m_iCurrentStep;
-// name of the map so we can run the engine
-char *m_sBSPName;
-// buffer we use in push mode to receive data directly from the network
-xmlParserInputBufferPtr m_xmlInputBuffer;
-xmlParserInputPtr m_xmlInput;
-xmlParserCtxtPtr m_xmlParserCtxt;
-// call this to switch the set listening mode
-bool SetupListening();
-// start a new EBeginStep
-void DoEBeginStep();
-// the xml and sax parser state
-char m_xmlBuf[MAX_NETMESSAGE];
-bool m_bNeedCtxtInit;
-message_info_t m_message_info;
+ // a flag we have set to true when using an external BSP plugin
+ // the resulting code with that is a bit dirty, cleaner solution would be to seperate the succession of commands from the listening loop
+ // (in two seperate classes probably)
+ bool m_bBSPPlugin;
+
+ // EIdle: we are not listening
+ // DoMonitoringLoop will change state to EBeginStep
+ // EBeginStep: the socket is up for listening, we are expecting incoming connection
+ // incoming connection will change state to EWatching
+ // EWatching: we have a connection, monitor it
+ // connection closed will see if we start a new step (EBeginStep) or launch Quake3 and end (EIdle)
+ enum EWatchBSPState { EIdle, EBeginStep, EWatching } m_eState;
+ socket_t *m_pListenSocket;
+ socket_t *m_pInSocket;
+ netmessage_t msg;
+ GPtrArray *m_pCmd;
+ // used to timeout EBeginStep
+ GTimer *m_pTimer;
+ std::size_t m_iCurrentStep;
+ // name of the map so we can run the engine
+ char *m_sBSPName;
+ // buffer we use in push mode to receive data directly from the network
+ xmlParserInputBufferPtr m_xmlInputBuffer;
+ xmlParserInputPtr m_xmlInput;
+ xmlParserCtxtPtr m_xmlParserCtxt;
+ // call this to switch the set listening mode
+ bool SetupListening();
+ // start a new EBeginStep
+ void DoEBeginStep();
+ // the xml and sax parser state
+ char m_xmlBuf[MAX_NETMESSAGE];
+ bool m_bNeedCtxtInit;
+ message_info_t m_message_info;
public:
-CWatchBSP(){
- m_pCmd = 0;
- m_bBSPPlugin = false;
- m_pListenSocket = NULL;
- m_pInSocket = NULL;
- m_eState = EIdle;
- m_pTimer = g_timer_new();
- m_sBSPName = NULL;
- m_xmlInputBuffer = NULL;
- m_bNeedCtxtInit = true;
-}
-virtual ~CWatchBSP(){
- EndMonitoringLoop();
- Net_Shutdown();
-
- g_timer_destroy( m_pTimer );
-}
-
-bool HasBSPPlugin() const
-{ return m_bBSPPlugin; }
+ CWatchBSP(){
+ m_pCmd = 0;
+ m_bBSPPlugin = false;
+ m_pListenSocket = NULL;
+ m_pInSocket = NULL;
+ m_eState = EIdle;
+ m_pTimer = g_timer_new();
+ m_sBSPName = NULL;
+ m_xmlInputBuffer = NULL;
+ m_bNeedCtxtInit = true;
+ }
+ virtual ~CWatchBSP(){
+ EndMonitoringLoop();
+ Net_Shutdown();
-// called regularly to keep listening
-void RoutineProcessing();
-// start a monitoring loop with the following steps
-void DoMonitoringLoop( GPtrArray *pCmd, const char *sBSPName );
-void EndMonitoringLoop(){
- Reset();
- if ( m_sBSPName ) {
- string_release( m_sBSPName, string_length( m_sBSPName ) );
- m_sBSPName = 0;
+ g_timer_destroy( m_pTimer );
}
- if ( m_pCmd ) {
- g_ptr_array_free( m_pCmd, TRUE );
- m_pCmd = 0;
+
+ bool HasBSPPlugin() const
+ { return m_bBSPPlugin; }
+
+ // called regularly to keep listening
+ void RoutineProcessing();
+ // start a monitoring loop with the following steps
+ void DoMonitoringLoop( GPtrArray *pCmd, const char *sBSPName );
+ void EndMonitoringLoop(){
+ Reset();
+ if ( m_sBSPName ) {
+ string_release( m_sBSPName, string_length( m_sBSPName ) );
+ m_sBSPName = 0;
+ }
+ if ( m_pCmd ) {
+ g_ptr_array_free( m_pCmd, TRUE );
+ m_pCmd = 0;
+ }
}
-}
-// close everything - may be called from the outside to abort the process
-void Reset();
-// start a listening loop for an external process, possibly a BSP plugin
-void ExternalListen();
+ // close everything - may be called from the outside to abort the process
+ void Reset();
+ // start a listening loop for an external process, possibly a BSP plugin
+ void ExternalListen();
};
CWatchBSP* g_pWatchBSP;
void Build_constructPreferences( PreferencesPage& page ){
- GtkWidget* monitorbsp = page.appendCheckBox( "", "Enable Build Process Monitoring", g_WatchBSP_Enabled );
- GtkWidget* leakstop = page.appendCheckBox( "", "Stop Compilation on Leak", g_WatchBSP_LeakStop );
- GtkWidget* runengine = page.appendCheckBox( "", "Run Engine After Compile", g_WatchBSP_RunQuake );
- GtkWidget* sleep = page.appendCheckBox ( "", "Sleep When Running the Engine", g_WatchBSP_DoSleep );
+ ui::CheckButton monitorbsp = page.appendCheckBox( "", "Enable Build Process Monitoring", g_WatchBSP_Enabled );
+ ui::CheckButton leakstop = page.appendCheckBox( "", "Stop Compilation on Leak", g_WatchBSP_LeakStop );
+ ui::CheckButton runengine = page.appendCheckBox( "", "Run Engine After Compile", g_WatchBSP_RunQuake );
+ ui::CheckButton sleep = page.appendCheckBox ( "", "Sleep When Running the Engine", g_WatchBSP_DoSleep );
Widget_connectToggleDependency( leakstop, monitorbsp );
Widget_connectToggleDependency( runengine, monitorbsp );
Widget_connectToggleDependency( sleep, runengine );
class MessageOutputStream : public TextOutputStream
{
-message_info_t* m_data;
+ message_info_t* m_data;
public:
-MessageOutputStream( message_info_t* data ) : m_data( data ){
-}
-std::size_t write( const char* buffer, std::size_t length ){
- if ( m_data->pGeometry != 0 ) {
- m_data->pGeometry->saxCharacters( m_data, reinterpret_cast<const xmlChar*>( buffer ), int(length) );
+ MessageOutputStream( message_info_t* data ) : m_data( data ){
}
- else
- {
- if ( m_data->ignore_depth == 0 ) {
- // output the message using the level
- message_print( m_data, buffer, length );
- // if this message has error level flag, we mark the depth to stop the compilation when we get out
- // we don't set the msg level if we don't stop on leak
- if ( m_data->msg_level == 3 ) {
- m_data->stop_depth = m_data->recurse - 1;
+
+ std::size_t write( const char* buffer, std::size_t length ){
+ if ( m_data->pGeometry != 0 ) {
+ m_data->pGeometry->saxCharacters( m_data, reinterpret_cast<const xmlChar*>( buffer ), int(length) );
+ }
+ else
+ {
+ if ( m_data->ignore_depth == 0 ) {
+ // output the message using the level
+ message_print( m_data, buffer, length );
+ // if this message has error level flag, we mark the depth to stop the compilation when we get out
+ // we don't set the msg level if we don't stop on leak
+ if ( m_data->msg_level == 3 ) {
+ m_data->stop_depth = m_data->recurse - 1;
+ }
}
}
- }
- return length;
-}
+ return length;
+ }
};
template<typename T>
}
m_eState = EIdle;
if ( s_routine_id ) {
- gtk_timeout_remove( s_routine_id );
+ g_source_remove( s_routine_id );
}
}
if ( SetupListening() == false ) {
const char* msg = "Failed to get a listening socket on port 39000.\nTry running with Build monitoring disabled if you can't fix this.\n";
globalOutputStream() << msg;
- gtk_MessageBox( GTK_WIDGET( MainFrame_getWindow() ), msg, "Build monitoring", eMB_OK, eMB_ICONERROR );
+ MainFrame_getWindow().alert( msg, "Build monitoring", ui::alert_type::OK, ui::alert_icon::Error );
return;
}
// set the timer for timeouts and step cancellation
msg << reinterpret_cast<const char*>( g_ptr_array_index( m_pCmd, m_iCurrentStep ) );
msg << "\nCheck that the file exists and that you don't run out of system resources.\n";
globalOutputStream() << msg.c_str();
- gtk_MessageBox( GTK_WIDGET( MainFrame_getWindow() ), msg.c_str(), "Build monitoring", eMB_OK, eMB_ICONERROR );
+ MainFrame_getWindow().alert( msg.c_str(), "Build monitoring", ui::alert_type::OK, ui::alert_icon::Error );
return;
}
// re-initialise the debug window
}
}
m_eState = EBeginStep;
- s_routine_id = gtk_timeout_add( 25, watchbsp_routine, this );
+ s_routine_id = g_timeout_add( 25, watchbsp_routine, this );
}
class RunEngineConfiguration
{
public:
-const char* executable;
-const char* mp_executable;
-bool do_sp_mp;
-
-RunEngineConfiguration() :
- executable( g_pGameDescription->getRequiredKeyValue( ENGINE_ATTRIBUTE ) ),
- mp_executable( g_pGameDescription->getKeyValue( MP_ENGINE_ATTRIBUTE ) ){
- do_sp_mp = !string_empty( mp_executable );
-}
+ const char* executable;
+ const char* mp_executable;
+ bool do_sp_mp;
+
+ RunEngineConfiguration() :
+ executable( g_pGameDescription->getRequiredKeyValue( ENGINE_ATTRIBUTE ) ),
+ mp_executable( g_pGameDescription->getKeyValue( MP_ENGINE_ATTRIBUTE ) ){
+ do_sp_mp = !string_empty( mp_executable );
+ }
};
inline void GlobalGameDescription_string_write_mapparameter( StringOutputStream& string, const char* mapname ){
case EBeginStep:
// timeout: if we don't get an incoming connection fast enough, go back to idle
if ( g_timer_elapsed( m_pTimer, NULL ) > g_WatchBSP_Timeout ) {
- gtk_MessageBox( GTK_WIDGET( MainFrame_getWindow() ), "The connection timed out, assuming the build process failed\nMake sure you are using a networked version of Q3Map?\nOtherwise you need to disable BSP Monitoring in prefs.", "BSP process monitoring", eMB_OK );
+ MainFrame_getWindow().alert( "The connection timed out, assuming the build process failed\nMake sure you are using a networked version of Q3Map?\nOtherwise you need to disable BSP Monitoring in prefs.", "BSP process monitoring", ui::alert_type::OK );
EndMonitoringLoop();
#if 0
if ( m_bBSPPlugin ) {
StringOutputStream msg;
msg << "Failed to execute the following command: " << cmd.c_str() << cmdline.c_str();
globalOutputStream() << msg.c_str();
- gtk_MessageBox( GTK_WIDGET( MainFrame_getWindow() ), msg.c_str(), "Build monitoring", eMB_OK, eMB_ICONERROR );
+ MainFrame_getWindow().alert( msg.c_str(), "Build monitoring", ui::alert_type::OK, ui::alert_icon::Error );
}
}
EndMonitoringLoop();
if ( m_eState != EIdle ) {
globalOutputStream() << "WatchBSP got a monitoring request while not idling...\n";
// prompt the user, should we cancel the current process and go ahead?
- if ( gtk_MessageBox( GTK_WIDGET( MainFrame_getWindow() ), "I am already monitoring a Build process.\nDo you want me to override and start a new compilation?",
- "Build process monitoring", eMB_YESNO ) == eIDYES ) {
+ if ( MainFrame_getWindow().alert( "I am already monitoring a Build process.\nDo you want me to override and start a new compilation?",
+ "Build process monitoring", ui::alert_type::YESNO ) == ui::alert_response::YES ) {
// disconnect and set EIdle state
Reset();
}
#include "windowobservers.h"
#include <vector>
-#include <gdk/gdkevents.h>
+#include <gdk/gdk.h>
#include "generic/bitfield.h"
namespace
#include <gdk/gdkkeysyms.h>
-gboolean selection_modifier_key_press( GtkWidget* widget, GdkEventKey* event, WindowObservers& observers ){
+gboolean selection_modifier_key_press( ui::Widget widget, GdkEventKey* event, WindowObservers& observers ){
switch ( event->keyval )
{
case GDK_Alt_L:
return FALSE;
}
-gboolean selection_modifier_key_release( GtkWidget* widget, GdkEventKey* event, WindowObservers& observers ){
+gboolean selection_modifier_key_release( ui::Widget widget, GdkEventKey* event, WindowObservers& observers ){
switch ( event->keyval )
{
case GDK_Alt_L:
WindowObservers_UpdateModifier( observers, modifiers, c_modifierControl );
}
-gboolean modifiers_button_press( GtkWidget* widget, GdkEventButton* event, WindowObservers* observers ){
+gboolean modifiers_button_press( ui::Widget widget, GdkEventButton* event, WindowObservers* observers ){
if ( event->type == GDK_BUTTON_PRESS ) {
WindowObservers_UpdateModifiers( *observers, modifiers_for_state( event->state ) );
}
return FALSE;
}
-gboolean modifiers_button_release( GtkWidget* widget, GdkEventButton* event, WindowObservers* observers ){
+gboolean modifiers_button_release( ui::Widget widget, GdkEventButton* event, WindowObservers* observers ){
if ( event->type == GDK_BUTTON_RELEASE ) {
WindowObservers_UpdateModifiers( *observers, modifiers_for_state( event->state ) );
}
return FALSE;
}
-gboolean modifiers_motion( GtkWidget *widget, GdkEventMotion *event, WindowObservers* observers ){
+gboolean modifiers_motion( ui::Widget widget, GdkEventMotion *event, WindowObservers* observers ){
WindowObservers_UpdateModifiers( *observers, modifiers_for_state( event->state ) );
return FALSE;
}
g_window_observers.push_back( observer );
}
-void GlobalWindowObservers_connectTopLevel( GtkWindow* window ){
+void GlobalWindowObservers_connectTopLevel( ui::Window window ){
g_signal_connect( G_OBJECT( window ), "key_press_event", G_CALLBACK( selection_modifier_key_press ), &g_window_observers );
g_signal_connect( G_OBJECT( window ), "key_release_event", G_CALLBACK( selection_modifier_key_release ), &g_window_observers );
}
-void GlobalWindowObservers_connectWidget( GtkWidget* widget ){
+void GlobalWindowObservers_connectWidget( ui::Widget widget ){
g_signal_connect( G_OBJECT( widget ), "button_press_event", G_CALLBACK( modifiers_button_press ), &g_window_observers );
g_signal_connect( G_OBJECT( widget ), "button_release_event", G_CALLBACK( modifiers_button_release ), &g_window_observers );
g_signal_connect( G_OBJECT( widget ), "motion_notify_event", G_CALLBACK( modifiers_motion ), &g_window_observers );
#include "windowobserver.h"
-#include <gdk/gdktypes.h>
+#include <gdk/gdk.h>
+#include <uilib/uilib.h>
#include "math/vector.h"
class WindowObserver;
void GlobalWindowObservers_add( WindowObserver* observer );
-typedef struct _GtkWidget GtkWidget;
-typedef struct _GtkWindow GtkWindow;
-void GlobalWindowObservers_connectWidget( GtkWidget* widget );
-void GlobalWindowObservers_connectTopLevel( GtkWindow* window );
+void GlobalWindowObservers_connectWidget( ui::Widget widget );
+void GlobalWindowObservers_connectTopLevel( ui::Window window );
inline ButtonIdentifier button_for_button( unsigned int button ){
switch ( button )
class ISAXHandler
{
public:
-virtual void Release(){
-}
+virtual void Release(){}
virtual void saxStartElement( message_info_t* ctx, const xmlChar* name, const xmlChar** attrs ) = 0;
virtual void saxEndElement( message_info_t* ctx, const xmlChar* name ) = 0;
virtual void saxCharacters( message_info_t* ctx, const xmlChar* ch, int len ) = 0;
#include "image.h"
#include "gtkutil/messagebox.h"
-#include <gtk/gtklabel.h>
-#include <gtk/gtkmenuitem.h>
+#include <gtk/gtk.h>
+#include <uilib/uilib.h>
+#include <gdk/gdkkeysyms.h>
#include "generic/callback.h"
#include "string/string.h"
unsigned char* img;
const char* filename;
- filename = file_dialog( GTK_WIDGET( MainFrame_getWindow() ), FALSE, "Save Image", 0, FILTER_BMP );
+ filename = ui::file_dialog( GTK_WIDGET( MainFrame_getWindow() ), FALSE, "Save Image", 0, FILTER_BMP );
if ( !filename ) {
return;
}
Shader* XYWnd::m_state_selected = 0;
void xy_update_xor_rectangle( XYWnd& self, rect_t area ){
- if ( GTK_WIDGET_VISIBLE( self.GetWidget() ) ) {
+ if ( gtk_widget_get_visible( self.GetWidget() ) ) {
self.m_XORRectangle.set( rectangle_from_area( area.min, area.max, self.Width(), self.Height() ) );
}
}
-gboolean xywnd_button_press( GtkWidget* widget, GdkEventButton* event, XYWnd* xywnd ){
+gboolean xywnd_button_press( ui::Widget widget, GdkEventButton* event, XYWnd* xywnd ){
if ( event->type == GDK_BUTTON_PRESS ) {
g_pParentWnd->SetActiveXY( xywnd );
return FALSE;
}
-gboolean xywnd_button_release( GtkWidget* widget, GdkEventButton* event, XYWnd* xywnd ){
+gboolean xywnd_button_release( ui::Widget widget, GdkEventButton* event, XYWnd* xywnd ){
if ( event->type == GDK_BUTTON_RELEASE ) {
xywnd->XY_MouseUp( static_cast<int>( event->x ), static_cast<int>( event->y ), buttons_for_event_button( event ) );
return FALSE;
}
-gboolean xywnd_focus_in( GtkWidget* widget, GdkEventFocus* event, XYWnd* xywnd ){
+gboolean xywnd_focus_in( ui::Widget widget, GdkEventFocus* event, XYWnd* xywnd ){
if ( event->type == GDK_FOCUS_CHANGE ) {
if ( event->in ) {
g_pParentWnd->SetActiveXY( xywnd );
reinterpret_cast<XYWnd*>( data )->XY_MouseMoved( static_cast<int>( x ), static_cast<int>( y ), buttons_for_state( state ) );
}
-gboolean xywnd_wheel_scroll( GtkWidget* widget, GdkEventScroll* event, XYWnd* xywnd ){
+gboolean xywnd_wheel_scroll( ui::Widget widget, GdkEventScroll* event, XYWnd* xywnd ){
if ( event->direction == GDK_SCROLL_UP ) {
XYWnd_ZoomIn( xywnd );
}
return FALSE;
}
-gboolean xywnd_size_allocate( GtkWidget* widget, GtkAllocation* allocation, XYWnd* xywnd ){
+gboolean xywnd_size_allocate( ui::Widget widget, GtkAllocation* allocation, XYWnd* xywnd ){
xywnd->m_nWidth = allocation->width;
xywnd->m_nHeight = allocation->height;
xywnd->updateProjection();
return FALSE;
}
-gboolean xywnd_expose( GtkWidget* widget, GdkEventExpose* event, XYWnd* xywnd ){
+gboolean xywnd_expose( ui::Widget widget, GdkEventExpose* event, XYWnd* xywnd ){
if ( glwidget_make_current( xywnd->GetWidget() ) != FALSE ) {
if ( Map_Valid( g_map ) && ScreenUpdates_Enabled() ) {
GlobalOpenGL_debugAssertNoErrors();
m_window_observer->setRectangleDrawCallback( ReferenceCaller1<XYWnd, rect_t, xy_update_xor_rectangle>( *this ) );
m_window_observer->setView( m_view );
- gtk_widget_ref( m_gl_widget );
+ g_object_ref( m_gl_widget );
gtk_widget_set_events( m_gl_widget, GDK_DESTROY | GDK_EXPOSURE_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK | GDK_POINTER_MOTION_MASK | GDK_SCROLL_MASK );
- GTK_WIDGET_SET_FLAGS( m_gl_widget, GTK_CAN_FOCUS );
+ gtk_widget_set_can_focus( m_gl_widget, true );
m_sizeHandler = g_signal_connect( G_OBJECT( m_gl_widget ), "size_allocate", G_CALLBACK( xywnd_size_allocate ), this );
m_exposeHandler = g_signal_connect( G_OBJECT( m_gl_widget ), "expose_event", G_CALLBACK( xywnd_expose ), this );
g_signal_handler_disconnect( G_OBJECT( m_gl_widget ), m_sizeHandler );
g_signal_handler_disconnect( G_OBJECT( m_gl_widget ), m_exposeHandler );
- gtk_widget_unref( m_gl_widget );
+ g_object_unref( m_gl_widget );
m_window_observer->release();
}
if ( ClipMode() && GlobalClipPoints_Find( mousePosition, (VIEWTYPE)m_viewType, m_fScale ) != 0 ) {
GdkCursor *cursor;
cursor = gdk_cursor_new( GDK_CROSSHAIR );
- gdk_window_set_cursor( m_gl_widget->window, cursor );
+ gdk_window_set_cursor( gtk_widget_get_window(m_gl_widget), cursor );
gdk_cursor_unref( cursor );
}
else
{
- gdk_window_set_cursor( m_gl_widget->window, 0 );
+ gdk_window_set_cursor( gtk_widget_get_window(m_gl_widget), 0 );
}
}
"textures/common/caulk" : TextureBrowser_GetSelectedShader( GlobalTextureBrowser() ) );
}
-void entitycreate_activated( GtkWidget* item ){
+void entitycreate_activated( ui::Widget item ){
scene::Node* world_node = Map_FindWorldspawn( g_map );
- const char* entity_name = gtk_label_get_text( GTK_LABEL( GTK_BIN( item )->child ) );
+ const char* entity_name = gtk_label_get_text( GTK_LABEL( gtk_bin_get_child(GTK_BIN( item )) ) );
if ( !( world_node && string_equal( entity_name, "worldspawn" ) ) ) {
g_pParentWnd->ActiveXY()->OnEntityCreate( entity_name );
}
else {
- GlobalRadiant().m_pfnMessageBox( GTK_WIDGET( MainFrame_getWindow() ), "There's already a worldspawn in your map!"
+ GlobalRadiant().m_pfnMessageBox( MainFrame_getWindow(), "There's already a worldspawn in your map!"
"",
"Info",
eMB_OK,
}
void EntityClassMenu_addItem( GtkMenu* menu, const char* name ){
- GtkMenuItem* item = GTK_MENU_ITEM( gtk_menu_item_new_with_label( name ) );
+ GtkMenuItem* item = ui::MenuItem( name );
g_signal_connect( G_OBJECT( item ), "activate", G_CALLBACK( entitycreate_activated ), item );
gtk_widget_show( GTK_WIDGET( item ) );
menu_add_item( menu, item );
m_previous = e->name();
}
void pushMenu( const CopiedString& name ){
- GtkMenuItem* item = GTK_MENU_ITEM( gtk_menu_item_new_with_label( name.c_str() ) );
+ GtkMenuItem* item = ui::MenuItem( name.c_str() );
gtk_widget_show( GTK_WIDGET( item ) );
container_add_widget( GTK_CONTAINER( m_stack.back().first ), GTK_WIDGET( item ) );
- GtkMenu* submenu = GTK_MENU( gtk_menu_new() );
+ GtkMenu* submenu = ui::Menu();
gtk_menu_item_set_submenu( item, GTK_WIDGET( submenu ) );
m_stack.push_back( MenuPair( submenu, name ) );
}
if ( m_mnuDrop == 0 ) { // first time, load it up
- GtkMenu* menu = m_mnuDrop = GTK_MENU( gtk_menu_new() );
+ GtkMenu* menu = m_mnuDrop = ui::Menu();
EntityClassMenuInserter inserter( menu );
GlobalEntityClassManager().forEach( inserter );
reinterpret_cast<XYWnd*>( data )->Scroll( -x, y );
}
-gboolean XYWnd_Move_focusOut( GtkWidget* widget, GdkEventFocus* event, XYWnd* xywnd ){
+gboolean XYWnd_Move_focusOut( ui::Widget widget, GdkEventFocus* event, XYWnd* xywnd ){
xywnd->Move_End();
return FALSE;
}
Move_End();
}
m_move_started = true;
- g_xywnd_freezePointer.freeze_pointer( m_parent != 0 ? m_parent : MainFrame_getWindow(), XYWnd_moveDelta, this );
+ g_xywnd_freezePointer.freeze_pointer( m_parent ? m_parent : MainFrame_getWindow(), XYWnd_moveDelta, this );
m_move_focusOut = g_signal_connect( G_OBJECT( m_gl_widget ), "focus_out_event", G_CALLBACK( XYWnd_Move_focusOut ), this );
}
void XYWnd::Move_End(){
m_move_started = false;
- g_xywnd_freezePointer.unfreeze_pointer( m_parent != 0 ? m_parent : MainFrame_getWindow() );
+ g_xywnd_freezePointer.unfreeze_pointer( m_parent ? m_parent : MainFrame_getWindow() );
g_signal_handler_disconnect( G_OBJECT( m_gl_widget ), m_move_focusOut );
}
}
}
-gboolean XYWnd_Zoom_focusOut( GtkWidget* widget, GdkEventFocus* event, XYWnd* xywnd ){
+gboolean XYWnd_Zoom_focusOut( ui::Widget widget, GdkEventFocus* event, XYWnd* xywnd ){
xywnd->Zoom_End();
return FALSE;
}
}
m_zoom_started = true;
g_dragZoom = 0;
- g_xywnd_freezePointer.freeze_pointer( m_parent != 0 ? m_parent : MainFrame_getWindow(), XYWnd_zoomDelta, this );
+ g_xywnd_freezePointer.freeze_pointer( m_parent ? m_parent : MainFrame_getWindow(), XYWnd_zoomDelta, this );
m_zoom_focusOut = g_signal_connect( G_OBJECT( m_gl_widget ), "focus_out_event", G_CALLBACK( XYWnd_Zoom_focusOut ), this );
}
void XYWnd::Zoom_End(){
m_zoom_started = false;
- g_xywnd_freezePointer.unfreeze_pointer( m_parent != 0 ? m_parent : MainFrame_getWindow() );
+ g_xywnd_freezePointer.unfreeze_pointer( m_parent ? m_parent : MainFrame_getWindow() );
g_signal_handler_disconnect( G_OBJECT( m_gl_widget ), m_zoom_focusOut );
}
m_viewType = viewType;
updateModelview();
- if ( m_parent != 0 ) {
+ if ( m_parent ) {
gtk_window_set_title( m_parent, ViewType_getTitle( m_viewType ) );
}
}
void WXY_BackgroundSelect( void ){
bool brushesSelected = Scene_countSelectedBrushes( GlobalSceneGraph() ) != 0;
if ( !brushesSelected ) {
- gtk_MessageBox( 0, "You have to select some brushes to get the bounding box for.\n",
- "No selection", eMB_OK, eMB_ICONERROR );
+ ui::root.alert( "You have to select some brushes to get the bounding box for.\n",
+ "No selection", ui::alert_type::OK, ui::alert_icon::Error );
return;
}
- const char *filename = file_dialog( GTK_WIDGET( MainFrame_getWindow() ), TRUE, "Background Image", NULL, NULL );
+ const char *filename = MainFrame_getWindow().file_dialog( TRUE, "Background Image", NULL, NULL );
g_pParentWnd->ActiveXY()->XY_DisableBackground();
if ( filename ) {
g_pParentWnd->ActiveXY()->XY_LoadBackgroundImage( filename );
ToggleShown g_xy_top_shown( true );
-void XY_Top_Shown_Construct( GtkWindow* parent ){
+void XY_Top_Shown_Construct( ui::Window parent ){
g_xy_top_shown.connect( GTK_WIDGET( parent ) );
}
ToggleShown g_yz_side_shown( false );
-void YZ_Side_Shown_Construct( GtkWindow* parent ){
+void YZ_Side_Shown_Construct( ui::Window parent ){
g_yz_side_shown.connect( GTK_WIDGET( parent ) );
}
ToggleShown g_xz_front_shown( false );
-void XZ_Front_Shown_Construct( GtkWindow* parent ){
+void XZ_Front_Shown_Construct( ui::Window parent ){
g_xz_front_shown.connect( GTK_WIDGET( parent ) );
}
GlobalToggles_insert( "ToggleView", ToggleShown::ToggleCaller( g_xy_top_shown ), ToggleItem::AddCallbackCaller( g_xy_top_shown.m_item ), Accelerator( 'V', (GdkModifierType)( GDK_SHIFT_MASK | GDK_CONTROL_MASK ) ) );
GlobalToggles_insert( "ToggleSideView", ToggleShown::ToggleCaller( g_yz_side_shown ), ToggleItem::AddCallbackCaller( g_yz_side_shown.m_item ) );
GlobalToggles_insert( "ToggleFrontView", ToggleShown::ToggleCaller( g_xz_front_shown ), ToggleItem::AddCallbackCaller( g_xz_front_shown.m_item ) );
- GlobalCommands_insert( "NextView", FreeCaller<XY_Next>(), Accelerator( GDK_Tab, (GdkModifierType)GDK_CONTROL_MASK ) );
- GlobalCommands_insert( "ZoomIn", FreeCaller<XY_ZoomIn>(), Accelerator( GDK_Delete ) );
- GlobalCommands_insert( "ZoomOut", FreeCaller<XY_ZoomOut>(), Accelerator( GDK_Insert ) );
- GlobalCommands_insert( "ViewTop", FreeCaller<XY_Top>(), Accelerator( GDK_KP_Home ) );
- GlobalCommands_insert( "ViewSide", FreeCaller<XY_Side>(), Accelerator( GDK_KP_Page_Down ) );
- GlobalCommands_insert( "ViewFront", FreeCaller<XY_Front>(), Accelerator( GDK_KP_End ) );
+ GlobalCommands_insert( "NextView", FreeCaller<XY_Next>(), Accelerator( GDK_KEY_Tab, (GdkModifierType)GDK_CONTROL_MASK ) );
+ GlobalCommands_insert( "ZoomIn", FreeCaller<XY_ZoomIn>(), Accelerator( GDK_KEY_Delete ) );
+ GlobalCommands_insert( "ZoomOut", FreeCaller<XY_ZoomOut>(), Accelerator( GDK_KEY_Insert ) );
+ GlobalCommands_insert( "ViewTop", FreeCaller<XY_Top>(), Accelerator( GDK_KEY_KP_Home ) );
+ GlobalCommands_insert( "ViewSide", FreeCaller<XY_Side>(), Accelerator( GDK_KEY_KP_Page_Down ) );
+ GlobalCommands_insert( "ViewFront", FreeCaller<XY_Front>(), Accelerator( GDK_KEY_KP_End ) );
GlobalCommands_insert( "Zoom100", FreeCaller<XY_Zoom100>() );
- GlobalCommands_insert( "CenterXYView", FreeCaller<XY_Focus>(), Accelerator( GDK_Tab, (GdkModifierType)( GDK_SHIFT_MASK | GDK_CONTROL_MASK ) ) );
+ GlobalCommands_insert( "CenterXYView", FreeCaller<XY_Focus>(), Accelerator( GDK_KEY_Tab, (GdkModifierType)( GDK_SHIFT_MASK | GDK_CONTROL_MASK ) ) );
GlobalPreferenceSystem().registerPreference( "ClipCaulk", BoolImportStringCaller( g_clip_useCaulk ), BoolExportStringCaller( g_clip_useCaulk ) );
{
class Node;
}
-typedef struct _GtkWindow GtkWindow;
typedef struct _GtkMenu GtkMenu;
class XYWnd
{
-GtkWidget* m_gl_widget;
+ui::Widget m_gl_widget;
guint m_sizeHandler;
guint m_exposeHandler;
DeferredDraw m_deferredDraw;
DeferredMotion m_deferred_motion;
public:
-GtkWindow* m_parent;
+ui::Window m_parent;
XYWnd();
~XYWnd();
void queueDraw(){
m_deferredDraw.draw();
}
-GtkWidget* GetWidget(){
+ui::Widget GetWidget(){
return m_gl_widget;
}
VIEWTYPE GlobalXYWnd_getCurrentViewType();
-typedef struct _GtkWindow GtkWindow;
-void XY_Top_Shown_Construct( GtkWindow* parent );
-void YZ_Side_Shown_Construct( GtkWindow* parent );
-void XZ_Front_Shown_Construct( GtkWindow* parent );
+void XY_Top_Shown_Construct( ui::Window parent );
+void YZ_Side_Shown_Construct( ui::Window parent );
+void XZ_Front_Shown_Construct( ui::Window parent );
void XYWindow_Construct();
void XYWindow_Destroy();