From: TimePath Date: Fri, 21 Jul 2017 12:00:51 +0000 (+1000) Subject: Align with GTK object hierarchy X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=789c28cef6c7d4c7f1d87a89674d75a244f8adfb;p=xonotic%2Fnetradiant.git Align with GTK object hierarchy --- diff --git a/libs/uilib/uilib.cpp b/libs/uilib/uilib.cpp index a76c0c70..054beced 100644 --- a/libs/uilib/uilib.cpp +++ b/libs/uilib/uilib.cpp @@ -22,11 +22,21 @@ namespace ui { gtk_main(); } - Widget root; + Widget root{nullptr}; - alert_response Widget::alert(std::string text, std::string title, alert_type type, alert_icon icon) +#define this (*static_cast(this)) + + void IEditable::editable(bool value) + { + gtk_editable_set_editable(GTK_EDITABLE(this), value); + } + + Widget::Widget() : Widget(nullptr) + {} + + alert_response IWidget::alert(std::string text, std::string title, alert_type type, alert_icon icon) { - auto ret = gtk_MessageBox(*this, text.c_str(), + auto ret = gtk_MessageBox(this, text.c_str(), title.c_str(), type == alert_type::OK ? eMB_OK : type == alert_type::OKCANCEL ? eMB_OKCANCEL : @@ -49,36 +59,39 @@ namespace ui { alert_response::OK; } - const char *Widget::file_dialog(bool open, const char *title, const char *path, - const char *pattern, bool want_load, bool want_import, - bool want_save) + const char * + IWidget::file_dialog(bool open, const char *title, const char *path, const char *pattern, bool want_load, + bool want_import, bool want_save) { - return ::file_dialog(*this, open, title, path, pattern, want_load, want_import, want_save); + return ::file_dialog(this, open, title, path, pattern, want_load, want_import, want_save); } - Window::Window(window_type type) - : Window(GTK_WINDOW(gtk_window_new( + Window::Window() : Window(nullptr) + {} + + Window::Window(window_type type) : Window(GTK_WINDOW(gtk_window_new( type == window_type::TOP ? GTK_WINDOW_TOPLEVEL : type == window_type::POPUP ? GTK_WINDOW_POPUP : - GTK_WINDOW_TOPLEVEL))) - {}; + GTK_WINDOW_TOPLEVEL + ))) + {} - Window Window::create_dialog_window(const char *title, void func(), void *data, int default_w, int default_h) + Window IWindow::create_dialog_window(const char *title, void func(), void *data, int default_w, int default_h) { - return Window(::create_dialog_window(*this, title, func, data, default_w, default_h)); + return Window(::create_dialog_window(this, title, func, data, default_w, default_h)); } - Window Window::create_modal_dialog_window(const char *title, ui_modal &dialog, int default_w, int default_h) + Window IWindow::create_modal_dialog_window(const char *title, ModalDialog &dialog, int default_w, int default_h) { - return Window(::create_modal_dialog_window(*this, title, dialog, default_w, default_h)); + return Window(::create_modal_dialog_window(this, title, dialog, default_w, default_h)); } - Window Window::create_floating_window(const char *title) + Window IWindow::create_floating_window(const char *title) { - return Window(::create_floating_window(title, *this)); + return Window(::create_floating_window(title, this)); } - std::uint64_t Window::on_key_press(bool (*f)(Widget widget, ui_evkey *event, void *extra), void *extra) + std::uint64_t IWindow::on_key_press(bool (*f)(Widget widget, _GdkEventKey *event, void *extra), void *extra) { using f_t = decltype(f); struct user_data { @@ -88,111 +101,117 @@ namespace ui { auto dtor = [](user_data *data, GClosure *) { delete data; }; - auto func = [](ui_widget *widget, GdkEventKey *event, user_data *args) -> bool { + auto func = [](_GtkWidget *widget, GdkEventKey *event, user_data *args) -> bool { return args->f(Widget(widget), event, args->extra); }; auto clos = g_cclosure_new(G_CALLBACK(+func), pass, reinterpret_cast(+dtor)); - return g_signal_connect_closure(G_OBJECT(*this), "key-press-event", clos, false); + return g_signal_connect_closure(G_OBJECT(this), "key-press-event", clos, false); } - void Window::add_accel_group(AccelGroup group) + void IWindow::add_accel_group(AccelGroup group) { - gtk_window_add_accel_group(*this, group); + gtk_window_add_accel_group(this, group); } - AccelGroup::AccelGroup() : AccelGroup(GTK_ACCEL_GROUP(gtk_accel_group_new())) - {} - - Adjustment::Adjustment(double value, - 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))) - {} - Alignment::Alignment(float xalign, float yalign, float xscale, float yscale) : Alignment(GTK_ALIGNMENT(gtk_alignment_new(xalign, yalign, xscale, yscale))) {} + Frame::Frame(const char *label) : Frame(GTK_FRAME(gtk_frame_new(label))) + {} + Button::Button() : Button(GTK_BUTTON(gtk_button_new())) {} Button::Button(const char *label) : Button(GTK_BUTTON(gtk_button_new_with_label(label))) {} - CellRendererText::CellRendererText() : CellRendererText(GTK_CELL_RENDERER_TEXT(gtk_cell_renderer_text_new())) - {} + bool IToggleButton::active() + { + return gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(this)) != 0; + } - ComboBoxText::ComboBoxText() : ComboBoxText(GTK_COMBO_BOX_TEXT(gtk_combo_box_text_new())) + CheckButton::CheckButton(const char *label) : CheckButton(GTK_CHECK_BUTTON(gtk_check_button_new_with_label(label))) {} - CheckButton::CheckButton(const char *label) : CheckButton(GTK_CHECK_BUTTON(gtk_check_button_new_with_label(label))) + MenuItem::MenuItem() : MenuItem(GTK_MENU_ITEM(gtk_menu_item_new())) {} - Entry::Entry() : Entry(GTK_ENTRY(gtk_entry_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))) {} - Entry::Entry(std::size_t max_length) : Entry() - { - gtk_entry_set_max_length(*this, static_cast(max_length)); - } + TearoffMenuItem::TearoffMenuItem() : TearoffMenuItem(GTK_TEAROFF_MENU_ITEM(gtk_tearoff_menu_item_new())) + {} - Frame::Frame(const char *label) : Frame(GTK_FRAME(gtk_frame_new(label))) + ComboBoxText::ComboBoxText() : ComboBoxText(GTK_COMBO_BOX_TEXT(gtk_combo_box_text_new())) {} - HBox::HBox(bool homogenous, int spacing) : HBox(GTK_HBOX(gtk_hbox_new(homogenous, spacing))) + ScrolledWindow::ScrolledWindow() : ScrolledWindow(GTK_SCROLLED_WINDOW(gtk_scrolled_window_new(nullptr, nullptr))) {} - HScale::HScale(Adjustment adjustment) : HScale(GTK_HSCALE(gtk_hscale_new(adjustment))) + VBox::VBox(bool homogenous, int spacing) : VBox(GTK_VBOX(gtk_vbox_new(homogenous, spacing))) {} - HScale::HScale(double min, double max, double step) : HScale(GTK_HSCALE(gtk_hscale_new_with_range(min, max, step))) + HBox::HBox(bool homogenous, int spacing) : HBox(GTK_HBOX(gtk_hbox_new(homogenous, spacing))) {} - Image::Image() : Image(GTK_IMAGE(gtk_image_new())) + HPaned::HPaned() : HPaned(GTK_HPANED(gtk_hpaned_new())) {} - Label::Label(const char *label) : Label(GTK_LABEL(gtk_label_new(label))) + VPaned::VPaned() : VPaned(GTK_VPANED(gtk_vpaned_new())) {} 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))) + Table::Table(std::size_t rows, std::size_t columns, bool homogenous) : Table( + GTK_TABLE(gtk_table_new(rows, columns, homogenous)) + ) {} - HPaned::HPaned() : HPaned(GTK_HPANED(gtk_hpaned_new())) + TextView::TextView() : TextView(GTK_TEXT_VIEW(gtk_text_view_new())) {} - VPaned::VPaned() : VPaned(GTK_VPANED(gtk_vpaned_new())) + TreeView::TreeView() : TreeView(GTK_TREE_VIEW(gtk_tree_view_new())) {} - ScrolledWindow::ScrolledWindow() : ScrolledWindow(GTK_SCROLLED_WINDOW(gtk_scrolled_window_new(nullptr, nullptr))) + TreeView::TreeView(TreeModel model) : TreeView(GTK_TREE_VIEW(gtk_tree_view_new_with_model(model))) {} - SpinButton::SpinButton(Adjustment adjustment, double climb_rate, std::size_t digits) : SpinButton( - GTK_SPIN_BUTTON(gtk_spin_button_new(adjustment, climb_rate, digits))) + Label::Label(const char *label) : Label(GTK_LABEL(gtk_label_new(label))) {} - Table::Table(std::size_t rows, std::size_t columns, bool homogenous) : Table( - GTK_TABLE(gtk_table_new(rows, columns, homogenous))) + Image::Image() : Image(GTK_IMAGE(gtk_image_new())) {} - TextView::TextView() : TextView(GTK_TEXT_VIEW(gtk_text_view_new())) + Entry::Entry() : Entry(GTK_ENTRY(gtk_entry_new())) {} - TreePath::TreePath() : TreePath(gtk_tree_path_new()) + Entry::Entry(std::size_t max_length) : Entry() + { + gtk_entry_set_max_length(this, static_cast(max_length)); + } + + SpinButton::SpinButton(Adjustment adjustment, double climb_rate, std::size_t digits) : SpinButton( + GTK_SPIN_BUTTON(gtk_spin_button_new(adjustment, climb_rate, digits))) {} - TreePath::TreePath(const char *path) : TreePath(gtk_tree_path_new_from_string(path)) + HScale::HScale(Adjustment adjustment) : HScale(GTK_HSCALE(gtk_hscale_new(adjustment))) {} - TreeView::TreeView() : TreeView(GTK_TREE_VIEW(gtk_tree_view_new())) + HScale::HScale(double min, double max, double step) : HScale(GTK_HSCALE(gtk_hscale_new_with_range(min, max, step))) {} - TreeView::TreeView(TreeModel model) : TreeView(GTK_TREE_VIEW(gtk_tree_view_new_with_model(model))) + Adjustment::Adjustment(double value, + 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))) + {} + + CellRendererText::CellRendererText() : CellRendererText(GTK_CELL_RENDERER_TEXT(gtk_cell_renderer_text_new())) {} TreeViewColumn::TreeViewColumn(const char *title, CellRenderer renderer, @@ -200,11 +219,17 @@ namespace ui { : 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); + 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))) + AccelGroup::AccelGroup() : AccelGroup(GTK_ACCEL_GROUP(gtk_accel_group_new())) + {} + + TreePath::TreePath() : TreePath(gtk_tree_path_new()) + {} + + TreePath::TreePath(const char *path) : TreePath(gtk_tree_path_new_from_string(path)) {} } diff --git a/libs/uilib/uilib.h b/libs/uilib/uilib.h index f3f490c3..2849a12a 100644 --- a/libs/uilib/uilib.h +++ b/libs/uilib/uilib.h @@ -3,42 +3,56 @@ #include -using ui_accelgroup = struct _GtkAccelGroup; -using ui_adjustment = struct _GtkAdjustment; -using ui_alignment = struct _GtkAlignment; -using ui_box = struct _GtkBox; -using ui_button = struct _GtkButton; -using ui_checkbutton = struct _GtkCheckButton; -using ui_combobox = struct _GtkComboBox; -using ui_comboboxtext = struct _GtkComboBoxText; -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_hscale = struct _GtkHScale; -using ui_hpaned = struct _GtkHPaned; -using ui_image = struct _GtkImage; -using ui_label = struct _GtkLabel; -using ui_menu = struct _GtkMenu; -using ui_menuitem = struct _GtkMenuItem; -using ui_modal = struct ModalDialog; -using ui_object = struct _GtkObject; -using ui_paned = struct _GtkPaned; -using ui_scrolledwindow = struct _GtkScrolledWindow; -using ui_spinbutton = struct _GtkSpinButton; -using ui_table = struct _GtkTable; -using ui_textview = struct _GtkTextView; -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_vpaned = struct _GtkVPaned; -using ui_widget = struct _GtkWidget; -using ui_window = struct _GtkWindow; +struct _GdkEventKey; +struct _GtkAccelGroup; +struct _GtkAdjustment; +struct _GtkAlignment; +struct _GtkBin; +struct _GtkBox; +struct _GtkButton; +struct _GtkCellEditable; +struct _GtkCellRenderer; +struct _GtkCellRendererText; +struct _GtkCheckButton; +struct _GtkComboBox; +struct _GtkComboBoxText; +struct _GtkContainer; +struct _GtkDialog; +struct _GtkEditable; +struct _GtkEntry; +struct _GtkFrame; +struct _GtkHBox; +struct _GtkHPaned; +struct _GtkHScale; +struct _GtkImage; +struct _GtkItem; +struct _GtkLabel; +struct _GtkListStore; +struct _GtkMenu; +struct _GtkMenuShell; +struct _GtkMenuItem; +struct _GtkMisc; +struct _GtkObject; +struct _GtkPaned; +struct _GtkRange; +struct _GtkScale; +struct _GtkScrolledWindow; +struct _GtkSpinButton; +struct _GtkTable; +struct _GtkTearoffMenuItem; +struct _GtkTextView; +struct _GtkToggleButton; +struct _GtkTreeModel; +struct _GtkTreePath; +struct _GtkTreeView; +struct _GtkTreeViewColumn; +struct _GtkVBox; +struct _GtkVPaned; +struct _GtkWidget; +struct _GtkWindow; +struct _GTypeInstance; + +struct ModalDialog; namespace ui { @@ -46,6 +60,8 @@ namespace ui { void main(); + extern class Widget root; + enum class alert_type { OK, OKCANCEL, @@ -74,207 +90,345 @@ namespace ui { POPUP }; - template - struct Convertible; - - template - struct Convertible { - operator T *() const - { return reinterpret_cast(static_cast(this)->_handle); } - }; - - template - struct Convertible { - explicit operator T *() const - { return reinterpret_cast(static_cast(this)->_handle); } - }; - - class Object : public Convertible { + namespace details { + + enum class Convert { + Implicit, Explicit + }; + + template + struct Convertible; + + template + struct Convertible { + operator T() const + { return reinterpret_cast(static_cast(this)->_handle); } + }; + + template + struct Convertible { + explicit operator T() const + { return reinterpret_cast(static_cast(this)->_handle); } + }; + + template + struct All : T ... { + All() + {}; + }; + + template + struct Mixin; + template + struct Mixin { + using type = All; + }; + template + struct Mixin { + using type = All; + }; + } + + class Object : + public details::Convertible, + public details::Convertible { public: - using native = ui_object; - void *_handle; + using native = _GtkObject *; + native _handle; - Object(void *h) : _handle(h) - { } + Object(native h) : _handle(h) + {} explicit operator bool() const { return _handle != nullptr; } - explicit operator ui_typeinst *() const - { return (ui_typeinst *) _handle; } - explicit operator void *() const { return _handle; } }; + static_assert(sizeof(Object) == sizeof(Object::native), "object slicing"); - static_assert(sizeof(Object) == sizeof(ui_widget *), "object slicing"); +#define WRAP(name, super, T, interfaces, ctors, methods) \ + class name; \ + class I##name { \ + public: \ + using self = name *; \ + methods \ + }; \ + class name : public super, public details::Convertible, public I##name, public details::Mixin::type { \ + public: \ + using self = name *; \ + using native = T *; \ + explicit name(native h) : super(reinterpret_cast(h)) {} \ + ctors \ + }; \ + inline bool operator<(name self, name other) { return self._handle < other._handle; } \ + static_assert(sizeof(name) == sizeof(super), "object slicing") - class Widget : public Object, public Convertible { - public: - using native = ui_widget; - explicit Widget(ui_widget *h = nullptr) : Object((void *) h) - { } + // https://developer.gnome.org/gtk2/stable/ch01.html - alert_response alert(std::string text, std::string title = "NetRadiant", - alert_type type = alert_type::OK, alert_icon icon = alert_icon::Default); + WRAP(CellEditable, Object, _GtkCellEditable, (), + , + ); - const char *file_dialog(bool open, const char *title, const char *path = nullptr, - const char *pattern = nullptr, bool want_load = false, bool want_import = false, - bool want_save = false); - }; + WRAP(Editable, Object, _GtkEditable, (), + Editable(); + , + void editable(bool value); + ); - static_assert(sizeof(Widget) == sizeof(Object), "object slicing"); + WRAP(Widget, Object, _GtkWidget, (), + Widget(); + , + alert_response alert( + std::string text, + std::string title = "NetRadiant", + alert_type type = alert_type::OK, + alert_icon icon = alert_icon::Default + ); + const char *file_dialog( + bool open, + const char *title, + const char *path = nullptr, + const char *pattern = nullptr, + bool want_load = false, + bool want_import = false, + bool want_save = false + ); + ); - extern Widget root; + WRAP(Container, Widget, _GtkContainer, (), + , + ); -#define WRAP(name, super, impl, methods) \ - class name : public super, public Convertible { \ - public: \ - using native = impl; \ - explicit name(impl *h) : super(reinterpret_cast(h)) {} \ - methods \ - }; \ - inline bool operator<(name self, name other) { return self._handle < other._handle; } \ - static_assert(sizeof(name) == sizeof(super), "object slicing") + WRAP(Bin, Container, _GtkBin, (), + , + ); - WRAP(AccelGroup, Object, ui_accelgroup, - AccelGroup(); + class AccelGroup; + WRAP(Window, Bin, _GtkWindow, (), + Window(); + Window(window_type type); + , + Window create_dialog_window( + const char *title, + void func(), + void *data, + int default_w = -1, + int default_h = -1 + ); + + Window create_modal_dialog_window( + const char *title, + ModalDialog &dialog, + int default_w = -1, + int default_h = -1 + ); + + Window create_floating_window(const char *title); + + std::uint64_t on_key_press( + bool (*f)(Widget widget, _GdkEventKey *event, void *extra), + void *extra = nullptr + ); + + void add_accel_group(AccelGroup group); ); - WRAP(Adjustment, Widget, ui_adjustment, - Adjustment(double value, - double lower, double upper, - double step_increment, double page_increment, - double page_size); + WRAP(Dialog, Window, _GtkDialog, (), + , ); - WRAP(Alignment, Widget, ui_alignment, + WRAP(Alignment, Bin, _GtkAlignment, (), Alignment(float xalign, float yalign, float xscale, float yscale); + , ); - WRAP(Box, Widget, ui_box,); + WRAP(Frame, Bin, _GtkFrame, (), + Frame(const char *label = nullptr); + , + ); - WRAP(Button, Widget, ui_button, + WRAP(Button, Bin, _GtkButton, (), Button(); Button(const char *label); + , ); - WRAP(CellRenderer, Object, ui_cellrenderer,); - - WRAP(CellRendererText, CellRenderer, ui_cellrenderertext, - CellRendererText(); + WRAP(ToggleButton, Button, _GtkToggleButton, (), + , + bool active(); ); - WRAP(CheckButton, Widget, ui_checkbutton, + WRAP(CheckButton, ToggleButton, _GtkCheckButton, (), CheckButton(const char *label); + , + ); + + WRAP(Item, Bin, _GtkItem, (), + , ); - WRAP(ComboBox, Widget, ui_combobox,); + WRAP(MenuItem, Item, _GtkMenuItem, (), + MenuItem(); + MenuItem(const char *label, bool mnemonic = false); + , + ); + WRAP(TearoffMenuItem, MenuItem, _GtkTearoffMenuItem, (), + TearoffMenuItem(); + , + ); - WRAP(ComboBoxText, ComboBox, ui_comboboxtext, + WRAP(ComboBox, Bin, _GtkComboBox, (), + , + ); + + WRAP(ComboBoxText, ComboBox, _GtkComboBoxText, (), ComboBoxText(); + , ); - WRAP(Entry, Widget, ui_entry, - Entry(); - Entry(std::size_t max_length); + WRAP(ScrolledWindow, Bin, _GtkScrolledWindow, (), + ScrolledWindow(); + , ); - WRAP(Frame, Widget, ui_frame, - Frame(const char *label = nullptr); + WRAP(Box, Container, _GtkBox, (), + , + ); + + WRAP(VBox, Box, _GtkVBox, (), + VBox(bool homogenous, int spacing); + , ); - WRAP(HBox, Box, ui_hbox, + WRAP(HBox, Box, _GtkHBox, (), HBox(bool homogenous, int spacing); + , ); - WRAP(HScale, Widget, ui_hscale, - HScale(Adjustment adjustment); - HScale(double min, double max, double step); + WRAP(Paned, Container, _GtkPaned, (), + , ); - WRAP(Image, Widget, ui_image, - Image(); + WRAP(HPaned, Paned, _GtkHPaned, (), + HPaned(); + , ); - WRAP(Label, Widget, ui_label, - Label(const char *label); + WRAP(VPaned, Paned, _GtkVPaned, (), + VPaned(); + , ); - WRAP(Menu, Widget, ui_menu, + WRAP(MenuShell, Container, _GtkMenuShell, (), + , + ); + + WRAP(Menu, Widget, _GtkMenu, (), Menu(); + , ); - WRAP(MenuItem, Widget, ui_menuitem, - MenuItem(const char *label, bool mnemonic = false); + WRAP(Table, Widget, _GtkTable, (), + Table(std::size_t rows, std::size_t columns, bool homogenous); + , + ); + + WRAP(TextView, Widget, _GtkTextView, (), + TextView(); + , + ); + + class TreeModel; + WRAP(TreeView, Widget, _GtkTreeView, (), + TreeView(); + TreeView(TreeModel model); + , ); - WRAP(Paned, Widget, ui_paned,); + WRAP(Misc, Widget, _GtkMisc, (), + , + ); - WRAP(HPaned, Paned, ui_hpaned, - HPaned(); - ); + WRAP(Label, Widget, _GtkLabel, (), + Label(const char *label); + , + ); - WRAP(VPaned, Paned, ui_vpaned, - VPaned(); - ); + WRAP(Image, Widget, _GtkImage, (), + Image(); + , + ); - WRAP(ScrolledWindow, Widget, ui_scrolledwindow, - ScrolledWindow(); + WRAP(Entry, Widget, _GtkEntry, (IEditable, ICellEditable), + Entry(); + Entry(std::size_t max_length); + , ); - WRAP(SpinButton, Widget, ui_spinbutton, + class Adjustment; + WRAP(SpinButton, Entry, _GtkSpinButton, (), SpinButton(Adjustment adjustment, double climb_rate, std::size_t digits); + , ); - WRAP(Table, Widget, ui_table, - Table(std::size_t rows, std::size_t columns, bool homogenous); + WRAP(Range, Widget, _GtkRange, (), + , ); - WRAP(TextView, Widget, ui_textview, - TextView(); + WRAP(Scale, Range, _GtkScale, (), + , ); - WRAP(TreeModel, Widget, ui_treemodel,); + WRAP(HScale, Scale, _GtkHScale, (), + HScale(Adjustment adjustment); + HScale(double min, double max, double step); + , + ); - WRAP(TreePath, Object, ui_treepath, - TreePath(); - TreePath(const char *path); + WRAP(Adjustment, Object, _GtkAdjustment, (), + Adjustment(double value, + double lower, double upper, + double step_increment, double page_increment, + double page_size); + , ); - WRAP(TreeView, Widget, ui_treeview, - TreeView(); - TreeView(TreeModel model); + WRAP(CellRenderer, Object, _GtkCellRenderer, (), + , + ); + + WRAP(CellRendererText, CellRenderer, _GtkCellRendererText, (), + CellRendererText(); + , ); struct TreeViewColumnAttribute { const char *attribute; int column; }; - WRAP(TreeViewColumn, Widget, ui_treeviewcolumn, + WRAP(TreeViewColumn, Object, _GtkTreeViewColumn, (), TreeViewColumn(const char *title, CellRenderer renderer, std::initializer_list attributes); + , ); - WRAP(VBox, Box, ui_vbox, - VBox(bool homogenous, int spacing); + WRAP(AccelGroup, Object, _GtkAccelGroup, (), + AccelGroup(); + , ); - WRAP(Window, Widget, ui_window, - Window() : Window(nullptr) {}; - Window(window_type type); - - Window create_dialog_window(const char *title, void func(), void *data, int default_w = -1, - int default_h = -1); - - Window create_modal_dialog_window(const char *title, ui_modal &dialog, int default_w = -1, - int default_h = -1); - - Window create_floating_window(const char *title); + WRAP(ListStore, Object, _GtkListStore, (), + , + ); - std::uint64_t on_key_press(bool (*f)(Widget widget, ui_evkey *event, void *extra), - void *extra = nullptr); + WRAP(TreeModel, Widget, _GtkTreeModel, (), + , + ); - void add_accel_group(AccelGroup group); + WRAP(TreePath, Object, _GtkTreePath, (), + TreePath(); + TreePath(const char *path); + , ); #undef WRAP