Nevar pievienot vairāk kā 25 tēmas Tēmai ir jāsākas ar burtu vai ciparu, tā var saturēt domu zīmes ('-') un var būt līdz 35 simboliem gara.
 
 
 
 
 
 

272 rindas
8.4 KiB

  1. /* GTK - The GIMP Toolkit
  2. * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald
  3. *
  4. * This library is free software; you can redistribute it and/or
  5. * modify it under the terms of the GNU Lesser General Public
  6. * License as published by the Free Software Foundation; either
  7. * version 2 of the License, or (at your option) any later version.
  8. *
  9. * This library is distributed in the hope that it will be useful,
  10. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  11. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  12. * Lesser General Public License for more details.
  13. *
  14. * You should have received a copy of the GNU Lesser General Public
  15. * License along with this library; if not, write to the
  16. * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
  17. * Boston, MA 02111-1307, USA.
  18. */
  19. /*
  20. * Modified by the GTK+ Team and others 1997-2000. See the AUTHORS
  21. * file for a list of people on the GTK+ Team. See the ChangeLog
  22. * files for a list of changes. These files are distributed with
  23. * GTK+ at ftp://ftp.gtk.org/pub/gtk/.
  24. */
  25. #if defined(GTK_DISABLE_SINGLE_INCLUDES) && !defined (__GTK_H_INSIDE__) && !defined (GTK_COMPILATION)
  26. #error "Only <gtk/gtk.h> can be included directly."
  27. #endif
  28. #ifndef __GTK_RC_H__
  29. #define __GTK_RC_H__
  30. #include <gtk/gtkstyle.h>
  31. G_BEGIN_DECLS
  32. /* Forward declarations */
  33. typedef struct _GtkIconFactory GtkIconFactory;
  34. typedef struct _GtkRcContext GtkRcContext;
  35. typedef struct _GtkRcStyleClass GtkRcStyleClass;
  36. #define GTK_TYPE_RC_STYLE (gtk_rc_style_get_type ())
  37. #define GTK_RC_STYLE(object) (G_TYPE_CHECK_INSTANCE_CAST ((object), GTK_TYPE_RC_STYLE, GtkRcStyle))
  38. #define GTK_RC_STYLE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GTK_TYPE_RC_STYLE, GtkRcStyleClass))
  39. #define GTK_IS_RC_STYLE(object) (G_TYPE_CHECK_INSTANCE_TYPE ((object), GTK_TYPE_RC_STYLE))
  40. #define GTK_IS_RC_STYLE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GTK_TYPE_RC_STYLE))
  41. #define GTK_RC_STYLE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GTK_TYPE_RC_STYLE, GtkRcStyleClass))
  42. typedef enum
  43. {
  44. GTK_RC_FG = 1 << 0,
  45. GTK_RC_BG = 1 << 1,
  46. GTK_RC_TEXT = 1 << 2,
  47. GTK_RC_BASE = 1 << 3
  48. } GtkRcFlags;
  49. struct _GtkRcStyle
  50. {
  51. GObject parent_instance;
  52. /*< public >*/
  53. gchar *name;
  54. gchar *bg_pixmap_name[5];
  55. PangoFontDescription *font_desc;
  56. GtkRcFlags color_flags[5];
  57. GdkColor fg[5];
  58. GdkColor bg[5];
  59. GdkColor text[5];
  60. GdkColor base[5];
  61. gint xthickness;
  62. gint ythickness;
  63. /*< private >*/
  64. GArray *rc_properties;
  65. /* list of RC style lists including this RC style */
  66. GSList *rc_style_lists;
  67. GSList *icon_factories;
  68. guint engine_specified : 1; /* The RC file specified the engine */
  69. };
  70. struct _GtkRcStyleClass
  71. {
  72. GObjectClass parent_class;
  73. /* Create an empty RC style of the same type as this RC style.
  74. * The default implementation, which does
  75. * g_object_new (G_OBJECT_TYPE (style), NULL);
  76. * should work in most cases.
  77. */
  78. GtkRcStyle * (*create_rc_style) (GtkRcStyle *rc_style);
  79. /* Fill in engine specific parts of GtkRcStyle by parsing contents
  80. * of brackets. Returns G_TOKEN_NONE if successful, otherwise returns
  81. * the token it expected but didn't get.
  82. */
  83. guint (*parse) (GtkRcStyle *rc_style,
  84. GtkSettings *settings,
  85. GScanner *scanner);
  86. /* Combine RC style data from src into dest. If overridden, this
  87. * function should chain to the parent.
  88. */
  89. void (*merge) (GtkRcStyle *dest,
  90. GtkRcStyle *src);
  91. /* Create an empty style suitable to this RC style
  92. */
  93. GtkStyle * (*create_style) (GtkRcStyle *rc_style);
  94. /* Padding for future expansion */
  95. void (*_gtk_reserved1) (void);
  96. void (*_gtk_reserved2) (void);
  97. void (*_gtk_reserved3) (void);
  98. void (*_gtk_reserved4) (void);
  99. };
  100. #ifdef G_OS_WIN32
  101. /* Reserve old names for DLL ABI backward compatibility */
  102. #define gtk_rc_add_default_file gtk_rc_add_default_file_utf8
  103. #define gtk_rc_set_default_files gtk_rc_set_default_files_utf8
  104. #define gtk_rc_parse gtk_rc_parse_utf8
  105. #endif
  106. void _gtk_rc_init (void);
  107. GSList* _gtk_rc_parse_widget_class_path (const gchar *pattern);
  108. void _gtk_rc_free_widget_class_path (GSList *list);
  109. gboolean _gtk_rc_match_widget_class (GSList *list,
  110. gint length,
  111. gchar *path,
  112. gchar *path_reversed);
  113. void gtk_rc_add_default_file (const gchar *filename);
  114. void gtk_rc_set_default_files (gchar **filenames);
  115. gchar** gtk_rc_get_default_files (void);
  116. GtkStyle* gtk_rc_get_style (GtkWidget *widget);
  117. GtkStyle* gtk_rc_get_style_by_paths (GtkSettings *settings,
  118. const char *widget_path,
  119. const char *class_path,
  120. GType type);
  121. gboolean gtk_rc_reparse_all_for_settings (GtkSettings *settings,
  122. gboolean force_load);
  123. void gtk_rc_reset_styles (GtkSettings *settings);
  124. gchar* gtk_rc_find_pixmap_in_path (GtkSettings *settings,
  125. GScanner *scanner,
  126. const gchar *pixmap_file);
  127. void gtk_rc_parse (const gchar *filename);
  128. void gtk_rc_parse_string (const gchar *rc_string);
  129. gboolean gtk_rc_reparse_all (void);
  130. #ifndef GTK_DISABLE_DEPRECATED
  131. void gtk_rc_add_widget_name_style (GtkRcStyle *rc_style,
  132. const gchar *pattern);
  133. void gtk_rc_add_widget_class_style (GtkRcStyle *rc_style,
  134. const gchar *pattern);
  135. void gtk_rc_add_class_style (GtkRcStyle *rc_style,
  136. const gchar *pattern);
  137. #endif /* GTK_DISABLE_DEPRECATED */
  138. GType gtk_rc_style_get_type (void) G_GNUC_CONST;
  139. GtkRcStyle* gtk_rc_style_new (void);
  140. GtkRcStyle* gtk_rc_style_copy (GtkRcStyle *orig);
  141. #ifndef GTK_DISABLE_DEPRECATED
  142. void gtk_rc_style_ref (GtkRcStyle *rc_style);
  143. void gtk_rc_style_unref (GtkRcStyle *rc_style);
  144. #endif
  145. gchar* gtk_rc_find_module_in_path (const gchar *module_file);
  146. gchar* gtk_rc_get_theme_dir (void);
  147. gchar* gtk_rc_get_module_dir (void);
  148. gchar* gtk_rc_get_im_module_path (void);
  149. gchar* gtk_rc_get_im_module_file (void);
  150. /* private functions/definitions */
  151. typedef enum {
  152. GTK_RC_TOKEN_INVALID = G_TOKEN_LAST,
  153. GTK_RC_TOKEN_INCLUDE,
  154. GTK_RC_TOKEN_NORMAL,
  155. GTK_RC_TOKEN_ACTIVE,
  156. GTK_RC_TOKEN_PRELIGHT,
  157. GTK_RC_TOKEN_SELECTED,
  158. GTK_RC_TOKEN_INSENSITIVE,
  159. GTK_RC_TOKEN_FG,
  160. GTK_RC_TOKEN_BG,
  161. GTK_RC_TOKEN_TEXT,
  162. GTK_RC_TOKEN_BASE,
  163. GTK_RC_TOKEN_XTHICKNESS,
  164. GTK_RC_TOKEN_YTHICKNESS,
  165. GTK_RC_TOKEN_FONT,
  166. GTK_RC_TOKEN_FONTSET,
  167. GTK_RC_TOKEN_FONT_NAME,
  168. GTK_RC_TOKEN_BG_PIXMAP,
  169. GTK_RC_TOKEN_PIXMAP_PATH,
  170. GTK_RC_TOKEN_STYLE,
  171. GTK_RC_TOKEN_BINDING,
  172. GTK_RC_TOKEN_BIND,
  173. GTK_RC_TOKEN_WIDGET,
  174. GTK_RC_TOKEN_WIDGET_CLASS,
  175. GTK_RC_TOKEN_CLASS,
  176. GTK_RC_TOKEN_LOWEST,
  177. GTK_RC_TOKEN_GTK,
  178. GTK_RC_TOKEN_APPLICATION,
  179. GTK_RC_TOKEN_THEME,
  180. GTK_RC_TOKEN_RC,
  181. GTK_RC_TOKEN_HIGHEST,
  182. GTK_RC_TOKEN_ENGINE,
  183. GTK_RC_TOKEN_MODULE_PATH,
  184. GTK_RC_TOKEN_IM_MODULE_PATH,
  185. GTK_RC_TOKEN_IM_MODULE_FILE,
  186. GTK_RC_TOKEN_STOCK,
  187. GTK_RC_TOKEN_LTR,
  188. GTK_RC_TOKEN_RTL,
  189. GTK_RC_TOKEN_COLOR,
  190. GTK_RC_TOKEN_UNBIND,
  191. GTK_RC_TOKEN_LAST
  192. } GtkRcTokenType;
  193. GScanner* gtk_rc_scanner_new (void);
  194. guint gtk_rc_parse_color (GScanner *scanner,
  195. GdkColor *color);
  196. guint gtk_rc_parse_color_full (GScanner *scanner,
  197. GtkRcStyle *style,
  198. GdkColor *color);
  199. guint gtk_rc_parse_state (GScanner *scanner,
  200. GtkStateType *state);
  201. guint gtk_rc_parse_priority (GScanner *scanner,
  202. GtkPathPriorityType *priority);
  203. /* rc properties
  204. * (structure forward declared in gtkstyle.h)
  205. */
  206. struct _GtkRcProperty
  207. {
  208. /* quark-ified property identifier like "GtkScrollbar::spacing" */
  209. GQuark type_name;
  210. GQuark property_name;
  211. /* fields similar to GtkSettingsValue */
  212. gchar *origin;
  213. GValue value;
  214. };
  215. const GtkRcProperty* _gtk_rc_style_lookup_rc_property (GtkRcStyle *rc_style,
  216. GQuark type_name,
  217. GQuark property_name);
  218. void _gtk_rc_style_set_rc_property (GtkRcStyle *rc_style,
  219. GtkRcProperty *property);
  220. void _gtk_rc_style_unset_rc_property (GtkRcStyle *rc_style,
  221. GQuark type_name,
  222. GQuark property_name);
  223. GSList * _gtk_rc_style_get_color_hashes (GtkRcStyle *rc_style);
  224. const gchar* _gtk_rc_context_get_default_font_name (GtkSettings *settings);
  225. void _gtk_rc_context_destroy (GtkSettings *settings);
  226. G_END_DECLS
  227. #endif /* __GTK_RC_H__ */