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 gio.MenuLinkIter;
26 
27 private import gio.MenuModel;
28 private import glib.Str;
29 private import gobject.ObjectG;
30 private import gtkc.gio;
31 public  import gtkc.giotypes;
32 
33 
34 /**
35  * #GMenuLinkIter is an opaque structure type.  You must access it using
36  * the functions below.
37  *
38  * Since: 2.32
39  */
40 public class MenuLinkIter : ObjectG
41 {
42 	/** the main Gtk struct */
43 	protected GMenuLinkIter* gMenuLinkIter;
44 
45 	/** Get the main Gtk struct */
46 	public GMenuLinkIter* getMenuLinkIterStruct()
47 	{
48 		return gMenuLinkIter;
49 	}
50 
51 	/** the main Gtk struct as a void* */
52 	protected override void* getStruct()
53 	{
54 		return cast(void*)gMenuLinkIter;
55 	}
56 
57 	protected override void setStruct(GObject* obj)
58 	{
59 		gMenuLinkIter = cast(GMenuLinkIter*)obj;
60 		super.setStruct(obj);
61 	}
62 
63 	/**
64 	 * Sets our main struct and passes it to the parent class.
65 	 */
66 	public this (GMenuLinkIter* gMenuLinkIter, bool ownedRef = false)
67 	{
68 		this.gMenuLinkIter = gMenuLinkIter;
69 		super(cast(GObject*)gMenuLinkIter, ownedRef);
70 	}
71 
72 	/**
73 	 */
74 
75 	public static GType getType()
76 	{
77 		return g_menu_link_iter_get_type();
78 	}
79 
80 	/**
81 	 * Gets the name of the link at the current iterator position.
82 	 *
83 	 * The iterator is not advanced.
84 	 *
85 	 * Return: the type of the link
86 	 *
87 	 * Since: 2.32
88 	 */
89 	public string getName()
90 	{
91 		return Str.toString(g_menu_link_iter_get_name(gMenuLinkIter));
92 	}
93 
94 	/**
95 	 * This function combines g_menu_link_iter_next() with
96 	 * g_menu_link_iter_get_name() and g_menu_link_iter_get_value().
97 	 *
98 	 * First the iterator is advanced to the next (possibly first) link.
99 	 * If that fails, then %FALSE is returned and there are no other effects.
100 	 *
101 	 * If successful, @out_link and @value are set to the name and #GMenuModel
102 	 * of the link that has just been advanced to.  At this point,
103 	 * g_menu_link_iter_get_name() and g_menu_link_iter_get_value() will return the
104 	 * same values again.
105 	 *
106 	 * The value returned in @out_link remains valid for as long as the iterator
107 	 * remains at the current position.  The value returned in @value must
108 	 * be unreffed using g_object_unref() when it is no longer in use.
109 	 *
110 	 * Params:
111 	 *     outLink = the name of the link
112 	 *     value = the linked #GMenuModel
113 	 *
114 	 * Return: %TRUE on success, or %FALSE if there is no additional link
115 	 *
116 	 * Since: 2.32
117 	 */
118 	public bool getNext(out string outLink, out MenuModel value)
119 	{
120 		char* outoutLink = null;
121 		GMenuModel* outvalue = null;
122 		
123 		auto p = g_menu_link_iter_get_next(gMenuLinkIter, &outoutLink, &outvalue) != 0;
124 		
125 		outLink = Str.toString(outoutLink);
126 		value = ObjectG.getDObject!(MenuModel)(outvalue);
127 		
128 		return p;
129 	}
130 
131 	/**
132 	 * Gets the linked #GMenuModel at the current iterator position.
133 	 *
134 	 * The iterator is not advanced.
135 	 *
136 	 * Return: the #GMenuModel that is linked to
137 	 *
138 	 * Since: 2.32
139 	 */
140 	public MenuModel getValue()
141 	{
142 		auto p = g_menu_link_iter_get_value(gMenuLinkIter);
143 		
144 		if(p is null)
145 		{
146 			return null;
147 		}
148 		
149 		return ObjectG.getDObject!(MenuModel)(cast(GMenuModel*) p, true);
150 	}
151 
152 	/**
153 	 * Attempts to advance the iterator to the next (possibly first)
154 	 * link.
155 	 *
156 	 * %TRUE is returned on success, or %FALSE if there are no more links.
157 	 *
158 	 * You must call this function when you first acquire the iterator to
159 	 * advance it to the first link (and determine if the first link exists
160 	 * at all).
161 	 *
162 	 * Return: %TRUE on success, or %FALSE when there are no more links
163 	 *
164 	 * Since: 2.32
165 	 */
166 	public bool next()
167 	{
168 		return g_menu_link_iter_next(gMenuLinkIter) != 0;
169 	}
170 }