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 	public static GType getType()
75 	{
76 		return g_menu_link_iter_get_type();
77 	}
78 
79 	/**
80 	 * Gets the name of the link at the current iterator position.
81 	 *
82 	 * The iterator is not advanced.
83 	 *
84 	 * Returns: the type of the link
85 	 *
86 	 * Since: 2.32
87 	 */
88 	public string getName()
89 	{
90 		return Str.toString(g_menu_link_iter_get_name(gMenuLinkIter));
91 	}
92 
93 	/**
94 	 * This function combines g_menu_link_iter_next() with
95 	 * g_menu_link_iter_get_name() and g_menu_link_iter_get_value().
96 	 *
97 	 * First the iterator is advanced to the next (possibly first) link.
98 	 * If that fails, then %FALSE is returned and there are no other effects.
99 	 *
100 	 * If successful, @out_link and @value are set to the name and #GMenuModel
101 	 * of the link that has just been advanced to.  At this point,
102 	 * g_menu_link_iter_get_name() and g_menu_link_iter_get_value() will return the
103 	 * same values again.
104 	 *
105 	 * The value returned in @out_link remains valid for as long as the iterator
106 	 * remains at the current position.  The value returned in @value must
107 	 * be unreffed using g_object_unref() when it is no longer in use.
108 	 *
109 	 * Params:
110 	 *     outLink = the name of the link
111 	 *     value = the linked #GMenuModel
112 	 *
113 	 * Returns: %TRUE on success, or %FALSE if there is no additional link
114 	 *
115 	 * Since: 2.32
116 	 */
117 	public bool getNext(out string outLink, out MenuModel value)
118 	{
119 		char* outoutLink = null;
120 		GMenuModel* outvalue = null;
121 		
122 		auto p = g_menu_link_iter_get_next(gMenuLinkIter, &outoutLink, &outvalue) != 0;
123 		
124 		outLink = Str.toString(outoutLink);
125 		value = ObjectG.getDObject!(MenuModel)(outvalue);
126 		
127 		return p;
128 	}
129 
130 	/**
131 	 * Gets the linked #GMenuModel at the current iterator position.
132 	 *
133 	 * The iterator is not advanced.
134 	 *
135 	 * Returns: the #GMenuModel that is linked to
136 	 *
137 	 * Since: 2.32
138 	 */
139 	public MenuModel getValue()
140 	{
141 		auto p = g_menu_link_iter_get_value(gMenuLinkIter);
142 		
143 		if(p is null)
144 		{
145 			return null;
146 		}
147 		
148 		return ObjectG.getDObject!(MenuModel)(cast(GMenuModel*) p, true);
149 	}
150 
151 	/**
152 	 * Attempts to advance the iterator to the next (possibly first)
153 	 * link.
154 	 *
155 	 * %TRUE is returned on success, or %FALSE if there are no more links.
156 	 *
157 	 * You must call this function when you first acquire the iterator to
158 	 * advance it to the first link (and determine if the first link exists
159 	 * at all).
160 	 *
161 	 * Returns: %TRUE on success, or %FALSE when there are no more links
162 	 *
163 	 * Since: 2.32
164 	 */
165 	public bool next()
166 	{
167 		return g_menu_link_iter_next(gMenuLinkIter) != 0;
168 	}
169 }