[Contents]   [Back]   [Prev]   [Up]   [Next]   [Forward]  


Package Gtk.Adjustment

This object represents an adjustable bounded value. It is used in many other widgets that have such internal values, like Gtk_Scrollbar, Gtk_Spin_Button, Gtk_Range, ... Modifying the value of these widgets is done through their associated adjustments.

The modification of the value is left to the user, who should call Value_Changed or Changed to emit the relevant signals.

Widget Hierarchy

Gtk_Object                    (see section Package Gtk.Object)
   \___ Gtk_Data              (see section Package Gtk.Data)
      \___ Gtk_Adjustment     (see section Package Gtk.Adjustment)

Signals

Subprograms

procedure Gtk_New              
  (Adjustment         : in out Gtk_Adjustment;
   Value              : in     Gfloat;
   Lower              : in     Gfloat;
   Upper              : in     Gfloat;
   Step_Increment     : in     Gfloat;
   Page_Increment     : in     Gfloat;
   Page_Size          : in     Gfloat);

Create a new adjustment.
Value is the initial value of the adjustment. It must be in the range (Lower .. Upper) and the adjustment's value will never be outside this range. Step_Increment is the value used to make minor adjustments, such as when the user clicks on the arrows of a scrollbar. Page_Increment is used to make major adjustments, such as when the user clicks in the through on a scrollbar. Page_Size is the size of the area that is currently visible (for instance in a Gtk_Scrolled_Window).


function Get_Type              return Gtk.Gtk_Type;

Return the internal value associated with a Gtk_Adjustment.


Read functions


function Get_Value             
  (Adjustment         : access Gtk_Adjustment_Record)
   return Gfloat;

Return the current value of the adjustment.


function Get_Lower             
  (Adjustment         : access Gtk_Adjustment_Record)
   return Gfloat;

Return the lower bound of the adjustment.


function Get_Upper             
  (Adjustment         : access Gtk_Adjustment_Record)
   return Gfloat;

Return the upper bound of the adjustment.


function Get_Step_Increment    
  (Adjustment         : access Gtk_Adjustment_Record)
   return Gfloat;

Return the step increment of the adjustment.


function Get_Page_Increment    
  (Adjustment         : access Gtk_Adjustment_Record)
   return Gfloat;

Return the page increment of the adjustment.


function Get_Page_Size         
  (Adjustment         : access Gtk_Adjustment_Record)
   return Gfloat;

Return the page size of the adjustment.


Write functions


procedure Set_Upper            
  (Adjustment         : access Gtk_Adjustment_Record;
   Upper              : in     Gfloat);

Modify the upper bound of the adjustment.
You should call Changed after modifying this value.


procedure Set_Lower            
  (Adjustment         : access Gtk_Adjustment_Record;
   Lower              : in     Gfloat);

Modify the lower bound of the adjustment.
You should call Changed after modifying this value.


procedure Set_Value            
  (Adjustment         : access Gtk_Adjustment_Record;
   Value              : in     Gfloat);

Modify the current value of the adjustment.
You do not need to call Value_Changed after modifying this value, this is done automatically.


procedure Set_Page_Size        
  (Adjustment         : access Gtk_Adjustment_Record;
   Page_Size          : in     Gfloat);

Modify the page size of the adjustment.
You should call Changed after modifying this value.


procedure Set_Page_Increment   
  (Adjustment         : access Gtk_Adjustment_Record;
   Page_Increment     : in     Gfloat);

Modify the page increment of the adjustment.
You should call Changed after modifying this value.


procedure Set_Step_Increment   
  (Adjustment         : access Gtk_Adjustment_Record;
   Step_Increment     : in     Gfloat);

Modify the step increment of the adjustment.
You should call Changed after modifying this value.


Misc functions


procedure Clamp_Page           
  (Adjustment         : access Gtk_Adjustment_Record;
   Lower              : in     Gfloat;
   Upper              : in     Gfloat);

Update the Adjustment value to ensure that the range between Lower and
Upper is in the current page (i.e. between value and value + page_size). If the range is larger than the page size, then only the start of it will be in the current page. A "value_changed" signal will be emitted if the value is changed.


Signals emission


procedure Changed              
  (Adjustment         : access Gtk_Adjustment_Record);

Emit the "changed" signal on Adjustment.
This warns any listener that some field other than the value has been changed.


procedure Value_Changed        
  (Adjustment         : access Gtk_Adjustment_Record);

Emit the "value_changed" signal on Adjustment.
This warns any listener that the value has been changed.


Example


 The meaning of the most important fields can be explained on the
 following figure (imagine this is a scrollbar):

    [-------|=================|-------------------]
   lower    value        value + page_size       upper

 


[Contents]   [Back]   [Prev]   [Up]   [Next]   [Forward]