This widget is deprecated. Use Gtk.Tree_View instead.
This widget displays a multi-column list. Each line is made of a number of column, each being able to display any kind of widget.
The intersection of a line and a column is called a Cell. Each cell can have a different type (Cell_Text, Cell_Pixmap, Cell_Pixtext), and display its contents depending on this type. For instance, the text is not displayed in the type is Cell_Pixmap. Note that this type is changed dynamically by some of the subprograms below, like Set_Pixmap, Set_Text, ... and Set_Cell_Contents
This is one of the most powerful widgets in GtkAda, that can be used to display an kind of information. Look also into using Gtk_Ctree, which is a similar widget.
You can add scrolling in a Gtk_Clist by adding it in a Gtk_Scrolled_Window.
Widget Hierarchy |
---|
GObject (see section Package Glib.Object) Gtk_Object (see section Package Gtk.Object) \___ Gtk_Widget (see section Package Gtk.Widget) \___ Gtk_Container (see section Package Gtk.Container) \___ Gtk_Clist (see section Package Gtk.Clist) |
Signals |
---|
Types |
---|
type Gtk_Button_Action is new Guint; | |
| |
type Gtk_Cell_Type is (Cell_Empty, Cell_Text, Cell_Pixmap, Cell_Pixtext, Cell_Widget); | |
| |
type Gtk_Clist_Compare_Func is access function (Clist : access Gtk_Clist_Record'Class; | |
| |
type Gtk_Clist_Row is new Gdk.C_Proxy; | |
A row of the clist.
Application-specific data can be associated with each row.
In the following subprograms, rows can also be accessed via their
number, starting from 0.
| |
type Gtk_Sort_Type is (Ascending, Descending); | |
|
Subprograms |
---|
Creating a list and setting the attributes | ||
procedure Gtk_New (Widget : out Gtk_Clist; Columns : in Gint); | ||
Create a list with Columns columns. | ||
procedure Gtk_New (Widget : out Gtk_Clist; Columns : in Gint; Titles : in Gtkada.Types.Chars_Ptr_Array); | ||
Create a new list with Columns columns. | ||
function Get_Type return Gtk.Gtk_Type; | ||
Return the internal value associated with a Gtk_Clist.
| ||
procedure Set_Hadjustment (Clist : access Gtk_Clist_Record; Adjustment : Gtk.Adjustment.Gtk_Adjustment); | ||
Set the horizontal adjustment used for the clist. | ||
procedure Set_Vadjustment (Clist : access Gtk_Clist_Record; Adjustment : Gtk.Adjustment.Gtk_Adjustment); | ||
Set the vertical adjustment used for the clist. | ||
function Get_Hadjustment (Clist : access Gtk_Clist_Record) return Gtk.Adjustment.Gtk_Adjustment; | ||
Return the horizontal adjustment used for the clist. | ||
function Get_Vadjustment (Clist : access Gtk_Clist_Record) return Gtk.Adjustment.Gtk_Adjustment; | ||
Return the vertical adjustment used for the clist. | ||
procedure Set_Selection_Mode (Clist : access Gtk_Clist_Record; Mode : in Gtk.Enums.Gtk_Selection_Mode); | ||
Modify the selection mode for the clist.
Note that changing the selection mode to Selection_Single or
Selection_Browse will deselect all the items in the clist.
| ||
function Get_Selection_Mode (Clist : access Gtk_Clist_Record) return Gtk.Enums.Gtk_Selection_Mode; | ||
Return the selection mode for the clist.
| ||
Visual aspects | ||
procedure Freeze (Clist : access Gtk_Clist_Record); | ||
Freeze all visual updates on the list, while you make big changes. | ||
procedure Thaw (Clist : access Gtk_Clist_Record); | ||
Thaw the list, ie reactivate all the visual updates. | ||
procedure Set_Shadow_Type (Clist : access Gtk_Clist_Record; The_Type : in Gtk.Enums.Gtk_Shadow_Type); | ||
Set the border style of the clist.
| ||
Modifying the contents | ||
function Append (Clist : access Gtk_Clist_Record; Text : in Gtkada.Types.Chars_Ptr_Array) return Gint; | ||
Append a new row to the clist, and return the index of the row created. | ||
function Prepend (Clist : access Gtk_Clist_Record; Text : in Gtkada.Types.Chars_Ptr_Array) return Gint; | ||
Add a new row at the beginning of the clist, and return its index. | ||
procedure Insert (Clist : access Gtk_Clist_Record; Row : in Gint; Text : in Gtkada.Types.Chars_Ptr_Array); | ||
Add a new row in the clist. | ||
procedure Remove (Clist : access Gtk_Clist_Record; Row : in Gint); | ||
Remove a row from the clist (0 is the first one).
| ||
procedure Clear (Clist : access Gtk_Clist_Record); | ||
Clears the entire list. This is much faster than doing a Remove on each | ||
procedure Swap_Rows (Clist : access Gtk_Clist_Record; Row1 : in Gint; Row2 : in Gint); | ||
Exchange the position of two rows in the clist.
| ||
procedure Row_Move (Clist : access Gtk_Clist_Record; Source_Row : in Gint; Dest_Row : in Gint); | ||
Move the row at Source_Row to Dest_Row (0 indicates the first row in | ||
procedure Set_Sort_Column (Clist : access Gtk_Clist_Record; Column : Gint); | ||
Indicate the column on which to sort the clist. | ||
function Get_Sort_Column (Clist : access Gtk_Clist_Record) return Gint; | ||
Return the column on which the clist is sorted.
| ||
procedure Set_Sort_Type (Clist : access Gtk_Clist_Record; Sort_Type : Gtk_Sort_Type); | ||
Indicate in which order the sort should be done on the clist | ||
function Get_Sort_Type (Clist : access Gtk_Clist_Record) return Gtk_Sort_Type; | ||
Return the sort type currently used for the list
| ||
procedure Sort (Clist : access Gtk_Clist_Record); | ||
Sort the lines of the clist, based on the column set by Set_Sort_Column, | ||
procedure Set_Auto_Sort (Clist : access Gtk_Clist_Record; Auto_Sort : Boolean); | ||
If Auto_Sort is true, then the clist will be automatically sorted every | ||
procedure Set_Compare_Func (Clist : access Gtk_Clist_Record; Func : Gtk_Clist_Compare_Func); | ||
Set the function used when sorting the list. This function takes two | ||
Columns | ||
function Get_Columns (Clist : access Gtk_Clist_Record) return Gint; | ||
Return the number of columns in the clist.
| ||
procedure Column_Titles_Hide (Clist : access Gtk_Clist_Record); | ||
Hide the column titles for the list. | ||
procedure Column_Titles_Show (Clist : access Gtk_Clist_Record); | ||
Show the column titles for the list. | ||
procedure Column_Title_Active (Clist : access Gtk_Clist_Record; Column : in Gint); | ||
Set the column title to be an activate title. | ||
procedure Column_Title_Passive (Clist : access Gtk_Clist_Record; Column : in Gint); | ||
Set the column title to be passive. | ||
procedure Column_Titles_Active (Clist : access Gtk_Clist_Record); | ||
Set all column titles to be active.
| ||
procedure Column_Titles_Passive (Clist : access Gtk_Clist_Record); | ||
Set all column titles to be passive.
| ||
procedure Set_Column_Title (Clist : access Gtk_Clist_Record; Column : in Gint; Title : in UTF8_String); | ||
Set the text for the button of the column's title. | ||
function Get_Column_Title (Clist : access Gtk_Clist_Record; Column : in Gint) return UTF8_String; | ||
Return the text used for the title's column. | ||
procedure Set_Column_Widget (Clist : access Gtk_Clist_Record; Column : in Gint; Widget : access Gtk.Widget.Gtk_Widget_Record'Class); | ||
Modify the widget used in the Gtk_Button that is the column's title. | ||
function Get_Column_Widget (Clist : access Gtk_Clist_Record; Column : in Gint) return Gtk.Widget.Gtk_Widget; | ||
Return the child of the button that makes the column's title. | ||
procedure Set_Column_Justification (Clist : access Gtk_Clist_Record; Column : in Gint; Justification : in Gtk.Enums.Gtk_Justification); | ||
Change the way the text in the whole column is justified. | ||
procedure Set_Column_Visibility (Clist : access Gtk_Clist_Record; Column : in Gint; Visible : in Boolean); | ||
Modify the visibility of a column. | ||
procedure Set_Column_Resizeable (Clist : access Gtk_Clist_Record; Column : in Gint; Resizeable : in Boolean); | ||
Set whether the column can be dynamically resized with the mouse. | ||
procedure Set_Column_Auto_Resize (Clist : access Gtk_Clist_Record; Column : in Gint; Auto_Resize : in Boolean); | ||
Set whether the column should automatically be resized to the optimal | ||
function Columns_Autosize (Clist : access Gtk_Clist_Record) return Gint; | ||
Set all the columns' width to their optimal size. | ||
function Optimal_Column_Width (Clist : access Gtk_Clist_Record; Column : Gint) return Gint; | ||
Return the optimal width for Column, based on its contents. | ||
procedure Set_Column_Width (Clist : access Gtk_Clist_Record; Column : in Gint; Width : in Gint); | ||
Set the column width in pixels. | ||
procedure Set_Column_Min_Width (Clist : access Gtk_Clist_Record; Column : Gint; Min_Width : Gint); | ||
Set the minimal width for the column, in pixels. | ||
procedure Set_Column_Max_Width (Clist : access Gtk_Clist_Record; Column : Gint; Max_Width : Gint); | ||
Set the maximal width for the column, in pixels. | ||
Rows | ||
function Get_Rows (Clist : access Gtk_Clist_Record) return Gint; | ||
Return the number of rows in the clist.
| ||
procedure Set_Row_Height (Clist : access Gtk_Clist_Record; Height : Gint); | ||
Set the height of the rows, in pixels. | ||
function Row_Is_Visible (Clist : access Gtk_Clist_Record; Row : in Gint) return Gtk.Enums.Gtk_Visibility; | ||
Return the visibility status of the row.
| ||
procedure Set_Foreground (Clist : access Gtk_Clist_Record; Row : in Gint; Color : in Gdk.Color.Gdk_Color); | ||
Set the foreground color for the row. | ||
procedure Set_Background (Clist : access Gtk_Clist_Record; Row : in Gint; Color : in Gdk.Color.Gdk_Color); | ||
Set the background color for the row. | ||
procedure Set_Row_Style (Clist : access Gtk_Clist_Record; Row : Gint; Style : in Gtk.Style.Gtk_Style); | ||
Set the default style for the cells in the row. This can be | ||
function Get_Row_Style (Clist : access Gtk_Clist_Record; Row : in Gint) return Gtk.Style.Gtk_Style; | ||
Return the default style used for the row.
| ||
procedure Set_Selectable (Clist : access Gtk_Clist_Record; Row : Gint; Selectable : Boolean); | ||
Indicate whether the row can be selected or not. | ||
function Get_Selectable (Clist : access Gtk_Clist_Record; Row : Gint) return Boolean; | ||
Return the selectable status of the row.
| ||
procedure Select_Row (Clist : access Gtk_Clist_Record; Row : in Gint; Column : in Gint); | ||
Emit the signal "select_row". This simulates the user pressing | ||
procedure Unselect_Row (Clist : access Gtk_Clist_Record; Row : in Gint; Column : in Gint); | ||
Emit the signal "unselect_row", as if the user had clicked on | ||
procedure Undo_Selection (Clist : access Gtk_Clist_Record); | ||
Undo the last select/unselect operation.
| ||
procedure Get_Selection_Info (Clist : access Gtk_Clist_Record; X : in Gint; Y : in Gint; Row : out Gint; Column : out Gint; Is_Valid : out Boolean); | ||
Return the Row/Column corresponding to the coordinates X,Y in the | ||
procedure Select_All (Clist : access Gtk_Clist_Record); | ||
Select all the rows in the clist. This only works if the selection | ||
procedure Unselect_All (Clist : access Gtk_Clist_Record); | ||
Deselect all the rows in the clist. If the selection mode is | ||
function Get_Focus_Row (Clist : access Gtk_Clist_Record) return Gint; | ||
Return the number of the line that currently has the focus.
| ||
function Get_Row_List (Clist : access Gtk_Clist_Record) return Row_List.Glist; | ||
Return the list of all the rows in the clist. This might speed up | ||
function Get_Selection (Widget : access Gtk_Clist_Record) return Gtk.Enums.Gint_List.Glist; | ||
Return the list of selected rows, by number.
| ||
Cells | ||
function Get_Cell_Type (Clist : access Gtk_Clist_Record; Row : in Gint; Column : in Gint) return Gtk_Cell_Type; | ||
Return the type of the cell at Row/Column. | ||
procedure Set_Text (Clist : access Gtk_Clist_Record; Row : in Gint; Column : in Gint; Text : in UTF8_String); | ||
Set the cell's text, replacing its current contents. | ||
function Get_Text (Clist : access Gtk_Clist_Record; Row : in Gint; Column : in Gint) return UTF8_String; | ||
Return the text contained in cell. The type of the cell should be | ||
function Get_Text (Clist : access Gtk_Clist_Record; Row : Gtk_Clist_Row; Column : in Gint) return UTF8_String; | ||
Return the text contained in cell. The Row can be obtained from | ||
procedure Set_Pixmap (Clist : access Gtk_Clist_Record; Row : in Gint; Column : in Gint; Pixmap : in Gdk.Pixmap.Gdk_Pixmap; Mask : in Gdk.Bitmap.Gdk_Bitmap); | ||
Set the cell's pixmap, replacing its current contents. | ||
procedure Get_Pixmap (Clist : access Gtk_Clist_Record; Row : in Gint; Column : in Gint; Pixmap : out Gdk.Pixmap.Gdk_Pixmap; Mask : out Gdk.Bitmap.Gdk_Bitmap; Is_Valid : out Boolean); | ||
Return the pixmap contained in a cell. The type of the cell should | ||
procedure Get_Pixmap (Clist : access Gtk_Clist_Record; Row : in Gtk_Clist_Row; Column : in Gint; Pixmap : out Gdk.Pixmap.Gdk_Pixmap; Mask : out Gdk.Bitmap.Gdk_Bitmap; Is_Valid : out Boolean); | ||
Return the pixmap contained in a cell. Row can be obtained directly with | ||
procedure Set_Pixtext (Clist : access Gtk_Clist_Record; Row : in Gint; Column : in Gint; Text : in UTF8_String; Spacing : in Guint8; Pixmap : in Gdk.Pixmap.Gdk_Pixmap; Mask : in Gdk.Bitmap.Gdk_Bitmap); | ||
Set both the text and the pixmap for the cell. | ||
procedure Get_Pixtext (Clist : access Gtk_Clist_Record; Row : in Gint; Column : in Gint; Spacing : out Guint8; Pixmap : out Gdk.Pixmap.Gdk_Pixmap; Mask : out Gdk.Bitmap.Gdk_Bitmap; Is_Valid : out Boolean); | ||
The result is not meaningful if Is_Valid is False. | ||
procedure Set_Cell_Style (Clist : access Gtk_Clist_Record; Row : in Gint; Column : in Gint; Style : in Gtk.Style.Gtk_Style); | ||
Set the style (font, color, ...) used for the cell. | ||
function Get_Cell_Style (Clist : access Gtk_Clist_Record; Row : in Gint; Column : in Gint) return Gtk.Style.Gtk_Style; | ||
Return the style of the cell.
| ||
procedure Set_Shift (Clist : access Gtk_Clist_Record; Row : in Gint; Column : in Gint; Vertical : in Gint; Horizontal : in Gint); | ||
Set a horizontal and vertical shift for drawing the content of the cell. | ||
procedure Set_Cell_Contents (Clist : access Gtk_Clist_Record; Row : Gtk_Clist_Row; Column : Gint; Cell_Type : Gtk_Cell_Type; Text : UTF8_String; Spacing : Guint8; Pixmap : Gdk.Pixmap.Gdk_Pixmap; Mask : Gdk.Bitmap.Gdk_Bitmap); | ||
Modify the contents and type of a cell. | ||
Reordering the list | ||
procedure Set_Reorderable (Clist : access Gtk_Clist_Record; Reorderable : Boolean); | ||
Set whether the list can be dynamically reordered by the user. | ||
procedure Set_Use_Drag_Icons (Clist : access Gtk_Clist_Record; Use_Icons : Boolean); | ||
Set whether drag icons are shown while the user is reordering the list. | ||
procedure Set_Button_Actions (Clist : access Gtk_Clist_Record; Button : Guint; Button_Action : Gtk_Button_Action); | ||
Set the action for a specific button on the list. | ||
procedure Moveto (Clist : access Gtk_Clist_Record; Row : in Gint; Column : in Gint; Row_Align : in Gfloat; Col_Align : in Gfloat); | ||
Scroll the list so that Row/Column is visible. | ||
Row_Data | ||
You can associate one private data with each row in the clist. If you This is your responsibility to use the Get and Set functions from the same generic package. However, you can use different packages for different lines (although this will definitely make things harder to use!)
Note also that an internal copy of the Data is done, therefore the
"find" functions found in gtk+ have no equivalent in GtkAda, although it
would be enough to write one by iterating over the Row numbers.
| ||
function Get (Object : access Gtk_Clist_Record'Class; Row : in Gint) return Data_Type; | ||
Get the data associated to a specific row.
| ||
function Get (Object : access Gtk_Clist_Record'Class; Row : in Gtk_Clist_Row) return Data_Type; | ||
Same as above, but acts directly on a row obtained through | ||
procedure Set (Object : access Gtk_Clist_Record'Class; Row : in Gint; Data : in Data_Type); | ||
Modify the data associated with a row
| ||
procedure Set (Object : access Gtk_Clist_Record'Class; Row : in Gtk_Clist_Row; Data : in Data_Type); | ||
Same as above but acts directly on a row obtained through |
Example |
---|
-- The procedure below shows how you can hide all the columns but one -- in the clist. -- Since Gtk_Clist prevents you to hide the last visible column, the following -- code does not work: -- -- -- Hide all the columns -- for J in 0 .. Get_Columns (Clist) loop -- Set_Column_Visibility (Clist, J, False); -- end loop; -- -- -- Show the one you want -- Set_Column_Visibility (Clist, New_Column, True); -- -- The following code should be used instead: package body Clist is procedure Hide_All_But_One (Clist : access Gtk_Clist_Record'Class; New_Column : Gint) is begin -- Make sure that at least one column is visible Set_Column_Visibility (Clist, New_Column, True); -- Hide all the other columns. for J in 0 .. Get_Columns (Clist) loop if J /= New_Column then Set_Column_Visibility (Clist, J, False); end if; end loop; end Hide_All_But_One; end Clist;