gtk_main();
}
- Widget root{nullptr};
+ void process()
+ {
+ while (gtk_events_pending()) {
+ gtk_main_iteration();
+ }
+ }
+
+ Widget root;
#define IMPL(T, F) template<> _IMPL(T, F)
#define _IMPL(T, F) struct verify<T *> { using self = T; static self test(self it) { return self(F(it)); } }
template<class T> _IMPL(T,);
-#define this verify<self>::test(*static_cast<self>(this))
+#define this (verify<self>::test(*static_cast<self>(this)))
IMPL(Editable, GTK_EDITABLE);
gtk_widget_show(this);
}
- IMPL(Window, GTK_WINDOW);
+ IMPL(Container, GTK_CONTAINER);
- Window::Window() : Window(nullptr)
- {}
+ void IContainer::add(Widget widget)
+ {
+ gtk_container_add(this, widget);
+ }
+
+ void IContainer::remove(Widget widget)
+ {
+ gtk_container_remove(this, widget);
+ }
+
+ IMPL(Bin, GTK_BIN);
+
+ IMPL(Window, GTK_WINDOW);
Window::Window(window_type type) : Window(GTK_WINDOW(gtk_window_new(
type == window_type::TOP ? GTK_WINDOW_TOPLEVEL :
TreePath::TreePath(const char *path) : TreePath(gtk_tree_path_new_from_string(path))
{}
+ // Custom
+
+ guint IGLArea::on_render(GCallback pFunction, void *data)
+ {
+#if GTK_TARGET == 3
+ return this.connect("render", pFunction, data);
+#endif
+#if GTK_TARGET == 2
+ return this.connect("expose_event", pFunction, data);
+#endif
+ };
+
}