Commit Graph

29 Commits

Author SHA1 Message Date
Christopher Davis
ff45145eac menubutton: Add active property and getter/setter
GtkMenuButton currently does not provide a way to tell
if it's open programmatically. The existing methods,
`popup()` and `popdown()`, do not expose any state
to callers. If someone wanted to know whether or not
a menubutton was open, they needed the popover. Given
that GtkMenuButton can manage the popovers itself,
that's not always an option for app developers.

This commit adds the `active` property and associated
methods, where `gtk_menu_button_set_active ()` replaces
both `gtk_menu_popup ()` and `gtk_menu_popdown ()`.
This addition also mirrors changes in other places,
Such as `GtkWidget:visible` vs `show()`/`hide()`.
2023-02-12 16:47:59 -05:00
Matthias Clasen
f141da6b55 gtk: Dissolve gtk-autocleanup.h
Move the autocleanup declarations into their
respective headers.
2022-09-23 23:07:43 -04:00
Alexander Mikhaylenko
8b48cf11f9 menubutton: Support custom children
Fixes https://gitlab.gnome.org/GNOME/gtk/-/issues/4205
2021-09-03 17:52:46 +05:00
Alexander Mikhaylenko
ac3b246858 menubutton: Add a way to always show arrow with image buttons
Make sure the button still has the .image-button style class with an icon,
also add it to the initial state with only an arrow. Add a new
.arrow-button style class for the icon+arrow state so it's possible to
style it.

Remove spacing from the label+arrow variant to match, re-add it from the
stylesheet for both.

Fixes https://gitlab.gnome.org/GNOME/gtk/-/issues/3501
2021-06-24 23:12:26 +05:00
Matthias Clasen
a74420bc1a menubutton: Enable F10 for primary menus
Add a ::primary property to GtkMenuButton, which can
be set to make the menu activatable with F10, like
menubars.
2021-05-24 17:27:40 -04:00
Matthias Clasen
91f7b9663f gtk: Clean up docs syntax
Replace leftover gtk-doc syntax (#Type) with backquotes.
2021-05-22 17:25:26 -04:00
Matthias Clasen
08371b25dc menubutton: Add property annotations
Connect properties, getters, and setters with annotations
2021-03-11 16:37:33 +00:00
Matthias Clasen
cd4c0b6127 menubutton: Fix a gtk-doc complaint 2020-11-17 07:34:52 -05:00
Florian Müllner
b146c48e23 menubutton: Remove align-widget property
The property has been unused since commit 8701e34f74. That was four
years ago, so it's safe to say that nobody has been missing it terribly.
2020-07-24 13:55:06 +02:00
Matthias Clasen
0e18e52f00 menubutton: Cosmetics
Fix a few typos in the docs.
2020-05-11 08:15:56 -04:00
Matthias Clasen
12d5fdd457 menubutton: Drop relief
We are only using this as a boolean, so change it
to a boolean property named has-frame.
2020-04-17 10:57:36 -04:00
Matthias Clasen
ba25e08e7b menubutton: Add a use-underline property
This is necessary since apps no longer have direct
access to the label.

Closes: https://gitlab.gnome.org/GNOME/gtk/-/issues/2489
2020-03-28 00:08:12 -04:00
Matthias Clasen
27543120f2 menubutton: Stop supporting menus 2019-12-29 20:31:57 -05:00
Timm Bäder
c0214cfcc1 menubutton: Add a create_popup_func
Some use cases require a menu button to create the popup on demand.
2019-09-09 17:36:23 +02:00
Matthias Clasen
a62a7ab282 menu button: Make final 2019-05-26 23:10:57 -04:00
Matthias Clasen
6c3e874701 menu button: Add popup/popdown functions
These are needed, after all.
2019-05-24 00:30:39 +00:00
Matthias Clasen
5ec7a31cf1 menu button: Add a relief property
This is used in various places.
2019-05-21 19:05:41 -04:00
Matthias Clasen
6a7d70cc9f menubutton: Don't derive from GtkToggleButton
Make GtkMenuButton a widget that has a
toggle button, instead of deriving from it.

We give it icon-name and label properties,
to let people do what they expect to do
with menu buttons.
2019-05-18 13:06:32 +00:00
Timm Bäder
faabb808be menubutton: Remove priv pointer 2018-03-07 20:26:51 +01:00
Matthias Clasen
4c150d8eb5 The big versioning cleanup
Remove all the old 2.x and 3.x version annotations.
GTK+ 4 is a new start, and from the perspective of a
GTK+ 4 developer all these APIs have been around since
the beginning.
2018-02-06 01:16:32 -05:00
Matthias Clasen
9822d510a6 GtkMenuButton: Support popovers
Add api to allow explicitly setting a GtkPopover instead of
a GtkMenu as the popup of a GtkMenuButton. Also, add api to
instruct the menu button to construct a popover when given
a menu model.

We set the style class "menu-button" on the button only when
it pops up a menu, to allow different treatment for the active
state of the button in the two cases.

https://bugzilla.gnome.org/show_bug.cgi?id=723878
2014-02-08 20:42:20 -05:00
Matthias Clasen
5adecf183b Move single-include guards inside include guards
gcc has optimizations for include guards that only work
if they are outermost in the the header.
https://bugzilla.gnome.org/show_bug.cgi?id=689810
2012-12-28 09:57:56 -05:00
Matthias Clasen
4b5db54fa7 Remove gtk_menu_button_[sg]et_menu
These functions were never in a stable release, and have
been renamed to gtk_menu_button_[sg]et_popup.
2012-09-24 00:08:30 -04:00
Matthias Clasen
0b11e08f87 Straigthen includes in gtkmenubutton.[hc]
Don't include gtk.h, but just include whats needed.
2012-09-24 00:01:39 -04:00
Cosimo Cecchi
f6079f6406 menubutton: use consistent parameter names
Or the introspection scanner will emit a warning.
2012-08-21 11:14:16 +02:00
Ryan Lortie
0244dc8017 GtkMenuButton: rename _set_menu() to _set_popup()
It's too close to the release so we'll keep _set_menu() around, but
deprecate it, pointing to the new API.  It will be removed (and the name
reused) before the 3.6.0 release.

https://bugzilla.gnome.org/show_bug.cgi?id=682235
2012-08-20 17:04:14 -04:00
Bastien Nocera
9fef2dc0d1 gtkmenubutton: Add menu button widget
As used in Totem and gnome-contacts. The widget
takes either a GtkMenu or a GMenuModel to construct
its menu, and can be given a parent widget to use to
position the drop-down (as used in GtkMenuToolButton).

https://bugzilla.gnome.org/show_bug.cgi?id=668013
2012-06-15 17:24:42 +01:00
Matthias Clasen
2baba250b8 Revert "gtkmenubutton: Add menu button widget"
This reverts commit 9d35f7e512.
2012-05-30 14:45:24 -04:00
Bastien Nocera
9d35f7e512 gtkmenubutton: Add menu button widget
As used in Totem and gnome-contacts. The widget
takes either a GtkMenu or a GMenuModel to construct
its menu, and can be given a parent widget to use to
position the drop-down (as used in GtkMenuToolButton).

https://bugzilla.gnome.org/show_bug.cgi?id=668013
2012-05-30 13:46:40 -04:00