1----------------------------------------------------------------------- 2-- GtkAda - Ada95 binding for Gtk+/Gnome -- 3-- -- 4-- Copyright (C) 1998-2000 E. Briot, J. Brobecker and A. Charlet -- 5-- Copyright (C) 2000-2013, AdaCore -- 6-- -- 7-- This library is free software; you can redistribute it and/or -- 8-- modify it under the terms of the GNU General Public -- 9-- License as published by the Free Software Foundation; either -- 10-- version 2 of the License, or (at your option) any later version. -- 11-- -- 12-- This library is distributed in the hope that it will be useful, -- 13-- but WITHOUT ANY WARRANTY; without even the implied warranty of -- 14-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -- 15-- General Public License for more details. -- 16-- -- 17-- You should have received a copy of the GNU General Public -- 18-- License along with this library; if not, write to the -- 19-- Free Software Foundation, Inc., 59 Temple Place - Suite 330, -- 20-- Boston, MA 02111-1307, USA. -- 21-- -- 22-- As a special exception, if other files instantiate generics from -- 23-- this unit, or you link this unit with other files to produce an -- 24-- executable, this unit does not by itself cause the resulting -- 25-- executable to be covered by the GNU General Public License. This -- 26-- exception does not however invalidate any other reasons why the -- 27-- executable file might be covered by the GNU Public License. -- 28----------------------------------------------------------------------- 29 30-- <description> 31-- The Gtk_Curve widget allows the user to edit a curve covering a range of 32-- values. It is typically used to fine-tune color balances in graphics 33-- applications like the Gimp. 34-- 35-- The Gtk_Curve widget has 3 modes of operation: spline, linear and free. In 36-- spline mode the user places points on the curve which are automatically 37-- connected together into a smooth curve. In linear mode the user places 38-- points on the curve which are connected by straight lines. In free mode the 39-- user can draw the points of the curve freely, and they are not connected at 40-- all. 41-- 42-- </description> 43-- <group>Drawing</group> 44 45pragma Warnings (Off, "*is already use-visible*"); 46with Glib; use Glib; 47with Glib.Properties; use Glib.Properties; 48with Glib.Types; use Glib.Types; 49with Gtk.Buildable; use Gtk.Buildable; 50with Gtk.Drawing_Area; use Gtk.Drawing_Area; 51with Gtk.Enums; use Gtk.Enums; 52with Gtk.Widget; use Gtk.Widget; 53 54package Gtk.Curve is 55 56 type Gtk_Curve_Record is new Gtk_Drawing_Area_Record with null record; 57 type Gtk_Curve is access all Gtk_Curve_Record'Class; 58 59 ------------------ 60 -- Constructors -- 61 ------------------ 62 63 procedure Gtk_New (Curve : out Gtk_Curve); 64 procedure Initialize (Curve : access Gtk_Curve_Record'Class); 65 66 function Get_Type return Glib.GType; 67 pragma Import (C, Get_Type, "gtk_curve_get_type"); 68 69 ------------- 70 -- Methods -- 71 ------------- 72 73 procedure Reset (Curve : access Gtk_Curve_Record); 74 -- Reset the curve. Reset to a straight line from the minimum x & y values 75 -- to the maximum x & y values (i.e. from the bottom-left to the top-right 76 -- corners). The curve type is not changed. 77 78 procedure Set_Curve_Type 79 (Curve : access Gtk_Curve_Record; 80 The_Type : Gtk.Enums.Gtk_Curve_Type); 81 -- Set the type of the curve. The curve will remain unchanged except when 82 -- changing from a free curve to a linear or spline curve, in which case 83 -- the curve will be changed as little as possible. 84 85 procedure Set_Gamma (Curve : access Gtk_Curve_Record; Gamma : Gfloat); 86 -- Recompute the entire curve using the given gamma value. A gamma value 87 -- of 1.0 results in a straight line. Values greater than 1.0 result in a 88 -- curve above the straight line. Values less than 1.0 result in a curve 89 -- below the straight line. The curve type is changed to Curve_Type_Free. 90 91 procedure Set_Range 92 (Curve : access Gtk_Curve_Record; 93 Min_X : Gfloat; 94 Max_X : Gfloat; 95 Min_Y : Gfloat; 96 Max_Y : Gfloat); 97 -- Set the minimum and maximum x & y values of the curve. The curve is 98 -- also reset with a call to Reset. 99 100 ---------------------- 101 -- GtkAda additions -- 102 ---------------------- 103 104 procedure Set_Vector 105 (Curve : access Gtk_Curve_Record; 106 Vector : Gfloat_Array); 107 procedure Get_Vector 108 (Curve : access Gtk_Curve_Record; 109 Vector : out Gfloat_Array); 110 -- Set the vector of points on the curve. 111 -- The curve type is set to Curve_Type_Free. 112 113 ---------------- 114 -- Interfaces -- 115 ---------------- 116 -- This class implements several interfaces. See Glib.Types 117 -- 118 -- - "Buildable" 119 120 package Implements_Buildable is new Glib.Types.Implements 121 (Gtk.Buildable.Gtk_Buildable, Gtk_Curve_Record, Gtk_Curve); 122 function "+" 123 (Widget : access Gtk_Curve_Record'Class) 124 return Gtk.Buildable.Gtk_Buildable 125 renames Implements_Buildable.To_Interface; 126 function "-" 127 (Interf : Gtk.Buildable.Gtk_Buildable) 128 return Gtk_Curve 129 renames Implements_Buildable.To_Object; 130 131 ---------------- 132 -- Properties -- 133 ---------------- 134 -- The following properties are defined for this widget. See 135 -- Glib.Properties for more information on properties) 136 -- 137 -- Name: Curve_Type_Property 138 -- Type: Gtk.Enums.Gtk_Curve_Type 139 -- Flags: read-write 140 -- 141 -- Name: Max_X_Property 142 -- Type: Gfloat 143 -- Flags: read-write 144 -- 145 -- Name: Max_Y_Property 146 -- Type: Gfloat 147 -- Flags: read-write 148 -- 149 -- Name: Min_X_Property 150 -- Type: Gfloat 151 -- Flags: read-write 152 -- 153 -- Name: Min_Y_Property 154 -- Type: Gfloat 155 -- Flags: read-write 156 157 Curve_Type_Property : constant Gtk.Enums.Property_Gtk_Curve_Type; 158 Max_X_Property : constant Glib.Properties.Property_Float; 159 Max_Y_Property : constant Glib.Properties.Property_Float; 160 Min_X_Property : constant Glib.Properties.Property_Float; 161 Min_Y_Property : constant Glib.Properties.Property_Float; 162 163 ------------- 164 -- Signals -- 165 ------------- 166 -- The following new signals are defined for this widget: 167 -- 168 -- "curve-type-changed" 169 -- procedure Handler (Self : access Gtk_Curve_Record'Class); 170 171 Signal_Curve_Type_Changed : constant Glib.Signal_Name := "curve-type-changed"; 172 173private 174 Curve_Type_Property : constant Gtk.Enums.Property_Gtk_Curve_Type := 175 Gtk.Enums.Build ("curve-type"); 176 Max_X_Property : constant Glib.Properties.Property_Float := 177 Glib.Properties.Build ("max-x"); 178 Max_Y_Property : constant Glib.Properties.Property_Float := 179 Glib.Properties.Build ("max-y"); 180 Min_X_Property : constant Glib.Properties.Property_Float := 181 Glib.Properties.Build ("min-x"); 182 Min_Y_Property : constant Glib.Properties.Property_Float := 183 Glib.Properties.Build ("min-y"); 184end Gtk.Curve; 185