1 /*
2  * This file is part of gtkD.
3  *
4  * gtkD is free software; you can redistribute it and/or modify
5  * it under the terms of the GNU Lesser General Public License
6  * as published by the Free Software Foundation; either version 3
7  * of the License, or (at your option) any later version, with
8  * some exceptions, please read the COPYING file.
9  *
10  * gtkD is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13  * GNU Lesser General Public License for more details.
14  *
15  * You should have received a copy of the GNU Lesser General Public License
16  * along with gtkD; if not, write to the Free Software
17  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110, USA
18  */
19 
20 // generated automatically - do not change
21 // find conversion definition on APILookup.txt
22 // implement new conversion functionalities on the wrap.utils pakage
23 
24 
25 module gtk.MediaControls;
26 
27 private import glib.ConstructionException;
28 private import gobject.ObjectG;
29 private import gtk.MediaStream;
30 private import gtk.Widget;
31 private import gtk.c.functions;
32 public  import gtk.c.types;
33 
34 
35 /**
36  * `GtkMediaControls` is a widget to show controls for a video.
37  * 
38  * ![An example GtkMediaControls](media-controls.png)
39  * 
40  * Usually, `GtkMediaControls` is used as part of [class@Gtk.Video].
41  */
42 public class MediaControls : Widget
43 {
44 	/** the main Gtk struct */
45 	protected GtkMediaControls* gtkMediaControls;
46 
47 	/** Get the main Gtk struct */
48 	public GtkMediaControls* getMediaControlsStruct(bool transferOwnership = false)
49 	{
50 		if (transferOwnership)
51 			ownedRef = false;
52 		return gtkMediaControls;
53 	}
54 
55 	/** the main Gtk struct as a void* */
56 	protected override void* getStruct()
57 	{
58 		return cast(void*)gtkMediaControls;
59 	}
60 
61 	/**
62 	 * Sets our main struct and passes it to the parent class.
63 	 */
64 	public this (GtkMediaControls* gtkMediaControls, bool ownedRef = false)
65 	{
66 		this.gtkMediaControls = gtkMediaControls;
67 		super(cast(GtkWidget*)gtkMediaControls, ownedRef);
68 	}
69 
70 
71 	/** */
72 	public static GType getType()
73 	{
74 		return gtk_media_controls_get_type();
75 	}
76 
77 	/**
78 	 * Creates a new `GtkMediaControls` managing the @stream passed to it.
79 	 *
80 	 * Params:
81 	 *     stream = a #GtkMediaStream to
82 	 *         manage or %NULL for none.
83 	 *
84 	 * Returns: a new `GtkMediaControls`
85 	 *
86 	 * Throws: ConstructionException GTK+ fails to create the object.
87 	 */
88 	public this(MediaStream stream)
89 	{
90 		auto __p = gtk_media_controls_new((stream is null) ? null : stream.getMediaStreamStruct());
91 
92 		if(__p is null)
93 		{
94 			throw new ConstructionException("null returned by new");
95 		}
96 
97 		this(cast(GtkMediaControls*) __p);
98 	}
99 
100 	/**
101 	 * Gets the media stream managed by @controls or %NULL if none.
102 	 *
103 	 * Returns: The media stream managed by @controls
104 	 */
105 	public MediaStream getMediaStream()
106 	{
107 		auto __p = gtk_media_controls_get_media_stream(gtkMediaControls);
108 
109 		if(__p is null)
110 		{
111 			return null;
112 		}
113 
114 		return ObjectG.getDObject!(MediaStream)(cast(GtkMediaStream*) __p);
115 	}
116 
117 	/**
118 	 * Sets the stream that is controlled by @controls.
119 	 *
120 	 * Params:
121 	 *     stream = a `GtkMediaStream`, or %NULL
122 	 */
123 	public void setMediaStream(MediaStream stream)
124 	{
125 		gtk_media_controls_set_media_stream(gtkMediaControls, (stream is null) ? null : stream.getMediaStreamStruct());
126 	}
127 }