1 /*
2 * This file is part of d-dazzle.
3 *
4 * d-dazzle 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 * d-dazzle 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 d-dazzle; if not, write to the Free Software
17 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110, USA
18 */19 moduledazzle.Slider;
20 21 privateimportdazzle.c.functions;
22 publicimportdazzle.c.types;
23 privateimportglib.ConstructionException;
24 privateimportgobject.ObjectG;
25 privateimportgtk.BuildableIF;
26 privateimportgtk.BuildableT;
27 privateimportgtk.Container;
28 privateimportgtk.Widget;
29 30 31 /** */32 publicclassSlider : Container33 {
34 /** the main Gtk struct */35 protectedDzlSlider* dzlSlider;
36 37 /** Get the main Gtk struct */38 publicDzlSlider* getSliderStruct(booltransferOwnership = false)
39 {
40 if (transferOwnership)
41 ownedRef = false;
42 returndzlSlider;
43 }
44 45 /** the main Gtk struct as a void* */46 protectedoverridevoid* getStruct()
47 {
48 returncast(void*)dzlSlider;
49 }
50 51 /**
52 * Sets our main struct and passes it to the parent class.
53 */54 publicthis (DzlSlider* dzlSlider, boolownedRef = false)
55 {
56 this.dzlSlider = dzlSlider;
57 super(cast(GtkContainer*)dzlSlider, ownedRef);
58 }
59 60 61 /** */62 publicstaticGTypegetType()
63 {
64 returndzl_slider_get_type();
65 }
66 67 /** */68 publicthis()
69 {
70 autop = dzl_slider_new();
71 72 if(pisnull)
73 {
74 thrownewConstructionException("null returned by new");
75 }
76 77 this(cast(DzlSlider*) p);
78 }
79 80 /** */81 publicvoidaddSlider(Widgetwidget, DzlSliderPositionposition)
82 {
83 dzl_slider_add_slider(dzlSlider, (widgetisnull) ? null : widget.getWidgetStruct(), position);
84 }
85 86 /** */87 publicDzlSliderPositiongetPosition()
88 {
89 returndzl_slider_get_position(dzlSlider);
90 }
91 92 /** */93 publicvoidsetPosition(DzlSliderPositionposition)
94 {
95 dzl_slider_set_position(dzlSlider, position);
96 }
97 }