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
dd03372eac
switch: Stop implementing GtkActivatable
2016-10-18 00:29:18 +02:00
Benjamin Otte
cd8b08f98f
switch: Use gdk_window_new_input()
2016-10-18 00:22:35 +02:00
Timm Bäder
feac88dc52
switch: Remove deprecated style properties
2016-10-16 18:17:21 +02:00
Benjamin Otte
e1a03ead7a
Use NULL for generic marshallers in g_signal_new()
...
glib will use the correct marshaller automatically. And as a side
effect, we also get all glib optimizations, like a va marshaller.
2016-08-29 16:20:54 +02:00
Timm Bäder
0efe186d95
switch: Remove .slider from slider gadget
...
As the documentation states, neither the switch nor the slider gadget
should be using any style classes.
2016-05-04 18:55:33 +02:00
Timm Bäder
4ba1f19b03
switch: Create less pango layouts
...
Instead of creating 2 pango layouts in every draw() and on in
_get_content_size (and calling into gettext twice in both cases), just
keep the layouts around and create them in only one place.
2016-05-04 18:35:30 +02:00
Matthias Clasen
8457dff08a
switch: Use getter for gtk-enable-animations
2016-05-01 00:40:08 -04:00
Matt Watson
7ad64a20aa
switch: port to progress tracker
2016-04-08 16:09:30 -07:00
Benjamin Otte
41195f6300
switch: An active switch is :checked
...
Fix an oversight that should have happened in the gadget refactoring:
An active switch should be :checked, just like togglebuttons,
checkbuttons, etc.
2016-03-23 18:14:57 +01:00
Timm Bäder
1331b60029
A few more documentation fixes
2016-02-09 08:05:16 +01:00
Timm Bäder
680ec087ab
switch: Don't queue draws after setting state flags
2016-02-04 20:00:21 +01:00
Timm Bäder
b8db48079f
switch: Fix text positioning
...
https://bugzilla.gnome.org/show_bug.cgi?id=760509
2016-01-12 21:56:53 +01:00
Timm Bäder
a8ceeb1766
switch: Don't include margins in input window size
...
https://bugzilla.gnome.org/show_bug.cgi?id=760509
2016-01-12 21:56:53 +01:00
Matthias Clasen
abbd6b11f6
switch: Deprecate style properties
...
CSS min-width and min-height on the slider node fit this
perfectly. We still fall back to the slider-width and
slider-height style properties if the CSS properties are
not set.
2015-12-16 13:53:13 -05:00
Benjamin Otte
0f8233bd7b
switch: Port to gadgets
2015-12-15 08:41:16 -05:00
Benjamin Otte
971a277419
cssnode: Change style-changed signal
...
Instead of having old and new style, now have a GtkCssStyleChange opaque
object that will compute the changes you are interested in for you.
This simplifies change signal handlers quite a bit and avoids lots of
repeated computation in every signal handler.
2015-12-12 02:16:04 +01:00
Matthias Clasen
870461475a
switch: Add a diagram to CSS node documentation
2015-11-03 14:27:35 -05:00
Matthias Clasen
bab20f1d10
trivial formatting fix
2015-10-31 19:23:47 -04:00
Matthias Clasen
7ea33d82ed
Remove a duplicate include
2015-10-31 19:19:53 -04:00
Matthias Clasen
506d5b5b48
switch: Document css names a bit
...
This is still provisional. Better gtk-doc support will be needed
to do better here.
2015-10-22 23:27:43 -04:00
Matthias Clasen
48b30e8e91
switch: Convert to element names
...
Use the element names switch and slider for the two css nodes,
and drop the .trough and .slider classes.
2015-10-22 21:40:31 -04:00
Benjamin Otte
1f1c7547da
switch: Use the right state when querying padding
...
We were using the state of the widget node, not the state of the slider
node.
This caused layout loops due to invalidations.
2015-10-22 18:43:55 +02:00
Benjamin Otte
950b1fb65c
switch: Port to GtkCssNode
...
This is a simple port, no code modifications so far other than replacing
gtk_style_context_save() with gtk_style_context_save_to_node().
2015-10-22 16:42:46 +02:00
Matthias Clasen
83b8bcb63a
switch: Unclip the slider shadow
...
This commit arranges things so the shadow of the slider can
extend outside the widget, even if the switch itself has no
shadow.
https://bugzilla.gnome.org/show_bug.cgi?id=755791
2015-10-03 16:20:50 -04:00
Matthias Clasen
1be338fd44
GtkSwitch: fix a reentry issue
...
The introduction of state broke some users which relied on
being able to set active in a notify::active handler.
https://bugzilla.gnome.org/show_bug.cgi?id=751754
2015-07-01 18:04:56 -07:00
Cosimo Cecchi
9913b02e3b
switch: add a style property for the switch height
...
Instead of hardcoding an aspect ratio.
This will be replaced by min-height/max-height when we have them.
https://bugzilla.gnome.org/show_bug.cgi?id=751689
2015-06-30 13:28:26 -07:00
Matthias Clasen
eea16f03f5
Stop using GDK_POINTER_MOTION_HINT_MASK in widgets
...
It is deprecated and no longer needed, and,as observed in
https://bugzilla.gnome.org/show_bug.cgi?id=746253 it
interferes with turning off event compression.
2015-03-22 17:33:38 -04:00
Chun-wei Fan
e31a936e3e
gtkswitch.c: Fix Build on C89 Compilers
...
This file now uses round(), which was not available until C99, so include
fallback-c89.c instead of math.h, which includes math.h and does a fallback
implementation of round().
2015-03-03 12:14:24 +08:00
Benjamin Otte
da559c08f9
switch: Have a priv varibale in the constructor
2015-02-16 23:57:04 +01:00
Benjamin Otte
e1081bc471
switch: Change handle_x to handle_pos
...
Make that variable go from 0.0 to 1.0 where 0.0 means inactive (slider
is on the left) and 1.0 means active (slider is on the right).
The math is simpler that way and most importantly the value is
independent of size.
2015-02-16 23:57:04 +01:00
Benjamin Otte
86a41b108e
switch: Get rid of offset member variable
...
We can compute it on-demand whereever we need it.
2015-02-16 23:57:04 +01:00
Benjamin Otte
1b171e812e
switch: Remove unused variables from private struct
2015-02-16 23:57:03 +01:00
Benjamin Otte
abfc9cd4eb
switch: Use trough style class by default
...
This allows animating the trough, and saves a save/restore pair.
2014-10-13 04:39:58 +02:00
Benjamin Otte
d1118071dd
switch: Set PRELIGHT state on widget
2014-10-13 04:39:58 +02:00
Matthias Clasen
7a81aaf3c8
GtkSwitch: Use gtk_widget_add_tick_callback
...
This api automatically takes care of dealing with disappearing
frame clocks, which we currently forget to and pay with crashes.
2014-09-23 11:23:20 -04:00
Benjamin Otte
b5a8b7ef3b
widget: Make _gtk_set_simple_clip() take an optional content clip
2014-08-21 00:54:07 +02:00
Matthias Clasen
5131472984
GtkSwitch: Initialize offset when beginning animation
...
handle_x always corresponds to the visible position of the handle,
which is where we want to start the animation. Without this, repeated
keyboard activation will not always animate.
2014-08-04 14:36:42 +02:00
Matthias Clasen
1569952d0e
GtkSwitch: Update handle_x in size-allocate
...
Since we are storing positions here that depend on the allocation,
we need to update them in size-allocate. This fixes incorrect
positioning of the handle if the switch is active initially.
https://bugzilla.gnome.org/show_bug.cgi?id=734213
2014-08-04 14:36:42 +02:00
Matthias Clasen
2e85046b8f
GtkSwitch: Don't store dest_offset
...
Instead, calculate it on the spot in the tick callback, and
update handle_x in gtk_switch_set_active, based on the new
active property.
2014-08-04 14:36:42 +02:00
Matthias Clasen
d4bd9e9c46
GtkSwitch: End animations on finalize
...
Handle the unlikely case that a switch gets finalized while its
toggle animation is running.
2014-08-04 14:36:42 +02:00
Matthias Clasen
007ba3bc14
GtkSwitch: End animation in set_active
...
End any running toggle animation before setting the set,
otherwise things get confused.
2014-08-04 14:36:42 +02:00
Matthias Clasen
8820c46ff0
GtkSwitch: Also animate for keyboard activation
2014-08-04 14:36:41 +02:00
Paolo Borelli
a0c89af801
GtkSwitch: implement animation
2014-08-03 10:22:41 +02:00
Paolo Borelli
22bd23adf3
GtkSwitch: remove unused assignment
2014-08-03 10:22:41 +02:00
Matthias Clasen
51a5cfc783
GtkSwitch: implement clipping
...
So switches can have shadows, too.
https://bugzilla.gnome.org/show_bug.cgi?id=733360
2014-07-18 16:37:18 -04:00
Jasper St. Pierre
fc75f459b0
gtkswitch: Fix docs
2014-06-29 19:10:42 -04:00
Matthias Clasen
1c57abb02b
GtkSwitch: Implement hover for GtkSwitch
...
This makes switches more similar to other activatable widgets
like buttons or scales.
2014-06-21 21:34:50 -04:00
Matthias Clasen
eed1ae682b
GtkSwitch: Use G_PARAM_EXPLICIT_NOTIFY
2014-06-09 13:31:12 -04:00
Carlos Garnacho
907e9f1946
gtk: Update GtkGesture users to the GtkPropagationPhase semantics change
...
Mainly doing s/TARGET/BUBBLE/ on the fully ported widgets, but GtkTreeView
where the double click handler has moved to GTK_PHASE_TARGET so it runs
parallelly to the still existing event handlers.
2014-05-27 17:47:12 +02:00