GTK+ Reference Manual
<<< Previous Page | Home | Up | Next Page >>>

# GtkTreeViewColumn

## Name

GtkTreeViewColumn --

## Synopsis

    #include <gtk/gtk.h>

    #define     GTK_TYPE_TREE_VIEW_COLUMN
    struct      GtkTreeViewColumn;
    enum        GtkTreeViewColumnSizing;
    GtkTreeViewColumn* gtk_tree_view_column_new (void);
    GtkTreeViewColumn* gtk_tree_view_column_new_with_attributes
                                                (const gchar *title,
                                                 GtkCellRenderer *cell,
                                                 ...);
    void        gtk_tree_view_column_add_attribute
                                                (GtkTreeViewColumn *tree_column,
                                                 GtkCellRenderer *cell_renderer,
                                                 const gchar *attribute,
                                                 gint column);
    void        gtk_tree_view_column_set_attributes
                                                (GtkTreeViewColumn *tree_column,
                                                 GtkCellRenderer *cell_renderer,
                                                 ...);
    void        gtk_tree_view_column_set_visible
                                                (GtkTreeViewColumn *tree_column,
                                                 gboolean visible);
    gboolean    gtk_tree_view_column_get_visible
                                                (GtkTreeViewColumn *tree_column);
    void        gtk_tree_view_column_set_sizing (GtkTreeViewColumn *tree_column,
                                                 GtkTreeViewColumnSizing type);
    GtkTreeViewColumnSizing gtk_tree_view_column_get_sizing
                                                (GtkTreeViewColumn *tree_column);
    gint        gtk_tree_view_column_get_width  (GtkTreeViewColumn *tree_column);
    void        gtk_tree_view_column_set_min_width
                                                (GtkTreeViewColumn *tree_column,
                                                 gint min_width);
    gint        gtk_tree_view_column_get_min_width
                                                (GtkTreeViewColumn *tree_column);
    void        gtk_tree_view_column_set_max_width
                                                (GtkTreeViewColumn *tree_column,
                                                 gint max_width);
    gint        gtk_tree_view_column_get_max_width
                                                (GtkTreeViewColumn *tree_column);
    void        gtk_tree_view_column_set_title  (GtkTreeViewColumn *tree_column,
                                                 const gchar *title);
    G_CONST_RETURN gchar* gtk_tree_view_column_get_title
                                                (GtkTreeViewColumn *tree_column);
    void        gtk_tree_view_column_set_clickable
                                                (GtkTreeViewColumn *tree_column,
                                                 gboolean clickable);
    void        gtk_tree_view_column_set_widget (GtkTreeViewColumn *tree_column,
                                                 GtkWidget *widget);
    GtkWidget*  gtk_tree_view_column_get_widget (GtkTreeViewColumn *tree_column);
    void        gtk_tree_view_column_set_alignment
                                                (GtkTreeViewColumn *tree_column,
                                                 gfloat xalign);
    gfloat      gtk_tree_view_column_get_alignment
                                                (GtkTreeViewColumn *tree_column);
    void        gtk_tree_view_column_clicked    (GtkTreeViewColumn *tree_column);

## Description

## Details

### GTK_TYPE_TREE_VIEW_COLUMN

    #define GTK_TYPE_TREE_VIEW_COLUMN	     (gtk_tree_view_column_get_type ())

### struct GtkTreeViewColumn

    struct GtkTreeViewColumn
    {
      GtkObject parent;

      GtkWidget *tree_view;
      GtkWidget *button;
      GtkWidget *child;
      GtkWidget *arrow;
      GtkWidget *alignment;
      GdkWindow *window;
      GtkCellEditable *editable_widget;
      gfloat xalign;
      guint property_changed_signal;

      gint spacing;
      gint fixed_width;
      gint width;
      gint requested_width;
      gint min_width;
      gint max_width;

      /* dragging columns */
      gint drag_x;
      gint drag_y;

      gchar *title;
      GList *cell_list;
      GtkTreeViewColumnSizing column_type;

      /* Sorting */
      guint sort_clicked_signal;
      guint sort_column_changed_signal;
      gint sort_column_id;
      GtkSortType sort_order;

      /* Flags */
      guint visible             : 1;
      guint clickable           : 1;
      guint dirty               : 1;
      guint show_sort_indicator : 1;
      guint maybe_reordered     : 1;
      guint reorderable         : 1;
    };

