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