1 /*
2  * This file is part of gtkD.
3  *
4  * gtkD is free software; you can redistribute it and/or modify
5  * it under the terms of the GNU Lesser General Public License
6  * as published by the Free Software Foundation; either version 3
7  * of the License, or (at your option) any later version, with
8  * some exceptions, please read the COPYING file.
9  *
10  * gtkD is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13  * GNU Lesser General Public License for more details.
14  *
15  * You should have received a copy of the GNU Lesser General Public License
16  * along with gtkD; if not, write to the Free Software
17  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110, USA
18  */
19 
20 // generated automatically - do not change
21 // find conversion definition on APILookup.txt
22 // implement new conversion functionalities on the wrap.utils pakage
23 
24 
25 module gsv.SourceGutter;
26 
27 private import gdk.Window;
28 private import gobject.ObjectG;
29 private import gsv.SourceGutterRenderer;
30 private import gsv.SourceView;
31 private import gsv.c.functions;
32 public  import gsv.c.types;
33 public  import gsvc.gsvtypes;
34 
35 
36 /** */
37 public class SourceGutter : ObjectG
38 {
39 	/** the main Gtk struct */
40 	protected GtkSourceGutter* gtkSourceGutter;
41 
42 	/** Get the main Gtk struct */
43 	public GtkSourceGutter* getSourceGutterStruct(bool transferOwnership = false)
44 	{
45 		if (transferOwnership)
46 			ownedRef = false;
47 		return gtkSourceGutter;
48 	}
49 
50 	/** the main Gtk struct as a void* */
51 	protected override void* getStruct()
52 	{
53 		return cast(void*)gtkSourceGutter;
54 	}
55 
56 	protected override void setStruct(GObject* obj)
57 	{
58 		gtkSourceGutter = cast(GtkSourceGutter*)obj;
59 		super.setStruct(obj);
60 	}
61 
62 	/**
63 	 * Sets our main struct and passes it to the parent class.
64 	 */
65 	public this (GtkSourceGutter* gtkSourceGutter, bool ownedRef = false)
66 	{
67 		this.gtkSourceGutter = gtkSourceGutter;
68 		super(cast(GObject*)gtkSourceGutter, ownedRef);
69 	}
70 
71 
72 	/** */
73 	public static GType getType()
74 	{
75 		return gtk_source_gutter_get_type();
76 	}
77 
78 	/**
79 	 *
80 	 *
81 	 * Deprecated: Use gtk_source_gutter_renderer_get_padding() instead.
82 	 */
83 	public void getPadding(int* xpad, int* ypad)
84 	{
85 		gtk_source_gutter_get_padding(gtkSourceGutter, xpad, ypad);
86 	}
87 
88 	/**
89 	 * Finds the #GtkSourceGutterRenderer at (x, y).
90 	 *
91 	 * Params:
92 	 *     x = The x position to get identified.
93 	 *     y = The y position to get identified.
94 	 *
95 	 * Returns: the renderer at (x, y) or %NULL.
96 	 */
97 	public SourceGutterRenderer getRendererAtPos(int x, int y)
98 	{
99 		auto p = gtk_source_gutter_get_renderer_at_pos(gtkSourceGutter, x, y);
100 
101 		if(p is null)
102 		{
103 			return null;
104 		}
105 
106 		return ObjectG.getDObject!(SourceGutterRenderer)(cast(GtkSourceGutterRenderer*) p);
107 	}
108 
109 	/**
110 	 * Returns: the associated #GtkSourceView.
111 	 *
112 	 * Since: 3.24
113 	 */
114 	public SourceView getView()
115 	{
116 		auto p = gtk_source_gutter_get_view(gtkSourceGutter);
117 
118 		if(p is null)
119 		{
120 			return null;
121 		}
122 
123 		return ObjectG.getDObject!(SourceView)(cast(GtkSourceView*) p);
124 	}
125 
126 	/**
127 	 * Get the #GdkWindow of the gutter. The window will only be available when the
128 	 * gutter has at least one, non-zero width, cell renderer packed.
129 	 *
130 	 * Deprecated: Use gtk_text_view_get_window() instead.
131 	 *
132 	 * Returns: the #GdkWindow of the gutter, or %NULL
133 	 *     if the gutter has no window.
134 	 *
135 	 * Since: 2.8
136 	 */
137 	public Window getWindow()
138 	{
139 		auto p = gtk_source_gutter_get_window(gtkSourceGutter);
140 
141 		if(p is null)
142 		{
143 			return null;
144 		}
145 
146 		return ObjectG.getDObject!(Window)(cast(GdkWindow*) p);
147 	}
148 
149 	/**
150 	 * Returns: the #GtkTextWindowType of @gutter.
151 	 *
152 	 * Since: 3.24
153 	 */
154 	public GtkTextWindowType getWindowType()
155 	{
156 		return gtk_source_gutter_get_window_type(gtkSourceGutter);
157 	}
158 
159 	/**
160 	 * Insert @renderer into the gutter. If @renderer is yet unowned then gutter
161 	 * claims its ownership. Otherwise just increases renderer's reference count.
162 	 * @renderer cannot be already inserted to another gutter.
163 	 *
164 	 * Params:
165 	 *     renderer = a gutter renderer (must inherit from #GtkSourceGutterRenderer).
166 	 *     position = the renderer position.
167 	 *
168 	 * Returns: %TRUE if operation succeeded. Otherwise %FALSE.
169 	 *
170 	 * Since: 3.0
171 	 */
172 	public bool insert(SourceGutterRenderer renderer, int position)
173 	{
174 		return gtk_source_gutter_insert(gtkSourceGutter, (renderer is null) ? null : renderer.getSourceGutterRendererStruct(), position) != 0;
175 	}
176 
177 	/**
178 	 * Invalidates the drawable area of the gutter. You can use this to force a
179 	 * redraw of the gutter if something has changed and needs to be redrawn.
180 	 *
181 	 * Since: 2.8
182 	 */
183 	public void queueDraw()
184 	{
185 		gtk_source_gutter_queue_draw(gtkSourceGutter);
186 	}
187 
188 	/**
189 	 * Removes @renderer from @gutter.
190 	 *
191 	 * Params:
192 	 *     renderer = a #GtkSourceGutterRenderer.
193 	 *
194 	 * Since: 2.8
195 	 */
196 	public void remove(SourceGutterRenderer renderer)
197 	{
198 		gtk_source_gutter_remove(gtkSourceGutter, (renderer is null) ? null : renderer.getSourceGutterRendererStruct());
199 	}
200 
201 	/**
202 	 * Reorders @renderer in @gutter to new @position.
203 	 *
204 	 * Params:
205 	 *     renderer = a #GtkCellRenderer.
206 	 *     position = the new renderer position.
207 	 *
208 	 * Since: 2.8
209 	 */
210 	public void reorder(SourceGutterRenderer renderer, int position)
211 	{
212 		gtk_source_gutter_reorder(gtkSourceGutter, (renderer is null) ? null : renderer.getSourceGutterRendererStruct(), position);
213 	}
214 
215 	/**
216 	 *
217 	 *
218 	 * Deprecated: Use gtk_source_gutter_renderer_set_padding() instead.
219 	 */
220 	public void setPadding(int xpad, int ypad)
221 	{
222 		gtk_source_gutter_set_padding(gtkSourceGutter, xpad, ypad);
223 	}
224 }