25'ten fazla konu seçemezsiniz Konular bir harf veya rakamla başlamalı, kısa çizgiler ('-') içerebilir ve en fazla 35 karakter uzunluğunda olabilir.
 
 
 
 
 
 

177 satır
7.9 KiB

  1. /* GTK - The GIMP Toolkit
  2. * Copyright (C) 2006-2007 Async Open Source,
  3. * Johan Dahlin <jdahlin@async.com.br>
  4. *
  5. * This library is free software; you can redistribute it and/or
  6. * modify it under the terms of the GNU Library General Public
  7. * License as published by the Free Software Foundation; either
  8. * version 2 of the License, or (at your option) any later version.
  9. *
  10. * This library is distributed in the hope that it will be useful,
  11. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  12. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  13. * Library General Public License for more details.
  14. *
  15. * You should have received a copy of the GNU Library General Public
  16. * License along with this library; if not, write to the
  17. * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
  18. * Boston, MA 02111-1307, USA.
  19. */
  20. #if defined(GTK_DISABLE_SINGLE_INCLUDES) && !defined (__GTK_H_INSIDE__) && !defined (GTK_COMPILATION)
  21. #error "Only <gtk/gtk.h> can be included directly."
  22. #endif
  23. #ifndef __GTK_BUILDABLE_H__
  24. #define __GTK_BUILDABLE_H__
  25. #include <gtk/gtkbuilder.h>
  26. #include <gtk/gtktypeutils.h>
  27. G_BEGIN_DECLS
  28. #define GTK_TYPE_BUILDABLE (gtk_buildable_get_type ())
  29. #define GTK_BUILDABLE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GTK_TYPE_BUILDABLE, GtkBuildable))
  30. #define GTK_BUILDABLE_CLASS(obj) (G_TYPE_CHECK_CLASS_CAST ((obj), GTK_TYPE_BUILDABLE, GtkBuildableIface))
  31. #define GTK_IS_BUILDABLE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GTK_TYPE_BUILDABLE))
  32. #define GTK_BUILDABLE_GET_IFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), GTK_TYPE_BUILDABLE, GtkBuildableIface))
  33. typedef struct _GtkBuildable GtkBuildable; /* Dummy typedef */
  34. typedef struct _GtkBuildableIface GtkBuildableIface;
  35. /**
  36. * GtkBuildableIface:
  37. * @g_iface: the parent class
  38. * @set_name: Stores the name attribute given in the GtkBuilder UI definition.
  39. * #GtkWidget stores the name as object data. Implement this method if your
  40. * object has some notion of "name" and it makes sense to map the XML name
  41. * attribute to it.
  42. * @get_name: The getter corresponding to @set_name. Implement this
  43. * if you implement @set_name.
  44. * @add_child: Adds a child. The @type parameter can be used to
  45. * differentiate the kind of child. #GtkContainer implements this
  46. * to add add a child widget to the container, #GtkNotebook uses
  47. * the @type to distinguish between page labels (of type "page-label")
  48. * and normal children.
  49. * @set_buildable_property: Sets a property of a buildable object.
  50. * It is normally not necessary to implement this, g_object_set_property()
  51. * is used by default. #GtkWindow implements this to delay showing itself
  52. * (i.e. setting the #GtkWidget:visible property) until the whole interface
  53. * is created.
  54. * @construct_child: Constructs a child of a buildable that has been
  55. * specified as "constructor" in the UI definition. #GtkUIManager implements
  56. * this to reference to a widget created in a &lt;ui&gt; tag which is outside
  57. * of the normal GtkBuilder UI definition hierarchy. A reference to the
  58. * constructed object is returned and becomes owned by the caller.
  59. * @custom_tag_start: Implement this if the buildable needs to parse
  60. * content below &lt;child&gt;. To handle an element, the implementation
  61. * must fill in the @parser structure and @user_data and return %TRUE.
  62. * #GtkWidget implements this to parse keyboard accelerators specified
  63. * in &lt;accelerator&gt; elements. #GtkContainer implements it to map
  64. * properties defined via &lt;packing&gt; elements to child properties.
  65. * Note that @user_data must be freed in @custom_tag_end or @custom_finished.
  66. * @custom_tag_end: Called for the end tag of each custom element that is
  67. * handled by the buildable (see @custom_tag_start).
  68. * @custom_finished: Called for each custom tag handled by the buildable
  69. * when the builder finishes parsing (see @custom_tag_start)
  70. * @parser_finished: Called when a builder finishes the parsing
  71. * of a UI definition. It is normally not necessary to implement this,
  72. * unless you need to perform special cleanup actions. #GtkWindow sets
  73. * the #GtkWidget:visible property here.
  74. * @get_internal_child: Returns an internal child of a buildable.
  75. * #GtkDialog implements this to give access to its @vbox, making
  76. * it possible to add children to the vbox in a UI definition.
  77. * Implement this if the buildable has internal children that may
  78. * need to be accessed from a UI definition.
  79. *
  80. * The GtkBuildableIface interface contains method that are
  81. * necessary to allow #GtkBuilder to construct an object from
  82. * a GtkBuilder UI definition.
  83. */
  84. struct _GtkBuildableIface
  85. {
  86. GTypeInterface g_iface;
  87. /* virtual table */
  88. void (* set_name) (GtkBuildable *buildable,
  89. const gchar *name);
  90. const gchar * (* get_name) (GtkBuildable *buildable);
  91. void (* add_child) (GtkBuildable *buildable,
  92. GtkBuilder *builder,
  93. GObject *child,
  94. const gchar *type);
  95. void (* set_buildable_property) (GtkBuildable *buildable,
  96. GtkBuilder *builder,
  97. const gchar *name,
  98. const GValue *value);
  99. GObject * (* construct_child) (GtkBuildable *buildable,
  100. GtkBuilder *builder,
  101. const gchar *name);
  102. gboolean (* custom_tag_start) (GtkBuildable *buildable,
  103. GtkBuilder *builder,
  104. GObject *child,
  105. const gchar *tagname,
  106. GMarkupParser *parser,
  107. gpointer *data);
  108. void (* custom_tag_end) (GtkBuildable *buildable,
  109. GtkBuilder *builder,
  110. GObject *child,
  111. const gchar *tagname,
  112. gpointer *data);
  113. void (* custom_finished) (GtkBuildable *buildable,
  114. GtkBuilder *builder,
  115. GObject *child,
  116. const gchar *tagname,
  117. gpointer data);
  118. void (* parser_finished) (GtkBuildable *buildable,
  119. GtkBuilder *builder);
  120. GObject * (* get_internal_child) (GtkBuildable *buildable,
  121. GtkBuilder *builder,
  122. const gchar *childname);
  123. };
  124. GType gtk_buildable_get_type (void) G_GNUC_CONST;
  125. void gtk_buildable_set_name (GtkBuildable *buildable,
  126. const gchar *name);
  127. const gchar * gtk_buildable_get_name (GtkBuildable *buildable);
  128. void gtk_buildable_add_child (GtkBuildable *buildable,
  129. GtkBuilder *builder,
  130. GObject *child,
  131. const gchar *type);
  132. void gtk_buildable_set_buildable_property (GtkBuildable *buildable,
  133. GtkBuilder *builder,
  134. const gchar *name,
  135. const GValue *value);
  136. GObject * gtk_buildable_construct_child (GtkBuildable *buildable,
  137. GtkBuilder *builder,
  138. const gchar *name);
  139. gboolean gtk_buildable_custom_tag_start (GtkBuildable *buildable,
  140. GtkBuilder *builder,
  141. GObject *child,
  142. const gchar *tagname,
  143. GMarkupParser *parser,
  144. gpointer *data);
  145. void gtk_buildable_custom_tag_end (GtkBuildable *buildable,
  146. GtkBuilder *builder,
  147. GObject *child,
  148. const gchar *tagname,
  149. gpointer *data);
  150. void gtk_buildable_custom_finished (GtkBuildable *buildable,
  151. GtkBuilder *builder,
  152. GObject *child,
  153. const gchar *tagname,
  154. gpointer data);
  155. void gtk_buildable_parser_finished (GtkBuildable *buildable,
  156. GtkBuilder *builder);
  157. GObject * gtk_buildable_get_internal_child (GtkBuildable *buildable,
  158. GtkBuilder *builder,
  159. const gchar *childname);
  160. G_END_DECLS
  161. #endif /* __GTK_BUILDABLE_H__ */