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.MappingList; 26 27 private import evince.document.c.functions; 28 public import evince.document.c.types; 29 private import glib.ConstructionException; 30 private import glib.ListG; 31 private import gobject.ObjectG; 32 private import gtkd.Loader; 33 34 35 /** */ 36 public class MappingList 37 { 38 /** the main Gtk struct */ 39 protected EvMappingList* evMappingList; 40 protected bool ownedRef; 41 42 /** Get the main Gtk struct */ 43 public EvMappingList* getMappingListStruct(bool transferOwnership = false) 44 { 45 if (transferOwnership) 46 ownedRef = false; 47 return evMappingList; 48 } 49 50 /** the main Gtk struct as a void* */ 51 protected void* getStruct() 52 { 53 return cast(void*)evMappingList; 54 } 55 56 /** 57 * Sets our main struct and passes it to the parent class. 58 */ 59 public this (EvMappingList* evMappingList, bool ownedRef = false) 60 { 61 this.evMappingList = evMappingList; 62 this.ownedRef = ownedRef; 63 } 64 65 ~this () 66 { 67 if ( Linker.isLoaded(LIBRARY_EVINCEDOCUMENT) && ownedRef ) 68 ev_mapping_list_unref(evMappingList); 69 } 70 71 72 /** */ 73 public static GType getType() 74 { 75 return ev_mapping_list_get_type(); 76 } 77 78 /** 79 * 80 * Params: 81 * page = page index for this mapping 82 * list = a #GList of data for the page 83 * dataDestroyFunc = function to free a list element 84 * Returns: an #EvMappingList 85 * 86 * Throws: ConstructionException GTK+ fails to create the object. 87 */ 88 public this(uint page, ListG list, GDestroyNotify dataDestroyFunc) 89 { 90 auto __p = ev_mapping_list_new(page, (list is null) ? null : list.getListGStruct(), dataDestroyFunc); 91 92 if(__p is null) 93 { 94 throw new ConstructionException("null returned by new"); 95 } 96 97 this(cast(EvMappingList*) __p); 98 } 99 100 /** 101 * 102 * Params: 103 * data = mapping data to find 104 * Returns: an #EvMapping 105 */ 106 public EvMapping* find(void* data) 107 { 108 return ev_mapping_list_find(evMappingList, data); 109 } 110 111 /** 112 * 113 * Params: 114 * data = mapping data to find 115 * func = function to use for equality check 116 * Returns: an #EvMapping 117 */ 118 public EvMapping* findCustom(void* data, GCompareFunc func) 119 { 120 return ev_mapping_list_find_custom(evMappingList, data, func); 121 } 122 123 /** 124 * 125 * Params: 126 * x = X coordinate 127 * y = Y coordinate 128 * Returns: the #EvMapping in the list at coordinates (x, y) 129 * 130 * Since: 3.12 131 */ 132 public EvMapping* get(double x, double y) 133 { 134 return ev_mapping_list_get(evMappingList, x, y); 135 } 136 137 /** 138 * 139 * Params: 140 * x = X coordinate 141 * y = Y coordinate 142 * Returns: the data of a mapping in the list at coordinates (x, y) 143 */ 144 public void* getData(double x, double y) 145 { 146 return ev_mapping_list_get_data(evMappingList, x, y); 147 } 148 149 /** 150 * Returns: the data for this mapping list 151 */ 152 public ListG getList() 153 { 154 auto __p = ev_mapping_list_get_list(evMappingList); 155 156 if(__p is null) 157 { 158 return null; 159 } 160 161 return new ListG(cast(GList*) __p); 162 } 163 164 /** */ 165 public uint getPage() 166 { 167 return ev_mapping_list_get_page(evMappingList); 168 } 169 170 /** */ 171 public uint length() 172 { 173 return ev_mapping_list_length(evMappingList); 174 } 175 176 /** 177 * 178 * Params: 179 * n = the position to retrieve 180 * Returns: the #Evmapping at position @n in @mapping_list 181 */ 182 public EvMapping* nth(uint n) 183 { 184 return ev_mapping_list_nth(evMappingList, n); 185 } 186 187 alias doref = ref_; 188 /** */ 189 public MappingList ref_() 190 { 191 auto __p = ev_mapping_list_ref(evMappingList); 192 193 if(__p is null) 194 { 195 return null; 196 } 197 198 return ObjectG.getDObject!(MappingList)(cast(EvMappingList*) __p, true); 199 } 200 201 /** */ 202 public void remove(EvMapping* mapping) 203 { 204 ev_mapping_list_remove(evMappingList, mapping); 205 } 206 207 /** */ 208 public void unref() 209 { 210 ev_mapping_list_unref(evMappingList); 211 } 212 }