}
CBackgroundDialogPage::CBackgroundDialogPage( VIEWTYPE vt ){
- GtkWidget *frame;
- GtkWidget *hbox;
GtkWidget *w;
m_vt = vt;
// A vbox to hold everything
m_pWidget = ui::VBox( FALSE,0 );
// Frame for file row
- frame = ui::Frame( "File" );
+ auto frame = ui::Frame( "File" );
gtk_box_pack_start( GTK_BOX( m_pWidget ),frame, FALSE, FALSE, 2 );
// hbox for first row
- hbox = ui::HBox( FALSE,5 );
+ auto hbox = ui::HBox( FALSE,5 );
gtk_container_set_border_width( GTK_CONTAINER( hbox ),4 );
- gtk_container_add( GTK_CONTAINER( frame ), hbox );
+ frame.add(hbox);
// label to display filename
m_pFileLabel = ui::Label( NO_FILE_MSG );
hbox = ui::HBox( FALSE,5 );
gtk_container_set_border_width( GTK_CONTAINER( hbox ),4 );
- gtk_container_add( GTK_CONTAINER( frame ), hbox );
+ frame.add(hbox);
w = ui::Label( "Vertex alpha:" );
gtk_box_pack_start( GTK_BOX( hbox ),w, FALSE, FALSE, 5 );
gtk_box_pack_start( GTK_BOX( m_pWidget ), frame, FALSE, FALSE, 2 );
hbox = ui::HBox( FALSE,5 );
- gtk_container_add( GTK_CONTAINER( frame ), hbox );
+ frame.add(hbox);
gtk_container_set_border_width( GTK_CONTAINER( hbox ),4 );
w = ui::Button( "from selection" );
*/
EMessageBoxReturn DoMessageBox( const char* lpText, const char* lpCaption, EMessageBoxType type ){
- ui::Widget window, w, vbox, hbox;
+ ui::Widget w, vbox, hbox;
EMessageBoxReturn ret;
int loop = 1;
- window = ui::Window( ui::window_type::TOP );
+ auto 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",
gtk_widget_realize( window );
vbox = ui::VBox( FALSE, 10 );
- gtk_container_add( GTK_CONTAINER( window ), vbox );
+ window.add(vbox);
gtk_widget_show( vbox );
w = ui::Label( lpText );
}
EMessageBoxReturn DoIntersectBox( IntersectRS* rs ){
- GtkWidget *window, *w, *vbox, *hbox;
+ GtkWidget *w, *hbox;
GtkWidget *check1, *check2;
EMessageBoxReturn ret;
int loop = 1;
- window = ui::Window( ui::window_type::TOP );
+ auto 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 );
- vbox = ui::VBox( FALSE, 10 );
- gtk_container_add( GTK_CONTAINER( window ), vbox );
+ auto vbox = ui::VBox( FALSE, 10 );
+ window.add(vbox);
gtk_widget_show( vbox );
// ---- vbox ----
}
EMessageBoxReturn DoPolygonBox( PolygonRS* rs ){
- GtkWidget *window, *w, *vbox, *hbox, *vbox2, *hbox2;
+ GtkWidget *w, *hbox, *vbox2, *hbox2;
GtkWidget *check1, *check2, *check3;
GtkWidget *text1, *text2;
EMessageBoxReturn ret;
int loop = 1;
- window = ui::Window( ui::window_type::TOP );
+ auto 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 );
- vbox = ui::VBox( FALSE, 10 );
- gtk_container_add( GTK_CONTAINER( window ), vbox );
- gtk_widget_show( vbox );
+ auto vbox = ui::VBox( FALSE, 10 );
+ window.add(vbox);
+ vbox.show();
// ---- vbox ----
// for stair builder stuck as close as i could to the MFC version
// obviously feel free to change it at will :)
EMessageBoxReturn DoBuildStairsBox( BuildStairsRS* rs ){
- // i made widgets for just about everything ... i think that's what i need to do dunno tho
- GtkWidget *window, *w, *vbox, *hbox;
+ GtkWidget *w;
GtkWidget *textStairHeight, *textRiserTex, *textMainTex;
GtkWidget *radioNorth, *radioSouth, *radioEast, *radioWest; // i'm guessing we can't just abuse 'w' for these if we're getting a value
GtkWidget *radioOldStyle, *radioBobStyle, *radioCornerStyle;
char *text = "Please set a value in the boxes below and press 'OK' to build the stairs";
- window = ui::Window( ui::window_type::TOP );
+ auto 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_widget_realize( window );
// new vbox
- vbox = ui::VBox( FALSE, 10 );
- gtk_container_add( GTK_CONTAINER( window ), vbox );
+ auto vbox = ui::VBox( FALSE, 10 );
+ window.add(vbox);
gtk_widget_show( vbox );
- hbox = ui::HBox( FALSE, 10 );
- gtk_container_add( GTK_CONTAINER( vbox ), hbox );
+ auto hbox = ui::HBox( FALSE, 10 );
+ vbox.add(hbox);
gtk_widget_show( hbox );
// dunno if you want this text or not ...
}
EMessageBoxReturn DoDoorsBox( DoorRS* rs ){
- GtkWidget *window, *hbox, *vbox, *w;
+ GtkWidget *hbox, *w;
GtkWidget *textFrontBackTex, *textTrimTex;
GtkWidget *checkScaleMainH, *checkScaleMainV, *checkScaleTrimH, *checkScaleTrimV;
GtkWidget *comboMain, *comboTrim;
EMessageBoxReturn ret;
int loop = 1;
- window = ui::Window( ui::window_type::TOP );
+ auto 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 );
LoadGList( GetFilename( buffer, "plugins/bt/door-tex.txt" ), listMainTextures );
LoadGList( GetFilename( buffer, "plugins/bt/door-tex-trim.txt" ), listTrimTextures );
- vbox = ui::VBox( FALSE, 10 );
- gtk_container_add( GTK_CONTAINER( window ), vbox );
+ auto vbox = ui::VBox( FALSE, 10 );
+ window.add(vbox);
gtk_widget_show( vbox );
// -------------------------- //
}
EMessageBoxReturn DoPathPlotterBox( PathPlotterRS* rs ){
- GtkWidget *window, *w, *vbox, *hbox;
+ GtkWidget *w, *hbox;
GtkWidget *text1, *text2, *text3;
GtkWidget *check1, *check2;
EMessageBoxReturn ret;
int loop = 1;
- window = ui::Window( ui::window_type::TOP );
+ auto 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 );
- vbox = ui::VBox( FALSE, 10 );
- gtk_container_add( GTK_CONTAINER( window ), vbox );
+ auto vbox = ui::VBox( FALSE, 10 );
+ window.add(vbox);
gtk_widget_show( vbox );
// ---- vbox ----
}
EMessageBoxReturn DoCTFColourChangeBox(){
- GtkWidget *window, *w, *vbox, *hbox;
+ GtkWidget *w, *hbox;
EMessageBoxReturn ret;
int loop = 1;
- window = ui::Window( ui::window_type::TOP );
+ auto 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 );
- vbox = ui::VBox( FALSE, 10 );
- gtk_container_add( GTK_CONTAINER( window ), vbox );
+ auto vbox = ui::VBox( FALSE, 10 );
+ window.add(vbox);
gtk_widget_show( vbox );
// ---- vbox ----
EMessageBoxReturn DoResetTextureBox( ResetTextureRS* rs ){
Str texSelected;
- GtkWidget *window, *w, *vbox, *hbox, *frame, *table;
+ GtkWidget *w, *hbox;
EMessageBoxReturn ret;
int loop = 1;
- window = ui::Window( ui::window_type::TOP );
+ auto 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_widget_realize( window );
- vbox = ui::VBox( FALSE, 10 );
- gtk_container_add( GTK_CONTAINER( window ), vbox );
- gtk_widget_show( vbox );
+ auto vbox = ui::VBox( FALSE, 10 );
+ window.add(vbox);
+ vbox.show();
// ---- vbox ----
// ---- /hbox ----
- frame = ui::Frame( "Reset Texture Names" );
+ auto frame = ui::Frame( "Reset Texture Names" );
gtk_widget_show( frame );
gtk_box_pack_start( GTK_BOX( vbox ), frame, FALSE, TRUE, 0 );
- table = ui::Table( 2, 3, TRUE );
- gtk_widget_show( table );
- gtk_container_add( GTK_CONTAINER( frame ), table );
+ auto table = ui::Table( 2, 3, TRUE );
+ table.show();
+ frame.add(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 );
gtk_box_pack_start( GTK_BOX( vbox ), frame, FALSE, TRUE, 0 );
table = ui::Table( 2, 3, TRUE );
- gtk_widget_show( table );
- gtk_container_add( GTK_CONTAINER( frame ), table );
+ table.show();
+ frame.add(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 );
gtk_box_pack_start( GTK_BOX( vbox ), frame, FALSE, TRUE, 0 );
table = ui::Table( 2, 3, TRUE );
- gtk_widget_show( table );
- gtk_container_add( GTK_CONTAINER( frame ), table );
+ table.show();
+ frame.add(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 );
gtk_box_pack_start( GTK_BOX( vbox ), frame, FALSE, TRUE, 0 );
table = ui::Table( 1, 3, TRUE );
- gtk_widget_show( table );
- gtk_container_add( GTK_CONTAINER( frame ), table );
+ table.show();
+ frame.add(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 );
EMessageBoxReturn DoTrainThingBox( TrainThingRS* rs ){
Str texSelected;
- GtkWidget *window, *w, *vbox, *hbox, *frame, *table;
+ GtkWidget *w, *hbox;
GtkWidget *radiusX, *radiusY;
GtkWidget *angleStart, *angleEnd;
EMessageBoxReturn ret;
int loop = 1;
- window = ui::Window( ui::window_type::TOP );
+ auto 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_widget_realize( window );
- vbox = ui::VBox( FALSE, 10 );
- gtk_container_add( GTK_CONTAINER( window ), vbox );
- gtk_widget_show( vbox );
+ auto vbox = ui::VBox( FALSE, 10 );
+ window.add(vbox);
+ vbox.show();
// ---- vbox ----
// ---- /hbox ----
- frame = ui::Frame( "Radii" );
+ auto frame = ui::Frame( "Radii" );
gtk_widget_show( frame );
gtk_box_pack_start( GTK_BOX( vbox ), frame, FALSE, TRUE, 0 );
- table = ui::Table( 2, 3, TRUE );
- gtk_widget_show( table );
- gtk_container_add( GTK_CONTAINER( frame ), table );
+ auto table = ui::Table( 2, 3, TRUE );
+ table.show();
+ frame.add(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 );
gtk_box_pack_start( GTK_BOX( vbox ), frame, FALSE, TRUE, 0 );
table = ui::Table( 2, 3, TRUE );
- gtk_widget_show( table );
- gtk_container_add( GTK_CONTAINER( frame ), table );
+ table.show();
+ frame.add(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 );
gtk_box_pack_start( GTK_BOX( vbox ), frame, FALSE, TRUE, 0 );
table = ui::Table( 2, 3, TRUE );
- gtk_widget_show( table );
- gtk_container_add( GTK_CONTAINER( frame ), table );
+ table.show();
+ frame.add(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 );
gtk_box_pack_start( GTK_BOX( vbox ), frame, FALSE, TRUE, 0 );
table = ui::Table( 2, 3, TRUE );
- gtk_widget_show( table );
- gtk_container_add( GTK_CONTAINER( frame ), table );
+ table.show();
+ frame.add(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 );
// ailmanki
// add a simple input for the MakeChain thing..
EMessageBoxReturn DoMakeChainBox( MakeChainRS* rs ){
- GtkWidget *window, *w, *vbox, *hbox;
+ GtkWidget *w;
GtkWidget *textlinkNum, *textlinkName;
EMessageBoxReturn ret;
int loop = 1;
- char *text = "Please set a value in the boxes below and press 'OK' to make a chain";
+ char const *text = "Please set a value in the boxes below and press 'OK' to make a chain";
- window = ui::Window( ui::window_type::TOP );
+ auto 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_widget_realize( window );
// new vbox
- vbox = ui::VBox( FALSE, 10 );
- gtk_container_add( GTK_CONTAINER( window ), vbox );
- gtk_widget_show( vbox );
+ auto vbox = ui::VBox( FALSE, 10 );
+ window.add(vbox);
+ vbox.show();
- hbox = ui::HBox( FALSE, 10 );
- gtk_container_add( GTK_CONTAINER( vbox ), hbox );
- gtk_widget_show( hbox );
+ auto hbox = ui::HBox( FALSE, 10 );
+ vbox.add(hbox);
+ hbox.show();
// dunno if you want this text or not ...
w = ui::Label( text );
// created by glade
GtkWidget*
create_w_plugplug2( void ){
- GtkWidget *w_plugplug2;
- GtkWidget *vbox1;
GtkWidget *hbox2;
GtkWidget *vbox4;
GtkWidget *r_collapse;
GtkWidget *b_close;
GtkWidget *vbox2;
GtkWidget *label1;
- GtkWidget *scrolledwindow1;
- GtkWidget *t_materialist;
GtkWidget *ed_materialname;
GtkWidget *hbox1;
GtkWidget *b_addmaterial;
GtkWidget *t_limitmatnames;
GtkWidget *t_objects;
- w_plugplug2 = ui::Window( ui::window_type::TOP );
+ auto 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 = ui::VBox( FALSE, 0 );
+ auto vbox1 = ui::VBox( FALSE, 0 );
gtk_widget_set_name( vbox1, "vbox1" );
gtk_widget_show( vbox1 );
- gtk_container_add( GTK_CONTAINER( w_plugplug2 ), vbox1 );
+ w_plugplug2.add(vbox1);
gtk_container_set_border_width( GTK_CONTAINER( vbox1 ), 5 );
hbox2 = ui::HBox( TRUE, 5 );
gtk_widget_show( label1 );
gtk_box_pack_start( GTK_BOX( vbox2 ), label1, FALSE, FALSE, 0 );
- scrolledwindow1 = ui::ScrolledWindow();
+ auto scrolledwindow1 = ui::ScrolledWindow();
gtk_widget_set_name( scrolledwindow1, "scrolledwindow1" );
- gtk_widget_show( scrolledwindow1 );
+ scrolledwindow1.show();
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 = ui::TreeView();
+ auto 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 );
+ t_materialist.show();
+ scrolledwindow1.add(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 );
}*/
static gint ci_new( GtkWidget *widget, gpointer data ){
- GtkWidget *window, *w, *vbox, *vbox2, *hbox, *frame; //, *name;
+ GtkWidget *w, *hbox; //, *name;
GtkWidget *fixed, *interpolated, *spline;
EMessageBoxReturn ret;
int loop = 1;
// char buf[128];
// create the window
- window = ui::Window( ui::window_type::TOP );
+ auto window = ui::Window( ui::window_type::TOP );
gtk_window_set_title( GTK_WINDOW( window ), "New Camera" );
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_widget_realize( window );
// fill the window
- vbox = ui::VBox( FALSE, 5 );
- gtk_container_add( GTK_CONTAINER( window ), vbox );
- gtk_widget_show( vbox );
+ auto vbox = ui::VBox( FALSE, 5 );
+ window.add(vbox);
+ vbox.show();
// -------------------------- //
gtk_box_pack_start( GTK_BOX( vbox ), hbox, FALSE, FALSE, 0 );
gtk_widget_show( hbox );
- frame = ui::Frame( "Type" );
+ auto frame = ui::Frame( "Type" );
gtk_box_pack_start( GTK_BOX( hbox ), frame, TRUE, TRUE, 0 );
gtk_widget_show( frame );
- vbox2 = ui::VBox( FALSE, 5 );
- gtk_container_add( GTK_CONTAINER( frame ), vbox2 );
+ auto vbox2 = ui::VBox( FALSE, 5 );
+ frame.add(vbox2);
gtk_container_set_border_width( GTK_CONTAINER( vbox2 ), 5 );
gtk_widget_show( vbox2 );
}
static gint ci_rename( GtkWidget *widget, gpointer data ){
- GtkWidget *window, *w, *vbox, *hbox, *name;
+ GtkWidget *w, *hbox, *name;
EMessageBoxReturn ret;
int loop = 1;
}
// create the window
- window = ui::Window( ui::window_type::TOP );
+ auto window = ui::Window( ui::window_type::TOP );
gtk_window_set_title( GTK_WINDOW( window ), "Rename Path" );
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_widget_realize( window );
// fill the window
- vbox = ui::VBox( FALSE, 5 );
- gtk_container_add( GTK_CONTAINER( window ), vbox );
- gtk_widget_show( vbox );
+ auto vbox = ui::VBox( FALSE, 5 );
+ window.add(vbox);
+ vbox.show();
// -------------------------- //
}
static gint ci_add_target( GtkWidget *widget, gpointer data ){
- GtkWidget *window, *w, *vbox, *vbox2, *hbox, *frame, *name;
+ GtkWidget *w, *hbox, *name;
GtkWidget *fixed, *interpolated, *spline;
EMessageBoxReturn ret;
int loop = 1;
}
// create the window
- window = ui::Window( ui::window_type::TOP );
+ auto window = ui::Window( ui::window_type::TOP );
gtk_window_set_title( GTK_WINDOW( window ), "Add Target" );
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_widget_realize( window );
// fill the window
- vbox = ui::VBox( FALSE, 5 );
- gtk_container_add( GTK_CONTAINER( window ), vbox );
- gtk_widget_show( vbox );
+ auto vbox = ui::VBox( FALSE, 5 );
+ window.add(vbox);
+ vbox.show();
// -------------------------- //
gtk_box_pack_start( GTK_BOX( vbox ), hbox, FALSE, FALSE, 0 );
gtk_widget_show( hbox );
- frame = ui::Frame( "Type" );
+ auto frame = ui::Frame( "Type" );
gtk_box_pack_start( GTK_BOX( hbox ), frame, TRUE, TRUE, 0 );
gtk_widget_show( frame );
- vbox2 = ui::VBox( FALSE, 5 );
- gtk_container_add( GTK_CONTAINER( frame ), vbox2 );
+ auto vbox2 = ui::VBox( FALSE, 5 );
+ frame.add(vbox2);
gtk_container_set_border_width( GTK_CONTAINER( vbox2 ), 5 );
gtk_widget_show( vbox2 );
};
static gint ci_add( GtkWidget *widget, gpointer data ){
- GtkWidget *window, *w, *vbox, *vbox2, *hbox, *frame, *parameters;
+ GtkWidget *w, *hbox, *parameters;
GtkWidget *eventWidget[EVENT_COUNT];
EMessageBoxReturn ret;
int i, loop = 1;
}
// create the window
- window = ui::Window( ui::window_type::TOP );
+ auto window = ui::Window( ui::window_type::TOP );
gtk_window_set_title( GTK_WINDOW( window ), "Add Event" );
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_widget_realize( window );
// fill the window
- vbox = ui::VBox( FALSE, 5 );
- gtk_container_add( GTK_CONTAINER( window ), vbox );
- gtk_widget_show( vbox );
+ auto vbox = ui::VBox( FALSE, 5 );
+ window.add(vbox);
+ vbox.show();
// -------------------------- //
gtk_box_pack_start( GTK_BOX( vbox ), hbox, FALSE, FALSE, 0 );
gtk_widget_show( hbox );
- frame = ui::Frame( "Type" );
+ auto frame = ui::Frame( "Type" );
gtk_box_pack_start( GTK_BOX( hbox ), frame, TRUE, TRUE, 0 );
gtk_widget_show( frame );
- vbox2 = ui::VBox( FALSE, 5 );
- gtk_container_add( GTK_CONTAINER( frame ), vbox2 );
+ auto vbox2 = ui::VBox( FALSE, 5 );
+ frame.add(vbox2);
gtk_container_set_border_width( GTK_CONTAINER( vbox2 ), 5 );
gtk_widget_show( vbox2 );
}
GtkWidget *CreateCameraInspectorDialog( void ){
- GtkWidget *window, *w, *vbox, *hbox, *table, *frame;
+ GtkWidget *w, *hbox;
// create the window
- window = ui::Window( ui::window_type::TOP );
+ auto window = ui::Window( ui::window_type::TOP );
gtk_window_set_title( GTK_WINDOW( window ), "Camera Inspector" );
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 );
// the table
// -------------------------- //
- table = ui::Table( 3, 2, FALSE );
- gtk_widget_show( table );
- gtk_container_add( GTK_CONTAINER( window ), table );
+ auto table = ui::Table( 3, 2, FALSE );
+ table.show();
+ window.add(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 );
// -------------------------- //
- frame = ui::Frame( "Path and Target editing" );
- gtk_widget_show( frame );
+ auto frame = ui::Frame( "Path and Target editing" );
+ frame.show();
gtk_table_attach( GTK_TABLE( table ), frame, 0, 1, 1, 2,
(GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ),
(GtkAttachOptions) ( GTK_FILL ), 0, 0 );
- vbox = ui::VBox( FALSE, 5 );
- gtk_container_add( GTK_CONTAINER( frame ), vbox );
+ auto vbox = ui::VBox( FALSE, 5 );
+ frame.add(vbox);
gtk_container_set_border_width( GTK_CONTAINER( vbox ), 5 );
- gtk_widget_show( vbox );
+ vbox.show();
// -------------------------- //
(GtkAttachOptions) ( GTK_FILL ), 0, 0 );
vbox = ui::VBox( FALSE, 5 );
- gtk_container_add( GTK_CONTAINER( frame ), vbox );
+ frame.add(vbox);
gtk_container_set_border_width( GTK_CONTAINER( vbox ), 5 );
- gtk_widget_show( vbox );
+ vbox.show();
// -------------------------- //
gtk_box_pack_start( GTK_BOX( vbox ), hbox, FALSE, FALSE, 0 );
gtk_widget_show( hbox );
- w = ui::ScrolledWindow();
+ auto scr = 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 );
+ scr.add(g_pEventsList);
//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 ) );
// create main dialog
GtkWidget* create_main_dialog(){
- GtkWidget *dlg, *vbox, *hbox, *hbox2, *button, *notebook, *frame, *table, *table2;
+ GtkWidget *hbox2, *button, *notebook, *table2;
GtkWidget *check, *spin, *radio, *label, *entry, *scale;
ui::Adjustment adj;
GSList *group;
const char *orientations[] = { "Ground surface", "Ceiling", "Wall facing 0", "Wall facing 90",
"Wall facing 180","Wall facing 270" };
- g_pWnd = dlg = ui::Window( ui::window_type::TOP );
+ auto dlg = g_pWnd = 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 = ui::HBox( FALSE, 5 );
- gtk_widget_show( hbox );
- gtk_container_add( GTK_CONTAINER( dlg ), hbox );
+ auto hbox = ui::HBox( FALSE, 5 );
+ hbox.show();
+ dlg.add(hbox);
gtk_container_set_border_width( GTK_CONTAINER( hbox ), 5 );
notebook = gtk_notebook_new();
gtk_widget_show( label );
gtk_notebook_append_page( GTK_NOTEBOOK( notebook ), table, label );
- frame = ui::Frame( "Game" );
+ auto 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 = ui::VBox( TRUE, 5 );
- gtk_widget_show( vbox );
- gtk_container_add( GTK_CONTAINER( frame ), vbox );
+ auto vbox = ui::VBox( TRUE, 5 );
+ vbox.show();
+ frame.add(vbox);
gtk_container_set_border_width( GTK_CONTAINER( vbox ), 5 );
for ( i = 0, group = NULL; i < NUMGAMES; i++ )
(GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ), 0, 0 );
vbox = ui::VBox( TRUE, 5 );
- gtk_widget_show( vbox );
- gtk_container_add( GTK_CONTAINER( frame ), vbox );
+ vbox.show();
+ frame.add(vbox);
gtk_container_set_border_width( GTK_CONTAINER( vbox ), 5 );
for ( i = 0, group = NULL; i < 5; i++ )
(GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ), 0, 0 );
vbox = ui::VBox( TRUE, 5 );
- gtk_widget_show( vbox );
- gtk_container_add( GTK_CONTAINER( frame ), vbox );
+ vbox.show();
+ frame.add(vbox);
gtk_container_set_border_width( GTK_CONTAINER( vbox ), 5 );
for ( i = 0, group = NULL; i < 6; i++ )
gtk_widget_show( frame );
gtk_box_pack_start( GTK_BOX( hbox2 ), frame, TRUE, TRUE, 0 );
- table = ui::Table( 3, 4, FALSE );
- gtk_widget_show( table );
+ auto table = ui::Table( 3, 4, FALSE );
+ table.show();
gtk_container_set_border_width( GTK_CONTAINER( table ), 5 );
- gtk_container_add( GTK_CONTAINER( frame ), table );
+ frame.add(table);
gtk_table_set_row_spacings( GTK_TABLE( table ), 5 );
gtk_table_set_col_spacings( GTK_TABLE( table ), 5 );
gtk_box_pack_start( GTK_BOX( hbox2 ), frame, TRUE, TRUE, 0 );
table = ui::Table( 2, 2, FALSE );
- gtk_widget_show( table );
+ table.show();
gtk_container_set_border_width( GTK_CONTAINER( table ), 5 );
- gtk_container_add( GTK_CONTAINER( frame ), table );
+ frame.add(table);
gtk_table_set_row_spacings( GTK_TABLE( table ), 5 );
gtk_table_set_col_spacings( GTK_TABLE( table ), 5 );
gtk_box_pack_start( GTK_BOX( vbox ), frame, FALSE, TRUE, 0 );
table = ui::Table( 3, 4, FALSE );
- gtk_widget_show( table );
+ table.show();
gtk_container_set_border_width( GTK_CONTAINER( table ), 5 );
- gtk_container_add( GTK_CONTAINER( frame ), table );
+ frame.add(table);
gtk_table_set_row_spacings( GTK_TABLE( table ), 5 );
gtk_table_set_col_spacings( GTK_TABLE( table ), 5 );
int AddTerrainKey; // ^Fishman - Add terrain key to func_group.
int SP; // ^Fishman - Snap to grid.
-GtkWidget *g_pWnd; // ghwnd;
+ui::Window g_pWnd{ui::null}; // ghwnd;
GtkWidget *g_pRadiantWnd; // ghwnd_main;
/*HWND ghwndAngles;
*/GtkWidget *g_pWndPreview;
extern HCURSOR ghCursorVertex;
extern HINSTANCE ghInst;*/
extern GtkWidget *g_pRadiantWnd;
-extern GtkWidget *g_pWnd;
+extern ui::Window g_pWnd;
/*extern HWND ghwndAngles;
extern HWND ghwndFix;
*/extern GtkWidget *g_pWndPreview;
}
void CreateViewWindow(){
- GtkWidget *dlg, *vbox, *hbox, *label, *spin, *frame;
+ GtkWidget *hbox, *label, *spin;
GtkObject *adj;
#ifndef ISOMETRIC
azimuth = PI / 6.;
#endif
- g_pWndPreview = dlg = ui::Window( ui::window_type::TOP );
+ auto dlg = g_pWndPreview = ui::Window( ui::window_type::TOP );
gtk_window_set_title( GTK_WINDOW( dlg ), "GtkGenSurf Preview" );
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 = ui::VBox( FALSE, 5 );
- gtk_widget_show( vbox );
- gtk_container_add( GTK_CONTAINER( dlg ), vbox );
+ auto vbox = ui::VBox( FALSE, 5 );
+ vbox.show();
+ dlg.add(vbox);
#ifndef ISOMETRIC
hbox = ui::HBox( TRUE, 5 );
g_signal_connect( G_OBJECT( spin ), "focus_out_event", G_CALLBACK( doublevariable_spinfocusout ), &azimuth );
#endif
- frame = ui::Frame( nullptr );
- gtk_widget_show( frame );
+ auto frame = ui::Frame( nullptr );
+ frame.show();
gtk_frame_set_shadow_type( GTK_FRAME( frame ), GTK_SHADOW_IN );
gtk_box_pack_start( GTK_BOX( vbox ), frame, TRUE, TRUE, 0 );
G_CALLBACK( button_press ), NULL );
gtk_widget_show( g_pPreviewWidget );
- gtk_container_add( GTK_CONTAINER( frame ), g_pPreviewWidget );
+ frame.add(ui::Widget(g_pPreviewWidget));
if ( Preview ) {
gtk_widget_show( g_pWndPreview );
}
int DoMessageBox( const char* lpText, const char* lpCaption, guint32 uType ){
- GtkWidget *window, *w, *vbox, *hbox;
+ GtkWidget *w, *hbox;
int mode = ( uType & MB_TYPEMASK ), ret, loop = 1;
- window = ui::Window( ui::window_type::TOP );
+ auto 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",
gtk_object_set_data( GTK_OBJECT( window ), "ret", &ret );
gtk_widget_realize( window );
- vbox = ui::VBox( FALSE, 10 );
- gtk_container_add( GTK_CONTAINER( window ), vbox );
- gtk_widget_show( vbox );
+ auto vbox = ui::VBox( FALSE, 10 );
+ window.add(vbox);
+ vbox.show();
w = ui::Label( lpText );
gtk_box_pack_start( GTK_BOX( vbox ), w, FALSE, FALSE, 2 );
}
void DoAboutDlg(){
- GtkWidget *dlg, *hbox, *vbox, *button, *label;
+ GtkWidget *vbox, *button, *label;
int loop = 1, ret = IDCANCEL;
- dlg = ui::Window( ui::window_type::TOP );
+ auto dlg = ui::Window( ui::window_type::TOP );
gtk_window_set_title( GTK_WINDOW( dlg ), "About Portal Viewer" );
g_signal_connect( GTK_OBJECT( dlg ), "delete_event",
G_CALLBACK( dialog_delete_callback ), NULL );
g_object_set_data( G_OBJECT( dlg ), "loop", &loop );
g_object_set_data( G_OBJECT( dlg ), "ret", &ret );
- hbox = ui::HBox( FALSE, 10 );
- gtk_widget_show( hbox );
- gtk_container_add( GTK_CONTAINER( dlg ), hbox );
+ auto hbox = ui::HBox( FALSE, 10 );
+ hbox.show();
+ dlg.add(hbox);
gtk_container_set_border_width( GTK_CONTAINER( hbox ), 10 );
char const *label_text = "Version 1.000\n\n"
}
void DoConfigDialog(){
- GtkWidget *dlg, *hbox, *vbox, *vbox2, *button, *table, *frame;
+ GtkWidget *hbox, *button, *table;
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;
- dlg = ui::Window( ui::window_type::TOP );
+ auto dlg = ui::Window( ui::window_type::TOP );
gtk_window_set_title( GTK_WINDOW( dlg ), "Portal Viewer Configuration" );
g_signal_connect( GTK_OBJECT( dlg ), "delete_event",
G_CALLBACK( dialog_delete_callback ), NULL );
g_object_set_data( G_OBJECT( dlg ), "loop", &loop );
g_object_set_data( G_OBJECT( dlg ), "ret", &ret );
- vbox = ui::VBox( FALSE, 5 );
- gtk_widget_show( vbox );
- gtk_container_add( GTK_CONTAINER( dlg ), vbox );
+ auto vbox = ui::VBox( FALSE, 5 );
+ vbox.show();
+ dlg.add(vbox);
gtk_container_set_border_width( GTK_CONTAINER( vbox ), 5 );
- frame = ui::Frame( "3D View" );
- gtk_widget_show( frame );
+ auto frame = ui::Frame( "3D View" );
+ frame.show();
gtk_box_pack_start( GTK_BOX( vbox ), frame, TRUE, TRUE, 0 );
- vbox2 = ui::VBox( FALSE, 5 );
- gtk_widget_show( vbox2 );
- gtk_container_add( GTK_CONTAINER( frame ), vbox2 );
+ auto vbox2 = ui::VBox( FALSE, 5 );
+ vbox2.show();
+ frame.add(vbox2);
gtk_container_set_border_width( GTK_CONTAINER( vbox2 ), 5 );
hbox = ui::HBox( FALSE, 5 );
gtk_box_pack_start( GTK_BOX( vbox ), frame, TRUE, TRUE, 0 );
vbox2 = ui::VBox( FALSE, 5 );
- gtk_widget_show( vbox2 );
- gtk_container_add( GTK_CONTAINER( frame ), vbox2 );
+ vbox2.show();
+ frame.add(vbox2);
gtk_container_set_border_width( GTK_CONTAINER( vbox2 ), 5 );
hbox = ui::HBox( FALSE, 5 );
}
int DoLoadPortalFileDialog(){
- GtkWidget *dlg, *vbox, *hbox, *button, *entry, *check2d, *check3d;
+ GtkWidget *hbox, *button, *entry, *check2d, *check3d;
int loop = 1, ret = IDCANCEL;
- dlg = ui::Window( ui::window_type::TOP );
+ auto dlg = ui::Window( ui::window_type::TOP );
gtk_window_set_title( GTK_WINDOW( dlg ), "Load .prt" );
g_signal_connect( GTK_OBJECT( dlg ), "delete_event",
G_CALLBACK( dialog_delete_callback ), NULL );
g_object_set_data( G_OBJECT( dlg ), "loop", &loop );
g_object_set_data( G_OBJECT( dlg ), "ret", &ret );
- vbox = ui::VBox( FALSE, 5 );
- gtk_widget_show( vbox );
- gtk_container_add( GTK_CONTAINER( dlg ), vbox );
+ auto vbox = ui::VBox( FALSE, 5 );
+ vbox.show();
+ dlg.add(vbox);
gtk_container_set_border_width( GTK_CONTAINER( vbox ), 5 );
entry = ui::Entry();
// About dialog
void about_plugin_window(){
- GtkWidget *window, *vbox, *label, *button;
+ GtkWidget *label, *button;
- window = ui::Window( ui::window_type::TOP ); // create a window
+ auto 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 = 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
+ auto vbox = ui::VBox( FALSE, 10 ); // create a box to arrange new objects vertically
+ window.add(vbox);
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
// MapCoordinator dialog window
void MapCoordinator(){
- GtkWidget *window, *vbox, *table, *label, *spinnerMinX, *spinnerMinY, *spinnerMaxX, *spinnerMaxY, *button;
+ GtkWidget *table, *label, *spinnerMinX, *spinnerMinY, *spinnerMaxX, *spinnerMaxY, *button;
Entity *theWorldspawn = NULL;
const char *buffer;
char line[20];
// in any case we need a window to show the user what to do
- window = ui::Window( ui::window_type::TOP ); // create the window
+ auto 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 = 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
+ auto vbox = ui::VBox( FALSE, 10 ); // create a box to arrange new objects vertically
+ window.add(vbox);
scene::Path path = makeReference( GlobalSceneGraph().root() ); // get the path to the root element of the graph
scene::Instance* instance = GlobalSceneGraph().find( path ); // find the instance to the given path
void button_set_icon( ui::Button button, const char* icon ){
ui::Image image = ui::Image(new_local_image( icon ));
image.show();
- gtk_container_add( GTK_CONTAINER( button ), GTK_WIDGET( image ) );
+ button.add(image);
}
void toggle_button_set_active_no_signal( ui::ToggleButton button, gboolean active ){
#include <gtk/gtk.h>
inline ui::Widget container_add_widget( ui::Container container, ui::Widget widget ){
- gtk_container_add( container, widget );
+ container.add(widget);
return widget;
}
inline void container_remove( ui::Widget item, gpointer data ){
auto container = ui::Container(GTK_CONTAINER( data ));
- gtk_container_remove( container, item );
+ container.add(item);
}
inline void container_remove_all( ui::Container container ){
ui::Window create_simple_modal_dialog_window( const char* title, ModalDialog& dialog, ui::Widget contents ){
ui::Window window = create_fixedsize_modal_dialog_window(ui::Window(), title, dialog );
- GtkVBox* vbox1 = create_dialog_vbox( 8, 4 );
- gtk_container_add( GTK_CONTAINER( window ), GTK_WIDGET( vbox1 ) );
+ auto vbox1 = create_dialog_vbox( 8, 4 );
+ window.add(vbox1);
- gtk_container_add( GTK_CONTAINER( vbox1 ), contents );
+ vbox1.add(contents);
ui::Alignment alignment = ui::Alignment( 0.5, 0.0, 0.0, 0.0 );
gtk_widget_show( GTK_WIDGET( alignment ) );
gtk_box_pack_start( GTK_BOX( vbox1 ), GTK_WIDGET( alignment ), FALSE, FALSE, 0 );
- GtkButton* button = create_dialog_button( "OK", G_CALLBACK( dialog_button_ok ), &dialog );
- gtk_container_add( GTK_CONTAINER( alignment ), GTK_WIDGET( button ) );
+ auto button = create_dialog_button( "OK", G_CALLBACK( dialog_button_ok ), &dialog );
+ alignment.add(button);
return window;
}
gtk_frame_set_shadow_type( frame, GTK_SHADOW_IN );
// path entry
- GtkHBox* hbox = ui::HBox( FALSE, 0 );
+ auto hbox = ui::HBox( FALSE, 0 );
gtk_widget_show( GTK_WIDGET( hbox ) );
auto entry = ui::Entry();
gtk_widget_show( GTK_WIDGET( button ) );
gtk_box_pack_end( GTK_BOX( hbox ), GTK_WIDGET( button ), FALSE, FALSE, 0 );
- gtk_container_add( GTK_CONTAINER( frame ), GTK_WIDGET( hbox ) );
+ frame.add(hbox);
return PathEntry( frame, entry, button );
}
auto frame = ui::Frame();
frame.show();
gtk_frame_set_shadow_type( frame, GTK_SHADOW_IN );
- gtk_container_add( GTK_CONTAINER( frame ), widget );
- gtk_widget_show( GTK_WIDGET( widget ) );
+ frame.add(widget);
+ widget.show();
return frame;
}
#include "pointer.h"
void menu_add_item( ui::Menu menu, ui::MenuItem item ){
- gtk_container_add( GTK_CONTAINER( menu ), GTK_WIDGET( item ) );
+ menu.add(item);
}
ui::MenuItem menu_separator( ui::Menu menu ){
auto accel = ui::AccelGroup();
window.add_accel_group( accel );
- GtkVBox* vbox = create_dialog_vbox( 8, 8 );
- gtk_container_add( GTK_CONTAINER( window ), GTK_WIDGET( vbox ) );
+ auto vbox = create_dialog_vbox( 8, 8 );
+ window.add(vbox);
GtkHBox* hboxDummy = create_dialog_hbox( 0, 0 );
GtkVBox* vboxDummy = create_dialog_vbox( 0, 0 );
gtk_box_pack_start( GTK_BOX( vbox ), GTK_WIDGET( vboxDummy ), FALSE, FALSE, 0 );
- GtkAlignment* alignment = ui::Alignment( 0.5, 0.0, 0.0, 0.0 );
+ auto 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 );
- GtkHBox* hbox = create_dialog_hbox( 8, 0 );
- gtk_container_add( GTK_CONTAINER( alignment ), GTK_WIDGET( hbox ) );
+ auto hbox = create_dialog_hbox( 8, 0 );
+ alignment.add(hbox);
gtk_box_pack_start( GTK_BOX( vboxDummy ), create_padding( 400, 0 ), FALSE, FALSE, 0 ); // HACK to force minimum width
#include "image.h"
-void toolbar_append( ui::Toolbar toolbar, GtkToolItem* button, const char* description ){
+void toolbar_append( ui::Toolbar toolbar, ui::ToolItem 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));
+ toolbar.add(button);
}
ui::ToolButton toolbar_append_button( ui::Toolbar toolbar, const char* description, const char* icon, const Callback& callback ){
auto button = ui::ToolButton(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);
+ toolbar_append(toolbar, button, description);
return button;
}
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);
+ toolbar_append(toolbar, button, description);
return button;
}
gtk_widget_show(this);
}
+ IMPL(Container, GTK_CONTAINER);
+
+ void IContainer::add(Widget widget)
+ {
+ gtk_container_add(this, widget);
+ }
+
+ IMPL(Bin, GTK_BIN);
+
IMPL(Window, GTK_WINDOW);
Window::Window() : Window(nullptr)
struct _GtkDialog;
struct _GtkEditable;
struct _GtkEntry;
+struct _GtkEntryCompletion;
struct _GtkFrame;
struct _GtkHBox;
struct _GtkHPaned;
};
}
+ extern struct Null {} null;
+
class Object :
public details::Convertible<Object, _GtkObject *, details::Convert::Explicit>,
public details::Convertible<Object, _GTypeInstance *, details::Convert::Explicit> {
#define WRAP(name, super, T, interfaces, ctors, methods) \
class name; \
- class I##name { \
+ class I##name : public details::Convertible<name, T *, details::Convert::Implicit> { \
public: \
using self = name *; \
methods \
}; \
- class name : public super, public details::Convertible<name, T *, details::Convert::Implicit>, public I##name, public details::Mixin<name, void interfaces>::type { \
+ class name : public super, public I##name, public details::Mixin<name, void interfaces>::type { \
public: \
using self = name *; \
using native = T *; \
explicit name(native h) : super(reinterpret_cast<super::native>(h)) {} \
+ explicit name(Null n) : name((native) nullptr) {} \
ctors \
}; \
inline bool operator<(name self, name other) { return self._handle < other._handle; } \
// https://developer.gnome.org/gtk2/stable/ch01.html
+ // GInterface
+
WRAP(CellEditable, Object, _GtkCellEditable, (),
,
);
void editable(bool value);
);
+ WRAP(TreeModel, Object, _GtkTreeModel, (),
+ ,
+ );
+
+ // GObject
+
WRAP(Widget, Object, _GtkWidget, (),
Widget();
,
WRAP(Container, Widget, _GtkContainer, (),
,
+ void add(Widget widget);
);
WRAP(Bin, Container, _GtkBin, (),
,
);
- WRAP(ListStore, Object, _GtkListStore, (),
+ WRAP(EntryCompletion, Object, _GtkEntryCompletion, (),
,
- void clear();
);
- WRAP(TreeModel, Widget, _GtkTreeModel, (),
+ WRAP(ListStore, Object, _GtkListStore, (ITreeModel),
,
+ void clear();
);
+ // GBoxed
+
WRAP(TreePath, Object, _GtkTreePath, (),
TreePath();
TreePath(const char *path);
}
int DoMessageBox( const char* lpText, const char* lpCaption, guint32 uType ){
- GtkWidget *window, *w, *vbox, *hbox;
+ GtkWidget *w, *vbox, *hbox;
int mode = ( uType & MB_TYPEMASK ), ret, loop = 1;
- window = ui::Window( ui::window_type::TOP );
+ auto 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",
gtk_widget_realize( window );
vbox = ui::VBox( FALSE, 10 );
- gtk_container_add( GTK_CONTAINER( window ), vbox );
+ window.add(vbox);
gtk_widget_show( vbox );
w = ui::Label( lpText );
ui::Widget buildView;
{
- GtkTable* table1 = create_dialog_table( 2, 2, 4, 4, 4 );
- gtk_container_add( GTK_CONTAINER( window ), GTK_WIDGET( table1 ) );
+ auto table1 = create_dialog_table( 2, 2, 4, 4, 4 );
+ window.add(table1);
{
GtkVBox* vbox = create_dialog_vbox( 4 );
gtk_table_attach( table1, GTK_WIDGET( vbox ), 1, 2, 0, 1,
}
}
{
- GtkFrame* frame = create_dialog_frame( "Build menu" );
+ auto frame = create_dialog_frame( "Build menu" );
gtk_table_attach( table1, GTK_WIDGET( frame ), 0, 1, 0, 1,
(GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ),
(GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ), 0, 0 );
{
- GtkScrolledWindow* scr = create_scrolled_window( GTK_POLICY_NEVER, GTK_POLICY_AUTOMATIC, 4 );
- gtk_container_add( GTK_CONTAINER( frame ), GTK_WIDGET( scr ) );
+ auto scr = create_scrolled_window( GTK_POLICY_NEVER, GTK_POLICY_AUTOMATIC, 4 );
+ frame.add(scr);
{
auto store = ui::ListStore(gtk_list_store_new( 1, G_TYPE_STRING ));
buildView = view;
projectList.m_store = store;
- gtk_container_add( GTK_CONTAINER( scr ), view );
+ scr.add(view);
g_signal_connect( G_OBJECT( view ), "key_press_event", G_CALLBACK( project_key_press ), &projectList );
}
}
{
- GtkFrame* frame = create_dialog_frame( "Commandline" );
+ auto frame = create_dialog_frame( "Commandline" );
gtk_table_attach( table1, GTK_WIDGET( frame ), 0, 1, 1, 2,
(GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ),
(GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ), 0, 0 );
{
- GtkScrolledWindow* scr = create_scrolled_window( GTK_POLICY_NEVER, GTK_POLICY_AUTOMATIC, 4 );
- gtk_container_add( GTK_CONTAINER( frame ), GTK_WIDGET( scr ) );
+ auto scr = create_scrolled_window( GTK_POLICY_NEVER, GTK_POLICY_AUTOMATIC, 4 );
+ frame.add(scr);
{
ui::ListStore store = ui::ListStore(gtk_list_store_new( 1, G_TYPE_STRING ));
view.show();
- gtk_container_add( GTK_CONTAINER( scr ), view );
+ scr.add(view);
g_object_unref( G_OBJECT( store ) );
auto accel = ui::AccelGroup();
window.add_accel_group( accel );
- GtkHBox* hbox = create_dialog_hbox( 4, 4 );
- gtk_container_add( GTK_CONTAINER( window ), GTK_WIDGET( hbox ) );
+ auto hbox = create_dialog_hbox( 4, 4 );
+ window.add(hbox);
{
- GtkScrolledWindow* scr = create_scrolled_window( GTK_POLICY_NEVER, GTK_POLICY_AUTOMATIC );
+ auto scr = create_scrolled_window( GTK_POLICY_NEVER, GTK_POLICY_AUTOMATIC );
gtk_box_pack_start( GTK_BOX( hbox ), GTK_WIDGET( scr ), TRUE, TRUE, 0 );
{
}
view.show();
- gtk_container_add( GTK_CONTAINER( scr ), view );
+ scr.add(view);
{
// Initialize dialog
WidgetFocusPrinter g_consoleWidgetFocusPrinter( "console" );
ui::Widget Console_constructWindow( ui::Window toplevel ){
- ui::Widget scr = ui::ScrolledWindow();
+ auto 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 );
scr.show();
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 );
- gtk_container_add( GTK_CONTAINER( scr ), text );
+ scr.add(text);
text.show();
g_console = text;
#include "gtkmisc.h"
-GtkEntry* DialogEntry_new(){
+ui::Entry DialogEntry_new(){
auto entry = ui::Entry();
entry.show();
gtk_widget_set_size_request( GTK_WIDGET( entry ), 64, -1 );
};
DialogEntryRow DialogEntryRow_new( const char* name ){
- ui::Widget alignment = ui::Alignment( 0.0, 0.5, 0.0, 0.0 );
+ auto alignment = ui::Alignment( 0.0, 0.5, 0.0, 0.0 );
alignment.show();
- GtkEntry* entry = DialogEntry_new();
- gtk_container_add( GTK_CONTAINER( alignment ), GTK_WIDGET( entry ) );
+ auto entry = DialogEntry_new();
+ alignment.add(entry);
return DialogEntryRow( ui::Widget(GTK_WIDGET( DialogRow_new( name, alignment ) )), entry );
}
-GtkSpinButton* DialogSpinner_new( double value, double lower, double upper, int fraction ){
+ui::SpinButton DialogSpinner_new( double value, double lower, double upper, int fraction ){
double step = 1.0 / double(fraction);
unsigned int digits = 0;
for (; fraction > 1; fraction /= 10 )
};
DialogSpinnerRow DialogSpinnerRow_new( const char* name, double value, double lower, double upper, int fraction ){
- ui::Widget alignment = ui::Alignment( 0.0, 0.5, 0.0, 0.0 );
+ auto alignment = ui::Alignment( 0.0, 0.5, 0.0, 0.0 );
alignment.show();
- GtkSpinButton* spin = DialogSpinner_new( value, lower, upper, fraction );
- gtk_container_add( GTK_CONTAINER( alignment ), GTK_WIDGET( spin ) );
+ auto spin = DialogSpinner_new( value, lower, upper, fraction );
+ alignment.add(spin);
return DialogSpinnerRow( ui::Widget(GTK_WIDGET( DialogRow_new( name, alignment ) )), spin );
}
}
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 );
+ auto alignment = ui::Alignment( 0.0, 0.5, 0.0, 0.0 );
alignment.show();
{
ui::Widget combo = ui::ComboBoxText();
AddIntComboData( *GTK_COMBO_BOX( combo ), importViewer, exportViewer );
combo.show();
- gtk_container_add( GTK_CONTAINER( alignment ), combo );
+ alignment.add(combo);
}
auto row = DialogRow_new( name, alignment );
AddIntAdjustmentData( *GTK_ADJUSTMENT(adj), IntImportCaller( data ), IntExportCaller( data ) );
// scale
- ui::Widget alignment = ui::Alignment( 0.0, 0.5, 1.0, 0.0 );
+ auto alignment = ui::Alignment( 0.0, 0.5, 1.0, 0.0 );
alignment.show();
ui::Widget scale = ui::HScale( adj );
gtk_scale_set_value_pos( GTK_SCALE( scale ), GTK_POS_LEFT );
scale.show();
- gtk_container_add( GTK_CONTAINER( alignment ), scale );
+ alignment.add(scale);
gtk_scale_set_draw_value( GTK_SCALE( scale ), draw_value );
gtk_scale_set_digits( GTK_SCALE( scale ), 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 );
+ auto alignment = ui::Alignment( 0.0, 0.5, 0.0, 0.0 );
alignment.show();;
{
RadioHBox radioBox = RadioHBox_new( names );
- gtk_container_add( GTK_CONTAINER( alignment ), GTK_WIDGET( radioBox.m_hbox ) );
+ alignment.add(radioBox.m_hbox);
AddIntRadioData( *GTK_RADIO_BUTTON( radioBox.m_radio ), importViewer, exportViewer );
}
ui::Widget getWidget() const {
return ui::Widget(GTK_WIDGET( m_entry ));
}
-GtkEntry* getEntry() const {
+ui::Entry getEntry() const {
return m_entry;
}
{
// class list
- ui::Widget scr = ui::ScrolledWindow();
+ auto scr = ui::ScrolledWindow();
scr.show();
gtk_paned_add1( GTK_PANED( split2 ), scr );
gtk_scrolled_window_set_policy( GTK_SCROLLED_WINDOW( scr ), GTK_POLICY_NEVER, GTK_POLICY_ALWAYS );
view.show();
- gtk_container_add( GTK_CONTAINER( scr ), GTK_WIDGET( view ) );
+ scr.add(view);
g_object_unref( G_OBJECT( store ) );
g_entityClassList = view;
}
{
- ui::Widget scr = ui::ScrolledWindow();
+ auto scr = ui::ScrolledWindow();
scr.show();
gtk_paned_add2( GTK_PANED( split2 ), scr );
gtk_scrolled_window_set_policy( GTK_SCROLLED_WINDOW( scr ), GTK_POLICY_NEVER, GTK_POLICY_ALWAYS );
gtk_text_view_set_wrap_mode( text, GTK_WRAP_WORD );
gtk_text_view_set_editable( text, FALSE );
text.show();
- gtk_container_add( GTK_CONTAINER( scr ), GTK_WIDGET( text ) );
+ scr.add(text);
g_entityClassComment = text;
}
}
{
// key/value list
- ui::Widget scr = ui::ScrolledWindow();
+ auto scr = ui::ScrolledWindow();
scr.show();
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 );
view.show();
- gtk_container_add( GTK_CONTAINER( scr ), view );
+ scr.add(view);
g_object_unref( G_OBJECT( store ) );
}
{
- ui::Widget scr = ui::ScrolledWindow();
+ auto scr = ui::ScrolledWindow();
scr.show();
gtk_scrolled_window_set_policy( GTK_SCROLLED_WINDOW( scr ), GTK_POLICY_NEVER, GTK_POLICY_AUTOMATIC );
- ui::Widget viewport = ui::Widget(gtk_viewport_new( 0, 0 ));
+ auto viewport = ui::Container(GTK_CONTAINER(gtk_viewport_new( 0, 0 )));
viewport.show();
gtk_viewport_set_shadow_type( GTK_VIEWPORT( viewport ), GTK_SHADOW_NONE );
g_attributeBox = ui::VBox( FALSE, 2 );
g_attributeBox.show();
- gtk_container_add( GTK_CONTAINER( viewport ), GTK_WIDGET( g_attributeBox ) );
- gtk_container_add( GTK_CONTAINER( scr ), viewport );
+ viewport.add(g_attributeBox);
+ scr.add(viewport);
gtk_paned_pack2( GTK_PANED( split2 ), scr, FALSE, FALSE );
}
}
void EntityList_constructWindow( ui::Window main_window ){
ASSERT_TRUE( !getEntityList().m_window );
- ui::Window window = ui::Window(create_persistent_floating_window( "Entity List", main_window ));
+ auto window = ui::Window(create_persistent_floating_window( "Entity List", main_window ));
window.add_accel_group(global_accel);
getEntityList().m_window = window;
{
- GtkScrolledWindow* scr = create_scrolled_window( GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC );
- gtk_container_add( GTK_CONTAINER( window ), GTK_WIDGET( scr ) );
+ auto scr = create_scrolled_window( GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC );
+ window.add(scr);
{
ui::Widget view = ui::TreeView();
gtk_tree_view_append_column( GTK_TREE_VIEW( view ), column );
view.show();
- gtk_container_add( GTK_CONTAINER( scr ), view );
+ scr.add(view);
getEntityList().m_tree_view = GTK_TREE_VIEW( view );
}
}
g_ptr_array_remove_index( m_pFeedbackElements, 0 );
}
- if ( m_clist != NULL ) {
+ if ( m_clist ) {
gtk_list_store_clear( m_clist );
}
}
}
ui::Window CDbgDlg::BuildDialog(){
- ui::Window window = MainFrame_getWindow().create_floating_window("Q3Map debug window" );
+ auto window = MainFrame_getWindow().create_floating_window("Q3Map debug window" );
- ui::Widget scr = ui::ScrolledWindow();
+ auto scr = ui::ScrolledWindow();
scr.show();
- gtk_container_add( GTK_CONTAINER( window ), GTK_WIDGET( scr ) );
+ window.add(scr);
gtk_scrolled_window_set_policy( GTK_SCROLLED_WINDOW( scr ), GTK_POLICY_NEVER, GTK_POLICY_AUTOMATIC );
gtk_scrolled_window_set_shadow_type( GTK_SCROLLED_WINDOW( scr ), GTK_SHADOW_IN );
view.show();
- gtk_container_add( GTK_CONTAINER( scr ), view );
+ scr.add(view);
g_object_unref( G_OBJECT( store ) );
ui::Window FindTextureDialog::BuildDialog(){
ui::Widget vbox, hbox, table, label;
- ui::Widget button, check, entry;
+ ui::Widget button, check;
+ ui::Entry entry{nullptr};
- ui::Window dlg = ui::Window(create_floating_window( "Find / Replace Texture(s)", m_parent ));
+ auto dlg = ui::Window(create_floating_window( "Find / Replace Texture(s)", m_parent ));
hbox = ui::HBox( FALSE, 5 );
hbox.show();
- gtk_container_add( GTK_CONTAINER( dlg ), GTK_WIDGET( hbox ) );
+ dlg.add(hbox);
gtk_container_set_border_width( GTK_CONTAINER( hbox ), 5 );
vbox = ui::VBox( FALSE, 5 );
g_signal_connect( G_OBJECT( entry ), "focus_in_event",
G_CALLBACK( find_focus_in ), 0 );
AddDialogData( *GTK_ENTRY( entry ), m_strFind );
- GlobalTextureEntryCompletion::instance().connect( GTK_ENTRY( entry ) );
+ GlobalTextureEntryCompletion::instance().connect( entry );
entry = ui::Entry();
entry.show();
g_signal_connect( G_OBJECT( entry ), "focus_in_event",
G_CALLBACK( replace_focus_in ), 0 );
AddDialogData( *GTK_ENTRY( entry ), m_strReplace );
- GlobalTextureEntryCompletion::instance().connect( GTK_ENTRY( entry ) );
+ GlobalTextureEntryCompletion::instance().connect( entry );
check = ui::CheckButton( "Within selected brushes only" );
check.show();
void GroupDlg::Create( ui::Window parent ){
ASSERT_MESSAGE( !m_window, "dialog already created" );
- ui::Window window = ui::Window(create_persistent_floating_window( "Entities", parent ));
+ auto window = ui::Window(create_persistent_floating_window( "Entities", parent ));
global_accel_connect_window( window );
{
ui::Widget notebook = ui::Widget(gtk_notebook_new());
notebook.show();
- gtk_container_add( GTK_CONTAINER( window ), notebook );
+ window.add(notebook);
gtk_notebook_set_tab_pos( GTK_NOTEBOOK( notebook ), GTK_POS_BOTTOM );
m_pNotebook = notebook;
};
ui::Window ProjectSettingsDialog_construct( ProjectSettingsDialog& dialog, ModalDialog& modal ){
- ui::Window window = MainFrame_getWindow().create_dialog_window("Project Settings", G_CALLBACK(dialog_delete_callback ), &modal );
+ auto 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( window ), GTK_WIDGET( table1 ) );
+ auto table1 = create_dialog_table( 1, 2, 4, 4, 4 );
+ window.add(table1);
{
GtkVBox* vbox = create_dialog_vbox( 4 );
gtk_table_attach( table1, GTK_WIDGET( vbox ), 1, 2, 0, 1,
}
}
{
- GtkFrame* frame = create_dialog_frame( "Project settings" );
+ auto frame = create_dialog_frame( "Project settings" );
gtk_table_attach( table1, GTK_WIDGET( frame ), 0, 1, 0, 1,
(GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ),
(GtkAttachOptions) ( GTK_FILL ), 0, 0 );
{
- GtkTable* table2 = create_dialog_table( ( globalMappingMode().do_mapping_mode ) ? 4 : 3, 2, 4, 4, 4 );
- gtk_container_add( GTK_CONTAINER( frame ), GTK_WIDGET( table2 ) );
+ auto table2 = create_dialog_table( ( globalMappingMode().do_mapping_mode ) ? 4 : 3, 2, 4, 4, 4 );
+ frame.add(table2);
{
auto label = ui::Label( "Select mod" );
ModalDialog dialog;
GtkEntry* sides_entry;
- ui::Window window = MainFrame_getWindow().create_dialog_window("Arbitrary sides", G_CALLBACK(dialog_delete_callback ), &dialog );
+ auto window = MainFrame_getWindow().create_dialog_window("Arbitrary sides", G_CALLBACK(dialog_delete_callback ), &dialog );
auto accel = ui::AccelGroup();
window.add_accel_group( accel );
{
- GtkHBox* hbox = create_dialog_hbox( 4, 4 );
- gtk_container_add( GTK_CONTAINER( window ), GTK_WIDGET( hbox ) );
+ auto hbox = create_dialog_hbox( 4, 4 );
+ window.add(hbox);
{
auto label = ui::Label( "Sides:" );
label.show();
ModalDialog dialog;
ModalDialogButton ok_button( dialog, eIDOK );
- ui::Window window = MainFrame_getWindow().create_modal_dialog_window("About NetRadiant", dialog );
+ auto window = MainFrame_getWindow().create_modal_dialog_window("About NetRadiant", dialog );
{
- GtkVBox* vbox = create_dialog_vbox( 4, 4 );
- gtk_container_add( GTK_CONTAINER( window ), GTK_WIDGET( vbox ) );
+ auto vbox = create_dialog_vbox( 4, 4 );
+ window.add(vbox);
{
GtkHBox* hbox = create_dialog_hbox( 4 );
GtkVBox* vbox2 = create_dialog_vbox( 4 );
gtk_box_pack_start( GTK_BOX( hbox ), GTK_WIDGET( vbox2 ), TRUE, FALSE, 0 );
{
- GtkFrame* frame = create_dialog_frame( 0, GTK_SHADOW_IN );
+ auto frame = create_dialog_frame( 0, GTK_SHADOW_IN );
gtk_box_pack_start( GTK_BOX( vbox2 ), GTK_WIDGET( frame ), FALSE, FALSE, 0 );
{
auto image = new_local_image( "logo.png" );
image.show();
- gtk_container_add( GTK_CONTAINER( frame ), GTK_WIDGET( image ) );
+ frame.add(image);
}
}
}
}
}
{
- GtkFrame* frame = create_dialog_frame( "OpenGL Properties" );
+ auto frame = create_dialog_frame( "OpenGL Properties" );
gtk_box_pack_start( GTK_BOX( vbox ), GTK_WIDGET( frame ), FALSE, FALSE, 0 );
{
- GtkTable* table = create_dialog_table( 3, 2, 4, 4, 4 );
- gtk_container_add( GTK_CONTAINER( frame ), GTK_WIDGET( table ) );
+ auto table = create_dialog_table( 3, 2, 4, 4, 4 );
+ frame.add(table);
{
auto label = ui::Label( "Vendor:" );
label.show();
}
}
{
- GtkFrame* frame = create_dialog_frame( "OpenGL Extensions" );
+ auto frame = create_dialog_frame( "OpenGL Extensions" );
gtk_box_pack_start( GTK_BOX( vbox ), GTK_WIDGET( frame ), TRUE, TRUE, 0 );
{
- GtkScrolledWindow* sc_extensions = create_scrolled_window( GTK_POLICY_AUTOMATIC, GTK_POLICY_ALWAYS, 4 );
- gtk_container_add( GTK_CONTAINER( frame ), GTK_WIDGET( sc_extensions ) );
+ auto sc_extensions = create_scrolled_window( GTK_POLICY_AUTOMATIC, GTK_POLICY_ALWAYS, 4 );
+ frame.add(sc_extensions);
{
- ui::Widget text_extensions = ui::TextView();
+ auto text_extensions = ui::TextView();
gtk_text_view_set_editable( GTK_TEXT_VIEW( text_extensions ), FALSE );
- gtk_container_add( GTK_CONTAINER( sc_extensions ), text_extensions );
+ sc_extensions.add(text_extensions);
GtkTextBuffer* buffer = gtk_text_view_get_buffer( GTK_TEXT_VIEW( text_extensions ) );
gtk_text_buffer_set_text( buffer, reinterpret_cast<const char*>( glGetString( GL_EXTENSIONS ) ), -1 );
gtk_text_view_set_wrap_mode( GTK_TEXT_VIEW( text_extensions ), GTK_WRAP_WORD );
GtkEntry* x;
GtkEntry* y;
- ui::Window window = MainFrame_getWindow().create_modal_dialog_window("Patch texture layout", dialog );
+ auto window = MainFrame_getWindow().create_modal_dialog_window("Patch texture layout", dialog );
auto accel = ui::AccelGroup();
window.add_accel_group( accel );
{
- GtkHBox* hbox = create_dialog_hbox( 4, 4 );
- gtk_container_add( GTK_CONTAINER( window ), GTK_WIDGET( hbox ) );
+ auto hbox = create_dialog_hbox( 4, 4 );
+ window.add(hbox);
{
GtkVBox* vbox = create_dialog_vbox( 4 );
gtk_box_pack_start( GTK_BOX( hbox ), GTK_WIDGET( vbox ), TRUE, TRUE, 0 );
}
static void CreateGtkTextEditor(){
- ui::Widget dlg;
- ui::Widget vbox, hbox, button, scr, text;
+ ui::Widget vbox, hbox, button, text;
- dlg = ui::Window( ui::window_type::TOP );
+ auto dlg = ui::Window( ui::window_type::TOP );
g_signal_connect( G_OBJECT( dlg ), "delete_event",
G_CALLBACK( editor_delete ), 0 );
vbox = ui::VBox( FALSE, 5 );
vbox.show();
- gtk_container_add( GTK_CONTAINER( dlg ), GTK_WIDGET( vbox ) );
+ dlg.add(vbox);
gtk_container_set_border_width( GTK_CONTAINER( vbox ), 5 );
- scr = ui::ScrolledWindow();
+ auto scr = ui::ScrolledWindow();
scr.show();
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 = ui::TextView();
- gtk_container_add( GTK_CONTAINER( scr ), text );
+ scr.add(text);
text.show();
g_object_set_data( G_OBJECT( dlg ), "text", (gpointer) text );
gtk_text_view_set_editable( GTK_TEXT_VIEW( text ), TRUE );
window.add_accel_group( accel_group );
{
- GtkHBox* hbox = create_dialog_hbox( 4, 4 );
- gtk_container_add( GTK_CONTAINER( window ), GTK_WIDGET( hbox ) );
+ auto hbox = create_dialog_hbox( 4, 4 );
+ window.add(hbox);
{
GtkVBox* vbox = create_dialog_vbox( 4 );
gtk_box_pack_start( GTK_BOX( hbox ), GTK_WIDGET( vbox ), TRUE, TRUE, 0 );
ModalDialogButton ok_button( dialog, eIDOK );
ModalDialogButton cancel_button( dialog, eIDCANCEL );
- ui::Window window = MainFrame_getWindow().create_modal_dialog_window(title, dialog, -1, -1 );
+ auto window = MainFrame_getWindow().create_modal_dialog_window(title, dialog, -1, -1 );
auto accel_group = ui::AccelGroup();
window.add_accel_group( accel_group );
{
- GtkHBox* hbox = create_dialog_hbox( 4, 4 );
- gtk_container_add( GTK_CONTAINER( window ), GTK_WIDGET( hbox ) );
+ auto hbox = create_dialog_hbox( 4, 4 );
+ window.add(hbox);
{
GtkVBox* vbox = create_dialog_vbox( 4 );
gtk_box_pack_start( GTK_BOX( hbox ), GTK_WIDGET( vbox ), TRUE, TRUE, 0 );
ModalDialog dialog;
ModalDialogButton ok_button( dialog, eIDOK );
- ui::Window window = MainFrame_getWindow().create_modal_dialog_window(title, dialog, -1, -1 );
+ auto window = MainFrame_getWindow().create_modal_dialog_window(title, dialog, -1, -1 );
auto accel_group = ui::AccelGroup();
window.add_accel_group( accel_group );
{
- GtkHBox* hbox = create_dialog_hbox( 4, 4 );
- gtk_container_add( GTK_CONTAINER( window ), GTK_WIDGET( hbox ) );
+ auto hbox = create_dialog_hbox( 4, 4 );
+ window.add(hbox);
{
GtkVBox* vbox = create_dialog_vbox( 4 );
gtk_box_pack_start( GTK_BOX( hbox ), GTK_WIDGET( vbox ), FALSE, FALSE, 0 );
#include "mainframe.h"
-#include "debugging/debugging.h"
-#include "version.h"
-
#include "ifilesystem.h"
#include "iundo.h"
-#include "ifilter.h"
-#include "itoolbar.h"
#include "editable.h"
#include "ientity.h"
#include "ishaders.h"
#include "cmdlib.h"
-#include "scenelib.h"
#include "stream/stringstream.h"
#include "signal/isignal.h"
#include "os/path.h"
#include "moduleobservers.h"
#include "gtkutil/clipboard.h"
-#include "gtkutil/container.h"
#include "gtkutil/frame.h"
-#include "gtkutil/glfont.h"
#include "gtkutil/glwidget.h"
#include "gtkutil/image.h"
#include "gtkutil/menu.h"
#include "gtkutil/paned.h"
-#include "gtkutil/widget.h"
#include "autosave.h"
#include "build.h"
#include "pluginmanager.h"
#include "pluginmenu.h"
#include "plugintoolbar.h"
-#include "points.h"
#include "preferences.h"
#include "qe3.h"
#include "qgl.h"
auto frame = create_dialog_frame( "Path settings", GTK_SHADOW_ETCHED_IN );
auto vbox2 = create_dialog_vbox( 0, 4 );
- gtk_container_add( GTK_CONTAINER( frame ), GTK_WIDGET( vbox2 ) );
+ frame.add(vbox2);
{
PreferencesPage preferencesPage( *this, ui::Widget(GTK_WIDGET( vbox2 )) );
ColoursMenu g_ColoursMenu;
-GtkMenuItem* create_colours_menu(){
- GtkMenuItem* colours_menu_item = new_sub_menu_item_with_mnemonic( "Colors" );
+ui::MenuItem create_colours_menu(){
+ auto colours_menu_item = new_sub_menu_item_with_mnemonic( "Colors" );
auto menu_in_menu = ui::Menu(GTK_MENU( gtk_menu_item_get_submenu( colours_menu_item ) ));
if ( g_Layout_enableDetachableMenus.m_value ) {
menu_tearoff( menu_in_menu );
dialog.m_label.show();
gtk_widget_set_size_request( GTK_WIDGET( dialog.m_label ), 200, -1 );
- gtk_container_add( GTK_CONTAINER( dialog.m_window ), GTK_WIDGET( dialog.m_label ) );
+ dialog.m_window.add(dialog.m_label);
}
return dialog;
}
-GtkMenuItem* create_file_menu(){
+ui::MenuItem create_file_menu(){
// File menu
- GtkMenuItem* file_menu_item = new_sub_menu_item_with_mnemonic( "_File" );
+ auto file_menu_item = new_sub_menu_item_with_mnemonic( "_File" );
auto menu = ui::Menu(GTK_MENU( gtk_menu_item_get_submenu( file_menu_item ) ));
if ( g_Layout_enableDetachableMenus.m_value ) {
menu_tearoff( menu );
return file_menu_item;
}
-GtkMenuItem* create_edit_menu(){
+ui::MenuItem create_edit_menu(){
// Edit menu
- GtkMenuItem* edit_menu_item = new_sub_menu_item_with_mnemonic( "_Edit" );
+ auto edit_menu_item = new_sub_menu_item_with_mnemonic( "_Edit" );
auto menu = ui::Menu(GTK_MENU( gtk_menu_item_get_submenu( edit_menu_item ) ));
if ( g_Layout_enableDetachableMenus.m_value ) {
menu_tearoff( menu );
ui::Widget g_toggle_entity_item;
ui::Widget g_toggle_entitylist_item;
-GtkMenuItem* create_view_menu( MainFrame::EViewStyle style ){
+ui::MenuItem create_view_menu( MainFrame::EViewStyle style ){
// View menu
- GtkMenuItem* view_menu_item = new_sub_menu_item_with_mnemonic( "Vie_w" );
+ auto view_menu_item = new_sub_menu_item_with_mnemonic( "Vie_w" );
auto menu = ui::Menu(GTK_MENU( gtk_menu_item_get_submenu( view_menu_item ) ));
if ( g_Layout_enableDetachableMenus.m_value ) {
menu_tearoff( menu );
return view_menu_item;
}
-GtkMenuItem* create_selection_menu(){
+ui::MenuItem create_selection_menu(){
// Selection menu
- GtkMenuItem* selection_menu_item = new_sub_menu_item_with_mnemonic( "M_odify" );
+ auto selection_menu_item = new_sub_menu_item_with_mnemonic( "M_odify" );
auto menu = ui::Menu(GTK_MENU( gtk_menu_item_get_submenu( selection_menu_item ) ));
if ( g_Layout_enableDetachableMenus.m_value ) {
menu_tearoff( menu );
return selection_menu_item;
}
-GtkMenuItem* create_bsp_menu(){
+ui::MenuItem create_bsp_menu(){
// BSP menu
- GtkMenuItem* bsp_menu_item = new_sub_menu_item_with_mnemonic( "_Build" );
+ auto bsp_menu_item = new_sub_menu_item_with_mnemonic( "_Build" );
auto menu = ui::Menu(GTK_MENU( gtk_menu_item_get_submenu( bsp_menu_item ) ));
if ( g_Layout_enableDetachableMenus.m_value ) {
return bsp_menu_item;
}
-GtkMenuItem* create_grid_menu(){
+ui::MenuItem create_grid_menu(){
// Grid menu
- GtkMenuItem* grid_menu_item = new_sub_menu_item_with_mnemonic( "_Grid" );
+ auto grid_menu_item = new_sub_menu_item_with_mnemonic( "_Grid" );
auto menu = ui::Menu(GTK_MENU( gtk_menu_item_get_submenu( grid_menu_item ) ));
if ( g_Layout_enableDetachableMenus.m_value ) {
menu_tearoff( menu );
return grid_menu_item;
}
-GtkMenuItem* create_misc_menu(){
+ui::MenuItem create_misc_menu(){
// Misc menu
- GtkMenuItem* misc_menu_item = new_sub_menu_item_with_mnemonic( "M_isc" );
+ auto misc_menu_item = new_sub_menu_item_with_mnemonic( "M_isc" );
auto menu = ui::Menu(GTK_MENU( gtk_menu_item_get_submenu( misc_menu_item ) ));
if ( g_Layout_enableDetachableMenus.m_value ) {
menu_tearoff( menu );
#if 0
create_menu_item_with_mnemonic( menu, "_Benchmark", FreeCaller<GlobalCamera_Benchmark>() );
#endif
- gtk_container_add( GTK_CONTAINER( menu ), GTK_WIDGET( create_colours_menu() ) );
+ menu.add(create_colours_menu());
create_menu_item_with_mnemonic( menu, "Find brush...", "FindBrush" );
create_menu_item_with_mnemonic( menu, "Map Info...", "MapInfo" );
return misc_menu_item;
}
-GtkMenuItem* create_entity_menu(){
+ui::MenuItem create_entity_menu(){
// Brush menu
- GtkMenuItem* entity_menu_item = new_sub_menu_item_with_mnemonic( "E_ntity" );
+ auto entity_menu_item = new_sub_menu_item_with_mnemonic( "E_ntity" );
auto menu = ui::Menu(GTK_MENU( gtk_menu_item_get_submenu( entity_menu_item ) ));
if ( g_Layout_enableDetachableMenus.m_value ) {
menu_tearoff( menu );
return entity_menu_item;
}
-GtkMenuItem* create_brush_menu(){
+ui::MenuItem create_brush_menu(){
// Brush menu
- GtkMenuItem* brush_menu_item = new_sub_menu_item_with_mnemonic( "B_rush" );
+ auto brush_menu_item = new_sub_menu_item_with_mnemonic( "B_rush" );
auto menu = ui::Menu(GTK_MENU( gtk_menu_item_get_submenu( brush_menu_item ) ));
if ( g_Layout_enableDetachableMenus.m_value ) {
menu_tearoff( menu );
return brush_menu_item;
}
-GtkMenuItem* create_patch_menu(){
+ui::MenuItem create_patch_menu(){
// Curve menu
- GtkMenuItem* patch_menu_item = new_sub_menu_item_with_mnemonic( "_Curve" );
+ auto patch_menu_item = new_sub_menu_item_with_mnemonic( "_Curve" );
auto menu = ui::Menu(GTK_MENU( gtk_menu_item_get_submenu( patch_menu_item ) ));
if ( g_Layout_enableDetachableMenus.m_value ) {
menu_tearoff( menu );
return patch_menu_item;
}
-GtkMenuItem* create_help_menu(){
+ui::MenuItem create_help_menu(){
// Help menu
- GtkMenuItem* help_menu_item = new_sub_menu_item_with_mnemonic( "_Help" );
+ auto help_menu_item = new_sub_menu_item_with_mnemonic( "_Help" );
auto menu = ui::Menu(GTK_MENU( gtk_menu_item_get_submenu( help_menu_item ) ));
if ( g_Layout_enableDetachableMenus.m_value ) {
menu_tearoff( menu );
auto menu_bar = ui::MenuBar(GTK_MENU_BAR( gtk_menu_bar_new() ));
menu_bar.show();
- gtk_container_add( menu_bar, GTK_WIDGET( create_file_menu() ) );
- gtk_container_add( menu_bar, GTK_WIDGET( create_edit_menu() ) );
- gtk_container_add( menu_bar, GTK_WIDGET( create_view_menu( style ) ) );
- gtk_container_add( menu_bar, GTK_WIDGET( create_selection_menu() ) );
- gtk_container_add( menu_bar, GTK_WIDGET( create_bsp_menu() ) );
- gtk_container_add( menu_bar, GTK_WIDGET( create_grid_menu() ) );
- gtk_container_add( menu_bar, GTK_WIDGET( create_misc_menu() ) );
- gtk_container_add( menu_bar, GTK_WIDGET( create_entity_menu() ) );
- gtk_container_add( menu_bar, GTK_WIDGET( create_brush_menu() ) );
- gtk_container_add( menu_bar, GTK_WIDGET( create_patch_menu() ) );
- gtk_container_add( menu_bar, GTK_WIDGET( create_plugins_menu() ) );
- gtk_container_add( menu_bar, GTK_WIDGET( create_help_menu() ) );
+ menu_bar.add(create_file_menu());
+ menu_bar.add(create_edit_menu());
+ menu_bar.add(create_view_menu(style));
+ menu_bar.add(create_selection_menu());
+ menu_bar.add(create_bsp_menu());
+ menu_bar.add(create_grid_menu());
+ menu_bar.add(create_misc_menu());
+ menu_bar.add(create_entity_menu());
+ menu_bar.add(create_brush_menu());
+ menu_bar.add(create_patch_menu());
+ menu_bar.add(create_plugins_menu());
+ menu_bar.add(create_help_menu());
return menu_bar;
}
auto space = [&]() {
auto btn = ui::Widget(GTK_WIDGET(gtk_separator_tool_item_new()));
btn.show();
- gtk_container_add(toolbar, btn);
+ toolbar.add(btn);
};
File_constructToolbar( toolbar );
gtk_misc_set_alignment( GTK_MISC( label ), 0, 0.5 );
gtk_misc_set_padding( GTK_MISC( label ), 4, 2 );
label.show();
- gtk_container_add( GTK_CONTAINER( frame ), GTK_WIDGET( label ) );
+ frame.add(label);
pStatusLabel[i] = ui::Widget(GTK_WIDGET( label ));
}
auto image = new_local_image( "splash.png" );
image.show();
- gtk_container_add( GTK_CONTAINER( window ), GTK_WIDGET( image ) );
+ window.add(image);
gtk_widget_set_size_request( GTK_WIDGET( window ), -1, -1 );
window.show();
GetPlugInMgr().Init( window );
ui::Widget vbox = ui::VBox( FALSE, 0 );
- gtk_container_add( GTK_CONTAINER( window ), vbox );
+ window.add(vbox);
vbox.show();
global_accel_connect_window( window );
GlobalCamera_setCamWnd( *m_pCamWnd );
{
- GtkFrame* frame = create_framed_widget( CamWnd_getWidget( *m_pCamWnd ) );
- gtk_container_add( GTK_CONTAINER( window ), GTK_WIDGET( frame ) );
+ auto frame = create_framed_widget( CamWnd_getWidget( *m_pCamWnd ) );
+ window.add(frame);
}
CamWnd_setParent( *m_pCamWnd, window );
{
- GtkFrame* frame = create_framed_widget( m_pXYWnd->GetWidget() );
- gtk_container_add( GTK_CONTAINER( window ), GTK_WIDGET( frame ) );
+ auto frame = create_framed_widget( m_pXYWnd->GetWidget() );
+ window.add(frame);
}
XY_Top_Shown_Construct( window );
m_pXZWnd->SetViewType( XZ );
{
- GtkFrame* frame = create_framed_widget( m_pXZWnd->GetWidget() );
- gtk_container_add( GTK_CONTAINER( window ), GTK_WIDGET( frame ) );
+ auto frame = create_framed_widget( m_pXZWnd->GetWidget() );
+ window.add(frame);
}
XZ_Front_Shown_Construct( window );
m_pYZWnd->SetViewType( YZ );
{
- GtkFrame* frame = create_framed_widget( m_pYZWnd->GetWidget() );
- gtk_container_add( GTK_CONTAINER( window ), GTK_WIDGET( frame ) );
+ auto frame = create_framed_widget( m_pYZWnd->GetWidget() );
+ window.add(frame);
}
YZ_Side_Shown_Construct( window );
window_set_position( window, g_posMapInfoWnd );
{
- GtkVBox* vbox = create_dialog_vbox( 4, 4 );
- gtk_container_add( GTK_CONTAINER( window ), GTK_WIDGET( vbox ) );
+ auto vbox = create_dialog_vbox( 4, 4 );
+ window.add(vbox);
{
GtkHBox* hbox = create_dialog_hbox( 4 );
gtk_misc_set_alignment( GTK_MISC( label ), 0, 0.5 );
}
{
- GtkScrolledWindow* scr = create_scrolled_window( GTK_POLICY_NEVER, GTK_POLICY_AUTOMATIC, 4 );
+ auto scr = create_scrolled_window( GTK_POLICY_NEVER, GTK_POLICY_AUTOMATIC, 4 );
gtk_box_pack_start( GTK_BOX( vbox ), GTK_WIDGET( scr ), TRUE, TRUE, 0 );
{
view.show();
- gtk_container_add( GTK_CONTAINER( scr ), view );
+ scr.add(view);
EntityBreakdownWalker = store;
}
window.add_accel_group( accel );
{
- GtkVBox* vbox = create_dialog_vbox( 4, 4 );
- gtk_container_add( GTK_CONTAINER( window ), GTK_WIDGET( vbox ) );
+ auto vbox = create_dialog_vbox( 4, 4 );
+ window.add(vbox);
{
GtkTable* table = create_dialog_table( 2, 2, 4, 4 );
gtk_box_pack_start( GTK_BOX( vbox ), GTK_WIDGET( table ), TRUE, TRUE, 0 );
auto vbox = ui::VBox( FALSE, 5 );
gtk_container_set_border_width( GTK_CONTAINER( vbox ), 5 );
vbox.show();
- gtk_container_add( GTK_CONTAINER( window ), GTK_WIDGET( vbox ) );
+ window.add(vbox);
{
auto hbox = ui::HBox( FALSE, 5 );
hbox.show();
auto vbox3 = ui::VBox( FALSE, 5 );
gtk_container_set_border_width( GTK_CONTAINER( vbox3 ), 5 );
vbox3.show();
- gtk_container_add( GTK_CONTAINER( frame ), GTK_WIDGET( vbox3 ) );
+ frame.add(vbox3);
{
auto table = ui::Table( 2, 2, FALSE );
table.show();
auto vbox3 = ui::VBox( FALSE, 5 );
gtk_container_set_border_width( GTK_CONTAINER( vbox3 ), 5 );
vbox3.show();
- gtk_container_add( GTK_CONTAINER( frame ), GTK_WIDGET( vbox3 ) );
+ frame.add(vbox3);
{
auto table = ui::Table( 3, 2, FALSE );
table.show();
{
auto vbox2 = ui::VBox( FALSE, 5 );
vbox2.show();
- gtk_container_add( GTK_CONTAINER( frame ), GTK_WIDGET( vbox2 ) );
+ frame.add(vbox2);
gtk_container_set_border_width( GTK_CONTAINER( vbox2 ), 5 );
{
auto label = ui::Label( "Name:" );
window.add_accel_group( accel );
{
- GtkHBox* hbox = create_dialog_hbox( 4, 4 );
- gtk_container_add( GTK_CONTAINER( window ), GTK_WIDGET( hbox ) );
+ auto hbox = create_dialog_hbox( 4, 4 );
+ window.add(hbox);
{
GtkTable* table = create_dialog_table( 2, 2, 4, 4 );
gtk_box_pack_start( GTK_BOX( hbox ), GTK_WIDGET( table ), TRUE, TRUE, 0 );
window.add_accel_group( accel_group );
{
- GtkHBox* hbox = create_dialog_hbox( 4, 4 );
- gtk_container_add( GTK_CONTAINER( window ), GTK_WIDGET( hbox ) );
+ auto hbox = create_dialog_hbox( 4, 4 );
+ window.add(hbox);
{
// Gef: Added a vbox to contain the toggle buttons
- GtkVBox* radio_vbox = create_dialog_vbox( 4 );
- gtk_container_add( GTK_CONTAINER( hbox ), GTK_WIDGET( radio_vbox ) );
+ auto radio_vbox = create_dialog_vbox( 4 );
+ hbox.add(radio_vbox);
{
auto table = ui::Table( 5, 2, FALSE );
#include <stack>
-void PlugInMenu_Add( GtkMenu* plugin_menu, IPlugIn* pPlugIn ){
+void PlugInMenu_Add( ui::Menu plugin_menu, IPlugIn* pPlugIn ){
ui::Widget item, parent;
ui::Menu menu{nullptr}, subMenu{nullptr};
const char *menuText, *menuCommand;
parent = ui::MenuItem( pPlugIn->getMenuName() );
parent.show();
- gtk_container_add( GTK_CONTAINER( plugin_menu ), parent );
+ plugin_menu.add(parent);
std::size_t nCount = pPlugIn->getCommandCount();
if ( nCount > 0 ) {
item = ui::MenuItem( menuText );
item.show();
- gtk_container_add( GTK_CONTAINER( menu ), item );
+ menu.add(item);
subMenu = ui::Menu();
gtk_menu_item_set_submenu( GTK_MENU_ITEM( item ), subMenu );
g_signal_connect( G_OBJECT( item ), "activate", G_CALLBACK( plugin_activated ), gint_to_pointer( m_nNextPlugInID ) );
}
item.show();
- gtk_container_add( GTK_CONTAINER( menu ), item );
+ menu.add(item);
pPlugIn->addMenuID( m_nNextPlugInID++ );
}
}
}
}
-GtkMenu* g_plugins_menu = 0;
+ui::Menu g_plugins_menu{ui::null};
GtkMenuItem* g_plugins_menu_separator = 0;
void PluginsMenu_populate(){
class PluginsMenuConstructor : public PluginsVisitor
{
- GtkMenu* m_menu;
+ ui::Menu m_menu;
public:
- PluginsMenuConstructor( GtkMenu* menu ) : m_menu( menu ){
+ PluginsMenuConstructor( ui::Menu menu ) : m_menu( menu ){
}
void visit( IPlugIn& plugin ){
PlugInMenu_Add( m_menu, &plugin );
return image_new_missing();
}
-void toolbar_insert( GtkToolbar *toolbar, const char* icon, const char* text, const char* tooltip, IToolbarButton::EType type, GCallback handler, gpointer data ){
+void toolbar_insert( ui::Toolbar toolbar, const char* icon, const char* text, const char* tooltip, IToolbarButton::EType type, GCallback handler, gpointer data ){
if (type == IToolbarButton::eSpace) {
auto it = ui::Widget(GTK_WIDGET(gtk_separator_tool_item_new()));
it.show();
- gtk_container_add(GTK_CONTAINER(toolbar), GTK_WIDGET(it));
+ toolbar.add(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));
+ auto button = ui::ToolButton(GTK_TOOL_BUTTON(gtk_tool_button_new(GTK_WIDGET(new_plugin_image(icon)), text)));
+ gtk_widget_set_tooltip_text(button, tooltip);
+ gtk_widget_show_all(button);
+ g_signal_connect(button, "clicked", G_CALLBACK(handler), data);
+ toolbar.add(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));
+ auto button = ui::ToolButton(GTK_TOOL_BUTTON(gtk_toggle_tool_button_new()));
+ gtk_tool_button_set_icon_widget(button, GTK_WIDGET(new_plugin_image(icon)));
+ gtk_tool_button_set_label(button, text);
+ gtk_widget_set_tooltip_text(button, tooltip);
+ gtk_widget_show_all(button);
+ g_signal_connect(button, "toggled", G_CALLBACK(handler), data);
+ toolbar.add(button);
return;
}
ERROR_MESSAGE( "invalid toolbar button type" );
(const_cast<const IToolbarButton *>( reinterpret_cast<IToolbarButton *>( data )))->activate();
}
-void PlugInToolbar_AddButton( GtkToolbar* toolbar, const IToolbarButton* button ){
+void PlugInToolbar_AddButton( ui::Toolbar toolbar, const IToolbarButton* button ){
toolbar_insert( toolbar, button->getImage(), button->getText(), button->getTooltip(), button->getType(), G_CALLBACK( ActivateToolbarButton ), reinterpret_cast<gpointer>( const_cast<IToolbarButton*>( button ) ) );
}
void PluginToolbar_populate(){
class AddToolbarItemVisitor : public ToolbarModules::Visitor
{
- GtkToolbar* m_toolbar;
+ ui::Toolbar m_toolbar;
public:
- AddToolbarItemVisitor( GtkToolbar* toolbar )
+ AddToolbarItemVisitor( ui::Toolbar toolbar )
: m_toolbar( toolbar ){
}
void visit( const char* name, const _QERPlugToolbarTable& table ) const {
auto frame = create_dialog_frame( "Game settings", GTK_SHADOW_ETCHED_IN );
auto vbox2 = create_dialog_vbox( 0, 4 );
- gtk_container_add( GTK_CONTAINER( frame ), GTK_WIDGET( vbox2 ) );
+ frame.add(vbox2);
{
PreferencesPage preferencesPage( *this, ui::Widget(GTK_WIDGET( vbox2 )) );
ui::Widget preflabel = ui::Label( name );
preflabel.show();
- ui::Widget pageframe = ui::Frame( name );
+ auto pageframe = ui::Frame( name );
gtk_container_set_border_width( GTK_CONTAINER( pageframe ), 4 );
pageframe.show();
ui::Widget vbox = ui::VBox( FALSE, 4 );
vbox.show();
gtk_container_set_border_width( GTK_CONTAINER( vbox ), 4 );
- gtk_container_add( GTK_CONTAINER( pageframe ), vbox );
+ pageframe.add(vbox);
// Add the page to the notebook
gtk_notebook_append_page( GTK_NOTEBOOK( notebook ), pageframe, preflabel );
{
ui::Widget mainvbox = ui::VBox( FALSE, 5 );
- gtk_container_add( GTK_CONTAINER( dialog ), mainvbox );
+ dialog.add(mainvbox);
gtk_container_set_border_width( GTK_CONTAINER( mainvbox ), 5 );
mainvbox.show();
hbox.show();
{
- ui::Widget sc_win = ui::ScrolledWindow();
+ auto 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 );
sc_win.show();
view.show();
- gtk_container_add( GTK_CONTAINER( sc_win ), view );
+ sc_win.add(view);
{
/********************************************************************/
g_rotate_dialog.window.add_accel_group( accel );
{
- GtkHBox* hbox = create_dialog_hbox( 4, 4 );
- gtk_container_add( GTK_CONTAINER( g_rotate_dialog.window ), GTK_WIDGET( hbox ) );
+ auto hbox = create_dialog_hbox( 4, 4 );
+ g_rotate_dialog.window.add(hbox);
{
GtkTable* table = create_dialog_table( 3, 2, 4, 4 );
gtk_box_pack_start( GTK_BOX( hbox ), GTK_WIDGET( table ), TRUE, TRUE, 0 );
g_scale_dialog.window.add_accel_group( accel );
{
- GtkHBox* hbox = create_dialog_hbox( 4, 4 );
- gtk_container_add( GTK_CONTAINER( g_scale_dialog.window ), GTK_WIDGET( hbox ) );
+ auto hbox = create_dialog_hbox( 4, 4 );
+ g_scale_dialog.window.add(hbox);
{
GtkTable* table = create_dialog_table( 3, 2, 4, 4 );
gtk_box_pack_start( GTK_BOX( hbox ), GTK_WIDGET( table ), TRUE, TRUE, 0 );
// replaced by only the vbox:
ui::Widget vbox = ui::VBox( FALSE, 5 );
vbox.show();
- gtk_container_add( GTK_CONTAINER( window ), GTK_WIDGET( vbox ) );
+ window.add(vbox);
gtk_container_set_border_width( GTK_CONTAINER( vbox ), 5 );
{
}
{
- ui::Widget frame = ui::Frame( "Texturing" );
+ auto frame = ui::Frame( "Texturing" );
frame.show();
gtk_box_pack_start( GTK_BOX( vbox ), GTK_WIDGET( frame ), FALSE, FALSE, 0 );
{
ui::Widget table = ui::Table( 4, 4, FALSE );
table.show();
- gtk_container_add( GTK_CONTAINER( frame ), table );
+ frame.add(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 );
auto vbox3 = ui::VBox( FALSE, 4 );
//gtk_container_set_border_width(GTK_CONTAINER(vbox3), 4);
vbox3.show();
- gtk_container_add( GTK_CONTAINER( frame ), GTK_WIDGET( vbox3 ) );
+ frame.add(vbox3);
{
auto table = ui::Table( 8, 4, FALSE );
table.show();
auto vbox3 = ui::VBox( FALSE, 4 );
//gtk_container_set_border_width(GTK_CONTAINER(vbox3), 4);
vbox3.show();
- gtk_container_add( GTK_CONTAINER( frame ), GTK_WIDGET( vbox3 ) );
+ frame.add(vbox3);
{
auto table = ui::Table( 8, 4, FALSE );
auto vbox3 = ui::VBox( FALSE, 4 );
gtk_container_set_border_width( GTK_CONTAINER( vbox3 ), 4 );
vbox3.show();
- gtk_container_add( GTK_CONTAINER( frame ), GTK_WIDGET( vbox3 ) );
+ frame.add(vbox3);
{
auto entry = ui::Entry();
// <-- end stuff...
TexTool::g_textoolWin.show();
gtk_widget_set_size_request( TexTool::g_textoolWin, -1, 240 ); //Yeah!
- gtk_container_add( GTK_CONTAINER( frame ), TexTool::g_textoolWin );
+ frame.add(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 ), "expose_event", G_CALLBACK( TexTool::expose ), NULL );
//Instead of this, we probably need to create a vbox to put into the frame, then the
//window, then the hbox. !!! FIX !!!
-// gtk_container_add(GTK_CONTAINER(frame), hbox);
+// frame.add(hbox);
//Hmm. Do we really need g_object_set_data? Mebbe not... And we don't! :-)
// g_object_set_data(G_OBJECT(flipX), "handler", gint_to_pointer(g_signal_connect(G_OBJECT(flipX), "toggled", G_CALLBACK(TexTool::flipX), 0)));
EntryCompletion() : m_store( 0 ), m_idleUpdate( UpdateCaller( *this ) ){
}
-void connect( GtkEntry* entry ){
+void connect( ui::Entry entry ){
if ( !m_store ) {
m_store = ui::ListStore(gtk_list_store_new( 1, G_TYPE_STRING ));
StringList().connect( IdleDraw::QueueDrawCaller( m_idleUpdate ) );
}
- GtkEntryCompletion* completion = gtk_entry_completion_new();
+ auto completion = ui::EntryCompletion(gtk_entry_completion_new());
gtk_entry_set_completion( entry, completion );
gtk_entry_completion_set_model( completion, GTK_TREE_MODEL( m_store ) );
gtk_entry_completion_set_text_column( completion, 0 );
ui::Widget m_texture_scroll;
ui::Widget m_treeViewTree;
ui::Widget m_treeViewTags;
-ui::Widget m_tag_frame;
+ui::Frame m_tag_frame{ui::null};
ui::ListStore m_assigned_store{nullptr};
ui::ListStore m_available_store{nullptr};
ui::Widget m_assigned_tree;
ui::Widget m_scr_win_tree;
ui::Widget m_scr_win_tags;
ui::Widget m_tag_notebook;
-ui::Widget m_search_button;
+ui::Button m_search_button{ui::null};
ui::Widget m_shader_info_item;
std::set<CopiedString> m_all_tags;
g_TextureBrowser.m_search_button = ui::Button();
g_signal_connect( G_OBJECT( g_TextureBrowser.m_search_button ), "clicked", G_CALLBACK( TextureBrowser_searchTags ), NULL );
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_TextureBrowser.m_search_button.add(image);
}
void TextureBrowser_checkTagFile(){
frame_table.show();
- gtk_container_add( GTK_CONTAINER( g_TextureBrowser.m_tag_frame ), frame_table );
+ g_TextureBrowser.m_tag_frame.add(frame_table);
}
{ // assigned tag list
ui::Widget scrolled_win = ui::ScrolledWindow();
gtk_table_attach( GTK_TABLE( frame_table ), scrolled_win, 2, 3, 1, 3, GTK_FILL, GTK_FILL, 0, 0 );
}
{ // tag arrow buttons
- 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 );
+ auto m_btn_left = ui::Button();
+ auto m_btn_right = ui::Button();
+ auto m_arrow_left = ui::Widget(gtk_arrow_new( GTK_ARROW_LEFT, GTK_SHADOW_OUT ));
+ auto m_arrow_right = ui::Widget(gtk_arrow_new( GTK_ARROW_RIGHT, GTK_SHADOW_OUT ));
+ m_btn_left.add(m_arrow_left);
+ m_btn_right.add(m_arrow_right);
// workaround. the size of the tag frame depends of the requested size of the arrow buttons.
gtk_widget_set_size_request( m_arrow_left, -1, 68 );