]> Pileus Git - ~andy/gtk/blob - gtk/gtktexttagprivate.h
c19ddf27541f5e7b442b32b2678a6014cc2f625f
[~andy/gtk] / gtk / gtktexttagprivate.h
1 #ifndef GTK_TEXT_TAG_PRIVATE_H
2 #define GTK_TEXT_TAG_PRIVATE_H
3
4 #include <gtk/gtktexttag.h>
5
6 /* values should already have desired defaults; this function will override
7  * the defaults with settings in the given tags, which should be sorted in
8  * ascending order of priority
9 */
10 void gtk_text_style_values_fill_from_tags (GtkTextStyleValues  *values,
11                                            GtkTextTag         **tags,
12                                            guint                n_tags);
13 void gtk_text_tag_array_sort              (GtkTextTag         **tag_array_p,
14                                            guint                len);
15
16 /*
17  * Style object created by folding a set of tags together
18  */
19
20 typedef struct _GtkTextAppearance GtkTextAppearance;
21
22 struct _GtkTextAppearance
23 {
24   GdkColor bg_color;
25   GdkColor fg_color;
26   GdkBitmap *bg_stipple;
27   GdkBitmap *fg_stipple;
28
29   guint underline : 4;          /* PangoUnderline */
30   guint overstrike : 1;
31
32   /* Whether to use background-related values; this is irrelevant for
33    * the values struct when in a tag, but is used for the composite
34    * values struct; it's true if any of the tags being composited
35    * had background stuff set. */
36   guint draw_bg : 1;
37
38   /* This is only used when we are actually laying out and rendering
39    * a paragraph; not when a GtkTextAppearance is part of a
40    * GtkTextStyleValues.
41    */
42   guint inside_selection : 1;
43 };
44
45 struct _GtkTextStyleValues
46 {
47   guint refcount;
48
49   GtkTextAppearance appearance;
50   
51   gint border_width;
52   GtkShadowType relief;
53   GtkJustification justify;
54   GtkTextDirection direction;
55   
56   PangoFontDescription *font_desc;
57   
58   /* lMargin1 */
59   gint left_margin;
60   
61   /* lMargin2 */
62   gint left_wrapped_line_margin;
63
64   /* super/subscript offset, can be negative */
65   gint offset;
66   
67   gint right_margin;
68
69   gint pixels_above_lines;
70
71   gint pixels_below_lines;
72
73   gint pixels_inside_wrap;
74
75   GtkTextTabArray *tab_array;
76   
77   GtkWrapMode wrap_mode;        /* How to handle wrap-around for this tag.
78                                  * Must be GTK_WRAPMODE_CHAR,
79                                  * GTK_WRAPMODE_NONE, GTK_WRAPMODE_WORD
80                                  */
81
82   gchar *language;
83   
84   /* hide the text  */
85   guint elide : 1;
86
87   /* Background is fit to full line height rather than
88    * baseline +/- ascent/descent (font height) */
89   guint bg_full_height : 1;
90   
91   /* can edit this text */
92   guint editable : 1;
93
94   /* colors are allocated etc. */
95   guint realized : 1;
96
97   guint pad1 : 1;
98   guint pad2 : 1;
99   guint pad3 : 1;
100   guint pad4 : 1;
101 };
102
103 GtkTextStyleValues *gtk_text_style_values_new       (void);
104 void                gtk_text_style_values_copy      (GtkTextStyleValues *src,
105                                                      GtkTextStyleValues *dest);
106 void                gtk_text_style_values_unref     (GtkTextStyleValues *values);
107 void                gtk_text_style_values_ref       (GtkTextStyleValues *values);
108
109 /* ensure colors are allocated, etc. for drawing */
110 void                gtk_text_style_values_realize   (GtkTextStyleValues *values,
111                                                      GdkColormap        *cmap,
112                                                      GdkVisual          *visual);
113
114 /* free the stuff again */
115 void                gtk_text_style_values_unrealize (GtkTextStyleValues *values,
116                                                      GdkColormap        *cmap,
117                                                      GdkVisual          *visual);
118
119 #endif