Commit Graph

214 Commits

Author SHA1 Message Date
Florian Müllner
1728aa581c checkbutton: Activate when moving focus
Currently we update the :active property on both the previous and
new focus button. That "visually activate" the button and will
emit ::toggled, but if the button is associated with an action,
the action state won't change.

Fix that by activating the new focus instead of explicitly fiddling
with the :active property.
2021-07-30 20:34:24 +02:00
Florian Müllner
c50475de34 checkbutton: Delegate ::activate to the helper if appropriate
If the button is associated with an action, the action is currently
only activated when the button is clicked, not when it is activated.
2021-07-30 20:34:24 +02:00
Matthias Clasen
3b70cd3226 checkbutton: Match GtkButton behavior
When leaving the widget before releasing the button,
we should not activate the checkbutton, to match the
way GtkButton behaves.

Fixes: #4061
2021-06-19 13:30:31 -07:00
Matthias Clasen
3418504b4b checkbutton: Fix actionable state tracking
If we have a GAction as model, we just have to
call gtk_action_helper_activate() and let
the action helper handle the state updates,

Fixes: #4022
2021-06-10 08:38:12 -04:00
Matthias Clasen
ee80a22db4 Merge branch 'wip/exalm/checks' into 'master'
checkbutton: Sync the indicator state with the widget

See merge request GNOME/gtk!3568
2021-05-25 20:29:06 +00:00
Matthias Clasen
be944053e0 docs: More syntax fixes
The syntax for interface links is [iface@...], not
[interface@...].
2021-05-22 21:21:10 -04:00
Alexander Mikhaylenko
fb6c6c85bf checkbutton: Don't allow to uncheck radios by activating them
Do the same check as when clicking.
2021-05-20 14:38:33 +05:00
Alexander Mikhaylenko
bad01edd2c checkbutton: Sync the indicator state with the widget
Clicking the whole check button toggles it, so make sure the hover and
active states are propagated to the indicator like in GTK3.
2021-05-20 12:17:45 +05:00
Matthias Clasen
ee837dfc12 checkbutton: Add a warning about cyclic groups
Setting up check or toggle button group relationships
in a cycle will lead to lockups. Add a warning about
this, and catch the simplest case with a precondition
check.

Fixes: #3763
2021-03-17 07:38:57 -04:00
Matthias Clasen
7ac7bb9543 checkbutton: Use markdown for css tree 2021-03-11 16:37:34 +00:00
Matthias Clasen
67fdc0491a checkbutton: Add property annotations
Connect properties, getters, and setters with annotations
2021-03-11 16:37:33 +00:00
Matthias Clasen
3d8c810ab7 checkbutton: Convert docs
Change link syntax, add an example image, generally clean things up.
2021-03-11 16:37:31 +00:00
Bilal Elmoussaoui
6e903e13a5 g-i: add missing since annotations for 4.2 2021-03-07 19:50:32 +01:00
Alexander Mikhaylenko
bf2620f041 checkbutton: Claim sequence on release instead of press
Make it possible to drag windows from check buttons in future.
2021-01-29 12:00:10 +05:00
Matthias Clasen
10d5705b70 Reduce use of GtkStyleContext
Remove some unnecessary uses of GtkStyleContext where
we can directly go to the GtkCssStyle, and and drop
unnnecessary includes.
2021-01-28 12:27:07 -05:00
Yetizone
601dfeeff9 checkbutton: Add activate signal to work with gtk_widget_activate()
Fixes https://gitlab.gnome.org/GNOME/gtk/-/issues/3525
Fixes https://gitlab.gnome.org/GNOME/gtk/-/issues/3550
2021-01-04 17:25:53 +02:00
Benjamin Otte
8dad615f04 gtk: Remove unused header include
gtkcssnodeprivate.h was mainly used for repositioning CSS nodes in
gadgets, and gadgets are gone now.
2020-10-20 04:50:12 +02:00
Matthias Clasen
746bdd3d47 checkbutton: Don't notify write-only properties
Nobody is listening...
2020-09-01 16:31:07 -04:00
Matthias Clasen
639c839ba4 Add docs about grouping via action
Mention this in the docs for gtk_check_button_set_group
and gtk_toggle_button_set_group.
2020-09-01 16:29:21 -04:00
Matthias Clasen
5f8769e1a8 checkbutton: Support GtkActionable properly
Support grouping buttons via a radio action, as well
as via explicit gtk_check_button_set_group() calls.
2020-09-01 16:29:21 -04:00
Matthias Clasen
1c0bf2604c checkbutton: Don't leak the action helper 2020-09-01 15:24:34 -04:00
Matthias Clasen
c7b6c2f441 Remove GtkRadioButton references in the docs 2020-08-30 21:23:25 -04:00
Matthias Clasen
cd284da794 checkbutton: Reuse a helper function 2020-08-30 21:23:25 -04:00
Matthias Clasen
591b52584e checkbutton: Fix clicking on the last group member
Clicking on the last group member was letting me
uncheck it, creating a radio group without active
item, which is not what we want.
2020-08-30 21:23:25 -04:00
Matthias Clasen
2d6c43b598 checkbutton: Drop gtkradiobutton.h include
No longer used.
2020-08-30 21:23:25 -04:00
Timm Bäder
1375fb4464 Change button hierarchy
A radiobutton without indicator is really just a togglebutton with a
group.

A radiobutton with indicator is really just a checkbutton with a group.

Make checkbutton its own widget not inheriting from GtkButton.
GtkRadioButton could be removed but it stays for now.

Radiobutton && !draw-indicator => Togglebutton
Checkbutton && !draw-indicator => Togglebutton

