package Implements_Gtk_Buildable is new Glib.Types.Implements (Gtk.Buildable.Gtk_Buildable, Gtk_Level_Bar_Record, Gtk_Level_Bar);
package Implements_Gtk_Orientable is new Glib.Types.Implements (Gtk.Orientable.Gtk_Orientable, Gtk_Level_Bar_Record, Gtk_Level_Bar);
type Gtk_Level_Bar_Record is new Gtk_Widget_Record with null record;
type Gtk_Level_Bar is access all Gtk_Level_Bar_Record'Class;
type Cb_Gtk_Level_Bar_UTF8_String_Void is not null access procedure (Self : access Gtk_Level_Bar_Record'Class; Name : UTF8_String);
type Cb_GObject_UTF8_String_Void is not null access procedure (Self : access Glib.Object.GObject_Record'Class; Name : UTF8_String);
Inverted_Property : constant Glib.Properties.Property_Boolean;
Max_Value_Property : constant Glib.Properties.Property_Double;
Min_Value_Property : constant Glib.Properties.Property_Double;
Mode_Property : constant Gtk.Enums.Property_Gtk_Level_Bar_Mode;
Value_Property : constant Glib.Properties.Property_Double;
Signal_Offset_Changed : constant Glib.Signal_Name := "offset-changed";
procedure Gtk_New
( | Self | : out Gtk_Level_Bar); |
procedure Initialize
( | Self | : not null access Gtk_Level_Bar_Record'Class); |
function Gtk_Level_Bar_New return Gtk_Level_Bar;
procedure Gtk_New_For_Interval
( | Self | : out Gtk_Level_Bar; |
Min_Value | : Gdouble; | |
Max_Value | : Gdouble); |
procedure Initialize_For_Interval
( | Self | : not null access Gtk_Level_Bar_Record'Class; |
Min_Value | : Gdouble; | |
Max_Value | : Gdouble); |
function Gtk_Level_Bar_New_For_Interval
( | Min_Value | : Gdouble; |
Max_Value | : Gdouble) return Gtk_Level_Bar; |
function Get_Type return Glib.GType;
procedure Add_Offset_Value
( | Self | : not null access Gtk_Level_Bar_Record; |
Name | : UTF8_String; | |
Value | : Gdouble); |
function Get_Inverted
( | Self | : not null access Gtk_Level_Bar_Record) return Boolean; |
procedure Set_Inverted
( | Self | : not null access Gtk_Level_Bar_Record; |
Inverted | : Boolean); |
function Get_Max_Value
( | Self | : not null access Gtk_Level_Bar_Record) return Gdouble; |
procedure Set_Max_Value
( | Self | : not null access Gtk_Level_Bar_Record; |
Value | : Gdouble); |
function Get_Min_Value
( | Self | : not null access Gtk_Level_Bar_Record) return Gdouble; |
procedure Set_Min_Value
( | Self | : not null access Gtk_Level_Bar_Record; |
Value | : Gdouble); |
function Get_Mode
( | Self | : not null access Gtk_Level_Bar_Record) return Gtk.Enums.Gtk_Level_Bar_Mode; |
procedure Set_Mode
( | Self | : not null access Gtk_Level_Bar_Record; |
Mode | : Gtk.Enums.Gtk_Level_Bar_Mode); |
function Get_Offset_Value
( | Self | : not null access Gtk_Level_Bar_Record; |
Name | : UTF8_String := ""; | |
Value | : access Gdouble) return Boolean; |
function Get_Value
( | Self | : not null access Gtk_Level_Bar_Record) return Gdouble; |
procedure Set_Value
( | Self | : not null access Gtk_Level_Bar_Record; |
Value | : Gdouble); |
procedure Remove_Offset_Value
( | Self | : not null access Gtk_Level_Bar_Record; |
Name | : UTF8_String := ""); |
function Get_Orientation
( | Self | : not null access Gtk_Level_Bar_Record) return Gtk.Enums.Gtk_Orientation; |
procedure Set_Orientation
( | Self | : not null access Gtk_Level_Bar_Record; |
Orientation | : Gtk.Enums.Gtk_Orientation); |
procedure On_Offset_Changed
( | Self | : not null access Gtk_Level_Bar_Record; |
Call | : Cb_Gtk_Level_Bar_UTF8_String_Void; | |
After | : Boolean := False); |
procedure On_Offset_Changed
( | Self | : not null access Gtk_Level_Bar_Record; |
Call | : Cb_GObject_UTF8_String_Void; | |
Slot | : not null access Glib.Object.GObject_Record'Class; | |
After | : Boolean := False); |
function "+"
( | Widget | : access Gtk_Level_Bar_Record'Class) return Gtk.Buildable.Gtk_Buildable renames Implements_Gtk_Buildable.To_Interface; |
function "-"
( | Interf | : Gtk.Buildable.Gtk_Buildable) return Gtk_Level_Bar renames Implements_Gtk_Buildable.To_Object; |
function "+"
( | Widget | : access Gtk_Level_Bar_Record'Class) return Gtk.Orientable.Gtk_Orientable renames Implements_Gtk_Orientable.To_Interface; |
function "-"
( | Interf | : Gtk.Orientable.Gtk_Orientable) return Gtk_Level_Bar renames Implements_Gtk_Orientable.To_Object; |
The Gtk.Level_Bar.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 Gtk.Level_Bar.Set_Value to set the current value, and Gtk.Level_Bar.Add_Offset_Value 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: GTK_LEVEL_BAR_OFFSET_LOW and GTK_LEVEL_BAR_OFFSET_HIGH, with values 0.25 and 0.75 respectively. == 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; } The default interval of values is between zero and one, but it's possible to modify the interval using Gtk.Level_Bar.Set_Min_Value and Gtk.Level_Bar.Set_Max_Value. 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 GTK_LEVEL_BAR_MODE_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's sufficient to set the minimum value to 0 and the maximum value to 5 after changing the indicator mode to discrete.