How do you write common codes for GObject?
- From: Kouhei Sutou <kou cozmixng org>
- To: gtk-list gnome org
- Subject: How do you write common codes for GObject?
- Date: Mon, 04 Sep 2017 23:03:55 +0900 (JST)
Hi,
We need to write common codes for GObject like the
followings:
#define GTK_TYPE_WIDGET (gtk_widget_get_type ())
#define GTK_WIDGET(widget) (G_TYPE_CHECK_INSTANCE_CAST ((widget), GTK_TYPE_WIDGET, GtkWidget))
#define GTK_WIDGET_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GTK_TYPE_WIDGET, GtkWidgetClass))
#define GTK_IS_WIDGET(widget) (G_TYPE_CHECK_INSTANCE_TYPE ((widget), GTK_TYPE_WIDGET))
#define GTK_IS_WIDGET_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GTK_TYPE_WIDGET))
#define GTK_WIDGET_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GTK_TYPE_WIDGET, GtkWidgetClass))
How do you write them?
a. Write them from scratch
b. Copy from existing codes, paste them to new source file
and substitute them
c. Generate them by script
d. Other
My approach is b. If there is better approach, I want to use
it. Please share your approach.
Thanks,
--
kou
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]