2 * This file is part of gtkD.
4 * gtkD is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU Lesser General Public License as published by
6 * the Free Software Foundation; either version 2.1 of the License, or
7 * (at your option) any later version.
9 * gtkD is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU Lesser General Public License for more details.
14 * You should have received a copy of the GNU Lesser General Public License
15 * along with gtkD; if not, write to the Free Software
16 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19 // generated automatically - do not change
20 // find conversion definition on APILookup.txt
21 // implement new conversion functionalities on the wrap.utils pakage
24 * Conversion parameters:
25 * inFile = GtkSourceView.html
27 * outFile = SourceView
28 * strct = GtkSourceView
48 * - GtkSourceBuffer* -> SourceBuffer
53 module gsv
.SourceView
;
59 import tango
.io
.Stdout
; // use the tango loging?
63 private import gsvc
.gsvtypes
;
65 private import gsvc
.gsv
;
68 private import gsv
.SourceBuffer
;
69 private import gtkc
.gtk
;
70 private import glib
.Str
;
78 private import gtk
.TextView
;
79 public class SourceView
: TextView
82 /** the main Gtk struct */
83 protected GtkSourceView
* gtkSourceView
;
86 public GtkSourceView
* getSourceViewStruct()
92 /** the main Gtk struct as a void* */
93 protected void* getStruct()
95 return cast(void*)gtkSourceView
;
99 * Sets our main struct and passes it to the parent class
101 public this (GtkSourceView
* gtkSourceView
)
105 if ( gtkSourceView
is null )
110 Stdout("struct gtkSourceView is null on constructor").newline
;
114 printf("struct gtkSourceView is null on constructor");
121 assert(gtkSourceView
!is null, "struct gtkSourceView is null on constructor");
123 super(cast(GtkTextView
*)gtkSourceView
);
124 this.gtkSourceView
= gtkSourceView
;
128 * Returns the GtkSourceBuffer being displayed by this source view.
129 * The reference count on the buffer is not incremented; the caller
130 * of this function won't own a new reference.
136 public SourceBuffer
getBuffer()
138 // GtkSourceBuffer* gtk_text_view_get_buffer (GtkTextView *text_view);
139 return new SourceBuffer( cast(GtkSourceBuffer
*)gtk_text_view_get_buffer(cast(GtkTextView
*)gtkSourceView
) );
147 // imports for the signal processing
148 private import gobject
.Signals
;
149 private import gtkc
.gdktypes
;
150 int[char[]] connectedSignals
;
152 void delegate(SourceView
)[] onRedoListeners
;
153 void addOnRedo(void delegate(SourceView
) dlg
, ConnectFlags connectFlags
=cast(ConnectFlags
)0)
155 if ( !("redo" in connectedSignals
) )
160 cast(GCallback
)&callBackRedo
,
164 connectedSignals
["redo"] = 1;
166 onRedoListeners
~= dlg
;
168 extern(C
) static void callBackRedo(GtkSourceView
* sourceviewStruct
, SourceView sourceView
)
170 bool consumed
= false;
172 foreach ( void delegate(SourceView
) dlg
; sourceView
.onRedoListeners
)
180 void delegate(SourceView
)[] onUndoListeners
;
181 void addOnUndo(void delegate(SourceView
) dlg
, ConnectFlags connectFlags
=cast(ConnectFlags
)0)
183 if ( !("undo" in connectedSignals
) )
188 cast(GCallback
)&callBackUndo
,
192 connectedSignals
["undo"] = 1;
194 onUndoListeners
~= dlg
;
196 extern(C
) static void callBackUndo(GtkSourceView
* sourceviewStruct
, SourceView sourceView
)
198 bool consumed
= false;
200 foreach ( void delegate(SourceView
) dlg
; sourceView
.onUndoListeners
)
211 * Creates a new GtkSourceView. An empty default buffer will be
212 * created for you. If you want to specify your own buffer, consider
213 * gtk_source_view_new_with_buffer().
215 * a new GtkSourceView
219 // GtkWidget* gtk_source_view_new (void);
220 this(cast(GtkSourceView
*)gtk_source_view_new() );
224 * Creates a new GtkSourceView widget displaying the buffer
225 * buffer. One buffer can be shared among many widgets.
231 public this (SourceBuffer buffer
)
233 // GtkWidget* gtk_source_view_new_with_buffer (GtkSourceBuffer *buffer);
234 this(cast(GtkSourceView
*)gtk_source_view_new_with_buffer((buffer
is null) ?
null : buffer
.getSourceBufferStruct()) );
238 * If TRUE line numbers will be displayed beside the text.
242 * whether line numbers should be displayed.
244 public void setShowLineNumbers(int show
)
246 // void gtk_source_view_set_show_line_numbers (GtkSourceView *view, gboolean show);
247 gtk_source_view_set_show_line_numbers(gtkSourceView
, show
);
251 * Returns whether line numbers are displayed beside the text.
255 * TRUE if the line numbers are displayed.
257 public int getShowLineNumbers()
259 // gboolean gtk_source_view_get_show_line_numbers (GtkSourceView *view);
260 return gtk_source_view_get_show_line_numbers(gtkSourceView
);
264 * If TRUE line markers will be displayed beside the text.
268 * whether line markers should be displayed.
270 public void setShowLineMarkers(int show
)
272 // void gtk_source_view_set_show_line_markers (GtkSourceView *view, gboolean show);
273 gtk_source_view_set_show_line_markers(gtkSourceView
, show
);
277 * Returns whether line markers are displayed beside the text.
281 * TRUE if the line markers are displayed.
283 public int getShowLineMarkers()
285 // gboolean gtk_source_view_get_show_line_markers (GtkSourceView *view);
286 return gtk_source_view_get_show_line_markers(gtkSourceView
);
290 * Sets the width of tabulation in characters.
294 * width of tab in characters.
296 public void setTabsWidth(uint width
)
298 // void gtk_source_view_set_tabs_width (GtkSourceView *view, guint width);
299 gtk_source_view_set_tabs_width(gtkSourceView
, width
);
303 * Returns the width of tabulation in characters.
309 public uint getTabsWidth()
311 // guint gtk_source_view_get_tabs_width (GtkSourceView *view);
312 return gtk_source_view_get_tabs_width(gtkSourceView
);
316 * If TRUE auto indentation of text is enabled.
320 * whether to enable auto indentation.
322 public void setAutoIndent(int enable
)
324 // void gtk_source_view_set_auto_indent (GtkSourceView *view, gboolean enable);
325 gtk_source_view_set_auto_indent(gtkSourceView
, enable
);
329 * Returns whether auto indentation of text is enabled.
333 * TRUE if auto indentation is enabled.
335 public int getAutoIndent()
337 // gboolean gtk_source_view_get_auto_indent (GtkSourceView *view);
338 return gtk_source_view_get_auto_indent(gtkSourceView
);
342 * If TRUE any tabulator character inserted is replaced by a group
343 * of space characters.
347 * whether to insert spaces instead of tabs.
349 public void setInsertSpacesInsteadOfTabs(int enable
)
351 // void gtk_source_view_set_insert_spaces_instead_of_tabs (GtkSourceView *view, gboolean enable);
352 gtk_source_view_set_insert_spaces_instead_of_tabs(gtkSourceView
, enable
);
356 * Returns whether when inserting a tabulator character it should
357 * be replaced by a group of space characters.
361 * TRUE if spaces are inserted instead of tabs.
363 public int getInsertSpacesInsteadOfTabs()
365 // gboolean gtk_source_view_get_insert_spaces_instead_of_tabs (GtkSourceView *view);
366 return gtk_source_view_get_insert_spaces_instead_of_tabs(gtkSourceView
);
370 * If TRUE a margin is displayed
374 * whether to show a margin.
376 public void setShowMargin(int show
)
378 // void gtk_source_view_set_show_margin (GtkSourceView *view, gboolean show);
379 gtk_source_view_set_show_margin(gtkSourceView
, show
);
383 * Returns whether a margin is displayed.
387 * TRUE if the margin is showed.
389 public int getShowMargin()
391 // gboolean gtk_source_view_get_show_margin (GtkSourceView *view);
392 return gtk_source_view_get_show_margin(gtkSourceView
);
396 * Sets the position of the right margin in the given view.
400 * the position of the margin to set.
402 public void setMargin(uint margin
)
404 // void gtk_source_view_set_margin (GtkSourceView *view, guint margin);
405 gtk_source_view_set_margin(gtkSourceView
, margin
);
409 * Gets the position of the right margin in the given view.
413 * the position of the right margin.
415 public uint getMargin()
417 // guint gtk_source_view_get_margin (GtkSourceView *view);
418 return gtk_source_view_get_margin(gtkSourceView
);
422 * If TRUE the current line is highlighted
426 * whether to highlight the current line
428 public void setHighlightCurrentLine(int show
)
430 // void gtk_source_view_set_highlight_current_line (GtkSourceView *view, gboolean show);
431 gtk_source_view_set_highlight_current_line(gtkSourceView
, show
);
435 * Returns whether the current line is highlighted
439 * TRUE if the current line is highlighted
441 public int getHighlightCurrentLine()
443 // gboolean gtk_source_view_get_highlight_current_line (GtkSourceView *view);
444 return gtk_source_view_get_highlight_current_line(gtkSourceView
);
448 * Associates a given pixbuf with a given marker_type.
456 public void setMarkerPixbuf(char[] markerType
, GdkPixbuf
* pixbuf
)
458 // void gtk_source_view_set_marker_pixbuf (GtkSourceView *view, const gchar *marker_type, GdkPixbuf *pixbuf);
459 gtk_source_view_set_marker_pixbuf(gtkSourceView
, Str
.toStringz(markerType
), pixbuf
);
463 * Gets the pixbuf which is associated with the given marker_type.
469 * a GdkPixbuf if found, or NULL if not found.
471 public GdkPixbuf
* getMarkerPixbuf(char[] markerType
)
473 // GdkPixbuf* gtk_source_view_get_marker_pixbuf (GtkSourceView *view, const gchar *marker_type);
474 return gtk_source_view_get_marker_pixbuf(gtkSourceView
, Str
.toStringz(markerType
));
478 * If TRUE HOME and END keys will move to the first/last non-space
479 * character of the line before moving to the start/end.
483 * whether to enable smart behavior for HOME and END keys.
485 public void setSmartHomeEnd(int enable
)
487 // void gtk_source_view_set_smart_home_end (GtkSourceView *view, gboolean enable);
488 gtk_source_view_set_smart_home_end(gtkSourceView
, enable
);
492 * Returns whether HOME and END keys will move to the first/last non-space
493 * character of the line before moving to the start/end.
497 * TRUE if smart behavior for HOME and END keys is enabled.
499 * The "auto-indent" property
500 * "auto-indent" gboolean : Read / Write
501 * Whether to enable auto indentation.
502 * Default value: FALSE
504 public int getSmartHomeEnd()
506 // gboolean gtk_source_view_get_smart_home_end (GtkSourceView *view);
507 return gtk_source_view_get_smart_home_end(gtkSourceView
);