CtkCellView

CtkCellView — A widget displaying a single row of a CtkTreeModel

Functions

Properties

char * background Write
CdkColor * background-cdk Read / Write
CdkRGBA * background-rgba Read / Write
gboolean background-set Read / Write
CtkCellArea * cell-area Read / Write / Construct Only
CtkCellAreaContext * cell-area-context Read / Write / Construct Only
gboolean draw-sensitive Read / Write
gboolean fit-model Read / Write
CtkTreeModel * model Read / Write

Types and Values

Object Hierarchy

    GObject
    ╰── GInitiallyUnowned
        ╰── CtkWidget
            ╰── CtkCellView

Implemented Interfaces

CtkCellView implements AtkImplementorIface, CtkBuildable, CtkCellLayout and CtkOrientable.

Includes

#include <ctk/ctk.h>

Description

A CtkCellView displays a single row of a CtkTreeModel using a CtkCellArea and CtkCellAreaContext. A CtkCellAreaContext can be provided to the CtkCellView at construction time in order to keep the cellview in context of a group of cell views, this ensures that the renderers displayed will be properly aligned with eachother (like the aligned cells in the menus of CtkComboBox).

CtkCellView is CtkOrientable in order to decide in which orientation the underlying CtkCellAreaContext should be allocated. Taking the CtkComboBox menu as an example, cellviews should be oriented horizontally if the menus are listed top-to-bottom and thus all share the same width but may have separate individual heights (left-to-right menus should be allocated vertically since they all share the same height but may have variable widths).

CSS nodes

CtkCellView has a single CSS node with name cellview.

Functions

ctk_cell_view_new ()

CtkWidget *
ctk_cell_view_new (void);

Creates a new CtkCellView widget.

Returns

A newly created CtkCellView widget.

Since: 2.6


ctk_cell_view_new_with_context ()

CtkWidget *
ctk_cell_view_new_with_context (CtkCellArea *area,
                                CtkCellAreaContext *context);

Creates a new CtkCellView widget with a specific CtkCellArea to layout cells and a specific CtkCellAreaContext.

Specifying the same context for a handfull of cells lets the underlying area synchronize the geometry for those cells, in this way alignments with cellviews for other rows are possible.

Parameters

area

the CtkCellArea to layout cells

 

context

the CtkCellAreaContext in which to calculate cell geometry

 

Returns

A newly created CtkCellView widget.

Since: 2.6


ctk_cell_view_new_with_text ()

CtkWidget *
ctk_cell_view_new_with_text (const gchar *text);

Creates a new CtkCellView widget, adds a CtkCellRendererText to it, and makes it show text .

Parameters

text

the text to display in the cell view

 

Returns

A newly created CtkCellView widget.

Since: 2.6


ctk_cell_view_new_with_markup ()

CtkWidget *
ctk_cell_view_new_with_markup (const gchar *markup);

Creates a new CtkCellView widget, adds a CtkCellRendererText to it, and makes it show markup . The text can be marked up with the Pango text markup language.

Parameters

markup

the text to display in the cell view

 

Returns

A newly created CtkCellView widget.

Since: 2.6


ctk_cell_view_new_with_pixbuf ()

CtkWidget *
ctk_cell_view_new_with_pixbuf (GdkPixbuf *pixbuf);

Creates a new CtkCellView widget, adds a CtkCellRendererPixbuf to it, and makes it show pixbuf .

Parameters

pixbuf

the image to display in the cell view

 

Returns

A newly created CtkCellView widget.

Since: 2.6


ctk_cell_view_set_model ()

void
ctk_cell_view_set_model (CtkCellView *cell_view,
                         CtkTreeModel *model);

Sets the model for cell_view . If cell_view already has a model set, it will remove it before setting the new model. If model is NULL, then it will unset the old model.

Parameters

cell_view

a CtkCellView

 

model

a CtkTreeModel.

[allow-none]

Since: 2.6


ctk_cell_view_get_model ()

CtkTreeModel *
ctk_cell_view_get_model (CtkCellView *cell_view);

Returns the model for cell_view . If no model is used NULL is returned.

Parameters

cell_view

a CtkCellView

 

Returns

a CtkTreeModel used or NULL.

[nullable][transfer none]

Since: 2.16


ctk_cell_view_set_displayed_row ()

void
ctk_cell_view_set_displayed_row (CtkCellView *cell_view,
                                 CtkTreePath *path);

Sets the row of the model that is currently displayed by the CtkCellView. If the path is unset, then the contents of the cellview “stick” at their last value; this is not normally a desired result, but may be a needed intermediate state if say, the model for the CtkCellView becomes temporarily empty.

Parameters

cell_view

a CtkCellView

 

path

a CtkTreePath or NULL to unset.

[allow-none]

Since: 2.6


ctk_cell_view_get_displayed_row ()

CtkTreePath *
ctk_cell_view_get_displayed_row (CtkCellView *cell_view);

Returns a CtkTreePath referring to the currently displayed row. If no row is currently displayed, NULL is returned.

Parameters

cell_view

a CtkCellView

 

Returns

the currently displayed row or NULL.

[nullable][transfer full]

Since: 2.6


ctk_cell_view_get_size_of_row ()

gboolean
ctk_cell_view_get_size_of_row (CtkCellView *cell_view,
                               CtkTreePath *path,
                               CtkRequisition *requisition);

