From 8824506c282ea0240788eaea708532129e6db907 Mon Sep 17 00:00:00 2001 From: TimePath Date: Sat, 22 Jul 2017 02:32:11 +1000 Subject: [PATCH] Wrap gtkutil/dialog --- libs/gtkutil/dialog.cpp | 10 +++++----- libs/gtkutil/dialog.h | 24 +++++------------------- 2 files changed, 10 insertions(+), 24 deletions(-) diff --git a/libs/gtkutil/dialog.cpp b/libs/gtkutil/dialog.cpp index 6c0c8edb..8a144871 100644 --- a/libs/gtkutil/dialog.cpp +++ b/libs/gtkutil/dialog.cpp @@ -176,14 +176,14 @@ ui::Window create_simple_modal_dialog_window( const char* title, ModalDialog& di } RadioHBox RadioHBox_new( StringArrayRange names ){ - GtkHBox* hbox = ui::HBox( TRUE, 4 ); + auto hbox = ui::HBox( TRUE, 4 ); gtk_widget_show( GTK_WIDGET( hbox ) ); GSList* group = 0; - GtkRadioButton* radio = 0; + auto radio = ui::RadioButton{nullptr}; for ( StringArrayRange::Iterator i = names.first; i != names.last; ++i ) { - radio = GTK_RADIO_BUTTON( gtk_radio_button_new_with_label( group, *i ) ); + radio = ui::RadioButton(GTK_RADIO_BUTTON( gtk_radio_button_new_with_label( group, *i ) )); gtk_widget_show( GTK_WIDGET( radio ) ); gtk_box_pack_start( GTK_BOX( hbox ), GTK_WIDGET( radio ), FALSE, FALSE, 0 ); @@ -195,8 +195,8 @@ RadioHBox RadioHBox_new( StringArrayRange names ){ PathEntry PathEntry_new(){ - GtkFrame* frame = ui::Frame(); - gtk_widget_show( GTK_WIDGET( frame ) ); + auto frame = ui::Frame(); + frame.show(); gtk_frame_set_shadow_type( frame, GTK_SHADOW_IN ); // path entry diff --git a/libs/gtkutil/dialog.h b/libs/gtkutil/dialog.h index 3fbb14b1..b5f235c2 100644 --- a/libs/gtkutil/dialog.h +++ b/libs/gtkutil/dialog.h @@ -30,15 +30,6 @@ typedef int gint; typedef gint gboolean; typedef struct _GdkEventAny GdkEventAny; -typedef struct _GtkWidget GtkWidget; -typedef struct _GtkHBox GtkHBox; -typedef struct _GtkVBox GtkVBox; -typedef struct _GtkRadioButton GtkRadioButton; -typedef struct _GtkFrame GtkFrame; -typedef struct _GtkEntry GtkEntry; -typedef struct _GtkButton GtkButton; -typedef struct _GtkLabel GtkLabel; -typedef struct _GtkTable GtkTable; struct ModalDialog @@ -61,11 +52,6 @@ struct ModalDialogButton typedef void ( *GCallback )( void ); typedef void* gpointer; -typedef struct _GtkTable GtkTable; -typedef struct _GtkButton GtkButton; -typedef struct _GtkVBox GtkVBox; -typedef struct _GtkHBox GtkHBox; -typedef struct _GtkFrame GtkFrame; ui::Window create_fixedsize_modal_window( ui::Window parent, const char* title, int width, int height ); @@ -93,9 +79,9 @@ ui::Window create_simple_modal_dialog_window( const char* title, ModalDialog& di class RadioHBox { public: -GtkHBox* m_hbox; +ui::HBox m_hbox; ui::RadioButton m_radio; -RadioHBox( GtkHBox* hbox, GtkRadioButton* radio ) : +RadioHBox( ui::HBox hbox, ui::RadioButton radio ) : m_hbox( hbox ), m_radio( radio ){ } @@ -107,10 +93,10 @@ RadioHBox RadioHBox_new( StringArrayRange names ); class PathEntry { public: -GtkFrame* m_frame; +ui::Frame m_frame; ui::Entry m_entry; -GtkButton* m_button; -PathEntry( GtkFrame* frame, GtkEntry* entry, GtkButton* button ) : +ui::Button m_button; +PathEntry( ui::Frame frame, ui::Entry entry, ui::Button button ) : m_frame( frame ), m_entry( entry ), m_button( button ){ -- 2.39.2