Merge branch 'better-switch-docs' into 'main'

switch: Expand the docs

See merge request GNOME/gtk!5903
This commit is contained in:
Matthias Clasen 2023-05-01 20:03:44 +00:00
commit 98dde97f20
4 changed files with 52 additions and 1 deletions

View File

@ -68,6 +68,7 @@ ui_files = [
'stackswitcher.ui',
'statusbar.ui',
'switch.ui',
'switch-state.ui',
'toggle-button.ui',
'video.ui',
'volumebutton.ui',

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.6 KiB

View File

@ -0,0 +1,43 @@
<?xml version="1.0" encoding="UTF-8"?>
<interface>
<object class="GtkWindow">
<property name="decorated">0</property>
<property name="resizable">0</property>
<property name="default-width">280</property>
<property name="default-height">120</property>
<style>
<class name="nobackground"/>
</style>
<child>
<object class="GtkBox">
<style>
<class name="shadow"/>
<class name="background"/>
<class name="frame"/>
</style>
<child>
<object class="GtkBox">
<property name="orientation">vertical</property>
<property name="spacing">3</property>
<property name="hexpand">1</property>
<property name="vexpand">1</property>
<property name="halign">center</property>
<property name="valign">center</property>
<child>
<object class="GtkSwitch">
<property name="active">1</property>
<property name="state">0</property>
</object>
</child>
<child>
<object class="GtkSwitch">
<property name="active">0</property>
<property name="state">1</property>
</object>
</child>
</object>
</child>
</object>
</child>
</object>
</interface>

View File

@ -34,7 +34,14 @@
* empty area, or by dragging the handle.
*
* `GtkSwitch` can also handle situations where the underlying state
* changes with a delay. See [signal@Gtk.Switch::state-set] for details.
* changes with a delay. In this case, the slider position indicates
* the user's recent change (as indicated by the [property@Gtk.Switch:active]
* property), and the color indicates whether the underlying state (represented
* by the [property@Gtk.Switch:state] property) has been updated yet.
*
* ![GtkSwitch with delayed state change](switch-state.png)
*
* See [signal@Gtk.Switch::state-set] for details.
*
* # CSS nodes
*