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 * Conversion parameters: 26 * inFile = GtkSourceGutter.html 27 * outPack = gsv 28 * outFile = SourceGutter 29 * strct = GtkSourceGutter 30 * realStrct= 31 * ctorStrct= 32 * clss = SourceGutter 33 * interf = 34 * class Code: No 35 * interface Code: No 36 * template for: 37 * extend = 38 * implements: 39 * prefixes: 40 * - gtk_source_gutter_ 41 * omit structs: 42 * omit prefixes: 43 * omit code: 44 * omit signals: 45 * imports: 46 * - gdk.Window 47 * - gsv.SourceGutterRenderer 48 * structWrap: 49 * - GdkWindow* -> Window 50 * - GtkSourceGutterRenderer* -> SourceGutterRenderer 51 * module aliases: 52 * local aliases: 53 * overrides: 54 */ 55 56 module gsv.SourceGutter; 57 58 public import gsvc.gsvtypes; 59 60 private import gsvc.gsv; 61 private import glib.ConstructionException; 62 private import gobject.ObjectG; 63 64 private import gdk.Window; 65 private import gsv.SourceGutterRenderer; 66 67 68 private import gobject.ObjectG; 69 70 /** 71 * The GtkSourceGutter object represents the left and right gutters of the text 72 * view. It is used by GtkSourceView to draw the line numbers and category 73 * marks that might be present on a line. By packing additional GtkSourceGutterRenderer 74 * objects in the gutter, you can extend the gutter with your own custom 75 * drawings. 76 * 77 * The gutter works very much the same way as cells rendered in a GtkTreeView. 78 * The concept is similar, with the exception that the gutter does not have an 79 * underlying GtkTreeModel. The builtin line number renderer is at position 80 * GTK_SOURCE_VIEW_GUTTER_POSITION_LINES (-30) and the marks renderer is at 81 * GTK_SOURCE_VIEW_GUTTER_POSITION_MARKS (-20). You can use these values to 82 * position custom renderers accordingly. 83 */ 84 public class SourceGutter : ObjectG 85 { 86 87 /** the main Gtk struct */ 88 protected GtkSourceGutter* gtkSourceGutter; 89 90 91 /** Get the main Gtk struct */ 92 public GtkSourceGutter* getSourceGutterStruct() 93 { 94 return gtkSourceGutter; 95 } 96 97 98 /** the main Gtk struct as a void* */ 99 protected override void* getStruct() 100 { 101 return cast(void*)gtkSourceGutter; 102 } 103 104 /** 105 * Sets our main struct and passes it to the parent class 106 */ 107 public this (GtkSourceGutter* gtkSourceGutter) 108 { 109 super(cast(GObject*)gtkSourceGutter); 110 this.gtkSourceGutter = gtkSourceGutter; 111 } 112 113 protected override void setStruct(GObject* obj) 114 { 115 super.setStruct(obj); 116 gtkSourceGutter = cast(GtkSourceGutter*)obj; 117 } 118 119 /** 120 */ 121 122 /** 123 * Get the GdkWindow of the gutter. The window will only be available when the 124 * gutter has at least one, non-zero width, cell renderer packed. 125 * Since 2.8 126 * Returns: the GdkWindow of the gutter, or NULL if the gutter has no window. [transfer none] 127 */ 128 public Window getWindow() 129 { 130 // GdkWindow * gtk_source_gutter_get_window (GtkSourceGutter *gutter); 131 auto p = gtk_source_gutter_get_window(gtkSourceGutter); 132 133 if(p is null) 134 { 135 return null; 136 } 137 138 return ObjectG.getDObject!(Window)(cast(GdkWindow*) p); 139 } 140 141 /** 142 * Insert renderer into the gutter. If renderer is yet unowned then gutter 143 * claims its ownership. Otherwise just increases renderer's reference count. 144 * renderer cannot be already inserted to another gutter. 145 * Params: 146 * renderer = a gutter renderer (must inherit from GtkSourceGutterRenderer). 147 * position = the renderer position. 148 * Returns: TRUE if operation succeeded. Otherwise FALSE. Since 3.0 149 */ 150 public int insert(SourceGutterRenderer renderer, int position) 151 { 152 // gboolean gtk_source_gutter_insert (GtkSourceGutter *gutter, GtkSourceGutterRenderer *renderer, gint position); 153 return gtk_source_gutter_insert(gtkSourceGutter, (renderer is null) ? null : renderer.getSourceGutterRendererStruct(), position); 154 } 155 156 /** 157 * Reorders renderer in gutter to new position. 158 * Since 2.8 159 * Params: 160 * renderer = a GtkCellRenderer. 161 * position = the new renderer position. 162 */ 163 public void reorder(SourceGutterRenderer renderer, int position) 164 { 165 // void gtk_source_gutter_reorder (GtkSourceGutter *gutter, GtkSourceGutterRenderer *renderer, gint position); 166 gtk_source_gutter_reorder(gtkSourceGutter, (renderer is null) ? null : renderer.getSourceGutterRendererStruct(), position); 167 } 168 169 /** 170 * Removes renderer from gutter. 171 * Since 2.8 172 * Params: 173 * renderer = a GtkSourceGutterRenderer. 174 */ 175 public void remove(SourceGutterRenderer renderer) 176 { 177 // void gtk_source_gutter_remove (GtkSourceGutter *gutter, GtkSourceGutterRenderer *renderer); 178 gtk_source_gutter_remove(gtkSourceGutter, (renderer is null) ? null : renderer.getSourceGutterRendererStruct()); 179 } 180 181 /** 182 * Invalidates the drawable area of the gutter. You can use this to force a 183 * redraw of the gutter if something has changed and needs to be redrawn. 184 * Since 2.8 185 */ 186 public void queueDraw() 187 { 188 // void gtk_source_gutter_queue_draw (GtkSourceGutter *gutter); 189 gtk_source_gutter_queue_draw(gtkSourceGutter); 190 } 191 192 /** 193 */ 194 public void getPadding(out int xpad, out int ypad) 195 { 196 // void gtk_source_gutter_get_padding (GtkSourceGutter *gutter, gint *xpad, gint *ypad); 197 gtk_source_gutter_get_padding(gtkSourceGutter, &xpad, &ypad); 198 } 199 200 /** 201 */ 202 public void setPadding(int xpad, int ypad) 203 { 204 // void gtk_source_gutter_set_padding (GtkSourceGutter *gutter, gint xpad, gint ypad); 205 gtk_source_gutter_set_padding(gtkSourceGutter, xpad, ypad); 206 } 207 208 /** 209 * Finds the GtkSourceGutterRenderer at (x, y). 210 * Params: 211 * x = The x position to get identified. 212 * y = The y position to get identified. 213 * Returns: the renderer at (x, y) or NULL. [transfer none] 214 */ 215 public SourceGutterRenderer getRendererAtPos(int x, int y) 216 { 217 // GtkSourceGutterRenderer * gtk_source_gutter_get_renderer_at_pos (GtkSourceGutter *gutter, gint x, gint y); 218 auto p = gtk_source_gutter_get_renderer_at_pos(gtkSourceGutter, x, y); 219 220 if(p is null) 221 { 222 return null; 223 } 224 225 return ObjectG.getDObject!(SourceGutterRenderer)(cast(GtkSourceGutterRenderer*) p); 226 } 227 }