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.ModelButton; 26 27 private import glib.ConstructionException; 28 private import gobject.ObjectG; 29 private import gtk.Button; 30 private import gtk.Widget; 31 private import gtkc.gtk; 32 public import gtkc.gtktypes; 33 34 35 /** 36 * GtkModelButton is a button class that can use a #GAction as its model. 37 * In contrast to #GtkToggleButton or #GtkRadioButton, which can also 38 * be backed by a #GAction via the #GtkActionable:action-name property, 39 * GtkModelButton will adapt its appearance according to the kind of 40 * action it is backed by, and appear either as a plain, check or 41 * radio button. 42 * 43 * Model buttons are used when popovers from a menu model with 44 * gtk_popover_new_from_model(); they can also be used manually in 45 * a #GtkPopoverMenu. 46 * 47 * When the action is specified via the #GtkActionable:action-name 48 * and #GtkActionable:action-target properties, the role of the button 49 * (i.e. whether it is a plain, check or radio button) is determined by 50 * the type of the action and doesn't have to be explicitly specified 51 * with the #GtkModelButton:role property. 52 * 53 * The content of the button is specified by the #GtkModelButton:text 54 * and #GtkModelButton:icon properties. 55 * 56 * The appearance of model buttons can be influenced with the 57 * #GtkModelButton:centered and #GtkModelButton:iconic properties. 58 * 59 * Model buttons have built-in support for submenus in #GtkPopoverMenu. 60 * To make a GtkModelButton that opens a submenu when activated, set 61 * the #GtkModelButton:menu-name property. To make a button that goes 62 * back to the parent menu, you should set the #GtkModelButton:inverted 63 * property to place the submenu indicator at the opposite side. 64 * 65 * # Example 66 * 67 * |[ 68 * <object class="GtkPopoverMenu"> 69 * <child> 70 * <object class="GtkBox"> 71 * <property name="visible">True</property> 72 * <property name="margin">10</property> 73 * <child> 74 * <object class="GtkModelButton"> 75 * <property name="visible">True</property> 76 * <property name="action-name">view.cut</property> 77 * <property name="text" translatable="yes">Cut</property> 78 * </object> 79 * </child> 80 * <child> 81 * <object class="GtkModelButton"> 82 * <property name="visible">True</property> 83 * <property name="action-name">view.copy</property> 84 * <property name="text" translatable="yes">Copy</property> 85 * </object> 86 * </child> 87 * <child> 88 * <object class="GtkModelButton"> 89 * <property name="visible">True</property> 90 * <property name="action-name">view.paste</property> 91 * <property name="text" translatable="yes">Paste</property> 92 * </object> 93 * </child> 94 * </object> 95 * </child> 96 * </object> 97 * ]| 98 */ 99 public class ModelButton : Button 100 { 101 /** the main Gtk struct */ 102 protected GtkModelButton* gtkModelButton; 103 104 /** Get the main Gtk struct */ 105 public GtkModelButton* getModelButtonStruct() 106 { 107 return gtkModelButton; 108 } 109 110 /** the main Gtk struct as a void* */ 111 protected override void* getStruct() 112 { 113 return cast(void*)gtkModelButton; 114 } 115 116 protected override void setStruct(GObject* obj) 117 { 118 gtkModelButton = cast(GtkModelButton*)obj; 119 super.setStruct(obj); 120 } 121 122 /** 123 * Sets our main struct and passes it to the parent class. 124 */ 125 public this (GtkModelButton* gtkModelButton, bool ownedRef = false) 126 { 127 this.gtkModelButton = gtkModelButton; 128 super(cast(GtkButton*)gtkModelButton, ownedRef); 129 } 130 131 /** 132 */ 133 134 public static GType getType() 135 { 136 return gtk_model_button_get_type(); 137 } 138 139 /** 140 * Creates a new GtkModelButton. 141 * 142 * Return: the newly created #GtkModelButton widget 143 * 144 * Since: 3.16 145 * 146 * Throws: ConstructionException GTK+ fails to create the object. 147 */ 148 public this() 149 { 150 auto p = gtk_model_button_new(); 151 152 if(p is null) 153 { 154 throw new ConstructionException("null returned by new"); 155 } 156 157 this(cast(GtkModelButton*) p); 158 } 159 }