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.view.DocumentModel; 26 27 private import evince.document.Document; 28 private import evince.view.c.functions; 29 public import evince.view.c.types; 30 private import glib.ConstructionException; 31 private import glib.Str; 32 private import gobject.ObjectG; 33 private import gobject.Signals; 34 private import std.algorithm; 35 36 37 /** */ 38 public class DocumentModel : ObjectG 39 { 40 /** the main Gtk struct */ 41 protected EvDocumentModel* evDocumentModel; 42 43 /** Get the main Gtk struct */ 44 public EvDocumentModel* getDocumentModelStruct(bool transferOwnership = false) 45 { 46 if (transferOwnership) 47 ownedRef = false; 48 return evDocumentModel; 49 } 50 51 /** the main Gtk struct as a void* */ 52 protected override void* getStruct() 53 { 54 return cast(void*)evDocumentModel; 55 } 56 57 /** 58 * Sets our main struct and passes it to the parent class. 59 */ 60 public this (EvDocumentModel* evDocumentModel, bool ownedRef = false) 61 { 62 this.evDocumentModel = evDocumentModel; 63 super(cast(GObject*)evDocumentModel, ownedRef); 64 } 65 66 67 /** */ 68 public static GType getType() 69 { 70 return ev_document_model_get_type(); 71 } 72 73 /** */ 74 public this() 75 { 76 auto __p = ev_document_model_new(); 77 78 if(__p is null) 79 { 80 throw new ConstructionException("null returned by new"); 81 } 82 83 this(cast(EvDocumentModel*) __p, true); 84 } 85 86 /** */ 87 public this(Document document) 88 { 89 auto __p = ev_document_model_new_with_document((document is null) ? null : document.getDocumentStruct()); 90 91 if(__p is null) 92 { 93 throw new ConstructionException("null returned by new_with_document"); 94 } 95 96 this(cast(EvDocumentModel*) __p, true); 97 } 98 99 /** */ 100 public bool getContinuous() 101 { 102 return ev_document_model_get_continuous(evDocumentModel) != 0; 103 } 104 105 /** 106 * Returns the #EvDocument referenced by the model. 107 * 108 * Returns: a #EvDocument 109 */ 110 public Document getDocument() 111 { 112 auto __p = ev_document_model_get_document(evDocumentModel); 113 114 if(__p is null) 115 { 116 return null; 117 } 118 119 return ObjectG.getDObject!(Document)(cast(EvDocument*) __p); 120 } 121 122 /** 123 * 124 * 125 * Deprecated: Use ev_document_model_get_page_layout() instead 126 * 127 * Returns: whether the document model's page layout is set to 128 * %EV_PAGE_LAYOUT_DUAL. 129 */ 130 public bool getDualPage() 131 { 132 return ev_document_model_get_dual_page(evDocumentModel) != 0; 133 } 134 135 /** */ 136 public bool getDualPageOddPagesLeft() 137 { 138 return ev_document_model_get_dual_page_odd_pages_left(evDocumentModel) != 0; 139 } 140 141 /** */ 142 public bool getFullscreen() 143 { 144 return ev_document_model_get_fullscreen(evDocumentModel) != 0; 145 } 146 147 /** */ 148 public bool getInvertedColors() 149 { 150 return ev_document_model_get_inverted_colors(evDocumentModel) != 0; 151 } 152 153 /** */ 154 public double getMaxScale() 155 { 156 return ev_document_model_get_max_scale(evDocumentModel); 157 } 158 159 /** */ 160 public double getMinScale() 161 { 162 return ev_document_model_get_min_scale(evDocumentModel); 163 } 164 165 /** */ 166 public int getPage() 167 { 168 return ev_document_model_get_page(evDocumentModel); 169 } 170 171 /** 172 * Returns: the document model's page layout 173 * 174 * Since: 3.8 175 */ 176 public EvPageLayout getPageLayout() 177 { 178 return ev_document_model_get_page_layout(evDocumentModel); 179 } 180 181 /** */ 182 public int getRotation() 183 { 184 return ev_document_model_get_rotation(evDocumentModel); 185 } 186 187 /** */ 188 public bool getRtl() 189 { 190 return ev_document_model_get_rtl(evDocumentModel) != 0; 191 } 192 193 /** */ 194 public double getScale() 195 { 196 return ev_document_model_get_scale(evDocumentModel); 197 } 198 199 /** */ 200 public EvSizingMode getSizingMode() 201 { 202 return ev_document_model_get_sizing_mode(evDocumentModel); 203 } 204 205 /** */ 206 public void setContinuous(bool continuous) 207 { 208 ev_document_model_set_continuous(evDocumentModel, continuous); 209 } 210 211 /** */ 212 public void setDocument(Document document) 213 { 214 ev_document_model_set_document(evDocumentModel, (document is null) ? null : document.getDocumentStruct()); 215 } 216 217 /** 218 * Sets the document model's page layout to %EV_PAGE_LAYOUT_SINGLE or 219 * %EV_PAGE_LAYOUT_DUAL. 220 * 221 * Deprecated: Use ev_document_model_set_page_layout() instead 222 * 223 * Params: 224 * dualPage = whether to enable dual page mode 225 */ 226 public void setDualPage(bool dualPage) 227 { 228 ev_document_model_set_dual_page(evDocumentModel, dualPage); 229 } 230 231 /** */ 232 public void setDualPageOddPagesLeft(bool oddLeft) 233 { 234 ev_document_model_set_dual_page_odd_pages_left(evDocumentModel, oddLeft); 235 } 236 237 /** */ 238 public void setFullscreen(bool fullscreen) 239 { 240 ev_document_model_set_fullscreen(evDocumentModel, fullscreen); 241 } 242 243 /** */ 244 public void setInvertedColors(bool invertedColors) 245 { 246 ev_document_model_set_inverted_colors(evDocumentModel, invertedColors); 247 } 248 249 /** */ 250 public void setMaxScale(double maxScale) 251 { 252 ev_document_model_set_max_scale(evDocumentModel, maxScale); 253 } 254 255 /** */ 256 public void setMinScale(double minScale) 257 { 258 ev_document_model_set_min_scale(evDocumentModel, minScale); 259 } 260 261 /** */ 262 public void setPage(int page) 263 { 264 ev_document_model_set_page(evDocumentModel, page); 265 } 266 267 /** */ 268 public void setPageByLabel(string pageLabel) 269 { 270 ev_document_model_set_page_by_label(evDocumentModel, Str.toStringz(pageLabel)); 271 } 272 273 /** 274 * Sets the document model's page layout to @layout. 275 * 276 * Params: 277 * layout = a #EvPageLayout 278 * 279 * Since: 3.8 280 */ 281 public void setPageLayout(EvPageLayout layout) 282 { 283 ev_document_model_set_page_layout(evDocumentModel, layout); 284 } 285 286 /** */ 287 public void setRotation(int rotation) 288 { 289 ev_document_model_set_rotation(evDocumentModel, rotation); 290 } 291 292 /** */ 293 public void setRtl(bool rtl) 294 { 295 ev_document_model_set_rtl(evDocumentModel, rtl); 296 } 297 298 /** */ 299 public void setScale(double scale) 300 { 301 ev_document_model_set_scale(evDocumentModel, scale); 302 } 303 304 /** */ 305 public void setSizingMode(EvSizingMode mode) 306 { 307 ev_document_model_set_sizing_mode(evDocumentModel, mode); 308 } 309 310 /** */ 311 gulong addOnPageChanged(void delegate(int, int, DocumentModel) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0) 312 { 313 return Signals.connect(this, "page-changed", dlg, connectFlags ^ ConnectFlags.SWAPPED); 314 } 315 }