Commit Graph

263 Commits

Author SHA1 Message Date
Robert Ancell
83867f9cbf Add missing (closure) GIR annotations 2020-01-13 14:26:50 +13:00
Alexander Larsson
96b37f4eb8 Use the new GtkBuildableParser type in GtkBuildable interfaces 2019-09-10 12:08:20 -04:00
Timm Bäder
e86bf764a8 scale: Allocate value close to slider
The scale might be allocated at a height greater than requested, and in
that case y=0 is just too far away. Allocate the value directly next to
the slider instead.
2019-09-09 17:36:25 +02:00
Timm Bäder
80411fb905 scale: Use top/left/bottom/right style classes on value label
Just top/bottom is not enough anymore.

77769a52b3 broke e.g. horizontal scales
with the value on top/bottom, adding too much space.
2019-09-09 17:36:25 +02:00
Timm Bäder
ee27587428 scale: Add a destroy notify to set_format_value_func
Closes #2098
2019-08-15 17:21:47 +02:00
Timm Bäder
0a96c3f062 scale: Properly update when inverted
Just queue_resize()ing the range itself doesn't work as it will just
re-allocate all the child widgets (i.e. just the trough) to its old
position and size.
2019-08-10 19:51:45 +02:00
Timm Bäder
42e6630c3e scale: Make a function shorter 2019-08-10 19:51:45 +02:00
Timm Bäder
87aeec2b63 scale: Fix value widget measurement
Since we set the size request of the label, the later measure()
call would return at least the size we set, making the size only ever
grow.
2019-08-09 14:30:01 +02:00
Timm Bäder
ea5fc348fa scale: Replace format-value signal
There is no reason for this to be a signal, since multiple handlers
don't make sense anyway. It was also broken because the scale needs to
know when a signal handler is added so it can update the value
representation.

Replace the signal with a set_format_value_func function which allows us
to do that.

