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  * Conversion parameters:
26  * inFile  = GtkCheckButton.html
27  * outPack = gtk
28  * outFile = CheckButton
29  * strct   = GtkCheckButton
30  * realStrct=
31  * ctorStrct=
32  * clss    = CheckButton
33  * interf  = 
34  * class Code: Yes
35  * interface Code: No
36  * template for:
37  * extend  = 
38  * implements:
39  * prefixes:
40  * 	- gtk_check_button_
41  * 	- gtk_
42  * omit structs:
43  * omit prefixes:
44  * omit code:
45  * 	- gtk_check_button_new_with_label
46  * 	- gtk_check_button_new_with_mnemonic
47  * omit signals:
48  * imports:
49  * 	- glib.Str
50  * 	- gtk.Button
51  * structWrap:
52  * module aliases:
53  * local aliases:
54  * overrides:
55  */
56 
57 module gtk.CheckButton;
58 
59 public  import gtkc.gtktypes;
60 
61 private import gtkc.gtk;
62 private import glib.ConstructionException;
63 private import gobject.ObjectG;
64 
65 
66 private import glib.Str;
67 private import gtk.Button;
68 
69 
70 
71 private import gtk.ToggleButton;
72 
73 /**
74  * Description
75  * A GtkCheckButton places a discrete GtkToggleButton next to a widget, (usually a GtkLabel). See the section on GtkToggleButton widgets for more information about toggle/check buttons.
76  * The important signal ('toggled') is also inherited from GtkToggleButton.
77  */
78 public class CheckButton : ToggleButton
79 {
80 	
81 	/** the main Gtk struct */
82 	protected GtkCheckButton* gtkCheckButton;
83 	
84 	
85 	public GtkCheckButton* getCheckButtonStruct()
86 	{
87 		return gtkCheckButton;
88 	}
89 	
90 	
91 	/** the main Gtk struct as a void* */
92 	protected override void* getStruct()
93 	{
94 		return cast(void*)gtkCheckButton;
95 	}
96 	
97 	/**
98 	 * Sets our main struct and passes it to the parent class
99 	 */
100 	public this (GtkCheckButton* gtkCheckButton)
101 	{
102 		super(cast(GtkToggleButton*)gtkCheckButton);
103 		this.gtkCheckButton = gtkCheckButton;
104 	}
105 	
106 	protected override void setStruct(GObject* obj)
107 	{
108 		super.setStruct(obj);
109 		gtkCheckButton = cast(GtkCheckButton*)obj;
110 	}
111 	
112 	/**
113 	 * Creates a new GtkCheckButton with a GtkLabel to the right of it.
114 	 * If mnemonic is true the label
115 	 * will be created using gtk_label_new_with_mnemonic(), so underscores
116 	 * in label indicate the mnemonic for the check button.
117 	 * Params:
118 	 *  label = The text of the button, with an underscore in front of the
119 	 *  mnemonic character
120 	 *  mnemonic = true if the button has an mnemnonic
121 	 * Throws: ConstructionException GTK+ fails to create the object.
122 	 */
123 	public this (string label, bool mnemonic=true)
124 	{
125 		GtkCheckButton* p;
126 		
127 		if ( mnemonic )
128 		{
129 			// GtkWidget* gtk_check_button_new_with_mnemonic  (const gchar *label);
130 			p = cast(GtkCheckButton*)gtk_check_button_new_with_mnemonic(Str.toStringz(label));
131 		}
132 		else
133 		{
134 			// GtkWidget* gtk_check_button_new_with_label (const gchar *label);
135 			p = cast(GtkCheckButton*)gtk_check_button_new_with_label(Str.toStringz(label));
136 		}
137 		
138 		if(p is null)
139 		{
140 			throw new ConstructionException("null returned by gtk_check_button_new_");
141 		}
142 		
143 		this(p);
144 	}
145 	
146 	/** */
147 	public this(string label, void delegate(CheckButton) onClicked, bool mnemonic=true)
148 	{
149 		this(label, mnemonic);
150 		addOnClicked(cast(void delegate(Button))onClicked);
151 	}
152 	
153 	
154 	/**
155 	 */
156 	
157 	/**
158 	 * Creates a new GtkCheckButton.
159 	 * Throws: ConstructionException GTK+ fails to create the object.
160 	 */
161 	public this ()
162 	{
163 		// GtkWidget * gtk_check_button_new (void);
164 		auto p = gtk_check_button_new();
165 		if(p is null)
166 		{
167 			throw new ConstructionException("null returned by gtk_check_button_new()");
168 		}
169 		this(cast(GtkCheckButton*) p);
170 	}
171 }