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 * # CSS nodes 46 * 47 * |[<!-- language="plain" --> 48 * checkbutton 49 * ├── check 50 * ╰── <child> 51 * ]| 52 * 53 * A GtkCheckButton with indicator (see gtk_toggle_button_set_mode()) has a 54 * main CSS node with name checkbutton and a subnode with name check. 55 * 56 * |[<!-- language="plain" --> 57 * button.check 58 * ├── check 59 * ╰── <child> 60 * ]| 61 * 62 * A GtkCheckButton without indicator changes the name of its main node 63 * to button and adds a .check style class to it. The subnode is invisible 64 * in this case. 65 */ 66 public class CheckButton : ToggleButton 67 { 68 /** the main Gtk struct */ 69 protected GtkCheckButton* gtkCheckButton; 70 71 /** Get the main Gtk struct */ 72 public GtkCheckButton* getCheckButtonStruct() 73 { 74 return gtkCheckButton; 75 } 76 77 /** the main Gtk struct as a void* */ 78 protected override void* getStruct() 79 { 80 return cast(void*)gtkCheckButton; 81 } 82 83 protected override void setStruct(GObject* obj) 84 { 85 gtkCheckButton = cast(GtkCheckButton*)obj; 86 super.setStruct(obj); 87 } 88 89 /** 90 * Sets our main struct and passes it to the parent class. 91 */ 92 public this (GtkCheckButton* gtkCheckButton, bool ownedRef = false) 93 { 94 this.gtkCheckButton = gtkCheckButton; 95 super(cast(GtkToggleButton*)gtkCheckButton, ownedRef); 96 } 97 98 /** 99 * Creates a new GtkCheckButton with a GtkLabel to the right of it. 100 * If mnemonic is true the label 101 * will be created using gtk_label_new_with_mnemonic(), so underscores 102 * in label indicate the mnemonic for the check button. 103 * Params: 104 * label = The text of the button, with an underscore in front of the 105 * mnemonic character 106 * mnemonic = true if the button has an mnemnonic 107 * Throws: ConstructionException GTK+ fails to create the object. 108 */ 109 public this (string label, bool mnemonic=true) 110 { 111 GtkCheckButton* p; 112 113 if ( mnemonic ) 114 { 115 // GtkWidget* gtk_check_button_new_with_mnemonic (const gchar *label); 116 p = cast(GtkCheckButton*)gtk_check_button_new_with_mnemonic(Str.toStringz(label)); 117 } 118 else 119 { 120 // GtkWidget* gtk_check_button_new_with_label (const gchar *label); 121 p = cast(GtkCheckButton*)gtk_check_button_new_with_label(Str.toStringz(label)); 122 } 123 124 if(p is null) 125 { 126 throw new ConstructionException("null returned by gtk_check_button_new_"); 127 } 128 129 this(p); 130 } 131 132 /** */ 133 public this(string label, void delegate(CheckButton) onClicked, bool mnemonic=true) 134 { 135 this(label, mnemonic); 136 addOnClicked(cast(void delegate(Button))onClicked); 137 } 138 139 /** 140 */ 141 142 /** */ 143 public static GType getType() 144 { 145 return gtk_check_button_get_type(); 146 } 147 148 /** 149 * Creates a new #GtkCheckButton. 150 * 151 * Returns: a #GtkWidget. 152 * 153 * Throws: ConstructionException GTK+ fails to create the object. 154 */ 155 public this() 156 { 157 auto p = gtk_check_button_new(); 158 159 if(p is null) 160 { 161 throw new ConstructionException("null returned by new"); 162 } 163 164 this(cast(GtkCheckButton*) p); 165 } 166 }