CoreGTK 3.22.0 CoreGTK is an Objective-C language binding for the GTK+ widget toolkit

CGTKTextView.m
1 /*
2 * CGTKTextView.m
3 * This file is part of CoreGTK
4 *
5 * Copyright (C) 2017 - Tyler Burton
6 *
7 * This library is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU Lesser General Public
9 * License as published by the Free Software Foundation; either
10 * version 2.1 of the License, or (at your option) any later version.
11 *
12 * This library is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 * Lesser General Public License for more details.
16 *
17 * You should have received a copy of the GNU Lesser General Public
18 * License along with this library; if not, write to the Free Software
19 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
20 */
21
22 /*
23 * Modified by the CoreGTK Team, 2017. See the AUTHORS file for a
24 * list of people on the CoreGTK Team.
25 * See the ChangeLog files for a list of changes.
26 *
27 */
28
29 /*
30 * Objective-C imports
31 */
32 #import "CoreGTK/CGTKTextView.h"
33
34 @implementation CGTKTextView
35
36 -(id)init
37 {
38 self = [super initWithGObject:(GObject *)gtk_text_view_new()];
39
40 if(self)
41 {
42 //Do nothing
43 }
44
45 return self;
46 }
47
48 -(id)initWithBuffer:(GtkTextBuffer*) buffer
49 {
50 self = [super initWithGObject:(GObject *)gtk_text_view_new_with_buffer(buffer)];
51
52 if(self)
53 {
54 //Do nothing
55 }
56
57 return self;
58 }
59
60 -(GtkTextView*)TEXTVIEW
61 {
62 return GTK_TEXT_VIEW([self GOBJECT]);
63 }
64
65 -(void)addChildAtAnchorWithChild:(CGTKWidget*) child andAnchor:(GtkTextChildAnchor*) anchor
66 {
67 gtk_text_view_add_child_at_anchor(GTK_TEXT_VIEW([self GOBJECT]), [child WIDGET], anchor);
68 }
69
70 -(void)addChildInWindowWithChild:(CGTKWidget*) child andWhichWindow:(GtkTextWindowType) whichWindow andXpos:(gint) xpos andYpos:(gint) ypos
71 {
72 gtk_text_view_add_child_in_window(GTK_TEXT_VIEW([self GOBJECT]), [child WIDGET], whichWindow, xpos, ypos);
73 }
74
75 -(BOOL)backwardDisplayLine:(GtkTextIter*) iter
76 {
77 return (gtk_text_view_backward_display_line(GTK_TEXT_VIEW([self GOBJECT]), iter) ? YES : NO);
78 }
79
80 -(BOOL)backwardDisplayLineStart:(GtkTextIter*) iter
81 {
82 return (gtk_text_view_backward_display_line_start(GTK_TEXT_VIEW([self GOBJECT]), iter) ? YES : NO);
83 }
84
85 -(void)bufferToWindowCoordsWithWin:(GtkTextWindowType) win andBufferX:(gint) bufferX andBufferY:(gint) bufferY andWindowX:(gint*) windowX andWindowY:(gint*) windowY
86 {
87 gtk_text_view_buffer_to_window_coords(GTK_TEXT_VIEW([self GOBJECT]), win, bufferX, bufferY, windowX, windowY);
88 }
89
90 -(BOOL)forwardDisplayLine:(GtkTextIter*) iter
91 {
92 return (gtk_text_view_forward_display_line(GTK_TEXT_VIEW([self GOBJECT]), iter) ? YES : NO);
93 }
94
95 -(BOOL)forwardDisplayLineEnd:(GtkTextIter*) iter
96 {
97 return (gtk_text_view_forward_display_line_end(GTK_TEXT_VIEW([self GOBJECT]), iter) ? YES : NO);
98 }
99
100 -(BOOL)getAcceptsTab
101 {
102 return (gtk_text_view_get_accepts_tab(GTK_TEXT_VIEW([self GOBJECT])) ? YES : NO);
103 }
104
105 -(gint)getBorderWindowSize:(GtkTextWindowType) type
106 {
107 return gtk_text_view_get_border_window_size(GTK_TEXT_VIEW([self GOBJECT]), type);
108 }
109
110 -(gint)getBottomMargin
111 {
112 return gtk_text_view_get_bottom_margin(GTK_TEXT_VIEW([self GOBJECT]));
113 }
114
115 -(GtkTextBuffer*)getBuffer
116 {
117 return gtk_text_view_get_buffer(GTK_TEXT_VIEW([self GOBJECT]));
118 }
119
120 -(void)getCursorLocationsWithIter:(const GtkTextIter*) iter andStrong:(GdkRectangle*) strong andWeak:(GdkRectangle*) weak
121 {
122 gtk_text_view_get_cursor_locations(GTK_TEXT_VIEW([self GOBJECT]), iter, strong, weak);
123 }
124
125 -(BOOL)getCursorVisible
126 {
127 return (gtk_text_view_get_cursor_visible(GTK_TEXT_VIEW([self GOBJECT])) ? YES : NO);
128 }
129
130 -(GtkTextAttributes*)getDefaultAttributes
131 {
132 return gtk_text_view_get_default_attributes(GTK_TEXT_VIEW([self GOBJECT]));
133 }
134
135 -(BOOL)getEditable
136 {
137 return (gtk_text_view_get_editable(GTK_TEXT_VIEW([self GOBJECT])) ? YES : NO);
138 }
139
140 -(GtkAdjustment*)getHadjustment
141 {
142 return gtk_text_view_get_hadjustment(GTK_TEXT_VIEW([self GOBJECT]));
143 }
144
145 -(gint)getIndent
146 {
147 return gtk_text_view_get_indent(GTK_TEXT_VIEW([self GOBJECT]));
148 }
149
150 -(GtkInputHints)getInputHints
151 {
152 return gtk_text_view_get_input_hints(GTK_TEXT_VIEW([self GOBJECT]));
153 }
154
155 -(GtkInputPurpose)getInputPurpose
156 {
157 return gtk_text_view_get_input_purpose(GTK_TEXT_VIEW([self GOBJECT]));
158 }
159
160 -(BOOL)getIterAtLocationWithIter:(GtkTextIter*) iter andX:(gint) x andY:(gint) y
161 {
162 return (gtk_text_view_get_iter_at_location(GTK_TEXT_VIEW([self GOBJECT]), iter, x, y) ? YES : NO);
163 }
164
165 -(BOOL)getIterAtPositionWithIter:(GtkTextIter*) iter andTrailing:(gint*) trailing andX:(gint) x andY:(gint) y
166 {
167 return (gtk_text_view_get_iter_at_position(GTK_TEXT_VIEW([self GOBJECT]), iter, trailing, x, y) ? YES : NO);
168 }
169
170 -(void)getIterLocationWithIter:(const GtkTextIter*) iter andLocation:(GdkRectangle*) location
171 {
172 gtk_text_view_get_iter_location(GTK_TEXT_VIEW([self GOBJECT]), iter, location);
173 }
174
175 -(GtkJustification)getJustification
176 {
177 return gtk_text_view_get_justification(GTK_TEXT_VIEW([self GOBJECT]));
178 }
179
180 -(gint)getLeftMargin
181 {
182 return gtk_text_view_get_left_margin(GTK_TEXT_VIEW([self GOBJECT]));
183 }
184
185 -(void)getLineAtYWithTargetIter:(GtkTextIter*) targetIter andY:(gint) y andLineTop:(gint*) lineTop
186 {
187 gtk_text_view_get_line_at_y(GTK_TEXT_VIEW([self GOBJECT]), targetIter, y, lineTop);
188 }
189
190 -(void)getLineYrangeWithIter:(const GtkTextIter*) iter andY:(gint*) y andHeight:(gint*) height
191 {
192 gtk_text_view_get_line_yrange(GTK_TEXT_VIEW([self GOBJECT]), iter, y, height);
193 }
194
195 -(BOOL)getMonospace
196 {
197 return (gtk_text_view_get_monospace(GTK_TEXT_VIEW([self GOBJECT])) ? YES : NO);
198 }
199
200 -(BOOL)getOverwrite
201 {
202 return (gtk_text_view_get_overwrite(GTK_TEXT_VIEW([self GOBJECT])) ? YES : NO);
203 }
204
205 -(gint)getPixelsAboveLines
206 {
207 return gtk_text_view_get_pixels_above_lines(GTK_TEXT_VIEW([self GOBJECT]));
208 }
209
210 -(gint)getPixelsBelowLines
211 {
212 return gtk_text_view_get_pixels_below_lines(GTK_TEXT_VIEW([self GOBJECT]));
213 }
214
215 -(gint)getPixelsInsideWrap
216 {
217 return gtk_text_view_get_pixels_inside_wrap(GTK_TEXT_VIEW([self GOBJECT]));
218 }
219
220 -(gint)getRightMargin
221 {
222 return gtk_text_view_get_right_margin(GTK_TEXT_VIEW([self GOBJECT]));
223 }
224
225 -(PangoTabArray*)getTabs
226 {
227 return gtk_text_view_get_tabs(GTK_TEXT_VIEW([self GOBJECT]));
228 }
229
230 -(gint)getTopMargin
231 {
232 return gtk_text_view_get_top_margin(GTK_TEXT_VIEW([self GOBJECT]));
233 }
234
235 -(GtkAdjustment*)getVadjustment
236 {
237 return gtk_text_view_get_vadjustment(GTK_TEXT_VIEW([self GOBJECT]));
238 }
239
240 -(void)getVisibleRect:(GdkRectangle*) visibleRect
241 {
242 gtk_text_view_get_visible_rect(GTK_TEXT_VIEW([self GOBJECT]), visibleRect);
243 }
244
245 -(GdkWindow*)getWindow:(GtkTextWindowType) win
246 {
247 return gtk_text_view_get_window(GTK_TEXT_VIEW([self GOBJECT]), win);
248 }
249
250 -(GtkTextWindowType)getWindowType:(GdkWindow*) window
251 {
252 return gtk_text_view_get_window_type(GTK_TEXT_VIEW([self GOBJECT]), window);
253 }
254
255 -(GtkWrapMode)getWrapMode
256 {
257 return gtk_text_view_get_wrap_mode(GTK_TEXT_VIEW([self GOBJECT]));
258 }
259
260 -(BOOL)imContextFilterKeypress:(GdkEventKey*) event
261 {
262 return (gtk_text_view_im_context_filter_keypress(GTK_TEXT_VIEW([self GOBJECT]), event) ? YES : NO);
263 }
264
265 -(void)moveChildWithChild:(CGTKWidget*) child andXpos:(gint) xpos andYpos:(gint) ypos
266 {
267 gtk_text_view_move_child(GTK_TEXT_VIEW([self GOBJECT]), [child WIDGET], xpos, ypos);
268 }
269
270 -(BOOL)moveMarkOnscreen:(GtkTextMark*) mark
271 {
272 return (gtk_text_view_move_mark_onscreen(GTK_TEXT_VIEW([self GOBJECT]), mark) ? YES : NO);
273 }
274
275 -(BOOL)moveVisuallyWithIter:(GtkTextIter*) iter andCount:(gint) count
276 {
277 return (gtk_text_view_move_visually(GTK_TEXT_VIEW([self GOBJECT]), iter, count) ? YES : NO);
278 }
279
280 -(BOOL)placeCursorOnscreen
281 {
282 return (gtk_text_view_place_cursor_onscreen(GTK_TEXT_VIEW([self GOBJECT])) ? YES : NO);
283 }
284
285 -(void)resetCursorBlink
286 {
287 gtk_text_view_reset_cursor_blink(GTK_TEXT_VIEW([self GOBJECT]));
288 }
289
290 -(void)resetImContext
291 {
292 gtk_text_view_reset_im_context(GTK_TEXT_VIEW([self GOBJECT]));
293 }
294
295 -(void)scrollMarkOnscreen:(GtkTextMark*) mark
296 {
297 gtk_text_view_scroll_mark_onscreen(GTK_TEXT_VIEW([self GOBJECT]), mark);
298 }
299
300 -(BOOL)scrollToIterWithIter:(GtkTextIter*) iter andWithinMargin:(gdouble) withinMargin andUseAlign:(BOOL) useAlign andXalign:(gdouble) xalign andYalign:(gdouble) yalign
301 {
302 return (gtk_text_view_scroll_to_iter(GTK_TEXT_VIEW([self GOBJECT]), iter, withinMargin, (useAlign ? TRUE : FALSE), xalign, yalign) ? YES : NO);
303 }
304
305 -(void)scrollToMarkWithMark:(GtkTextMark*) mark andWithinMargin:(gdouble) withinMargin andUseAlign:(BOOL) useAlign andXalign:(gdouble) xalign andYalign:(gdouble) yalign
306 {
307 gtk_text_view_scroll_to_mark(GTK_TEXT_VIEW([self GOBJECT]), mark, withinMargin, (useAlign ? TRUE : FALSE), xalign, yalign);
308 }
309
310 -(void)setAcceptsTab:(BOOL) acceptsTab
311 {
312 gtk_text_view_set_accepts_tab(GTK_TEXT_VIEW([self GOBJECT]), (acceptsTab ? TRUE : FALSE));
313 }
314
315 -(void)setBorderWindowSizeWithType:(GtkTextWindowType) type andSize:(gint) size
316 {
317 gtk_text_view_set_border_window_size(GTK_TEXT_VIEW([self GOBJECT]), type, size);
318 }
319
320 -(void)setBottomMargin:(gint) bottomMargin
321 {
322 gtk_text_view_set_bottom_margin(GTK_TEXT_VIEW([self GOBJECT]), bottomMargin);
323 }
324
325 -(void)setBuffer:(GtkTextBuffer*) buffer
326 {
327 gtk_text_view_set_buffer(GTK_TEXT_VIEW([self GOBJECT]), buffer);
328 }
329
330 -(void)setCursorVisible:(BOOL) setting
331 {
332 gtk_text_view_set_cursor_visible(GTK_TEXT_VIEW([self GOBJECT]), (setting ? TRUE : FALSE));
333 }
334
335 -(void)setEditable:(BOOL) setting
336 {
337 gtk_text_view_set_editable(GTK_TEXT_VIEW([self GOBJECT]), (setting ? TRUE : FALSE));
338 }
339
340 -(void)setIndent:(gint) indent
341 {
342 gtk_text_view_set_indent(GTK_TEXT_VIEW([self GOBJECT]), indent);
343 }
344
345 -(void)setInputHints:(GtkInputHints) hints
346 {
347 gtk_text_view_set_input_hints(GTK_TEXT_VIEW([self GOBJECT]), hints);
348 }
349
350 -(void)setInputPurpose:(GtkInputPurpose) purpose
351 {
352 gtk_text_view_set_input_purpose(GTK_TEXT_VIEW([self GOBJECT]), purpose);
353 }
354
355 -(void)setJustification:(GtkJustification) justification
356 {
357 gtk_text_view_set_justification(GTK_TEXT_VIEW([self GOBJECT]), justification);
358 }
359
360 -(void)setLeftMargin:(gint) leftMargin
361 {
362 gtk_text_view_set_left_margin(GTK_TEXT_VIEW([self GOBJECT]), leftMargin);
363 }
364
365 -(void)setMonospace:(BOOL) monospace
366 {
367 gtk_text_view_set_monospace(GTK_TEXT_VIEW([self GOBJECT]), (monospace ? TRUE : FALSE));
368 }
369
370 -(void)setOverwrite:(BOOL) overwrite
371 {
372 gtk_text_view_set_overwrite(GTK_TEXT_VIEW([self GOBJECT]), (overwrite ? TRUE : FALSE));
373 }
374
375 -(void)setPixelsAboveLines:(gint) pixelsAboveLines
376 {
377 gtk_text_view_set_pixels_above_lines(GTK_TEXT_VIEW([self GOBJECT]), pixelsAboveLines);
378 }
379
380 -(void)setPixelsBelowLines:(gint) pixelsBelowLines
381 {
382 gtk_text_view_set_pixels_below_lines(GTK_TEXT_VIEW([self GOBJECT]), pixelsBelowLines);
383 }
384
385 -(void)setPixelsInsideWrap:(gint) pixelsInsideWrap
386 {
387 gtk_text_view_set_pixels_inside_wrap(GTK_TEXT_VIEW([self GOBJECT]), pixelsInsideWrap);
388 }
389
390 -(void)setRightMargin:(gint) rightMargin
391 {
392 gtk_text_view_set_right_margin(GTK_TEXT_VIEW([self GOBJECT]), rightMargin);
393 }
394
395 -(void)setTabs:(PangoTabArray*) tabs
396 {
397 gtk_text_view_set_tabs(GTK_TEXT_VIEW([self GOBJECT]), tabs);
398 }
399
400 -(void)setTopMargin:(gint) topMargin
401 {
402 gtk_text_view_set_top_margin(GTK_TEXT_VIEW([self GOBJECT]), topMargin);
403 }
404
405 -(void)setWrapMode:(GtkWrapMode) wrapMode
406 {
407 gtk_text_view_set_wrap_mode(GTK_TEXT_VIEW([self GOBJECT]), wrapMode);
408 }
409
410 -(BOOL)startsDisplayLine:(const GtkTextIter*) iter
411 {
412 return (gtk_text_view_starts_display_line(GTK_TEXT_VIEW([self GOBJECT]), iter) ? YES : NO);
413 }
414
415 -(void)windowToBufferCoordsWithWin:(GtkTextWindowType) win andWindowX:(gint) windowX andWindowY:(gint) windowY andBufferX:(gint*) bufferX andBufferY:(gint*) bufferY
416 {
417 gtk_text_view_window_to_buffer_coords(GTK_TEXT_VIEW([self GOBJECT]), win, windowX, windowY, bufferX, bufferY);
418 }
419
420
421 @end
-[CGTKTextView getBuffer]
GtkTextBuffer * getBuffer()
Definition: CGTKTextView.m:115
CGTKTextView
Definition: CGTKTextView.h:34
-[CGTKTextView getPixelsAboveLines]
gint getPixelsAboveLines()
Definition: CGTKTextView.m:205
-[CGTKBase GOBJECT]
GObject * GOBJECT()
Definition: CGTKBase.m:82
-[CGTKTextView getTabs]
PangoTabArray * getTabs()
Definition: CGTKTextView.m:225
-[CGTKTextView init]
id init()
Definition: CGTKTextView.m:36
-[CGTKTextView getInputHints]
GtkInputHints getInputHints()
Definition: CGTKTextView.m:150
-[CGTKTextView getLeftMargin]
gint getLeftMargin()
Definition: CGTKTextView.m:180
-[CGTKTextView getAcceptsTab]
BOOL getAcceptsTab()
Definition: CGTKTextView.m:100
-[CGTKTextView getJustification]
GtkJustification getJustification()
Definition: CGTKTextView.m:175
-[CGTKTextView TEXTVIEW]
GtkTextView * TEXTVIEW()
Definition: CGTKTextView.m:60
-[CGTKBase initWithGObject:]
id initWithGObject:(GObject *obj)
Definition: CGTKBase.m:48
-[CGTKTextView getRightMargin]
gint getRightMargin()
Definition: CGTKTextView.m:220
-[CGTKTextView resetCursorBlink]
void resetCursorBlink()
Definition: CGTKTextView.m:285
-[CGTKWidget getWindow]
GdkWindow * getWindow()
Definition: CGTKWidget.m:711
-[CGTKWidget WIDGET]
GtkWidget * WIDGET()
Definition: CGTKWidget.m:61
-[CGTKTextView getVadjustment]
GtkAdjustment * getVadjustment()
Definition: CGTKTextView.m:235
-[CGTKTextView getMonospace]
BOOL getMonospace()
Definition: CGTKTextView.m:195
-[CGTKTextView getDefaultAttributes]
GtkTextAttributes * getDefaultAttributes()
Definition: CGTKTextView.m:130
-[CGTKTextView getHadjustment]
GtkAdjustment * getHadjustment()
Definition: CGTKTextView.m:140
-[CGTKTextView getWrapMode]
GtkWrapMode getWrapMode()
Definition: CGTKTextView.m:255
-[CGTKTextView placeCursorOnscreen]
BOOL placeCursorOnscreen()
Definition: CGTKTextView.m:280
-[CGTKTextView getPixelsInsideWrap]
gint getPixelsInsideWrap()
Definition: CGTKTextView.m:215
-[CGTKTextView getOverwrite]
BOOL getOverwrite()
Definition: CGTKTextView.m:200
-[CGTKTextView getTopMargin]
gint getTopMargin()
Definition: CGTKTextView.m:230
CGTKWidget
Definition: CGTKWidget.h:34
-[CGTKTextView getCursorVisible]
BOOL getCursorVisible()
Definition: CGTKTextView.m:125
-[CGTKTextView resetImContext]
void resetImContext()
Definition: CGTKTextView.m:290
-[CGTKTextView getIndent]
gint getIndent()
Definition: CGTKTextView.m:145
-[CGTKTextView getEditable]
BOOL getEditable()
Definition: CGTKTextView.m:135
-[CGTKTextView getPixelsBelowLines]
gint getPixelsBelowLines()
Definition: CGTKTextView.m:210
-[CGTKTextView getBottomMargin]
gint getBottomMargin()
Definition: CGTKTextView.m:110
-[CGTKTextView getInputPurpose]
GtkInputPurpose getInputPurpose()
Definition: CGTKTextView.m:155