Commit Graph

191 Commits

Author SHA1 Message Date
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
Benjamin Otte
9c0acf62b4 widget: Allow adding event controllers in ui files 2018-04-26 17:59:41 +02:00
Timm Bäder
172b0e7ea0 frame: Use underscores in widgets ids in the docs
They will work in composite widget templates this way.
2018-04-15 17:12:01 +02:00
Timm Bäder
bf08537885 frame: Remove priv pointer 2018-04-15 17:12:01 +02:00
Timm Bäder
be77e0d500 frame: Stop saving label and child allocation
We don't use them for anything anymore.
2018-04-15 17:12:01 +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
Daniel Boles
e4578ca7bf Frame: Erase the now-useless property label-yalign
The border is now drawn on the frame node, not using an internal border
node, so we are no longer able to align the label to vertically overlap
the border. The property no longer performs its original purpose, & nor
is it a useful candidate for giving a new role, so no point keeping it.

https://bugzilla.gnome.org/show_bug.cgi?id=778886
2018-03-12 14:17:32 +00: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
Daniel Boles
252b03c43e Frame: Enhance CSS docs
Indicate how the old shadow types are replaced by CSS border-style et
al., and quote the names of nodes and classes for easier readability.
2017-10-02 19:50:02 +01:00
Daniel Boles
ac4faad8a2 Frame: Add missing fixed-width format to enums 2017-09-14 18:29:08 +01: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
d3beea2c3d frame: Fix child allocation
Don't add the parent's allocation from gtk_widget_get_allocation
2017-07-19 21:27:13 -04:00
Timm Bäder
671c5ac434 frame: Fix copy&paste bug in shadow-type handling
If the given shadow_type is none NONE, we have to remove the .flat style
class of course, not add it.
2017-07-19 21:27:12 -04:00
Timm Bäder
78b497bd7a frame: Remove empty finalize implementation 2017-07-19 21:27:11 -04:00
Timm Bäder
c6cc314905 frame: Remove gadget 2017-07-19 21:27:11 -04:00
Timm Bäder
90537a5e04 frame: Remove css box drawing 2017-07-19 21:27:11 -04:00
Daniel Boles
ce1098598d Frame: Don’t advise adding .flat class in code
https://bugzilla.gnome.org/show_bug.cgi?id=779653#c33
and this is closer to what gtk-3-22 says anyway.
2017-05-14 11:53:25 +01:00
Timm Bäder
bbe5385541 frame: Properly initialize clip
GtkCssGadget initializes the content clip to {0, 0, 0, 0}, so we can't
just union the child clip with it.
2017-04-28 11:27:09 +02:00
Timm Bäder
179b8b0cbc Fix gdk_rectangle_union calls
Turns out that the destination is the last parameter, not the first one.
This fixes the flickering in the first page of the widget-factory when
using the expander on page 2.
2017-04-28 11:27:09 +02:00
Timm Bäder
b01b5267bb frame: Compute clip directly 2017-04-25 20:30:37 +02:00
Timm Bäder
f053a63d74 container: Remove include_internals parameter from forall
with include_internals=TRUE, this is the same as the (still private)
gtk_widget_forall, or just using the children/sibling accessors in a
loop.
2017-04-25 20:30:37 +02:00
Daniel Boles
24b966f6e7 Frame: minor update to intro docs
This incorporates a couple of recent tweaks from gtk-3-22.
2017-03-06 07:25:08 +00:00
Daniel Boles
e0b70f3629 Frame—Note set_label always destroys :label-widget
The fact that it doesn’t reuse the existing GtkLabel if present is not
immediately obvious to users (or is it just me?), so clarify that the
pre-existing :label-widget, if any, is always removed and replaced.
2017-02-21 21:26:43 +00:00
Daniel Boles
b106c5e4d5 Frame—Clarify relationship of :shadow-type & .flat 2017-02-21 21:26:41 +00:00
Daniel Boles
b953710fd7 Frame: Explain the .flat style class 2017-02-19 17:19:08 +00:00
Alexander Larsson
7bee22bcb6 Avoid some more type checks for internal calls 2017-01-11 15:27:51 +01:00
Benjamin Otte
0dbdf0c428 gadget: Remove gtk_css_gadget_draw()
And with it, remove the draw func from custom gadgets, that has been
NULL everywhere.

