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.WindowControls; 26 27 private import glib.ConstructionException; 28 private import glib.Str; 29 private import glib.c.functions; 30 private import gobject.ObjectG; 31 private import gtk.Widget; 32 private import gtk.c.functions; 33 public import gtk.c.types; 34 35 36 /** 37 * `GtkWindowControls` shows window frame controls. 38 * 39 * Typical window frame controls are minimize, maximize and close buttons, 40 * and the window icon. 41 * 42 * ![An example GtkWindowControls](windowcontrols.png) 43 * 44 * `GtkWindowControls` only displays start or end side of the controls (see 45 * [property@Gtk.WindowControls:side]), so it's intended to be always used 46 * in pair with another `GtkWindowControls` for the opposite side, for example: 47 * 48 * ```xml 49 * <object class="GtkBox"> 50 * <child> 51 * <object class="GtkWindowControls"> 52 * <property name="side">start</property> 53 * </object> 54 * </child> 55 * 56 * ... 57 * 58 * <child> 59 * <object class="GtkWindowControls"> 60 * <property name="side">end</property> 61 * </object> 62 * </child> 63 * </object> 64 * ``` 65 * 66 * # CSS nodes 67 * 68 * ``` 69 * windowcontrols 70 * ├── [image.icon] 71 * ├── [button.minimize] 72 * ├── [button.maximize] 73 * ╰── [button.close] 74 * ``` 75 * 76 * A `GtkWindowControls`' CSS node is called windowcontrols. It contains 77 * subnodes corresponding to each title button. Which of the title buttons 78 * exist and where they are placed exactly depends on the desktop environment 79 * and [property@Gtk.WindowControls:decoration-layout] value. 80 * 81 * When [property@Gtk.WindowControls:empty] is %TRUE, it gets the .empty 82 * style class. 83 * 84 * # Accessibility 85 * 86 * `GtkWindowControls` uses the %GTK_ACCESSIBLE_ROLE_GROUP role. 87 */ 88 public class WindowControls : Widget 89 { 90 /** the main Gtk struct */ 91 protected GtkWindowControls* gtkWindowControls; 92 93 /** Get the main Gtk struct */ 94 public GtkWindowControls* getWindowControlsStruct(bool transferOwnership = false) 95 { 96 if (transferOwnership) 97 ownedRef = false; 98 return gtkWindowControls; 99 } 100 101 /** the main Gtk struct as a void* */ 102 protected override void* getStruct() 103 { 104 return cast(void*)gtkWindowControls; 105 } 106 107 /** 108 * Sets our main struct and passes it to the parent class. 109 */ 110 public this (GtkWindowControls* gtkWindowControls, bool ownedRef = false) 111 { 112 this.gtkWindowControls = gtkWindowControls; 113 super(cast(GtkWidget*)gtkWindowControls, ownedRef); 114 } 115 116 117 /** */ 118 public static GType getType() 119 { 120 return gtk_window_controls_get_type(); 121 } 122 123 /** 124 * Creates a new `GtkWindowControls`. 125 * 126 * Params: 127 * side = the side 128 * 129 * Returns: a new `GtkWindowControls`. 130 * 131 * Throws: ConstructionException GTK+ fails to create the object. 132 */ 133 public this(GtkPackType side) 134 { 135 auto __p = gtk_window_controls_new(side); 136 137 if(__p is null) 138 { 139 throw new ConstructionException("null returned by new"); 140 } 141 142 this(cast(GtkWindowControls*) __p); 143 } 144 145 /** 146 * Gets the decoration layout of this `GtkWindowControls`. 147 * 148 * Returns: the decoration layout or %NULL if it is unset 149 */ 150 public string getDecorationLayout() 151 { 152 return Str.toString(gtk_window_controls_get_decoration_layout(gtkWindowControls)); 153 } 154 155 /** 156 * Gets whether the widget has any window buttons. 157 * 158 * Returns: %TRUE if the widget has window buttons, otherwise %FALSE 159 */ 160 public bool getEmpty() 161 { 162 return gtk_window_controls_get_empty(gtkWindowControls) != 0; 163 } 164 165 /** 166 * Gets the side to which this `GtkWindowControls` instance belongs. 167 * 168 * Returns: the side 169 */ 170 public GtkPackType getSide() 171 { 172 return gtk_window_controls_get_side(gtkWindowControls); 173 } 174 175 /** 176 * Sets the decoration layout for the title buttons. 177 * 178 * This overrides the [property@Gtk.Settings:gtk-decoration-layout] 179 * setting. 180 * 181 * The format of the string is button names, separated by commas. 182 * A colon separates the buttons that should appear on the left 183 * from those on the right. Recognized button names are minimize, 184 * maximize, close and icon (the window icon). 185 * 186 * For example, “icon:minimize,maximize,close” specifies a icon 187 * on the left, and minimize, maximize and close buttons on the right. 188 * 189 * If [property@Gtk.WindowControls:side] value is @GTK_PACK_START, @self 190 * will display the part before the colon, otherwise after that. 191 * 192 * Params: 193 * layout = a decoration layout, or %NULL to 194 * unset the layout 195 */ 196 public void setDecorationLayout(string layout) 197 { 198 gtk_window_controls_set_decoration_layout(gtkWindowControls, Str.toStringz(layout)); 199 } 200 201 /** 202 * Determines which part of decoration layout the `GtkWindowControls` uses. 203 * 204 * See [property@Gtk.WindowControls:decoration-layout]. 205 * 206 * Params: 207 * side = a side 208 */ 209 public void setSide(GtkPackType side) 210 { 211 gtk_window_controls_set_side(gtkWindowControls, side); 212 } 213 }