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.Media;
26 
27 private import evince.document.Page;
28 private import evince.document.c.functions;
29 public  import evince.document.c.types;
30 private import glib.ConstructionException;
31 private import glib.Str;
32 private import gobject.ObjectG;
33 
34 
35 /** */
36 public class Media : ObjectG
37 {
38 	/** the main Gtk struct */
39 	protected EvMedia* evMedia;
40 
41 	/** Get the main Gtk struct */
42 	public EvMedia* getMediaStruct(bool transferOwnership = false)
43 	{
44 		if (transferOwnership)
45 			ownedRef = false;
46 		return evMedia;
47 	}
48 
49 	/** the main Gtk struct as a void* */
50 	protected override void* getStruct()
51 	{
52 		return cast(void*)evMedia;
53 	}
54 
55 	/**
56 	 * Sets our main struct and passes it to the parent class.
57 	 */
58 	public this (EvMedia* evMedia, bool ownedRef = false)
59 	{
60 		this.evMedia = evMedia;
61 		super(cast(GObject*)evMedia, ownedRef);
62 	}
63 
64 
65 	/** */
66 	public static GType getType()
67 	{
68 		return ev_media_get_type();
69 	}
70 
71 	/** */
72 	public this(Page page, string uri)
73 	{
74 		auto __p = ev_media_new_for_uri((page is null) ? null : page.getPageStruct(), Str.toStringz(uri));
75 
76 		if(__p is null)
77 		{
78 			throw new ConstructionException("null returned by new_for_uri");
79 		}
80 
81 		this(cast(EvMedia*) __p, true);
82 	}
83 
84 	/** */
85 	public uint getPageIndex()
86 	{
87 		return ev_media_get_page_index(evMedia);
88 	}
89 
90 	/** */
91 	public bool getShowControls()
92 	{
93 		return ev_media_get_show_controls(evMedia) != 0;
94 	}
95 
96 	/** */
97 	public string getUri()
98 	{
99 		return Str.toString(ev_media_get_uri(evMedia));
100 	}
101 
102 	/** */
103 	public void setShowControls(bool showControls)
104 	{
105 		ev_media_set_show_controls(evMedia, showControls);
106 	}
107 }