return hbox;
}
-ui::Frame create_dialog_frame( const char* label, GtkShadowType shadow ){
+ui::Frame create_dialog_frame( const char* label, ui::Shadow shadow ){
auto frame = ui::Frame( label );
frame.show();
- gtk_frame_set_shadow_type( frame, shadow );
+ gtk_frame_set_shadow_type( frame, (GtkShadowType) shadow );
return frame;
}
#include "generic/callback.h"
#include "generic/arrayrange.h"
#include "qerplugin.h"
-#include <gtk/gtk.h>
typedef int gint;
typedef gint gboolean;
ui::Button create_dialog_button( const char* label, GCallback func, gpointer data );
ui::VBox create_dialog_vbox( int spacing, int border = 0 );
ui::HBox create_dialog_hbox( int spacing, int border = 0 );
-ui::Frame create_dialog_frame( const char* label, GtkShadowType shadow = GTK_SHADOW_ETCHED_IN );
+ui::Frame create_dialog_frame( const char* label, ui::Shadow shadow = ui::Shadow::ETCHED_IN );
ui::Button create_modal_dialog_button( const char* label, ModalDialogButton& button );
ui::Window create_modal_dialog_window( ui::Window parent, const char* title, ModalDialog& dialog, int default_w = -1, int default_h = -1 );
POPUP
};
+ enum class Shadow {
+ NONE,
+ IN,
+ OUT,
+ ETCHED_IN,
+ ETCHED_OUT
+ };
+
namespace details {
enum class Convert {
class DialogEntryRow
{
public:
-DialogEntryRow( ui::Widget row, GtkEntry* entry ) : m_row( row ), m_entry( entry ){
+DialogEntryRow( ui::Widget row, ui::Entry entry ) : m_row( row ), m_entry( entry ){
}
ui::Widget m_row;
-GtkEntry* m_entry;
+ui::Entry m_entry;
};
DialogEntryRow DialogEntryRow_new( const char* name ){
DialogSpinnerRow( ui::Widget row, GtkSpinButton* spin ) : m_row( row ), m_spin( spin ){
}
ui::Widget m_row;
-GtkSpinButton* m_spin;
+ui::SpinButton m_spin;
};
DialogSpinnerRow DialogSpinnerRow_new( const char* name, double value, double lower, double upper, int fraction ){
auto alignment = ui::Alignment( 0.0, 0.5, 0.0, 0.0 );
alignment.show();
{
- ui::Widget combo = ui::ComboBoxText();
+ auto combo = ui::ComboBoxText();
for ( StringArrayRange::Iterator i = values.first; i != values.last; ++i )
{
gtk_table_set_col_spacings( GTK_TABLE( table ), 5 );
GSList* group = 0;
- ui::Widget radio;
+ ui::RadioButton radio{ui::null};
for ( StringArrayRange::Iterator icon = icons.first; icon != icons.last; ++icon )
{
guint pos = static_cast<guint>( icon - icons.first );
(GtkAttachOptions) ( 0 ),
(GtkAttachOptions) ( 0 ), 0, 0 );
- radio = ui::Widget(gtk_radio_button_new( group ));
+ radio = ui::RadioButton(GTK_RADIO_BUTTON(gtk_radio_button_new( group )));
radio.show();
gtk_table_attach( GTK_TABLE( table ), radio, pos, pos + 1, 1, 2,
(GtkAttachOptions) ( 0 ),
ui::Widget Dialog::addIntEntry( ui::Widget vbox, const char* name, const IntImportCallback& importViewer, const IntExportCallback& exportViewer ){
DialogEntryRow row( DialogEntryRow_new( name ) );
- AddIntEntryData( *row.m_entry, importViewer, exportViewer );
+ AddIntEntryData( *GTK_ENTRY(row.m_entry), importViewer, exportViewer );
DialogVBox_packRow( ui::VBox(GTK_VBOX( vbox )), row.m_row );
return row.m_row;
}
ui::Widget Dialog::addSizeEntry( ui::Widget vbox, const char* name, const SizeImportCallback& importViewer, const SizeExportCallback& exportViewer ){
DialogEntryRow row( DialogEntryRow_new( name ) );
- AddSizeEntryData( *row.m_entry, importViewer, exportViewer );
+ AddSizeEntryData( *GTK_ENTRY(row.m_entry), importViewer, exportViewer );
DialogVBox_packRow( ui::VBox(GTK_VBOX( vbox )), row.m_row );
return row.m_row;
}
ui::Widget Dialog::addFloatEntry( ui::Widget vbox, const char* name, const FloatImportCallback& importViewer, const FloatExportCallback& exportViewer ){
DialogEntryRow row( DialogEntryRow_new( name ) );
- AddFloatEntryData( *row.m_entry, importViewer, exportViewer );
+ AddFloatEntryData( *GTK_ENTRY(row.m_entry), importViewer, exportViewer );
DialogVBox_packRow( ui::VBox(GTK_VBOX( vbox )), row.m_row );
return row.m_row;
}
PathEntry pathEntry = PathEntry_new();
g_signal_connect( G_OBJECT( pathEntry.m_button ), "clicked", G_CALLBACK( browse_directory ? button_clicked_entry_browse_directory : button_clicked_entry_browse_file ), pathEntry.m_entry );
- AddTextEntryData( *GTK_ENTRY( pathEntry.m_entry ), importViewer, exportViewer );
+ AddTextEntryData( *GTK_ENTRY(pathEntry.m_entry), importViewer, exportViewer );
auto row = DialogRow_new( name, ui::Widget(GTK_WIDGET( pathEntry.m_frame )) );
DialogVBox_packRow( ui::VBox(GTK_VBOX( vbox )), row );
ui::SpinButton Dialog::addSpinner( ui::Widget vbox, const char* name, double value, double lower, double upper, const IntImportCallback& importViewer, const IntExportCallback& exportViewer ){
DialogSpinnerRow row( DialogSpinnerRow_new( name, value, lower, upper, 1 ) );
- AddIntSpinnerData( *row.m_spin, importViewer, exportViewer );
+ AddIntSpinnerData( *GTK_SPIN_BUTTON(row.m_spin), importViewer, exportViewer );
DialogVBox_packRow( ui::VBox(GTK_VBOX( vbox )), row.m_row );
return ui::SpinButton(row.m_spin);
}
ui::SpinButton Dialog::addSpinner( ui::Widget vbox, const char* name, double value, double lower, double upper, const FloatImportCallback& importViewer, const FloatExportCallback& exportViewer ){
DialogSpinnerRow row( DialogSpinnerRow_new( name, value, lower, upper, 10 ) );
- AddFloatSpinnerData( *row.m_spin, importViewer, exportViewer );
+ AddFloatSpinnerData( *GTK_SPIN_BUTTON(row.m_spin), importViewer, exportViewer );
DialogVBox_packRow( ui::VBox(GTK_VBOX( vbox )), row.m_row );
return ui::SpinButton(row.m_spin);
}
#include <list>
#include <uilib/uilib.h>
+#include <gtk/gtk.h>
#include "gtkutil/dialog.h"
#include "generic/callback.h"
ui::Window FindTextureDialog::BuildDialog(){
ui::Widget vbox, hbox, table, label;
- ui::Widget button, check;
+ ui::Widget button;
ui::Entry entry{nullptr};
auto dlg = ui::Window(create_floating_window( "Find / Replace Texture(s)", m_parent ));
(GtkAttachOptions) ( 0 ), 0, 0 );
g_signal_connect( G_OBJECT( entry ), "focus_in_event",
G_CALLBACK( find_focus_in ), 0 );
- AddDialogData( *GTK_ENTRY( entry ), m_strFind );
+ AddDialogData( *GTK_ENTRY(entry), m_strFind );
GlobalTextureEntryCompletion::instance().connect( entry );
entry = ui::Entry();
(GtkAttachOptions) ( 0 ), 0, 0 );
g_signal_connect( G_OBJECT( entry ), "focus_in_event",
G_CALLBACK( replace_focus_in ), 0 );
- AddDialogData( *GTK_ENTRY( entry ), m_strReplace );
+ AddDialogData( *GTK_ENTRY(entry), m_strReplace );
GlobalTextureEntryCompletion::instance().connect( entry );
- check = ui::CheckButton( "Within selected brushes only" );
+ auto check = ui::CheckButton( "Within selected brushes only" );
check.show();
gtk_box_pack_start( GTK_BOX( vbox ), check, TRUE, TRUE, 0 );
- AddDialogData( *GTK_TOGGLE_BUTTON( check ), m_bSelectedOnly );
+ AddDialogData( *GTK_TOGGLE_BUTTON(check), m_bSelectedOnly );
vbox = ui::VBox( FALSE, 5 );
vbox.show();
GtkVBox* vbox2 = create_dialog_vbox( 4 );
gtk_box_pack_start( GTK_BOX( hbox ), GTK_WIDGET( vbox2 ), TRUE, FALSE, 0 );
{
- auto frame = create_dialog_frame( 0, GTK_SHADOW_IN );
+ auto frame = create_dialog_frame( 0, ui::Shadow::IN );
gtk_box_pack_start( GTK_BOX( vbox2 ), GTK_WIDGET( frame ), FALSE, FALSE, 0 );
{
auto image = new_local_image( "logo.png" );
{
public:
ui::Window BuildDialog(){
- auto frame = create_dialog_frame( "Path settings", GTK_SHADOW_ETCHED_IN );
+ auto frame = create_dialog_frame( "Path settings", ui::Shadow::ETCHED_IN );
auto vbox2 = create_dialog_vbox( 0, 4 );
frame.add(vbox2);
}
ui::Window CGameDialog::BuildDialog(){
- auto frame = create_dialog_frame( "Game settings", GTK_SHADOW_ETCHED_IN );
+ auto frame = create_dialog_frame( "Game settings", ui::Shadow::ETCHED_IN );
auto vbox2 = create_dialog_vbox( 0, 4 );
frame.add(vbox2);
#include "dialog.h"
#include <list>
#include <map>
+#include <glib.h>
void Widget_connectToggleDependency( ui::Widget self, ui::Widget toggleButton );
gtk_widget_set_size_request( button, 60, -1 );
}
{
- ui::Widget spin = ui::SpinButton( ui::Adjustment( 1, 0, 1 << 16, 1, 10, 0 ), 0, 6 );
+ auto spin = ui::SpinButton( ui::Adjustment( 1, 0, 1 << 16, 1, 10, 0 ), 0, 6 );
spin.show();
gtk_table_attach( GTK_TABLE( table ), spin, 2, 3, 1, 2,
(GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ),
AddDialogData( *GTK_SPIN_BUTTON( spin ), m_fitHorizontal );
}
{
- ui::Widget spin = ui::SpinButton( ui::Adjustment( 1, 0, 1 << 16, 1, 10, 0 ), 0, 6 );
+ auto spin = ui::SpinButton( ui::Adjustment( 1, 0, 1 << 16, 1, 10, 0 ), 0, 6 );
spin.show();
gtk_table_attach( GTK_TABLE( table ), spin, 3, 4, 1, 2,
(GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ),