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 module dazzle.PreferencesGroup;
20 
21 private import dazzle.PatternSpec;
22 private import dazzle.c.functions;
23 public  import dazzle.c.types;
24 private import glib.HashTable;
25 private import glib.Str;
26 private import gobject.ObjectG;
27 private import gtk.Bin;
28 private import gtk.BuildableIF;
29 private import gtk.BuildableT;
30 private import gtk.SizeGroup;
31 private import gtk.Widget;
32 
33 
34 /** */
35 public class PreferencesGroup : Bin
36 {
37 	/** the main Gtk struct */
38 	protected DzlPreferencesGroup* dzlPreferencesGroup;
39 
40 	/** Get the main Gtk struct */
41 	public DzlPreferencesGroup* getPreferencesGroupStruct(bool transferOwnership = false)
42 	{
43 		if (transferOwnership)
44 			ownedRef = false;
45 		return dzlPreferencesGroup;
46 	}
47 
48 	/** the main Gtk struct as a void* */
49 	protected override void* getStruct()
50 	{
51 		return cast(void*)dzlPreferencesGroup;
52 	}
53 
54 	/**
55 	 * Sets our main struct and passes it to the parent class.
56 	 */
57 	public this (DzlPreferencesGroup* dzlPreferencesGroup, bool ownedRef = false)
58 	{
59 		this.dzlPreferencesGroup = dzlPreferencesGroup;
60 		super(cast(GtkBin*)dzlPreferencesGroup, ownedRef);
61 	}
62 
63 
64 	/** */
65 	public static GType getType()
66 	{
67 		return dzl_preferences_group_get_type();
68 	}
69 
70 	/** */
71 	public override void add(Widget widget)
72 	{
73 		dzl_preferences_group_add(dzlPreferencesGroup, (widget is null) ? null : widget.getWidgetStruct());
74 	}
75 
76 	/** */
77 	public int getPriority()
78 	{
79 		return dzl_preferences_group_get_priority(dzlPreferencesGroup);
80 	}
81 
82 	/**
83 	 * Gets a size group that can be used to organize items in
84 	 * a group based on columns.
85 	 *
86 	 * Returns: a #GtkSizeGroup
87 	 */
88 	public SizeGroup getSizeGroup(uint column)
89 	{
90 		auto p = dzl_preferences_group_get_size_group(dzlPreferencesGroup, column);
91 
92 		if(p is null)
93 		{
94 			return null;
95 		}
96 
97 		return ObjectG.getDObject!(SizeGroup)(cast(GtkSizeGroup*) p);
98 	}
99 
100 	/** */
101 	public string getTitle()
102 	{
103 		return Str.toString(dzl_preferences_group_get_title(dzlPreferencesGroup));
104 	}
105 
106 	/** */
107 	public uint refilter(PatternSpec spec)
108 	{
109 		return dzl_preferences_group_refilter(dzlPreferencesGroup, (spec is null) ? null : spec.getPatternSpecStruct());
110 	}
111 
112 	/** */
113 	public void setMap(HashTable map)
114 	{
115 		dzl_preferences_group_set_map(dzlPreferencesGroup, (map is null) ? null : map.getHashTableStruct());
116 	}
117 }