Package: gtk

Class gtk-level-bar

Superclasses

gtk-widget, g-initially-unowned, gtk-buildable, gtk-orientable, g-object, common-lisp:standard-object, common-lisp:t

Documented Subclasses

None

Direct Slots

inverted
The inverted property of type :boolean (Read / Write)
Level bars normally grow from top to bottom or left to right. Inverted level bars grow in the opposite direction.
Default value: nil
Since 3.8
max-value
The max-value property of type :double (Read / Write)
The max-value property determines the maximum value of the interval that can be displayed by the bar.
Allowed values: >= 0
Default value: 1
min-value
The min-value property of type :double (Read / Write)
The min-value property determines the minimum value of the interval that can be displayed by the bar.
Allowed values: >= 0
Default value: 0
mode
The mode property of type gtk-level-bar-mode (Read / Write)
The mode property determines the way gtk-level-bar interprets the value properties to draw the level fill area. Specifically, when the value is :continuous, gtk-level-bar will draw a single block representing the current value in that area; when the value is :discrete, the widget will draw a succession of separate blocks filling the draw area, with the number of blocks being equal to the units separating the integral roundings of min-value and max-value.
Default value: :continuous
value
The value property of type :double (Read / Write)
The value property determines the currently filled value of the level bar.
Allowed values: >= 0
Default value: 0

Details

The gtk-level-bar 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 two offsets by default on the level bar: "low" and "high", with values 0.25 and 0.75 respectively.

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 :discrete is used, the bar level is rendered as a finite and 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 was introduced in GTK+ 3.6.

GtkLevelBar as GtkBuildable

The gtk-level-bar implementation of the gtk-buildable interface supports a custom <offsets> element, which can contain any number of <offset> elements, each of which must have name and value attributes.

CSS nodes

 levelbar[.discrete]
 ╰── trough
     ├── block.filled.level-name
     ┊
     ├── block.empty
     ┊    
gtk-level-bar has a main CSS node with name levelbar and one of the style classes .discrete or .continuous and a subnode with name trough. Below the trough node are a number of nodes with name block and style class .filled or .empty. 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 style class .level-name 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

Adding a custom offset on the bar.
 static GtkWidget *
 create_level_bar (void)
 {
   GtkWidget *level_bar;

level_bar = gtk_level_bar_new ();

/* This changes the value of the default low offset */ gtk_level_bar_add_offset_value (GTK_LEVEL_BAR (level_bar), GTK_LEVEL_BAR_OFFSET_LOW, 0.10);

/* This adds a new offset to the bar; the application will * be able to change its color by using the following selector, * either by adding it to its CSS file or using * gtk_css_provider_load_from_data() and gtk_style_context_add_provider() * * .level-bar.fill-block.level-my-offset { * background-color: green; * border-style: solid; * border-color: black; * border-style: 1px; * } */ gtk_level_bar_add_offset_value (GTK_LEVEL_BAR (level_bar), "my-offset", 0.60); return level_bar; }

Style Property Details

min-block-height
The min-block-height style property of type :int (Read / Write)
The min-block-height style property determines the minimum height for blocks filling the gtk-level-bar widget.
Warning: The min-block-height property has been deprecated since version 3.20 and should not be used in newly-written code. Use the standard min-width/min-height CSS properties on the block elements; the value of this style property is ignored.
Allowed values: >= 1
Default value: 3
min-block-width
The min-block-width style property of type :int (Read / Write)
The "min-block-width" style property determines the minimum width for blocks filling the gtk-level-bar widget.
Warning: The min-block-height property has been deprecated since version 3.20 and should not be used in newly-written code. Use the standard min-width/min-height CSS properties on the block elements; the value of this style property is ignored.
Allowed values: >= 1
Default value: 3

Signal Details

The "offset-changed" signal
lambda (levelbar name)    : Has Details      
Emitted 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 detailed signal "changed::x" in order to only receive callbacks when the value of offset "x" changes.
levelbar
A gtk-level-bar.
name
The name of the offset that changed value.
 

Slot Access Functions

Inherited Slot Access Functions

2014-2-3