comparison finch/libgnt/gnttextview.h @ 21161:e119edfc0fb0

applied changes from 172a59b41412c4630834d66f2e7ec3be970cc36b through 365b126365cc18309aea7f8eef0e9b2a19e6bda8 And others.
author Sadrul Habib Chowdhury <imadil@gmail.com>
date Wed, 07 Nov 2007 14:07:52 +0000
parents bddf964880cf
children
comparison
equal deleted inserted replaced
21160:45e550db32ab 21161:e119edfc0fb0
86 }; 86 };
87 87
88 G_BEGIN_DECLS 88 G_BEGIN_DECLS
89 89
90 /** 90 /**
91 * 91 * @return GType for GntTextView.
92 *
93 * @return
94 */ 92 */
95 GType gnt_text_view_get_gtype(void); 93 GType gnt_text_view_get_gtype(void);
96 94
97 /* XXX: For now, don't set a textview to have any border. 95 /**
98 * If you want borders real bad, put it in a box. */ 96 * Create a new textview.
99 /** 97 *
100 * 98 * @return The newly created textview.
101 *
102 * @return
103 */ 99 */
104 GntWidget * gnt_text_view_new(void); 100 GntWidget * gnt_text_view_new(void);
105 101
106 /* scroll > 0 means scroll up, < 0 means scroll down, == 0 means scroll to the end */ 102 /**
107 /** 103 * Scroll the textview.
108 * 104 * @param view The textview to scroll.
109 * @param view 105 * @param scroll scroll > 0 means scroll up, < 0 means scroll down, == 0 means scroll to the end.
110 * @param scroll
111 */ 106 */
112 void gnt_text_view_scroll(GntTextView *view, int scroll); 107 void gnt_text_view_scroll(GntTextView *view, int scroll);
113 108
114 /** 109 /**
115 * 110 * Append new text in a textview.
116 * @param view 111 *
117 * @param text 112 * @param view The textview.
118 * @param flags 113 * @param text The text to append to the textview.
114 * @param flags The text-flags to apply to the new text.
119 */ 115 */
120 void gnt_text_view_append_text_with_flags(GntTextView *view, const char *text, GntTextFormatFlags flags); 116 void gnt_text_view_append_text_with_flags(GntTextView *view, const char *text, GntTextFormatFlags flags);
121 117
122 /** 118 /**
123 * 119 * Append text in the textview, with some identifier (tag) for the added text.
124 * @param view 120 *
125 * @param text 121 * @param view The textview.
126 * @param flags 122 * @param text The text to append.
127 * @param tag 123 * @param flags The text-flags to apply to the new text.
124 * @param tag The tag for the appended text, so it can be changed later (@see gnt_text_view_tag_change)
128 */ 125 */
129 void gnt_text_view_append_text_with_tag(GntTextView *view, const char *text, GntTextFormatFlags flags, const char *tag); 126 void gnt_text_view_append_text_with_tag(GntTextView *view, const char *text, GntTextFormatFlags flags, const char *tag);
130 127
131 /* Move the cursor to the beginning of the next line and resets text-attributes. 128 /**
132 * It first completes the current line with the current text-attributes. */ 129 * Move the cursor to the beginning of the next line and resets text-attributes.
133 /** 130 * It first completes the current line with the current text-attributes.
134 * 131 *
135 * @param view 132 * @param view The textview.
136 */ 133 */
137 void gnt_text_view_next_line(GntTextView *view); 134 void gnt_text_view_next_line(GntTextView *view);
138 135
139 /** 136 /**
140 * 137 * Convert GNT-text formats to ncurses-text attributes.
141 * @param flags 138 *
142 * 139 * @param flags The GNT text format.
143 * @return 140 *
141 * @return Nucrses text attribute.
144 */ 142 */
145 chtype gnt_text_format_flag_to_chtype(GntTextFormatFlags flags); 143 chtype gnt_text_format_flag_to_chtype(GntTextFormatFlags flags);
146 144
147 /** 145 /**
148 * 146 * Clear the contents of the textview.
149 * @param view 147 *
148 * @param view The textview.
150 */ 149 */
151 void gnt_text_view_clear(GntTextView *view); 150 void gnt_text_view_clear(GntTextView *view);
152 151
153 /** 152 /**
154 * 153 * The number of lines below the bottom-most visible line.
155 * @param view 154 *
156 * 155 * @param view The textview.
157 * @return 156 *
157 * @return Number of lines below the bottom-most visible line.
158 */ 158 */
159 int gnt_text_view_get_lines_below(GntTextView *view); 159 int gnt_text_view_get_lines_below(GntTextView *view);
160 160
161 /** 161 /**
162 * 162 * The number of lines above the topmost visible line.
163 * @param view 163 *
164 * 164 * @param view The textview.
165 * @return 165 *
166 * @return Number of lines above the topmost visible line.
166 */ 167 */
167 int gnt_text_view_get_lines_above(GntTextView *view); 168 int gnt_text_view_get_lines_above(GntTextView *view);
168 169
169 /* If text is NULL, then the tag is removed. */ 170 /**
170 /** 171 * Change the text of a tag.
171 * 172 *
172 * @param view 173 * @param view The textview.
173 * @param name 174 * @param name The name of the tag.
174 * @param text 175 * @param text The new text for the text. If 'text' is @c NULL, the tag is removed.
175 * @param all 176 * @param all @c TRUE if all of the instancess of the tag should be changed, @c FALSE if
176 * 177 * only the first instance should be changed.
177 * @return 178 *
179 * @return The number of instances changed.
178 */ 180 */
179 int gnt_text_view_tag_change(GntTextView *view, const char *name, const char *text, gboolean all); 181 int gnt_text_view_tag_change(GntTextView *view, const char *name, const char *text, gboolean all);
180 182
181 /** 183 /**
182 * 184 * Setup hooks so that pressing up/down/page-up/page-down keys when 'widget' is
183 * @param view 185 * in focus scrolls the textview.
184 * @param widget 186 *
187 * @param view The textview.
188 * @param widget The trigger widget.
185 */ 189 */
186 void gnt_text_view_attach_scroll_widget(GntTextView *view, GntWidget *widget); 190 void gnt_text_view_attach_scroll_widget(GntTextView *view, GntWidget *widget);
187 191
188 /** 192 /**
189 * 193 * Setup appropriate hooks so that pressing some keys when the 'pager' widget
190 * @param view 194 * is in focus triggers the PAGER to popup with the contents of the textview
191 * @param widget 195 * in it.
196 *
197 * The default key-combination to trigger the pager is a-v, and the default
198 * PAGER application is $PAGER. Both can be changed in ~/.gntrc like this:
199 *
200 * @code
201 * [pager]
202 * key = a-v
203 * path = /path/to/pager
204 * @endcode
205 *
206 * @param view The textview.
207 * @param pager The widget to trigger the PAGER.
192 */ 208 */
193 void gnt_text_view_attach_pager_widget(GntTextView *view, GntWidget *pager); 209 void gnt_text_view_attach_pager_widget(GntTextView *view, GntWidget *pager);
194 210
195 /** 211 /**
196 * 212 * Setup appropriate hooks so that pressing some keys when 'widget'
197 * @param view 213 * is in focus triggers the EDITOR to popup with the contents of the textview
198 * @param widget 214 * in it.
199 */ 215 *
200 void gnt_text_view_attach_editor_widget(GntTextView *view, GntWidget *pager); 216 * The default key-combination to trigger the pager is a-e, and the default
217 * EDITOR application is $EDITOR. Both can be changed in ~/.gntrc like this:
218 *
219 * @code
220 * [editor]
221 * key = a-e
222 * path = /path/to/editor
223 * @endcode
224 *
225 * @param view The textview.
226 * @param widget The widget to trigger the EDITOR.
227 */
228 void gnt_text_view_attach_editor_widget(GntTextView *view, GntWidget *widget);
201 229
202 /** 230 /**
203 * Set a GntTextViewFlag for the textview widget. 231 * Set a GntTextViewFlag for the textview widget.
204 * 232 *
205 * @param view The textview widget 233 * @param view The textview widget