## Documentation

Table of Contents
Class Inheritance Tree
Widget Screenshots
Package groups

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-2007 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.     -----------------------------------------------------------------------

30.     --  <description>

31.     --  A Gtk_Color_Selection widget is a complex dialog that allows the user

32.     --  to select a color based either on its (Red, Green, Blue) or its

33.     --  (Hue, Saturation, Value).

34.     --  An additional field is provided to select the opacity of the color (this

35.     --  is usually called the alpha channel).

36.     --

37.     --  See Gtk.Color_Selection_Dialog for a version of this widget that comes with

38.     --  its own dialog.

39.     --

40.     --  See Gtk.Extra.Color_Combo for a different way to select colors.

41.     --  </description>

42.     --  <c_version>2.8.17</c_version>

43.     --  <group>Drawing</group>

44.     --  <testgtk>create_color_selection.adb</testgtk>

45.     --  <screenshot>gtk-colorsel</screenshot>

47.     with Glib.PropertiesTo API docTo specTo body;

48.     with Gdk.ColorTo API docTo specTo body;

49.     with Gtk.EnumsTo API docTo specTo body;

50.     with Gtk.BoxTo API docTo specTo body;

52.     package Gtk.Color_SelectionTo API docTo specTo body is

54.        type Gtk_Color_Selection_RecordTo API docTo body is new Gtk.Box.Gtk_Box_RecordTo API docTo spec with private;

55.        type Gtk_Color_Selection is access all Gtk_Color_Selection_RecordTo API docTo specTo body'Class;

57.        type Color_Index is (Red, Green, Blue, Opacity);

58.        --  Used as an index to the table used to set and get the currently

59.        --  selected color.

61.        type Color_Array is array (Color_IndexTo API docTo spec) of GdoubleTo API docTo spec;

62.        --  Array that indicates the currently selected color.

63.        --  All the values are between 0.0 and 1.0 (a percentage value).

64.        --  They should be converted to absolute values before using them to create

65.        --  a new color, with the following piece of code:

66.        --    Absolute := To_Absolute (Color_Array (Index))

68.        procedure Gtk_NewTo API docTo body (Widget : out Gtk_Color_SelectionTo API docTo spec);

