mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2024-12-23 22:16:16 +01:00
doc: Extend a bit G_DECLARE_* documentation example
This commit is contained in:
parent
bccc99b5ac
commit
893ff61176
@ -1401,6 +1401,17 @@ guint g_type_get_type_registration_serial (void);
|
||||
* #endif
|
||||
* ]|
|
||||
*
|
||||
* And use it as follow in your C file:
|
||||
*
|
||||
* |[<!-- language="C" -->
|
||||
* struct _MyAppWindow
|
||||
* {
|
||||
* GtkWindow parent;
|
||||
* ...
|
||||
* };
|
||||
* G_DEFINE_TYPE (MyAppWindow, my_app_window, GTK_TYPE_WINDOW)
|
||||
* ]|
|
||||
*
|
||||
* This results in the following things happening:
|
||||
*
|
||||
* - the usual `my_app_window_get_type()` function is declared with a return type of #GType
|
||||
@ -1491,6 +1502,18 @@ guint g_type_get_type_registration_serial (void);
|
||||
* #endif
|
||||
* ]|
|
||||
*
|
||||
* Since the instance structure is public it is often needed to declare a
|
||||
* private struct as follow in your C file:
|
||||
*
|
||||
* |[<!-- language="C" -->
|
||||
* typedef struct _GtkFrobberPrivate GtkFrobberPrivate;
|
||||
* struct _GtkFrobberPrivate
|
||||
* {
|
||||
* ...
|
||||
* };
|
||||
* G_DEFINE_TYPE_WITH_PRIVATE (GtkFrobber, gtk_frobber, GTK_TYPE_WIDGET)
|
||||
* ]|
|
||||
*
|
||||
* This results in the following things happening:
|
||||
*
|
||||
* - the usual `gtk_frobber_get_type()` function is declared with a return type of #GType
|
||||
@ -1585,6 +1608,18 @@ guint g_type_get_type_registration_serial (void);
|
||||
* #endif
|
||||
* ]|
|
||||
*
|
||||
* And use it as follow in your C file:
|
||||
*
|
||||
* |[<!-- language="C" -->
|
||||
* G_DEFINE_INTERFACE (MyModel, my_model, G_TYPE_OBJECT);
|
||||
*
|
||||
* static void
|
||||
* my_model_default_init (MyModelInterface *iface)
|
||||
* {
|
||||
* ...
|
||||
* }
|
||||
* ]|
|
||||
*
|
||||
* This results in the following things happening:
|
||||
*
|
||||
* - the usual `my_model_get_type()` function is declared with a return type of #GType
|
||||
|
Loading…
Reference in New Issue
Block a user