Add Composite Child machinery and APIs to GtkWidget
This commit implements the needed machinery for GtkWidget
to build it's composite content from GtkBuilder XML and
adds the following API:
o gtk_widget_init_template()
An api to be called in instance initializers of any
GtkWidget subclass that uses template XML to build it's components.
o gtk_widget_class_set_template()
API to associate GtkBuilder XML to a given GtkWidget subclass
o gtk_widget_class_automate_child()
API to declare an object built by GtkBuilder to be associated
with an instance structure offset and automatically set.
o gtk_widget_get_automated_child()
API for bindings to fetch a child declared to be automated by
gtk_widget_class_automate_child(), for the case where bindings
do not generate GObjects under the hood and cannot use structure
offsets to resolve composite object pointers.
o gtk_widget_class_declare_callback[s]()
Declare static functions to be used in signal callbacks from
a given class's template XML
o gtk_widget_class_set_connect_func()
API for bindings to override the signal connection machinery
for a given GtkWidget derived class.
This commit is contained in:
@ -943,6 +943,79 @@ GDK_AVAILABLE_IN_3_8
|
||||
void gtk_widget_remove_tick_callback (GtkWidget *widget,
|
||||
guint id);
|
||||
|
||||
/**
|
||||
* gtk_widget_class_bind_callback:
|
||||
* @widget_class: a #GtkWidgetClass
|
||||
* @callback: the callback symbol
|
||||
*
|
||||
* Shorthand for gtk_widget_class_declare_callback(), adds a symbol
|
||||
* by it's own name to the @widget_class.
|
||||
*
|
||||
* Since: 3.10
|
||||
*/
|
||||
#define gtk_widget_class_bind_callback(widget_class, callback) \
|
||||
gtk_widget_class_declare_callback (GTK_WIDGET_CLASS (widget_class), \
|
||||
#callback, G_CALLBACK(callback))
|
||||
|
||||
/**
|
||||
* gtk_widget_class_bind_child:
|
||||
* @widget_class: a #GtkWidgetClass
|
||||
* @private_data_type: the type of this widget class's instance private data
|
||||
* @member_name: name of the instance private member on @private_data_type
|
||||
*
|
||||
* Shorthand for gtk_widget_class_automate_child(). This macro assumes that
|
||||
* the @member_name is the name of the component instance to lookup as specified
|
||||
* in the composite template.
|
||||
*
|
||||
* Since: 3.10
|
||||
*/
|
||||
#define gtk_widget_class_bind_child(widget_class, private_data_type, member_name) \
|
||||
gtk_widget_class_automate_child (widget_class, #member_name, FALSE, \
|
||||
G_STRUCT_OFFSET (private_data_type, member_name))
|
||||
|
||||
/**
|
||||
* gtk_widget_class_bind_child_internal:
|
||||
* @widget_class: a #GtkWidgetClass
|
||||
* @private_data_type: the type name of this widget class's instance private data
|
||||
* @member_name: name of the instance private member on @private_data_type
|
||||
*
|
||||
* Shorthand for gtk_widget_class_automate_child(). Essentially the same as
|
||||
* gtk_widget_class_bind_child() except that it will export the child as
|
||||
* an internal child.
|
||||
*
|
||||
* Since: 3.10
|
||||
*/
|
||||
#define gtk_widget_class_bind_child_internal(widget_class, private_data_type, member_name) \
|
||||
gtk_widget_class_automate_child (widget_class, #member_name, TRUE, \
|
||||
G_STRUCT_OFFSET (private_data_type, member_name))
|
||||
|
||||
GDK_AVAILABLE_IN_3_10
|
||||
void gtk_widget_init_template (GtkWidget *widget);
|
||||
GDK_AVAILABLE_IN_3_10
|
||||
GObject *gtk_widget_get_automated_child (GtkWidget *widget,
|
||||
GType widget_type,
|
||||
const gchar *name);
|
||||
GDK_AVAILABLE_IN_3_10
|
||||
void gtk_widget_class_set_template (GtkWidgetClass *widget_class,
|
||||
GBytes *template_bytes);
|
||||
GDK_AVAILABLE_IN_3_10
|
||||
void gtk_widget_class_set_template_from_resource (GtkWidgetClass *widget_class,
|
||||
const gchar *resource_name);
|
||||
GDK_AVAILABLE_IN_3_10
|
||||
void gtk_widget_class_declare_callback (GtkWidgetClass *widget_class,
|
||||
const gchar *callback_name,
|
||||
GCallback callback_symbol);
|
||||
GDK_AVAILABLE_IN_3_10
|
||||
void gtk_widget_class_set_connect_func (GtkWidgetClass *widget_class,
|
||||
GtkBuilderConnectFunc connect_func,
|
||||
gpointer connect_data,
|
||||
GDestroyNotify connect_data_destroy);
|
||||
GDK_AVAILABLE_IN_3_10
|
||||
void gtk_widget_class_automate_child (GtkWidgetClass *widget_class,
|
||||
const gchar *name,
|
||||
gboolean internal_child,
|
||||
gssize struct_offset);
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
#endif /* __GTK_WIDGET_H__ */
|
||||
|
||||
Reference in New Issue
Block a user