Radiobutton && draw-indicator => CheckButton + group
2020-08-29 16:46:28 +02:00
Matthias Clasen
f561000124 docs: Clean up many dangling links
In many cases, these were references to no longer
existing api, so some rewording was necessary.
2020-08-04 22:11:34 -04:00
Matthias Clasen
4a9b4ad720 checkbutton: Initialize accessible state
The checked state of checkbuttons should be FALSE
initially, not UNDEFINED.
2020-07-27 21:18:09 -04:00
Matthias Clasen
d90f79de0e a11y: Document roles of widgets
Add a section to the long description for each
widget that is using a non-default accessible role.
2020-07-27 10:48:08 -04:00
Matthias Clasen
e17b5f337d a11y: Update GtkCheckButton
This is a bit unfortunate, since the aria modelling
doesn't quite agree with ours, so we have to listen
for the togglebutton property change, and we inherit
the pressed state from the togglebutton accessible.
2020-07-26 20:31:15 +01:00
Emmanuele Bassi
58628f9a9e a11y: Add roles to various widgets 2020-07-26 20:31:15 +01:00
Emmanuele Bassi
c63087a563 Remove ATK
To build a better world sometimes means having to tear the old one down.
        -- Alexander Pierce, "Captain America: The Winter Soldier"

ATK served us well for nearly 20 years, but the world has changed, and
GTK has changed with it. Now ATK is mostly a hindrance towards improving
the accessibility stack:

 - it maps to a very specific implementation, AT-SPI, which is Linux and
   Unix specific
 - it requires implementing the same functionality in three different
   layers of the stack: AT-SPI, ATK, and GTK
 - only GTK uses it; every other Linux and Unix toolkit and application
   talks to AT-SPI directly, including assistive technologies

Sadly, we cannot incrementally port GTK to a new accessibility stack;
since ATK insulates us entirely from the underlying implementation, we
cannot replace it piecemeal. Instead, we're going to remove everything
and then incrementally build on a clean slate:

 - add an "accessible" interface, implemented by GTK objects directly,
   which describe the accessible role and state changes for every UI
   element
 - add an "assistive technology context" to proxy a native accessibility
   API, and assign it to every widget
 - implement the AT context depending on the platform

For more information, see: https://gitlab.gnome.org/GNOME/gtk/-/issues/2833
2020-07-26 20:31:14 +01:00
Benjamin Otte
d375dce9f5 Replace "gchar" with "char" 2020-07-25 00:47:36 +02:00
Yuri Chornoivan
01bd4cc4e1 Fix minor typos 2020-05-28 11:00:03 +03:00
Matthias Clasen
183431c918 checkbutton: Modernize
Stop implementing GtkContainer, and just use a box layout
instead of doing our own thing manually.
2020-05-04 22:53:07 -04:00
Matthias Clasen
b55195fa2e Move the idle sizer to GtkWindow
This was only living in gtkcontainer.c for historic
reasons. Move it closer to where it belongs, and
rename it from 'idle' to 'layout', since it is
really about the layout phase of the frame clock,
nowadays.
2020-04-20 16:30:45 -04:00
Timm Bäder
655711fef2 Rename gtk_widget{get,set,has}_style_class to _css_class
We want to use css instead of style everywhere now.
2020-02-07 13:16:45 -05:00
Timm Bäder
b7ee2cbc28 Start using GtkWidget's new style class API 2020-02-07 13:16:32 -05:00
Alexander Larsson
6a15e9169d Rename GtkIcon widget to GtkBuiltinIcon
This is an internal widget whose name is not very important, and we
want to rename GtkIconInfo to GtkIcon, so lets rename this.
2020-01-30 10:53:33 +01:00
Benjamin Otte
146b921246 cssnode: Convert name + id from interned string to GQuark
The reason for this is simply that I want to get hash functions that
have their values close together, so they can fit in a smaller range
(the goal here is 12 bits). By using GQuark, we get consecutive numbers
starting with 1 (and applications have <1000 quarks usually), whereas
interned strings can be all over the place.

As a side effect we also save 64 bytes per declaration.
2020-01-28 02:17:03 +01:00
Matthias Clasen
112aed590f Remove builtin icons altogether
This removes support for GtkCssImageBuiltin and
GtkCssImageBuiltinType from everywhere.
2020-01-10 14:34:56 -05:00
Matthias Clasen
d3c45cb979 docs: Miscellaneous doc fixes
Additions and correction all over the place,
in GDK and GTK docs.
2019-02-24 16:53:12 -05:00
Timm Bäder
359d874ddb Use g_clear_pointer to unparent widgets 2018-11-13 20:53:14 +01:00
Timm Bäder
ade171a2ed widget: Don't pass a position to ->size_allocate
The values have been 0/0 for a long time now, so just drop the
GtkAllocation argument and replace it with width and height.
2018-11-13 16:28:54 +01:00
Timm Bäder
96e465b6d9 checkbutton: Remove snapshot implementation
It just does when the default GtkWidget implementation does anyway:
snapshot all child widgets
2018-08-25 08:05:52 +02:00
Benjamin Otte
169203951b widget: Remove clip from size-allocate vfunc
As the clip is no longer needed, get rid of it.
2018-04-05 14:56:38 +02:00
Timm Bäder
67258c69f0 checkbutton: Don't reorder non-existent indicator widget 2018-02-26 18:23:20 +01:00
Matthias Clasen
b379ca3e02 check button: Fix inconsistent state
This has been broken since the inconsistent state
was moved here in 2aea8dfee9.
2017-12-25 11:36:39 -05:00
Matthias Clasen
ffd6baec42 gtk: Intern css names
This avoids a bunch of strdups at startup.
2017-11-17 22:49:57 -05:00
Timm Bäder
8b0f60bb6f checkbutton: Destroy indicator widget when draw-indicator is FALSE 2017-10-29 13:27:03 +01:00