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
999d45b4e8
Remove various unused style properties
2016-10-16 18:17:21 +02:00
Timm Bäder
efffa3b6bd
range: Remove min slider size setter/getter
2016-10-16 18:17:21 +02:00
Matthias Clasen
07e9b399d5
scale: Document interaction between rounding and autoscrolling
...
This is a bit of a gotcha, so better document it.
2016-08-24 12:58:54 -04:00
Ignacio Casal Quinteiro
b0f793c8e7
Use g_snprintf instead of snprintf.
...
snprintf is not compatible with msvc.
2016-08-10 12:45:39 +02:00
Chun-wei Fan
cd44f6d875
Fix build of commit f23e99b
...
Commit f23e99b
made use of snprintf(), which is not universally available.
Fix this by using g_snprintf().
2016-06-27 11:53:30 +08:00
Matthias Clasen
f23e99b063
scale, spinbutton: Avoid -0.0
...
This is a very longstanding bug; time to finally put it to rest.
https://bugzilla.gnome.org/show_bug.cgi?id=118959
2016-06-07 23:04:40 -04:00
Matthias Clasen
7f06f2818a
Ensure that GtkRange allocates enough space for the value
...
This is a long-standing problem of GtkScale.
https://bugzilla.gnome.org/show_bug.cgi?id=766372
https://bugzilla.gnome.org/show_bug.cgi?id=578626
https://bugzilla.gnome.org/show_bug.cgi?id=79229
2016-06-07 21:28:44 -04:00
Matthias Clasen
3f3c1768c9
scale: Also queue a resize if font changes
...
As Benjamin pointed out, what AFFECTS_FONT can also affect size,
but the implication is not automatic, so queue a resize manually.
2016-06-03 10:49:29 -04:00
Matthias Clasen
fd9f7babf6
scale: Apply css style to text
...
Use the new functions we have to apply CSS styles to the
value and marks text from their respective subnodes.
2016-06-03 00:30:59 -04:00
Matthias Clasen
4151cb1202
scale: Use more succinct names for style classes
...
Use .marks-before/after to indicate the presence of marks.
As Lapo points out, compatibility with the previous names
is not really that important, since everything else changed
around it.
https://bugzilla.gnome.org/show_bug.cgi?id=766440
2016-05-19 09:44:48 -04:00
Matthias Clasen
fa9f22eec4
scale: Bring back marks-related style classes
...
It turns out that it is too hard (and in some cases, impossible)
to get this information from node positioning, so bring back the
.scale-has-marks-above/below style classes on the main node.
This should allow us to fix the 'pointy sliders'.
https://bugzilla.gnome.org/show_bug.cgi?id=766440
2016-05-18 12:59:39 -04:00
Matthias Clasen
38f71172f8
scale: Avoid a crash
...
gtk_scale_get_layout was not careful enough, leading to a crash
when opening the inspector on a scale.
2016-05-15 14:18:09 -04:00
Timm Bäder
327777a291
Scale: Set the correct value alignment
...
We're measuring both the width of the minimal and the maximal value for
the value gadget, but only give the value the minimal width for its
current value, resultnig in an always left-aligned value.
Fix this by assigning the width of the value gadget to the value layout
and letting pango align the text inside the layout.
https://bugzilla.gnome.org/show_bug.cgi?id=766120
2016-05-10 21:24:50 +02:00
Timm Bäder
20592a7935
scale: Remove double nullable annotation
...
Being both (allow-none) and (nullable) at the same time is a bit much.
Was from 591e7f5ef8
.
2016-05-10 12:53:42 +02:00
Matthias Clasen
27210f523b
scale: Fix mark positioning at the left/top edge
...
We were failing to take the widget allocation.x/y into account
when deciding whether we need to push in the mark.
https://bugzilla.gnome.org/show_bug.cgi?id=765922
2016-05-05 15:17:56 -04:00
Cosimo Cecchi
26f9dc6508
scale: fix marks node position for scales with value
...
We should only count the value node as the first/last one if its
position matches.
2016-03-26 22:43:53 -07:00
Cosimo Cecchi
6efc06ef5c
scale: remove impossible case
...
We only create the gadget when the markup is not empty, so we don't
need to check again here.
2016-03-26 22:43:53 -07:00
Cosimo Cecchi
b989910293
scale: cache pango layouts for mark labels
...
Constantly creating pango layouts while drawing means that animations
will be slow. Instead, cache the pango layout in the mark structure.
2016-03-26 22:43:53 -07:00
Timm Bäder
985121813e
scale: Fix value height calculation
...
if (orientation) doesn't make a lot of sense but C doesn't complain and
instead evaluates orientation to TRUE for GTK_ORIENTATION_VERTICAL
(since that's 1), thus inverting the value sizes.
2016-03-16 10:20:17 +01:00
Cosimo Cecchi
d9db329496
scale: trivial code cleanup
2016-03-06 11:10:44 -08:00
Cosimo Cecchi
f294bdc803
scale: deprecate value-spacing style property
...
Nothing uses it now.
2016-03-06 11:10:44 -08:00
Cosimo Cecchi
a9b50b6f69
scale: port scale values to gadgets
...
And add a default color like it was before.
This also fixes other issues with scale values interacting with scale
mark labels, which were buggy at least since 3.18.
2016-03-06 11:09:46 -08:00
Cosimo Cecchi
b1144a73de
scale: don't add scale label for empty markup
...
This is a regression from the gadget port.
2016-03-02 11:17:08 -08:00
Matthias Clasen
577783a19d
scale: Don't leave css nodes behind
...
We create and destroy gadgets inside the scale hierarchy here,
and if we don't explicitly remove their CSS nodes from the parent,
they stick around.
2016-03-01 15:58:21 -05:00
Cosimo Cecchi
5a83787dc0
Update CSS nodes documentation
2016-02-29 10:45:14 -08:00
Cosimo Cecchi
bb55a1a958
scale: add gadgets for indicator/label in scale marks
...
This will allow us to theme them indepdendently, and specify a size for
the indicator from the theme.
2016-02-29 10:45:14 -08:00
Cosimo Cecchi
7bd3d87eeb
scale: add a gadget for every mark
...
We want to add another gadget for the mark indicator. This will allow us
to do so.
2016-02-29 10:45:14 -08:00
Cosimo Cecchi
cdd7a7bdcd
scale: implement rendering for marks gadgets
...
This completes the conversion of scale marks to gadgets.
2016-02-29 10:45:14 -08:00
Cosimo Cecchi
1a8eb9fefa
scale: implement size allocate for mark gadgets
...
This allows to move the mark sections around with e.g. margins.
2016-02-29 10:45:14 -08:00
Cosimo Cecchi
562a501f3b
scale: port marks size request to gadgets
2016-02-29 10:45:14 -08:00
Cosimo Cecchi
2f420d0e14
scale: use gadgets instead of nodes for mark containers
...
The gadget is not yet allocated though.
2016-02-29 10:45:14 -08:00
Cosimo Cecchi
b73d274d55
scale: rename function arguments
...
To make them clearer. No functional change here.
2016-02-29 10:45:14 -08:00
Cosimo Cecchi
8d5d16ae56
scale: remove unused argument
...
It's always GTK_POS_TOP.
2016-02-29 10:45:13 -08:00
Cosimo Cecchi
424f17c0fb
range: don't use gtk_range_set_min_slider_size()
...
The way this method is used from the GtkRange subclasses doesn't really
work well when the slider properties change as a consequence of e.g. a
style class being applied (e.g. the fine-tune style class).
In fact, there's no need to read the minimum slider size out of band,
and we can obtain the same result in a way that always work by setting a
private property on GtkRange.
2016-02-29 10:45:13 -08:00
Cosimo Cecchi
a9ea544f3d
scale: always add marks at the beginning or the end
...
Marks are always either the first or the last child of the scale.
2016-02-29 10:45:13 -08:00
Cosimo Cecchi
d1c5ecfaef
scale: deprecate slider-length style property
...
This can be achieved using min-height/min-width CSS properties now.
2016-02-29 10:45:12 -08:00
Matthias Clasen
2f544655f9
Revise CSS node documentation
...
Clarify the use of brackets in the CSS node diagrams:
[] means optional nodes or classes, <> means child widgets.
2015-12-16 10:58:47 -05:00
Timm Bäder
591e7f5ef8
GtkScale: Add missing nullable annotations
2015-12-02 21:06:11 +01:00
Matthias Clasen
60c7893c14
scale: Document the new CSS nodes
2015-11-06 22:27:31 -05:00
Matthias Clasen
8d886f3513
Cosmetic: Use defines for style classes
2015-11-06 11:50:23 -05:00
Matthias Clasen
76fbcc2f26
range: Document fine-tuning style class use
2015-11-06 11:50:23 -05:00
Matthias Clasen
bfee2d3c61
scale: Stop using style classes for marks
...
We can use :first/last-child for this now.
2015-11-06 07:01:42 -05:00
Matthias Clasen
07841f269d
scale: Split marks node into two
...
Use separate CSS nodes for the marks above and below the trough.
2015-11-05 07:26:10 -05:00
Matthias Clasen
2bfb5ad812
range: Add a CSS node for the trough
...
This is in sync with what we do elsewhere for troughs.
2015-11-05 07:26:10 -05:00
Matthias Clasen
0024358c91
scale: Fix a crash
...
We can only free the marks_node if there is one.
2015-11-03 23:35:32 -05:00
Matthias Clasen
8727c8fe24
range: Convert to CSS nodes
...
Use CSS nodes for GtkScale and GtkScrollbar. See their documentation
for details on what subnodes with what names exist.
2015-11-03 23:17:09 -05:00
Matthias Clasen
ea241c691c
scale: Drop unneeded private exports
...
Nobody outside gtkscale.c is using these functions, so make
them static.
2015-09-23 07:01:15 -04:00
Matthias Clasen
dfe1c63c9b
scale: Convert to g_object_notify_by_pspec
...
This avoids pspec lookup overhead in g_object_notify.
2015-09-06 17:11:36 -04:00
Matthias Clasen
1ed21ad3d4
GtkScale: More work on mark spacing
...
Try harder not to push the scale out of balance by marks. With
this change, the remaining difference in the drawing is down
to asymmetric assets and margins coming out of the theme.
To fully support such asymmetric rendering, we need implement
baseline alignment for scales.
https://bugzilla.gnome.org/show_bug.cgi?id=749650
2015-06-23 09:36:14 -04:00