1. ------------------------------------------------------------------------------ 
  2. --                                                                          -- 
  3. --      Copyright (C) 1998-2000 E. Briot, J. Brobecker and A. Charlet       -- 
  4. --                     Copyright (C) 2000-2014, AdaCore                     -- 
  5. --                                                                          -- 
  6. -- This library is free software;  you can redistribute it and/or modify it -- 
  7. -- under terms of the  GNU General Public License  as published by the Free -- 
  8. -- Software  Foundation;  either version 3,  or (at your  option) any later -- 
  9. -- version. This library is distributed in the hope that it will be useful, -- 
  10. -- but WITHOUT ANY WARRANTY;  without even the implied warranty of MERCHAN- -- 
  11. -- TABILITY or FITNESS FOR A PARTICULAR PURPOSE.                            -- 
  12. --                                                                          -- 
  13. -- As a special exception under Section 7 of GPL version 3, you are granted -- 
  14. -- additional permissions described in the GCC Runtime Library Exception,   -- 
  15. -- version 3.1, as published by the Free Software Foundation.               -- 
  16. --                                                                          -- 
  17. -- You should have received a copy of the GNU General Public License and    -- 
  18. -- a copy of the GCC Runtime Library Exception along with this program;     -- 
  19. -- see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see    -- 
  20. -- <http://www.gnu.org/licenses/>.                                          -- 
  21. --                                                                          -- 
  22. ------------------------------------------------------------------------------ 
  23.  
  24. --  <description> 
  25. --  A Gtk.Spin_Button.Gtk_Spin_Button is an ideal way to allow the user to set 
  26. --  the value of some attribute. Rather than having to directly type a number 
  27. --  into a Gtk.GEntry.Gtk_Entry, GtkSpinButton allows the user to click on one 
  28. --  of two arrows to increment or decrement the displayed value. A value can 
  29. --  still be typed in, with the bonus that it can be checked to ensure it is in 
  30. --  a given range. 
  31. -- 
  32. --  The main properties of a GtkSpinButton are through an adjustment. See the 
  33. --  Gtk.Adjustment.Gtk_Adjustment section for more details about an 
  34. --  adjustment's properties. 
  35. -- 
  36. --  == Using a GtkSpinButton to get an integer == 
  37. -- 
  38. --    /* Provides a function to retrieve an integer value from a 
  39. --    * GtkSpinButton and creates a spin button to model percentage 
  40. --    * values. 
  41. --    */ 
  42. --    gint 
  43. --    grab_int_value (GtkSpinButton *button, 
  44. --       gpointer       user_data) 
  45. --    { 
  46. --       return gtk_spin_button_get_value_as_int (button); 
  47. --    } 
  48. --    void 
  49. --    create_integer_spin_button (void) 
  50. --    { 
  51. --       GtkWidget *window, *button; 
  52. --       GtkAdjustment *adjustment; 
  53. --       adjustment = gtk_adjustment_new (50.0, 0.0, 100.0, 1.0, 5.0, 0.0); 
  54. --       window = gtk_window_new (GTK_WINDOW_TOPLEVEL); 
  55. --       gtk_container_set_border_width (GTK_CONTAINER (window), 5); 
  56. --       /* creates the spinbutton, with no decimal places */ 
  57. --       button = gtk_spin_button_new (adjustment, 1.0, 0); 
  58. --       gtk_container_add (GTK_CONTAINER (window), button); 
  59. --       gtk_widget_show_all (window); 
  60. --    } 
  61. -- 
  62. --  == Using a GtkSpinButton to get a floating point value == 
  63. -- 
  64. --    /* Provides a function to retrieve a floating point value from a 
  65. --    * GtkSpinButton, and creates a high precision spin button. 
  66. --    */ 
  67. --    gfloat 
  68. --    grab_float_value (GtkSpinButton *button, 
  69. --       gpointer       user_data) 
  70. --    { 
  71. --       return gtk_spin_button_get_value (button); 
  72. --    } 
  73. --    void 
  74. --    create_floating_spin_button (void) 
  75. --    { 
  76. --       GtkWidget *window, *button; 
  77. --       GtkAdjustment *adjustment; 
  78. --       adjustment = gtk_adjustment_new (2.500, 0.0, 5.0, 0.001, 0.1, 0.0); 
  79. --       window = gtk_window_new (GTK_WINDOW_TOPLEVEL); 
  80. --       gtk_container_set_border_width (GTK_CONTAINER (window), 5); 
  81. --       /* creates the spinbutton, with three decimal places */ 
  82. --       button = gtk_spin_button_new (adjustment, 0.001, 3); 
  83. --       gtk_container_add (GTK_CONTAINER (window), button); 
  84. --       gtk_widget_show_all (window); 
  85. --    } 
  86. -- 
  87. -- 
  88. --  </description> 
  89. pragma Ada_2005; 
  90.  
  91. pragma Warnings (Off, "*is already use-visible*"); 
  92. with Gdk.Event;               use Gdk.Event; 
  93. with Glib;                    use Glib; 
  94. with Glib.Generic_Properties; use Glib.Generic_Properties; 
  95. with Glib.Object;             use Glib.Object; 
  96. with Glib.Properties;         use Glib.Properties; 
  97. with Glib.Types;              use Glib.Types; 
  98. with Gtk.Adjustment;          use Gtk.Adjustment; 
  99. with Gtk.Buildable;           use Gtk.Buildable; 
  100. with Gtk.Cell_Editable;       use Gtk.Cell_Editable; 
  101. with Gtk.Editable;            use Gtk.Editable; 
  102. with Gtk.Enums;               use Gtk.Enums; 
  103. with Gtk.GEntry;              use Gtk.GEntry; 
  104. with Gtk.Orientable;          use Gtk.Orientable; 
  105.  
  106. package Gtk.Spin_Button is 
  107.  
  108.    type Gtk_Spin_Button_Record is new Gtk_Entry_Record with null record; 
  109.    type Gtk_Spin_Button is access all Gtk_Spin_Button_Record'Class; 
  110.  
  111.    type Gtk_Spin_Type is ( 
  112.       Spin_Step_Forward, 
  113.       Spin_Step_Backward, 
  114.       Spin_Page_Forward, 
  115.       Spin_Page_Backward, 
  116.       Spin_Home, 
  117.       Spin_End, 
  118.       Spin_User_Defined); 
  119.    pragma Convention (C, Gtk_Spin_Type); 
  120.    --  The values of the GtkSpinType enumeration are used to specify the 
  121.    --  change to make in Gtk.Spin_Button.Spin. 
  122.  
  123.    type Gtk_Spin_Button_Update_Policy is ( 
  124.       Update_Always, 
  125.       Update_If_Valid); 
  126.    pragma Convention (C, Gtk_Spin_Button_Update_Policy); 
  127.    --  The spin button update policy determines whether the spin button 
  128.    --  displays values even if they are outside the bounds of its adjustment. 
  129.    --  See Gtk.Spin_Button.Set_Update_Policy. 
  130.  
  131.    ---------------------------- 
  132.    -- Enumeration Properties -- 
  133.    ---------------------------- 
  134.  
  135.    package Gtk_Spin_Type_Properties is 
  136.       new Generic_Internal_Discrete_Property (Gtk_Spin_Type); 
  137.    type Property_Gtk_Spin_Type is new Gtk_Spin_Type_Properties.Property; 
  138.  
  139.    package Gtk_Spin_Button_Update_Policy_Properties is 
  140.       new Generic_Internal_Discrete_Property (Gtk_Spin_Button_Update_Policy); 
  141.    type Property_Gtk_Spin_Button_Update_Policy is new Gtk_Spin_Button_Update_Policy_Properties.Property; 
  142.  
  143.    ------------------ 
  144.    -- Constructors -- 
  145.    ------------------ 
  146.  
  147.    procedure Gtk_New 
  148.       (Spin_Button : out Gtk_Spin_Button; 
  149.        Adjustment  : access Gtk.Adjustment.Gtk_Adjustment_Record'Class; 
  150.        Climb_Rate  : Gdouble; 
  151.        The_Digits  : Guint := 0); 
  152.    procedure Initialize 
  153.       (Spin_Button : not null access Gtk_Spin_Button_Record'Class; 
  154.        Adjustment  : access Gtk.Adjustment.Gtk_Adjustment_Record'Class; 
  155.        Climb_Rate  : Gdouble; 
  156.        The_Digits  : Guint := 0); 
  157.    --  Creates a new Gtk.Spin_Button.Gtk_Spin_Button. 
  158.    --  "adjustment": the Gtk.Adjustment.Gtk_Adjustment object that this spin 
  159.    --  button should use, or null 
  160.    --  "climb_rate": specifies how much the spin button changes when an arrow 
  161.    --  is clicked on 
  162.    --  "digits": the number of decimal places to display 
  163.  
  164.    function Gtk_Spin_Button_New 
  165.       (Adjustment : access Gtk.Adjustment.Gtk_Adjustment_Record'Class; 
  166.        Climb_Rate : Gdouble; 
  167.        The_Digits : Guint := 0) return Gtk_Spin_Button; 
  168.    --  Creates a new Gtk.Spin_Button.Gtk_Spin_Button. 
  169.    --  "adjustment": the Gtk.Adjustment.Gtk_Adjustment object that this spin 
  170.    --  button should use, or null 
  171.    --  "climb_rate": specifies how much the spin button changes when an arrow 
  172.    --  is clicked on 
  173.    --  "digits": the number of decimal places to display 
  174.  
  175.    procedure Gtk_New 
  176.       (Spin_Button : out Gtk_Spin_Button; 
  177.        Min         : Gdouble; 
  178.        Max         : Gdouble; 
  179.        Step        : Gdouble); 
  180.    procedure Initialize 
  181.       (Spin_Button : not null access Gtk_Spin_Button_Record'Class; 
  182.        Min         : Gdouble; 
  183.        Max         : Gdouble; 
  184.        Step        : Gdouble); 
  185.    --  This is a convenience constructor that allows creation of a numeric 
  186.    --  Gtk.Spin_Button.Gtk_Spin_Button without manually creating an adjustment. 
  187.    --  The value is initially set to the minimum value and a page increment of 
  188.    --  10 * Step is the default. The precision of the spin button is equivalent 
  189.    --  to the precision of Step. 
  190.    --  Note that the way in which the precision is derived works best if Step 
  191.    --  is a power of ten. If the resulting precision is not suitable for your 
  192.    --  needs, use Gtk.Spin_Button.Set_Digits to correct it. 
  193.    --  "min": Minimum allowable value 
  194.    --  "max": Maximum allowable value 
  195.    --  "step": Increment added or subtracted by spinning the widget 
  196.  
  197.    function Gtk_Spin_Button_New_With_Range 
  198.       (Min  : Gdouble; 
  199.        Max  : Gdouble; 
  200.        Step : Gdouble) return Gtk_Spin_Button; 
  201.    --  This is a convenience constructor that allows creation of a numeric 
  202.    --  Gtk.Spin_Button.Gtk_Spin_Button without manually creating an adjustment. 
  203.    --  The value is initially set to the minimum value and a page increment of 
  204.    --  10 * Step is the default. The precision of the spin button is equivalent 
  205.    --  to the precision of Step. 
  206.    --  Note that the way in which the precision is derived works best if Step 
  207.    --  is a power of ten. If the resulting precision is not suitable for your 
  208.    --  needs, use Gtk.Spin_Button.Set_Digits to correct it. 
  209.    --  "min": Minimum allowable value 
  210.    --  "max": Maximum allowable value 
  211.    --  "step": Increment added or subtracted by spinning the widget 
  212.  
  213.    function Get_Type return Glib.GType; 
  214.    pragma Import (C, Get_Type, "gtk_spin_button_get_type"); 
  215.  
  216.    ------------- 
  217.    -- Methods -- 
  218.    ------------- 
  219.  
  220.    procedure Configure 
  221.       (Spin_Button : not null access Gtk_Spin_Button_Record; 
  222.        Adjustment  : access Gtk.Adjustment.Gtk_Adjustment_Record'Class; 
  223.        Climb_Rate  : Gdouble; 
  224.        The_Digits  : Guint); 
  225.    --  Changes the properties of an existing spin button. The adjustment, 
  226.    --  climb rate, and number of decimal places are all changed accordingly, 
  227.    --  after this function call. 
  228.    --  "adjustment": a Gtk.Adjustment.Gtk_Adjustment 
  229.    --  "climb_rate": the new climb rate 
  230.    --  "digits": the number of decimal places to display in the spin button 
  231.  
  232.    function Get_Adjustment 
  233.       (Spin_Button : not null access Gtk_Spin_Button_Record) 
  234.        return Gtk.Adjustment.Gtk_Adjustment; 
  235.    --  Get the adjustment associated with a Gtk.Spin_Button.Gtk_Spin_Button 
  236.  
  237.    procedure Set_Adjustment 
  238.       (Spin_Button : not null access Gtk_Spin_Button_Record; 
  239.        Adjustment  : not null access Gtk.Adjustment.Gtk_Adjustment_Record'Class); 
  240.    --  Replaces the Gtk.Adjustment.Gtk_Adjustment associated with Spin_Button. 
  241.    --  "adjustment": a Gtk.Adjustment.Gtk_Adjustment to replace the existing 
  242.    --  adjustment 
  243.  
  244.    function Get_Digits 
  245.       (Spin_Button : not null access Gtk_Spin_Button_Record) return Guint; 
  246.    --  Fetches the precision of Spin_Button. See Gtk.Spin_Button.Set_Digits. 
  247.  
  248.    procedure Set_Digits 
  249.       (Spin_Button : not null access Gtk_Spin_Button_Record; 
  250.        The_Digits  : Guint); 
  251.    --  Set the precision to be displayed by Spin_Button. Up to 20 digit 
  252.    --  precision is allowed. 
  253.    --  "digits": the number of digits after the decimal point to be displayed 
  254.    --  for the spin button's value 
  255.  
  256.    procedure Get_Increments 
  257.       (Spin_Button : not null access Gtk_Spin_Button_Record; 
  258.        Step        : out Gdouble; 
  259.        Page        : out Gdouble); 
  260.    --  Gets the current step and page the increments used by Spin_Button. See 
  261.    --  Gtk.Spin_Button.Set_Increments. 
  262.    --  "step": location to store step increment, or null 
  263.    --  "page": location to store page increment, or null 
  264.  
  265.    procedure Set_Increments 
  266.       (Spin_Button : not null access Gtk_Spin_Button_Record; 
  267.        Step        : Gdouble; 
  268.        Page        : Gdouble); 
  269.    --  Sets the step and page increments for spin_button. This affects how 
  270.    --  quickly the value changes when the spin button's arrows are activated. 
  271.    --  "step": increment applied for a button 1 press. 
  272.    --  "page": increment applied for a button 2 press. 
  273.  
  274.    function Get_Numeric 
  275.       (Spin_Button : not null access Gtk_Spin_Button_Record) return Boolean; 
  276.    --  Returns whether non-numeric text can be typed into the spin button. See 
  277.    --  Gtk.Spin_Button.Set_Numeric. 
  278.  
  279.    procedure Set_Numeric 
  280.       (Spin_Button : not null access Gtk_Spin_Button_Record; 
  281.        Numeric     : Boolean); 
  282.    --  Sets the flag that determines if non-numeric text can be typed into the 
  283.    --  spin button. 
  284.    --  "numeric": flag indicating if only numeric entry is allowed 
  285.  
  286.    procedure Get_Range 
  287.       (Spin_Button : not null access Gtk_Spin_Button_Record; 
  288.        Min         : out Gdouble; 
  289.        Max         : out Gdouble); 
  290.    --  Gets the range allowed for Spin_Button. See Gtk.Spin_Button.Set_Range. 
  291.    --  "min": location to store minimum allowed value, or null 
  292.    --  "max": location to store maximum allowed value, or null 
  293.  
  294.    procedure Set_Range 
  295.       (Spin_Button : not null access Gtk_Spin_Button_Record; 
  296.        Min         : Gdouble; 
  297.        Max         : Gdouble); 
  298.    --  Sets the minimum and maximum allowable values for Spin_Button. 
  299.    --  If the current value is outside this range, it will be adjusted to fit 
  300.    --  within the range, otherwise it will remain unchanged. 
  301.    --  "min": minimum allowable value 
  302.    --  "max": maximum allowable value 
  303.  
  304.    function Get_Snap_To_Ticks 
  305.       (Spin_Button : not null access Gtk_Spin_Button_Record) return Boolean; 
  306.    --  Returns whether the values are corrected to the nearest step. See 
  307.    --  Gtk.Spin_Button.Set_Snap_To_Ticks. 
  308.  
  309.    procedure Set_Snap_To_Ticks 
  310.       (Spin_Button   : not null access Gtk_Spin_Button_Record; 
  311.        Snap_To_Ticks : Boolean); 
  312.    --  Sets the policy as to whether values are corrected to the nearest step 
  313.    --  increment when a spin button is activated after providing an invalid 
  314.    --  value. 
  315.    --  "snap_to_ticks": a flag indicating if invalid values should be 
  316.    --  corrected 
  317.  
  318.    function Get_Update_Policy 
  319.       (Spin_Button : not null access Gtk_Spin_Button_Record) 
  320.        return Gtk_Spin_Button_Update_Policy; 
  321.    --  Gets the update behavior of a spin button. See 
  322.    --  Gtk.Spin_Button.Set_Update_Policy. 
  323.  
  324.    procedure Set_Update_Policy 
  325.       (Spin_Button : not null access Gtk_Spin_Button_Record; 
  326.        Policy      : Gtk_Spin_Button_Update_Policy); 
  327.    --  Sets the update behavior of a spin button. This determines whether the 
  328.    --  spin button is always updated or only when a valid value is set. 
  329.    --  "policy": a Gtk.Spin_Button.Gtk_Spin_Button_Update_Policy value 
  330.  
  331.    function Get_Value 
  332.       (Spin_Button : not null access Gtk_Spin_Button_Record) return Gdouble; 
  333.    --  Get the value in the Spin_Button. 
  334.  
  335.    procedure Set_Value 
  336.       (Spin_Button : not null access Gtk_Spin_Button_Record; 
  337.        Value       : Gdouble); 
  338.    --  Sets the value of Spin_Button. 
  339.    --  "value": the new value 
  340.  
  341.    function Get_Value_As_Int 
  342.       (Spin_Button : not null access Gtk_Spin_Button_Record) return Gint; 
  343.    --  Get the value Spin_Button represented as an integer. 
  344.  
  345.    function Get_Wrap 
  346.       (Spin_Button : not null access Gtk_Spin_Button_Record) return Boolean; 
  347.    --  Returns whether the spin button's value wraps around to the opposite 
  348.    --  limit when the upper or lower limit of the range is exceeded. See 
  349.    --  Gtk.Spin_Button.Set_Wrap. 
  350.  
  351.    procedure Set_Wrap 
  352.       (Spin_Button : not null access Gtk_Spin_Button_Record; 
  353.        Wrap        : Boolean); 
  354.    --  Sets the flag that determines if a spin button value wraps around to 
  355.    --  the opposite limit when the upper or lower limit of the range is 
  356.    --  exceeded. 
  357.    --  "wrap": a flag indicating if wrapping behavior is performed 
  358.  
  359.    procedure Spin 
  360.       (Spin_Button : not null access Gtk_Spin_Button_Record; 
  361.        Direction   : Gtk_Spin_Type; 
  362.        Increment   : Gdouble); 
  363.    --  Increment or decrement a spin button's value in a specified direction 
  364.    --  by a specified amount. 
  365.    --  "direction": a Gtk.Spin_Button.Gtk_Spin_Type indicating the direction 
  366.    --  to spin 
  367.    --  "increment": step increment to apply in the specified direction 
  368.  
  369.    procedure Update (Spin_Button : not null access Gtk_Spin_Button_Record); 
  370.    --  Manually force an update of the spin button. 
  371.  
  372.    --------------------------------------------- 
  373.    -- Inherited subprograms (from interfaces) -- 
  374.    --------------------------------------------- 
  375.    --  Methods inherited from the Buildable interface are not duplicated here 
  376.    --  since they are meant to be used by tools, mostly. If you need to call 
  377.    --  them, use an explicit cast through the "-" operator below. 
  378.  
  379.    procedure Editing_Done 
  380.       (Cell_Editable : not null access Gtk_Spin_Button_Record); 
  381.  
  382.    procedure Remove_Widget 
  383.       (Cell_Editable : not null access Gtk_Spin_Button_Record); 
  384.  
  385.    procedure Start_Editing 
  386.       (Cell_Editable : not null access Gtk_Spin_Button_Record; 
  387.        Event         : Gdk.Event.Gdk_Event); 
  388.  
  389.    procedure Copy_Clipboard 
  390.       (Editable : not null access Gtk_Spin_Button_Record); 
  391.  
  392.    procedure Cut_Clipboard 
  393.       (Editable : not null access Gtk_Spin_Button_Record); 
  394.  
  395.    procedure Delete_Selection 
  396.       (Editable : not null access Gtk_Spin_Button_Record); 
  397.  
  398.    procedure Delete_Text 
  399.       (Editable  : not null access Gtk_Spin_Button_Record; 
  400.        Start_Pos : Gint; 
  401.        End_Pos   : Gint := -1); 
  402.  
  403.    function Get_Chars 
  404.       (Editable  : not null access Gtk_Spin_Button_Record; 
  405.        Start_Pos : Gint; 
  406.        End_Pos   : Gint := -1) return UTF8_String; 
  407.  
  408.    function Get_Editable 
  409.       (Editable : not null access Gtk_Spin_Button_Record) return Boolean; 
  410.  
  411.    procedure Set_Editable 
  412.       (Editable    : not null access Gtk_Spin_Button_Record; 
  413.        Is_Editable : Boolean); 
  414.  
  415.    function Get_Position 
  416.       (Editable : not null access Gtk_Spin_Button_Record) return Gint; 
  417.  
  418.    procedure Set_Position 
  419.       (Editable : not null access Gtk_Spin_Button_Record; 
  420.        Position : Gint); 
  421.  
  422.    procedure Get_Selection_Bounds 
  423.       (Editable      : not null access Gtk_Spin_Button_Record; 
  424.        Start_Pos     : out Gint; 
  425.        End_Pos       : out Gint; 
  426.        Has_Selection : out Boolean); 
  427.  
  428.    procedure Insert_Text 
  429.       (Editable        : not null access Gtk_Spin_Button_Record; 
  430.        New_Text        : UTF8_String; 
  431.        New_Text_Length : Gint; 
  432.        Position        : in out Gint); 
  433.  
  434.    procedure Paste_Clipboard 
  435.       (Editable : not null access Gtk_Spin_Button_Record); 
  436.  
  437.    procedure Select_Region 
  438.       (Editable  : not null access Gtk_Spin_Button_Record; 
  439.        Start_Pos : Gint; 
  440.        End_Pos   : Gint := -1); 
  441.  
  442.    function Get_Orientation 
  443.       (Self : not null access Gtk_Spin_Button_Record) 
  444.        return Gtk.Enums.Gtk_Orientation; 
  445.  
  446.    procedure Set_Orientation 
  447.       (Self        : not null access Gtk_Spin_Button_Record; 
  448.        Orientation : Gtk.Enums.Gtk_Orientation); 
  449.  
  450.    ---------------- 
  451.    -- Properties -- 
  452.    ---------------- 
  453.    --  The following properties are defined for this widget. See 
  454.    --  Glib.Properties for more information on properties) 
  455.  
  456.    Adjustment_Property : constant Glib.Properties.Property_Object; 
  457.    --  Type: Gtk.Adjustment.Gtk_Adjustment 
  458.  
  459.    Climb_Rate_Property : constant Glib.Properties.Property_Double; 
  460.    --  Type: Gdouble 
  461.  
  462.    The_Digits_Property : constant Glib.Properties.Property_Uint; 
  463.  
  464.    Numeric_Property : constant Glib.Properties.Property_Boolean; 
  465.  
  466.    Snap_To_Ticks_Property : constant Glib.Properties.Property_Boolean; 
  467.  
  468.    Update_Policy_Property : constant Gtk.Spin_Button.Property_Gtk_Spin_Button_Update_Policy; 
  469.    --  Type: Gtk_Spin_Button_Update_Policy 
  470.  
  471.    Value_Property : constant Glib.Properties.Property_Double; 
  472.    --  Type: Gdouble 
  473.  
  474.    Wrap_Property : constant Glib.Properties.Property_Boolean; 
  475.  
  476.    ------------- 
  477.    -- Signals -- 
  478.    ------------- 
  479.  
  480.    type Cb_Gtk_Spin_Button_Gtk_Scroll_Type_Void is not null access procedure 
  481.      (Self   : access Gtk_Spin_Button_Record'Class; 
  482.       Object : Gtk.Enums.Gtk_Scroll_Type); 
  483.  
  484.    type Cb_GObject_Gtk_Scroll_Type_Void is not null access procedure 
  485.      (Self   : access Glib.Object.GObject_Record'Class; 
  486.       Object : Gtk.Enums.Gtk_Scroll_Type); 
  487.  
  488.    Signal_Change_Value : constant Glib.Signal_Name := "change-value"; 
  489.    procedure On_Change_Value 
  490.       (Self  : not null access Gtk_Spin_Button_Record; 
  491.        Call  : Cb_Gtk_Spin_Button_Gtk_Scroll_Type_Void; 
  492.        After : Boolean := False); 
  493.    procedure On_Change_Value 
  494.       (Self  : not null access Gtk_Spin_Button_Record; 
  495.        Call  : Cb_GObject_Gtk_Scroll_Type_Void; 
  496.        Slot  : not null access Glib.Object.GObject_Record'Class; 
  497.        After : Boolean := False); 
  498.  
  499.    type Cb_Gtk_Spin_Button_Gdouble_Gint is not null access function 
  500.      (Self      : access Gtk_Spin_Button_Record'Class; 
  501.       New_Value : access Gdouble) return Gint; 
  502.  
  503.    type Cb_GObject_Gdouble_Gint is not null access function 
  504.      (Self      : access Glib.Object.GObject_Record'Class; 
  505.       New_Value : access Gdouble) return Gint; 
  506.  
  507.    Signal_Input : constant Glib.Signal_Name := "input"; 
  508.    procedure On_Input 
  509.       (Self  : not null access Gtk_Spin_Button_Record; 
  510.        Call  : Cb_Gtk_Spin_Button_Gdouble_Gint; 
  511.        After : Boolean := False); 
  512.    procedure On_Input 
  513.       (Self  : not null access Gtk_Spin_Button_Record; 
  514.        Call  : Cb_GObject_Gdouble_Gint; 
  515.        Slot  : not null access Glib.Object.GObject_Record'Class; 
  516.        After : Boolean := False); 
  517.    --  The ::input signal can be used to influence the conversion of the users 
  518.    --  input into a double value. The signal handler is expected to use 
  519.    --  Gtk.GEntry.Get_Text to retrieve the text of the entry and set New_Value 
  520.    --  to the new value. 
  521.    -- 
  522.    --  The default conversion uses g_strtod. 
  523.    --  
  524.    --  Callback parameters: 
  525.    --    --  "new_value": return location for the new value 
  526.    --    --  Returns True for a successful conversion, False if the input was not handled, and GTK_INPUT_ERROR if the conversion failed. 
  527.  
  528.    type Cb_Gtk_Spin_Button_Boolean is not null access function 
  529.      (Self : access Gtk_Spin_Button_Record'Class) return Boolean; 
  530.  
  531.    type Cb_GObject_Boolean is not null access function 
  532.      (Self : access Glib.Object.GObject_Record'Class) 
  533.    return Boolean; 
  534.  
  535.    Signal_Output : constant Glib.Signal_Name := "output"; 
  536.    procedure On_Output 
  537.       (Self  : not null access Gtk_Spin_Button_Record; 
  538.        Call  : Cb_Gtk_Spin_Button_Boolean; 
  539.        After : Boolean := False); 
  540.    procedure On_Output 
  541.       (Self  : not null access Gtk_Spin_Button_Record; 
  542.        Call  : Cb_GObject_Boolean; 
  543.        Slot  : not null access Glib.Object.GObject_Record'Class; 
  544.        After : Boolean := False); 
  545.    --  The ::output signal can be used to change to formatting of the value 
  546.    --  that is displayed in the spin buttons entry. |[ /* show leading zeros */ 
  547.    --  static gboolean on_output (GtkSpinButton *spin, gpointer data) { 
  548.    --  GtkAdjustment *adjustment; gchar *text; int value; 
  549.    -- 
  550.    --  adjustment = gtk_spin_button_get_adjustment (spin); value = 
  551.    --  (int)gtk_adjustment_get_value (adjustment); text = g_strdup_printf 
  552.    --  ("%02d", value); gtk_entry_set_text (GTK_ENTRY (spin), text); g_free 
  553.    --  (text); 
  554.    -- 
  555.    --  return TRUE; } ]| 
  556.    --  
  557.    --  Callback parameters: 
  558.    --    --  Returns True if the value has been displayed 
  559.  
  560.    type Cb_Gtk_Spin_Button_Void is not null access procedure 
  561.      (Self : access Gtk_Spin_Button_Record'Class); 
  562.  
  563.    type Cb_GObject_Void is not null access procedure 
  564.      (Self : access Glib.Object.GObject_Record'Class); 
  565.  
  566.    Signal_Value_Changed : constant Glib.Signal_Name := "value-changed"; 
  567.    procedure On_Value_Changed 
  568.       (Self  : not null access Gtk_Spin_Button_Record; 
  569.        Call  : Cb_Gtk_Spin_Button_Void; 
  570.        After : Boolean := False); 
  571.    procedure On_Value_Changed 
  572.       (Self  : not null access Gtk_Spin_Button_Record; 
  573.        Call  : Cb_GObject_Void; 
  574.        Slot  : not null access Glib.Object.GObject_Record'Class; 
  575.        After : Boolean := False); 
  576.  
  577.    Signal_Wrapped : constant Glib.Signal_Name := "wrapped"; 
  578.    procedure On_Wrapped 
  579.       (Self  : not null access Gtk_Spin_Button_Record; 
  580.        Call  : Cb_Gtk_Spin_Button_Void; 
  581.        After : Boolean := False); 
  582.    procedure On_Wrapped 
  583.       (Self  : not null access Gtk_Spin_Button_Record; 
  584.        Call  : Cb_GObject_Void; 
  585.        Slot  : not null access Glib.Object.GObject_Record'Class; 
  586.        After : Boolean := False); 
  587.    --  The wrapped signal is emitted right after the spinbutton wraps from its 
  588.    --  maximum to minimum value or vice-versa. 
  589.  
  590.    ---------------- 
  591.    -- Interfaces -- 
  592.    ---------------- 
  593.    --  This class implements several interfaces. See Glib.Types 
  594.    -- 
  595.    --  - "Buildable" 
  596.    -- 
  597.    --  - "CellEditable" 
  598.    -- 
  599.    --  - "Editable" 
  600.    -- 
  601.    --  - "Orientable" 
  602.  
  603.    package Implements_Gtk_Buildable is new Glib.Types.Implements 
  604.      (Gtk.Buildable.Gtk_Buildable, Gtk_Spin_Button_Record, Gtk_Spin_Button); 
  605.    function "+" 
  606.      (Widget : access Gtk_Spin_Button_Record'Class) 
  607.    return Gtk.Buildable.Gtk_Buildable 
  608.    renames Implements_Gtk_Buildable.To_Interface; 
  609.    function "-" 
  610.      (Interf : Gtk.Buildable.Gtk_Buildable) 
  611.    return Gtk_Spin_Button 
  612.    renames Implements_Gtk_Buildable.To_Object; 
  613.  
  614.    package Implements_Gtk_Cell_Editable is new Glib.Types.Implements 
  615.      (Gtk.Cell_Editable.Gtk_Cell_Editable, Gtk_Spin_Button_Record, Gtk_Spin_Button); 
  616.    function "+" 
  617.      (Widget : access Gtk_Spin_Button_Record'Class) 
  618.    return Gtk.Cell_Editable.Gtk_Cell_Editable 
  619.    renames Implements_Gtk_Cell_Editable.To_Interface; 
  620.    function "-" 
  621.      (Interf : Gtk.Cell_Editable.Gtk_Cell_Editable) 
  622.    return Gtk_Spin_Button 
  623.    renames Implements_Gtk_Cell_Editable.To_Object; 
  624.  
  625.    package Implements_Gtk_Editable is new Glib.Types.Implements 
  626.      (Gtk.Editable.Gtk_Editable, Gtk_Spin_Button_Record, Gtk_Spin_Button); 
  627.    function "+" 
  628.      (Widget : access Gtk_Spin_Button_Record'Class) 
  629.    return Gtk.Editable.Gtk_Editable 
  630.    renames Implements_Gtk_Editable.To_Interface; 
  631.    function "-" 
  632.      (Interf : Gtk.Editable.Gtk_Editable) 
  633.    return Gtk_Spin_Button 
  634.    renames Implements_Gtk_Editable.To_Object; 
  635.  
  636.    package Implements_Gtk_Orientable is new Glib.Types.Implements 
  637.      (Gtk.Orientable.Gtk_Orientable, Gtk_Spin_Button_Record, Gtk_Spin_Button); 
  638.    function "+" 
  639.      (Widget : access Gtk_Spin_Button_Record'Class) 
  640.    return Gtk.Orientable.Gtk_Orientable 
  641.    renames Implements_Gtk_Orientable.To_Interface; 
  642.    function "-" 
  643.      (Interf : Gtk.Orientable.Gtk_Orientable) 
  644.    return Gtk_Spin_Button 
  645.    renames Implements_Gtk_Orientable.To_Object; 
  646.  
  647. private 
  648.    Wrap_Property : constant Glib.Properties.Property_Boolean := 
  649.      Glib.Properties.Build ("wrap"); 
  650.    Value_Property : constant Glib.Properties.Property_Double := 
  651.      Glib.Properties.Build ("value"); 
  652.    Update_Policy_Property : constant Gtk.Spin_Button.Property_Gtk_Spin_Button_Update_Policy := 
  653.      Gtk.Spin_Button.Build ("update-policy"); 
  654.    Snap_To_Ticks_Property : constant Glib.Properties.Property_Boolean := 
  655.      Glib.Properties.Build ("snap-to-ticks"); 
  656.    Numeric_Property : constant Glib.Properties.Property_Boolean := 
  657.      Glib.Properties.Build ("numeric"); 
  658.    The_Digits_Property : constant Glib.Properties.Property_Uint := 
  659.      Glib.Properties.Build ("digits"); 
  660.    Climb_Rate_Property : constant Glib.Properties.Property_Double := 
  661.      Glib.Properties.Build ("climb-rate"); 
  662.    Adjustment_Property : constant Glib.Properties.Property_Object := 
  663.      Glib.Properties.Build ("adjustment"); 
  664. end Gtk.Spin_Button;