1 module webkit2.OptionMenuItem;
2 
3 private import glib.Str;
4 private import gobject.ObjectG;
5 private import webkit2.c.functions;
6 public  import webkit2.c.types;
7 
8 
9 /**
10  * The #WebKitOptionMenu is composed of WebKitOptionMenuItem<!-- -->s.
11  * A WebKitOptionMenuItem always has a label and can contain a tooltip text.
12  * You can use the WebKitOptionMenuItem of a #WebKitOptionMenu to build your
13  * own menus.
14  *
15  * Since: 2.18
16  */
17 public class OptionMenuItem
18 {
19 	/** the main Gtk struct */
20 	protected WebKitOptionMenuItem* webKitOptionMenuItem;
21 	protected bool ownedRef;
22 
23 	/** Get the main Gtk struct */
24 	public WebKitOptionMenuItem* getOptionMenuItemStruct(bool transferOwnership = false)
25 	{
26 		if (transferOwnership)
27 			ownedRef = false;
28 		return webKitOptionMenuItem;
29 	}
30 
31 	/** the main Gtk struct as a void* */
32 	protected void* getStruct()
33 	{
34 		return cast(void*)webKitOptionMenuItem;
35 	}
36 
37 	/**
38 	 * Sets our main struct and passes it to the parent class.
39 	 */
40 	public this (WebKitOptionMenuItem* webKitOptionMenuItem, bool ownedRef = false)
41 	{
42 		this.webKitOptionMenuItem = webKitOptionMenuItem;
43 		this.ownedRef = ownedRef;
44 	}
45 
46 	~this ()
47 	{
48 		if ( ownedRef )
49 			webkit_option_menu_item_free(webKitOptionMenuItem);
50 	}
51 
52 
53 	/** */
54 	public static GType getType()
55 	{
56 		return webkit_option_menu_item_get_type();
57 	}
58 
59 	/**
60 	 * Make a copy of the #WebKitOptionMenuItem.
61 	 *
62 	 * Returns: A copy of passed in #WebKitOptionMenuItem
63 	 *
64 	 * Since: 2.18
65 	 */
66 	public OptionMenuItem copy()
67 	{
68 		auto __p = webkit_option_menu_item_copy(webKitOptionMenuItem);
69 
70 		if(__p is null)
71 		{
72 			return null;
73 		}
74 
75 		return ObjectG.getDObject!(OptionMenuItem)(cast(WebKitOptionMenuItem*) __p, true);
76 	}
77 
78 	/**
79 	 * Free the #WebKitOptionMenuItem.
80 	 *
81 	 * Since: 2.18
82 	 */
83 	public void free()
84 	{
85 		webkit_option_menu_item_free(webKitOptionMenuItem);
86 		ownedRef = false;
87 	}
88 
89 	/**
90 	 * Get the label of a #WebKitOptionMenuItem.
91 	 *
92 	 * Returns: The label of @item.
93 	 *
94 	 * Since: 2.18
95 	 */
96 	public string getLabel()
97 	{
98 		return Str.toString(webkit_option_menu_item_get_label(webKitOptionMenuItem));
99 	}
100 
101 	/**
102 	 * Get the tooltip of a #WebKitOptionMenuItem.
103 	 *
104 	 * Returns: The tooltip of @item, or %NULL.
105 	 *
106 	 * Since: 2.18
107 	 */
108 	public string getTooltip()
109 	{
110 		return Str.toString(webkit_option_menu_item_get_tooltip(webKitOptionMenuItem));
111 	}
112 
113 	/**
114 	 * Whether a #WebKitOptionMenuItem is enabled.
115 	 *
116 	 * Returns: %TRUE if the @item is enabled or %FALSE otherwise.
117 	 *
118 	 * Since: 2.18
119 	 */
120 	public bool isEnabled()
121 	{
122 		return webkit_option_menu_item_is_enabled(webKitOptionMenuItem) != 0;
123 	}
124 
125 	/**
126 	 * Whether a #WebKitOptionMenuItem is a group child.
127 	 *
128 	 * Returns: %TRUE if the @item is a group child or %FALSE otherwise.
129 	 *
130 	 * Since: 2.18
131 	 */
132 	public bool isGroupChild()
133 	{
134 		return webkit_option_menu_item_is_group_child(webKitOptionMenuItem) != 0;
135 	}
136 
137 	/**
138 	 * Whether a #WebKitOptionMenuItem is a group label.
139 	 *
140 	 * Returns: %TRUE if the @item is a group label or %FALSE otherwise.
141 	 *
142 	 * Since: 2.18
143 	 */
144 	public bool isGroupLabel()
145 	{
146 		return webkit_option_menu_item_is_group_label(webKitOptionMenuItem) != 0;
147 	}
148 
149 	/**
150 	 * Whether a #WebKitOptionMenuItem is the currently selected one.
151 	 *
152 	 * Returns: %TRUE if the @item is selected or %FALSE otherwise.
153 	 *
154 	 * Since: 2.18
155 	 */
156 	public bool isSelected()
157 	{
158 		return webkit_option_menu_item_is_selected(webKitOptionMenuItem) != 0;
159 	}
160 }