Você não pode selecionar mais de 25 tópicos Os tópicos devem começar com uma letra ou um número, podem incluir traços ('-') e podem ter até 35 caracteres.
 
 
 
 
 
 

140 linhas
4.9 KiB

  1. /* GTK - The GIMP Toolkit
  2. * Copyright (C) 2000 Red Hat, Inc.
  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 Free
  16. * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  17. */
  18. #if defined(GTK_DISABLE_SINGLE_INCLUDES) && !defined (__GTK_H_INSIDE__) && !defined (GTK_COMPILATION)
  19. #error "Only <gtk/gtk.h> can be included directly."
  20. #endif
  21. #ifndef __GTK_SETTINGS_H__
  22. #define __GTK_SETTINGS_H__
  23. #include <gtk/gtkrc.h>
  24. G_BEGIN_DECLS
  25. /* -- type macros --- */
  26. #define GTK_TYPE_SETTINGS (gtk_settings_get_type ())
  27. #define GTK_SETTINGS(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GTK_TYPE_SETTINGS, GtkSettings))
  28. #define GTK_SETTINGS_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GTK_TYPE_SETTINGS, GtkSettingsClass))
  29. #define GTK_IS_SETTINGS(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GTK_TYPE_SETTINGS))
  30. #define GTK_IS_SETTINGS_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GTK_TYPE_SETTINGS))
  31. #define GTK_SETTINGS_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GTK_TYPE_SETTINGS, GtkSettingsClass))
  32. /* --- typedefs --- */
  33. typedef struct _GtkSettingsClass GtkSettingsClass;
  34. typedef struct _GtkSettingsValue GtkSettingsValue;
  35. typedef struct _GtkSettingsPropertyValue GtkSettingsPropertyValue; /* Internal */
  36. /* --- structures --- */
  37. struct _GtkSettings
  38. {
  39. GObject parent_instance;
  40. GData *GSEAL (queued_settings); /* of type GtkSettingsValue* */
  41. GtkSettingsPropertyValue *GSEAL (property_values);
  42. GtkRcContext *GSEAL (rc_context);
  43. GdkScreen *GSEAL (screen);
  44. };
  45. struct _GtkSettingsClass
  46. {
  47. GObjectClass parent_class;
  48. };
  49. struct _GtkSettingsValue
  50. {
  51. /* origin should be something like "filename:linenumber" for rc files,
  52. * or e.g. "XProperty" for other sources
  53. */
  54. gchar *origin;
  55. /* valid types are LONG, DOUBLE and STRING corresponding to the token parsed,
  56. * or a GSTRING holding an unparsed statement
  57. */
  58. GValue value;
  59. };
  60. /* --- functions --- */
  61. GType gtk_settings_get_type (void) G_GNUC_CONST;
  62. #ifndef GDK_MULTIHEAD_SAFE
  63. GtkSettings* gtk_settings_get_default (void);
  64. #endif
  65. GtkSettings* gtk_settings_get_for_screen (GdkScreen *screen);
  66. void gtk_settings_install_property (GParamSpec *pspec);
  67. void gtk_settings_install_property_parser (GParamSpec *pspec,
  68. GtkRcPropertyParser parser);
  69. /* --- precoded parsing functions --- */
  70. gboolean gtk_rc_property_parse_color (const GParamSpec *pspec,
  71. const GString *gstring,
  72. GValue *property_value);
  73. gboolean gtk_rc_property_parse_enum (const GParamSpec *pspec,
  74. const GString *gstring,
  75. GValue *property_value);
  76. gboolean gtk_rc_property_parse_flags (const GParamSpec *pspec,
  77. const GString *gstring,
  78. GValue *property_value);
  79. gboolean gtk_rc_property_parse_requisition (const GParamSpec *pspec,
  80. const GString *gstring,
  81. GValue *property_value);
  82. gboolean gtk_rc_property_parse_border (const GParamSpec *pspec,
  83. const GString *gstring,
  84. GValue *property_value);
  85. /*< private >*/
  86. void gtk_settings_set_property_value (GtkSettings *settings,
  87. const gchar *name,
  88. const GtkSettingsValue *svalue);
  89. void gtk_settings_set_string_property (GtkSettings *settings,
  90. const gchar *name,
  91. const gchar *v_string,
  92. const gchar *origin);
  93. void gtk_settings_set_long_property (GtkSettings *settings,
  94. const gchar *name,
  95. glong v_long,
  96. const gchar *origin);
  97. void gtk_settings_set_double_property (GtkSettings *settings,
  98. const gchar *name,
  99. gdouble v_double,
  100. const gchar *origin);
  101. /* implementation details */
  102. void _gtk_settings_set_property_value_from_rc (GtkSettings *settings,
  103. const gchar *name,
  104. const GtkSettingsValue *svalue);
  105. void _gtk_settings_reset_rc_values (GtkSettings *settings);
  106. void _gtk_settings_handle_event (GdkEventSetting *event);
  107. GtkRcPropertyParser _gtk_rc_property_parser_from_type (GType type);
  108. gboolean _gtk_settings_parse_convert (GtkRcPropertyParser parser,
  109. const GValue *src_value,
  110. GParamSpec *pspec,
  111. GValue *dest_value);
  112. G_END_DECLS
  113. #endif /* __GTK_SETTINGS_H__ */