GtkCellRendererText

GtkCellRendererText — Renders text in a cell

Properties

gboolean align-set Read / Write
PangoAlignment alignment Read / Write
PangoAttrList * attributes Read / Write
char * background Write
GdkColor * background-gdk Read / Write
GdkRGBA * background-rgba Read / Write
gboolean background-set Read / Write
gboolean editable Read / Write
gboolean editable-set Read / Write
PangoEllipsizeMode ellipsize Read / Write
gboolean ellipsize-set Read / Write
char * family Read / Write
gboolean family-set Read / Write
char * font Read / Write
PangoFontDescription * font-desc Read / Write
char * foreground Write
GdkColor * foreground-gdk Read / Write
GdkRGBA * foreground-rgba Read / Write
gboolean foreground-set Read / Write
char * language Read / Write
gboolean language-set Read / Write
char * markup Write
int max-width-chars Read / Write
char * placeholder-text Read / Write
int rise Read / Write
gboolean rise-set Read / Write
double scale Read / Write
gboolean scale-set Read / Write
gboolean single-paragraph-mode Read / Write
int size Read / Write
double size-points Read / Write
gboolean size-set Read / Write
PangoStretch stretch Read / Write
gboolean stretch-set Read / Write
gboolean strikethrough Read / Write
gboolean strikethrough-set Read / Write
PangoStyle style Read / Write
gboolean style-set Read / Write
char * text Read / Write
PangoUnderline underline Read / Write
gboolean underline-set Read / Write
PangoVariant variant Read / Write
gboolean variant-set Read / Write
int weight Read / Write
gboolean weight-set Read / Write
int width-chars Read / Write
PangoWrapMode wrap-mode Read / Write
int wrap-width Read / Write

Signals

void edited Run Last

Types and Values

Object Hierarchy

    GObject
    ╰── GInitiallyUnowned
        ╰── GtkCellRenderer
            ╰── GtkCellRendererText
                ├── GtkCellRendererAccel
                ├── GtkCellRendererCombo
                ╰── GtkCellRendererSpin

Includes

#include <gtk/gtk.h>

Description

A GtkCellRendererText renders a given text in its cell, using the font, color and style information provided by its properties. The text will be ellipsized if it is too long and the “ellipsize” property allows it.

If the “mode” is GTK_CELL_RENDERER_MODE_EDITABLE, the GtkCellRendererText allows to edit its text using an entry.

Functions

gtk_cell_renderer_text_new ()

GtkCellRenderer *
gtk_cell_renderer_text_new (void);

Creates a new GtkCellRendererText. Adjust how text is drawn using object properties. Object properties can be set globally (with g_object_set()). Also, with GtkTreeViewColumn, you can bind a property to a value in a GtkTreeModel. For example, you can bind the “text” property on the cell renderer to a string value in the model, thus rendering a different string in each row of the GtkTreeView

Returns

the new cell renderer

gtk_cell_renderer_text_set_fixed_height_from_font ()

void
gtk_cell_renderer_text_set_fixed_height_from_font
                               (GtkCellRendererText *renderer,
                                gint number_of_rows);

Sets the height of a renderer to explicitly be determined by the “font” and “y_pad” property set on it. Further changes in these properties do not affect the height, so they must be accompanied by a subsequent call to this function. Using this function is unflexible, and should really only be used if calculating the size of a cell is too slow (ie, a massive number of cells displayed). If number_of_rows is -1, then the fixed height is unset, and the height is determined by the properties again.

Parameters

renderer

A GtkCellRendererText

number_of_rows

Number of rows of text each cell renderer is allocated, or -1

Types and Values

struct GtkCellRendererText

struct GtkCellRendererText;

Property Details

The “align-set” property

  “align-set”                gboolean

Whether this tag affects the alignment mode.

Owner: GtkCellRendererText

Flags: Read / Write

Default value: FALSE

The “alignment” property

  “alignment”                PangoAlignment

Specifies how to align the lines of text with respect to each other.

Note that this property describes how to align the lines of text in case there are several of them. The "xalign" property of GtkCellRenderer, on the other hand, sets the horizontal alignment of the whole text.

Owner: GtkCellRendererText

Flags: Read / Write

Default value: PANGO_ALIGN_LEFT

Since: 2.10

The “attributes” property

  “attributes”               PangoAttrList *

A list of style attributes to apply to the text of the renderer.

Owner: GtkCellRendererText

Flags: Read / Write

The “background” property

  “background”               char *

Background color as a string.

Owner: GtkCellRendererText

Flags: Write

Default value: NULL

The “background-gdk” property

  “background-gdk”           GdkColor *

Background color as a GdkColor

GtkCellRendererText:background-gdk has been deprecated since version 3.4 and should not be used in newly-written code.

Use “background-rgba” instead.

