| 1 | /* GTK - The GIMP Toolkit |
| 2 | * Copyright (C) 2015 Benjamin Otte <[email protected]> |
| 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 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 | |
| 18 | #include "config.h"cxx . . $ `<file>/build/config.h`/ |
| 19 | |
| 20 | #include "gtkimagedefinitionprivate.h"cxx . . $ `<file>/gtk/gtkimagedefinitionprivate.h`/ |
| 21 | |
| 22 | typedef struct _GtkImageDefinitionEmptycxx . . $ _GtkImageDefinitionEmpty# GtkImageDefinitionEmptycxx . . $ GtkImageDefinitionEmpty#; |
| 23 | typedef struct _GtkImageDefinitionIconNamecxx . . $ _GtkImageDefinitionIconName# GtkImageDefinitionIconNamecxx . . $ GtkImageDefinitionIconName#; |
| 24 | typedef struct _GtkImageDefinitionGIconcxx . . $ _GtkImageDefinitionGIcon# GtkImageDefinitionGIconcxx . . $ GtkImageDefinitionGIcon#; |
| 25 | typedef struct _GtkImageDefinitionPaintablecxx . . $ _GtkImageDefinitionPaintable# GtkImageDefinitionPaintablecxx . . $ GtkImageDefinitionPaintable#; |
| 26 | |
| 27 | struct _GtkImageDefinitionEmptycxx . . $ _GtkImageDefinitionEmpty# { |
| 28 | GtkImageTypecxx . . $ GtkImageType# typecxx . . $ _GtkImageDefinitionEmpty#type.; |
| 29 | int ref_countcxx . . $ _GtkImageDefinitionEmpty#ref_count.; |
| 30 | }; |
| 31 | |
| 32 | struct _GtkImageDefinitionIconNamecxx . . $ _GtkImageDefinitionIconName# { |
| 33 | GtkImageTypecxx . . $ GtkImageType# typecxx . . $ _GtkImageDefinitionIconName#type.; |
| 34 | int ref_countcxx . . $ _GtkImageDefinitionIconName#ref_count.; |
| 35 | |
| 36 | char *icon_namecxx . . $ _GtkImageDefinitionIconName#icon_name.; |
| 37 | }; |
| 38 | |
| 39 | struct _GtkImageDefinitionGIconcxx . . $ _GtkImageDefinitionGIcon# { |
| 40 | GtkImageTypecxx . . $ GtkImageType# typecxx . . $ _GtkImageDefinitionGIcon#type.; |
| 41 | int ref_countcxx . . $ _GtkImageDefinitionGIcon#ref_count.; |
| 42 | |
| 43 | GIconcxx . . $ GIcon# *giconcxx . . $ _GtkImageDefinitionGIcon#gicon.; |
| 44 | }; |
| 45 | |
| 46 | struct _GtkImageDefinitionPaintablecxx . . $ _GtkImageDefinitionPaintable# { |
| 47 | GtkImageTypecxx . . $ GtkImageType# typecxx . . $ _GtkImageDefinitionPaintable#type.; |
| 48 | int ref_countcxx . . $ _GtkImageDefinitionPaintable#ref_count.; |
| 49 | |
| 50 | GdkPaintablecxx . . $ GdkPaintable# *paintablecxx . . $ _GtkImageDefinitionPaintable#paintable.; |
| 51 | }; |
| 52 | |
| 53 | union _GtkImageDefinitioncxx . . $ _GtkImageDefinition# |
| 54 | { |
| 55 | GtkImageTypecxx . . $ GtkImageType# typecxx . . $ _GtkImageDefinition#type.; |
| 56 | GtkImageDefinitionEmptycxx . . $ GtkImageDefinitionEmpty# emptycxx . . $ _GtkImageDefinition#empty.; |
| 57 | GtkImageDefinitionIconNamecxx . . $ GtkImageDefinitionIconName# icon_namecxx . . $ _GtkImageDefinition#icon_name.; |
| 58 | GtkImageDefinitionGIconcxx . . $ GtkImageDefinitionGIcon# giconcxx . . $ _GtkImageDefinition#gicon.; |
| 59 | GtkImageDefinitionPaintablecxx . . $ GtkImageDefinitionPaintable# paintablecxx . . $ _GtkImageDefinition#paintable.; |
| 60 | }; |
| 61 | |
| 62 | GtkImageDefinitioncxx . . $ GtkImageDefinition# * |
| 63 | gtk_image_definition_new_emptycxx . . $ gtk_image_definition_new_empty(9a43d7a653a059c4). (void) |
| 64 | { |
| 65 | static GtkImageDefinitionEmptycxx . . $ GtkImageDefinitionEmpty# empty = { GTK_IMAGE_EMPTYcxx . . $ GTK_IMAGE_EMPTY., 1 }; |
| 66 | |
| 67 | return gtk_image_definition_refcxx . . $ gtk_image_definition_ref(4070604180121330). ((GtkImageDefinitioncxx . . $ GtkImageDefinition# *) &empty); |
| 68 | } |
| 69 | |
| 70 | static inline GtkImageDefinitioncxx . . $ GtkImageDefinition# * |
| 71 | gtk_image_definition_alloccxx . . $ gtk_image_definition_alloc(a0e985f38c4aadf8). (GtkImageTypecxx . . $ GtkImageType# type) |
| 72 | { |
| 73 | static gsizecxx . . $ gsize# sizes[] = { |
| 74 | sizeof (GtkImageDefinitionEmptycxx . . $ GtkImageDefinitionEmpty#), |
| 75 | sizeof (GtkImageDefinitionIconNamecxx . . $ GtkImageDefinitionIconName#), |
| 76 | sizeof (GtkImageDefinitionGIconcxx . . $ GtkImageDefinitionGIcon#), |
| 77 | sizeof (GtkImageDefinitionPaintablecxx . . $ GtkImageDefinitionPaintable#) |
| 78 | }; |
| 79 | GtkImageDefinitioncxx . . $ GtkImageDefinition# *def; |
| 80 | |
| 81 | g_assertcxx . . $ `<external>/15287032793271088244/gtestutils.h:275:9`! (type < G_N_ELEMENTScxx . . $ `<external>/12741050725406041920/gmacros.h:993:9`! (sizes)); |
| 82 | |
| 83 | def = g_malloc0cxx . . $ g_malloc0(bfcfa4d6b7f7ef64). (sizes[type]); |
| 84 | def->typecxx . . $ _GtkImageDefinition#type. = type; |
| 85 | def->emptycxx . . $ _GtkImageDefinition#empty..ref_countcxx . . $ _GtkImageDefinitionEmpty#ref_count. = 1; |
| 86 | |
| 87 | return def; |
| 88 | } |
| 89 | |
| 90 | GtkImageDefinitioncxx . . $ GtkImageDefinition# * |
| 91 | gtk_image_definition_new_icon_namecxx . . $ gtk_image_definition_new_icon_name(116d623cbc269da9). (const char *icon_name) |
| 92 | { |
| 93 | GtkImageDefinitioncxx . . $ GtkImageDefinition# *def; |
| 94 | |
| 95 | if (icon_name == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`! || icon_name[0] == '\0') |
| 96 | return NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!; |
| 97 | |
| 98 | def = gtk_image_definition_alloccxx . . $ gtk_image_definition_alloc(a0e985f38c4aadf8). (GTK_IMAGE_ICON_NAMEcxx . . $ GTK_IMAGE_ICON_NAME.); |
| 99 | def->icon_namecxx . . $ _GtkImageDefinition#icon_name..icon_namecxx . . $ _GtkImageDefinitionIconName#icon_name. = g_strdupcxx . . $ `<external>/7822753393113922331/gstrfuncs.h:324:9`! (icon_name); |
| 100 | |
| 101 | return def; |
| 102 | } |
| 103 | |
| 104 | GtkImageDefinitioncxx . . $ GtkImageDefinition# * |
| 105 | gtk_image_definition_new_giconcxx . . $ gtk_image_definition_new_gicon(9e29d8158c94e17f). (GIconcxx . . $ GIcon# *gicon) |
| 106 | { |
| 107 | GtkImageDefinitioncxx . . $ GtkImageDefinition# *def; |
| 108 | |
| 109 | if (gicon == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!) |
| 110 | return NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!; |
| 111 | |
| 112 | def = gtk_image_definition_alloccxx . . $ gtk_image_definition_alloc(a0e985f38c4aadf8). (GTK_IMAGE_GICONcxx . . $ GTK_IMAGE_GICON.); |
| 113 | def->giconcxx . . $ _GtkImageDefinition#gicon..giconcxx . . $ _GtkImageDefinitionGIcon#gicon. = g_object_refcxx . . $ `<external>/1341695927569185362/gobject.h:533:9`! (gicon); |
| 114 | |
| 115 | return def; |
| 116 | } |
| 117 | |
| 118 | GtkImageDefinitioncxx . . $ GtkImageDefinition# * |
| 119 | gtk_image_definition_new_paintablecxx . . $ gtk_image_definition_new_paintable(fead3e7fcbdc3a8d). (GdkPaintablecxx . . $ GdkPaintable# *paintable) |
| 120 | { |
| 121 | GtkImageDefinitioncxx . . $ GtkImageDefinition# *def; |
| 122 | |
| 123 | if (paintable == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!) |
| 124 | return NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!; |
| 125 | |
| 126 | def = gtk_image_definition_alloccxx . . $ gtk_image_definition_alloc(a0e985f38c4aadf8). (GTK_IMAGE_PAINTABLEcxx . . $ GTK_IMAGE_PAINTABLE.); |
| 127 | def->paintablecxx . . $ _GtkImageDefinition#paintable..paintablecxx . . $ _GtkImageDefinitionPaintable#paintable. = g_object_refcxx . . $ `<external>/1341695927569185362/gobject.h:533:9`! (paintable); |
| 128 | |
| 129 | return def; |
| 130 | } |
| 131 | |
| 132 | GtkImageDefinitioncxx . . $ GtkImageDefinition# * |
| 133 | gtk_image_definition_refcxx . . $ gtk_image_definition_ref(4070604180121330). (GtkImageDefinitioncxx . . $ GtkImageDefinition# *def) |
| 134 | { |
| 135 | GtkImageDefinitionEmptycxx . . $ GtkImageDefinitionEmpty# *empty = (GtkImageDefinitionEmptycxx . . $ GtkImageDefinitionEmpty# *) def; |
| 136 | |
| 137 | empty->ref_countcxx . . $ _GtkImageDefinitionEmpty#ref_count.++; |
| 138 | |
| 139 | return def; |
| 140 | } |
| 141 | |
| 142 | void |
| 143 | gtk_image_definition_unrefcxx . . $ gtk_image_definition_unref(8d6423bd359d38b9). (GtkImageDefinitioncxx . . $ GtkImageDefinition# *def) |
| 144 | { |
| 145 | GtkImageDefinitionEmptycxx . . $ GtkImageDefinitionEmpty# *empty = (GtkImageDefinitionEmptycxx . . $ GtkImageDefinitionEmpty# *) def; |
| 146 | |
| 147 | empty->ref_countcxx . . $ _GtkImageDefinitionEmpty#ref_count.--; |
| 148 | |
| 149 | if (empty->ref_countcxx . . $ _GtkImageDefinitionEmpty#ref_count. > 0) |
| 150 | return; |
| 151 | |
| 152 | switch (def->typecxx . . $ _GtkImageDefinition#type.) |
| 153 | { |
| 154 | default: |
| 155 | case GTK_IMAGE_EMPTYcxx . . $ GTK_IMAGE_EMPTY.: |
| 156 | g_assert_not_reachedcxx . . $ `<external>/15287032793271088244/gtestutils.h:274:9`! (); |
| 157 | break; |
| 158 | case GTK_IMAGE_PAINTABLEcxx . . $ GTK_IMAGE_PAINTABLE.: |
| 159 | { |
| 160 | GtkImageDefinitionPaintablecxx . . $ GtkImageDefinitionPaintable# *paintable = (GtkImageDefinitionPaintablecxx . . $ GtkImageDefinitionPaintable# *) def; |
| 161 | g_object_unrefcxx . . $ g_object_unref(5d22bdacc48458e8). (paintable->paintablecxx . . $ _GtkImageDefinitionPaintable#paintable.); |
| 162 | } |
| 163 | break; |
| 164 | case GTK_IMAGE_ICON_NAMEcxx . . $ GTK_IMAGE_ICON_NAME.: |
| 165 | { |
| 166 | GtkImageDefinitionIconNamecxx . . $ GtkImageDefinitionIconName# *icon_name = (GtkImageDefinitionIconNamecxx . . $ GtkImageDefinitionIconName# *) def; |
| 167 | g_freecxx . . $ g_free(5d22bdacc48458e8). (icon_name->icon_namecxx . . $ _GtkImageDefinitionIconName#icon_name.); |
| 168 | } |
| 169 | break; |
| 170 | case GTK_IMAGE_GICONcxx . . $ GTK_IMAGE_GICON.: |
| 171 | { |
| 172 | GtkImageDefinitionGIconcxx . . $ GtkImageDefinitionGIcon# *gicon = (GtkImageDefinitionGIconcxx . . $ GtkImageDefinitionGIcon# *) def; |
| 173 | g_object_unrefcxx . . $ g_object_unref(5d22bdacc48458e8). (gicon->giconcxx . . $ _GtkImageDefinitionGIcon#gicon.); |
| 174 | } |
| 175 | break; |
| 176 | } |
| 177 | |
| 178 | g_freecxx . . $ g_free(5d22bdacc48458e8). (def); |
| 179 | } |
| 180 | |
| 181 | GtkImageTypecxx . . $ GtkImageType# |
| 182 | gtk_image_definition_get_storage_typecxx . . $ gtk_image_definition_get_storage_type(878a028ca1514ca5). (const GtkImageDefinitioncxx . . $ GtkImageDefinition# *def) |
| 183 | { |
| 184 | return def->typecxx . . $ _GtkImageDefinition#type.; |
| 185 | } |
| 186 | |
| 187 | int |
| 188 | gtk_image_definition_get_scalecxx . . $ gtk_image_definition_get_scale(49caba30f9db0677). (const GtkImageDefinitioncxx . . $ GtkImageDefinition# *def) |
| 189 | { |
| 190 | switch (def->typecxx . . $ _GtkImageDefinition#type.) |
| 191 | { |
| 192 | default: |
| 193 | g_assert_not_reachedcxx . . $ `<external>/15287032793271088244/gtestutils.h:274:9`! (); |
| 194 | case GTK_IMAGE_EMPTYcxx . . $ GTK_IMAGE_EMPTY.: |
| 195 | case GTK_IMAGE_PAINTABLEcxx . . $ GTK_IMAGE_PAINTABLE.: |
| 196 | case GTK_IMAGE_ICON_NAMEcxx . . $ GTK_IMAGE_ICON_NAME.: |
| 197 | case GTK_IMAGE_GICONcxx . . $ GTK_IMAGE_GICON.: |
| 198 | return 1; |
| 199 | } |
| 200 | } |
| 201 | |
| 202 | const char * |
| 203 | gtk_image_definition_get_icon_namecxx . . $ gtk_image_definition_get_icon_name(dacfe2538177ac55). (const GtkImageDefinitioncxx . . $ GtkImageDefinition# *def) |
| 204 | { |
| 205 | const GtkImageDefinitionIconNamecxx . . $ GtkImageDefinitionIconName# *icon_name = (const GtkImageDefinitionIconNamecxx . . $ GtkImageDefinitionIconName# *) def; |
| 206 | |
| 207 | if (def->typecxx . . $ _GtkImageDefinition#type. != GTK_IMAGE_ICON_NAMEcxx . . $ GTK_IMAGE_ICON_NAME.) |
| 208 | return NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!; |
| 209 | |
| 210 | return icon_name->icon_namecxx . . $ _GtkImageDefinitionIconName#icon_name.; |
| 211 | } |
| 212 | |
| 213 | GIconcxx . . $ GIcon# * |
| 214 | gtk_image_definition_get_giconcxx . . $ gtk_image_definition_get_gicon(f044423f0adda99). (const GtkImageDefinitioncxx . . $ GtkImageDefinition# *def) |
| 215 | { |
| 216 | const GtkImageDefinitionGIconcxx . . $ GtkImageDefinitionGIcon# *gicon = (const GtkImageDefinitionGIconcxx . . $ GtkImageDefinitionGIcon# *) def; |
| 217 | |
| 218 | if (def->typecxx . . $ _GtkImageDefinition#type. != GTK_IMAGE_GICONcxx . . $ GTK_IMAGE_GICON.) |
| 219 | return NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!; |
| 220 | |
| 221 | return gicon->giconcxx . . $ _GtkImageDefinitionGIcon#gicon.; |
| 222 | } |
| 223 | |
| 224 | GdkPaintablecxx . . $ GdkPaintable# * |
| 225 | gtk_image_definition_get_paintablecxx . . $ gtk_image_definition_get_paintable(d3ca75ad27a1d0c6). (const GtkImageDefinitioncxx . . $ GtkImageDefinition# *def) |
| 226 | { |
| 227 | const GtkImageDefinitionPaintablecxx . . $ GtkImageDefinitionPaintable# *paintable = (const GtkImageDefinitionPaintablecxx . . $ GtkImageDefinitionPaintable# *) def; |
| 228 | |
| 229 | if (def->typecxx . . $ _GtkImageDefinition#type. != GTK_IMAGE_PAINTABLEcxx . . $ GTK_IMAGE_PAINTABLE.) |
| 230 | return NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!; |
| 231 | |
| 232 | return paintable->paintablecxx . . $ _GtkImageDefinitionPaintable#paintable.; |
| 233 | } |