1 /* 2 ** 1998-08-11 - Header for the styles module. Surprise. 3 */ 4 5 #if !defined STYLES_H 6 #define STYLES_H 7 8 #include "xmlutil.h" 9 10 /* Maximum number of guaranteed unique style name characters, plus 1. */ 11 #define STL_STYLE_NAME_SIZE (32) 12 #define STL_PROPERTY_NAME_SIZE (32) 13 14 /* A string of characters NOT legal in style names. Not enforced by style module, 15 ** but recommended nevertheless. 16 */ 17 #define STL_STYLE_NAME_REJECT "\t\n\\,.;:!\"#$�%&/()=+*/<>[]{}'�~^" 18 19 typedef struct StyleInfo StyleInfo; 20 typedef struct Style Style; 21 22 /* A couple of standard property names. Has no real importance, but useful to minimize 23 ** pain in going from the old hard-coded vector-based system to the new hash-based one. 24 */ 25 #define SPN_COL_UNSEL_BG "uBG" 26 #define SPN_COL_UNSEL_FG "uFG" 27 #define SPN_ICON_UNSEL "uIcon" 28 #define SPN_ACTN_DEFAULT "Default" 29 #define SPN_ACTN_VIEW "View" 30 #define SPN_ACTN_EDIT "Edit" 31 #define SPN_ACTN_PRINT "Print" 32 #define SPN_ACTN_PLAY "Play" 33 34 /* ----------------------------------------------------------------------------------------- */ 35 36 StyleInfo * stl_styleinfo_new(void); 37 StyleInfo * stl_styleinfo_default(void); 38 StyleInfo * stl_styleinfo_copy(StyleInfo *si); 39 void stl_styleinfo_destroy(StyleInfo *si); 40 GtkTreeStore * stl_styleinfo_build_partial(const StyleInfo *si, const Style *ignore); 41 42 Style * stl_styleinfo_get_style_iter(const StyleInfo *si, GtkTreeStore *store, GtkTreeIter *iter); 43 gboolean stl_styleinfo_tree_find_style(const StyleInfo *si, GtkTreeStore *store, const Style *style, GtkTreeIter *iter); 44 void stl_styleinfo_set_name_iter(const StyleInfo *si, GtkTreeStore *store, GtkTreeIter *iter, const gchar *name); 45 46 void stl_styleinfo_freeze(StyleInfo *si); 47 void stl_styleinfo_thaw(StyleInfo *si); 48 49 void stl_styleinfo_dump(StyleInfo *si); 50 51 void stl_styleinfo_style_add(StyleInfo *si, Style *parent, Style *stl); 52 void stl_styleinfo_style_remove(StyleInfo *si, Style *stl); 53 Style * stl_styleinfo_style_find(const StyleInfo *si, const gchar *name); 54 Style * stl_styleinfo_style_get_parent(StyleInfo *si, Style *stl); 55 void stl_styleinfo_style_set_parent(StyleInfo *si, Style *stl, Style *new_parent); 56 Style * stl_styleinfo_style_get_parent(StyleInfo *si, Style *stl); 57 58 gboolean stl_styleinfo_style_siblings(StyleInfo *si, Style *stla, Style *stlb); 59 60 Style * stl_styleinfo_style_root(const StyleInfo *si); 61 gboolean stl_styleinfo_style_has_children(StyleInfo *si, Style *stl); 62 GList * stl_styleinfo_style_get_children(StyleInfo *si, Style *stl, gboolean include_root); 63 64 void stl_styleinfo_save(MainInfo *min, StyleInfo *si, FILE *out, const gchar *tag); 65 StyleInfo * stl_styleinfo_load(const XmlNode *node); 66 67 Style * stl_style_new(const gchar *name); 68 Style * stl_style_new_unique_name(StyleInfo *si); 69 Style * stl_style_copy(Style *stl); 70 Style * stl_style_get(GtkWidget *wid); 71 72 void stl_style_set_expand(Style *stl, gboolean expand); 73 gboolean stl_style_get_expand(Style *stl); 74 75 void stl_style_set_name(Style *stl, const gchar *name); 76 void stl_style_set_name_widget(GtkWidget *wid, const gchar *name); 77 const gchar * stl_style_get_name(Style *stl); 78 GString * stl_style_get_name_full(Style *stl); 79 80 gint stl_style_compare_hierarchy(const Style *stla, const Style *stlb); 81 82 /* Setting a non-existent property adds it to the style. Setting a property with 83 ** the wrong kind of value will not do anything, but is stupid, so don't do that. 84 ** The way to change a property's type is to first remove it, then set it again. 85 */ 86 void stl_style_property_set_color(Style *stl, const gchar *property, const GdkColor *value); 87 void stl_style_property_set_color_rgb(Style *stl, const gchar *property, guint16 red, guint16 green, guint16 blue); 88 void stl_style_property_set_icon(Style *stl, const gchar *property, const gchar *value); 89 void stl_style_property_set_action(Style *stl, const gchar *property, const gchar *value); 90 const GdkColor* stl_style_property_get_color(const Style *stl, const gchar *property); 91 const gchar * stl_style_property_get_icon(const Style *stl, const gchar *property); 92 const gchar * stl_style_property_get_action(const Style *stl, const gchar *property); 93 gboolean stl_style_property_get_override(const Style *stl, const gchar *property); 94 GList * stl_style_property_get_actions(const Style *stl); 95 gboolean stl_style_property_has_action(const Style *stl, const gchar *action); 96 97 gboolean stl_style_property_overrides(Style *stl); 98 gboolean stl_style_property_is_unique(Style *stl, const gchar *property); 99 gboolean stl_style_property_rename(Style *stl, const gchar *property, const gchar *new_name); 100 void stl_style_property_remove(Style *stl, const gchar *property); 101 102 void stl_style_destroy(Style *stl, gboolean unlink); 103 104 #endif /* STYLES_H */ 105