Owner: GtkCellRendererText

Flags: Read / Write

The “background-rgba” property

  “background-rgba”          GdkRGBA *

Background color as a GdkRGBA

Owner: GtkCellRendererText

Flags: Read / Write

Since: 3.0

The “background-set” property

  “background-set”           gboolean

Whether this tag affects the background color.

Owner: GtkCellRendererText

Flags: Read / Write

Default value: FALSE

The “editable” property

  “editable”                 gboolean

Whether the text can be modified by the user.

Owner: GtkCellRendererText

Flags: Read / Write

Default value: FALSE

The “editable-set” property

  “editable-set”             gboolean

Whether this tag affects text editability.

Owner: GtkCellRendererText

Flags: Read / Write

Default value: FALSE

The “ellipsize” property

  “ellipsize”                PangoEllipsizeMode

Specifies the preferred place to ellipsize the string, if the cell renderer does not have enough room to display the entire string. Setting it to PANGO_ELLIPSIZE_NONE turns off ellipsizing. See the wrap-width property for another way of making the text fit into a given width.

Owner: GtkCellRendererText

Flags: Read / Write

Default value: PANGO_ELLIPSIZE_NONE

Since: 2.6

The “ellipsize-set” property

  “ellipsize-set”            gboolean

Whether this tag affects the ellipsize mode.

Owner: GtkCellRendererText

Flags: Read / Write

Default value: FALSE

The “family” property

  “family”                   char *

Name of the font family, e.g. Sans, Helvetica, Times, Monospace.

Owner: GtkCellRendererText

Flags: Read / Write

Default value: NULL

The “family-set” property

  “family-set”               gboolean

Whether this tag affects the font family.

Owner: GtkCellRendererText

Flags: Read / Write

Default value: FALSE

The “font” property

  “font”                     char *

Font description as a string, e.g. "Sans Italic 12".

Owner: GtkCellRendererText

Flags: Read / Write

Default value: NULL

The “font-desc” property

  “font-desc”                PangoFontDescription *

Font description as a PangoFontDescription struct.

Owner: GtkCellRendererText

Flags: Read / Write

The “foreground” property

  “foreground”               char *

Foreground color as a string.

Owner: GtkCellRendererText

Flags: Write

Default value: NULL

The “foreground-gdk” property

  “foreground-gdk”           GdkColor *

Foreground color as a GdkColor

GtkCellRendererText:foreground-gdk has been deprecated since version 3.4 and should not be used in newly-written code.

Use “foreground-rgba” instead.

Owner: GtkCellRendererText

Flags: Read / Write

The “foreground-rgba” property

  “foreground-rgba”          GdkRGBA *

Foreground color as a GdkRGBA

Owner: GtkCellRendererText

Flags: Read / Write

Since: 3.0

The “foreground-set” property

  “foreground-set”           gboolean

Whether this tag affects the foreground color.

Owner: GtkCellRendererText

Flags: Read / Write

Default value: FALSE

The “language” property

  “language”                 char *

The language this text is in, as an ISO code. Pango can use this as a hint when rendering the text. If you don't understand this parameter, you probably don't need it.

Owner: GtkCellRendererText

Flags: Read / Write

Default value: NULL

The “language-set” property

  “language-set”             gboolean

Whether this tag affects the language the text is rendered as.

Owner: GtkCellRendererText

Flags: Read / Write

Default value: FALSE

The “markup” property

  “markup”                   char *

Marked up text to render.

Owner: GtkCellRendererText

Flags: Write

Default value: NULL

The “max-width-chars” property

  “max-width-chars”          int

The desired maximum width of the cell, in characters. If this property is set to -1, the width will be calculated automatically.

For cell renderers that ellipsize or wrap text; this property controls the maximum reported width of the cell. The cell should not receive any greater allocation unless it is set to expand in its GtkCellLayout and all of the cell's siblings have received their natural width.

Owner: GtkCellRendererText

Flags: Read / Write

Allowed values: >= -1

Default value: -1

Since: 3.0

The “placeholder-text” property

  “placeholder-text”         char *

The text that will be displayed in the GtkCellRenderer if “editable” is TRUE and the cell is empty.

Since 3.6

Owner: GtkCellRendererText

Flags: Read / Write

Default value: NULL

The “rise” property

  “rise”                     int

Offset of text above the baseline (below the baseline if rise is negative).

Owner: GtkCellRendererText

Flags: Read / Write

Allowed values: >= -2147483647

Default value: 0

The “rise-set” property

  “rise-set”                 gboolean

Whether this tag affects the rise.

Owner: GtkCellRendererText

Flags: Read / Write

Default value: FALSE

The “scale” property

  “scale”                    double

Font scaling factor.

Owner: GtkCellRendererText

Flags: Read / Write

Allowed values: >= 0

