_
View_
ColumnGeneral organization of the tree_view widgets:
______________Tree_View___________________________________ | _________________________ ________________________| | |_____Tree_View_Column1__| |___Tree_View_Column2 __|| | | | | || | | ----------- ---------|| | || | | |Renderer1| |render2 || | || | | | | | || | || | | | | | || | || | | | | | || | || | | |---------| |--------|| | || | |________________________| |_______________________|| |_________________________________________________________|
A tree view can contain multiple physical columns on the screen. These columns can have a button at the top, typically to force an ordering of the tree). They can also be reorganized interactively by the user.
Each physical column can display several information, like buttons, strings, ... Each of this display comes from a cell_renderer, that displays some data it reads from the model associated with the tree_view.
The renderers are then divided into lines, which are typically pointed to by iterators (Gtk_Tree_Iter).
Widget Hierarchy |
---|
GObject (see section Package Glib.Object) Gtk_Object (see section Package Gtk.Object) \___ Gtk_Tree_View_Column (see section Package Gtk.Tree |
Signals |
---|
Types |
---|
type Cell_Data_Func is access procedure | |
| |
type Data_Type is (<>); | |
| |
type Gtk_Tree_View_Column_Sizing is (Tree_View_Column_Grow_Only, Tree_View_Column_Autosize, Tree_View_Column_Fixed); | |
|
Subprograms |
---|
procedure Convert; | ||
| ||
procedure Gtk_New (Widget : out Gtk_Tree_View_Column); | ||
Create a new Gtk_Tree_View_Column.
| ||
function Get_Type return Glib.GType; | ||
Return the internal value associated with this widget.
| ||
Visual representation of the data | ||
All the cells in a column have a similar graphical representation. This The visual representation is specified through a "renderer". See the various Gtk.Cell_Renderer* packages for more information on the available renderers.
Note that the same renderer can be used for multiple columns, even
though its properties can be different each time. This means that for
instance you can instantiate only one Gtk_Cell_Renderer_Text, and use it
for all the columns that need to display text.
| ||
procedure Pack_Start (Tree_Column : access Gtk_Tree_View_Column_Record; Cell : access Gtk.Cell_Renderer.Gtk_Cell_Renderer_Record'Class; Expand : Boolean); | ||
Add a renderer to the Tree_Column. | ||
procedure Pack_End (Tree_Column : access Gtk_Tree_View_Column_Record; Cell : access Gtk.Cell_Renderer.Gtk_Cell_Renderer_Record'Class; Expand : Boolean); | ||
Same as the above. See the description of Pack_Start and Pack_End in | ||
procedure Clear (Tree_Column : access Gtk_Tree_View_Column_Record); | ||
Remove all the renderers set in the column. | ||
function Get_Cell_Renderers (Tree_Column : access Gtk_Tree_View_Column_Record) return Gtk.Cell_Renderer.Cell_Renderer_List.Glist; | ||
Return the list of cell renderers set in the column
| ||
Specifying the data to display | ||
The data to display in a column is always read from the model associated For instance, if you have a database that contains some distance and time information, and you want to display the speed in a tree view: if you are using a Gtk_Tree_Store model, you have to create a third column in the model to store the string, and have a renderer point to that third column. However, if you are using your own model, it is conceivable that the speed is computed on the fly from the distance and time. The subprograms below use two or three parameters to precisely identify the part of the tree they impact: the column, the renderer in the column, and in some cases the specific line.
A renderer is always associated with a column in the model (even if that
is a virtual column not associated with physical data). This is done
through the Add_Attribute subprogram. This will read the data from the
model. The type of the data read depends on the type of the column in
the model.
The type of data that Add_Attribute excepts to find in the column is
documented in the packages for each of the renderer.
| ||
procedure Add_Attribute (Tree_Column : access Gtk_Tree_View_Column_Record; Cell_Renderer : access Gtk.Cell_Renderer.Gtk_Cell_Renderer_Record'Class; Attribute : String; Column : Gint); | ||
Add an attribute mapping to the list in Tree_Column. For a list of properties available for each Cell_Renderer, please refer to the corresponding package specifications.
See also the function Set_Cell_Data_Func for another way to query the
data to display in the tree.
| ||
procedure Set_Cell_Data_Func (Tree_Column : access Gtk_Tree_View_Column_Record; Cell : access Gtk.Cell_Renderer.Gtk_Cell_Renderer_Record'Class; Func : Cell_Data_Func); | ||
Set the function to use for the column. | ||
procedure Set_Cell_Data_Func (Tree_Column : access Gtk_Tree_View_Column_Record; Cell : access Gtk.Cell_Renderer.Gtk_Cell_Renderer_Record'Class; Func : Cell_Data_Func; Data : Data_Type); | ||
| ||
procedure Clear_Attributes (Tree_Column : access Gtk_Tree_View_Column_Record; Cell_Renderer : access Gtk.Cell_Renderer.Gtk_Cell_Renderer_Record'Class); | ||
Clear all existing attributes previously set with | ||
Options for manipulating the columns | ||
procedure Set_Spacing (Tree_Column : access Gtk_Tree_View_Column_Record; Spacing : Gint); | ||
Set the spacing field of Tree_Column. | ||
function Get_Spacing (Tree_Column : access Gtk_Tree_View_Column_Record) return Gint; | ||
Return the spacing of Tree_Column.
| ||
procedure Set_Visible (Tree_Column : access Gtk_Tree_View_Column_Record; Visible : Boolean); | ||
Set the visibility of Tree_Column.
| ||
function Get_Visible (Tree_Column : access Gtk_Tree_View_Column_Record) return Boolean; | ||
Return True if Tree_Column is visible.
| ||
procedure Set_Resizable (Tree_Column : access Gtk_Tree_View_Column_Record; Resizable : Boolean); | ||
Set whether the Tree_Column is resizable.
| ||
function Get_Resizable (Tree_Column : access Gtk_Tree_View_Column_Record) return Boolean; | ||
Return whether Tree_Column is resizable.
| ||
procedure Set_Sizing (Tree_Column : access Gtk_Tree_View_Column_Record; The_Type : Gtk_Tree_View_Column_Sizing); | ||
Set the growth behavior of Tree_Column to The_Type.
| ||
function Get_Sizing (Tree_Column : access Gtk_Tree_View_Column_Record) return Gtk_Tree_View_Column_Sizing; | ||
Return the current type of Tree_Column.
| ||
function Get_Width (Tree_Column : access Gtk_Tree_View_Column_Record) return Gint; | ||
Return the current size of the Tree_Column in pixels.
| ||
function Get_Fixed_Width (Tree_Column : access Gtk_Tree_View_Column_Record) return Gint; | ||
Get the fixed width of the column. | ||
procedure Set_Fixed_Width (Tree_Column : access Gtk_Tree_View_Column_Record; Fixed_Width : Gint); | ||
Set the size of the column in pixels. | ||
procedure Set_Min_Width (Tree_Column : access Gtk_Tree_View_Column_Record; Min_Width : Gint); | ||
Set the minimum width of the Tree_Column. | ||
function Get_Min_Width (Tree_Column : access Gtk_Tree_View_Column_Record) return Gint; | ||
Return the minimum width in pixels of the Tree_Column, or -1 if no | ||
procedure Set_Max_Width (Tree_Column : access Gtk_Tree_View_Column_Record; Max_Width : Gint); | ||
Set the maximum width of the Tree_Column. | ||
function Get_Max_Width (Tree_Column : access Gtk_Tree_View_Column_Record) return Gint; | ||
Return the maximum width in pixels of the Tree_Column, or -1 if no | ||
procedure Clicked (Tree_Column : access Gtk_Tree_View_Column_Record); | ||
Emit the "clicked" signal on the column. | ||
procedure Set_Title (Tree_Column : access Gtk_Tree_View_Column_Record; Title : UTF8_String); | ||
Set the title of the Tree_Column. | ||
function Get_Title (Tree_Column : access Gtk_Tree_View_Column_Record) return UTF8_String; | ||
Return the title of the Tree_Column.
| ||
procedure Set_Clickable (Tree_Column : access Gtk_Tree_View_Column_Record; Clickable : Boolean); | ||
Set the header to be active if Active is True. | ||
function Get_Clickable (Tree_Column : access Gtk_Tree_View_Column_Record) return Boolean; | ||
Return True if the user can click on the header for the column.
| ||
procedure Set_Widget (Tree_Column : access Gtk_Tree_View_Column_Record; Widget : access Gtk.Widget.Gtk_Widget_Record'Class); | ||
| ||
function Get_Widget (Tree_Column : access Gtk_Tree_View_Column_Record) return Gtk.Widget.Gtk_Widget; | ||
Return the Gtk_Widget in the button in the column header. | ||
procedure Set_Alignment (Tree_Column : access Gtk_Tree_View_Column_Record; Xalign : Gfloat); | ||
Set the alignment of the title or custom widget inside the column header | ||
function Get_Alignment (Tree_Column : access Gtk_Tree_View_Column_Record) return Gfloat; | ||
Return the current x alignment of Tree_Column. | ||
procedure Set_Reorderable (Tree_Column : access Gtk_Tree_View_Column_Record; Reorderable : Boolean); | ||
| ||
function Get_Reorderable (Tree_Column : access Gtk_Tree_View_Column_Record) return Boolean; | ||
| ||
procedure Set_Sort_Column_Id (Tree_Column : access Gtk_Tree_View_Column_Record; Sort_Column_Id : Gint); | ||
Set the logical sort_column_id that this column sorts on when this | ||
function Get_Sort_Column_Id (Tree_Column : access Gtk_Tree_View_Column_Record) return Gint; | ||
Get the logical sort_column_id that the model sorts on when this | ||
procedure Set_Sort_Indicator (Tree_Column : access Gtk_Tree_View_Column_Record; Setting : Boolean); | ||
Call this function with a Setting of True to display an arrow in | ||
function Get_Sort_Indicator (Tree_Column : access Gtk_Tree_View_Column_Record) return Boolean; | ||
Get the value set by Set_Sort_Indicator.
| ||
procedure Set_Sort_Order (Tree_Column : access Gtk_Tree_View_Column_Record; Order : Gtk_Sort_Type); | ||
Change the appearance of the sort indicator. | ||
function Get_Sort_Order (Tree_Column : access Gtk_Tree_View_Column_Record) return Gtk_Sort_Type; | ||
Get the value set by Set_Sort_Order.
| ||
procedure Cell_Set_Cell_Data (Tree_Column : access Gtk_Tree_View_Column_Record; Tree_Model : access Gtk.Tree_Model.Gtk_Tree_Model_Record'Class; Iter : Gtk.Tree_Model.Gtk_Tree_Iter; Is_Expander : Boolean; Is_Expanded : Boolean); | ||
Set the cell renderer based on the Tree_Model and Tree_Node. | ||
procedure Cell_Get_Size (Tree_Column : access Gtk_Tree_View_Column_Record; Cell_Area : Gdk.Rectangle.Gdk_Rectangle; X_Offset : out Gint; Y_Offset : out Gint; Width : out Gint; Height : out Gint); | ||
Obtain the width and height needed to render the column. | ||
function Cell_Is_Visible (Tree_Column : access Gtk_Tree_View_Column_Record) return Boolean; | ||
|