GtkTreeViewColumn* col = gtk_tree_view_column_new();
gtk_tree_view_column_set_title( col, "materials" );
gtk_tree_view_append_column( GTK_TREE_VIEW( lookup_widget( wnd, "t_materialist" ) ), col );
- GtkCellRenderer* renderer = ui::CellRendererText();
+ auto renderer = ui::CellRendererText();
gtk_tree_view_insert_column_with_attributes( GTK_TREE_VIEW( lookup_widget( wnd, "t_materialist" ) ), -1, "", renderer, "text", 0, NULL );
// list store
double lower, double upper,
double step_increment, double page_increment,
double page_size)
- : Adjustment(GTK_ADJUSTMENT(gtk_adjustment_new(value, lower, upper, step_increment, page_increment, page_size)))
+ : Adjustment(
+ GTK_ADJUSTMENT(gtk_adjustment_new(value, lower, upper, step_increment, page_increment, page_size)))
{ }
Alignment::Alignment(float xalign, float yalign, float xscale, float yscale)
CellRendererText::CellRendererText() : CellRendererText(GTK_CELL_RENDERER_TEXT(gtk_cell_renderer_text_new()))
{ }
- ComboBoxText::ComboBoxText() : ComboBoxText(GTK_COMBO_BOX(gtk_combo_box_new_text()))
- { }
+ ComboBox ComboBoxText()
+ { return ComboBox(GTK_COMBO_BOX(gtk_combo_box_new_text())); }
CheckButton::CheckButton(const char *label) : CheckButton(GTK_CHECK_BUTTON(gtk_check_button_new_with_label(label)))
{ }
Menu::Menu() : Menu(GTK_MENU(gtk_menu_new()))
{ }
- MenuItem::MenuItem(const char *label, bool mnemonic) : MenuItem(GTK_MENU_ITEM((mnemonic ? gtk_menu_item_new_with_mnemonic : gtk_menu_item_new_with_label)(label)))
+ MenuItem::MenuItem(const char *label, bool mnemonic) : MenuItem(
+ GTK_MENU_ITEM((mnemonic ? gtk_menu_item_new_with_mnemonic : gtk_menu_item_new_with_label)(label)))
{ }
ScrolledWindow::ScrolledWindow() : ScrolledWindow(GTK_SCROLLED_WINDOW(gtk_scrolled_window_new(nullptr, nullptr)))
{ }
- SpinButton::SpinButton(Adjustment adjustment, double climb_rate, std::size_t digits) : SpinButton(GTK_SPIN_BUTTON(gtk_spin_button_new(adjustment, climb_rate, digits)))
+ SpinButton::SpinButton(Adjustment adjustment, double climb_rate, std::size_t digits) : SpinButton(
+ GTK_SPIN_BUTTON(gtk_spin_button_new(adjustment, climb_rate, digits)))
{ }
- Table::Table(std::size_t rows, std::size_t columns, bool homogenous) : Table(GTK_TABLE(gtk_table_new(rows, columns, homogenous)))
+ Table::Table(std::size_t rows, std::size_t columns, bool homogenous) : Table(
+ GTK_TABLE(gtk_table_new(rows, columns, homogenous)))
{ }
TreePath::TreePath() : TreePath(gtk_tree_path_new())
TreeView::TreeView(TreeModel model) : TreeView(GTK_TREE_VIEW(gtk_tree_view_new_with_model(model)))
{ }
+ TreeViewColumn::TreeViewColumn(const char *title, CellRenderer renderer,
+ std::initializer_list<TreeViewColumnAttribute> attributes)
+ : TreeViewColumn(gtk_tree_view_column_new_with_attributes(title, renderer, nullptr))
+ {
+ for (auto &it : attributes) {
+ gtk_tree_view_column_add_attribute(*this, renderer, it.attribute, it.column);
+ }
+ };
+
VBox::VBox(bool homogenous, int spacing) : VBox(GTK_VBOX(gtk_vbox_new(homogenous, spacing)))
{ }
using ui_button = struct _GtkButton;
using ui_checkbutton = struct _GtkCheckButton;
using ui_combobox = struct _GtkComboBox;
-using ui_comboboxtext = ui_combobox;
using ui_cellrenderer = struct _GtkCellRenderer;
using ui_cellrenderertext = struct _GtkCellRendererText;
using ui_entry = struct _GtkEntry;
using ui_treemodel = struct _GtkTreeModel;
using ui_treepath = struct _GtkTreePath;
using ui_treeview = struct _GtkTreeView;
+using ui_treeviewcolumn = struct _GtkTreeViewColumn;
using ui_typeinst = struct _GTypeInstance;
using ui_vbox = struct _GtkVBox;
using ui_widget = struct _GtkWidget;
WRAP(ComboBox, Widget, ui_combobox,);
- WRAP(ComboBoxText, ComboBox, ui_comboboxtext,
- ComboBoxText();
- );
+ ComboBox ComboBoxText();
WRAP(Entry, Widget, ui_entry,
Entry();
TreeView(TreeModel model);
);
+ struct TreeViewColumnAttribute {
+ const char *attribute;
+ int column;
+ };
+ WRAP(TreeViewColumn, Widget, ui_treeviewcolumn,
+ TreeViewColumn(const char *title, CellRenderer renderer, std::initializer_list<TreeViewColumnAttribute> attributes);
+ );
+
WRAP(VBox, Box, ui_vbox,
VBox(bool homogenous, int spacing);
);
ui::Widget view = ui::TreeView( ui::TreeModel(GTK_TREE_MODEL( store ) ));
gtk_tree_view_set_headers_visible( GTK_TREE_VIEW( view ), FALSE );
- GtkCellRenderer* renderer = ui::CellRendererText();
+ auto renderer = ui::CellRendererText();
object_set_boolean_property( G_OBJECT( renderer ), "editable", TRUE );
g_signal_connect( renderer, "edited", G_CALLBACK( project_cell_edited ), &projectList );
- GtkTreeViewColumn* column = gtk_tree_view_column_new_with_attributes( "", renderer, "text", 0, 0 );
+ GtkTreeViewColumn* column = ui::TreeViewColumn( "", renderer, {{"text", 0}} );
gtk_tree_view_append_column( GTK_TREE_VIEW( view ), column );
GtkTreeSelection* selection = gtk_tree_view_get_selection( GTK_TREE_VIEW( view ) );
ui::Widget view = ui::TreeView(ui::TreeModel( GTK_TREE_MODEL( store ) ));
gtk_tree_view_set_headers_visible( GTK_TREE_VIEW( view ), FALSE );
- GtkCellRenderer* renderer = ui::CellRendererText();
+ auto renderer = ui::CellRendererText();
object_set_boolean_property( G_OBJECT( renderer ), "editable", TRUE );
g_signal_connect( renderer, "edited", G_CALLBACK( commands_cell_edited ), store );
- GtkTreeViewColumn* column = gtk_tree_view_column_new_with_attributes( "", renderer, "text", 0, 0 );
+ GtkTreeViewColumn* column = ui::TreeViewColumn( "", renderer, {{"text", 0}} );
gtk_tree_view_append_column( GTK_TREE_VIEW( view ), column );
GtkTreeSelection* selection = gtk_tree_view_get_selection( GTK_TREE_VIEW( view ) );
gtk_tree_view_set_enable_search( GTK_TREE_VIEW( view ), false ); // annoying
{
- GtkCellRenderer* renderer = ui::CellRendererText();
- GtkTreeViewColumn* column = gtk_tree_view_column_new_with_attributes( "Command", renderer, "text", 0, "weight-set", 2, "weight", 3, NULL );
+ auto renderer = ui::CellRendererText();
+ GtkTreeViewColumn* column = ui::TreeViewColumn( "Command", renderer, {{"text", 0}, {"weight-set", 2}, {"weight", 3}} );
gtk_tree_view_append_column( GTK_TREE_VIEW( view ), column );
}
{
- GtkCellRenderer* renderer = ui::CellRendererText();
- GtkTreeViewColumn* column = gtk_tree_view_column_new_with_attributes( "Key", renderer, "text", 1, "weight-set", 2, "weight", 3, NULL );
+ auto renderer = ui::CellRendererText();
+ GtkTreeViewColumn* column = ui::TreeViewColumn( "Key", renderer, {{"text", 1}, {"weight-set", 2}, {"weight", 3}} );
gtk_tree_view_append_column( GTK_TREE_VIEW( view ), column );
}
m_combo( 0 ),
m_nonModal( ApplyCaller( *this ) ),
m_type( type ){
- GtkComboBox* combo = ui::ComboBoxText();
+ auto combo = ui::ComboBoxText();
for ( ListAttributeType::const_iterator i = type.begin(); i != type.end(); ++i )
{
g_signal_connect( G_OBJECT( view ), "key_press_event", G_CALLBACK( EntityClassList_keypress ), 0 );
{
- GtkCellRenderer* renderer = ui::CellRendererText();
- GtkTreeViewColumn* column = gtk_tree_view_column_new_with_attributes( "Key", renderer, "text", 0, 0 );
+ auto renderer = ui::CellRendererText();
+ GtkTreeViewColumn* column = ui::TreeViewColumn( "Key", renderer, {{"text", 0}} );
gtk_tree_view_append_column( view, column );
}
gtk_tree_view_set_headers_visible( GTK_TREE_VIEW( view ), FALSE );
{
- GtkCellRenderer* renderer = ui::CellRendererText();
- GtkTreeViewColumn* column = gtk_tree_view_column_new_with_attributes( "", renderer, "text", 0, 0 );
+ auto renderer = ui::CellRendererText();
+ GtkTreeViewColumn* column = ui::TreeViewColumn( "", renderer, {{"text", 0}} );
gtk_tree_view_append_column( GTK_TREE_VIEW( view ), column );
}
{
- GtkCellRenderer* renderer = ui::CellRendererText();
- GtkTreeViewColumn* column = gtk_tree_view_column_new_with_attributes( "", renderer, "text", 1, 0 );
+ auto renderer = ui::CellRendererText();
+ GtkTreeViewColumn* column = ui::TreeViewColumn( "", renderer, {{"text", 1}} );
gtk_tree_view_append_column( GTK_TREE_VIEW( view ), column );
}
ui::Widget view = ui::Widget(gtk_tree_view_new());
gtk_tree_view_set_headers_visible( GTK_TREE_VIEW( view ), FALSE );
- GtkCellRenderer* renderer = ui::CellRendererText();
+ auto renderer = ui::CellRendererText();
GtkTreeViewColumn* column = gtk_tree_view_column_new();
gtk_tree_view_column_pack_start( column, renderer, TRUE );
gtk_tree_view_column_set_cell_data_func( column, renderer, entitylist_treeviewcolumn_celldatafunc, 0, 0 );
gtk_tree_view_set_headers_visible( GTK_TREE_VIEW( view ), FALSE );
{
- GtkCellRenderer* renderer = ui::CellRendererText();
- GtkTreeViewColumn* column = gtk_tree_view_column_new_with_attributes( "", renderer, "text", 0, NULL );
+ auto renderer = ui::CellRendererText();
+ GtkTreeViewColumn* column = ui::TreeViewColumn( "", renderer, {{"text", 0}} );
gtk_tree_view_append_column( GTK_TREE_VIEW( view ), column );
}
ScopedLock lock( m_lock );
#if defined _DEBUG
m_buffer << "Break into the debugger?\n";
- bool handled = ui::alert( 0, m_buffer.c_str(), "Radiant - Runtime Error", eMB_YESNO, eMB_ICONERROR ) == eIDNO;
+ bool handled = ui::root.alert( m_buffer.c_str(), "Radiant - Runtime Error", ui::alert_type::YESNO, ui::alert_icon::ERROR ) == ui::alert_response::NO;
m_buffer.clear();
return handled;
#else
gtk_tree_view_set_headers_clickable( GTK_TREE_VIEW( view ), TRUE );
{
- GtkCellRenderer* renderer = ui::CellRendererText();
- GtkTreeViewColumn* column = gtk_tree_view_column_new_with_attributes( "Entity", renderer, "text", 0, 0 );
+ auto renderer = ui::CellRendererText();
+ GtkTreeViewColumn* column = ui::TreeViewColumn( "Entity", renderer, {{"text", 0}} );
gtk_tree_view_append_column( GTK_TREE_VIEW( view ), column );
gtk_tree_view_column_set_sort_column_id( column, 0 );
}
{
- GtkCellRenderer* renderer = ui::CellRendererText();
- GtkTreeViewColumn* column = gtk_tree_view_column_new_with_attributes( "Count", renderer, "text", 1, 0 );
+ auto renderer = ui::CellRendererText();
+ GtkTreeViewColumn* column = ui::TreeViewColumn( "Count", renderer, {{"text", 1}} );
gtk_tree_view_append_column( GTK_TREE_VIEW( view ), column );
gtk_tree_view_column_set_sort_column_id( column, 1 );
}
gtk_tree_view_set_headers_visible( GTK_TREE_VIEW( view ), FALSE );
{
- GtkCellRenderer* renderer = ui::CellRendererText();
- GtkTreeViewColumn* column = gtk_tree_view_column_new_with_attributes( "Preferences", renderer, "text", 0, NULL );
+ auto renderer = ui::CellRendererText();
+ GtkTreeViewColumn* column = ui::TreeViewColumn( "Preferences", renderer, {{"text", 0}} );
gtk_tree_view_append_column( GTK_TREE_VIEW( view ), column );
}
}
void TextureBrowser_createTreeViewTree(){
- GtkCellRenderer* renderer;
g_TextureBrowser.m_treeViewTree = ui::Widget(GTK_WIDGET( gtk_tree_view_new() ));
gtk_tree_view_set_enable_search( GTK_TREE_VIEW( g_TextureBrowser.m_treeViewTree ), FALSE );
gtk_tree_view_set_headers_visible( GTK_TREE_VIEW( g_TextureBrowser.m_treeViewTree ), FALSE );
g_signal_connect( g_TextureBrowser.m_treeViewTree, "row-activated", (GCallback) TreeView_onRowActivated, NULL );
- renderer = ui::CellRendererText();
+ auto renderer = ui::CellRendererText();
gtk_tree_view_insert_column_with_attributes( GTK_TREE_VIEW( g_TextureBrowser.m_treeViewTree ), -1, "", renderer, "text", 0, NULL );
TextureBrowser_constructTreeStore();
}
void TextureBrowser_createTreeViewTags(){
- GtkCellRenderer* renderer;
g_TextureBrowser.m_treeViewTags = ui::Widget(GTK_WIDGET( gtk_tree_view_new() ));
gtk_tree_view_set_enable_search( GTK_TREE_VIEW( g_TextureBrowser.m_treeViewTags ), FALSE );
gtk_tree_view_set_headers_visible( GTK_TREE_VIEW( g_TextureBrowser.m_treeViewTags ), FALSE );
- renderer = ui::CellRendererText();
+ auto renderer = ui::CellRendererText();
gtk_tree_view_insert_column_with_attributes( GTK_TREE_VIEW( g_TextureBrowser.m_treeViewTags ), -1, "", renderer, "text", 0, NULL );
TextureBrowser_constructTreeStoreTags();
GtkTreeSortable* sortable = GTK_TREE_SORTABLE( g_TextureBrowser.m_assigned_store );
gtk_tree_sortable_set_sort_column_id( sortable, TAG_COLUMN, GTK_SORT_ASCENDING );
- GtkCellRenderer* renderer = ui::CellRendererText();
+ auto renderer = ui::CellRendererText();
g_TextureBrowser.m_assigned_tree = ui::TreeView(ui::TreeModel( GTK_TREE_MODEL( g_TextureBrowser.m_assigned_store ) ));
g_object_unref( G_OBJECT( g_TextureBrowser.m_assigned_store ) );
GtkTreeSelection* selection = gtk_tree_view_get_selection( GTK_TREE_VIEW( g_TextureBrowser.m_assigned_tree ) );
gtk_tree_selection_set_mode( selection, GTK_SELECTION_MULTIPLE );
- GtkTreeViewColumn* column = gtk_tree_view_column_new_with_attributes( "", renderer, "text", TAG_COLUMN, NULL );
+ GtkTreeViewColumn* column = ui::TreeViewColumn( "", renderer, {{"text", TAG_COLUMN}} );
gtk_tree_view_append_column( GTK_TREE_VIEW( g_TextureBrowser.m_assigned_tree ), column );
gtk_widget_show( g_TextureBrowser.m_assigned_tree );
GtkTreeSortable* sortable = GTK_TREE_SORTABLE( g_TextureBrowser.m_available_store );
gtk_tree_sortable_set_sort_column_id( sortable, TAG_COLUMN, GTK_SORT_ASCENDING );
- GtkCellRenderer* renderer = ui::CellRendererText();
+ auto renderer = ui::CellRendererText();
g_TextureBrowser.m_available_tree = ui::TreeView(ui::TreeModel( GTK_TREE_MODEL( g_TextureBrowser.m_available_store ) ));
g_object_unref( G_OBJECT( g_TextureBrowser.m_available_store ) );
GtkTreeSelection* selection = gtk_tree_view_get_selection( GTK_TREE_VIEW( g_TextureBrowser.m_available_tree ) );
gtk_tree_selection_set_mode( selection, GTK_SELECTION_MULTIPLE );
- GtkTreeViewColumn* column = gtk_tree_view_column_new_with_attributes( "", renderer, "text", TAG_COLUMN, NULL );
+ GtkTreeViewColumn* column = ui::TreeViewColumn( "", renderer, {{"text", TAG_COLUMN}} );
gtk_tree_view_append_column( GTK_TREE_VIEW( g_TextureBrowser.m_available_tree ), column );
gtk_widget_show( g_TextureBrowser.m_available_tree );