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 module gtk.CheckButton; 26 27 private import glib.ConstructionException; 28 private import glib.Str; 29 private import gobject.ObjectG; 30 private import gtk.Button; 31 private import gtk.ToggleButton; 32 private import gtk.Widget; 33 private import gtkc.gtk; 34 public import gtkc.gtktypes; 35 36 37 /** 38 * A #GtkCheckButton places a discrete #GtkToggleButton next to a widget, 39 * (usually a #GtkLabel). See the section on #GtkToggleButton widgets for 40 * more information about toggle/check buttons. 41 * 42 * The important signal ( #GtkToggleButton::toggled ) is also inherited from 43 * #GtkToggleButton. 44 */ 45 public class CheckButton : ToggleButton 46 { 47 /** the main Gtk struct */ 48 protected GtkCheckButton* gtkCheckButton; 49 50 /** Get the main Gtk struct */ 51 public GtkCheckButton* getCheckButtonStruct() 52 { 53 return gtkCheckButton; 54 } 55 56 /** the main Gtk struct as a void* */ 57 protected override void* getStruct() 58 { 59 return cast(void*)gtkCheckButton; 60 } 61 62 protected override void setStruct(GObject* obj) 63 { 64 gtkCheckButton = cast(GtkCheckButton*)obj; 65 super.setStruct(obj); 66 } 67 68 /** 69 * Sets our main struct and passes it to the parent class. 70 */ 71 public this (GtkCheckButton* gtkCheckButton, bool ownedRef = false) 72 { 73 this.gtkCheckButton = gtkCheckButton; 74 super(cast(GtkToggleButton*)gtkCheckButton, ownedRef); 75 } 76 77 /** 78 * Creates a new GtkCheckButton with a GtkLabel to the right of it. 79 * If mnemonic is true the label 80 * will be created using gtk_label_new_with_mnemonic(), so underscores 81 * in label indicate the mnemonic for the check button. 82 * Params: 83 * label = The text of the button, with an underscore in front of the 84 * mnemonic character 85 * mnemonic = true if the button has an mnemnonic 86 * Throws: ConstructionException GTK+ fails to create the object. 87 */ 88 public this (string label, bool mnemonic=true) 89 { 90 GtkCheckButton* p; 91 92 if ( mnemonic ) 93 { 94 // GtkWidget* gtk_check_button_new_with_mnemonic (const gchar *label); 95 p = cast(GtkCheckButton*)gtk_check_button_new_with_mnemonic(Str.toStringz(label)); 96 } 97 else 98 { 99 // GtkWidget* gtk_check_button_new_with_label (const gchar *label); 100 p = cast(GtkCheckButton*)gtk_check_button_new_with_label(Str.toStringz(label)); 101 } 102 103 if(p is null) 104 { 105 throw new ConstructionException("null returned by gtk_check_button_new_"); 106 } 107 108 this(p); 109 } 110 111 /** */ 112 public this(string label, void delegate(CheckButton) onClicked, bool mnemonic=true) 113 { 114 this(label, mnemonic); 115 addOnClicked(cast(void delegate(Button))onClicked); 116 } 117 118 /** 119 */ 120 121 /** */ 122 public static GType getType() 123 { 124 return gtk_check_button_get_type(); 125 } 126 127 /** 128 * Creates a new #GtkCheckButton. 129 * 130 * Return: a #GtkWidget. 131 * 132 * Throws: ConstructionException GTK+ fails to create the object. 133 */ 134 public this() 135 { 136 auto p = gtk_check_button_new(); 137 138 if(p is null) 139 { 140 throw new ConstructionException("null returned by new"); 141 } 142 143 this(cast(GtkCheckButton*) p); 144 } 145 }