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