ctk_cell_view_get_size_of_row has been deprecated since version 3.0 and should not be used in newly-written code.

Combo box formerly used this to calculate the sizes for cellviews, now you can achieve this by either using the “fit-model” property or by setting the currently displayed row of the CtkCellView and using ctk_widget_get_preferred_size().

Sets requisition to the size needed by cell_view to display the model row pointed to by path .

Parameters

cell_view

a CtkCellView

 

path

a CtkTreePath

 

requisition

return location for the size.

[out]

Returns

TRUE

Since: 2.6


ctk_cell_view_set_background_color ()

void
ctk_cell_view_set_background_color (CtkCellView *cell_view,
                                    const CdkColor *color);

ctk_cell_view_set_background_color has been deprecated since version 3.4 and should not be used in newly-written code.

Use ctk_cell_view_set_background_rgba() instead.

Sets the background color of view .

Parameters

cell_view

a CtkCellView

 

color

the new background color

 

Since: 2.6


ctk_cell_view_set_background_rgba ()

void
ctk_cell_view_set_background_rgba (CtkCellView *cell_view,
                                   const CdkRGBA *rgba);

Sets the background color of cell_view .

Parameters

cell_view

a CtkCellView

 

rgba

the new background color

 

Since: 3.0


ctk_cell_view_set_draw_sensitive ()

void
ctk_cell_view_set_draw_sensitive (CtkCellView *cell_view,
                                  gboolean draw_sensitive);

Sets whether cell_view should draw all of its cells in a sensitive state, this is used by CtkComboBox menus to ensure that rows with insensitive cells that contain children appear sensitive in the parent menu item.

Parameters

cell_view

a CtkCellView

 

draw_sensitive

whether to draw all cells in a sensitive state.

 

Since: 3.0


ctk_cell_view_get_draw_sensitive ()

gboolean
ctk_cell_view_get_draw_sensitive (CtkCellView *cell_view);

Gets whether cell_view is configured to draw all of its cells in a sensitive state.

Parameters

cell_view

a CtkCellView

 

Returns

whether cell_view draws all of its cells in a sensitive state

Since: 3.0


ctk_cell_view_set_fit_model ()

void
ctk_cell_view_set_fit_model (CtkCellView *cell_view,
                             gboolean fit_model);

Sets whether cell_view should request space to fit the entire CtkTreeModel.

This is used by CtkComboBox to ensure that the cell view displayed on the combo box’s button always gets enough space and does not resize when selection changes.

Parameters

cell_view

a CtkCellView

 

fit_model

whether cell_view should request space for the whole model.

 

Since: 3.0


ctk_cell_view_get_fit_model ()

gboolean
ctk_cell_view_get_fit_model (CtkCellView *cell_view);

Gets whether cell_view is configured to request space to fit the entire CtkTreeModel.

Parameters

cell_view

a CtkCellView

 

Returns

whether cell_view requests space to fit the entire CtkTreeModel.

Since: 3.0

Types and Values

struct CtkCellView

struct CtkCellView;

struct CtkCellViewClass

struct CtkCellViewClass {
  CtkWidgetClass parent_class;
};

Members

Property Details

The “background” property

  “background”               char *

Background color as a string.

Owner: CtkCellView

Flags: Write

Default value: NULL


The “background-cdk” property

  “background-cdk”           CdkColor *

The background color as a CdkColor

Owner: CtkCellView

Flags: Read / Write


The “background-rgba” property

  “background-rgba”          CdkRGBA *

The background color as a CdkRGBA

Owner: CtkCellView

Flags: Read / Write

Since: 3.0


The “background-set” property

  “background-set”           gboolean

Whether this tag affects the background color.

Owner: CtkCellView

Flags: Read / Write

Default value: FALSE


The “cell-area” property

  “cell-area”                CtkCellArea *

The CtkCellArea rendering cells

If no area is specified when creating the cell view with ctk_cell_view_new_with_context() a horizontally oriented CtkCellAreaBox will be used.

since 3.0

Owner: CtkCellView

Flags: Read / Write / Construct Only


The “cell-area-context” property

  “cell-area-context”        CtkCellAreaContext *

The CtkCellAreaContext used to compute the geometry of the cell view.

A group of cell views can be assigned the same context in order to ensure the sizes and cell alignments match across all the views with the same context.

CtkComboBox menus uses this to assign the same context to all cell views in the menu items for a single menu (each submenu creates its own context since the size of each submenu does not depend on parent or sibling menus).

since 3.0

Owner: CtkCellView

Flags: Read / Write / Construct Only


The “draw-sensitive” property

  “draw-sensitive”           gboolean

Whether all cells should be draw as sensitive for this view regardless of the actual cell properties (used to make menus with submenus appear sensitive when the items in submenus might be insensitive).

since 3.0

Owner: CtkCellView

Flags: Read / Write

Default value: FALSE


The “fit-model” property

  “fit-model”                gboolean

Whether the view should request enough space to always fit the size of every row in the model (used by the combo box to ensure the combo box size doesnt change when different items are selected).

since 3.0

Owner: CtkCellView

Flags: Read / Write

Default value: FALSE


The “model” property

  “model”                    CtkTreeModel *

The model for cell view

since 2.10

Owner: CtkCellView

Flags: Read / Write