Toc Gallery Index Tree Gtk.GRange

Screenshot

No screeshot

Hierarchy

Description

This widget provides a low level graphical representation of a range of values. It is used by other widgets such as Gtk_Scale and Gtk_Scrollbar.

Types

  • type Gtk_GRange is Gtk_Range;
  • type Gtk_Range is access all Gtk_Range_Record'Class;
  • type Gtk_Range_Record is new Gtk.Widget.Gtk_Widget_Record with private;

Subprograms

  • function Get_Type return Gtk.Gtk_Type;
    Return the internal value associated with a Gtk_Range.
  • procedure Set_Update_Policy (The_Range : access Gtk_Range_Record; Policy : Gtk_Update_Type);
    Set the update policy for the range. Update_Continuous means that anytime the range slider is moved, the range value will change and the value_changed signal will be emitted. Update_Delayed means that the value will be updated after a brief timeout where no slider motion occurs, so updates are spaced by a short time rather than continuous. Update_Discontinuous means that the value will only be updated when the user releases the button and ends the slider drag operation.
  • function Get_Update_Policy (The_Range : access Gtk_Range_Record) return Gtk_Update_Type;
    Return the current update policy.
  • procedure Set_Adjustment (The_Range : access Gtk_Range_Record; Adjustment : Gtk.Adjustment.Gtk_Adjustment);
    Set the adjustment to be used as the "model" object for this range widget. The adjustment indicates the current range value, the minimum and maximum range values, the step/page increments used for keybindings and scrolling, and the page size. The page size is normally 0 for Gtk_Scale and nonzero for Gtk_Scrollbar, and indicates the size of the visible area of the widget being scrolled. The page size affects the size of the scrollbar slider.
  • function Get_Adjustment (The_Range : access Gtk_Range_Record) return Gtk.Adjustment.Gtk_Adjustment;
    Return the adjustment associated with the range widget.
  • procedure Set_Inverted (The_Range : access Gtk_Range_Record; Setting : Boolean := True);
    Ranges normally move from lower to higher values as the slider moves from top to bottom or left to right. Inverted ranges have higher values at the top or on the right rather than on the bottom or left.
  • function Get_Inverted (The_Range : access Gtk_Range_Record) return Boolean;
    Return whether the range is inverted.
  • procedure Set_Increments (The_Range : access Gtk_Range_Record; Step : Gdouble; Page : Gdouble);
    Set the Step and the Page size for the range. The Step size is used when the user clicks on the Gtk_Scrollbar arrows or moves the Gtk_Scale via the arrow keys. The Page size is used when moving by pages via the Page-Up and Page-Down keys for instance.
  • procedure Set_Range (The_Range : access Gtk_Range_Record; Min : Gdouble; Max : Gdouble);
    Set the allowable values in the Gtk_Range, and clamps the range value to the between Min and Max.
  • procedure Set_Value (The_Range : access Gtk_Range_Record; Value : Gdouble);
    Set the current value of the given Range. If the value is outside the minimum or the maximum value range, it will be clamped to fit inside the range. Cause the "value_changed" signal to be emitted if the value is different.
  • function Get_Value (The_Range : access Gtk_Range_Record) return Gdouble;
    Return the current value of the range.