Fixes #113
2019-08-09 14:30:01 +02:00
Timm Bäder
ebc0d3760f range: remove range_size_request vfunc
It's unneeded in GtkScale and named after the gtk2 size_request function
2019-08-09 14:30:01 +02:00
Timm Bäder
b4a6d69f5d scale: Allocate left marks next to trough 2019-08-09 14:30:01 +02:00
Timm Bäder
05cdce2e8d scale: Fix an uninitialized value 2019-08-09 14:30:01 +02:00
Michael Natterer
caf50bcb93 gtk: fix weed_out_neg_zero() in spinbutton and scale
It was not copying the terminating \0 in the string, breaking output
in spinbutton (didn't try scale). Fixes #3452.


(cherry picked from commit ae2ef1472c)
2019-06-03 00:34:44 +00:00
Matthias Clasen
546cbd55eb scale: Use standard padding 2019-05-26 23:17:28 -04:00
Matthias Clasen
5b78a3048f gizmo: Add a contains_func
Let GtkGizmo override the contains() implementation.
Update all callers to pass NULL for the contains_func.
2019-04-07 15:47:24 +00:00
Benjamin Otte
01f7f255b5 gtk: Check return value of compute_bounds()
Half of these calls will completely break if anybody ever uses CSS
transforms with them, but hey...
2019-02-20 05:26:31 +01: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
85a002bf9f scale: Don't set label css name to "label"
That's already the css name of all labels.
2018-11-09 18:59:30 +01:00
Daniel Boles
06a1477f80 Scale: Document new optional classes on value node 2018-04-18 22:59:19 +01:00
Timm Bäder
3ce6355bf4 widget: Remove _get_own_allocation
Replace all usages of it with _compute_bounds
2018-04-10 09:43:47 +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
1355c9ae88 scale: Remove priv pointer 2018-02-27 12:39:04 +01:00
Benjamin Otte
f08bc40fbb a11y: Don't include gtk.h
Also add missing includes and sort them for all the widgets that relied
on that before.
2018-02-08 15:25:53 +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
Timm Bäder
77769a52b3 adwaita: Add some spacing to the scale value
So the slider does not overlap the value label. Since the value label is
allocated at the widget edge in gtk3, the correct fix here would
probably be to remove the 12px padding we apply to the entire scale and
instead apply it only to the trough.
2018-01-10 10:11:31 +01:00
Timm Bäder
b9531e3a7c scale: Allocate marks widget along the trough 2018-01-10 09:29:05 +01:00
Timm Bäder
93df23d962 Remove some more gtk_widget_get_content_size uses 2017-12-04 12:42:52 +01:00
Matthias Clasen
ffd6baec42 gtk: Intern css names
This avoids a bunch of strdups at startup.
2017-11-17 22:49:57 -05:00
Benjamin Otte
cf1cd19b61 range: Stack widgets properly
The trough widgets have the slider on top of the fill level and the
hilight widget. Make sure the widget stacking respects that.

This is particularly relevant because picking event targets should pick
the slider and not the hilight widget.
2017-11-05 05:13:17 +01:00
Benjamin Otte
43c212ac28 build: Enable -Wswitch-enum and -Wswitch-default
This patch makes that work using 1 of 2 options:

1. Add all missing enums to the switch statement
  or
2. Cast the switch argument to a uint to avoid having to do that (mostly
   for GdkEventType).

I even found a bug while doing that: clearing a GtkImage with a surface
did not notify thae surface property.

The reason for enabling this flag even though it is tedious at times is
that it is very useful when adding values to an enum, because it makes
GTK immediately warn about all the switch statements where this enum is
relevant.
And I expect changes to enums to be frequent during the GTK4 development
cycle.
2017-10-06 21:23:39 +02:00
Timm Bäder
9f3f640c0d widget: Remove gtk_widget_get_border_allocation 2017-08-14 12:22:39 +02:00
Timm Bäder
5f859a1f24 widget: Remove gtk_widget_get_content_allocation
Replace it where we still need something similar, e.g. in
gtk_widget_translate_coordinates
2017-08-14 12:22:39 +02:00
Timm Bäder
30d6b08271 scale: Allocate the value next to the slider
... when vertical. Also fixes usage of the uninitialized value_alloc.y.
2017-08-01 11:36:03 +02:00
Timm Bäder
36ab70ddf5 widget: Add baseline and out_clip parameters to size-allocate
Since setting a clip is mandatory for almost all widgets, we can as well
change the size-allocate signature to include a out_clip parameter, just
like GtkCssGadget did. And since we now always propagate baselines, we
might as well pass that one on to size-allocate.

This way we can also make sure to transform the clip returned from
size-allocate to parent-coordinates, i.e. the same coordinate space
priv->allocation is in.
2017-07-19 21:27:16 -04:00
Timm Bäder
995903e971 scale: Fix mark positions
Someone else will have to fix the css.
2017-07-19 21:27:15 -04:00
Timm Bäder
ed5b7fedb8 scale: Remove custom indicator drawing
it's a css node so we can simply use the background instead of the
foreground color in the theme.
2017-07-19 21:27:15 -04:00
Timm Bäder
5bb355f06f scale: Fix mark indicator allocations 2017-07-19 21:27:15 -04:00
Timm Bäder
3dc6d240b3 Fix a few allocation coordinates & sizes 2017-07-19 21:27:15 -04:00
Timm Bäder
1c5eec92fe range: Fix slider allocation 2017-07-19 21:27:14 -04:00
Timm Bäder
3babd184c0 scale: Fix css node ordering and expected results
Add :dir(ltr) where expected, i.e. everywhere we now have a widget but
had a gadget before.
Also, fix the expected output to expect mark subnodes in the order
specified in the GtkScale does, i.e.

├── mark
    ├── [label]
    ╰── indicator

for marks at the top of the scale and

├── mark
    ├── indicator
    ╰── [label]

For marks at the bottom of the scale.
2017-07-19 21:27:13 -04:00
Timm Bäder
5204fd5ea1 scale: Replace all gadgets with widgets 2017-07-19 21:27:13 -04:00
Timm Bäder
6e74975e41 range: make the slider a gadget 2017-07-19 21:27:12 -04:00
Timm Bäder
90cc401f1a range: Remove contents gadget
It's not needed anymore since the range only has one child gadget: the
trough.
2017-07-19 21:27:12 -04:00
Timm Bäder
1d782b8930 scale: Fix value position
by not using the range's gadget which is not allocated to any position
anymore.
2017-07-19 21:27:12 -04:00
Timm Bäder
c3ffad1fb3 gtkscale: Properly initialize the clip 2017-07-19 21:27:12 -04:00
Daniel Boles
e0a741c8ee Scale: Improve documentation of set_has_origin()
Properly format the property name, and avoid saying scale so many times.
2017-05-02 12:39:04 +01:00
Daniel Boles
4d88dc44b6 Scale: Explain how to round value when !draw-value
Scale:digits is (now, again) ineffective if Scale:draw-value is FALSE.
To get rounding in that case, the base Range:round-digits must be used.
2017-05-02 12:39:04 +01:00
Daniel Boles
8308ce1e61 Scale: Fix documentation of digits per last revert
Revert doc changes that were for the behavioural change just reverted.

Add a clarifying note that, under the original behaviour, :digits only
rounds the Adjustment if :draw-value is TRUE at the time of the change.

https://bugzilla.gnome.org/show_bug.cgi?id=781605
https://bugzilla.gnome.org/show_bug.cgi?id=358970
2017-04-26 12:32:07 +01:00
Matthias Clasen
197355e15a Revert "Scale: Always sync ::digits to Range::round-digits"
This reverts commit 4a6bd134bd.

This change in behavior broke various things.

https://bugzilla.gnome.org/show_bug.cgi?id=781605
2017-04-26 07:30:19 -04:00