Web lists-archives.com

Re: How do you write common codes for GObject?




On 4 September 2017 at 15:03, Kouhei Sutou <kou@xxxxxxxxxxxx> wrote:
> 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?

>   d. Other

Use G_DECLARE_FINAL_TYPE and G_DECLARE_DERIVABLE_TYPE from GObject.

https://developer.gnome.org/gobject/stable/howto-gobject.html#howto-gobject-header

Ciao,
 Emmanuele.

-- 
https://www.bassi.io
[@] ebassi [@gmail.com]
_______________________________________________
gtk-list mailing list
gtk-list@xxxxxxxxx
https://mail.gnome.org/mailman/listinfo/gtk-list