Default value: 1

The “scale-set” property

  “scale-set”                gboolean

Whether this tag scales the font size by a factor.

Owner: GtkCellRendererText

Flags: Read / Write

Default value: FALSE

The “single-paragraph-mode” property

  “single-paragraph-mode”    gboolean

Whether to keep all text in a single paragraph.

Owner: GtkCellRendererText

Flags: Read / Write

Default value: FALSE

The “size” property

  “size”                     int

Font size.

Owner: GtkCellRendererText

Flags: Read / Write

Allowed values: >= 0

Default value: 0

The “size-points” property

  “size-points”              double

Font size in points.

Owner: GtkCellRendererText

Flags: Read / Write

Allowed values: >= 0

Default value: 0

The “size-set” property

  “size-set”                 gboolean

Whether this tag affects the font size.

Owner: GtkCellRendererText

Flags: Read / Write

Default value: FALSE

The “stretch” property

  “stretch”                  PangoStretch

Font stretch.

Owner: GtkCellRendererText

Flags: Read / Write

Default value: PANGO_STRETCH_NORMAL

The “stretch-set” property

  “stretch-set”              gboolean

Whether this tag affects the font stretch.

Owner: GtkCellRendererText

Flags: Read / Write

Default value: FALSE

The “strikethrough” property

  “strikethrough”            gboolean

Whether to strike through the text.

Owner: GtkCellRendererText

Flags: Read / Write

Default value: FALSE

The “strikethrough-set” property

  “strikethrough-set”        gboolean

Whether this tag affects strikethrough.

Owner: GtkCellRendererText

Flags: Read / Write

Default value: FALSE

The “style” property

  “style”                    PangoStyle

Font style.

Owner: GtkCellRendererText

Flags: Read / Write

Default value: PANGO_STYLE_NORMAL

The “style-set” property

  “style-set”                gboolean

Whether this tag affects the font style.

Owner: GtkCellRendererText

Flags: Read / Write

Default value: FALSE

The “text” property

  “text”                     char *

Text to render.

Owner: GtkCellRendererText

Flags: Read / Write

Default value: NULL

The “underline” property

  “underline”                PangoUnderline

Style of underline for this text.

Owner: GtkCellRendererText

Flags: Read / Write

Default value: PANGO_UNDERLINE_NONE

The “underline-set” property

  “underline-set”            gboolean

Whether this tag affects underlining.

Owner: GtkCellRendererText

Flags: Read / Write

Default value: FALSE

The “variant” property

  “variant”                  PangoVariant

Font variant.

Owner: GtkCellRendererText

Flags: Read / Write

Default value: PANGO_VARIANT_NORMAL

The “variant-set” property

  “variant-set”              gboolean

Whether this tag affects the font variant.

Owner: GtkCellRendererText

Flags: Read / Write

Default value: FALSE

The “weight” property

  “weight”                   int

Font weight.

Owner: GtkCellRendererText

Flags: Read / Write

Allowed values: >= 0

Default value: 400

The “weight-set” property

  “weight-set”               gboolean

Whether this tag affects the font weight.

Owner: GtkCellRendererText

Flags: Read / Write

Default value: FALSE

The “width-chars” property

  “width-chars”              int

The desired width of the cell, in characters. If this property is set to -1, the width will be calculated automatically, otherwise the cell will request either 3 characters or the property value, whichever is greater.

Owner: GtkCellRendererText

Flags: Read / Write

Allowed values: >= -1

Default value: -1

Since: 2.6

The “wrap-mode” property

  “wrap-mode”                PangoWrapMode

Specifies how to break the string into multiple lines, if the cell renderer does not have enough room to display the entire string. This property has no effect unless the wrap-width property is set.

Owner: GtkCellRendererText

Flags: Read / Write

Default value: PANGO_WRAP_CHAR

Since: 2.8

The “wrap-width” property

  “wrap-width”               int

Specifies the minimum width at which the text is wrapped. The wrap-mode property can be used to influence at what character positions the line breaks can be placed. Setting wrap-width to -1 turns wrapping off.

Owner: GtkCellRendererText

Flags: Read / Write

Allowed values: >= -1

Default value: -1

Since: 2.8

Signal Details

The “edited” signal

void
user_function (GtkCellRendererText *renderer,
               char                *path,
               char                *new_text,
               gpointer             user_data)

This signal is emitted after renderer has been edited.

It is the responsibility of the application to update the model and store new_text at the position indicated by path .

Parameters

renderer

the object which received the signal

path

the path identifying the edited cell

new_text

the new text

user_data

user data set when the signal handler was connected.

Flags: Run Last

© 2005–2020 The GNOME Project
Licensed under the GNU Lesser General Public License version 2.1 or later.
https://developer.gnome.org/gtk3/3.24/GtkCellRendererText.html