Debian Codegraph @

gtk/gtklistitemwidget.c

raw symbols SCIP
1 /*
2 * Copyright © 2018 Benjamin Otte
3 *
4 * This library is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Lesser General Public
6 * License as published by the Free Software Foundation; either
7 * version 2.1 of the License, or (at your option) any later version.
8 *
9 * This library is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * Lesser General Public License for more details.
13 *
14 * You should have received a copy of the GNU Lesser General Public
15 * License along with this library. If not, see <http://www.gnu.org/licenses/>.
16 *
17 * Authors: Benjamin Otte <[email protected]>
18 */
19
20 #include "config.h"cxx . . $ `<file>/build/config.h`/
21
22 #include "gtklistitemwidgetprivate.h"cxx . . $ `<file>/gtk/gtklistitemwidgetprivate.h`/
23
24 #include "gtkbinlayout.h"cxx . . $ `<file>/gtk/gtkbinlayout.h`/
25 #include "gtkeventcontrollermotion.h"cxx . . $ `<file>/gtk/gtkeventcontrollermotion.h`/
26 #include "gtkgestureclick.h"cxx . . $ `<file>/gtk/gtkgestureclick.h`/
27 #include "gtklistitemfactoryprivate.h"cxx . . $ `<file>/gtk/gtklistitemfactoryprivate.h`/
28 #include "gtklistitemprivate.h"cxx . . $ `<file>/gtk/gtklistitemprivate.h`/
29 #include "gtklistbaseprivate.h"cxx . . $ `<file>/gtk/gtklistbaseprivate.h`/
30 #include "gtkwidget.h"cxx . . $ `<file>/gtk/gtkwidget.h`/
31 #include "gtkwidgetprivate.h"cxx . . $ `<file>/gtk/gtkwidgetprivate.h`/
32
33 G_DEFINE_TYPEcxx . . $ `<external>/9567554376676449156/gtype.h:1834:9`! (GtkListItemWidget, gtk_list_item_widget, GTK_TYPE_LIST_FACTORY_WIDGETcxx . . $ `gtk/gtklistfactorywidgetprivate.h:28:9`!)
34
35 static gbooleancxx . . $ gboolean#
36 gtk_list_item_widget_focuscxx . . $ gtk_list_item_widget_focus(8bb1c65c821a69cd). (GtkWidgetcxx . . $ GtkWidget# *widget,
37 GtkDirectionTypecxx . . $ GtkDirectionType# direction)
38 {
39 GtkWidgetcxx . . $ GtkWidget# *child = gtk_widget_get_first_childcxx . . $ gtk_widget_get_first_child(ef973e1b01680070). (widget);
40 GtkWidgetcxx . . $ GtkWidget# *focus_child = gtk_widget_get_focus_childcxx . . $ gtk_widget_get_focus_child(ef973e1b01680070). (widget);
41
42 if (focus_child)
43 {
44 /* focus is in the child */
45 if (gtk_widget_child_focuscxx . . $ gtk_widget_child_focus(8bb1c65c821a69cd). (focus_child, direction))
46 return TRUEcxx . . $ `<external>/12741050725406041920/gmacros.h:971:9`!;
47 else if (direction == GTK_DIR_TAB_BACKWARDcxx . . $ GTK_DIR_TAB_BACKWARD.)
48 return gtk_widget_grab_focus_selfcxx . . $ gtk_widget_grab_focus_self(9247ef2dc26c5426). (widget);
49 else
50 return FALSEcxx . . $ `<external>/12741050725406041920/gmacros.h:967:9`!;
51 }
52 else if (gtk_widget_is_focuscxx . . $ gtk_widget_is_focus(9247ef2dc26c5426). (widget))
53 {
54 /* The widget has focus */
55 if (direction == GTK_DIR_TAB_FORWARDcxx . . $ GTK_DIR_TAB_FORWARD.)
56 {
57 if (child)
58 return gtk_widget_child_focuscxx . . $ gtk_widget_child_focus(8bb1c65c821a69cd). (child, direction);
59 }
60
61 return FALSEcxx . . $ `<external>/12741050725406041920/gmacros.h:967:9`!;
62 }
63 else
64 {
65 /* focus coming in from the outside */
66 if (direction == GTK_DIR_TAB_BACKWARDcxx . . $ GTK_DIR_TAB_BACKWARD.)
67 {
68 if (child &&
69 gtk_widget_child_focuscxx . . $ gtk_widget_child_focus(8bb1c65c821a69cd). (child, direction))
70 return TRUEcxx . . $ `<external>/12741050725406041920/gmacros.h:971:9`!;
71
72 return gtk_widget_grab_focus_selfcxx . . $ gtk_widget_grab_focus_self(9247ef2dc26c5426). (widget);
73 }
74 else
75 {
76 if (gtk_widget_grab_focus_selfcxx . . $ gtk_widget_grab_focus_self(9247ef2dc26c5426). (widget))
77 return TRUEcxx . . $ `<external>/12741050725406041920/gmacros.h:971:9`!;
78
79 if (child &&
80 gtk_widget_child_focuscxx . . $ gtk_widget_child_focus(8bb1c65c821a69cd). (child, direction))
81 return TRUEcxx . . $ `<external>/12741050725406041920/gmacros.h:971:9`!;
82
83 return FALSEcxx . . $ `<external>/12741050725406041920/gmacros.h:967:9`!;
84 }
85 }
86 }
87
88 static gbooleancxx . . $ gboolean#
89 gtk_list_item_widget_grab_focuscxx . . $ gtk_list_item_widget_grab_focus(9247ef2dc26c5426). (GtkWidgetcxx . . $ GtkWidget# *widget)
90 {
91 GtkWidgetcxx . . $ GtkWidget# *child;
92
93 if (GTK_WIDGET_CLASScxx . . $ `gtk/gtkwidget.h:45:9`! (gtk_list_item_widget_parent_class)->grab_focuscxx . . $ _GtkWidgetClass#grab_focus. (widget))
94 return TRUEcxx . . $ `<external>/12741050725406041920/gmacros.h:971:9`!;
95
96 child = gtk_widget_get_first_childcxx . . $ gtk_widget_get_first_child(ef973e1b01680070). (widget);
97 if (child && gtk_widget_grab_focuscxx . . $ gtk_widget_grab_focus(9247ef2dc26c5426). (child))
98 return TRUEcxx . . $ `<external>/12741050725406041920/gmacros.h:971:9`!;
99
100 return FALSEcxx . . $ `<external>/12741050725406041920/gmacros.h:967:9`!;
101 }
102
103 static gpointercxx . . $ gpointer#
104 gtk_list_item_widget_create_objectcxx . . $ gtk_list_item_widget_create_object(b74c42e358122988). (GtkListFactoryWidgetcxx . . $ GtkListFactoryWidget# *fw)
105 {
106 return gtk_list_item_newcxx . . $ gtk_list_item_new(b795c4b5600284b4). ();
107 }
108
109 static void
110 gtk_list_item_widget_setup_objectcxx . . $ gtk_list_item_widget_setup_object(8801c5424a7a2326). (GtkListFactoryWidgetcxx . . $ GtkListFactoryWidget# *fw,
111 gpointercxx . . $ gpointer# object)
112 {
113 GtkListItemWidgetcxx . . $ GtkListItemWidget# *self = GTK_LIST_ITEM_WIDGETcxx . . $ `gtk/gtklistitemwidgetprivate.h:27:9`! (fw);
114 GtkListItemcxx . . $ GtkListItem# *list_item = object;
115
116 GTK_LIST_FACTORY_WIDGET_CLASScxx . . $ `gtk/gtklistfactorywidgetprivate.h:30:9`! (gtk_list_item_widget_parent_class)->setup_objectcxx . . $ _GtkListFactoryWidgetClass#setup_object. (fw, object);
117
118 list_item->ownercxx . . $ _GtkListItem#owner. = self;
119
120 gtk_list_item_widget_set_childcxx . . $ gtk_list_item_widget_set_child(b82b183105509c19). (self, list_item->childcxx . . $ _GtkListItem#child.);
121
122 gtk_list_factory_widget_set_activatablecxx . . $ gtk_list_factory_widget_set_activatable(3dafe698869a395a). (fw, list_item->activatablecxx . . $ _GtkListItem#activatable.);
123 gtk_list_factory_widget_set_selectablecxx . . $ gtk_list_factory_widget_set_selectable(3dafe698869a395a). (fw, list_item->selectablecxx . . $ _GtkListItem#selectable.);
124 gtk_widget_set_focusablecxx . . $ gtk_widget_set_focusable(81f145f668a0074f). (GTK_WIDGETcxx . . $ `gtk/gtkwidget.h:44:9`! (self), list_item->focusablecxx . . $ _GtkListItem#focusable.);
125
126 gtk_accessible_update_propertycxx . . $ gtk_accessible_update_property(7f02be67e42032aa). (GTK_ACCESSIBLEcxx . . $ GTK_ACCESSIBLE(4ecffd44f086533a). (self),
127 GTK_ACCESSIBLE_PROPERTY_LABELcxx . . $ GTK_ACCESSIBLE_PROPERTY_LABEL., list_item->accessible_labelcxx . . $ _GtkListItem#accessible_label.,
128 GTK_ACCESSIBLE_PROPERTY_DESCRIPTIONcxx . . $ GTK_ACCESSIBLE_PROPERTY_DESCRIPTION., list_item->accessible_descriptioncxx . . $ _GtkListItem#accessible_description.,
129 -1);
130
131 gtk_list_item_do_notifycxx . . $ gtk_list_item_do_notify(4675f52f61c3414a). (list_item,
132 gtk_list_item_base_get_itemcxx . . $ gtk_list_item_base_get_item(65e6e49d8588e28f). (GTK_LIST_ITEM_BASEcxx . . $ `gtk/gtklistitembaseprivate.h:27:9`! (self)) != NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!,
133 gtk_list_item_base_get_positioncxx . . $ gtk_list_item_base_get_position(ce2bc36d78475c90). (GTK_LIST_ITEM_BASEcxx . . $ `gtk/gtklistitembaseprivate.h:27:9`! (self)) != GTK_INVALID_LIST_POSITIONcxx . . $ `gtk/gtktypes.h:79:9`!,
134 gtk_list_item_base_get_selectedcxx . . $ gtk_list_item_base_get_selected(713b57492acab63). (GTK_LIST_ITEM_BASEcxx . . $ `gtk/gtklistitembaseprivate.h:27:9`! (self)));
135 }
136
137 static void
138 gtk_list_item_widget_teardown_objectcxx . . $ gtk_list_item_widget_teardown_object(8801c5424a7a2326). (GtkListFactoryWidgetcxx . . $ GtkListFactoryWidget# *fw,
139 gpointercxx . . $ gpointer# object)
140 {
141 GtkListItemWidgetcxx . . $ GtkListItemWidget# *self = GTK_LIST_ITEM_WIDGETcxx . . $ `gtk/gtklistitemwidgetprivate.h:27:9`! (fw);
142 GtkListItemcxx . . $ GtkListItem# *list_item = object;
143
144 GTK_LIST_FACTORY_WIDGET_CLASScxx . . $ `gtk/gtklistfactorywidgetprivate.h:30:9`! (gtk_list_item_widget_parent_class)->teardown_objectcxx . . $ _GtkListFactoryWidgetClass#teardown_object. (fw, object);
145
146 list_item->ownercxx . . $ _GtkListItem#owner. = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!;
147
148 gtk_list_item_widget_set_childcxx . . $ gtk_list_item_widget_set_child(b82b183105509c19). (self, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!);
149
150 gtk_list_factory_widget_set_activatablecxx . . $ gtk_list_factory_widget_set_activatable(3dafe698869a395a). (fw, FALSEcxx . . $ `<external>/12741050725406041920/gmacros.h:967:9`!);
151 gtk_list_factory_widget_set_selectablecxx . . $ gtk_list_factory_widget_set_selectable(3dafe698869a395a). (fw, FALSEcxx . . $ `<external>/12741050725406041920/gmacros.h:967:9`!);
152 gtk_widget_set_focusablecxx . . $ gtk_widget_set_focusable(81f145f668a0074f). (GTK_WIDGETcxx . . $ `gtk/gtkwidget.h:44:9`! (self), TRUEcxx . . $ `<external>/12741050725406041920/gmacros.h:971:9`!);
153
154 gtk_accessible_reset_propertycxx . . $ gtk_accessible_reset_property(58234f89de8af20e). (GTK_ACCESSIBLEcxx . . $ GTK_ACCESSIBLE(4ecffd44f086533a). (self), GTK_ACCESSIBLE_PROPERTY_LABELcxx . . $ GTK_ACCESSIBLE_PROPERTY_LABEL.);
155 gtk_accessible_reset_propertycxx . . $ gtk_accessible_reset_property(58234f89de8af20e). (GTK_ACCESSIBLEcxx . . $ GTK_ACCESSIBLE(4ecffd44f086533a). (self), GTK_ACCESSIBLE_PROPERTY_DESCRIPTIONcxx . . $ GTK_ACCESSIBLE_PROPERTY_DESCRIPTION.);
156
157 gtk_list_item_do_notifycxx . . $ gtk_list_item_do_notify(4675f52f61c3414a). (list_item,
158 gtk_list_item_base_get_itemcxx . . $ gtk_list_item_base_get_item(65e6e49d8588e28f). (GTK_LIST_ITEM_BASEcxx . . $ `gtk/gtklistitembaseprivate.h:27:9`! (self)) != NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!,
159 gtk_list_item_base_get_positioncxx . . $ gtk_list_item_base_get_position(ce2bc36d78475c90). (GTK_LIST_ITEM_BASEcxx . . $ `gtk/gtklistitembaseprivate.h:27:9`! (self)) != GTK_INVALID_LIST_POSITIONcxx . . $ `gtk/gtktypes.h:79:9`!,
160 gtk_list_item_base_get_selectedcxx . . $ gtk_list_item_base_get_selected(713b57492acab63). (GTK_LIST_ITEM_BASEcxx . . $ `gtk/gtklistitembaseprivate.h:27:9`! (self)));
161
162 /* FIXME: This is technically not correct, the child is user code, isn't it? */
163 gtk_list_item_set_childcxx . . $ gtk_list_item_set_child(dbfde0321fb20275). (list_item, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!);
164 }
165
166 static void
167 gtk_list_item_widget_update_objectcxx . . $ gtk_list_item_widget_update_object(a21bef057e295ad1). (GtkListFactoryWidgetcxx . . $ GtkListFactoryWidget# *fw,
168 gpointercxx . . $ gpointer# object,
169 guintcxx . . $ guint# position,
170 gpointercxx . . $ gpointer# item,
171 gbooleancxx . . $ gboolean# selected)
172 {
173 GtkListItemWidgetcxx . . $ GtkListItemWidget# *self = GTK_LIST_ITEM_WIDGETcxx . . $ `gtk/gtklistitemwidgetprivate.h:27:9`! (fw);
174 GtkListItemBasecxx . . $ GtkListItemBase# *base = GTK_LIST_ITEM_BASEcxx . . $ `gtk/gtklistitembaseprivate.h:27:9`! (self);
175 GtkListItemcxx . . $ GtkListItem# *list_item = object;
176 /* Track notify manually instead of freeze/thaw_notify for performance reasons. */
177 gbooleancxx . . $ gboolean# notify_item = FALSEcxx . . $ `<external>/12741050725406041920/gmacros.h:967:9`!, notify_position = FALSEcxx . . $ `<external>/12741050725406041920/gmacros.h:967:9`!, notify_selected = FALSEcxx . . $ `<external>/12741050725406041920/gmacros.h:967:9`!;
178
179 /* FIXME: It's kinda evil to notify external objects from here... */
180 notify_item = gtk_list_item_base_get_itemcxx . . $ gtk_list_item_base_get_item(65e6e49d8588e28f). (base) != item;
181 notify_position = gtk_list_item_base_get_positioncxx . . $ gtk_list_item_base_get_position(ce2bc36d78475c90). (base) != position;
182 notify_selected = gtk_list_item_base_get_selectedcxx . . $ gtk_list_item_base_get_selected(713b57492acab63). (base) != selected;
183
184 GTK_LIST_FACTORY_WIDGET_CLASScxx . . $ `gtk/gtklistfactorywidgetprivate.h:30:9`! (gtk_list_item_widget_parent_class)->update_objectcxx . . $ _GtkListFactoryWidgetClass#update_object. (fw,
185 object,
186 position,
187 item,
188 selected);
189
190 if (list_item)
191 gtk_list_item_do_notifycxx . . $ gtk_list_item_do_notify(4675f52f61c3414a). (list_item, notify_item, notify_position, notify_selected);
192 }
193
194 static void
195 gtk_list_item_widget_class_initcxx . . $ gtk_list_item_widget_class_init(2adbcf2fe7a1d8af). (GtkListItemWidgetClasscxx . . $ GtkListItemWidgetClass# *klass)
196 {
197 GtkListFactoryWidgetClasscxx . . $ GtkListFactoryWidgetClass# *factory_class = GTK_LIST_FACTORY_WIDGET_CLASScxx . . $ `gtk/gtklistfactorywidgetprivate.h:30:9`! (klass);
198 GtkWidgetClasscxx . . $ GtkWidgetClass# *widget_class = GTK_WIDGET_CLASScxx . . $ `gtk/gtkwidget.h:45:9`! (klass);
199
200 factory_class->create_objectcxx . . $ _GtkListFactoryWidgetClass#create_object. = gtk_list_item_widget_create_objectcxx . . $ gtk_list_item_widget_create_object(b74c42e358122988).;
201 factory_class->setup_objectcxx . . $ _GtkListFactoryWidgetClass#setup_object. = gtk_list_item_widget_setup_objectcxx . . $ gtk_list_item_widget_setup_object(8801c5424a7a2326).;
202 factory_class->update_objectcxx . . $ _GtkListFactoryWidgetClass#update_object. = gtk_list_item_widget_update_objectcxx . . $ gtk_list_item_widget_update_object(a21bef057e295ad1).;
203 factory_class->teardown_objectcxx . . $ _GtkListFactoryWidgetClass#teardown_object. = gtk_list_item_widget_teardown_objectcxx . . $ gtk_list_item_widget_teardown_object(8801c5424a7a2326).;
204
205 widget_class->focuscxx . . $ _GtkWidgetClass#focus. = gtk_list_item_widget_focuscxx . . $ gtk_list_item_widget_focus(8bb1c65c821a69cd).;
206 widget_class->grab_focuscxx . . $ _GtkWidgetClass#grab_focus. = gtk_list_item_widget_grab_focuscxx . . $ gtk_list_item_widget_grab_focus(9247ef2dc26c5426).;
207
208 /* This gets overwritten by gtk_list_item_widget_new() but better safe than sorry */
209 gtk_widget_class_set_css_namecxx . . $ gtk_widget_class_set_css_name(6333614c746ab65a). (widget_class, I_cxx . . $ `gdk/gdkprivate.h:35:9`!("row"));
210 gtk_widget_class_set_layout_manager_typecxx . . $ gtk_widget_class_set_layout_manager_type(2a839cbf4b1b4191). (widget_class, GTK_TYPE_BIN_LAYOUTcxx . . $ `gtk/gtkbinlayout.h:23:9`!);
211 }
212
213 static void
214 gtk_list_item_widget_initcxx . . $ gtk_list_item_widget_init(c8bb8d8ef397347). (GtkListItemWidgetcxx . . $ GtkListItemWidget# *self)
215 {
216 gtk_widget_set_focusablecxx . . $ gtk_widget_set_focusable(81f145f668a0074f). (GTK_WIDGETcxx . . $ `gtk/gtkwidget.h:44:9`! (self), TRUEcxx . . $ `<external>/12741050725406041920/gmacros.h:971:9`!);
217 }
218
219 GtkWidgetcxx . . $ GtkWidget# *
220 gtk_list_item_widget_newcxx . . $ gtk_list_item_widget_new(5515aee3c4273cf8). (GtkListItemFactorycxx . . $ GtkListItemFactory# *factory,
221 const char *css_name,
222 GtkAccessibleRolecxx . . $ GtkAccessibleRole# role)
223 {
224 g_return_val_if_failcxx . . $ `<external>/5169755362661750954/gmessages.h:665:9`! (css_name != NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!);
225
226 return g_object_newcxx . . $ g_object_new(8485fe61b4be4c78). (GTK_TYPE_LIST_ITEM_WIDGETcxx . . $ `gtk/gtklistitemwidgetprivate.h:26:9`!,
227 "css-name", css_name,
228 "accessible-role", role,
229 "factory", factory,
230 NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!);
231 }
232
233 void
234 gtk_list_item_widget_set_childcxx . . $ gtk_list_item_widget_set_child(b82b183105509c19). (GtkListItemWidgetcxx . . $ GtkListItemWidget# *self,
235 GtkWidgetcxx . . $ GtkWidget# *child)
236 {
237 GtkWidgetcxx . . $ GtkWidget# *cur_child = gtk_widget_get_first_childcxx . . $ gtk_widget_get_first_child(ef973e1b01680070). (GTK_WIDGETcxx . . $ `gtk/gtkwidget.h:44:9`! (self));
238
239 if (cur_child == child)
240 return;
241
242 g_clear_pointercxx . . $ `<external>/1123956534522462559/gmem.h:135:9`! (&cur_child, gtk_widget_unparent);
243
244 if (child)
245 gtk_widget_set_parentcxx . . $ gtk_widget_set_parent(4f261c0971c30e7). (child, GTK_WIDGETcxx . . $ `gtk/gtkwidget.h:44:9`! (self));
246 }
247