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.AnnotationAttachment;
26 
27 private import evince.document.Annotation;
28 private import evince.document.AnnotationMarkupIF;
29 private import evince.document.AnnotationMarkupT;
30 private import evince.document.Attachment;
31 private import evince.document.Page;
32 private import evince.document.c.functions;
33 public  import evince.document.c.types;
34 private import glib.ConstructionException;
35 private import gobject.ObjectG;
36 
37 
38 /** */
39 public class AnnotationAttachment : Annotation, AnnotationMarkupIF
40 {
41 	/** the main Gtk struct */
42 	protected EvAnnotationAttachment* evAnnotationAttachment;
43 
44 	/** Get the main Gtk struct */
45 	public EvAnnotationAttachment* getAnnotationAttachmentStruct(bool transferOwnership = false)
46 	{
47 		if (transferOwnership)
48 			ownedRef = false;
49 		return evAnnotationAttachment;
50 	}
51 
52 	/** the main Gtk struct as a void* */
53 	protected override void* getStruct()
54 	{
55 		return cast(void*)evAnnotationAttachment;
56 	}
57 
58 	/**
59 	 * Sets our main struct and passes it to the parent class.
60 	 */
61 	public this (EvAnnotationAttachment* evAnnotationAttachment, bool ownedRef = false)
62 	{
63 		this.evAnnotationAttachment = evAnnotationAttachment;
64 		super(cast(EvAnnotation*)evAnnotationAttachment, ownedRef);
65 	}
66 
67 	// add the AnnotationMarkup capabilities
68 	mixin AnnotationMarkupT!(EvAnnotationAttachment);
69 
70 
71 	/** */
72 	public static GType getType()
73 	{
74 		return ev_annotation_attachment_get_type();
75 	}
76 
77 	/** */
78 	public this(Page page, Attachment attachment)
79 	{
80 		auto __p = ev_annotation_attachment_new((page is null) ? null : page.getPageStruct(), (attachment is null) ? null : attachment.getAttachmentStruct());
81 
82 		if(__p is null)
83 		{
84 			throw new ConstructionException("null returned by new");
85 		}
86 
87 		this(cast(EvAnnotationAttachment*) __p, true);
88 	}
89 
90 	/**
91 	 * Returns: an #EvAttachment
92 	 */
93 	public Attachment getAttachment()
94 	{
95 		auto __p = ev_annotation_attachment_get_attachment(evAnnotationAttachment);
96 
97 		if(__p is null)
98 		{
99 			return null;
100 		}
101 
102 		return ObjectG.getDObject!(Attachment)(cast(EvAttachment*) __p);
103 	}
104 
105 	/** */
106 	public bool setAttachment(Attachment attachment)
107 	{
108 		return ev_annotation_attachment_set_attachment(evAnnotationAttachment, (attachment is null) ? null : attachment.getAttachmentStruct()) != 0;
109 	}
110 }