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.RootT; 26 27 public import gdk.Display; 28 public import gobject.ObjectG; 29 public import gtk.Widget; 30 public import gtk.c.functions; 31 public import gtk.c.types; 32 33 34 /** 35 * `GtkRoot` is the interface implemented by all widgets that can act as a toplevel 36 * widget. 37 * 38 * The root widget takes care of providing the connection to the windowing system 39 * and manages layout, drawing and event delivery for its widget hierarchy. 40 * 41 * The obvious example of a `GtkRoot` is `GtkWindow`. 42 * 43 * To get the display to which a `GtkRoot` belongs, use 44 * [method@Gtk.Root.get_display]. 45 * 46 * `GtkRoot` also maintains the location of keyboard focus inside its widget 47 * hierarchy, with [method@Gtk.Root.set_focus] and [method@Gtk.Root.get_focus]. 48 */ 49 public template RootT(TStruct) 50 { 51 /** Get the main Gtk struct */ 52 public GtkRoot* getRootStruct(bool transferOwnership = false) 53 { 54 if (transferOwnership) 55 ownedRef = false; 56 return cast(GtkRoot*)getStruct(); 57 } 58 59 60 /** 61 * Returns the display that this `GtkRoot` is on. 62 * 63 * Returns: the display of @root 64 */ 65 public Display getDisplayRoot() 66 { 67 auto __p = gtk_root_get_display(getRootStruct()); 68 69 if(__p is null) 70 { 71 return null; 72 } 73 74 return ObjectG.getDObject!(Display)(cast(GdkDisplay*) __p); 75 } 76 77 /** 78 * Retrieves the current focused widget within the root. 79 * 80 * Note that this is the widget that would have the focus 81 * if the root is active; if the root is not focused then 82 * `gtk_widget_has_focus (widget)` will be %FALSE for the 83 * widget. 84 * 85 * Returns: the currently focused 86 * widget, or %NULL if there is none. 87 */ 88 public Widget getFocus() 89 { 90 auto __p = gtk_root_get_focus(getRootStruct()); 91 92 if(__p is null) 93 { 94 return null; 95 } 96 97 return ObjectG.getDObject!(Widget)(cast(GtkWidget*) __p); 98 } 99 100 /** 101 * If @focus is not the current focus widget, and is focusable, sets 102 * it as the focus widget for the root. 103 * 104 * If @focus is %NULL, unsets the focus widget for the root. 105 * 106 * To set the focus to a particular widget in the root, it is usually 107 * more convenient to use [method@Gtk.Widget.grab_focus] instead of 108 * this function. 109 * 110 * Params: 111 * focus = widget to be the new focus widget, or %NULL 112 * to unset the focus widget 113 */ 114 public void setFocus(Widget focus) 115 { 116 gtk_root_set_focus(getRootStruct(), (focus is null) ? null : focus.getWidgetStruct()); 117 } 118 }