Re: How do you write common codes for GObject?



use new macros if you don't need back compatibility


Il giorno lun 04 set 2017 16:03:55 CEST, Kouhei Sutou ha scritto:

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.



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]