All gadgets are snapshot now.
2016-12-20 18:01:12 +01:00
Benjamin Otte
3f75b11982 frame: Implement snapshot() 2016-12-20 18:01:12 +01:00
Piotr Drąg
a2da4ddceb Use Unicode in translatable strings
See https://developer.gnome.org/hig/stable/typography.html

https://bugzilla.gnome.org/show_bug.cgi?id=772371
2016-12-19 15:08:10 -05:00
Benjamin Otte
96a94fc21d frame: Remove the border node
It does weird clipping that
(a) nobody likes
(b) is hard to support in the new rendering world.
So we take the easy way out.

The actual frame is now drawn by the frame node around the label.
2016-12-19 05:36:06 +01:00
Timm Bäder
ac20c3eb22 frame: Use gtk_widget_measure to measure child sizes 2016-12-04 12:00:46 +01:00
Benjamin Otte
82eb223c58 Revert "GtkFrame: Convert to indirect rendering"
This reverts commit a0b2b3745f.

Frames cannot be rendered by GSK yet, because they do clipping.
2016-11-15 17:49:19 +01:00
Benjamin Otte
da207c9fdd snapshot: Add a snapshot function to GtkCssCustomGadget 2016-11-15 17:48:45 +01:00
Benjamin Otte
a0e63b8a07 rendernode: Require passing a renderer to get_draw_context()
This is in preparation of making render nodes independent of the
renderer, so that they can be rendered multiple times with different
renderers.
2016-11-01 16:32:26 +01:00
Timm Bäder
b2a0105234 frame: Get the render node from the gadget
So we get a proper css background etc. applied.
2016-10-28 19:33:47 +02:00
Timm Bäder
8c128f36c5 frame: Use measure() to measure label size 2016-10-28 16:33:02 +02: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
Timm Bäder
00e7c69044 frame: Remove unused constants 2016-10-20 20:12:05 +02:00
Matthias Clasen
a0b2b3745f GtkFrame: Convert to indirect rendering
Create a GskRenderNode for the contents of the frame.
2016-10-18 11:49:11 +01:00
Benjamin Otte
4df6ddad54 API: container: Remove gtk_container_set_border_width() 2016-10-16 18:18:58 +02:00
Timm Bäder
41119057dd frame: Fix horizontal size request
We were adding the border gadget size and the label widget size in any
case, but when calculating the width, we want the maximum of those two,
not the sum.

https://bugzilla.gnome.org/show_bug.cgi?id=760482
2016-02-29 14:19:38 +01:00
Timm Bäder
870a5b424f frame: Don't move border gadget and child down
Setting label-yalign should affect the border gadget, but we need to
compensate for its position by moving the child down or up, depending on
the border gadget's position, so the child never moves.

https://bugzilla.gnome.org/show_bug.cgi?id=762123
2016-02-28 09:24:21 -05:00
Timm Bäder
0213815d2f Move .keycap docs from GtkFrame to GtkLabel
That's where .keycap is used nowadays.
2016-02-25 20:45:33 +01:00
Timm Bäder
77594be976 frame: Measure border gadget separately
https://bugzilla.gnome.org/show_bug.cgi?id=760482
2016-02-25 20:45:33 +01:00
Timm Bäder
3431451463 frame: Let GtkContainer handle border-width
https://bugzilla.gnome.org/show_bug.cgi?id=760482
2016-02-25 20:45:33 +01:00
Timm Bäder
bdd182f38c frame: Set border gadget state after creating it 2016-02-10 14:03:39 +01:00
Matthias Clasen
2cf810c4c9 frame: Don't overlap label and child
We didn't do this previously, so don't start now.

https://bugzilla.gnome.org/show_bug.cgi?id=760528
2016-01-15 19:16:23 -05:00
Matthias Clasen
ea4cff1ea4 Use convenience API that was introduced recently
Use gtk_css_gadget_set_state in all the places where we previously
were getting a node from a gadget, just to call gtk_css_node_set_state.
2016-01-13 00:19:31 -05:00