| 1 | /* GTK - The GIMP Toolkit |
| 2 | * |
| 3 | * Copyright (C) 2003 Ricardo Fernandez Pascual |
| 4 | * Copyright (C) 2004 Paolo Borelli |
| 5 | * Copyright (C) 2012 Bastien Nocera |
| 6 | * |
| 7 | * This library is free software; you can redistribute it and/or |
| 8 | * modify it under the terms of the GNU Lesser General Public |
| 9 | * License as published by the Free Software Foundation; either |
| 10 | * version 2 of the License, or (at your option) any later version. |
| 11 | * |
| 12 | * This library is distributed in the hope that it will be useful, |
| 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
| 15 | * Lesser General Public License for more details. |
| 16 | * |
| 17 | * You should have received a copy of the GNU Lesser General Public |
| 18 | * License along with this library. If not, see <http://www.gnu.org/licenses/>. |
| 19 | */ |
| 20 | |
| 21 | /** |
| 22 | * GtkMenuButton: |
| 23 | * |
| 24 | * Displays a popup when clicked. |
| 25 | * |
| 26 | * <picture> |
| 27 | * <source srcset="menu-button-dark.png" media="(prefers-color-scheme: dark)"> |
| 28 | * <img alt="An example GtkMenuButton" src="menu-button.png"> |
| 29 | * </picture> |
| 30 | * |
| 31 | * This popup can be provided either as a `GtkPopover` or as an abstract |
| 32 | * `GMenuModel`. |
| 33 | * |
| 34 | * The `GtkMenuButton` widget can show either an icon (set with the |
| 35 | * [[email protected]:icon-name] property) or a label (set with the |
| 36 | * [[email protected]:label] property). If neither is explicitly set, |
| 37 | * a [[email protected]] is automatically created, using an arrow image oriented |
| 38 | * according to [[email protected]:direction] or the generic |
| 39 | * “open-menu-symbolic” icon if the direction is not set. |
| 40 | * |
| 41 | * The positioning of the popup is determined by the |
| 42 | * [[email protected]:direction] property of the menu button. |
| 43 | * |
| 44 | * For menus, the [[email protected]:halign] and [[email protected]:valign] |
| 45 | * properties of the menu are also taken into account. For example, when the |
| 46 | * direction is %GTK_ARROW_DOWN and the horizontal alignment is %GTK_ALIGN_START, |
| 47 | * the menu will be positioned below the button, with the starting edge |
| 48 | * (depending on the text direction) of the menu aligned with the starting |
| 49 | * edge of the button. If there is not enough space below the button, the |
| 50 | * menu is popped up above the button instead. If the alignment would move |
| 51 | * part of the menu offscreen, it is “pushed in”. |
| 52 | * |
| 53 | * | | start | center | end | |
| 54 | * | - | --- | --- | --- | |
| 55 | * | **down** |  |  |  | |
| 56 | * | **up** |  |  |  | |
| 57 | * | **left** |  |  |  | |
| 58 | * | **right** |  |  |  | |
| 59 | * |
| 60 | * # CSS nodes |
| 61 | * |
| 62 | * ``` |
| 63 | * menubutton |
| 64 | * ╰── button.toggle |
| 65 | * ╰── <content> |
| 66 | * ╰── [arrow] |
| 67 | * ``` |
| 68 | * |
| 69 | * `GtkMenuButton` has a single CSS node with name `menubutton` |
| 70 | * which contains a `button` node with a `.toggle` style class. |
| 71 | * |
| 72 | * If the button contains an icon, it will have the `.image-button` style class, |
| 73 | * if it contains text, it will have `.text-button` style class. If an arrow is |
| 74 | * visible in addition to an icon, text or a custom child, it will also have |
| 75 | * `.arrow-button` style class. |
| 76 | * |
| 77 | * Inside the toggle button content, there is an `arrow` node for |
| 78 | * the indicator, which will carry one of the `.none`, `.up`, `.down`, |
| 79 | * `.left` or `.right` style classes to indicate the direction that |
| 80 | * the menu will appear in. The CSS is expected to provide a suitable |
| 81 | * image for each of these cases using the `-gtk-icon-source` property. |
| 82 | * |
| 83 | * Optionally, the `menubutton` node can carry the `.circular` style class |
| 84 | * to request a round appearance. |
| 85 | * |
| 86 | * # Accessibility |
| 87 | * |
| 88 | * `GtkMenuButton` uses the [[email protected]] role. |
| 89 | */ |
| 90 | |
| 91 | #include "config.h"cxx . . $ `<file>/build/config.h`/ |
| 92 | |
| 93 | #include "gtkactionable.h"cxx . . $ `<file>/gtk/gtkactionable.h`/ |
| 94 | #include "gtkbinlayout.h"cxx . . $ `<file>/gtk/gtkbinlayout.h`/ |
| 95 | #include "gtkbuildable.h"cxx . . $ `<file>/gtk/gtkbuildable.h`/ |
| 96 | #include "gtkbuiltiniconprivate.h"cxx . . $ `<file>/gtk/gtkbuiltiniconprivate.h`/ |
| 97 | #include "gtkgizmoprivate.h"cxx . . $ `<file>/gtk/gtkgizmoprivate.h`/ |
| 98 | #include "gtkimage.h"cxx . . $ `<file>/gtk/gtkimage.h`/ |
| 99 | #include "gtkmain.h"cxx . . $ `<file>/gtk/gtkmain.h`/ |
| 100 | #include "gtkmenubutton.h"cxx . . $ `<file>/gtk/gtkmenubutton.h`/ |
| 101 | #include "gtkmenubuttonprivate.h"cxx . . $ `<file>/gtk/gtkmenubuttonprivate.h`/ |
| 102 | #include "gtkpopover.h"cxx . . $ `<file>/gtk/gtkpopover.h`/ |
| 103 | #include "gtkpopovermenu.h"cxx . . $ `<file>/gtk/gtkpopovermenu.h`/ |
| 104 | #include "gtkprivate.h"cxx . . $ `<file>/gtk/gtkprivate.h`/ |
| 105 | #include "gtktypebuiltins.h"cxx . . $ `<file>/build/gtk/gtktypebuiltins.h`/ |
| 106 | #include "gtklabel.h"cxx . . $ `<file>/gtk/gtklabel.h`/ |
| 107 | #include "gtkbox.h"cxx . . $ `<file>/gtk/gtkbox.h`/ |
| 108 | #include "gtkwidgetprivate.h"cxx . . $ `<file>/gtk/gtkwidgetprivate.h`/ |
| 109 | #include "gtkbuttonprivate.h"cxx . . $ `<file>/gtk/gtkbuttonprivate.h`/ |
| 110 | #include "gtknative.h"cxx . . $ `<file>/gtk/gtknative.h`/ |
| 111 | #include "gtkwindow.h"cxx . . $ `<file>/gtk/gtkwindow.h`/ |
| 112 | #include "gtkbuilderprivate.h"cxx . . $ `<file>/gtk/gtkbuilderprivate.h`/ |
| 113 | |
| 114 | typedef struct _GtkMenuButtonClasscxx . . $ _GtkMenuButtonClass# GtkMenuButtonClasscxx . . $ GtkMenuButtonClass#; |
| 115 | typedef struct _GtkMenuButtonPrivatecxx . . $ _GtkMenuButtonPrivate# GtkMenuButtonPrivatecxx . . $ GtkMenuButtonPrivate#; |
| 116 | |
| 117 | struct _GtkMenuButtoncxx . . $ _GtkMenuButton# |
| 118 | { |
| 119 | GtkWidgetcxx . . $ GtkWidget# parent_instancecxx . . $ _GtkMenuButton#parent_instance.; |
| 120 | |
| 121 | GtkWidgetcxx . . $ GtkWidget# *buttoncxx . . $ _GtkMenuButton#button.; |
| 122 | GtkWidgetcxx . . $ GtkWidget# *popovercxx . . $ _GtkMenuButton#popover.; /* Only one at a time can be set */ |
| 123 | GMenuModelcxx . . $ GMenuModel# *modelcxx . . $ _GtkMenuButton#model.; |
| 124 | |
| 125 | GtkMenuButtonCreatePopupFunccxx . . $ GtkMenuButtonCreatePopupFunc# create_popup_funccxx . . $ _GtkMenuButton#create_popup_func.; |
| 126 | gpointercxx . . $ gpointer# create_popup_user_datacxx . . $ _GtkMenuButton#create_popup_user_data.; |
| 127 | GDestroyNotifycxx . . $ GDestroyNotify# create_popup_destroy_notifycxx . . $ _GtkMenuButton#create_popup_destroy_notify.; |
| 128 | |
| 129 | GtkWidgetcxx . . $ GtkWidget# *label_widgetcxx . . $ _GtkMenuButton#label_widget.; |
| 130 | GtkWidgetcxx . . $ GtkWidget# *image_widgetcxx . . $ _GtkMenuButton#image_widget.; |
| 131 | GtkWidgetcxx . . $ GtkWidget# *arrow_widgetcxx . . $ _GtkMenuButton#arrow_widget.; |
| 132 | GtkWidgetcxx . . $ GtkWidget# *childcxx . . $ _GtkMenuButton#child.; |
| 133 | GtkArrowTypecxx . . $ GtkArrowType# arrow_typecxx . . $ _GtkMenuButton#arrow_type.; |
| 134 | gbooleancxx . . $ gboolean# always_show_arrowcxx . . $ _GtkMenuButton#always_show_arrow.; |
| 135 | |
| 136 | gbooleancxx . . $ gboolean# primarycxx . . $ _GtkMenuButton#primary.; |
| 137 | gbooleancxx . . $ gboolean# can_shrinkcxx . . $ _GtkMenuButton#can_shrink.; |
| 138 | }; |
| 139 | |
| 140 | struct _GtkMenuButtonClasscxx . . $ _GtkMenuButtonClass# |
| 141 | { |
| 142 | GtkWidgetClasscxx . . $ GtkWidgetClass# parent_classcxx . . $ _GtkMenuButtonClass#parent_class.; |
| 143 | |
| 144 | void (* activatecxx . . $ _GtkMenuButtonClass#activate.) (GtkMenuButtoncxx . . $ GtkMenuButton# *self); |
| 145 | }; |
| 146 | |
| 147 | enumcxx . . $ $anonymous_type_a6dc420ba85f9c78_0# |
| 148 | { |
| 149 | PROP_0cxx . . $ PROP_0., |
| 150 | PROP_MENU_MODELcxx . . $ PROP_MENU_MODEL., |
| 151 | PROP_DIRECTIONcxx . . $ PROP_DIRECTION., |
| 152 | PROP_POPOVERcxx . . $ PROP_POPOVER., |
| 153 | PROP_ICON_NAMEcxx . . $ PROP_ICON_NAME., |
| 154 | PROP_ALWAYS_SHOW_ARROWcxx . . $ PROP_ALWAYS_SHOW_ARROW., |
| 155 | PROP_LABELcxx . . $ PROP_LABEL., |
| 156 | PROP_USE_UNDERLINEcxx . . $ PROP_USE_UNDERLINE., |
| 157 | PROP_HAS_FRAMEcxx . . $ PROP_HAS_FRAME., |
| 158 | PROP_PRIMARYcxx . . $ PROP_PRIMARY., |
| 159 | PROP_CHILDcxx . . $ PROP_CHILD., |
| 160 | PROP_ACTIVEcxx . . $ PROP_ACTIVE., |
| 161 | PROP_CAN_SHRINKcxx . . $ PROP_CAN_SHRINK., |
| 162 | LAST_PROPcxx . . $ LAST_PROP. |
| 163 | }; |
| 164 | |
| 165 | enumcxx . . $ $anonymous_type_a6dc420ba85f9c78_1# { |
| 166 | ACTIVATEcxx . . $ ACTIVATE., |
| 167 | LAST_SIGNALcxx . . $ LAST_SIGNAL. |
| 168 | }; |
| 169 | |
| 170 | static GParamSpeccxx . . $ GParamSpec# *menu_button_propscxx . . $ menu_button_props.[LAST_PROPcxx . . $ LAST_PROP.]; |
| 171 | static guintcxx . . $ guint# signalscxx . . $ signals.[LAST_SIGNALcxx . . $ LAST_SIGNAL.] = { 0 }; |
| 172 | |
| 173 | static void gtk_menu_button_buildable_iface_initcxx . . $ gtk_menu_button_buildable_iface_init(c5db55232772c4cd). (GtkBuildableIfacecxx . . $ GtkBuildableIface# *iface); |
| 174 | |
| 175 | G_DEFINE_TYPE_WITH_CODEcxx . . $ `<external>/9567554376676449156/gtype.h:1850:9`! (GtkMenuButton, gtk_menu_button, GTK_TYPE_WIDGETcxx . . $ `gtk/gtkwidget.h:43:9`!, |
| 176 | G_IMPLEMENT_INTERFACEcxx . . $ `<external>/9567554376676449156/gtype.h:2115:9`! (GTK_TYPE_BUILDABLEcxx . . $ `gtk/gtkbuildable.h:29:9`!, gtk_menu_button_buildable_iface_init)) |
| 177 | |
| 178 | static void gtk_menu_button_disposecxx . . $ gtk_menu_button_dispose(6087475fa43034d3). (GObjectcxx . . $ GObject# *object); |
| 179 | |
| 180 | static void |
| 181 | gtk_menu_button_set_propertycxx . . $ gtk_menu_button_set_property(d7c4bb29f36c0dc4). (GObjectcxx . . $ GObject# *object, |
| 182 | guintcxx . . $ guint# property_id, |
| 183 | const GValuecxx . . $ GValue# *value, |
| 184 | GParamSpeccxx . . $ GParamSpec# *pspec) |
| 185 | { |
| 186 | GtkMenuButtoncxx . . $ GtkMenuButton# *self = GTK_MENU_BUTTONcxx . . $ `gtk/gtkmenubutton.h:33:9`! (object); |
| 187 | |
| 188 | switch (property_id) |
| 189 | { |
| 190 | case PROP_MENU_MODELcxx . . $ PROP_MENU_MODEL.: |
| 191 | gtk_menu_button_set_menu_modelcxx . . $ gtk_menu_button_set_menu_model(81ffc948659b3076). (self, g_value_get_objectcxx . . $ g_value_get_object(e12dff36056c2cce). (value)); |
| 192 | break; |
| 193 | case PROP_DIRECTIONcxx . . $ PROP_DIRECTION.: |
| 194 | gtk_menu_button_set_directioncxx . . $ gtk_menu_button_set_direction(40bd283e4dd59bae). (self, g_value_get_enumcxx . . $ g_value_get_enum(f890c5c75ead5b21). (value)); |
| 195 | break; |
| 196 | case PROP_POPOVERcxx . . $ PROP_POPOVER.: |
| 197 | gtk_menu_button_set_popovercxx . . $ gtk_menu_button_set_popover(b776b2571a0f34d3). (self, g_value_get_objectcxx . . $ g_value_get_object(e12dff36056c2cce). (value)); |
| 198 | break; |
| 199 | case PROP_ICON_NAMEcxx . . $ PROP_ICON_NAME.: |
| 200 | gtk_menu_button_set_icon_namecxx . . $ gtk_menu_button_set_icon_name(99b1edd8bd276d85). (self, g_value_get_stringcxx . . $ g_value_get_string(cc0a2be2b8f7bdc8). (value)); |
| 201 | break; |
| 202 | case PROP_ALWAYS_SHOW_ARROWcxx . . $ PROP_ALWAYS_SHOW_ARROW.: |
| 203 | gtk_menu_button_set_always_show_arrowcxx . . $ gtk_menu_button_set_always_show_arrow(4e87c735efc37a53). (self, g_value_get_booleancxx . . $ g_value_get_boolean(f890c5c75ead5b21). (value)); |
| 204 | break; |
| 205 | case PROP_LABELcxx . . $ PROP_LABEL.: |
| 206 | gtk_menu_button_set_labelcxx . . $ gtk_menu_button_set_label(99b1edd8bd276d85). (self, g_value_get_stringcxx . . $ g_value_get_string(cc0a2be2b8f7bdc8). (value)); |
| 207 | break; |
| 208 | case PROP_USE_UNDERLINEcxx . . $ PROP_USE_UNDERLINE.: |
| 209 | gtk_menu_button_set_use_underlinecxx . . $ gtk_menu_button_set_use_underline(4e87c735efc37a53). (self, g_value_get_booleancxx . . $ g_value_get_boolean(f890c5c75ead5b21). (value)); |
| 210 | break; |
| 211 | case PROP_HAS_FRAMEcxx . . $ PROP_HAS_FRAME.: |
| 212 | gtk_menu_button_set_has_framecxx . . $ gtk_menu_button_set_has_frame(4e87c735efc37a53). (self, g_value_get_booleancxx . . $ g_value_get_boolean(f890c5c75ead5b21). (value)); |
| 213 | break; |
| 214 | case PROP_PRIMARYcxx . . $ PROP_PRIMARY.: |
| 215 | gtk_menu_button_set_primarycxx . . $ gtk_menu_button_set_primary(4e87c735efc37a53). (self, g_value_get_booleancxx . . $ g_value_get_boolean(f890c5c75ead5b21). (value)); |
| 216 | break; |
| 217 | case PROP_CHILDcxx . . $ PROP_CHILD.: |
| 218 | gtk_menu_button_set_childcxx . . $ gtk_menu_button_set_child(b776b2571a0f34d3). (self, g_value_get_objectcxx . . $ g_value_get_object(e12dff36056c2cce). (value)); |
| 219 | break; |
| 220 | case PROP_ACTIVEcxx . . $ PROP_ACTIVE.: |
| 221 | gtk_menu_button_set_activecxx . . $ gtk_menu_button_set_active(4e87c735efc37a53). (self, g_value_get_booleancxx . . $ g_value_get_boolean(f890c5c75ead5b21). (value)); |
| 222 | break; |
| 223 | case PROP_CAN_SHRINKcxx . . $ PROP_CAN_SHRINK.: |
| 224 | gtk_menu_button_set_can_shrinkcxx . . $ gtk_menu_button_set_can_shrink(4e87c735efc37a53). (self, g_value_get_booleancxx . . $ g_value_get_boolean(f890c5c75ead5b21). (value)); |
| 225 | break; |
| 226 | default: |
| 227 | G_OBJECT_WARN_INVALID_PROPERTY_IDcxx . . $ `<external>/1341695927569185362/gobject.h:690:9`! (object, property_id, pspec); |
| 228 | } |
| 229 | } |
| 230 | |
| 231 | static void |
| 232 | gtk_menu_button_get_propertycxx . . $ gtk_menu_button_get_property(cee2c52f22407c66). (GObjectcxx . . $ GObject# *object, |
| 233 | guintcxx . . $ guint# property_id, |
| 234 | GValuecxx . . $ GValue# *value, |
| 235 | GParamSpeccxx . . $ GParamSpec# *pspec) |
| 236 | { |
| 237 | GtkMenuButtoncxx . . $ GtkMenuButton# *self = GTK_MENU_BUTTONcxx . . $ `gtk/gtkmenubutton.h:33:9`! (object); |
| 238 | |
| 239 | switch (property_id) |
| 240 | { |
| 241 | case PROP_MENU_MODELcxx . . $ PROP_MENU_MODEL.: |
| 242 | g_value_set_objectcxx . . $ g_value_set_object(e945b84c1e9702f). (value, self->modelcxx . . $ _GtkMenuButton#model.); |
| 243 | break; |
| 244 | case PROP_DIRECTIONcxx . . $ PROP_DIRECTION.: |
| 245 | g_value_set_enumcxx . . $ g_value_set_enum(b698c61e8e30c4ea). (value, self->arrow_typecxx . . $ _GtkMenuButton#arrow_type.); |
| 246 | break; |
| 247 | case PROP_POPOVERcxx . . $ PROP_POPOVER.: |
| 248 | g_value_set_objectcxx . . $ g_value_set_object(e945b84c1e9702f). (value, self->popovercxx . . $ _GtkMenuButton#popover.); |
| 249 | break; |
| 250 | case PROP_ICON_NAMEcxx . . $ PROP_ICON_NAME.: |
| 251 | g_value_set_stringcxx . . $ g_value_set_string(65b9ea7708b82b9b). (value, gtk_menu_button_get_icon_namecxx . . $ gtk_menu_button_get_icon_name(5ff5d82d25b59546). (GTK_MENU_BUTTONcxx . . $ `gtk/gtkmenubutton.h:33:9`! (object))); |
| 252 | break; |
| 253 | case PROP_ALWAYS_SHOW_ARROWcxx . . $ PROP_ALWAYS_SHOW_ARROW.: |
| 254 | g_value_set_booleancxx . . $ g_value_set_boolean(b698c61e8e30c4ea). (value, gtk_menu_button_get_always_show_arrowcxx . . $ gtk_menu_button_get_always_show_arrow(8d66f822f8ca91). (self)); |
| 255 | break; |
| 256 | case PROP_LABELcxx . . $ PROP_LABEL.: |
| 257 | g_value_set_stringcxx . . $ g_value_set_string(65b9ea7708b82b9b). (value, gtk_menu_button_get_labelcxx . . $ gtk_menu_button_get_label(5ff5d82d25b59546). (GTK_MENU_BUTTONcxx . . $ `gtk/gtkmenubutton.h:33:9`! (object))); |
| 258 | break; |
| 259 | case PROP_USE_UNDERLINEcxx . . $ PROP_USE_UNDERLINE.: |
| 260 | g_value_set_booleancxx . . $ g_value_set_boolean(b698c61e8e30c4ea). (value, gtk_menu_button_get_use_underlinecxx . . $ gtk_menu_button_get_use_underline(8d66f822f8ca91). (GTK_MENU_BUTTONcxx . . $ `gtk/gtkmenubutton.h:33:9`! (object))); |
| 261 | break; |
| 262 | case PROP_HAS_FRAMEcxx . . $ PROP_HAS_FRAME.: |
| 263 | g_value_set_booleancxx . . $ g_value_set_boolean(b698c61e8e30c4ea). (value, gtk_menu_button_get_has_framecxx . . $ gtk_menu_button_get_has_frame(8d66f822f8ca91). (GTK_MENU_BUTTONcxx . . $ `gtk/gtkmenubutton.h:33:9`! (object))); |
| 264 | break; |
| 265 | case PROP_PRIMARYcxx . . $ PROP_PRIMARY.: |
| 266 | g_value_set_booleancxx . . $ g_value_set_boolean(b698c61e8e30c4ea). (value, gtk_menu_button_get_primarycxx . . $ gtk_menu_button_get_primary(8d66f822f8ca91). (GTK_MENU_BUTTONcxx . . $ `gtk/gtkmenubutton.h:33:9`! (object))); |
| 267 | break; |
| 268 | case PROP_CHILDcxx . . $ PROP_CHILD.: |
| 269 | g_value_set_objectcxx . . $ g_value_set_object(e945b84c1e9702f). (value, gtk_menu_button_get_childcxx . . $ gtk_menu_button_get_child(d95598b85ec9bc8d). (self)); |
| 270 | break; |
| 271 | case PROP_ACTIVEcxx . . $ PROP_ACTIVE.: |
| 272 | g_value_set_booleancxx . . $ g_value_set_boolean(b698c61e8e30c4ea). (value, gtk_menu_button_get_activecxx . . $ gtk_menu_button_get_active(8d66f822f8ca91). (self)); |
| 273 | break; |
| 274 | case PROP_CAN_SHRINKcxx . . $ PROP_CAN_SHRINK.: |
| 275 | g_value_set_booleancxx . . $ g_value_set_boolean(b698c61e8e30c4ea). (value, gtk_menu_button_get_can_shrinkcxx . . $ gtk_menu_button_get_can_shrink(8d66f822f8ca91). (self)); |
| 276 | break; |
| 277 | default: |
| 278 | G_OBJECT_WARN_INVALID_PROPERTY_IDcxx . . $ `<external>/1341695927569185362/gobject.h:690:9`! (object, property_id, pspec); |
| 279 | } |
| 280 | } |
| 281 | |
| 282 | static void |
| 283 | gtk_menu_button_notifycxx . . $ gtk_menu_button_notify(89706f8943b9e738). (GObjectcxx . . $ GObject# *object, |
| 284 | GParamSpeccxx . . $ GParamSpec# *pspec) |
| 285 | { |
| 286 | if (strcmpcxx . . $ strcmp(5ae29d726ae57f88). (pspec->namecxx . . $ _GParamSpec#name., "focus-on-click") == 0) |
| 287 | { |
| 288 | GtkMenuButtoncxx . . $ GtkMenuButton# *self = GTK_MENU_BUTTONcxx . . $ `gtk/gtkmenubutton.h:33:9`! (object); |
| 289 | |
| 290 | gtk_widget_set_focus_on_clickcxx . . $ gtk_widget_set_focus_on_click(81f145f668a0074f). (self->buttoncxx . . $ _GtkMenuButton#button., |
| 291 | gtk_widget_get_focus_on_clickcxx . . $ gtk_widget_get_focus_on_click(9247ef2dc26c5426). (GTK_WIDGETcxx . . $ `gtk/gtkwidget.h:44:9`! (self))); |
| 292 | } |
| 293 | |
| 294 | if (G_OBJECT_CLASScxx . . $ `<external>/1341695927569185362/gobject.h:61:9`! (gtk_menu_button_parent_class)->notifycxx . . $ _GObjectClass#notify.) |
| 295 | G_OBJECT_CLASScxx . . $ `<external>/1341695927569185362/gobject.h:61:9`! (gtk_menu_button_parent_class)->notifycxx . . $ _GObjectClass#notify. (object, pspec); |
| 296 | } |
| 297 | |
| 298 | static void |
| 299 | gtk_menu_button_state_flags_changedcxx . . $ gtk_menu_button_state_flags_changed(e7d7ee4ea524d63). (GtkWidgetcxx . . $ GtkWidget# *widget, |
| 300 | GtkStateFlagscxx . . $ GtkStateFlags# previous_state_flags) |
| 301 | { |
| 302 | GtkMenuButtoncxx . . $ GtkMenuButton# *self = GTK_MENU_BUTTONcxx . . $ `gtk/gtkmenubutton.h:33:9`! (widget); |
| 303 | |
| 304 | if (!gtk_widget_is_sensitivecxx . . $ gtk_widget_is_sensitive(9247ef2dc26c5426). (widget)) |
| 305 | { |
| 306 | if (self->popovercxx . . $ _GtkMenuButton#popover.) |
| 307 | gtk_widget_set_visiblecxx . . $ gtk_widget_set_visible(81f145f668a0074f). (self->popovercxx . . $ _GtkMenuButton#popover., FALSEcxx . . $ `<external>/12741050725406041920/gmacros.h:967:9`!); |
| 308 | } |
| 309 | } |
| 310 | |
| 311 | static void |
| 312 | gtk_menu_button_toggledcxx . . $ gtk_menu_button_toggled(d46d383cb9623429). (GtkMenuButtoncxx . . $ GtkMenuButton# *self) |
| 313 | { |
| 314 | const gbooleancxx . . $ gboolean# active = gtk_toggle_button_get_activecxx . . $ gtk_toggle_button_get_active(a71b61b8ee1ea69c). (GTK_TOGGLE_BUTTONcxx . . $ `gtk/gtktogglebutton.h:38:9`! (self->button)); |
| 315 | |
| 316 | /* Might set a new menu/popover */ |
| 317 | if (active && self->create_popup_funccxx . . $ _GtkMenuButton#create_popup_func.) |
| 318 | { |
| 319 | self->create_popup_funccxx . . $ _GtkMenuButton#create_popup_func. (self, self->create_popup_user_datacxx . . $ _GtkMenuButton#create_popup_user_data.); |
| 320 | } |
| 321 | |
| 322 | if (self->popovercxx . . $ _GtkMenuButton#popover.) |
| 323 | { |
| 324 | if (active) |
| 325 | { |
| 326 | gtk_popover_popupcxx . . $ gtk_popover_popup(b785fb6a7faea117). (GTK_POPOVERcxx . . $ `gtk/gtkpopover.h:32:9`! (self->popover)); |
| 327 | gtk_accessible_update_statecxx . . $ gtk_accessible_update_state(a322e699be08ab8a). (GTK_ACCESSIBLEcxx . . $ GTK_ACCESSIBLE(4ecffd44f086533a). (self), |
| 328 | GTK_ACCESSIBLE_STATE_EXPANDEDcxx . . $ GTK_ACCESSIBLE_STATE_EXPANDED., TRUEcxx . . $ `<external>/12741050725406041920/gmacros.h:971:9`!, |
| 329 | -1); |
| 330 | } |
| 331 | else |
| 332 | { |
| 333 | gtk_popover_popdowncxx . . $ gtk_popover_popdown(b785fb6a7faea117). (GTK_POPOVERcxx . . $ `gtk/gtkpopover.h:32:9`! (self->popover)); |
| 334 | gtk_accessible_reset_statecxx . . $ gtk_accessible_reset_state(a21a779102f74de1). (GTK_ACCESSIBLEcxx . . $ GTK_ACCESSIBLE(4ecffd44f086533a). (self), |
| 335 | GTK_ACCESSIBLE_STATE_EXPANDEDcxx . . $ GTK_ACCESSIBLE_STATE_EXPANDED.); |
| 336 | } |
| 337 | } |
| 338 | |
| 339 | g_object_notify_by_pspeccxx . . $ g_object_notify_by_pspec(89706f8943b9e738). (G_OBJECTcxx . . $ `<external>/1341695927569185362/gobject.h:54:9`! (self), menu_button_propscxx . . $ menu_button_props.[PROP_ACTIVEcxx . . $ PROP_ACTIVE.]); |
| 340 | } |
| 341 | |
| 342 | static void |
| 343 | gtk_menu_button_measurecxx . . $ gtk_menu_button_measure(d91afbd837fc0c19). (GtkWidgetcxx . . $ GtkWidget# *widget, |
| 344 | GtkOrientationcxx . . $ GtkOrientation# orientation, |
| 345 | int for_size, |
| 346 | int *minimum, |
| 347 | int *natural, |
| 348 | int *minimum_baseline, |
| 349 | int *natural_baseline) |
| 350 | { |
| 351 | GtkMenuButtoncxx . . $ GtkMenuButton# *self = GTK_MENU_BUTTONcxx . . $ `gtk/gtkmenubutton.h:33:9`! (widget); |
| 352 | |
| 353 | gtk_widget_measurecxx . . $ gtk_widget_measure(d91afbd837fc0c19). (self->buttoncxx . . $ _GtkMenuButton#button., |
| 354 | orientation, |
| 355 | for_size, |
| 356 | minimum, natural, |
| 357 | minimum_baseline, natural_baseline); |
| 358 | |
| 359 | } |
| 360 | |
| 361 | static void |
| 362 | gtk_menu_button_size_allocatecxx . . $ gtk_menu_button_size_allocate(598a503332136822). (GtkWidgetcxx . . $ GtkWidget# *widget, |
| 363 | int width, |
| 364 | int height, |
| 365 | int baseline) |
| 366 | { |
| 367 | GtkMenuButtoncxx . . $ GtkMenuButton# *self= GTK_MENU_BUTTONcxx . . $ `gtk/gtkmenubutton.h:33:9`! (widget); |
| 368 | |
| 369 | gtk_widget_size_allocatecxx . . $ gtk_widget_size_allocate(6dbef67925be57e3). (self->buttoncxx . . $ _GtkMenuButton#button., |
| 370 | &(GtkAllocationcxx . . $ GtkAllocation#) { 0, 0, width, height }, |
| 371 | baseline); |
| 372 | if (self->popovercxx . . $ _GtkMenuButton#popover.) |
| 373 | gtk_popover_presentcxx . . $ gtk_popover_present(b785fb6a7faea117). (GTK_POPOVERcxx . . $ `gtk/gtkpopover.h:32:9`! (self->popover)); |
| 374 | } |
| 375 | |
| 376 | static gbooleancxx . . $ gboolean# |
| 377 | gtk_menu_button_focuscxx . . $ gtk_menu_button_focus(8bb1c65c821a69cd). (GtkWidgetcxx . . $ GtkWidget# *widget, |
| 378 | GtkDirectionTypecxx . . $ GtkDirectionType# direction) |
| 379 | { |
| 380 | GtkMenuButtoncxx . . $ GtkMenuButton# *self = GTK_MENU_BUTTONcxx . . $ `gtk/gtkmenubutton.h:33:9`! (widget); |
| 381 | |
| 382 | if (self->popovercxx . . $ _GtkMenuButton#popover. && gtk_widget_get_visiblecxx . . $ gtk_widget_get_visible(9247ef2dc26c5426). (self->popovercxx . . $ _GtkMenuButton#popover.)) |
| 383 | return gtk_widget_child_focuscxx . . $ gtk_widget_child_focus(8bb1c65c821a69cd). (self->popovercxx . . $ _GtkMenuButton#popover., direction); |
| 384 | else |
| 385 | return gtk_widget_child_focuscxx . . $ gtk_widget_child_focus(8bb1c65c821a69cd). (self->buttoncxx . . $ _GtkMenuButton#button., direction); |
| 386 | } |
| 387 | |
| 388 | static gbooleancxx . . $ gboolean# |
| 389 | gtk_menu_button_grab_focuscxx . . $ gtk_menu_button_grab_focus(9247ef2dc26c5426). (GtkWidgetcxx . . $ GtkWidget# *widget) |
| 390 | { |
| 391 | GtkMenuButtoncxx . . $ GtkMenuButton# *self = GTK_MENU_BUTTONcxx . . $ `gtk/gtkmenubutton.h:33:9`! (widget); |
| 392 | |
| 393 | return gtk_widget_grab_focuscxx . . $ gtk_widget_grab_focus(9247ef2dc26c5426). (self->buttoncxx . . $ _GtkMenuButton#button.); |
| 394 | } |
| 395 | |
| 396 | static void |
| 397 | gtk_menu_button_activatecxx . . $ gtk_menu_button_activate(d46d383cb9623429). (GtkMenuButtoncxx . . $ GtkMenuButton# *self) |
| 398 | { |
| 399 | gtk_widget_activatecxx . . $ gtk_widget_activate(9247ef2dc26c5426). (self->buttoncxx . . $ _GtkMenuButton#button.); |
| 400 | } |
| 401 | |
| 402 | static void gtk_menu_button_rootcxx . . $ gtk_menu_button_root(d7cf858254b37903). (GtkWidgetcxx . . $ GtkWidget# *widget); |
| 403 | static void gtk_menu_button_unrootcxx . . $ gtk_menu_button_unroot(d7cf858254b37903). (GtkWidgetcxx . . $ GtkWidget# *widget); |
| 404 | |
| 405 | static void |
| 406 | gtk_menu_button_class_initcxx . . $ gtk_menu_button_class_init(a63f575a46239cd7). (GtkMenuButtonClasscxx . . $ GtkMenuButtonClass# *klass) |
| 407 | { |
| 408 | GObjectClasscxx . . $ GObjectClass# *gobject_class = G_OBJECT_CLASScxx . . $ `<external>/1341695927569185362/gobject.h:61:9`! (klass); |
| 409 | GtkWidgetClasscxx . . $ GtkWidgetClass# *widget_class = GTK_WIDGET_CLASScxx . . $ `gtk/gtkwidget.h:45:9`! (klass); |
| 410 | |
| 411 | gobject_class->set_propertycxx . . $ _GObjectClass#set_property. = gtk_menu_button_set_propertycxx . . $ gtk_menu_button_set_property(d7c4bb29f36c0dc4).; |
| 412 | gobject_class->get_propertycxx . . $ _GObjectClass#get_property. = gtk_menu_button_get_propertycxx . . $ gtk_menu_button_get_property(cee2c52f22407c66).; |
| 413 | gobject_class->notifycxx . . $ _GObjectClass#notify. = gtk_menu_button_notifycxx . . $ gtk_menu_button_notify(89706f8943b9e738).; |
| 414 | gobject_class->disposecxx . . $ _GObjectClass#dispose. = gtk_menu_button_disposecxx . . $ gtk_menu_button_dispose(6087475fa43034d3).; |
| 415 | |
| 416 | widget_class->rootcxx . . $ _GtkWidgetClass#root. = gtk_menu_button_rootcxx . . $ gtk_menu_button_root(d7cf858254b37903).; |
| 417 | widget_class->unrootcxx . . $ _GtkWidgetClass#unroot. = gtk_menu_button_unrootcxx . . $ gtk_menu_button_unroot(d7cf858254b37903).; |
| 418 | widget_class->measurecxx . . $ _GtkWidgetClass#measure. = gtk_menu_button_measurecxx . . $ gtk_menu_button_measure(d91afbd837fc0c19).; |
| 419 | widget_class->size_allocatecxx . . $ _GtkWidgetClass#size_allocate. = gtk_menu_button_size_allocatecxx . . $ gtk_menu_button_size_allocate(598a503332136822).; |
| 420 | widget_class->state_flags_changedcxx . . $ _GtkWidgetClass#state_flags_changed. = gtk_menu_button_state_flags_changedcxx . . $ gtk_menu_button_state_flags_changed(e7d7ee4ea524d63).; |
| 421 | widget_class->focuscxx . . $ _GtkWidgetClass#focus. = gtk_menu_button_focuscxx . . $ gtk_menu_button_focus(8bb1c65c821a69cd).; |
| 422 | widget_class->grab_focuscxx . . $ _GtkWidgetClass#grab_focus. = gtk_menu_button_grab_focuscxx . . $ gtk_menu_button_grab_focus(9247ef2dc26c5426).; |
| 423 | |
| 424 | klass->activatecxx . . $ _GtkMenuButtonClass#activate. = gtk_menu_button_activatecxx . . $ gtk_menu_button_activate(d46d383cb9623429).; |
| 425 | |
| 426 | /** |
| 427 | * GtkMenuButton:menu-model: |
| 428 | * |
| 429 | * The `GMenuModel` from which the popup will be created. |
| 430 | * |
| 431 | * See [[email protected]_menu_model] for the interaction |
| 432 | * with the [[email protected]:popover] property. |
| 433 | */ |
| 434 | menu_button_propscxx . . $ menu_button_props.[PROP_MENU_MODELcxx . . $ PROP_MENU_MODEL.] = |
| 435 | g_param_spec_objectcxx . . $ g_param_spec_object(faf99966f027a127). ("menu-model", NULLcxx . . $ `<external>/15298297234472979974/stddef.h:419:9`!, NULLcxx . . $ `<external>/15298297234472979974/stddef.h:419:9`!, |
| 436 | G_TYPE_MENU_MODELcxx . . $ `<external>/17783962342109199441/gmenumodel.h:115:9`!, |
| 437 | GTK_PARAM_READWRITEcxx . . $ `gtk/gtkprivate.h:44:9`!); |
| 438 | |
| 439 | /** |
| 440 | * GtkMenuButton:direction: |
| 441 | * |
| 442 | * The `GtkArrowType` representing the direction in which the |
| 443 | * menu or popover will be popped out. |
| 444 | */ |
| 445 | menu_button_propscxx . . $ menu_button_props.[PROP_DIRECTIONcxx . . $ PROP_DIRECTION.] = |
| 446 | g_param_spec_enumcxx . . $ g_param_spec_enum(bfeb217b5dc6c0ac). ("direction", NULLcxx . . $ `<external>/15298297234472979974/stddef.h:419:9`!, NULLcxx . . $ `<external>/15298297234472979974/stddef.h:419:9`!, |
| 447 | GTK_TYPE_ARROW_TYPEcxx . . $ `build/gtk/gtktypebuiltins.h:120:9`!, |
| 448 | GTK_ARROW_DOWNcxx . . $ GTK_ARROW_DOWN., |
| 449 | GTK_PARAM_READWRITEcxx . . $ `gtk/gtkprivate.h:44:9`!|G_PARAM_EXPLICIT_NOTIFYcxx . . $ G_PARAM_EXPLICIT_NOTIFY.); |
| 450 | |
| 451 | /** |
| 452 | * GtkMenuButton:popover: |
| 453 | * |
| 454 | * The `GtkPopover` that will be popped up when the button is clicked. |
| 455 | */ |
| 456 | menu_button_propscxx . . $ menu_button_props.[PROP_POPOVERcxx . . $ PROP_POPOVER.] = |
| 457 | g_param_spec_objectcxx . . $ g_param_spec_object(faf99966f027a127). ("popover", NULLcxx . . $ `<external>/15298297234472979974/stddef.h:419:9`!, NULLcxx . . $ `<external>/15298297234472979974/stddef.h:419:9`!, |
| 458 | GTK_TYPE_POPOVERcxx . . $ `gtk/gtkpopover.h:31:9`!, |
| 459 | G_PARAM_READWRITEcxx . . $ G_PARAM_READWRITE.); |
| 460 | |
| 461 | /** |
| 462 | * GtkMenuButton:icon-name: |
| 463 | * |
| 464 | * The name of the icon used to automatically populate the button. |
| 465 | */ |
| 466 | menu_button_propscxx . . $ menu_button_props.[PROP_ICON_NAMEcxx . . $ PROP_ICON_NAME.] = |
| 467 | g_param_spec_stringcxx . . $ g_param_spec_string(378e8746be5cd899). ("icon-name", NULLcxx . . $ `<external>/15298297234472979974/stddef.h:419:9`!, NULLcxx . . $ `<external>/15298297234472979974/stddef.h:419:9`!, |
| 468 | NULLcxx . . $ `<external>/15298297234472979974/stddef.h:419:9`!, |
| 469 | GTK_PARAM_READWRITEcxx . . $ `gtk/gtkprivate.h:44:9`!|G_PARAM_EXPLICIT_NOTIFYcxx . . $ G_PARAM_EXPLICIT_NOTIFY.); |
| 470 | |
| 471 | /** |
| 472 | * GtkMenuButton:always-show-arrow: |
| 473 | * |
| 474 | * Whether to show a dropdown arrow even when using an icon or a custom child. |
| 475 | * |
| 476 | * Since: 4.4 |
| 477 | */ |
| 478 | menu_button_propscxx . . $ menu_button_props.[PROP_ALWAYS_SHOW_ARROWcxx . . $ PROP_ALWAYS_SHOW_ARROW.] = |
| 479 | g_param_spec_booleancxx . . $ g_param_spec_boolean(315d86b79c0116e0). ("always-show-arrow", NULLcxx . . $ `<external>/15298297234472979974/stddef.h:419:9`!, NULLcxx . . $ `<external>/15298297234472979974/stddef.h:419:9`!, |
| 480 | FALSEcxx . . $ `<external>/12741050725406041920/gmacros.h:967:9`!, |
| 481 | GTK_PARAM_READWRITEcxx . . $ `gtk/gtkprivate.h:44:9`!|G_PARAM_EXPLICIT_NOTIFYcxx . . $ G_PARAM_EXPLICIT_NOTIFY.); |
| 482 | |
| 483 | /** |
| 484 | * GtkMenuButton:label: |
| 485 | * |
| 486 | * The label for the button. |
| 487 | */ |
| 488 | menu_button_propscxx . . $ menu_button_props.[PROP_LABELcxx . . $ PROP_LABEL.] = |
| 489 | g_param_spec_stringcxx . . $ g_param_spec_string(378e8746be5cd899). ("label", NULLcxx . . $ `<external>/15298297234472979974/stddef.h:419:9`!, NULLcxx . . $ `<external>/15298297234472979974/stddef.h:419:9`!, |
| 490 | NULLcxx . . $ `<external>/15298297234472979974/stddef.h:419:9`!, |
| 491 | GTK_PARAM_READWRITEcxx . . $ `gtk/gtkprivate.h:44:9`!|G_PARAM_EXPLICIT_NOTIFYcxx . . $ G_PARAM_EXPLICIT_NOTIFY.); |
| 492 | |
| 493 | /** |
| 494 | * GtkMenuButton:use-underline: |
| 495 | * |
| 496 | * If set an underscore in the text indicates a mnemonic. |
| 497 | */ |
| 498 | menu_button_propscxx . . $ menu_button_props.[PROP_USE_UNDERLINEcxx . . $ PROP_USE_UNDERLINE.] = |
| 499 | g_param_spec_booleancxx . . $ g_param_spec_boolean(315d86b79c0116e0). ("use-underline", NULLcxx . . $ `<external>/15298297234472979974/stddef.h:419:9`!, NULLcxx . . $ `<external>/15298297234472979974/stddef.h:419:9`!, |
| 500 | FALSEcxx . . $ `<external>/12741050725406041920/gmacros.h:967:9`!, |
| 501 | GTK_PARAM_READWRITEcxx . . $ `gtk/gtkprivate.h:44:9`!|G_PARAM_EXPLICIT_NOTIFYcxx . . $ G_PARAM_EXPLICIT_NOTIFY.); |
| 502 | |
| 503 | /** |
| 504 | * GtkMenuButton:has-frame: |
| 505 | * |
| 506 | * Whether the button has a frame. |
| 507 | */ |
| 508 | menu_button_propscxx . . $ menu_button_props.[PROP_HAS_FRAMEcxx . . $ PROP_HAS_FRAME.] = |
| 509 | g_param_spec_booleancxx . . $ g_param_spec_boolean(315d86b79c0116e0). ("has-frame", NULLcxx . . $ `<external>/15298297234472979974/stddef.h:419:9`!, NULLcxx . . $ `<external>/15298297234472979974/stddef.h:419:9`!, |
| 510 | TRUEcxx . . $ `<external>/12741050725406041920/gmacros.h:971:9`!, |
| 511 | GTK_PARAM_READWRITEcxx . . $ `gtk/gtkprivate.h:44:9`!|G_PARAM_EXPLICIT_NOTIFYcxx . . $ G_PARAM_EXPLICIT_NOTIFY.); |
| 512 | |
| 513 | /** |
| 514 | * GtkMenuButton:primary: |
| 515 | * |
| 516 | * Whether the menu button acts as a primary menu. |
| 517 | * |
| 518 | * Primary menus can be opened using the <kbd>F10</kbd> key |
| 519 | * |
| 520 | * Since: 4.4 |
| 521 | */ |
| 522 | menu_button_propscxx . . $ menu_button_props.[PROP_PRIMARYcxx . . $ PROP_PRIMARY.] = |
| 523 | g_param_spec_booleancxx . . $ g_param_spec_boolean(315d86b79c0116e0). ("primary", NULLcxx . . $ `<external>/15298297234472979974/stddef.h:419:9`!, NULLcxx . . $ `<external>/15298297234472979974/stddef.h:419:9`!, |
| 524 | FALSEcxx . . $ `<external>/12741050725406041920/gmacros.h:967:9`!, |
| 525 | GTK_PARAM_READWRITEcxx . . $ `gtk/gtkprivate.h:44:9`!|G_PARAM_EXPLICIT_NOTIFYcxx . . $ G_PARAM_EXPLICIT_NOTIFY.); |
| 526 | |
| 527 | /** |
| 528 | * GtkMenuButton:child: |
| 529 | * |
| 530 | * The child widget. |
| 531 | * |
| 532 | * Since: 4.6 |
| 533 | */ |
| 534 | menu_button_propscxx . . $ menu_button_props.[PROP_CHILDcxx . . $ PROP_CHILD.] = |
| 535 | g_param_spec_objectcxx . . $ g_param_spec_object(faf99966f027a127). ("child", NULLcxx . . $ `<external>/15298297234472979974/stddef.h:419:9`!, NULLcxx . . $ `<external>/15298297234472979974/stddef.h:419:9`!, |
| 536 | GTK_TYPE_WIDGETcxx . . $ `gtk/gtkwidget.h:43:9`!, |
| 537 | GTK_PARAM_READWRITEcxx . . $ `gtk/gtkprivate.h:44:9`!|G_PARAM_EXPLICIT_NOTIFYcxx . . $ G_PARAM_EXPLICIT_NOTIFY.); |
| 538 | |
| 539 | /** |
| 540 | * GtkMenuButton:active: |
| 541 | * |
| 542 | * Whether the menu button is active. |
| 543 | * |
| 544 | * Since: 4.10 |
| 545 | */ |
| 546 | menu_button_propscxx . . $ menu_button_props.[PROP_ACTIVEcxx . . $ PROP_ACTIVE.] = |
| 547 | g_param_spec_booleancxx . . $ g_param_spec_boolean(315d86b79c0116e0). ("active", NULLcxx . . $ `<external>/15298297234472979974/stddef.h:419:9`!, NULLcxx . . $ `<external>/15298297234472979974/stddef.h:419:9`!, |
| 548 | FALSEcxx . . $ `<external>/12741050725406041920/gmacros.h:967:9`!, |
| 549 | GTK_PARAM_READWRITEcxx . . $ `gtk/gtkprivate.h:44:9`!|G_PARAM_EXPLICIT_NOTIFYcxx . . $ G_PARAM_EXPLICIT_NOTIFY.); |
| 550 | |
| 551 | /** |
| 552 | * GtkMenuButton:can-shrink: |
| 553 | * |
| 554 | * Whether the size of the button can be made smaller than the natural |
| 555 | * size of its contents. |
| 556 | * |
| 557 | * Since: 4.12 |
| 558 | */ |
| 559 | menu_button_propscxx . . $ menu_button_props.[PROP_CAN_SHRINKcxx . . $ PROP_CAN_SHRINK.] = |
| 560 | g_param_spec_booleancxx . . $ g_param_spec_boolean(315d86b79c0116e0). ("can-shrink", NULLcxx . . $ `<external>/15298297234472979974/stddef.h:419:9`!, NULLcxx . . $ `<external>/15298297234472979974/stddef.h:419:9`!, |
| 561 | FALSEcxx . . $ `<external>/12741050725406041920/gmacros.h:967:9`!, |
| 562 | GTK_PARAM_READWRITEcxx . . $ `gtk/gtkprivate.h:44:9`!|G_PARAM_EXPLICIT_NOTIFYcxx . . $ G_PARAM_EXPLICIT_NOTIFY.); |
| 563 | |
| 564 | g_object_class_install_propertiescxx . . $ g_object_class_install_properties(569d03e6a4088541). (gobject_class, LAST_PROPcxx . . $ LAST_PROP., menu_button_propscxx . . $ menu_button_props.); |
| 565 | |
| 566 | /** |
| 567 | * GtkMenuButton::activate: |
| 568 | * @widget: the object which received the signal. |
| 569 | * |
| 570 | * Emitted to when the menu button is activated. |
| 571 | * |
| 572 | * The `::activate` signal on `GtkMenuButton` is an action signal and |
| 573 | * emitting it causes the button to pop up its menu. |
| 574 | * |
| 575 | * Since: 4.4 |
| 576 | */ |
| 577 | signalscxx . . $ signals.[ACTIVATEcxx . . $ ACTIVATE.] = |
| 578 | g_signal_newcxx . . $ g_signal_new(b0aa5e8090fb95c0). (I_cxx . . $ `gdk/gdkprivate.h:35:9`! ("activate"), |
| 579 | G_OBJECT_CLASS_TYPEcxx . . $ `<external>/1341695927569185362/gobject.h:117:9`! (gobject_class), |
| 580 | G_SIGNAL_RUN_FIRSTcxx . . $ G_SIGNAL_RUN_FIRST. | G_SIGNAL_ACTIONcxx . . $ G_SIGNAL_ACTION., |
| 581 | G_STRUCT_OFFSETcxx . . $ `<external>/12741050725406041920/gmacros.h:1005:9`! (GtkMenuButtonClass, activate), |
| 582 | NULLcxx . . $ `<external>/15298297234472979974/stddef.h:419:9`!, NULLcxx . . $ `<external>/15298297234472979974/stddef.h:419:9`!, |
| 583 | NULLcxx . . $ `<external>/15298297234472979974/stddef.h:419:9`!, |
| 584 | G_TYPE_NONEcxx . . $ `<external>/9567554376676449156/gtype.h:72:9`!, 0); |
| 585 | |
| 586 | gtk_widget_class_set_activate_signalcxx . . $ gtk_widget_class_set_activate_signal(53d965ee418c3db). (widget_class, signalscxx . . $ signals.[ACTIVATEcxx . . $ ACTIVATE.]); |
| 587 | |
| 588 | gtk_widget_class_set_css_namecxx . . $ gtk_widget_class_set_css_name(6333614c746ab65a). (widget_class, I_cxx . . $ `gdk/gdkprivate.h:35:9`!("menubutton")); |
| 589 | gtk_widget_class_set_accessible_rolecxx . . $ gtk_widget_class_set_accessible_role(a3df1a29abf28273). (widget_class, GTK_ACCESSIBLE_ROLE_BUTTONcxx . . $ GTK_ACCESSIBLE_ROLE_BUTTON.); |
| 590 | } |
| 591 | |
| 592 | static void |
| 593 | set_arrow_typecxx . . $ set_arrow_type(77ac7bcc377f84). (GtkWidgetcxx . . $ GtkWidget# *arrow, |
| 594 | GtkArrowTypecxx . . $ GtkArrowType# arrow_type, |
| 595 | gbooleancxx . . $ gboolean# visible) |
| 596 | { |
| 597 | gtk_widget_remove_css_classcxx . . $ gtk_widget_remove_css_class(3e0616a87a6c51e5). (arrow, "none"); |
| 598 | gtk_widget_remove_css_classcxx . . $ gtk_widget_remove_css_class(3e0616a87a6c51e5). (arrow, "down"); |
| 599 | gtk_widget_remove_css_classcxx . . $ gtk_widget_remove_css_class(3e0616a87a6c51e5). (arrow, "up"); |
| 600 | gtk_widget_remove_css_classcxx . . $ gtk_widget_remove_css_class(3e0616a87a6c51e5). (arrow, "left"); |
| 601 | gtk_widget_remove_css_classcxx . . $ gtk_widget_remove_css_class(3e0616a87a6c51e5). (arrow, "right"); |
| 602 | switch (arrow_type) |
| 603 | { |
| 604 | case GTK_ARROW_NONEcxx . . $ GTK_ARROW_NONE.: |
| 605 | gtk_widget_add_css_classcxx . . $ gtk_widget_add_css_class(3e0616a87a6c51e5). (arrow, "none"); |
| 606 | break; |
| 607 | case GTK_ARROW_DOWNcxx . . $ GTK_ARROW_DOWN.: |
| 608 | gtk_widget_add_css_classcxx . . $ gtk_widget_add_css_class(3e0616a87a6c51e5). (arrow, "down"); |
| 609 | break; |
| 610 | case GTK_ARROW_UPcxx . . $ GTK_ARROW_UP.: |
| 611 | gtk_widget_add_css_classcxx . . $ gtk_widget_add_css_class(3e0616a87a6c51e5). (arrow, "up"); |
| 612 | break; |
| 613 | case GTK_ARROW_LEFTcxx . . $ GTK_ARROW_LEFT.: |
| 614 | gtk_widget_add_css_classcxx . . $ gtk_widget_add_css_class(3e0616a87a6c51e5). (arrow, "left"); |
| 615 | break; |
| 616 | case GTK_ARROW_RIGHTcxx . . $ GTK_ARROW_RIGHT.: |
| 617 | gtk_widget_add_css_classcxx . . $ gtk_widget_add_css_class(3e0616a87a6c51e5). (arrow, "right"); |
| 618 | break; |
| 619 | default: |
| 620 | break; |
| 621 | } |
| 622 | |
| 623 | gtk_widget_set_visiblecxx . . $ gtk_widget_set_visible(81f145f668a0074f). (arrow, visible); |
| 624 | } |
| 625 | |
| 626 | static void |
| 627 | update_style_classescxx . . $ update_style_classes(d46d383cb9623429). (GtkMenuButtoncxx . . $ GtkMenuButton# *menu_button) |
| 628 | { |
| 629 | gbooleancxx . . $ gboolean# has_icon = menu_button->image_widgetcxx . . $ _GtkMenuButton#image_widget. != NULLcxx . . $ `<external>/15298297234472979974/stddef.h:419:9`!; |
| 630 | gbooleancxx . . $ gboolean# has_label = menu_button->label_widgetcxx . . $ _GtkMenuButton#label_widget. != NULLcxx . . $ `<external>/15298297234472979974/stddef.h:419:9`!; |
| 631 | gbooleancxx . . $ gboolean# has_only_arrow = menu_button->arrow_widgetcxx . . $ _GtkMenuButton#arrow_widget. == gtk_button_get_childcxx . . $ gtk_button_get_child(59ace0eb5a68a7f1). (GTK_BUTTONcxx . . $ `gtk/gtkbutton.h:37:9`! (menu_button->button)); |
| 632 | gbooleancxx . . $ gboolean# has_arrow = gtk_widget_get_visiblecxx . . $ gtk_widget_get_visible(9247ef2dc26c5426). (menu_button->arrow_widgetcxx . . $ _GtkMenuButton#arrow_widget.); |
| 633 | |
| 634 | if (has_only_arrow || has_icon) |
| 635 | gtk_widget_add_css_classcxx . . $ gtk_widget_add_css_class(3e0616a87a6c51e5). (menu_button->buttoncxx . . $ _GtkMenuButton#button., "image-button"); |
| 636 | else |
| 637 | gtk_widget_remove_css_classcxx . . $ gtk_widget_remove_css_class(3e0616a87a6c51e5). (menu_button->buttoncxx . . $ _GtkMenuButton#button., "image-button"); |
| 638 | |
| 639 | if (has_label) |
| 640 | gtk_widget_add_css_classcxx . . $ gtk_widget_add_css_class(3e0616a87a6c51e5). (menu_button->buttoncxx . . $ _GtkMenuButton#button., "text-button"); |
| 641 | else |
| 642 | gtk_widget_remove_css_classcxx . . $ gtk_widget_remove_css_class(3e0616a87a6c51e5). (menu_button->buttoncxx . . $ _GtkMenuButton#button., "text-button"); |
| 643 | |
| 644 | if (has_arrow && !has_only_arrow) |
| 645 | gtk_widget_add_css_classcxx . . $ gtk_widget_add_css_class(3e0616a87a6c51e5). (menu_button->buttoncxx . . $ _GtkMenuButton#button., "arrow-button"); |
| 646 | else |
| 647 | gtk_widget_remove_css_classcxx . . $ gtk_widget_remove_css_class(3e0616a87a6c51e5). (menu_button->buttoncxx . . $ _GtkMenuButton#button., "arrow-button"); |
| 648 | } |
| 649 | |
| 650 | static void |
| 651 | update_arrowcxx . . $ update_arrow(d46d383cb9623429). (GtkMenuButtoncxx . . $ GtkMenuButton# *menu_button) |
| 652 | { |
| 653 | gbooleancxx . . $ gboolean# has_only_arrow, is_text_button; |
| 654 | |
| 655 | if (menu_button->arrow_widgetcxx . . $ _GtkMenuButton#arrow_widget. == NULLcxx . . $ `<external>/15298297234472979974/stddef.h:419:9`!) |
| 656 | return; |
| 657 | |
| 658 | has_only_arrow = menu_button->arrow_widgetcxx . . $ _GtkMenuButton#arrow_widget. == gtk_button_get_childcxx . . $ gtk_button_get_child(59ace0eb5a68a7f1). (GTK_BUTTONcxx . . $ `gtk/gtkbutton.h:37:9`! (menu_button->button)); |
| 659 | is_text_button = menu_button->label_widgetcxx . . $ _GtkMenuButton#label_widget. != NULLcxx . . $ `<external>/15298297234472979974/stddef.h:419:9`!; |
| 660 | |
| 661 | set_arrow_typecxx . . $ set_arrow_type(77ac7bcc377f84). (menu_button->arrow_widgetcxx . . $ _GtkMenuButton#arrow_widget., |
| 662 | menu_button->arrow_typecxx . . $ _GtkMenuButton#arrow_type., |
| 663 | has_only_arrow || |
| 664 | ((is_text_button || menu_button->always_show_arrowcxx . . $ _GtkMenuButton#always_show_arrow.) && |
| 665 | (menu_button->arrow_typecxx . . $ _GtkMenuButton#arrow_type. != GTK_ARROW_NONEcxx . . $ GTK_ARROW_NONE.))); |
| 666 | |
| 667 | update_style_classescxx . . $ update_style_classes(d46d383cb9623429). (menu_button); |
| 668 | } |
| 669 | |
| 670 | static void |
| 671 | add_arrowcxx . . $ add_arrow(d46d383cb9623429). (GtkMenuButtoncxx . . $ GtkMenuButton# *self) |
| 672 | { |
| 673 | GtkWidgetcxx . . $ GtkWidget# *arrow; |
| 674 | |
| 675 | arrow = gtk_builtin_icon_newcxx . . $ gtk_builtin_icon_new(6d90f3ec8782e10d). ("arrow"); |
| 676 | gtk_widget_set_haligncxx . . $ gtk_widget_set_halign(71362b4a1e4eb244). (arrow, GTK_ALIGN_CENTERcxx . . $ GTK_ALIGN_CENTER.); |
| 677 | set_arrow_typecxx . . $ set_arrow_type(77ac7bcc377f84). (arrow, self->arrow_typecxx . . $ _GtkMenuButton#arrow_type., TRUEcxx . . $ `<external>/12741050725406041920/gmacros.h:971:9`!); |
| 678 | gtk_button_set_childcxx . . $ gtk_button_set_child(8c03878ed7d55c1e). (GTK_BUTTONcxx . . $ `gtk/gtkbutton.h:37:9`! (self->button), arrow); |
| 679 | self->arrow_widgetcxx . . $ _GtkMenuButton#arrow_widget. = arrow; |
| 680 | } |
| 681 | |
| 682 | static void |
| 683 | gtk_menu_button_initcxx . . $ gtk_menu_button_init(d46d383cb9623429). (GtkMenuButtoncxx . . $ GtkMenuButton# *self) |
| 684 | { |
| 685 | self->arrow_typecxx . . $ _GtkMenuButton#arrow_type. = GTK_ARROW_DOWNcxx . . $ GTK_ARROW_DOWN.; |
| 686 | |
| 687 | self->buttoncxx . . $ _GtkMenuButton#button. = gtk_toggle_button_newcxx . . $ gtk_toggle_button_new(2369ce5e9f2c7dfd). (); |
| 688 | gtk_widget_set_parentcxx . . $ gtk_widget_set_parent(4f261c0971c30e7). (self->buttoncxx . . $ _GtkMenuButton#button., GTK_WIDGETcxx . . $ `gtk/gtkwidget.h:44:9`! (self)); |
| 689 | g_signal_connect_swappedcxx . . $ `<external>/15952772511652638895/gsignal.h:617:9`! (self->button, "toggled", G_CALLBACKcxx . . $ `<external>/16473872192229286895/gclosure.h:73:9`! (gtk_menu_button_toggled), self); |
| 690 | add_arrowcxx . . $ add_arrow(d46d383cb9623429). (self); |
| 691 | update_style_classescxx . . $ update_style_classes(d46d383cb9623429). (self); |
| 692 | |
| 693 | gtk_widget_set_sensitivecxx . . $ gtk_widget_set_sensitive(81f145f668a0074f). (self->buttoncxx . . $ _GtkMenuButton#button., FALSEcxx . . $ `<external>/12741050725406041920/gmacros.h:967:9`!); |
| 694 | |
| 695 | gtk_widget_add_css_classcxx . . $ gtk_widget_add_css_class(3e0616a87a6c51e5). (GTK_WIDGETcxx . . $ `gtk/gtkwidget.h:44:9`! (self), "popup"); |
| 696 | } |
| 697 | |
| 698 | static GtkBuildableIfacecxx . . $ GtkBuildableIface# *parent_buildable_ifacecxx . . $ parent_buildable_iface.; |
| 699 | |
| 700 | static void |
| 701 | gtk_menu_button_buildable_add_childcxx . . $ gtk_menu_button_buildable_add_child(784606fbae7a2cc). (GtkBuildablecxx . . $ GtkBuildable# *buildable, |
| 702 | GtkBuildercxx . . $ GtkBuilder# *builder, |
| 703 | GObjectcxx . . $ GObject# *child, |
| 704 | const char *type) |
| 705 | { |
| 706 | if (GTK_IS_WIDGETcxx . . $ `gtk/gtkwidget.h:46:9`! (child)) |
| 707 | { |
| 708 | gtk_buildable_child_deprecation_warningcxx . . $ gtk_buildable_child_deprecation_warning(f47ca88812b837c7). (buildable, builder, NULLcxx . . $ `<external>/15298297234472979974/stddef.h:419:9`!, "child"); |
| 709 | gtk_menu_button_set_childcxx . . $ gtk_menu_button_set_child(b776b2571a0f34d3). (GTK_MENU_BUTTONcxx . . $ `gtk/gtkmenubutton.h:33:9`! (buildable), GTK_WIDGETcxx . . $ `gtk/gtkwidget.h:44:9`! (child)); |
| 710 | } |
| 711 | else |
| 712 | { |
| 713 | parent_buildable_ifacecxx . . $ parent_buildable_iface.->add_childcxx . . $ _GtkBuildableIface#add_child. (buildable, builder, child, type); |
| 714 | } |
| 715 | } |
| 716 | |
| 717 | static void |
| 718 | gtk_menu_button_buildable_iface_initcxx . . $ gtk_menu_button_buildable_iface_init(c5db55232772c4cd). (GtkBuildableIfacecxx . . $ GtkBuildableIface# *iface) |
| 719 | { |
| 720 | parent_buildable_ifacecxx . . $ parent_buildable_iface. = g_type_interface_peek_parentcxx . . $ g_type_interface_peek_parent(9f162e79bfc6c74). (iface); |
| 721 | |
| 722 | iface->add_childcxx . . $ _GtkBuildableIface#add_child. = gtk_menu_button_buildable_add_childcxx . . $ gtk_menu_button_buildable_add_child(784606fbae7a2cc).; |
| 723 | } |
| 724 | |
| 725 | /** |
| 726 | * gtk_menu_button_new: |
| 727 | * |
| 728 | * Creates a new `GtkMenuButton` widget with downwards-pointing |
| 729 | * arrow as the only child. |
| 730 | * |
| 731 | * You can replace the child widget with another `GtkWidget` |
| 732 | * should you wish to. |
| 733 | * |
| 734 | * Returns: The newly created `GtkMenuButton` |
| 735 | */ |
| 736 | GtkWidgetcxx . . $ GtkWidget# * |
| 737 | gtk_menu_button_newcxx . . $ gtk_menu_button_new(2369ce5e9f2c7dfd). (void) |
| 738 | { |
| 739 | return g_object_newcxx . . $ g_object_new(8485fe61b4be4c78). (GTK_TYPE_MENU_BUTTONcxx . . $ `gtk/gtkmenubutton.h:32:9`!, NULLcxx . . $ `<external>/15298297234472979974/stddef.h:419:9`!); |
| 740 | } |
| 741 | |
| 742 | static void |
| 743 | update_sensitivitycxx . . $ update_sensitivity(d46d383cb9623429). (GtkMenuButtoncxx . . $ GtkMenuButton# *self) |
| 744 | { |
| 745 | gbooleancxx . . $ gboolean# has_popup; |
| 746 | |
| 747 | has_popup = self->popovercxx . . $ _GtkMenuButton#popover. != NULLcxx . . $ `<external>/15298297234472979974/stddef.h:419:9`! || self->create_popup_funccxx . . $ _GtkMenuButton#create_popup_func. != NULLcxx . . $ `<external>/15298297234472979974/stddef.h:419:9`!; |
| 748 | |
| 749 | gtk_widget_set_sensitivecxx . . $ gtk_widget_set_sensitive(81f145f668a0074f). (self->buttoncxx . . $ _GtkMenuButton#button., has_popup); |
| 750 | |
| 751 | gtk_accessible_update_propertycxx . . $ gtk_accessible_update_property(7f02be67e42032aa). (GTK_ACCESSIBLEcxx . . $ GTK_ACCESSIBLE(4ecffd44f086533a). (self->buttoncxx . . $ _GtkMenuButton#button.), |
| 752 | GTK_ACCESSIBLE_PROPERTY_HAS_POPUPcxx . . $ GTK_ACCESSIBLE_PROPERTY_HAS_POPUP., has_popup, |
| 753 | -1); |
| 754 | if (self->popovercxx . . $ _GtkMenuButton#popover. != NULLcxx . . $ `<external>/15298297234472979974/stddef.h:419:9`!) |
| 755 | gtk_accessible_update_relationcxx . . $ gtk_accessible_update_relation(ee5ad1c3df8c751). (GTK_ACCESSIBLEcxx . . $ GTK_ACCESSIBLE(4ecffd44f086533a). (self->buttoncxx . . $ _GtkMenuButton#button.), |
| 756 | GTK_ACCESSIBLE_RELATION_CONTROLScxx . . $ GTK_ACCESSIBLE_RELATION_CONTROLS., self->popovercxx . . $ _GtkMenuButton#popover., NULLcxx . . $ `<external>/15298297234472979974/stddef.h:419:9`!, |
| 757 | -1); |
| 758 | else |
| 759 | gtk_accessible_reset_relationcxx . . $ gtk_accessible_reset_relation(d8116f91fffa0a9e). (GTK_ACCESSIBLEcxx . . $ GTK_ACCESSIBLE(4ecffd44f086533a). (self->buttoncxx . . $ _GtkMenuButton#button.), |
| 760 | GTK_ACCESSIBLE_RELATION_CONTROLScxx . . $ GTK_ACCESSIBLE_RELATION_CONTROLS.); |
| 761 | } |
| 762 | |
| 763 | static gbooleancxx . . $ gboolean# |
| 764 | menu_deactivate_cbcxx . . $ menu_deactivate_cb(8d66f822f8ca91). (GtkMenuButtoncxx . . $ GtkMenuButton# *self) |
| 765 | { |
| 766 | gtk_toggle_button_set_activecxx . . $ gtk_toggle_button_set_active(71dd9c09e6b3b31d). (GTK_TOGGLE_BUTTONcxx . . $ `gtk/gtktogglebutton.h:38:9`! (self->button), FALSEcxx . . $ `<external>/12741050725406041920/gmacros.h:967:9`!); |
| 767 | |
| 768 | return TRUEcxx . . $ `<external>/12741050725406041920/gmacros.h:971:9`!; |
| 769 | } |
| 770 | |
| 771 | /** |
| 772 | * gtk_menu_button_set_menu_model: |
| 773 | * @menu_button: a `GtkMenuButton` |
| 774 | * @menu_model: (nullable): a `GMenuModel`, or %NULL to unset and disable the |
| 775 | * button |
| 776 | * |
| 777 | * Sets the `GMenuModel` from which the popup will be constructed. |
| 778 | * |
| 779 | * If @menu_model is %NULL, the button is disabled. |
| 780 | * |
| 781 | * A [[email protected]] will be created from the menu model with |
| 782 | * [[email protected]_from_model]. Actions will be connected |
| 783 | * as documented for this function. |
| 784 | * |
| 785 | * If [[email protected]:popover] is already set, it will be |
| 786 | * dissociated from the @menu_button, and the property is set to %NULL. |
| 787 | */ |
| 788 | void |
| 789 | gtk_menu_button_set_menu_modelcxx . . $ gtk_menu_button_set_menu_model(81ffc948659b3076). (GtkMenuButtoncxx . . $ GtkMenuButton# *menu_button, |
| 790 | GMenuModelcxx . . $ GMenuModel# *menu_model) |
| 791 | { |
| 792 | g_return_if_failcxx . . $ `<external>/5169755362661750954/gmessages.h:652:9`! (GTK_IS_MENU_BUTTONcxx . . $ `gtk/gtkmenubutton.h:34:9`! (menu_button)); |
| 793 | g_return_if_failcxx . . $ `<external>/5169755362661750954/gmessages.h:652:9`! (G_IS_MENU_MODELcxx . . $ `<external>/17783962342109199441/gmenumodel.h:120:9`! (menu_model) || menu_model == NULLcxx . . $ `<external>/15298297234472979974/stddef.h:419:9`!); |
| 794 | |
| 795 | g_object_freeze_notifycxx . . $ g_object_freeze_notify(6087475fa43034d3). (G_OBJECTcxx . . $ `<external>/1341695927569185362/gobject.h:54:9`! (menu_button)); |
| 796 | |
| 797 | if (menu_model) |
| 798 | g_object_refcxx . . $ `<external>/1341695927569185362/gobject.h:533:9`! (menu_model); |
| 799 | |
| 800 | if (menu_model) |
| 801 | { |
| 802 | GtkWidgetcxx . . $ GtkWidget# *popover; |
| 803 | |
| 804 | popover = gtk_popover_menu_new_from_modelcxx . . $ gtk_popover_menu_new_from_model(f2b4d3daa6c23d55). (menu_model); |
| 805 | |
| 806 | gtk_accessible_update_relationcxx . . $ gtk_accessible_update_relation(ee5ad1c3df8c751). (GTK_ACCESSIBLEcxx . . $ GTK_ACCESSIBLE(4ecffd44f086533a). (popover), |
| 807 | GTK_ACCESSIBLE_RELATION_LABELLED_BYcxx . . $ GTK_ACCESSIBLE_RELATION_LABELLED_BY., menu_button, NULLcxx . . $ `<external>/15298297234472979974/stddef.h:419:9`!, |
| 808 | -1); |
| 809 | |
| 810 | gtk_menu_button_set_popovercxx . . $ gtk_menu_button_set_popover(b776b2571a0f34d3). (menu_button, popover); |
| 811 | } |
| 812 | else |
| 813 | { |
| 814 | gtk_menu_button_set_popovercxx . . $ gtk_menu_button_set_popover(b776b2571a0f34d3). (menu_button, NULLcxx . . $ `<external>/15298297234472979974/stddef.h:419:9`!); |
| 815 | } |
| 816 | |
| 817 | menu_button->modelcxx . . $ _GtkMenuButton#model. = menu_model; |
| 818 | g_object_notify_by_pspeccxx . . $ g_object_notify_by_pspec(89706f8943b9e738). (G_OBJECTcxx . . $ `<external>/1341695927569185362/gobject.h:54:9`! (menu_button), menu_button_propscxx . . $ menu_button_props.[PROP_MENU_MODELcxx . . $ PROP_MENU_MODEL.]); |
| 819 | |
| 820 | g_object_thaw_notifycxx . . $ g_object_thaw_notify(6087475fa43034d3). (G_OBJECTcxx . . $ `<external>/1341695927569185362/gobject.h:54:9`! (menu_button)); |
| 821 | } |
| 822 | |
| 823 | /** |
| 824 | * gtk_menu_button_get_menu_model: |
| 825 | * @menu_button: a `GtkMenuButton` |
| 826 | * |
| 827 | * Returns the `GMenuModel` used to generate the popup. |
| 828 | * |
| 829 | * Returns: (nullable) (transfer none): a `GMenuModel` |
| 830 | */ |
| 831 | GMenuModelcxx . . $ GMenuModel# * |
| 832 | gtk_menu_button_get_menu_modelcxx . . $ gtk_menu_button_get_menu_model(269d5e565063460b). (GtkMenuButtoncxx . . $ GtkMenuButton# *menu_button) |
| 833 | { |
| 834 | g_return_val_if_failcxx . . $ `<external>/5169755362661750954/gmessages.h:665:9`! (GTK_IS_MENU_BUTTONcxx . . $ `gtk/gtkmenubutton.h:34:9`! (menu_button), NULLcxx . . $ `<external>/15298297234472979974/stddef.h:419:9`!); |
| 835 | |
| 836 | return menu_button->modelcxx . . $ _GtkMenuButton#model.; |
| 837 | } |
| 838 | |
| 839 | static void |
| 840 | update_popover_directioncxx . . $ update_popover_direction(d46d383cb9623429). (GtkMenuButtoncxx . . $ GtkMenuButton# *self) |
| 841 | { |
| 842 | if (!self->popovercxx . . $ _GtkMenuButton#popover.) |
| 843 | return; |
| 844 | |
| 845 | switch (self->arrow_typecxx . . $ _GtkMenuButton#arrow_type.) |
| 846 | { |
| 847 | case GTK_ARROW_UPcxx . . $ GTK_ARROW_UP.: |
| 848 | gtk_popover_set_positioncxx . . $ gtk_popover_set_position(c8e9e28dedbd3540). (GTK_POPOVERcxx . . $ `gtk/gtkpopover.h:32:9`! (self->popover), GTK_POS_TOPcxx . . $ GTK_POS_TOP.); |
| 849 | break; |
| 850 | case GTK_ARROW_DOWNcxx . . $ GTK_ARROW_DOWN.: |
| 851 | case GTK_ARROW_NONEcxx . . $ GTK_ARROW_NONE.: |
| 852 | gtk_popover_set_positioncxx . . $ gtk_popover_set_position(c8e9e28dedbd3540). (GTK_POPOVERcxx . . $ `gtk/gtkpopover.h:32:9`! (self->popover), GTK_POS_BOTTOMcxx . . $ GTK_POS_BOTTOM.); |
| 853 | break; |
| 854 | case GTK_ARROW_LEFTcxx . . $ GTK_ARROW_LEFT.: |
| 855 | gtk_popover_set_positioncxx . . $ gtk_popover_set_position(c8e9e28dedbd3540). (GTK_POPOVERcxx . . $ `gtk/gtkpopover.h:32:9`! (self->popover), GTK_POS_LEFTcxx . . $ GTK_POS_LEFT.); |
| 856 | break; |
| 857 | case GTK_ARROW_RIGHTcxx . . $ GTK_ARROW_RIGHT.: |
| 858 | gtk_popover_set_positioncxx . . $ gtk_popover_set_position(c8e9e28dedbd3540). (GTK_POPOVERcxx . . $ `gtk/gtkpopover.h:32:9`! (self->popover), GTK_POS_RIGHTcxx . . $ GTK_POS_RIGHT.); |
| 859 | break; |
| 860 | default: |
| 861 | break; |
| 862 | } |
| 863 | } |
| 864 | |
| 865 | static void |
| 866 | popover_destroy_cbcxx . . $ popover_destroy_cb(d46d383cb9623429). (GtkMenuButtoncxx . . $ GtkMenuButton# *menu_button) |
| 867 | { |
| 868 | gtk_menu_button_set_popovercxx . . $ gtk_menu_button_set_popover(b776b2571a0f34d3). (menu_button, NULLcxx . . $ `<external>/15298297234472979974/stddef.h:419:9`!); |
| 869 | } |
| 870 | |
| 871 | /** |
| 872 | * gtk_menu_button_set_direction: |
| 873 | * @menu_button: a `GtkMenuButton` |
| 874 | * @direction: a `GtkArrowType` |
| 875 | * |
| 876 | * Sets the direction in which the popup will be popped up. |
| 877 | * |
| 878 | * If the button is automatically populated with an arrow icon, |
| 879 | * its direction will be changed to match. |
| 880 | * |
| 881 | * If the does not fit in the available space in the given direction, |
| 882 | * GTK will its best to keep it inside the screen and fully visible. |
| 883 | * |
| 884 | * If you pass %GTK_ARROW_NONE for a @direction, the popup will behave |
| 885 | * as if you passed %GTK_ARROW_DOWN (although you won’t see any arrows). |
| 886 | */ |
| 887 | void |
| 888 | gtk_menu_button_set_directioncxx . . $ gtk_menu_button_set_direction(40bd283e4dd59bae). (GtkMenuButtoncxx . . $ GtkMenuButton# *menu_button, |
| 889 | GtkArrowTypecxx . . $ GtkArrowType# direction) |
| 890 | { |
| 891 | g_return_if_failcxx . . $ `<external>/5169755362661750954/gmessages.h:652:9`! (GTK_IS_MENU_BUTTONcxx . . $ `gtk/gtkmenubutton.h:34:9`! (menu_button)); |
| 892 | |
| 893 | if (menu_button->arrow_typecxx . . $ _GtkMenuButton#arrow_type. == direction) |
| 894 | return; |
| 895 | |
| 896 | menu_button->arrow_typecxx . . $ _GtkMenuButton#arrow_type. = direction; |
| 897 | g_object_notify_by_pspeccxx . . $ g_object_notify_by_pspec(89706f8943b9e738). (G_OBJECTcxx . . $ `<external>/1341695927569185362/gobject.h:54:9`! (menu_button), menu_button_propscxx . . $ menu_button_props.[PROP_DIRECTIONcxx . . $ PROP_DIRECTION.]); |
| 898 | |
| 899 | update_arrowcxx . . $ update_arrow(d46d383cb9623429). (menu_button); |
| 900 | update_popover_directioncxx . . $ update_popover_direction(d46d383cb9623429). (menu_button); |
| 901 | } |
| 902 | |
| 903 | /** |
| 904 | * gtk_menu_button_get_direction: |
| 905 | * @menu_button: a `GtkMenuButton` |
| 906 | * |
| 907 | * Returns the direction the popup will be pointing at when popped up. |
| 908 | * |
| 909 | * Returns: a `GtkArrowType` value |
| 910 | */ |
| 911 | GtkArrowTypecxx . . $ GtkArrowType# |
| 912 | gtk_menu_button_get_directioncxx . . $ gtk_menu_button_get_direction(5fdf79e5c6aebe16). (GtkMenuButtoncxx . . $ GtkMenuButton# *menu_button) |
| 913 | { |
| 914 | g_return_val_if_failcxx . . $ `<external>/5169755362661750954/gmessages.h:665:9`! (GTK_IS_MENU_BUTTONcxx . . $ `gtk/gtkmenubutton.h:34:9`! (menu_button), GTK_ARROW_DOWN); |
| 915 | |
| 916 | return menu_button->arrow_typecxx . . $ _GtkMenuButton#arrow_type.; |
| 917 | } |
| 918 | |
| 919 | static void |
| 920 | gtk_menu_button_disposecxx . . $ gtk_menu_button_dispose(6087475fa43034d3). (GObjectcxx . . $ GObject# *object) |
| 921 | { |
| 922 | GtkMenuButtoncxx . . $ GtkMenuButton# *self = GTK_MENU_BUTTONcxx . . $ `gtk/gtkmenubutton.h:33:9`! (object); |
| 923 | |
| 924 | if (self->popovercxx . . $ _GtkMenuButton#popover.) |
| 925 | { |
| 926 | g_signal_handlers_disconnect_by_funccxx . . $ `<external>/15952772511652638895/gsignal.h:629:9`! (self->popover, |
| 927 | menu_deactivate_cb, |
| 928 | object); |
| 929 | g_signal_handlers_disconnect_by_funccxx . . $ `<external>/15952772511652638895/gsignal.h:629:9`! (self->popover, |
| 930 | popover_destroy_cb, |
| 931 | object); |
| 932 | gtk_widget_unparentcxx . . $ gtk_widget_unparent(d7cf858254b37903). (self->popovercxx . . $ _GtkMenuButton#popover.); |
| 933 | self->popovercxx . . $ _GtkMenuButton#popover. = NULLcxx . . $ `<external>/15298297234472979974/stddef.h:419:9`!; |
| 934 | } |
| 935 | |
| 936 | g_clear_objectcxx . . $ `<external>/1341695927569185362/gobject.h:695:9`! (&self->model); |
| 937 | g_clear_pointercxx . . $ `<external>/1123956534522462559/gmem.h:135:9`! (&self->button, gtk_widget_unparent); |
| 938 | |
| 939 | if (self->create_popup_destroy_notifycxx . . $ _GtkMenuButton#create_popup_destroy_notify.) |
| 940 | self->create_popup_destroy_notifycxx . . $ _GtkMenuButton#create_popup_destroy_notify. (self->create_popup_user_datacxx . . $ _GtkMenuButton#create_popup_user_data.); |
| 941 | |
| 942 | G_OBJECT_CLASScxx . . $ `<external>/1341695927569185362/gobject.h:61:9`! (gtk_menu_button_parent_class)->disposecxx . . $ _GObjectClass#dispose. (object); |
| 943 | } |
| 944 | |
| 945 | /** |
| 946 | * gtk_menu_button_set_popover: |
| 947 | * @menu_button: a `GtkMenuButton` |
| 948 | * @popover: (nullable) (type GtkPopover): a `GtkPopover`, or %NULL to unset and |
| 949 | * disable the button |
| 950 | * |
| 951 | * Sets the `GtkPopover` that will be popped up when the @menu_button is clicked. |
| 952 | * |
| 953 | * If @popover is %NULL, the button is disabled. |
| 954 | * |
| 955 | * If [[email protected]:menu-model] is set, the menu model is dissociated |
| 956 | * from the @menu_button, and the property is set to %NULL. |
| 957 | */ |
| 958 | void |
| 959 | gtk_menu_button_set_popovercxx . . $ gtk_menu_button_set_popover(b776b2571a0f34d3). (GtkMenuButtoncxx . . $ GtkMenuButton# *menu_button, |
| 960 | GtkWidgetcxx . . $ GtkWidget# *popover) |
| 961 | { |
| 962 | g_return_if_failcxx . . $ `<external>/5169755362661750954/gmessages.h:652:9`! (GTK_IS_MENU_BUTTONcxx . . $ `gtk/gtkmenubutton.h:34:9`! (menu_button)); |
| 963 | g_return_if_failcxx . . $ `<external>/5169755362661750954/gmessages.h:652:9`! (GTK_IS_POPOVERcxx . . $ `gtk/gtkpopover.h:34:9`! (popover) || popover == NULLcxx . . $ `<external>/15298297234472979974/stddef.h:419:9`!); |
| 964 | |
| 965 | g_object_freeze_notifycxx . . $ g_object_freeze_notify(6087475fa43034d3). (G_OBJECTcxx . . $ `<external>/1341695927569185362/gobject.h:54:9`! (menu_button)); |
| 966 | |
| 967 | g_clear_objectcxx . . $ `<external>/1341695927569185362/gobject.h:695:9`! (&menu_button->model); |
| 968 | |
| 969 | if (menu_button->popovercxx . . $ _GtkMenuButton#popover.) |
| 970 | { |
| 971 | gtk_widget_set_visiblecxx . . $ gtk_widget_set_visible(81f145f668a0074f). (menu_button->popovercxx . . $ _GtkMenuButton#popover., FALSEcxx . . $ `<external>/12741050725406041920/gmacros.h:967:9`!); |
| 972 | |
| 973 | g_signal_handlers_disconnect_by_funccxx . . $ `<external>/15952772511652638895/gsignal.h:629:9`! (menu_button->popover, |
| 974 | menu_deactivate_cb, |
| 975 | menu_button); |
| 976 | g_signal_handlers_disconnect_by_funccxx . . $ `<external>/15952772511652638895/gsignal.h:629:9`! (menu_button->popover, |
| 977 | popover_destroy_cb, |
| 978 | menu_button); |
| 979 | |
| 980 | gtk_widget_unparentcxx . . $ gtk_widget_unparent(d7cf858254b37903). (menu_button->popovercxx . . $ _GtkMenuButton#popover.); |
| 981 | } |
| 982 | |
| 983 | menu_button->popovercxx . . $ _GtkMenuButton#popover. = popover; |
| 984 | |
| 985 | if (popover) |
| 986 | { |
| 987 | gtk_widget_set_parentcxx . . $ gtk_widget_set_parent(4f261c0971c30e7). (menu_button->popovercxx . . $ _GtkMenuButton#popover., GTK_WIDGETcxx . . $ `gtk/gtkwidget.h:44:9`! (menu_button)); |
| 988 | g_signal_connect_swappedcxx . . $ `<external>/15952772511652638895/gsignal.h:617:9`! (menu_button->popover, "closed", |
| 989 | G_CALLBACKcxx . . $ `<external>/16473872192229286895/gclosure.h:73:9`! (menu_deactivate_cb), menu_button); |
| 990 | g_signal_connect_swappedcxx . . $ `<external>/15952772511652638895/gsignal.h:617:9`! (menu_button->popover, "destroy", |
| 991 | G_CALLBACKcxx . . $ `<external>/16473872192229286895/gclosure.h:73:9`! (popover_destroy_cb), menu_button); |
| 992 | update_popover_directioncxx . . $ update_popover_direction(d46d383cb9623429). (menu_button); |
| 993 | } |
| 994 | |
| 995 | update_sensitivitycxx . . $ update_sensitivity(d46d383cb9623429). (menu_button); |
| 996 | |
| 997 | g_object_notify_by_pspeccxx . . $ g_object_notify_by_pspec(89706f8943b9e738). (G_OBJECTcxx . . $ `<external>/1341695927569185362/gobject.h:54:9`! (menu_button), menu_button_propscxx . . $ menu_button_props.[PROP_POPOVERcxx . . $ PROP_POPOVER.]); |
| 998 | g_object_notify_by_pspeccxx . . $ g_object_notify_by_pspec(89706f8943b9e738). (G_OBJECTcxx . . $ `<external>/1341695927569185362/gobject.h:54:9`! (menu_button), menu_button_propscxx . . $ menu_button_props.[PROP_MENU_MODELcxx . . $ PROP_MENU_MODEL.]); |
| 999 | g_object_thaw_notifycxx . . $ g_object_thaw_notify(6087475fa43034d3). (G_OBJECTcxx . . $ `<external>/1341695927569185362/gobject.h:54:9`! (menu_button)); |
| 1000 | } |
| 1001 | |
| 1002 | /** |
| 1003 | * gtk_menu_button_get_popover: |
| 1004 | * @menu_button: a `GtkMenuButton` |
| 1005 | * |
| 1006 | * Returns the `GtkPopover` that pops out of the button. |
| 1007 | * |
| 1008 | * If the button is not using a `GtkPopover`, this function |
| 1009 | * returns %NULL. |
| 1010 | * |
| 1011 | * Returns: (nullable) (transfer none): a `GtkPopover` or %NULL |
| 1012 | */ |
| 1013 | GtkPopovercxx . . $ GtkPopover# * |
| 1014 | gtk_menu_button_get_popovercxx . . $ gtk_menu_button_get_popover(dc0a700c7097ce4a). (GtkMenuButtoncxx . . $ GtkMenuButton# *menu_button) |
| 1015 | { |
| 1016 | g_return_val_if_failcxx . . $ `<external>/5169755362661750954/gmessages.h:665:9`! (GTK_IS_MENU_BUTTONcxx . . $ `gtk/gtkmenubutton.h:34:9`! (menu_button), NULLcxx . . $ `<external>/15298297234472979974/stddef.h:419:9`!); |
| 1017 | |
| 1018 | return GTK_POPOVERcxx . . $ `gtk/gtkpopover.h:32:9`! (menu_button->popover); |
| 1019 | } |
| 1020 | |
| 1021 | /** |
| 1022 | * gtk_menu_button_set_icon_name: |
| 1023 | * @menu_button: a `GtkMenuButton` |
| 1024 | * @icon_name: the icon name |
| 1025 | * |
| 1026 | * Sets the name of an icon to show inside the menu button. |
| 1027 | * |
| 1028 | * Setting icon name resets [[email protected]:label] and |
| 1029 | * [[email protected]:child]. |
| 1030 | * |
| 1031 | * If [[email protected]:always-show-arrow] is set to `TRUE` and |
| 1032 | * [[email protected]:direction] is not `GTK_ARROW_NONE`, a dropdown arrow |
| 1033 | * will be shown next to the icon. |
| 1034 | */ |
| 1035 | void |
| 1036 | gtk_menu_button_set_icon_namecxx . . $ gtk_menu_button_set_icon_name(99b1edd8bd276d85). (GtkMenuButtoncxx . . $ GtkMenuButton# *menu_button, |
| 1037 | const char *icon_name) |
| 1038 | { |
| 1039 | GtkWidgetcxx . . $ GtkWidget# *box, *image_widget, *arrow; |
| 1040 | |
| 1041 | g_return_if_failcxx . . $ `<external>/5169755362661750954/gmessages.h:652:9`! (GTK_IS_MENU_BUTTONcxx . . $ `gtk/gtkmenubutton.h:34:9`! (menu_button)); |
| 1042 | |
| 1043 | g_object_freeze_notifycxx . . $ g_object_freeze_notify(6087475fa43034d3). (G_OBJECTcxx . . $ `<external>/1341695927569185362/gobject.h:54:9`! (menu_button)); |
| 1044 | |
| 1045 | if (gtk_menu_button_get_labelcxx . . $ gtk_menu_button_get_label(5ff5d82d25b59546). (menu_button)) |
| 1046 | g_object_notify_by_pspeccxx . . $ g_object_notify_by_pspec(89706f8943b9e738). (G_OBJECTcxx . . $ `<external>/1341695927569185362/gobject.h:54:9`! (menu_button), menu_button_propscxx . . $ menu_button_props.[PROP_LABELcxx . . $ PROP_LABEL.]); |
| 1047 | |
| 1048 | if (gtk_menu_button_get_childcxx . . $ gtk_menu_button_get_child(d95598b85ec9bc8d). (menu_button)) |
| 1049 | g_object_notify_by_pspeccxx . . $ g_object_notify_by_pspec(89706f8943b9e738). (G_OBJECTcxx . . $ `<external>/1341695927569185362/gobject.h:54:9`! (menu_button), menu_button_propscxx . . $ menu_button_props.[PROP_CHILDcxx . . $ PROP_CHILD.]); |
| 1050 | |
| 1051 | box = gtk_box_newcxx . . $ gtk_box_new(b19e0ce02196028e). (GTK_ORIENTATION_HORIZONTALcxx . . $ GTK_ORIENTATION_HORIZONTAL., 0); |
| 1052 | gtk_widget_set_haligncxx . . $ gtk_widget_set_halign(71362b4a1e4eb244). (box, GTK_ALIGN_CENTERcxx . . $ GTK_ALIGN_CENTER.); |
| 1053 | |
| 1054 | image_widget = g_object_newcxx . . $ g_object_new(8485fe61b4be4c78). (GTK_TYPE_IMAGEcxx . . $ `gtk/gtkimage.h:38:9`!, |
| 1055 | "accessible-role", GTK_ACCESSIBLE_ROLE_PRESENTATIONcxx . . $ GTK_ACCESSIBLE_ROLE_PRESENTATION., |
| 1056 | "icon-name", icon_name, |
| 1057 | NULLcxx . . $ `<external>/15298297234472979974/stddef.h:419:9`!); |
| 1058 | menu_button->image_widgetcxx . . $ _GtkMenuButton#image_widget. = image_widget; |
| 1059 | |
| 1060 | arrow = gtk_builtin_icon_newcxx . . $ gtk_builtin_icon_new(6d90f3ec8782e10d). ("arrow"); |
| 1061 | menu_button->arrow_widgetcxx . . $ _GtkMenuButton#arrow_widget. = arrow; |
| 1062 | |
| 1063 | gtk_box_appendcxx . . $ gtk_box_append(72f3a0256788ecaf). (GTK_BOXcxx . . $ `gtk/gtkbox.h:39:9`! (box), image_widget); |
| 1064 | gtk_box_appendcxx . . $ gtk_box_append(72f3a0256788ecaf). (GTK_BOXcxx . . $ `gtk/gtkbox.h:39:9`! (box), arrow); |
| 1065 | gtk_button_set_childcxx . . $ gtk_button_set_child(8c03878ed7d55c1e). (GTK_BUTTONcxx . . $ `gtk/gtkbutton.h:37:9`! (menu_button->button), box); |
| 1066 | |
| 1067 | menu_button->label_widgetcxx . . $ _GtkMenuButton#label_widget. = NULLcxx . . $ `<external>/15298297234472979974/stddef.h:419:9`!; |
| 1068 | menu_button->childcxx . . $ _GtkMenuButton#child. = NULLcxx . . $ `<external>/15298297234472979974/stddef.h:419:9`!; |
| 1069 | |
| 1070 | update_arrowcxx . . $ update_arrow(d46d383cb9623429). (menu_button); |
| 1071 | |
| 1072 | g_object_notify_by_pspeccxx . . $ g_object_notify_by_pspec(89706f8943b9e738). (G_OBJECTcxx . . $ `<external>/1341695927569185362/gobject.h:54:9`! (menu_button), menu_button_propscxx . . $ menu_button_props.[PROP_ICON_NAMEcxx . . $ PROP_ICON_NAME.]); |
| 1073 | |
| 1074 | g_object_thaw_notifycxx . . $ g_object_thaw_notify(6087475fa43034d3). (G_OBJECTcxx . . $ `<external>/1341695927569185362/gobject.h:54:9`! (menu_button)); |
| 1075 | } |
| 1076 | |
| 1077 | /** |
| 1078 | * gtk_menu_button_get_icon_name: |
| 1079 | * @menu_button: a `GtkMenuButton` |
| 1080 | * |
| 1081 | * Gets the name of the icon shown in the button. |
| 1082 | * |
| 1083 | * Returns: (nullable): the name of the icon shown in the button |
| 1084 | */ |
| 1085 | const char * |
| 1086 | gtk_menu_button_get_icon_namecxx . . $ gtk_menu_button_get_icon_name(5ff5d82d25b59546). (GtkMenuButtoncxx . . $ GtkMenuButton# *menu_button) |
| 1087 | { |
| 1088 | g_return_val_if_failcxx . . $ `<external>/5169755362661750954/gmessages.h:665:9`! (GTK_IS_MENU_BUTTONcxx . . $ `gtk/gtkmenubutton.h:34:9`! (menu_button), NULLcxx . . $ `<external>/15298297234472979974/stddef.h:419:9`!); |
| 1089 | |
| 1090 | if (menu_button->image_widgetcxx . . $ _GtkMenuButton#image_widget.) |
| 1091 | return gtk_image_get_icon_namecxx . . $ gtk_image_get_icon_name(f44047a7f2c8f602). (GTK_IMAGEcxx . . $ `gtk/gtkimage.h:39:9`! (menu_button->image_widget)); |
| 1092 | |
| 1093 | return NULLcxx . . $ `<external>/15298297234472979974/stddef.h:419:9`!; |
| 1094 | } |
| 1095 | |
| 1096 | /** |
| 1097 | * gtk_menu_button_set_always_show_arrow: |
| 1098 | * @menu_button: a `GtkMenuButton` |
| 1099 | * @always_show_arrow: whether to show a dropdown arrow even when using an icon |
| 1100 | * or a custom child |
| 1101 | * |
| 1102 | * Sets whether to show a dropdown arrow even when using an icon or a custom |
| 1103 | * child. |
| 1104 | * |
| 1105 | * Since: 4.4 |
| 1106 | */ |
| 1107 | void |
| 1108 | gtk_menu_button_set_always_show_arrowcxx . . $ gtk_menu_button_set_always_show_arrow(4e87c735efc37a53). (GtkMenuButtoncxx . . $ GtkMenuButton# *menu_button, |
| 1109 | gbooleancxx . . $ gboolean# always_show_arrow) |
| 1110 | { |
| 1111 | g_return_if_failcxx . . $ `<external>/5169755362661750954/gmessages.h:652:9`! (GTK_IS_MENU_BUTTONcxx . . $ `gtk/gtkmenubutton.h:34:9`! (menu_button)); |
| 1112 | |
| 1113 | always_show_arrow = !!always_show_arrow; |
| 1114 | |
| 1115 | if (always_show_arrow == menu_button->always_show_arrowcxx . . $ _GtkMenuButton#always_show_arrow.) |
| 1116 | return; |
| 1117 | |
| 1118 | menu_button->always_show_arrowcxx . . $ _GtkMenuButton#always_show_arrow. = always_show_arrow; |
| 1119 | |
| 1120 | update_arrowcxx . . $ update_arrow(d46d383cb9623429). (menu_button); |
| 1121 | |
| 1122 | g_object_notify_by_pspeccxx . . $ g_object_notify_by_pspec(89706f8943b9e738). (G_OBJECTcxx . . $ `<external>/1341695927569185362/gobject.h:54:9`! (menu_button), menu_button_propscxx . . $ menu_button_props.[PROP_ALWAYS_SHOW_ARROWcxx . . $ PROP_ALWAYS_SHOW_ARROW.]); |
| 1123 | } |
| 1124 | |
| 1125 | /** |
| 1126 | * gtk_menu_button_get_always_show_arrow: |
| 1127 | * @menu_button: a `GtkMenuButton` |
| 1128 | * |
| 1129 | * Gets whether to show a dropdown arrow even when using an icon or a custom |
| 1130 | * child. |
| 1131 | * |
| 1132 | * Returns: whether to show a dropdown arrow even when using an icon or a custom |
| 1133 | * child. |
| 1134 | * |
| 1135 | * Since: 4.4 |
| 1136 | */ |
| 1137 | gbooleancxx . . $ gboolean# |
| 1138 | gtk_menu_button_get_always_show_arrowcxx . . $ gtk_menu_button_get_always_show_arrow(8d66f822f8ca91). (GtkMenuButtoncxx . . $ GtkMenuButton# *menu_button) |
| 1139 | { |
| 1140 | g_return_val_if_failcxx . . $ `<external>/5169755362661750954/gmessages.h:665:9`! (GTK_IS_MENU_BUTTONcxx . . $ `gtk/gtkmenubutton.h:34:9`! (menu_button), FALSEcxx . . $ `<external>/12741050725406041920/gmacros.h:967:9`!); |
| 1141 | |
| 1142 | return menu_button->always_show_arrowcxx . . $ _GtkMenuButton#always_show_arrow.; |
| 1143 | } |
| 1144 | |
| 1145 | /** |
| 1146 | * gtk_menu_button_set_label: |
| 1147 | * @menu_button: a `GtkMenuButton` |
| 1148 | * @label: the label |
| 1149 | * |
| 1150 | * Sets the label to show inside the menu button. |
| 1151 | * |
| 1152 | * Setting a label resets [[email protected]:icon-name] and |
| 1153 | * [[email protected]:child]. |
| 1154 | * |
| 1155 | * If [[email protected]:direction] is not `GTK_ARROW_NONE`, a dropdown |
| 1156 | * arrow will be shown next to the label. |
| 1157 | */ |
| 1158 | void |
| 1159 | gtk_menu_button_set_labelcxx . . $ gtk_menu_button_set_label(99b1edd8bd276d85). (GtkMenuButtoncxx . . $ GtkMenuButton# *menu_button, |
| 1160 | const char *label) |
| 1161 | { |
| 1162 | GtkWidgetcxx . . $ GtkWidget# *box; |
| 1163 | GtkWidgetcxx . . $ GtkWidget# *label_widget; |
| 1164 | GtkWidgetcxx . . $ GtkWidget# *arrow; |
| 1165 | |
| 1166 | g_return_if_failcxx . . $ `<external>/5169755362661750954/gmessages.h:652:9`! (GTK_IS_MENU_BUTTONcxx . . $ `gtk/gtkmenubutton.h:34:9`! (menu_button)); |
| 1167 | |
| 1168 | g_object_freeze_notifycxx . . $ g_object_freeze_notify(6087475fa43034d3). (G_OBJECTcxx . . $ `<external>/1341695927569185362/gobject.h:54:9`! (menu_button)); |
| 1169 | |
| 1170 | if (gtk_menu_button_get_icon_namecxx . . $ gtk_menu_button_get_icon_name(5ff5d82d25b59546). (menu_button)) |
| 1171 | g_object_notify_by_pspeccxx . . $ g_object_notify_by_pspec(89706f8943b9e738). (G_OBJECTcxx . . $ `<external>/1341695927569185362/gobject.h:54:9`! (menu_button), menu_button_propscxx . . $ menu_button_props.[PROP_ICON_NAMEcxx . . $ PROP_ICON_NAME.]); |
| 1172 | if (gtk_menu_button_get_childcxx . . $ gtk_menu_button_get_child(d95598b85ec9bc8d). (menu_button)) |
| 1173 | g_object_notify_by_pspeccxx . . $ g_object_notify_by_pspec(89706f8943b9e738). (G_OBJECTcxx . . $ `<external>/1341695927569185362/gobject.h:54:9`! (menu_button), menu_button_propscxx . . $ menu_button_props.[PROP_CHILDcxx . . $ PROP_CHILD.]); |
| 1174 | |
| 1175 | box = gtk_box_newcxx . . $ gtk_box_new(b19e0ce02196028e). (GTK_ORIENTATION_HORIZONTALcxx . . $ GTK_ORIENTATION_HORIZONTAL., 0); |
| 1176 | gtk_widget_set_hexpandcxx . . $ gtk_widget_set_hexpand(81f145f668a0074f). (box, FALSEcxx . . $ `<external>/12741050725406041920/gmacros.h:967:9`!); |
| 1177 | label_widget = gtk_label_newcxx . . $ gtk_label_new(6d90f3ec8782e10d). (label); |
| 1178 | gtk_label_set_use_underlinecxx . . $ gtk_label_set_use_underline(ae51c99326df3b2e). (GTK_LABELcxx . . $ `gtk/gtklabel.h:36:9`! (label_widget), |
| 1179 | gtk_button_get_use_underlinecxx . . $ gtk_button_get_use_underline(cd7e49b0d5152fbd). (GTK_BUTTONcxx . . $ `gtk/gtkbutton.h:37:9`! (menu_button->button))); |
| 1180 | gtk_label_set_ellipsizecxx . . $ gtk_label_set_ellipsize(671bf0a445f46a82). (GTK_LABELcxx . . $ `gtk/gtklabel.h:36:9`! (label_widget), |
| 1181 | menu_button->can_shrinkcxx . . $ _GtkMenuButton#can_shrink. ? PANGO_ELLIPSIZE_ENDcxx . . $ PANGO_ELLIPSIZE_END. |
| 1182 | : PANGO_ELLIPSIZE_NONEcxx . . $ PANGO_ELLIPSIZE_NONE.); |
| 1183 | gtk_widget_set_hexpandcxx . . $ gtk_widget_set_hexpand(81f145f668a0074f). (label_widget, TRUEcxx . . $ `<external>/12741050725406041920/gmacros.h:971:9`!); |
| 1184 | arrow = gtk_builtin_icon_newcxx . . $ gtk_builtin_icon_new(6d90f3ec8782e10d). ("arrow"); |
| 1185 | menu_button->arrow_widgetcxx . . $ _GtkMenuButton#arrow_widget. = arrow; |
| 1186 | gtk_box_appendcxx . . $ gtk_box_append(72f3a0256788ecaf). (GTK_BOXcxx . . $ `gtk/gtkbox.h:39:9`! (box), label_widget); |
| 1187 | gtk_box_appendcxx . . $ gtk_box_append(72f3a0256788ecaf). (GTK_BOXcxx . . $ `gtk/gtkbox.h:39:9`! (box), arrow); |
| 1188 | gtk_button_set_childcxx . . $ gtk_button_set_child(8c03878ed7d55c1e). (GTK_BUTTONcxx . . $ `gtk/gtkbutton.h:37:9`! (menu_button->button), box); |
| 1189 | menu_button->label_widgetcxx . . $ _GtkMenuButton#label_widget. = label_widget; |
| 1190 | |
| 1191 | menu_button->image_widgetcxx . . $ _GtkMenuButton#image_widget. = NULLcxx . . $ `<external>/15298297234472979974/stddef.h:419:9`!; |
| 1192 | menu_button->childcxx . . $ _GtkMenuButton#child. = NULLcxx . . $ `<external>/15298297234472979974/stddef.h:419:9`!; |
| 1193 | |
| 1194 | update_arrowcxx . . $ update_arrow(d46d383cb9623429). (menu_button); |
| 1195 | |
| 1196 | g_object_notify_by_pspeccxx . . $ g_object_notify_by_pspec(89706f8943b9e738). (G_OBJECTcxx . . $ `<external>/1341695927569185362/gobject.h:54:9`! (menu_button), menu_button_propscxx . . $ menu_button_props.[PROP_LABELcxx . . $ PROP_LABEL.]); |
| 1197 | |
| 1198 | g_object_thaw_notifycxx . . $ g_object_thaw_notify(6087475fa43034d3). (G_OBJECTcxx . . $ `<external>/1341695927569185362/gobject.h:54:9`! (menu_button)); |
| 1199 | } |
| 1200 | |
| 1201 | /** |
| 1202 | * gtk_menu_button_get_label: |
| 1203 | * @menu_button: a `GtkMenuButton` |
| 1204 | * |
| 1205 | * Gets the label shown in the button |
| 1206 | * |
| 1207 | * Returns: (nullable): the label shown in the button |
| 1208 | */ |
| 1209 | const char * |
| 1210 | gtk_menu_button_get_labelcxx . . $ gtk_menu_button_get_label(5ff5d82d25b59546). (GtkMenuButtoncxx . . $ GtkMenuButton# *menu_button) |
| 1211 | { |
| 1212 | g_return_val_if_failcxx . . $ `<external>/5169755362661750954/gmessages.h:665:9`! (GTK_IS_MENU_BUTTONcxx . . $ `gtk/gtkmenubutton.h:34:9`! (menu_button), NULLcxx . . $ `<external>/15298297234472979974/stddef.h:419:9`!); |
| 1213 | |
| 1214 | if (menu_button->label_widgetcxx . . $ _GtkMenuButton#label_widget.) |
| 1215 | return gtk_label_get_labelcxx . . $ gtk_label_get_label(204bfb80200b298b). (GTK_LABELcxx . . $ `gtk/gtklabel.h:36:9`! (menu_button->label_widget)); |
| 1216 | |
| 1217 | return NULLcxx . . $ `<external>/15298297234472979974/stddef.h:419:9`!; |
| 1218 | } |
| 1219 | |
| 1220 | /** |
| 1221 | * gtk_menu_button_set_has_frame: |
| 1222 | * @menu_button: a `GtkMenuButton` |
| 1223 | * @has_frame: whether the button should have a visible frame |
| 1224 | * |
| 1225 | * Sets the style of the button. |
| 1226 | */ |
| 1227 | void |
| 1228 | gtk_menu_button_set_has_framecxx . . $ gtk_menu_button_set_has_frame(4e87c735efc37a53). (GtkMenuButtoncxx . . $ GtkMenuButton# *menu_button, |
| 1229 | gbooleancxx . . $ gboolean# has_frame) |
| 1230 | { |
| 1231 | g_return_if_failcxx . . $ `<external>/5169755362661750954/gmessages.h:652:9`! (GTK_IS_MENU_BUTTONcxx . . $ `gtk/gtkmenubutton.h:34:9`! (menu_button)); |
| 1232 | |
| 1233 | if (gtk_button_get_has_framecxx . . $ gtk_button_get_has_frame(cd7e49b0d5152fbd). (GTK_BUTTONcxx . . $ `gtk/gtkbutton.h:37:9`! (menu_button->button)) == has_frame) |
| 1234 | return; |
| 1235 | |
| 1236 | gtk_button_set_has_framecxx . . $ gtk_button_set_has_frame(72b6f5ca16c9f0b6). (GTK_BUTTONcxx . . $ `gtk/gtkbutton.h:37:9`! (menu_button->button), has_frame); |
| 1237 | g_object_notify_by_pspeccxx . . $ g_object_notify_by_pspec(89706f8943b9e738). (G_OBJECTcxx . . $ `<external>/1341695927569185362/gobject.h:54:9`! (menu_button), menu_button_propscxx . . $ menu_button_props.[PROP_HAS_FRAMEcxx . . $ PROP_HAS_FRAME.]); |
| 1238 | } |
| 1239 | |
| 1240 | /** |
| 1241 | * gtk_menu_button_get_has_frame: |
| 1242 | * @menu_button: a `GtkMenuButton` |
| 1243 | * |
| 1244 | * Returns whether the button has a frame. |
| 1245 | * |
| 1246 | * Returns: %TRUE if the button has a frame |
| 1247 | */ |
| 1248 | gbooleancxx . . $ gboolean# |
| 1249 | gtk_menu_button_get_has_framecxx . . $ gtk_menu_button_get_has_frame(8d66f822f8ca91). (GtkMenuButtoncxx . . $ GtkMenuButton# *menu_button) |
| 1250 | { |
| 1251 | g_return_val_if_failcxx . . $ `<external>/5169755362661750954/gmessages.h:665:9`! (GTK_IS_MENU_BUTTONcxx . . $ `gtk/gtkmenubutton.h:34:9`! (menu_button), TRUEcxx . . $ `<external>/12741050725406041920/gmacros.h:971:9`!); |
| 1252 | |
| 1253 | return gtk_button_get_has_framecxx . . $ gtk_button_get_has_frame(cd7e49b0d5152fbd). (GTK_BUTTONcxx . . $ `gtk/gtkbutton.h:37:9`! (menu_button->button)); |
| 1254 | } |
| 1255 | |
| 1256 | /** |
| 1257 | * gtk_menu_button_popup: |
| 1258 | * @menu_button: a `GtkMenuButton` |
| 1259 | * |
| 1260 | * Pop up the menu. |
| 1261 | */ |
| 1262 | void |
| 1263 | gtk_menu_button_popupcxx . . $ gtk_menu_button_popup(d46d383cb9623429). (GtkMenuButtoncxx . . $ GtkMenuButton# *menu_button) |
| 1264 | { |
| 1265 | g_return_if_failcxx . . $ `<external>/5169755362661750954/gmessages.h:652:9`! (GTK_IS_MENU_BUTTONcxx . . $ `gtk/gtkmenubutton.h:34:9`! (menu_button)); |
| 1266 | |
| 1267 | gtk_toggle_button_set_activecxx . . $ gtk_toggle_button_set_active(71dd9c09e6b3b31d). (GTK_TOGGLE_BUTTONcxx . . $ `gtk/gtktogglebutton.h:38:9`! (menu_button->button), TRUEcxx . . $ `<external>/12741050725406041920/gmacros.h:971:9`!); |
| 1268 | } |
| 1269 | |
| 1270 | /** |
| 1271 | * gtk_menu_button_popdown: |
| 1272 | * @menu_button: a `GtkMenuButton` |
| 1273 | * |
| 1274 | * Dismiss the menu. |
| 1275 | */ |
| 1276 | void |
| 1277 | gtk_menu_button_popdowncxx . . $ gtk_menu_button_popdown(d46d383cb9623429). (GtkMenuButtoncxx . . $ GtkMenuButton# *menu_button) |
| 1278 | { |
| 1279 | g_return_if_failcxx . . $ `<external>/5169755362661750954/gmessages.h:652:9`! (GTK_IS_MENU_BUTTONcxx . . $ `gtk/gtkmenubutton.h:34:9`! (menu_button)); |
| 1280 | |
| 1281 | gtk_toggle_button_set_activecxx . . $ gtk_toggle_button_set_active(71dd9c09e6b3b31d). (GTK_TOGGLE_BUTTONcxx . . $ `gtk/gtktogglebutton.h:38:9`! (menu_button->button), FALSEcxx . . $ `<external>/12741050725406041920/gmacros.h:967:9`!); |
| 1282 | } |
| 1283 | |
| 1284 | /** |
| 1285 | * gtk_menu_button_set_create_popup_func: |
| 1286 | * @menu_button: a `GtkMenuButton` |
| 1287 | * @func: (nullable) (scope notified) (closure user_data) (destroy destroy_notify): function |
| 1288 | * to call when a popup is about to be shown, but none has been provided via other means, |
| 1289 | * or %NULL to reset to default behavior |
| 1290 | * @user_data: user data to pass to @func |
| 1291 | * @destroy_notify: (nullable): destroy notify for @user_data |
| 1292 | * |
| 1293 | * Sets @func to be called when a popup is about to be shown. |
| 1294 | * |
| 1295 | * @func should use one of |
| 1296 | * |
| 1297 | * - [[email protected]_popover] |
| 1298 | * - [[email protected]_menu_model] |
| 1299 | * |
| 1300 | * to set a popup for @menu_button. |
| 1301 | * If @func is non-%NULL, @menu_button will always be sensitive. |
| 1302 | * |
| 1303 | * Using this function will not reset the menu widget attached to |
| 1304 | * @menu_button. Instead, this can be done manually in @func. |
| 1305 | */ |
| 1306 | void |
| 1307 | gtk_menu_button_set_create_popup_funccxx . . $ gtk_menu_button_set_create_popup_func(f833443bf5fe3456). (GtkMenuButtoncxx . . $ GtkMenuButton# *menu_button, |
| 1308 | GtkMenuButtonCreatePopupFunccxx . . $ GtkMenuButtonCreatePopupFunc# func, |
| 1309 | gpointercxx . . $ gpointer# user_data, |
| 1310 | GDestroyNotifycxx . . $ GDestroyNotify# destroy_notify) |
| 1311 | { |
| 1312 | g_return_if_failcxx . . $ `<external>/5169755362661750954/gmessages.h:652:9`! (GTK_IS_MENU_BUTTONcxx . . $ `gtk/gtkmenubutton.h:34:9`! (menu_button)); |
| 1313 | |
| 1314 | if (menu_button->create_popup_destroy_notifycxx . . $ _GtkMenuButton#create_popup_destroy_notify.) |
| 1315 | menu_button->create_popup_destroy_notifycxx . . $ _GtkMenuButton#create_popup_destroy_notify. (menu_button->create_popup_user_datacxx . . $ _GtkMenuButton#create_popup_user_data.); |
| 1316 | |
| 1317 | menu_button->create_popup_funccxx . . $ _GtkMenuButton#create_popup_func. = func; |
| 1318 | menu_button->create_popup_user_datacxx . . $ _GtkMenuButton#create_popup_user_data. = user_data; |
| 1319 | menu_button->create_popup_destroy_notifycxx . . $ _GtkMenuButton#create_popup_destroy_notify. = destroy_notify; |
| 1320 | |
| 1321 | update_sensitivitycxx . . $ update_sensitivity(d46d383cb9623429). (menu_button); |
| 1322 | } |
| 1323 | |
| 1324 | /** |
| 1325 | * gtk_menu_button_set_use_underline: |
| 1326 | * @menu_button: a `GtkMenuButton` |
| 1327 | * @use_underline: %TRUE if underlines in the text indicate mnemonics |
| 1328 | * |
| 1329 | * If true, an underline in the text indicates a mnemonic. |
| 1330 | */ |
| 1331 | void |
| 1332 | gtk_menu_button_set_use_underlinecxx . . $ gtk_menu_button_set_use_underline(4e87c735efc37a53). (GtkMenuButtoncxx . . $ GtkMenuButton# *menu_button, |
| 1333 | gbooleancxx . . $ gboolean# use_underline) |
| 1334 | { |
| 1335 | g_return_if_failcxx . . $ `<external>/5169755362661750954/gmessages.h:652:9`! (GTK_IS_MENU_BUTTONcxx . . $ `gtk/gtkmenubutton.h:34:9`! (menu_button)); |
| 1336 | |
| 1337 | if (gtk_button_get_use_underlinecxx . . $ gtk_button_get_use_underline(cd7e49b0d5152fbd). (GTK_BUTTONcxx . . $ `gtk/gtkbutton.h:37:9`! (menu_button->button)) == use_underline) |
| 1338 | return; |
| 1339 | |
| 1340 | gtk_button_set_use_underlinecxx . . $ gtk_button_set_use_underline(72b6f5ca16c9f0b6). (GTK_BUTTONcxx . . $ `gtk/gtkbutton.h:37:9`! (menu_button->button), use_underline); |
| 1341 | if (menu_button->label_widgetcxx . . $ _GtkMenuButton#label_widget.) |
| 1342 | gtk_label_set_use_underlinecxx . . $ gtk_label_set_use_underline(ae51c99326df3b2e). (GTK_LABELcxx . . $ `gtk/gtklabel.h:36:9`! (menu_button->label_widget), use_underline); |
| 1343 | |
| 1344 | g_object_notify_by_pspeccxx . . $ g_object_notify_by_pspec(89706f8943b9e738). (G_OBJECTcxx . . $ `<external>/1341695927569185362/gobject.h:54:9`! (menu_button), menu_button_propscxx . . $ menu_button_props.[PROP_USE_UNDERLINEcxx . . $ PROP_USE_UNDERLINE.]); |
| 1345 | } |
| 1346 | |
| 1347 | /** |
| 1348 | * gtk_menu_button_get_use_underline: |
| 1349 | * @menu_button: a `GtkMenuButton` |
| 1350 | * |
| 1351 | * Returns whether an embedded underline in the text indicates a |
| 1352 | * mnemonic. |
| 1353 | * |
| 1354 | * Returns: %TRUE whether an embedded underline in the text indicates |
| 1355 | * the mnemonic accelerator keys. |
| 1356 | */ |
| 1357 | gbooleancxx . . $ gboolean# |
| 1358 | gtk_menu_button_get_use_underlinecxx . . $ gtk_menu_button_get_use_underline(8d66f822f8ca91). (GtkMenuButtoncxx . . $ GtkMenuButton# *menu_button) |
| 1359 | { |
| 1360 | g_return_val_if_failcxx . . $ `<external>/5169755362661750954/gmessages.h:665:9`! (GTK_IS_MENU_BUTTONcxx . . $ `gtk/gtkmenubutton.h:34:9`! (menu_button), FALSEcxx . . $ `<external>/12741050725406041920/gmacros.h:967:9`!); |
| 1361 | |
| 1362 | return gtk_button_get_use_underlinecxx . . $ gtk_button_get_use_underline(cd7e49b0d5152fbd). (GTK_BUTTONcxx . . $ `gtk/gtkbutton.h:37:9`! (menu_button->button)); |
| 1363 | } |
| 1364 | |
| 1365 | static GListcxx . . $ GList# * |
| 1366 | get_menu_barscxx . . $ get_menu_bars(538c5d62831bbfe). (GtkWidgetcxx . . $ GtkWidget# *toplevel) |
| 1367 | { |
| 1368 | return g_object_get_datacxx . . $ g_object_get_data(973400aee2f864c2). (G_OBJECTcxx . . $ `<external>/1341695927569185362/gobject.h:54:9`! (toplevel), "gtk-menu-bar-list"); |
| 1369 | } |
| 1370 | |
| 1371 | static void |
| 1372 | set_menu_barscxx . . $ set_menu_bars(be47d75c1b5ebf8d). (GtkWidgetcxx . . $ GtkWidget# *toplevel, |
| 1373 | GListcxx . . $ GList# *menubars) |
| 1374 | { |
| 1375 | g_object_set_datacxx . . $ g_object_set_data(c3d5001d890c27fc). (G_OBJECTcxx . . $ `<external>/1341695927569185362/gobject.h:54:9`! (toplevel), I_cxx . . $ `gdk/gdkprivate.h:35:9`!("gtk-menu-bar-list"), menubars); |
| 1376 | } |
| 1377 | |
| 1378 | static void |
| 1379 | add_to_toplevelcxx . . $ add_to_toplevel(dfc7d8f093015f04). (GtkWidgetcxx . . $ GtkWidget# *toplevel, |
| 1380 | GtkMenuButtoncxx . . $ GtkMenuButton# *button) |
| 1381 | { |
| 1382 | GListcxx . . $ GList# *menubars = get_menu_barscxx . . $ get_menu_bars(538c5d62831bbfe). (toplevel); |
| 1383 | |
| 1384 | set_menu_barscxx . . $ set_menu_bars(be47d75c1b5ebf8d). (toplevel, g_list_prependcxx . . $ g_list_prepend(35007086a6b2ba1c). (menubars, button)); |
| 1385 | } |
| 1386 | |
| 1387 | static void |
| 1388 | remove_from_toplevelcxx . . $ remove_from_toplevel(dfc7d8f093015f04). (GtkWidgetcxx . . $ GtkWidget# *toplevel, |
| 1389 | GtkMenuButtoncxx . . $ GtkMenuButton# *button) |
| 1390 | { |
| 1391 | GListcxx . . $ GList# *menubars = get_menu_barscxx . . $ get_menu_bars(538c5d62831bbfe). (toplevel); |
| 1392 | |
| 1393 | menubars = g_list_removecxx . . $ g_list_remove(29d4c135b9e7c78b). (menubars, button); |
| 1394 | set_menu_barscxx . . $ set_menu_bars(be47d75c1b5ebf8d). (toplevel, menubars); |
| 1395 | } |
| 1396 | |
| 1397 | static void |
| 1398 | gtk_menu_button_rootcxx . . $ gtk_menu_button_root(d7cf858254b37903). (GtkWidgetcxx . . $ GtkWidget# *widget) |
| 1399 | { |
| 1400 | GtkMenuButtoncxx . . $ GtkMenuButton# *button = GTK_MENU_BUTTONcxx . . $ `gtk/gtkmenubutton.h:33:9`! (widget); |
| 1401 | |
| 1402 | GTK_WIDGET_CLASScxx . . $ `gtk/gtkwidget.h:45:9`! (gtk_menu_button_parent_class)->rootcxx . . $ _GtkWidgetClass#root. (widget); |
| 1403 | |
| 1404 | if (button->primarycxx . . $ _GtkMenuButton#primary.) |
| 1405 | { |
| 1406 | GtkWidgetcxx . . $ GtkWidget# *toplevel = GTK_WIDGETcxx . . $ `gtk/gtkwidget.h:44:9`! (gtk_widget_get_root (widget)); |
| 1407 | add_to_toplevelcxx . . $ add_to_toplevel(dfc7d8f093015f04). (toplevel, button); |
| 1408 | } |
| 1409 | } |
| 1410 | |
| 1411 | static void |
| 1412 | gtk_menu_button_unrootcxx . . $ gtk_menu_button_unroot(d7cf858254b37903). (GtkWidgetcxx . . $ GtkWidget# *widget) |
| 1413 | { |
| 1414 | GtkWidgetcxx . . $ GtkWidget# *toplevel; |
| 1415 | |
| 1416 | toplevel = GTK_WIDGETcxx . . $ `gtk/gtkwidget.h:44:9`! (gtk_widget_get_root (widget)); |
| 1417 | remove_from_toplevelcxx . . $ remove_from_toplevel(dfc7d8f093015f04). (toplevel, GTK_MENU_BUTTONcxx . . $ `gtk/gtkmenubutton.h:33:9`! (widget)); |
| 1418 | |
| 1419 | GTK_WIDGET_CLASScxx . . $ `gtk/gtkwidget.h:45:9`! (gtk_menu_button_parent_class)->unrootcxx . . $ _GtkWidgetClass#unroot. (widget); |
| 1420 | } |
| 1421 | |
| 1422 | /** |
| 1423 | * gtk_menu_button_set_primary: |
| 1424 | * @menu_button: a `GtkMenuButton` |
| 1425 | * @primary: whether the menubutton should act as a primary menu |
| 1426 | * |
| 1427 | * Sets whether menu button acts as a primary menu. |
| 1428 | * |
| 1429 | * Primary menus can be opened with the <kbd>F10</kbd> key. |
| 1430 | * |
| 1431 | * Since: 4.4 |
| 1432 | */ |
| 1433 | void |
| 1434 | gtk_menu_button_set_primarycxx . . $ gtk_menu_button_set_primary(4e87c735efc37a53). (GtkMenuButtoncxx . . $ GtkMenuButton# *menu_button, |
| 1435 | gbooleancxx . . $ gboolean# primary) |
| 1436 | { |
| 1437 | GtkRootcxx . . $ GtkRoot# *toplevel; |
| 1438 | |
| 1439 | g_return_if_failcxx . . $ `<external>/5169755362661750954/gmessages.h:652:9`! (GTK_IS_MENU_BUTTONcxx . . $ `gtk/gtkmenubutton.h:34:9`! (menu_button)); |
| 1440 | |
| 1441 | if (menu_button->primarycxx . . $ _GtkMenuButton#primary. == primary) |
| 1442 | return; |
| 1443 | |
| 1444 | menu_button->primarycxx . . $ _GtkMenuButton#primary. = primary; |
| 1445 | toplevel = gtk_widget_get_rootcxx . . $ gtk_widget_get_root(978ce13b0a79da4). (GTK_WIDGETcxx . . $ `gtk/gtkwidget.h:44:9`! (menu_button)); |
| 1446 | |
| 1447 | if (toplevel) |
| 1448 | { |
| 1449 | if (menu_button->primarycxx . . $ _GtkMenuButton#primary.) |
| 1450 | add_to_toplevelcxx . . $ add_to_toplevel(dfc7d8f093015f04). (GTK_WIDGETcxx . . $ `gtk/gtkwidget.h:44:9`! (toplevel), menu_button); |
| 1451 | else |
| 1452 | remove_from_toplevelcxx . . $ remove_from_toplevel(dfc7d8f093015f04). (GTK_WIDGETcxx . . $ `gtk/gtkwidget.h:44:9`! (toplevel), menu_button); |
| 1453 | } |
| 1454 | |
| 1455 | g_object_notify_by_pspeccxx . . $ g_object_notify_by_pspec(89706f8943b9e738). (G_OBJECTcxx . . $ `<external>/1341695927569185362/gobject.h:54:9`! (menu_button), menu_button_propscxx . . $ menu_button_props.[PROP_PRIMARYcxx . . $ PROP_PRIMARY.]); |
| 1456 | } |
| 1457 | |
| 1458 | /** |
| 1459 | * gtk_menu_button_get_primary: |
| 1460 | * @menu_button: a `GtkMenuButton` |
| 1461 | * |
| 1462 | * Returns whether the menu button acts as a primary menu. |
| 1463 | * |
| 1464 | * Returns: %TRUE if the button is a primary menu |
| 1465 | * |
| 1466 | * Since: 4.4 |
| 1467 | */ |
| 1468 | gbooleancxx . . $ gboolean# |
| 1469 | gtk_menu_button_get_primarycxx . . $ gtk_menu_button_get_primary(8d66f822f8ca91). (GtkMenuButtoncxx . . $ GtkMenuButton# *menu_button) |
| 1470 | { |
| 1471 | g_return_val_if_failcxx . . $ `<external>/5169755362661750954/gmessages.h:665:9`! (GTK_IS_MENU_BUTTONcxx . . $ `gtk/gtkmenubutton.h:34:9`! (menu_button), FALSEcxx . . $ `<external>/12741050725406041920/gmacros.h:967:9`!); |
| 1472 | |
| 1473 | return menu_button->primarycxx . . $ _GtkMenuButton#primary.; |
| 1474 | } |
| 1475 | |
| 1476 | /** |
| 1477 | * gtk_menu_button_set_child: |
| 1478 | * @menu_button: a `GtkMenuButton` |
| 1479 | * @child: (nullable): the child widget |
| 1480 | * |
| 1481 | * Sets the child widget of @menu_button. |
| 1482 | * |
| 1483 | * Setting a child resets [[email protected]:label] and |
| 1484 | * [[email protected]:icon-name]. |
| 1485 | * |
| 1486 | * If [[email protected]:always-show-arrow] is set to `TRUE` and |
| 1487 | * [[email protected]:direction] is not `GTK_ARROW_NONE`, a dropdown arrow |
| 1488 | * will be shown next to the child. |
| 1489 | * |
| 1490 | * Since: 4.6 |
| 1491 | */ |
| 1492 | void |
| 1493 | gtk_menu_button_set_childcxx . . $ gtk_menu_button_set_child(b776b2571a0f34d3). (GtkMenuButtoncxx . . $ GtkMenuButton# *menu_button, |
| 1494 | GtkWidgetcxx . . $ GtkWidget# *child) |
| 1495 | { |
| 1496 | GtkWidgetcxx . . $ GtkWidget# *box, *arrow, *inner_widget; |
| 1497 | |
| 1498 | g_return_if_failcxx . . $ `<external>/5169755362661750954/gmessages.h:652:9`! (GTK_IS_MENU_BUTTONcxx . . $ `gtk/gtkmenubutton.h:34:9`! (menu_button)); |
| 1499 | g_return_if_failcxx . . $ `<external>/5169755362661750954/gmessages.h:652:9`! (child == NULLcxx . . $ `<external>/15298297234472979974/stddef.h:419:9`! || menu_button->child == child || gtk_widget_get_parent (child) == NULLcxx . . $ `<external>/15298297234472979974/stddef.h:419:9`!); |
| 1500 | |
| 1501 | if (menu_button->childcxx . . $ _GtkMenuButton#child. == child) |
| 1502 | return; |
| 1503 | |
| 1504 | g_object_freeze_notifycxx . . $ g_object_freeze_notify(6087475fa43034d3). (G_OBJECTcxx . . $ `<external>/1341695927569185362/gobject.h:54:9`! (menu_button)); |
| 1505 | |
| 1506 | if (gtk_menu_button_get_labelcxx . . $ gtk_menu_button_get_label(5ff5d82d25b59546). (menu_button)) |
| 1507 | g_object_notify_by_pspeccxx . . $ g_object_notify_by_pspec(89706f8943b9e738). (G_OBJECTcxx . . $ `<external>/1341695927569185362/gobject.h:54:9`! (menu_button), menu_button_propscxx . . $ menu_button_props.[PROP_LABELcxx . . $ PROP_LABEL.]); |
| 1508 | if (gtk_menu_button_get_icon_namecxx . . $ gtk_menu_button_get_icon_name(5ff5d82d25b59546). (menu_button)) |
| 1509 | g_object_notify_by_pspeccxx . . $ g_object_notify_by_pspec(89706f8943b9e738). (G_OBJECTcxx . . $ `<external>/1341695927569185362/gobject.h:54:9`! (menu_button), menu_button_propscxx . . $ menu_button_props.[PROP_ICON_NAMEcxx . . $ PROP_ICON_NAME.]); |
| 1510 | |
| 1511 | box = gtk_box_newcxx . . $ gtk_box_new(b19e0ce02196028e). (GTK_ORIENTATION_HORIZONTALcxx . . $ GTK_ORIENTATION_HORIZONTAL., 0); |
| 1512 | gtk_widget_set_hexpandcxx . . $ gtk_widget_set_hexpand(81f145f668a0074f). (box, FALSEcxx . . $ `<external>/12741050725406041920/gmacros.h:967:9`!); |
| 1513 | |
| 1514 | arrow = gtk_builtin_icon_newcxx . . $ gtk_builtin_icon_new(6d90f3ec8782e10d). ("arrow"); |
| 1515 | menu_button->arrow_widgetcxx . . $ _GtkMenuButton#arrow_widget. = arrow; |
| 1516 | |
| 1517 | inner_widget = gtk_gizmo_new_with_rolecxx . . $ gtk_gizmo_new_with_role(f87719e279ae009d). ("contents", |
| 1518 | GTK_ACCESSIBLE_ROLE_GROUPcxx . . $ GTK_ACCESSIBLE_ROLE_GROUP., |
| 1519 | NULLcxx . . $ `<external>/15298297234472979974/stddef.h:419:9`!, |
| 1520 | NULLcxx . . $ `<external>/15298297234472979974/stddef.h:419:9`!, |
| 1521 | NULLcxx . . $ `<external>/15298297234472979974/stddef.h:419:9`!, |
| 1522 | NULLcxx . . $ `<external>/15298297234472979974/stddef.h:419:9`!, |
| 1523 | (GtkGizmoFocusFunccxx . . $ GtkGizmoFocusFunc#)gtk_widget_focus_childcxx . . $ gtk_widget_focus_child(8bb1c65c821a69cd)., |
| 1524 | NULLcxx . . $ `<external>/15298297234472979974/stddef.h:419:9`!); |
| 1525 | |
| 1526 | gtk_widget_set_layout_managercxx . . $ gtk_widget_set_layout_manager(4079769398e3bd92). (inner_widget, gtk_bin_layout_newcxx . . $ gtk_bin_layout_new(487a1448eb6d33ac). ()); |
| 1527 | gtk_widget_set_hexpandcxx . . $ gtk_widget_set_hexpand(81f145f668a0074f). (inner_widget, TRUEcxx . . $ `<external>/12741050725406041920/gmacros.h:971:9`!); |
| 1528 | if (child) |
| 1529 | gtk_widget_set_parentcxx . . $ gtk_widget_set_parent(4f261c0971c30e7). (child, inner_widget); |
| 1530 | |
| 1531 | gtk_box_appendcxx . . $ gtk_box_append(72f3a0256788ecaf). (GTK_BOXcxx . . $ `gtk/gtkbox.h:39:9`! (box), inner_widget); |
| 1532 | gtk_box_appendcxx . . $ gtk_box_append(72f3a0256788ecaf). (GTK_BOXcxx . . $ `gtk/gtkbox.h:39:9`! (box), arrow); |
| 1533 | gtk_button_set_childcxx . . $ gtk_button_set_child(8c03878ed7d55c1e). (GTK_BUTTONcxx . . $ `gtk/gtkbutton.h:37:9`! (menu_button->button), box); |
| 1534 | |
| 1535 | menu_button->childcxx . . $ _GtkMenuButton#child. = child; |
| 1536 | |
| 1537 | menu_button->image_widgetcxx . . $ _GtkMenuButton#image_widget. = NULLcxx . . $ `<external>/15298297234472979974/stddef.h:419:9`!; |
| 1538 | menu_button->label_widgetcxx . . $ _GtkMenuButton#label_widget. = NULLcxx . . $ `<external>/15298297234472979974/stddef.h:419:9`!; |
| 1539 | |
| 1540 | update_arrowcxx . . $ update_arrow(d46d383cb9623429). (menu_button); |
| 1541 | |
| 1542 | g_object_notify_by_pspeccxx . . $ g_object_notify_by_pspec(89706f8943b9e738). (G_OBJECTcxx . . $ `<external>/1341695927569185362/gobject.h:54:9`! (menu_button), menu_button_propscxx . . $ menu_button_props.[PROP_CHILDcxx . . $ PROP_CHILD.]); |
| 1543 | |
| 1544 | g_object_thaw_notifycxx . . $ g_object_thaw_notify(6087475fa43034d3). (G_OBJECTcxx . . $ `<external>/1341695927569185362/gobject.h:54:9`! (menu_button)); |
| 1545 | } |
| 1546 | |
| 1547 | /** |
| 1548 | * gtk_menu_button_get_child: |
| 1549 | * @menu_button: a `GtkMenuButton` |
| 1550 | * |
| 1551 | * Gets the child widget of @menu_button. |
| 1552 | * |
| 1553 | * Returns: (nullable) (transfer none): the child widget of @menu_button |
| 1554 | * |
| 1555 | * Since: 4.6 |
| 1556 | */ |
| 1557 | GtkWidgetcxx . . $ GtkWidget# * |
| 1558 | gtk_menu_button_get_childcxx . . $ gtk_menu_button_get_child(d95598b85ec9bc8d). (GtkMenuButtoncxx . . $ GtkMenuButton# *menu_button) |
| 1559 | { |
| 1560 | g_return_val_if_failcxx . . $ `<external>/5169755362661750954/gmessages.h:665:9`! (GTK_IS_MENU_BUTTONcxx . . $ `gtk/gtkmenubutton.h:34:9`! (menu_button), NULLcxx . . $ `<external>/15298297234472979974/stddef.h:419:9`!); |
| 1561 | |
| 1562 | return menu_button->childcxx . . $ _GtkMenuButton#child.; |
| 1563 | } |
| 1564 | |
| 1565 | /** |
| 1566 | * gtk_menu_button_set_active: |
| 1567 | * @menu_button: a `GtkMenuButton` |
| 1568 | * @active: whether the menu button is active |
| 1569 | * |
| 1570 | * Sets whether the menu button is active. |
| 1571 | * |
| 1572 | * Since: 4.10 |
| 1573 | */ |
| 1574 | void |
| 1575 | gtk_menu_button_set_activecxx . . $ gtk_menu_button_set_active(4e87c735efc37a53). (GtkMenuButtoncxx . . $ GtkMenuButton# *menu_button, |
| 1576 | gbooleancxx . . $ gboolean# active) |
| 1577 | { |
| 1578 | g_return_if_failcxx . . $ `<external>/5169755362661750954/gmessages.h:652:9`! (GTK_IS_MENU_BUTTONcxx . . $ `gtk/gtkmenubutton.h:34:9`! (menu_button)); |
| 1579 | |
| 1580 | if (active == gtk_menu_button_get_activecxx . . $ gtk_menu_button_get_active(8d66f822f8ca91). (menu_button)) |
| 1581 | return; |
| 1582 | |
| 1583 | gtk_toggle_button_set_activecxx . . $ gtk_toggle_button_set_active(71dd9c09e6b3b31d). (GTK_TOGGLE_BUTTONcxx . . $ `gtk/gtktogglebutton.h:38:9`! (menu_button->button), |
| 1584 | active); |
| 1585 | |
| 1586 | g_object_notify_by_pspeccxx . . $ g_object_notify_by_pspec(89706f8943b9e738). (G_OBJECTcxx . . $ `<external>/1341695927569185362/gobject.h:54:9`! (menu_button), menu_button_propscxx . . $ menu_button_props.[PROP_ACTIVEcxx . . $ PROP_ACTIVE.]); |
| 1587 | } |
| 1588 | |
| 1589 | /** |
| 1590 | * gtk_menu_button_get_active: |
| 1591 | * @menu_button: a `GtkMenuButton` |
| 1592 | * |
| 1593 | * Returns whether the menu button is active. |
| 1594 | * |
| 1595 | * Returns: TRUE if the button is active |
| 1596 | * |
| 1597 | * Since: 4.10 |
| 1598 | */ |
| 1599 | gbooleancxx . . $ gboolean# |
| 1600 | gtk_menu_button_get_activecxx . . $ gtk_menu_button_get_active(8d66f822f8ca91). (GtkMenuButtoncxx . . $ GtkMenuButton# *menu_button) |
| 1601 | { |
| 1602 | g_return_val_if_failcxx . . $ `<external>/5169755362661750954/gmessages.h:665:9`! (GTK_IS_MENU_BUTTONcxx . . $ `gtk/gtkmenubutton.h:34:9`! (menu_button), FALSEcxx . . $ `<external>/12741050725406041920/gmacros.h:967:9`!); |
| 1603 | |
| 1604 | return gtk_toggle_button_get_activecxx . . $ gtk_toggle_button_get_active(a71b61b8ee1ea69c). (GTK_TOGGLE_BUTTONcxx . . $ `gtk/gtktogglebutton.h:38:9`! (menu_button->button)); |
| 1605 | } |
| 1606 | |
| 1607 | /** |
| 1608 | * gtk_menu_button_set_can_shrink: |
| 1609 | * @menu_button: a menu button |
| 1610 | * @can_shrink: whether the button can shrink |
| 1611 | * |
| 1612 | * Sets whether the button size can be smaller than the natural size of |
| 1613 | * its contents. |
| 1614 | * |
| 1615 | * For text buttons, setting @can_shrink to true will ellipsize the label. |
| 1616 | * |
| 1617 | * For icon buttons, this function has no effect. |
| 1618 | * |
| 1619 | * Since: 4.12 |
| 1620 | */ |
| 1621 | void |
| 1622 | gtk_menu_button_set_can_shrinkcxx . . $ gtk_menu_button_set_can_shrink(4e87c735efc37a53). (GtkMenuButtoncxx . . $ GtkMenuButton# *menu_button, |
| 1623 | gbooleancxx . . $ gboolean# can_shrink) |
| 1624 | { |
| 1625 | g_return_if_failcxx . . $ `<external>/5169755362661750954/gmessages.h:652:9`! (GTK_IS_MENU_BUTTONcxx . . $ `gtk/gtkmenubutton.h:34:9`! (menu_button)); |
| 1626 | |
| 1627 | can_shrink = !!can_shrink; |
| 1628 | |
| 1629 | if (menu_button->can_shrinkcxx . . $ _GtkMenuButton#can_shrink. == can_shrink) |
| 1630 | return; |
| 1631 | |
| 1632 | menu_button->can_shrinkcxx . . $ _GtkMenuButton#can_shrink. = can_shrink; |
| 1633 | |
| 1634 | if (menu_button->label_widgetcxx . . $ _GtkMenuButton#label_widget. != NULLcxx . . $ `<external>/15298297234472979974/stddef.h:419:9`!) |
| 1635 | { |
| 1636 | gtk_label_set_ellipsizecxx . . $ gtk_label_set_ellipsize(671bf0a445f46a82). (GTK_LABELcxx . . $ `gtk/gtklabel.h:36:9`! (menu_button->label_widget), |
| 1637 | can_shrink ? PANGO_ELLIPSIZE_ENDcxx . . $ PANGO_ELLIPSIZE_END. |
| 1638 | : PANGO_ELLIPSIZE_NONEcxx . . $ PANGO_ELLIPSIZE_NONE.); |
| 1639 | } |
| 1640 | |
| 1641 | g_object_notify_by_pspeccxx . . $ g_object_notify_by_pspec(89706f8943b9e738). (G_OBJECTcxx . . $ `<external>/1341695927569185362/gobject.h:54:9`! (menu_button), menu_button_propscxx . . $ menu_button_props.[PROP_CAN_SHRINKcxx . . $ PROP_CAN_SHRINK.]); |
| 1642 | } |
| 1643 | |
| 1644 | /** |
| 1645 | * gtk_menu_button_get_can_shrink: |
| 1646 | * @menu_button: a button |
| 1647 | * |
| 1648 | * Retrieves whether the button can be smaller than the natural |
| 1649 | * size of its contents. |
| 1650 | * |
| 1651 | * Returns: true if the button can shrink, and false otherwise |
| 1652 | * |
| 1653 | * Since: 4.12 |
| 1654 | */ |
| 1655 | gbooleancxx . . $ gboolean# |
| 1656 | gtk_menu_button_get_can_shrinkcxx . . $ gtk_menu_button_get_can_shrink(8d66f822f8ca91). (GtkMenuButtoncxx . . $ GtkMenuButton# *menu_button) |
| 1657 | { |
| 1658 | g_return_val_if_failcxx . . $ `<external>/5169755362661750954/gmessages.h:665:9`! (GTK_IS_MENU_BUTTONcxx . . $ `gtk/gtkmenubutton.h:34:9`! (menu_button), FALSEcxx . . $ `<external>/12741050725406041920/gmacros.h:967:9`!); |
| 1659 | |
| 1660 | return menu_button->can_shrinkcxx . . $ _GtkMenuButton#can_shrink.; |
| 1661 | } |