From: TimePath Date: Wed, 17 Feb 2016 05:18:19 +0000 (+1100) Subject: Wrap GtkFrame X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=99271b39b27e0618366638247d048b0547357bef;p=xonotic%2Fnetradiant.git Wrap GtkFrame --- diff --git a/contrib/bkgrnd2d/dialog.cpp b/contrib/bkgrnd2d/dialog.cpp index a8f01769..35dd5ff5 100644 --- a/contrib/bkgrnd2d/dialog.cpp +++ b/contrib/bkgrnd2d/dialog.cpp @@ -198,7 +198,7 @@ CBackgroundDialogPage::CBackgroundDialogPage( VIEWTYPE vt ){ // A vbox to hold everything 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 @@ -234,7 +234,7 @@ CBackgroundDialogPage::CBackgroundDialogPage( VIEWTYPE vt ){ 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 = ui::HBox( FALSE,5 ); @@ -257,7 +257,7 @@ CBackgroundDialogPage::CBackgroundDialogPage( VIEWTYPE vt ){ 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 ); diff --git a/contrib/bobtoolz/dialogs/dialogs-gtk.cpp b/contrib/bobtoolz/dialogs/dialogs-gtk.cpp index 5fe84ece..22c00dd9 100644 --- a/contrib/bobtoolz/dialogs/dialogs-gtk.cpp +++ b/contrib/bobtoolz/dialogs/dialogs-gtk.cpp @@ -1348,7 +1348,7 @@ EMessageBoxReturn DoResetTextureBox( ResetTextureRS* rs ){ // ---- /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 ); @@ -1396,7 +1396,7 @@ EMessageBoxReturn DoResetTextureBox( ResetTextureRS* rs ){ // ---- /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 ); @@ -1452,7 +1452,7 @@ EMessageBoxReturn DoResetTextureBox( ResetTextureRS* rs ){ // ---- /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 ); @@ -1508,7 +1508,7 @@ EMessageBoxReturn DoResetTextureBox( ResetTextureRS* rs ){ // ---- /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 ); @@ -1674,7 +1674,7 @@ EMessageBoxReturn DoTrainThingBox( TrainThingRS* rs ){ // ---- /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 ); @@ -1717,7 +1717,7 @@ EMessageBoxReturn DoTrainThingBox( TrainThingRS* rs ){ - frame = gtk_frame_new( "Angles" ); + frame = ui::Frame( "Angles" ); gtk_widget_show( frame ); gtk_box_pack_start( GTK_BOX( vbox ), frame, FALSE, TRUE, 0 ); @@ -1759,7 +1759,7 @@ EMessageBoxReturn DoTrainThingBox( TrainThingRS* rs ){ 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 ); @@ -1802,7 +1802,7 @@ EMessageBoxReturn DoTrainThingBox( TrainThingRS* rs ){ - frame = gtk_frame_new( "Points" ); + frame = ui::Frame( "Points" ); gtk_widget_show( frame ); gtk_box_pack_start( GTK_BOX( vbox ), frame, FALSE, TRUE, 0 ); diff --git a/contrib/camera/dialogs.cpp b/contrib/camera/dialogs.cpp index 1e5f31b8..5515c400 100644 --- a/contrib/camera/dialogs.cpp +++ b/contrib/camera/dialogs.cpp @@ -91,7 +91,7 @@ static gint ci_new( GtkWidget *widget, gpointer data ){ 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 ); @@ -520,7 +520,7 @@ static gint ci_add_target( GtkWidget *widget, gpointer data ){ 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 ); @@ -851,7 +851,7 @@ static gint ci_add( GtkWidget *widget, gpointer data ){ 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 ); @@ -1070,7 +1070,7 @@ GtkWidget *CreateCameraInspectorDialog( void ){ // -------------------------- // - 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 ), @@ -1164,7 +1164,7 @@ GtkWidget *CreateCameraInspectorDialog( void ){ // -------------------------- // - 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 ), diff --git a/contrib/gtkgensurf/gendlgs.cpp b/contrib/gtkgensurf/gendlgs.cpp index 4ae4d58c..c1cdb8cb 100644 --- a/contrib/gtkgensurf/gendlgs.cpp +++ b/contrib/gtkgensurf/gendlgs.cpp @@ -1384,7 +1384,7 @@ GtkWidget* create_main_dialog(){ 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 ), @@ -1405,7 +1405,7 @@ GtkWidget* create_main_dialog(){ 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 ), @@ -1426,7 +1426,7 @@ GtkWidget* create_main_dialog(){ 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 ), @@ -1536,7 +1536,7 @@ GtkWidget* create_main_dialog(){ 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 ); @@ -1623,7 +1623,7 @@ GtkWidget* create_main_dialog(){ 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 ); @@ -1707,7 +1707,7 @@ GtkWidget* create_main_dialog(){ 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 ); diff --git a/contrib/gtkgensurf/view.cpp b/contrib/gtkgensurf/view.cpp index fd245a2f..63980809 100644 --- a/contrib/gtkgensurf/view.cpp +++ b/contrib/gtkgensurf/view.cpp @@ -414,7 +414,7 @@ void CreateViewWindow(){ 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 ); diff --git a/contrib/prtview/ConfigDialog.cpp b/contrib/prtview/ConfigDialog.cpp index 51bf9885..22aa138e 100644 --- a/contrib/prtview/ConfigDialog.cpp +++ b/contrib/prtview/ConfigDialog.cpp @@ -260,7 +260,7 @@ void DoConfigDialog(){ 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 ); @@ -410,7 +410,7 @@ void DoConfigDialog(){ gtk_box_pack_start( GTK_BOX( hbox ), portalcheck, TRUE, TRUE, 0 ); gtk_signal_connect( GTK_OBJECT( portalcheck ), "toggled", GTK_SIGNAL_FUNC( 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 ); diff --git a/libs/gtkutil/dialog.cpp b/libs/gtkutil/dialog.cpp index ca654b9d..17b9ac7a 100644 --- a/libs/gtkutil/dialog.cpp +++ b/libs/gtkutil/dialog.cpp @@ -50,7 +50,7 @@ GtkHBox* create_dialog_hbox( int spacing, int border ){ } 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; @@ -204,7 +204,7 @@ RadioHBox RadioHBox_new( StringArrayRange names ){ 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 ); diff --git a/libs/gtkutil/frame.cpp b/libs/gtkutil/frame.cpp index 8914fb70..53fb462d 100644 --- a/libs/gtkutil/frame.cpp +++ b/libs/gtkutil/frame.cpp @@ -22,9 +22,10 @@ #include "frame.h" #include +#include 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 ); diff --git a/libs/uilib/uilib.cpp b/libs/uilib/uilib.cpp index 79d3848b..667ca91e 100644 --- a/libs/uilib/uilib.cpp +++ b/libs/uilib/uilib.cpp @@ -116,6 +116,9 @@ namespace ui { Entry::Entry(std::size_t max_length) : Entry(GTK_ENTRY(gtk_entry_new_with_max_length(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))) { } diff --git a/libs/uilib/uilib.h b/libs/uilib/uilib.h index f0eb3b1f..432db2be 100644 --- a/libs/uilib/uilib.h +++ b/libs/uilib/uilib.h @@ -13,6 +13,7 @@ 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_label = struct _GtkLabel; using ui_menu = struct _GtkMenu; @@ -157,6 +158,10 @@ namespace ui { 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); ); diff --git a/radiant/mainframe.cpp b/radiant/mainframe.cpp index 35a7cb72..7f05f9ca 100644 --- a/radiant/mainframe.cpp +++ b/radiant/mainframe.cpp @@ -2404,7 +2404,7 @@ ui::Widget create_main_statusbar( ui::Widget pStatusLabel[c_count_status] ){ 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 ); diff --git a/radiant/patchdialog.cpp b/radiant/patchdialog.cpp index eff14bd6..c0ba02c4 100644 --- a/radiant/patchdialog.cpp +++ b/radiant/patchdialog.cpp @@ -587,7 +587,7 @@ ui::Window PatchInspector::BuildDialog(){ 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 ); { @@ -734,7 +734,7 @@ ui::Window PatchInspector::BuildDialog(){ } } 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 ); { @@ -802,7 +802,7 @@ ui::Window PatchInspector::BuildDialog(){ } } { - 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 ); { diff --git a/radiant/preferences.cpp b/radiant/preferences.cpp index a194fb82..7b62beef 100644 --- a/radiant/preferences.cpp +++ b/radiant/preferences.cpp @@ -662,7 +662,7 @@ ui::Widget PreferencePages_addPage( ui::Widget notebook, const char* name ){ ui::Widget preflabel = ui::Label( name ); gtk_widget_show( preflabel ); - ui::Widget pageframe = ui::Widget(gtk_frame_new( name )); + ui::Widget pageframe = ui::Frame( name ); gtk_container_set_border_width( GTK_CONTAINER( pageframe ), 4 ); gtk_widget_show( pageframe ); diff --git a/radiant/surfacedialog.cpp b/radiant/surfacedialog.cpp index f1597159..dc59b332 100644 --- a/radiant/surfacedialog.cpp +++ b/radiant/surfacedialog.cpp @@ -824,7 +824,7 @@ ui::Window SurfaceInspector::BuildDialog(){ } { - ui::Widget frame = ui::Widget(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 ); { @@ -944,7 +944,7 @@ ui::Window SurfaceInspector::BuildDialog(){ } 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 ); { @@ -979,7 +979,7 @@ ui::Window SurfaceInspector::BuildDialog(){ } } { - 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 ); { @@ -1018,7 +1018,7 @@ ui::Window SurfaceInspector::BuildDialog(){ } } { - 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 ); { @@ -1041,7 +1041,7 @@ ui::Window SurfaceInspector::BuildDialog(){ #if TEXTOOL_ENABLED if ( g_bp_globals.m_texdefTypeId == TEXDEFTYPEID_BRUSHPRIMITIVES ) { // Shamus: Textool goodies... - ui::Widget 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 ); { diff --git a/radiant/texwindow.cpp b/radiant/texwindow.cpp index 88d0c002..9ddc26a8 100644 --- a/radiant/texwindow.cpp +++ b/radiant/texwindow.cpp @@ -2058,7 +2058,7 @@ ui::Widget TextureBrowser_constructWindow( ui::Window toplevel ){ { // Tag frame frame_table = ui::Table( 3, 3, FALSE ); - g_TextureBrowser.m_tag_frame = ui::Widget(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 );