Commit Graph

180 Commits

Author SHA1 Message Date
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
Matthias Clasen
fb8589671d Drop unused includes of gtkrender.h
We don't use the gtk_render apis internally anymore.
Drop these includes so it is clear where the remaining
uses are.
2017-10-25 21:46:46 -04: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
4f0140fa6c Remove GtkBuiltinIcon
Now unused.
2017-07-19 21:27:13 -04:00
Timm Bäder
efd7b38abc checkbutton: stop using gadgets 2017-07-19 21:27:13 -04:00
Timm Bäder
720bb9eede checkbutton: Don't draw a focus ring
GtkWidget does it for us now.
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
b4e26e686d checkbutton: Don't use parent button's gadget
check buttons showing their indicator still use the internal boxgadget
and have therefore the wrong size, but this gets us closer.
2017-07-19 21:27:11 -04:00
Carlos Garnacho
eaa17b2548 gtkbutton: Make windowless
It is no longer necessary to receive events, so it's relatively straightforward
now to drop.
2017-05-25 16:25:59 +02:00
Timm Bäder
91932ffbc7 button: Remove baseline_align value
It's unused.
2017-05-05 11:18:05 +02:00
Timm Bäder
2aea8dfee9 togglebutton: Move :inconsistent to GtkCheckButton 2017-01-30 18:11:00 +01:00
Timm Bäder
66d584ce6e togglebutton: Move :draw-indicator property to GtkCheckButton
It's not used in GtkToggleButton at all, only in GtkCheckButton and
GtkRadioButton.
2017-01-30 18:11:00 +01:00
Benjamin Otte
ab47479045 snapshot: Convert GtkButton and subclasses 2016-11-15 17:48:45 +01:00
Matthias Clasen
793f843b08 check button: Update for new box gadget functionality
The box gadget now does the render node conversion for
all its children, so we have less work to do.
2016-11-01 14:29:25 -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
Timm Bäder
2e32655ccd checkbutton: Remove unused constants 2016-10-20 20:12:05 +02:00
Matthias Clasen
6a1edb0960 GtkCheckButton: Convert to indirect rendering
This is another example of indirect rendering with a box gadget.
There is currently still some positioning problem with the
checkmark.
2016-10-18 11:49:13 +01:00
Emmanuele Bassi
9bb816f8ee gtk: Include the appropriate headers 2016-10-17 11:10:14 +01:00
Timm Bäder
999d45b4e8 Remove various unused style properties 2016-10-16 18:17:21 +02:00
Timm Bäder
601839c825 Remove various sizing related style properties 2016-10-16 18:17:21 +02:00
Timm Bäder
485d1b9835 Button: Remove alignment API 2016-10-16 18:17:21 +02:00
Benjamin Otte
a72c4576b2 cssimagebuiltin: Remove icons that don't draw anything anymore 2016-05-03 12:59:13 +02:00
Matthias Clasen
2148708917 box gadget: Redo expand flag handling
We only keep one align flag per child, so it seems odd to
keep separate h/v expand flags. Just keep one expand flag
and interpret it according to orientation. Allow setting
the expand flag for child widgets too, though, so we can
make widget expand without interfering with the recursive
widget expand flag.

Update all callers.

Use the new possibility of expanding child widgets to make
the label of check and radio buttons expand. This fixes
unexpected behavior of these widgets in RTL in some places.

https://bugzilla.gnome.org/show_bug.cgi?id=765742
2016-04-28 21:59:34 -04:00
Matthias Clasen
8bf148b006 check button: Reverse alignments in RTL
Flip alignments for the box gadget children.
2016-04-28 21:59:34 -04:00
Matthias Clasen
c48f0d6f8b check button: Reinstate rtl allocation behavior
In rtl mode, we must not just reverse the children,
but also allocate from the right. Use the newly introduced
box gadget api to achieve this.

https://bugzilla.gnome.org/show_bug.cgi?id=762945
2016-03-03 21:28:51 -05:00
Matthias Clasen
7ed1225296 check button: Draw focus again
The box gadget now has API for this; use it.
2016-02-20 10:54:48 -05:00
Matthias Clasen
a32b39c60f checkbutton: Handle rtl changes again
Now that the box gadget has api for it, use it here to
change the order of the gadgets for right-to-left.
2016-01-18 00:11:50 -05:00
Matthias Clasen
7859f8ee91 checkbutton: Use a box gadget
Now that builtin icons have a baseline, we can just use
a box gadget with baseline alignment for the indicator
and the label.
2016-01-17 21:16:33 -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
Timm Bäder
788ee466b8 button: Don't include margins in input window size
And do the same thing for GtkCheckButton

https://bugzilla.gnome.org/show_bug.cgi?id=760509
2016-01-12 21:56:44 +01:00
Matthias Clasen
e8ba058396 checkbutton: Update state initially
Without this, the check node starts out without the :dir(ltr)
state, at least.
2015-12-28 10:24:02 -05:00
Matthias Clasen
9ac80c2510 checkbutton: stop saving cairo state
GtkBuiltinIcon now does this on its own.
2015-12-20 01:04:13 -05:00
Matthias Clasen
c0683d9267 checkbutton: Fix regression from builtin icon
The leaking of cairo transforms from builtin icon drawing
was causing the label to be drawn at the wrong position.
2015-12-19 23:23:09 -05:00
Benjamin Otte
36653bea41 checkbutton: Use a builtin icon
Also, add support to uiltin icons to look up the default size from a
style property.
2015-12-16 19:55:50 +01:00
Matthias Clasen
0291978acc check button: Deprecate indicator-size
CSS min-width/min-height can do just the same. We still fall
back to the indicator-size style property if the CSS properties
are not set.
2015-12-16 13:11:24 -05:00