Commit Graph

20 Commits

Author SHA1 Message Date
Emmanuele Bassi
a313417879 Replace boilerplate in GtkIcon
Be a good GObject citizen and use G_DECLARE_FINAL_TYPE instead of
writing the usual GObject boilerplate.
2018-02-01 15:30:39 +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
43a9b82797 Support -gtk-icon-size for builtins
This makes css icons more similar to themed icons, which
is the overall goal here.
2017-11-15 14:22:17 -05:00
Timm Bäder
657983cfda Don't try to snapshot invisible icons
These spew criticals when width == 0 || height == 0.
2017-10-10 09:49:35 +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
c2abb698be Replace a few get_content_allocation calls with get_content_size
The position of the content allocation is almost never relevant since
it's 0/0 for measure, size_allocate and snapshot.
2017-07-19 21:27:14 -04:00
Timm Bäder
d3e88ed5a6 icon: Stop offset'ing in snapshot
The snapshot is not offset to the content allocation when ->snapshot is
called.
2017-07-19 21:27:13 -04:00
Timm Bäder
70a58fd83a icon: Render at content position
Since we get offset automatically to the widget allocation before
->snapshot is called, we still have to offset the difference to the
position of the content allocation.
2017-07-19 21:27:13 -04:00
Timm Bäder
4f0140fa6c Remove GtkBuiltinIcon
Now unused.
2017-07-19 21:27:13 -04:00
Timm Bäder
ed38b1c365 icon: Add _set_css_name back 2017-07-19 21:27:13 -04:00
Timm Bäder
8b1b0f4efd icon: Add _set_image 2017-07-19 21:27:12 -04:00
Timm Bäder
2876790cc3 icon: Only draw in content allocation 2017-07-19 21:27:12 -04:00
Timm Bäder
c7c08cf9a1 icon: Remove gadget 2017-07-19 21:27:12 -04:00
Timm Bäder
ede6f2ab59 Slightly rework clip handling
always initialize clips to the (content) allocation, don't walk up the
widget hierarchy in gtk_widget_set_clip, implement
gtk_widget_size_allocate in GtkSeparator. This way we don't end up using
uninitialized clip values.

The entire clip handling is up for major rework since we can't and don't
want to force every single widget to call _set_clip in size-allocate
implementations.
2017-07-19 21:27:12 -04:00
Timm Bäder
2305ba577d icon: Stop calling gtk_widget_set_allocation
The allocation passed to size-allocate is the content allocation so this
call doesn't make sense anymore.
2017-07-19 21:27:11 -04:00
Benjamin Otte
ada70f4872 snapshot: Convert GtkIcon 2016-11-15 17:49:19 +01:00
Matthias Clasen
45e83f3d38 Convert GtkIcon to indirect rendering 2016-10-27 20:35:39 -04:00
Timm Bäder
9992a616ef widget: Use ::measure vfunc to measure size
Add a new ::measure vfunc similar to GtkCssGadget's that widget
implementations have to override instead of the old get_preferred_width,
get_preferred_height, get_preferred_width_for_height,
get_preferred_height_for_width and
get_preferred_height_and_baseline_for_width.
2016-10-22 19:05:47 +02:00
Matthias Clasen
2d6ce0da08 Add some docs to GtkIcon 2015-12-22 15:03:15 -05:00
Cosimo Cecchi
9b7473b633 Introduce GtkIcon private class
This is an utility widget that wraps a GtkBuiltinIcon for situations
where using a real widget is more convenient than a gadget.
2015-12-22 09:29:43 -08:00