]> Pileus Git - ~andy/gtk/blob - gtk/gtktexttypes.h
update to reflect text widget changes.
[~andy/gtk] / gtk / gtktexttypes.h
1 #ifndef GTK_TEXT_TYPES_H
2 #define GTK_TEXT_TYPES_H
3
4 #ifdef __cplusplus
5 extern "C" {
6 #endif /* __cplusplus */
7
8 #include <glib.h>
9
10 #include <gtk/gtktextbuffer.h>
11 #include <gtk/gtktexttagprivate.h>
12
13
14 typedef struct _GtkTextCounter GtkTextCounter;
15 typedef struct _GtkTextLineSegment GtkTextLineSegment;
16 typedef struct _GtkTextLineSegmentClass GtkTextLineSegmentClass;
17 typedef struct _GtkTextToggleBody GtkTextToggleBody;
18 typedef struct _GtkTextViewSearch GtkTextViewSearch;
19 typedef struct _GtkTextTab GtkTextTab;
20 typedef struct _GtkTextViewStyle GtkTextViewStyle;
21 typedef struct _GtkTextMarkBody GtkTextMarkBody;
22
23 /*
24  * Search
25  */
26
27 /*
28  * The data structure below is used for searching a B-tree for transitions
29  * on a single tag (or for all tag transitions).  No code outside of
30  * tkTextBTree.c should ever modify any of the fields in these structures,
31  * but it's OK to use them for read-only information.
32  */
33
34 struct _GtkTextViewSearch {
35   GtkTextBTree *tree;
36   
37   GtkTextIter curIndex;         /* Position of last tag transition
38                                          * returned by gtk_text_btree_next_tag, or
39                                          * index of start of segment
40                                          * containing starting position for
41                                          * search if gtk_text_btree_next_tag hasn't
42                                          * been called yet, or same as
43                                          * stopIndex if search is over. */
44
45   GtkTextLineSegment *segPtr;           /* Actual tag segment returned
46                                            by last call to
47                                            gtk_text_btree_next_tag,
48                                            or NULL if 
49                                            gtk_text_btree_next_tag
50                                            hasn't returned  anything
51                                            yet. */
52   
53   GtkTextLineSegment *lastPtr;          /* Stop search before just before
54                                          * considering this segment. */
55   GtkTextTag *tag;                      /* Tag to search for (or tag found, if
56                                          * allTags is non-zero). */
57   int linesLeft;                        /* Lines left to search (including
58                                          * curIndex and stopIndex).  When
59                                          * this becomes <= 0 the search is
60                                          * over. */
61   int allTags;                  /* Non-zero means ignore tag check:
62                                  * search for transitions on all
63                                  * tags. */
64 };
65
66 /*
67  * The following data structure describes a single tab stop.
68  */
69
70 typedef enum {
71   GTK_TEXT_TAB_LEFT,
72   GTK_TEXT_TAB_RIGHT,
73   GTK_TEXT_TAB_CENTER,
74   GTK_TEXT_TAB_NUMERIC
75 } GtkTextTabAlign;
76
77 struct _GtkTextTab {
78     int location;                       /* Offset in pixels of this tab stop
79                                          * from the left margin (lmargin2) of
80                                          * the text. */
81     GtkTextTabAlign alignment;          /* Where the tab stop appears relative
82                                          * to the text. */
83 };
84
85 struct _GtkTextTabArray {
86   guint refcount;
87   int numTabs;                  /* Number of tab stops. */
88   GtkTextTab *tabs;
89 };
90
91 GtkTextTabArray *gtk_text_view_tab_array_new   (guint             size);
92 void              gtk_text_view_tab_array_ref   (GtkTextTabArray *tab_array);
93 void              gtk_text_view_tab_array_unref (GtkTextTabArray *tab_array);
94
95 /*
96  * Declarations for variables shared among the text-related files:
97  */
98
99 /* In gtktextbtree.c */
100 extern GtkTextLineSegmentClass gtk_text_char_type;
101 extern GtkTextLineSegmentClass gtk_text_toggle_on_type;
102 extern GtkTextLineSegmentClass gtk_text_toggle_off_type;
103
104 /* In gtktextmark.c */
105 extern GtkTextLineSegmentClass gtk_text_left_mark_type;
106 extern GtkTextLineSegmentClass gtk_text_right_mark_type;
107
108 /* In gtktextchild.c */
109 extern GtkTextLineSegmentClass gtk_text_pixmap_type;
110 extern GtkTextLineSegmentClass gtk_text_view_child_type;
111
112 /*
113  * UTF 8 Stubs
114  */
115
116 extern const gunichar gtk_text_unknown_char;
117 extern const gchar gtk_text_unknown_char_utf8[];
118
119 gboolean gtk_text_byte_begins_utf8_char (const gchar *byte);
120 guint    gtk_text_utf_to_latin1_char    (const gchar *p,
121                                          guchar      *l1_ch);
122 gchar*   gtk_text_utf_to_latin1         (const gchar *p,
123                                          gint         len);
124 gchar*   gtk_text_latin1_to_utf         (const gchar *latin1,
125                                          gint         len);
126
127
128 gchar*   g_convert (const gchar *str,
129                     gint         len,
130                     const gchar *to_codeset,
131                     const gchar *from_codeset,
132                     gint        *bytes_converted);
133        
134 #ifdef __cplusplus
135 }
136 #endif /* __cplusplus */
137
138 #endif
139