| 1 | /* |
| 2 | * Copyright © 2023 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 "gtklistitembaseprivate.h"cxx . . $ `<file>/gtk/gtklistitembaseprivate.h`/ |
| 23 | |
| 24 | #include "gtkaccessible.h"cxx . . $ `<file>/gtk/gtkaccessible.h`/ |
| 25 | |
| 26 | typedef struct _GtkListItemBasePrivatecxx . . $ _GtkListItemBasePrivate# GtkListItemBasePrivatecxx . . $ GtkListItemBasePrivate#; |
| 27 | struct _GtkListItemBasePrivatecxx . . $ _GtkListItemBasePrivate# |
| 28 | { |
| 29 | GObjectcxx . . $ GObject# *itemcxx . . $ _GtkListItemBasePrivate#item.; |
| 30 | guintcxx . . $ guint# positioncxx . . $ _GtkListItemBasePrivate#position.; |
| 31 | gbooleancxx . . $ gboolean# selectedcxx . . $ _GtkListItemBasePrivate#selected.; |
| 32 | }; |
| 33 | |
| 34 | G_DEFINE_TYPE_WITH_PRIVATEcxx . . $ `<external>/9567554376676449156/gtype.h:1876:9`! (GtkListItemBase, gtk_list_item_base, GTK_TYPE_WIDGETcxx . . $ `gtk/gtkwidget.h:43:9`!) |
| 35 | |
| 36 | static void |
| 37 | gtk_list_item_base_default_updatecxx . . $ gtk_list_item_base_default_update(ec614068b9a83da0). (GtkListItemBasecxx . . $ GtkListItemBase# *self, |
| 38 | guintcxx . . $ guint# position, |
| 39 | gpointercxx . . $ gpointer# item, |
| 40 | gbooleancxx . . $ gboolean# selected) |
| 41 | { |
| 42 | GtkListItemBasePrivatecxx . . $ GtkListItemBasePrivate# *priv = gtk_list_item_base_get_instance_privatecxx . . $ gtk_list_item_base_get_instance_private(65e6e49d8588e28f). (self); |
| 43 | |
| 44 | g_set_objectcxx . . $ `<external>/1341695927569185362/gobject.h:762:9`! (&priv->item, item); |
| 45 | priv->positioncxx . . $ _GtkListItemBasePrivate#position. = position; |
| 46 | priv->selectedcxx . . $ _GtkListItemBasePrivate#selected. = selected; |
| 47 | } |
| 48 | |
| 49 | static void |
| 50 | gtk_list_item_base_disposecxx . . $ gtk_list_item_base_dispose(6087475fa43034d3). (GObjectcxx . . $ GObject# *object) |
| 51 | { |
| 52 | GtkListItemBasecxx . . $ GtkListItemBase# *self = GTK_LIST_ITEM_BASEcxx . . $ `gtk/gtklistitembaseprivate.h:27:9`! (object); |
| 53 | GtkListItemBasePrivatecxx . . $ GtkListItemBasePrivate# *priv = gtk_list_item_base_get_instance_privatecxx . . $ gtk_list_item_base_get_instance_private(65e6e49d8588e28f). (self); |
| 54 | |
| 55 | g_clear_objectcxx . . $ `<external>/1341695927569185362/gobject.h:695:9`! (&priv->item); |
| 56 | |
| 57 | G_OBJECT_CLASScxx . . $ `<external>/1341695927569185362/gobject.h:61:9`! (gtk_list_item_base_parent_class)->disposecxx . . $ _GObjectClass#dispose. (object); |
| 58 | } |
| 59 | |
| 60 | static void |
| 61 | gtk_list_item_base_class_initcxx . . $ gtk_list_item_base_class_init(f7a50fb1e05acaed). (GtkListItemBaseClasscxx . . $ GtkListItemBaseClass# *klass) |
| 62 | { |
| 63 | GObjectClasscxx . . $ GObjectClass# *gobject_class = G_OBJECT_CLASScxx . . $ `<external>/1341695927569185362/gobject.h:61:9`! (klass); |
| 64 | |
| 65 | klass->updatecxx . . $ _GtkListItemBaseClass#update. = gtk_list_item_base_default_updatecxx . . $ gtk_list_item_base_default_update(ec614068b9a83da0).; |
| 66 | |
| 67 | gobject_class->disposecxx . . $ _GObjectClass#dispose. = gtk_list_item_base_disposecxx . . $ gtk_list_item_base_dispose(6087475fa43034d3).; |
| 68 | } |
| 69 | |
| 70 | static void |
| 71 | gtk_list_item_base_initcxx . . $ gtk_list_item_base_init(1c2134e88aad52fe). (GtkListItemBasecxx . . $ GtkListItemBase# *self) |
| 72 | { |
| 73 | } |
| 74 | |
| 75 | void |
| 76 | gtk_list_item_base_updatecxx . . $ gtk_list_item_base_update(ec614068b9a83da0). (GtkListItemBasecxx . . $ GtkListItemBase# *self, |
| 77 | guintcxx . . $ guint# position, |
| 78 | gpointercxx . . $ gpointer# item, |
| 79 | gbooleancxx . . $ gboolean# selected) |
| 80 | { |
| 81 | GtkListItemBasePrivatecxx . . $ GtkListItemBasePrivate# *priv = gtk_list_item_base_get_instance_privatecxx . . $ gtk_list_item_base_get_instance_private(65e6e49d8588e28f). (self); |
| 82 | gbooleancxx . . $ gboolean# was_selected; |
| 83 | |
| 84 | if (priv->positioncxx . . $ _GtkListItemBasePrivate#position. == position && |
| 85 | priv->itemcxx . . $ _GtkListItemBasePrivate#item. == item && |
| 86 | priv->selectedcxx . . $ _GtkListItemBasePrivate#selected. == selected) |
| 87 | return; |
| 88 | |
| 89 | was_selected = priv->selectedcxx . . $ _GtkListItemBasePrivate#selected.; |
| 90 | |
| 91 | GTK_LIST_ITEM_BASE_GET_CLASScxx . . $ `gtk/gtklistitembaseprivate.h:31:9`! (self)->updatecxx . . $ _GtkListItemBaseClass#update. (self, position, item, selected); |
| 92 | |
| 93 | /* don't look at selected variable, it's not reentrancy safe */ |
| 94 | if (was_selected != priv->selectedcxx . . $ _GtkListItemBasePrivate#selected.) |
| 95 | { |
| 96 | if (priv->selectedcxx . . $ _GtkListItemBasePrivate#selected.) |
| 97 | gtk_widget_set_state_flagscxx . . $ gtk_widget_set_state_flags(2b95d95a3c3aa236). (GTK_WIDGETcxx . . $ `gtk/gtkwidget.h:44:9`! (self), GTK_STATE_FLAG_SELECTEDcxx . . $ GTK_STATE_FLAG_SELECTED., FALSEcxx . . $ `<external>/12741050725406041920/gmacros.h:967:9`!); |
| 98 | else |
| 99 | gtk_widget_unset_state_flagscxx . . $ gtk_widget_unset_state_flags(e7d7ee4ea524d63). (GTK_WIDGETcxx . . $ `gtk/gtkwidget.h:44:9`! (self), GTK_STATE_FLAG_SELECTEDcxx . . $ GTK_STATE_FLAG_SELECTED.); |
| 100 | } |
| 101 | |
| 102 | /* We're updating the a11y state at least once because of the side-effects, subsequent same state filtering is done on the a11y layer. */ |
| 103 | gtk_accessible_update_statecxx . . $ gtk_accessible_update_state(a322e699be08ab8a). (GTK_ACCESSIBLEcxx . . $ GTK_ACCESSIBLE(4ecffd44f086533a). (self), |
| 104 | GTK_ACCESSIBLE_STATE_SELECTEDcxx . . $ GTK_ACCESSIBLE_STATE_SELECTED., priv->selectedcxx . . $ _GtkListItemBasePrivate#selected., |
| 105 | -1); |
| 106 | } |
| 107 | |
| 108 | guintcxx . . $ guint# |
| 109 | gtk_list_item_base_get_positioncxx . . $ gtk_list_item_base_get_position(ce2bc36d78475c90). (GtkListItemBasecxx . . $ GtkListItemBase# *self) |
| 110 | { |
| 111 | GtkListItemBasePrivatecxx . . $ GtkListItemBasePrivate# *priv = gtk_list_item_base_get_instance_privatecxx . . $ gtk_list_item_base_get_instance_private(65e6e49d8588e28f). (self); |
| 112 | |
| 113 | return priv->positioncxx . . $ _GtkListItemBasePrivate#position.; |
| 114 | } |
| 115 | |
| 116 | gpointercxx . . $ gpointer# |
| 117 | gtk_list_item_base_get_itemcxx . . $ gtk_list_item_base_get_item(65e6e49d8588e28f). (GtkListItemBasecxx . . $ GtkListItemBase# *self) |
| 118 | { |
| 119 | GtkListItemBasePrivatecxx . . $ GtkListItemBasePrivate# *priv = gtk_list_item_base_get_instance_privatecxx . . $ gtk_list_item_base_get_instance_private(65e6e49d8588e28f). (self); |
| 120 | |
| 121 | return priv->itemcxx . . $ _GtkListItemBasePrivate#item.; |
| 122 | } |
| 123 | |
| 124 | gbooleancxx . . $ gboolean# |
| 125 | gtk_list_item_base_get_selectedcxx . . $ gtk_list_item_base_get_selected(713b57492acab63). (GtkListItemBasecxx . . $ GtkListItemBase# *self) |
| 126 | { |
| 127 | GtkListItemBasePrivatecxx . . $ GtkListItemBasePrivate# *priv = gtk_list_item_base_get_instance_privatecxx . . $ gtk_list_item_base_get_instance_private(65e6e49d8588e28f). (self); |
| 128 | |
| 129 | return priv->selectedcxx . . $ _GtkListItemBasePrivate#selected.; |
| 130 | } |
| 131 |