## Documentation

Table of Contents
Class Inheritance Tree
Widget Screenshots
Package groups

1.     -----------------------------------------------------------------------

2.     --               GtkAda - Ada95 binding for Gtk+/Gnome               --

3.     --                                                                   --

4.     --      Copyright (C) 2000 E. Briot, J. Brobecker and A. Charlet     --

5.     --                Copyright (C) 2000-2006 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_Combo is a widget that ease the selection of colors

32.     --  by the user. It is a special form of a Gtk_Combo_Box, that displays

33.     --  a special popup window, with a list of colors.

34.     --

35.     --  Note that nothing appears in the button, this your responsibility to

36.     --  update it when the user selects a new color (see the "changed" signal).

37.     --

38.     --  The recommended solution is to put a Gtk_Pixmap as the

39.     --  child of the button of the combo box ("Add (Get_Button (Combo), Pixmap)"),

40.     --  and updated it in the handler for this signal.

41.     --  </description>

42.     --  <c_version>gtkextra 2.1.1</c_version>

43.     --  <group>Selectors</group>

45.     with Gdk.ColorTo API docTo specTo body;

46.     with Gtk.Extra.Combo_ButtonTo API docTo specTo body;

48.     package Gtk.Extra.Color_ComboTo API docTo specTo body is

50.        type Gtk_Color_Combo_RecordTo API docTo body is

51.          new Gtk.Extra.Combo_Button.Gtk_Combo_Button_RecordTo API docTo specTo body with private;

52.        type Gtk_Color_Combo is access all Gtk_Color_Combo_RecordTo API docTo specTo body'Class;

54.        procedure Gtk_NewTo API docTo body (Widget : out Gtk_Color_ComboTo API docTo spec);

55.        --  Create a new default combo box.

56.        --  It shows a list of 40 default colors.

58.        procedure InitializeTo API docTo body (Widget : access Gtk_Color_Combo_RecordTo API docTo specTo body'Class);

59.        --  Internal initialization function.

60.        --  See the section "Creating your own widgets" in the documentation.

62.        procedure Gtk_NewTo API docTo body

63.          (Widget : out Gtk_Color_ComboTo API docTo spec;

64.           Nrows  : GintTo API docTo spec;

65.           Ncols  : GintTo API docTo spec;

66.           Values : Gdk.Color.Gdk_Color_ArrayTo API docTo spec);

67.        --  Create a new combo box with a specific list of colors.

68.        --  Note that Color_Names must contain at least Nrows * Ncols elements.

70.        procedure InitializeTo API docTo body

71.          (Widget : access Gtk_Color_Combo_RecordTo API docTo specTo body;

72.           Nrows  : GintTo API docTo spec;

73.           Ncols  : GintTo API docTo spec;

74.           Values : Gdk.Color.Gdk_Color_ArrayTo API docTo spec);

75.        --  Internal initialization function.

76.        --  See the section "Creating your own widgets" in the documentation.

78.        function Get_TypeTo API docTo body return Gtk.Gtk_TypeTo API docTo spec;

79.        --  Return the internal value associated with a Gtk_Color_Combo.

81.        function Get_Color_AtTo API docTo body

82.          (Widget : access Gtk_Color_Combo_RecordTo API docTo specTo body;

83.           Row    : GintTo API docTo spec;

84.           Col    : GintTo API docTo spec) return Gdk.Color.Gdk_ColorTo API docTo specTo body;

85.        --  Return the name of the color at specific coordinates.

87.        procedure Find_ColorTo API docTo body

88.          (Color_Combo : access Gtk_Color_Combo_RecordTo API docTo specTo body;

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

90.           Row         : out GintTo API docTo spec;

91.           Col         : out GintTo API docTo spec);

92.        --  Return the coordinates in which a color appear in the popup window.

93.        --  (-1, -1) is returned if the color was not found in the combo box.

95.        function Get_SelectionTo API docTo body (Color_Combo : access Gtk_Color_Combo_RecordTo API docTo specTo body)

96.           return Gdk.Color.Gdk_ColorTo API docTo specTo body;

97.        --  Return the current selection in the combo.

99.        function Set_ColorTo API docTo body

100.          (Color_Combo : access Gtk_Color_Combo_RecordTo API docTo specTo body;

101.           Name        : String)

102.          return Boolean;

103.        --  Set the new current color. If the color is not found in the list of

104.        --  colors provided in the popup window, False is returned.

106.        function Set_ColorTo API docTo body

107.          (Color_Combo : access Gtk_Color_Combo_RecordTo API docTo specTo body;

108.           ColorTo API docTo body       : Gdk.Color.Gdk_ColorTo API docTo specTo body)

109.          return Boolean;

110.        --  Set the new current color. Color must have been allocated first.  If the

111.        --  color is not found in the list of colors provided in the popup window,

112.        --  False is returned.

114.        function Get_NcolsTo API docTo body (Color_Combo : access Gtk_Color_Combo_RecordTo API docTo specTo body)

115.           return GintTo API docTo spec;

116.        --  Return the number of columns in the popup window

118.        function Get_NrowsTo API docTo body (Color_Combo : access Gtk_Color_Combo_RecordTo API docTo specTo body)

119.           return GintTo API docTo spec;

120.        --  Return the number of rows in the popup window

122.        procedure ChangedTo API docTo body

123.          (Color_Combo : access Gtk_Color_Combo_RecordTo API docTo specTo body;

124.           Row : GintTo API docTo spec;

125.           Col : GintTo API docTo spec);

126.        --  Emit the changed signal for the widget, as if the color at coordinates

127.        --  (Row, Col) had been selected.

128.        --  Note that this doesn't change the internal state of the widget (use

129.        --  Set_Color for that).

131.        -------------

132.        -- Signals --

133.        -------------

135.        --  <signals>

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

137.        --

138.        --  - "changed"

139.        --  procedure Handler (Color_Combo : access Gtk_Color_Combo_Record'Class;

140.        --                     Selection   : Gint;

141.        --                     Color       : access Gdk.Color.Gdk_Color);

142.        --

143.        --  Emitted when the color has selected a new color.

144.        --  Selection is the number of the selection (this is the total

145.        --  row * Ncols + col). Color_Name is the name of the selected color.

146.        --  </signals>

148.     private

149.        type Gtk_Color_Combo_RecordTo API docTo spec is

150.          new Gtk.Extra.Combo_Button.Gtk_Combo_Button_RecordTo API docTo specTo body with null record;

151.        pragma Import (C, Get_TypeTo API docTo spec, "gtk_color_combo_get_type");

152.     end Gtk.Extra.Color_ComboTo API docTo specTo body;