Signals

  • adjust_bounds
    procedure Handler (R : access Gtk_Range_Record'Class; Value : Gdouble);
  • change_value
    function Handler (R : access Gtk_Range_Record'Class; Typ : Gtk_Scroll_Type; Value : Gdouble) return Gboolean;
    Emitted when a scroll action is performed on the range. The type of event that occurred and the new value are returned. The application should return True if it has handled the event itself.
  • move_slider
    procedure Handler (R : access Gtk_Range_Record'Class);
    Emitted when the slider has changed
  • value_changed
    procedure Handler (R : access Gtk_Range_Record'Class);
    Emitted when the current value of the range has changed

Properties

  • Adjustment_Property
    Object
    The GtkAdjustment that contains the current value of this range
  • Inverted_Property
    Boolean
    Invert direction slider moves to increase range value
  • Update_Policy_Property
    Gtk_Update_Type
    How the range should be updated on the screen
    See: Set_Update_Policy

Style Properties

  • Arrow_Displacement_X_Property
    Int
    How far in the x direction to move the arrow when the button is
  • Arrow_Displacement_Y_Property
    Int
    How far in the y direction to move the arrow when the button is
  • Slider_Width_Property
    Int
    Width of scrollbar or scale thumb
  • Stepper_Size_Property
    Int
    Length of step buttons at ends
  • Stepper_Spacing_Property
    Int
    Spacing between step buttons and thumb
  • Trough_Border_Property
    Int
    Spacing between thumb/steppers and outer trough bevel

Testgtk source code

This code is part of testgtk, a demo application packaged with GtkAda. Testgtk demonstrates the various widgets of GtkAda
----------------------------------------------------------------------- -- GtkAda - Ada95 binding for the Gimp Toolkit -- -- -- -- Copyright (C) 1998-1999 -- -- Emmanuel Briot, Joel Brobecker and Arnaud Charlet -- -- -- -- This library is free software; you can redistribute it and/or -- -- modify it under the terms of the GNU General Public -- -- License as published by the Free Software Foundation; either -- -- version 2 of the License, or (at your option) any later version. -- -- -- -- This library is distributed in the hope that it will be useful, -- -- but WITHOUT ANY WARRANTY; without even the implied warranty of -- -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -- -- General Public License for more details. -- -- -- -- You should have received a copy of the GNU General Public -- -- License along with this library; if not, write to the -- -- Free Software Foundation, Inc., 59 Temple Place - Suite 330, -- -- Boston, MA 02111-1307, USA. -- -- -- -- -- -- -- -- -- -- ----------------------------------------------------------------------- with Gtk.Adjustment; use Gtk.Adjustment; with Gtk.Box; use Gtk.Box; with Gtk.Enums; use Gtk.Enums; with Gtk.Scale; use Gtk.Scale; with Gtk.Scrollbar; use Gtk.Scrollbar; with Gtk; use Gtk; package body Create_Range is function Help return String is begin return "A @bGtk_Range@B is a simple way to select a value in a" & " specific interval. Although less precise than a " & "@bGtk_Spin_Button@B, it is much faster to use." & ASCII.LF & "A @bGtk_Scrollbar@B (seen below the range) can also be used as a" & " @bGtk_Range@B, although it does not display its value and relies" & " on another widget to do so." & ASCII.LF & "Note that this demo does not require any explicit callback to be" & " set to connect the two widgets. In fact, they both use the same" & " @bGtk_Adjustment@B for their value. Thus, when you modify one of" & " the widget, it modifies its value in the adjustment, which is then" & " reflected in the other widget." & ASCII.LF & "As you can see, the @bGtk_Scrollbar@B update its value as soon as" & " it is moved, whereas the @bGtk_Range@B only update its value when" & " the user releases the mouse button."; end Help; procedure Run (Frame : access Gtk.Frame.Gtk_Frame_Record'Class) is Box1 : Gtk_Box; Box2 : Gtk_Box; Adjustment : Gtk_Adjustment; Scale : Gtk_Scale; Scrollbar : Gtk_Scrollbar; begin Set_Label (Frame, "Range"); Gtk_New_Vbox (Box1, False, 0); Add (Frame, Box1); Gtk_New_Vbox (Box2, False, 10); Set_Border_Width (Box2, 10); Pack_Start (Box1, Box2, False, False, 0); Gtk_New (Adjustment, 0.0, 0.0, 101.0, 0.1, 1.0, 1.0); Gtk_New_Hscale (Scale, Adjustment); Set_USize (Scale, 150, 30); Set_Update_Policy (Scale, Update_Delayed); Set_Digits (Scale, 1); Set_Draw_Value (Scale, True); Pack_Start (Box2, Scale, True, True, 0); Gtk_New_Hscrollbar (Scrollbar, Adjustment); Set_Update_Policy (Scrollbar, Update_Continuous); Pack_Start (Box2, Scrollbar, True, True, 0); Show_All (Frame); end Run; end Create_Range;

Alphabetical Index