1 /* 2 * This file is part of EvinceD. 3 * EvinceD is based on GtkD. 4 * 5 * EvinceD is free software; you can redistribute it and/or modify 6 * it under the terms of the GNU Lesser General Public License 7 * as published by the Free Software Foundation; either version 3 8 * of the License, or (at your option) any later version, with 9 * some exceptions, please read the COPYING file. 10 * 11 * EvinceD is distributed in the hope that it will be useful, 12 * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 * GNU Lesser General Public License for more details. 15 * 16 * You should have received a copy of the GNU Lesser General Public License 17 * along with EvinceD; if not, write to the Free Software 18 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110, USA 19 */ 20 21 // generated automatically - do not change 22 // find conversion definition on APILookup.txt 23 24 25 module evince.document.Annotation; 26 27 private import evince.document.Page; 28 private import evince.document.Rectangle; 29 private import evince.document.c.functions; 30 public import evince.document.c.types; 31 private import gdk.Color; 32 private import gdk.RGBA; 33 private import glib.MemorySlice; 34 private import glib.Str; 35 private import gobject.ObjectG; 36 37 38 /** */ 39 public class Annotation : ObjectG 40 { 41 /** the main Gtk struct */ 42 protected EvAnnotation* evAnnotation; 43 44 /** Get the main Gtk struct */ 45 public EvAnnotation* getAnnotationStruct(bool transferOwnership = false) 46 { 47 if (transferOwnership) 48 ownedRef = false; 49 return evAnnotation; 50 } 51 52 /** the main Gtk struct as a void* */ 53 protected override void* getStruct() 54 { 55 return cast(void*)evAnnotation; 56 } 57 58 /** 59 * Sets our main struct and passes it to the parent class. 60 */ 61 public this (EvAnnotation* evAnnotation, bool ownedRef = false) 62 { 63 this.evAnnotation = evAnnotation; 64 super(cast(GObject*)evAnnotation, ownedRef); 65 } 66 67 68 /** */ 69 public static GType getType() 70 { 71 return ev_annotation_get_type(); 72 } 73 74 /** 75 * Compare @annot and @other. 76 * 77 * Params: 78 * other = another #EvAnnotation 79 * 80 * Returns: %TRUE if @annot is equal to @other, %FALSE otherwise 81 */ 82 public bool equal(Annotation other) 83 { 84 return ev_annotation_equal(evAnnotation, (other is null) ? null : other.getAnnotationStruct()) != 0; 85 } 86 87 /** */ 88 public EvAnnotationType getAnnotationType() 89 { 90 return ev_annotation_get_annotation_type(evAnnotation); 91 } 92 93 /** */ 94 public void getArea(Rectangle area) 95 { 96 ev_annotation_get_area(evAnnotation, (area is null) ? null : area.getRectangleStruct()); 97 } 98 99 /** 100 * Get the color of @annot. 101 * 102 * Deprecated: Use ev_annotation_get_rgba() instead. 103 * 104 * Params: 105 * color = a #GdkColor to be filled with the Annotation color. 106 */ 107 public void getColor(out Color color) 108 { 109 GdkColor* outcolor = sliceNew!GdkColor(); 110 111 ev_annotation_get_color(evAnnotation, outcolor); 112 113 color = ObjectG.getDObject!(Color)(outcolor, true); 114 } 115 116 /** 117 * Get the contents of @annot. The contents of 118 * @annot is the text that is displayed in the annotation, or an 119 * alternate description of the annotation's content for non-text annotations 120 * 121 * Returns: a string with the contents of the annotation or 122 * %NULL if @annot has no contents. 123 */ 124 public string getContents() 125 { 126 return Str.toString(ev_annotation_get_contents(evAnnotation)); 127 } 128 129 /** 130 * Get the last modification date of @annot. 131 * 132 * Returns: A string containing the last modification date. 133 */ 134 public string getModified() 135 { 136 return Str.toString(ev_annotation_get_modified(evAnnotation)); 137 } 138 139 /** 140 * Get the name of @annot. The name of the annotation is a string 141 * that uniquely indenftifies @annot amongs all the annotations 142 * in the same page. 143 * 144 * Returns: the string with the annotation's name. 145 */ 146 public string getName() 147 { 148 return Str.toString(ev_annotation_get_name(evAnnotation)); 149 } 150 151 /** 152 * Get the page where @annot appears. 153 * 154 * Returns: the #EvPage where @annot appears 155 */ 156 public Page getPage() 157 { 158 auto __p = ev_annotation_get_page(evAnnotation); 159 160 if(__p is null) 161 { 162 return null; 163 } 164 165 return ObjectG.getDObject!(Page)(cast(EvPage*) __p); 166 } 167 168 /** 169 * Get the index of the page where @annot appears. Note that the index 170 * is 0 based. 171 * 172 * Returns: the page index. 173 */ 174 public uint getPageIndex() 175 { 176 return ev_annotation_get_page_index(evAnnotation); 177 } 178 179 /** 180 * Gets the color of @annot. 181 * 182 * Params: 183 * rgba = a #GdkRGBA to be filled with the annotation color 184 * 185 * Since: 3.6 186 */ 187 public void getRgba(out RGBA rgba) 188 { 189 GdkRGBA* outrgba = sliceNew!GdkRGBA(); 190 191 ev_annotation_get_rgba(evAnnotation, outrgba); 192 193 rgba = ObjectG.getDObject!(RGBA)(outrgba, true); 194 } 195 196 /** 197 * Set the area of the annotation to @area. 198 * 199 * Params: 200 * area = a #EvRectangle 201 * 202 * Returns: %TRUE if the area has been changed, %FALSE otherwise 203 * 204 * Since: 3.18 205 */ 206 public bool setArea(Rectangle area) 207 { 208 return ev_annotation_set_area(evAnnotation, (area is null) ? null : area.getRectangleStruct()) != 0; 209 } 210 211 /** 212 * Set the color of the annotation to @color. You can monitor 213 * changes to the annotation's color by connecting to 214 * notify::color signal on @annot. 215 * 216 * Deprecated: Use ev_annotation_set_rgba() instead. 217 * 218 * Params: 219 * color = a #GdkColor 220 * 221 * Returns: %TRUE when the color has been changed, %FALSE otherwise. 222 */ 223 public bool setColor(Color color) 224 { 225 return ev_annotation_set_color(evAnnotation, (color is null) ? null : color.getColorStruct()) != 0; 226 } 227 228 /** 229 * Set the contents of @annot. You can monitor 230 * changes in the annotation's contents by connecting to 231 * notify::contents signal of @annot. 232 * 233 * Returns: %TRUE if the contents have been changed, %FALSE otherwise. 234 */ 235 public bool setContents(string contents) 236 { 237 return ev_annotation_set_contents(evAnnotation, Str.toStringz(contents)) != 0; 238 } 239 240 /** 241 * Set the last modification date of @annot to @modified. To 242 * set the last modification date using a #GTime, use 243 * ev_annotation_set_modified_from_time() instead. You can monitor 244 * changes to the last modification date by connecting to the 245 * notify::modified signal on @annot. 246 * 247 * Params: 248 * modified = string with the last modification date. 249 * 250 * Returns: %TRUE if the last modification date has been updated, %FALSE otherwise. 251 */ 252 public bool setModified(string modified) 253 { 254 return ev_annotation_set_modified(evAnnotation, Str.toStringz(modified)) != 0; 255 } 256 257 /** 258 * Set the last modification date of @annot to @utime. You can 259 * monitor changes to the last modification date by connecting to the 260 * notify::modified sinal on @annot. 261 * For the time-format used, see ev_document_misc_format_date(). 262 * 263 * Params: 264 * utime = a #GTime 265 * 266 * Returns: %TRUE if the last modified date has been updated, %FALSE otherwise. 267 */ 268 public bool setModifiedFromTime(GTime utime) 269 { 270 return ev_annotation_set_modified_from_time(evAnnotation, utime) != 0; 271 } 272 273 /** 274 * Set the name of @annot. 275 * You can monitor changes of the annotation name by connecting 276 * to the notify::name signal on @annot. 277 * 278 * Returns: %TRUE when the name has been changed, %FALSE otherwise. 279 */ 280 public bool setName(string name) 281 { 282 return ev_annotation_set_name(evAnnotation, Str.toStringz(name)) != 0; 283 } 284 285 /** 286 * Set the color of the annotation to @rgba. 287 * 288 * Params: 289 * rgba = a #GdkRGBA 290 * 291 * Returns: %TRUE if the color has been changed, %FALSE otherwise 292 * 293 * Since: 3.6 294 */ 295 public bool setRgba(RGBA rgba) 296 { 297 return ev_annotation_set_rgba(evAnnotation, (rgba is null) ? null : rgba.getRGBAStruct()) != 0; 298 } 299 }