69.        procedure InitializeTo API docTo body (Widget : access Gtk_Color_Selection_RecordTo API docTo specTo body'Class);

70.        --  Creates or initiailizes a new color selection widget.

72.        function Get_TypeTo API docTo body return Glib.GTypeTo API docTo spec;

73.        --  Return the internal value associated with a Gtk_Color_Selection.

75.        procedure Set_Current_ColorTo API docTo body

76.          (Colorsel : access Gtk_Color_Selection_RecordTo API docTo specTo body;

77.           ColorTo API docTo body    : Gdk.Color.Gdk_ColorTo API docTo specTo body);

78.        procedure Get_Current_ColorTo API docTo body

79.          (Colorsel : access Gtk_Color_Selection_RecordTo API docTo specTo body;

80.           ColorTo API docTo body    : out Gdk.Color.Gdk_ColorTo API docTo specTo body);

81.        --  Set the current color of the Colorsel. When called for the first time,

82.        --  the original color will the set to Color as well.

84.        procedure Set_Previous_ColorTo API docTo body

85.          (Colorsel : access Gtk_Color_Selection_RecordTo API docTo specTo body;

86.           ColorTo API docTo body    : Gdk.Color.Gdk_ColorTo API docTo specTo body);

87.        procedure Get_Previous_ColorTo API docTo body

88.          (Colorsel : access Gtk_Color_Selection_RecordTo API docTo specTo body;

89.           ColorTo API docTo body    : out Gdk.Color.Gdk_ColorTo API docTo specTo body);

90.        --  Set the previous color. This procedure should not be called without

91.        --  analysis, as it might seem confusing to see that color change.

92.        --  Calling Set_Current_Color for the first time will also set this

93.        --  color.

95.        function Is_AdjustingTo API docTo body

96.           (Colorsel : access Gtk_Color_Selection_RecordTo API docTo specTo body) return Boolean;

97.        --  Get the current state of the Colorsel.

98.        --  Return TRue if the user is currently dragging a color around, False if

99.        --  the selection has stopped.

101.        function To_AbsoluteTo API docTo body (Color : GdoubleTo API docTo spec) return GushortTo API docTo spec;

102.        --  Convert from a percentage value as returned by Get_Color to an

103.        --  absolute value as can be used with Gdk_Color.

105.        function To_PercentTo API docTo body (Color : GushortTo API docTo spec) return GdoubleTo API docTo spec;

106.        --  Convert from an absolute value as used in Gdk_Color to a percentage

107.        --  value as used in Set_Color.

109.        -------------

110.        -- Opacity --

111.        -------------

112.        --  The color selection widget allows you optionally to select the opacity

113.        --  of the color

115.        procedure Set_Has_Opacity_ControlTo API docTo body

116.          (Colorsel    : access Gtk_Color_Selection_RecordTo API docTo specTo body;

117.           Has_Opacity : Boolean);

118.        function Get_Has_Opacity_ControlTo API docTo body

119.          (Colorsel : access Gtk_Color_Selection_RecordTo API docTo specTo body) return Boolean;

120.        --  Set the Colorsel to use or not use opacity. An additional field is

121.        --  displayed to select the opacity if needed.

123.        procedure Set_Previous_AlphaTo API docTo body

124.          (Colorsel : access Gtk_Color_Selection_RecordTo API docTo specTo body;

125.           Alpha    : Guint16To API docTo spec);

126.        function Get_Previous_AlphaTo API docTo body

127.          (Colorsel : access Gtk_Color_Selection_RecordTo API docTo specTo body) return Guint16To API docTo spec;

128.        --  Set the previous opacity to Alpha. This procedure should not be called

129.        --  without analysis, as it might seem confusing to see that value change.

131.        procedure Set_Current_AlphaTo API docTo body

132.          (Colorsel : access Gtk_Color_Selection_RecordTo API docTo specTo body;

133.           Alpha    : Guint16To API docTo spec);

134.        function Get_Current_AlphaTo API docTo body

135.          (Colorsel : access Gtk_Color_Selection_RecordTo API docTo specTo body) return Guint16To API docTo spec;

136.        --  Set the current opacity to be Alpha. When called for the first time,

137.        --  the original opacity will be set too.

139.        -------------

140.        -- Palette --

141.        -------------

142.        --  The color selection widget can optionally display a palette, which the

143.        --  user can change dynamically. This palette helps selecting colors for the

144.        --  user, who can chose faster among a limited set of colors.

146.        procedure Set_Has_PaletteTo API docTo body

147.          (Colorsel    : access Gtk_Color_Selection_RecordTo API docTo specTo body;

148.           Has_Palette : Boolean);

149.        function Get_Has_PaletteTo API docTo body

150.          (Colorsel : access Gtk_Color_Selection_RecordTo API docTo specTo body) return Boolean;

151.        --  If Has_Palette is True, then set the Colorsel to show the palette.

152.        --  Hide the palette otherwise.

154.        function Palette_From_StringTo API docTo body

155.          (Str : String) return Gdk.Color.Gdk_Color_ArrayTo API docTo spec;

156.        --  Parses a color palette string; this string is a colon-separated list of

157.        --  color names readable by Gdk.Color.Parse.

158.        --  An empty array is returned if Str couldn't be parsed

160.        function Palette_To_StringTo API docTo body

161.          (Colors   : Gdk.Color.Gdk_Color_ArrayTo API docTo spec) return String;

162.        --  Encodes a palette as a string, useful for persistent storage.

164.        type Gtk_Color_Selection_Change_Palette_With_Screen_Func is access

165.          procedure (Screen : Gdk.Gdk_ScreenTo API docTo spec;

166.                     Colors : Gdk.Color.Gdk_Color_ArrayTo API docTo spec);

167.        --  This function should save the new palette contents, and update the

168.        --  Gtk_Settings property "gtk-color-palette" so all Gtk_Color_Selection

169.        --  widgets will be modified, including the current one. For instance, you

170.        --  would do:

171.        --    Set_String_Property

172.        --      (Get_Default, Gtk_Color_Palette, Palette_To_String (Colors), "Foo");

174.        function Set_Change_Palette_With_Screen_HookTo API docTo body

175.          (Func : Gtk_Color_Selection_Change_Palette_With_Screen_FuncTo API docTo spec)

176.           return Gtk_Color_Selection_Change_Palette_With_Screen_FuncTo API docTo spec;

177.        --  Installs a global function to be called whenever the user tries to

178.        --  modify the palette in a color selection.

179.        --  Return value: the previous change palette hook (that was replaced).

181.        -----------------

182.        -- Obsolescent --

183.        -----------------

184.        --  All subprograms below are now obsolescent in gtk+. They might be removed

185.        --  from future versions of gtk+ (and therefore GtkAda).

186.        --  To find out whether your code uses any of these, we recommend compiling

187.        --  with the -gnatwj switch

188.        --  <doc_ignore>

190.        procedure Set_Update_PolicyTo API docTo body

191.          (Colorsel : access Gtk_Color_Selection_RecordTo API docTo specTo body;

192.           PolicyTo API docTo body   : Enums.Gtk_Update_TypeTo API docTo spec);

193.        pragma Obsolescent;  --  Set_Update_Policy

194.        --  Set the behavior of the scales used to select a value (red, green,...)

195.        --  Set Policy to Update_Continuous if you want to update the color

196.        --  continuously as the slider is mode, Update_Discontinuous to update the

197.        --  color only when the mouse is released and Update_Delayed to update when

198.        --  the mouse is released or has been motionless for a while.

200.        procedure Set_ColorTo API docTo body

201.          (Colorsel : access Gtk_Color_Selection_RecordTo API docTo specTo body;

202.           Color    : Color_ArrayTo API docTo spec);

203.        pragma Obsolescent ("Use Set_Current_Color");  --  Set_Color

204.        --  Modify the current color.

205.        --  Note that Color is an array of percentages, between 0.0 and 1.0, not

206.        --  absolute values.

208.        procedure Get_ColorTo API docTo body

209.          (Colorsel : access Gtk_Color_Selection_RecordTo API docTo specTo body;

210.           Color    : out Color_ArrayTo API docTo spec);

211.        pragma Obsolescent ("Use Get_Current_Color");  --  Get_Color

212.        --  Get the current color.

213.        --  Note that Color is an array of percentages, between 0.0 and 1.0, not

214.        --  absolute values.

216.        --  </doc_ignore>

218.        ----------------

219.        -- Properties --

220.        ----------------

222.        --  <properties>

223.        --  The following properties are defined for this widget. See

224.        --  Glib.Properties for more information on properties.

225.        --

226.        --  Name:  Current_Alpha_Property

227.        --  Type:  Uint

228.        --  Descr: The current opacity value (0 fully transparent, 65535 fully

229.        --         opaque)

230.        --

231.        --  Name:  Current_Color_Property

232.        --  Type:  Boxed

233.        --  Descr: The current color

234.        --

235.        --  Name:  Has_Opacity_Control_Property

236.        --  Type:  Boolean

237.        --  Descr: Whether the color selector should allow setting opacity

238.        --

239.        --  Name:  Has_Palette_Property

240.        --  Type:  Boolean

241.        --  Descr: Whether a palette should be used

242.        --

243.        --  </properties>

245.        Current_Alpha_Property       : constant Glib.Properties.Property_UintTo API docTo spec;

246.        --  Current_Color_Property       : constant Glib.Properties.Property_Boxed;

247.        Has_Opacity_Control_Property : constant Glib.Properties.Property_BooleanTo API docTo spec;

248.        Has_Palette_Property         : constant Glib.Properties.Property_BooleanTo API docTo spec;

250.        -------------

251.        -- Signals --

252.        -------------

254.        --  <signals>

255.        --  The following new signals are defined for this widget:

256.        --

257.        --  - "color_changed"

258.        --    procedure Handler

259.        --       (Selection : access Gtk_Color_Selection_Record'Class);

260.        --    Called every time a new color is selected in the dialog

261.        --  </signals>

263.        Signal_Color_Changed : constant Glib.Signal_NameTo API docTo spec := "color_changed";

265.     private

266.        type Gtk_Color_Selection_RecordTo API docTo spec is new Gtk.Box.Gtk_Box_RecordTo API docTo spec

267.          with null record;

269.        Current_Alpha_PropertyTo API docTo spec : constant Glib.Properties.Property_UintTo API docTo spec :=

270.          Glib.Properties.BuildTo API docTo specTo body ("current-alpha");

271.        --  Current_Color_Property : constant Glib.Properties.Property_Boxed :=

272.        --    Glib.Properties.Build ("current-color");

273.        Has_Opacity_Control_PropertyTo API docTo spec : constant Glib.Properties.Property_BooleanTo API docTo spec :=

274.          Glib.Properties.BuildTo API docTo specTo body ("has-opacity-control");

275.        Has_Palette_PropertyTo API docTo spec : constant Glib.Properties.Property_BooleanTo API docTo spec :=

276.          Glib.Properties.BuildTo API docTo specTo body ("has-palette");

278.        pragma Import (C, Get_TypeTo API docTo spec, "gtk_color_selection_get_type");

279.     end Gtk.Color_SelectionTo API docTo specTo body;

281.     --  These subprograms never had a binding and are now obsolescent:

282.     --  No binding: gtk_color_selection_set_change_palette_hook