]> Pileus Git - ~andy/gtk/blob - gtk/gtktextattributes.h
stylecontext: Do invalidation on first resize container
[~andy/gtk] / gtk / gtktextattributes.h
1 /* gtktexttag.c - text tag object
2  *
3  * Copyright (c) 1992-1994 The Regents of the University of California.
4  * Copyright (c) 1994-1997 Sun Microsystems, Inc.
5  * Copyright (c) 2000      Red Hat, Inc.
6  * Tk -> Gtk port by Havoc Pennington <hp@redhat.com>
7  *
8  * This software is copyrighted by the Regents of the University of
9  * California, Sun Microsystems, Inc., and other parties.  The
10  * following terms apply to all files associated with the software
11  * unless explicitly disclaimed in individual files.
12  *
13  * The authors hereby grant permission to use, copy, modify,
14  * distribute, and license this software and its documentation for any
15  * purpose, provided that existing copyright notices are retained in
16  * all copies and that this notice is included verbatim in any
17  * distributions. No written agreement, license, or royalty fee is
18  * required for any of the authorized uses.  Modifications to this
19  * software may be copyrighted by their authors and need not follow
20  * the licensing terms described here, provided that the new terms are
21  * clearly indicated on the first page of each file where they apply.
22  *
23  * IN NO EVENT SHALL THE AUTHORS OR DISTRIBUTORS BE LIABLE TO ANY
24  * PARTY FOR DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL
25  * DAMAGES ARISING OUT OF THE USE OF THIS SOFTWARE, ITS DOCUMENTATION,
26  * OR ANY DERIVATIVES THEREOF, EVEN IF THE AUTHORS HAVE BEEN ADVISED
27  * OF THE POSSIBILITY OF SUCH DAMAGE.
28  *
29  * THE AUTHORS AND DISTRIBUTORS SPECIFICALLY DISCLAIM ANY WARRANTIES,
30  * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
31  * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, AND
32  * NON-INFRINGEMENT.  THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS,
33  * AND THE AUTHORS AND DISTRIBUTORS HAVE NO OBLIGATION TO PROVIDE
34  * MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
35  *
36  * GOVERNMENT USE: If you are acquiring this software on behalf of the
37  * U.S. government, the Government shall have only "Restricted Rights"
38  * in the software and related documentation as defined in the Federal
39  * Acquisition Regulations (FARs) in Clause 52.227.19 (c) (2).  If you
40  * are acquiring the software on behalf of the Department of Defense,
41  * the software shall be classified as "Commercial Computer Software"
42  * and the Government shall have only "Restricted Rights" as defined
43  * in Clause 252.227-7013 (c) (1) of DFARs.  Notwithstanding the
44  * foregoing, the authors grant the U.S. Government and others acting
45  * in its behalf permission to use and distribute the software in
46  * accordance with the terms specified in this license.
47  *
48  */
49
50 #ifndef __GTK_TEXT_ATTRIBUTES_H__
51 #define __GTK_TEXT_ATTRIBUTES_H__
52
53
54 #if !defined (__GTK_H_INSIDE__) && !defined (GTK_COMPILATION)
55 #error "Only <gtk/gtk.h> can be included directly."
56 #endif
57
58 #include <gdk/gdk.h>
59 #include <gtk/gtkenums.h>
60
61
62 G_BEGIN_DECLS
63
64 typedef struct _GtkTextAttributes GtkTextAttributes;
65
66 #define GTK_TYPE_TEXT_ATTRIBUTES     (gtk_text_attributes_get_type ())
67
68 typedef struct _GtkTextAppearance GtkTextAppearance;
69
70 /**
71  * GtkTextAttributes:
72  *
73  * Using #GtkTextAttributes directly should rarely be necessary.
74  * It's primarily useful with gtk_text_iter_get_attributes().
75  * As with most GTK+ structs, the fields in this struct should only
76  * be read, never modified directly.
77  */
78 struct _GtkTextAppearance
79 {
80   /*< public >*/
81   GdkColor bg_color;
82   GdkColor fg_color;
83
84   /* super/subscript rise, can be negative */
85   gint rise;
86
87   /*< public >*/
88   guint underline : 4;          /* PangoUnderline */
89   guint strikethrough : 1;
90
91   /* Whether to use background-related values; this is irrelevant for
92    * the values struct when in a tag, but is used for the composite
93    * values struct; it's true if any of the tags being composited
94    * had background stuff set.
95    */
96   guint draw_bg : 1;
97
98   /* These are only used when we are actually laying out and rendering
99    * a paragraph; not when a GtkTextAppearance is part of a
100    * GtkTextAttributes.
101    */
102   guint inside_selection : 1;
103   guint is_text : 1;
104
105   GdkRGBA *rgba[2];
106
107 #if (defined(__SIZEOF_INT__) && defined(__SIZEOF_POINTER__)) && (__SIZEOF_INT__ == __SIZEOF_POINTER__)
108   /* unusable, just for ABI compat */
109   guint padding[2];
110 #endif
111 };
112
113 struct _GtkTextAttributes
114 {
115   /*< private >*/
116   guint refcount;
117
118   /*< public >*/
119   GtkTextAppearance appearance;
120
121   GtkJustification justification;
122   GtkTextDirection direction;
123
124   /* Individual chunks of this can be set/unset as a group */
125   PangoFontDescription *font;
126
127   gdouble font_scale;
128
129   gint left_margin;
130   gint right_margin;
131   gint indent;
132
133   gint pixels_above_lines;
134   gint pixels_below_lines;
135   gint pixels_inside_wrap;
136
137   PangoTabArray *tabs;
138
139   GtkWrapMode wrap_mode;        /* How to handle wrap-around for this tag.
140                                  * Must be GTK_WRAPMODE_CHAR,
141                                  * GTK_WRAPMODE_NONE, GTK_WRAPMODE_WORD
142                                  */
143
144   PangoLanguage *language;
145
146   /*< private >*/
147   GdkColor *pg_bg_color;
148
149   /*< public >*/
150   /* hide the text  */
151   guint invisible : 1;
152
153   /* Background is fit to full line height rather than
154    * baseline +/- ascent/descent (font height)
155    */
156   guint bg_full_height : 1;
157
158   /* can edit this text */
159   guint editable : 1;
160
161   /*< private >*/
162   GdkRGBA *pg_bg_rgba;
163
164   guint padding[3];
165 };
166
167 GtkTextAttributes* gtk_text_attributes_new         (void);
168 GtkTextAttributes* gtk_text_attributes_copy        (GtkTextAttributes *src);
169 void               gtk_text_attributes_copy_values (GtkTextAttributes *src,
170                                                     GtkTextAttributes *dest);
171 void               gtk_text_attributes_unref       (GtkTextAttributes *values);
172 GtkTextAttributes *gtk_text_attributes_ref         (GtkTextAttributes *values);
173
174 GType              gtk_text_attributes_get_type    (void) G_GNUC_CONST;
175
176
177 G_END_DECLS
178
179 #endif
180