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