### enum GtkTreeViewColumnSizing

    typedef enum
    {
      GTK_TREE_VIEW_COLUMN_GROW_ONLY,
      GTK_TREE_VIEW_COLUMN_RESIZABLE,
      GTK_TREE_VIEW_COLUMN_AUTOSIZE,
      GTK_TREE_VIEW_COLUMN_FIXED
    } GtkTreeViewColumnSizing;

### gtk_tree_view_column_new ()

    GtkTreeViewColumn* gtk_tree_view_column_new (void);

Creates a new GtkTreeViewColumn.

Returns : | A newly created GtkTreeViewColumn.

### gtk_tree_view_column_new_with_attributes ()

    GtkTreeViewColumn* gtk_tree_view_column_new_with_attributes
                                                (const gchar *title,
                                                 GtkCellRenderer *cell,
                                                 ...);

Creates a new GtkTreeViewColumn with a number of default values. This is equivalent to calling `gtk_tree_view_column_set_title`, `gtk_tree_view_column_pack_start`, and `gtk_tree_view_column_set_attributes` on the newly created GtkTreeViewColumn.

`title` : | The title to set the header to.
`cell` : | The GtkCellRenderer.
`...` : | A NULL terminated list of attributes.
Returns : | A newly created GtkTreeViewColumn.

### gtk_tree_view_column_add_attribute ()

    void        gtk_tree_view_column_add_attribute
                                                (GtkTreeViewColumn *tree_column,
                                                 GtkCellRenderer *cell_renderer,
                                                 const gchar *attribute,
                                                 gint column);

Adds an attribute mapping to the list in `tree_column`. The `column` is the column of the model to get a value from, and the `attribute` is the parameter on `cell_renderer` to be set from the value. So for example if column 2 of the model contains strings, you could have the "text" attribute of a GtkCellRendererText get its values from column 2.

`tree_column` : | A GtkTreeViewColumn.
`cell_renderer` : | the GtkCellRenderer to set attributes on
`attribute` : | An attribute on the renderer
`column` : | The column position on the model to get the attribute from.

### gtk_tree_view_column_set_attributes ()

    void        gtk_tree_view_column_set_attributes
                                                (GtkTreeViewColumn *tree_column,
                                                 GtkCellRenderer *cell_renderer,
                                                 ...);

Sets the attributes in the list as the attributes of `tree_column`. The attributes should be in attribute/column order, as in `gtk_tree_view_column_add_attribute`. All existing attributes are removed, and replaced with the new attributes.

`tree_column` : | A GtkTreeViewColumn.
`cell_renderer` : | the GtkCellRenderer we're setting the attributes of
`...` : | A NULL terminated listing of attributes.

### gtk_tree_view_column_set_visible ()

    void        gtk_tree_view_column_set_visible
                                                (GtkTreeViewColumn *tree_column,
                                                 gboolean visible);

Sets the visibility of `tree_column`.

`tree_column` : | A GtkTreeViewColumn.
`visible` : | TRUE if the `tree_column` is visible.

### gtk_tree_view_column_get_visible ()

    gboolean    gtk_tree_view_column_get_visible
                                                (GtkTreeViewColumn *tree_column);

Returns TRUE if `tree_column` is visible.

`tree_column` : | A GtkTreeViewColumn.
Returns : | whether the column is visible or not. If it is visible, then the tree will show the column.

### gtk_tree_view_column_set_sizing ()

    void        gtk_tree_view_column_set_sizing (GtkTreeViewColumn *tree_column,
                                                 GtkTreeViewColumnSizing type);

Sets the growth behavior of `tree_column` to `type`.

`tree_column` : | A GtkTreeViewColumn.
`type` : | The GtkTreeViewColumnSizing.

### gtk_tree_view_column_get_sizing ()

    GtkTreeViewColumnSizing gtk_tree_view_column_get_sizing
                                                (GtkTreeViewColumn *tree_column);

Returns the current type of `tree_column`.

`tree_column` : | A GtkTreeViewColumn.
Returns : | The type of `tree_column`.

### gtk_tree_view_column_get_width ()

    gint        gtk_tree_view_column_get_width  (GtkTreeViewColumn *tree_column);

Returns the current size of the `tree_column` in pixels.

`tree_column` : | A GtkTreeViewColumn.
Returns : | The current width of the `tree_column`.

### gtk_tree_view_column_set_min_width ()

    void        gtk_tree_view_column_set_min_width
                                                (GtkTreeViewColumn *tree_column,
                                                 gint min_width);

