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