Package: gtk
Class gtk-level-bar
SuperclassesDocumented Subclasses
None
Direct SlotsDetails The gtk-level-bar widget is a bar widget that can be used as a
level indicator.
Typical use cases are displaying the strength of a password, or showing the
charge level of a battery. Use the gtk-level-bar-value function to set the current value, and the gtk-level-bar-add-offset-value function to set the value offsets at which the bar will be considered in a different state. GTK will add a few offsets by default on the level bar: "low", "high" and "full", with values 0.25, 0.75 and 1.0 respectively. Note that it is your responsibility to update preexisting offsets when changing the minimum or maximum value. GTK will simply clamp them to the new range. The default interval of values is between zero and one, but it is possible to modify the interval using the gtk-level-bar-min-value and gtk-level-bar-max-value functions. The value will be always drawn in proportion to the admissible interval, i.e. a value of 15 with a specified interval between 10 and 20 is equivalent to a value of 0.5 with an interval between 0 and 1. When the :discrete level bar mode is used, the bar level is rendered as a finite number of separated blocks instead of a single one. The number of blocks that will be rendered is equal to the number of units specified by the admissible interval. For instance, to build a bar rendered with five blocks, it is sufficient to set the minimum value to 0 and the maximum value to 5 after changing the indicator mode to discrete. GtkLevelBar as GtkBuildableCSS nodeslevelbar[.discrete] ╰── trough ├── block.filled.level-name ┊ ├── block.empty ┊The gtk-level-bar implementation has a main CSS node with name levelbar and one of the .discrete or .continuous style classes and a subnode with name trough. Below the trough node are a number of nodes with name block and .filled or .empty style class. In continuous mode, there is exactly one node of each, in discrete mode, the number of filled and unfilled nodes corresponds to blocks that are drawn. The block.filled nodes also get a .level-name style class corresponding to the level for the current value. In horizontal orientation, the nodes are always arranged from left to right, regardless of text direction. Example(defun create-level-bar (orientation) (let* ((levelbar (make-instance 'gtk-level-bar :orientation orientation))) ;; This changes the value of the default low offset (gtk-level-bar-add-offset-value levelbar "low" 0.10d0) ;; This adds a new offset to the bar. The application will ;; be able to change its color CSS like this: ;; ;; levelbar block.my-offset { ;; background-color: magenta; ;; border-style: solid; ;; border-color: black; ;; border-style: 1px; ;; } (gtk-level-bar-add-offset-value levelbar "my-offset" 0.60d0) ;; Return the new level bar levelbar)) Style Property Details
Signal DetailsThe "offset-changed" signallambda (levelbar name) :detailedEmitted when an offset specified on the bar changes value as an effect to the gtk-level-bar-add-offset-value function being called. The signal supports detailed connections. You can connect to the "changed::x" detailed signal in order to only receive callbacks when the value of "x" offset changes.
| Slot Access Functions
Inherited Slot Access FunctionsSee also |
*2021-12-22