Sets the minimum width of the `tree_column`. If `min_width` is -1, then the minimum width is unset.

`tree_column` : | A GtkTreeViewColumn.
`min_width` : | The minimum width of the column in pixels, or -1.

### gtk_tree_view_column_get_min_width ()

    gint        gtk_tree_view_column_get_min_width
                                                (GtkTreeViewColumn *tree_column);

Returns the minimum width in pixels of the `tree_column`, or -1 if no minimum width is set.

`tree_column` : | A GtkTreeViewColumn.
Returns : | The minimum width of the `tree_column`.

### gtk_tree_view_column_set_max_width ()

    void        gtk_tree_view_column_set_max_width
                                                (GtkTreeViewColumn *tree_column,
                                                 gint max_width);

Sets the maximum width of the `tree_column`. If `max_width` is -1, then the maximum width is unset. Note, the column can actually be wider than max width if it's the last column in a view. In this case, the column expands to fill the view.

`tree_column` : | A GtkTreeViewColumn.
`max_width` : | The maximum width of the column in pixels, or -1.

### gtk_tree_view_column_get_max_width ()

    gint        gtk_tree_view_column_get_max_width
                                                (GtkTreeViewColumn *tree_column);

Returns the maximum width in pixels of the `tree_column`, or -1 if no maximum width is set.

`tree_column` : | A GtkTreeViewColumn.
Returns : | The maximum width of the `tree_column`.

### gtk_tree_view_column_set_title ()

    void        gtk_tree_view_column_set_title  (GtkTreeViewColumn *tree_column,
                                                 const gchar *title);

Sets the title of the `tree_column`. If a custom widget has been set, then this value is ignored.

`tree_column` : | A GtkTreeViewColumn.
`title` : | The title of the `tree_column`.

### gtk_tree_view_column_get_title ()

    G_CONST_RETURN gchar* gtk_tree_view_column_get_title
                                                (GtkTreeViewColumn *tree_column);

Returns the title of the widget. This value should not be modified.

`tree_column` : | A GtkTreeViewColumn.
Returns : | the title of the column.

### gtk_tree_view_column_set_clickable ()

    void        gtk_tree_view_column_set_clickable
                                                (GtkTreeViewColumn *tree_column,
                                                 gboolean clickable);

Sets the header to be active if `active` is TRUE. When the header is active, then it can take keyboard focus, and can be clicked.

`tree_column` : | A GtkTreeViewColumn.
`clickable` : | TRUE if the header is active.

### gtk_tree_view_column_set_widget ()

    void        gtk_tree_view_column_set_widget (GtkTreeViewColumn *tree_column,
                                                 GtkWidget *widget);

Sets the widget in the header to be `widget`. If widget is NULL, then the header button is set with a GtkLabel set to the title of `tree_column`.

`tree_column` : | A GtkTreeViewColumn.
`widget` : | A child GtkWidget, or NULL.

### gtk_tree_view_column_get_widget ()

    GtkWidget*  gtk_tree_view_column_get_widget (GtkTreeViewColumn *tree_column);

Returns the GtkWidget in the button in the column header. If a custom widget has not been set, then this will be a GtkAlignment with a GtkLabel in it.

`tree_column` : | A GtkTreeViewColumn.
Returns : | The GtkWidget in the column header.

### gtk_tree_view_column_set_alignment ()

    void        gtk_tree_view_column_set_alignment
                                                (GtkTreeViewColumn *tree_column,
                                                 gfloat xalign);

Sets the alignment of the title or custom widget inside the column header.

`tree_column` : | A GtkTreeViewColumn.
`xalign` : | alignment (0.0 for left, 0.5 for center, 1.0 for right)

### gtk_tree_view_column_get_alignment ()

    gfloat      gtk_tree_view_column_get_alignment
                                                (GtkTreeViewColumn *tree_column);

Returns the current x alignment of `tree_column`. This value can range between 0.0 and 1.0.

`tree_column` : | A GtkTreeViewColumn.
Returns : | The current alignent of `tree_column`.

### gtk_tree_view_column_clicked ()

    void        gtk_tree_view_column_clicked    (GtkTreeViewColumn *tree_column);

Emits the "clicked" signal on the column. This function will only work if the user could have conceivably clicked on the button.

`tree_column` : | a GtkTreeViewColumn

<<< Previous Page | Home | Up | Next Page >>>
GtkTreeStore | GtkTreeView