Basics

Guides

API Reference

Menu

Basics

Guides

API Reference

class: CellRenderer

[40:7] extends: object

An object for rendering a single cell The GtkCellRenderer is a base class of a set of objects used for rendering a cell to a cairo_t. These objects are used primarily by the GtkTreeView widget, though they aren’t tied to them in any specific way. It is worth noting that GtkCellRenderer is not a GtkWidget and cannot be treated as such. The primary use of a GtkCellRenderer is for drawing a certain graphical elements on a cairo_t. Typically, one cell renderer is used to draw many cells on the screen. To this extent, it isn’t expected that a CellRenderer keep any permanent state around. Instead, any state is set just prior to use using GObjects property system. Then, the cell is measured using gtk_cell_renderer_get_preferred_size(). Finally, the cell is rendered in the correct location using gtk_cell_renderer_snapshot(). There are a number of rules that must be followed when writing a new GtkCellRenderer. First and foremost, it’s important that a certain set of properties will always yield a cell renderer of the same size, barring a style change. The GtkCellRenderer also has a number of generic properties that are expected to be honored by all children. Beyond merely rendering a cell, cell renderers can optionally provide active user interface elements. A cell renderer can be “activatable” like GtkCellRendererToggle, which toggles when it gets activated by a mouse click, or it can be “editable” like GtkCellRendererText, which allows the user to edit the text using a widget implementing the GtkCellEditable interface, e.g. GtkEntry. To make a cell renderer activatable or editable, you have to implement the GtkCellRendererClass.activate or GtkCellRendererClass.start_editing virtual functions, respectively. Many properties of GtkCellRenderer and its subclasses have a corresponding “set” property, e.g. “cell-background-set” corresponds to “cell-background”. These “set” properties reflect whether a property has been set or not. You should not set them independently.

Members

  • handleObj
  • lib
  • retainedCallbacks
  • signalHandlerNames
  • signalSetterHandlers

Methods

  • CellRenderer (Handle = null)

    Creates a new CellRenderer by wrapping a native handle or another wrapper.

    • @p Handle is the native handle or another wrapper whose handle to adopt.
  • toNativeHandle (Source)

    Normalizes a constructor argument into a raw pointer carrier. Accepts a raw NativeHandle, a raw NativeBuffer returned from fn.call(...), another generated wrapper exposing handle(), or null. Returns null when the argument carries no pointer.

    • @p Source is the raw handle, raw buffer, wrapper, or null.
    • @r A raw pointer carrier or null when no pointer is present.
  • getLib ()

    Returns the opened native library for this generated wrapper.

    • @r The opened native library.
  • handle ()

    Returns the wrapped NativeHandle.

    • @r The wrapped NativeHandle.
  • isNull ()

    Returns true when the wrapped handle is null.

    • @r A bool.
  • describe ()

    Returns a small string for debugging generated wrappers.

    • @r A string.
  • asInitiallyUnowned ()

    Wraps this handle as InitiallyUnowned.

    • @r A InitiallyUnowned object.
  • connectSignal (string Name, CallbackObj)

    Connects one generated callback wrapper to a named signal.

    • @p Name is the signal name.
    • @p CallbackObj is the generated callback wrapper to connect.
    • @r The connected handler id.
  • disconnectSignalHandler (int HandlerId)

    Disconnects one retained signal handler id.

    • @p HandlerId is the signal handler id to disconnect.
    • @r None.
  • setOnEditingcanceled (callback Fn, UserData = null)

    This signal gets emitted when the user cancels the process of editing a cell. For example, an editable cell renderer could be written to cancel editing when the user presses Escape. See also: gtk_cell_renderer_stop_editing().

    • @p Fn is the Aussom callback.
    • @p Fn is called with (CellRenderer Self).
    • @p UserData is retained and passed through to the generated callback wrapper when provided.
    • @r The connected handler id.
  • setOnEditingstarted (callback Fn, UserData = null)

    This signal gets emitted when a cell starts to be edited. The intended use of this signal is to do special setup on @editable, e.g. adding a GtkEntryCompletion or setting up additional columns in a GtkComboBox. See gtk_cell_editable_start_editing() for information on the lifecycle of the @editable and a way to do setup that doesn’t depend on the @renderer. Note that GTK doesn't guarantee that cell renderers will continue to use the same kind of widget for editing in future releases, therefore you should check the type of @editable before doing any specific setup, as in the following example: c static void text_editing_started (GtkCellRenderer *cell, GtkCellEditable *editable, const char *path, gpointer data) { if (GTK_IS_ENTRY (editable)) { GtkEntry *entry = GTK_ENTRY (editable); // ... create a GtkEntryCompletion gtk_entry_set_completion (entry, completion); } }

    • @p Fn is the Aussom callback.
    • @p Fn is called with (CellRenderer Self, CellEditable Editable, string Path).
    • @p UserData is retained and passed through to the generated callback wrapper when provided.
    • @r The connected handler id.
  • getProperty (string Name)

    Reads one generated property by name.

  • setProperty (string Name, Value)

    Writes one generated property by name.

  • setCellbackground (string Value)

    Writes the cell-background property.

    • @p Value is the new property value.
    • @r None.
  • setCellbackgroundset (bool Value)

    Writes the cell-background-set property.

    • @p Value is the new property value.
    • @r None.
  • setHeight (int Value)

    Writes the height property.

    • @p Value is the new property value.
    • @r None.
  • setIsexpanded (bool Value)

    Writes the is-expanded property.

    • @p Value is the new property value.
    • @r None.
  • setIsexpander (bool Value)

    Writes the is-expander property.

    • @p Value is the new property value.
    • @r None.
  • setMode (string Value)

    Writes the mode property.

    • @p Value is the new property value.
    • @r None.
  • setSensitive (bool Value)

    Writes the sensitive property.

    • @p Value is the new property value.
    • @r None.
  • setVisible (bool Value)

    Writes the visible property.

    • @p Value is the new property value.
    • @r None.
  • setWidth (int Value)

    Writes the width property.

    • @p Value is the new property value.
    • @r None.
  • setXalign (double Value)

    Writes the xalign property.

    • @p Value is the new property value.
    • @r None.
  • setXpad (int Value)

    Writes the xpad property.

    • @p Value is the new property value.
    • @r None.
  • setYalign (double Value)

    Writes the yalign property.

    • @p Value is the new property value.
    • @r None.
  • setYpad (int Value)

    Writes the ypad property.

    • @p Value is the new property value.
    • @r None.
  • activate (object event, object widget, string path, background_area, cell_area, string flags)

    Passes an activate event to the cell renderer for possible processing. Some cell renderers may use events; for example, GtkCellRendererToggle toggles when it gets a mouse click.

    • @p event is a GdkEvent.
    • @p widget is widget that received the event.
    • @p path is widget-dependent string representation of the event location; e.g. for GtkTreeView, a string representation of GtkTreePath.
    • @p background_area is background area as passed to gtk_cell_renderer_render().
    • @p cell_area is cell area as passed to gtk_cell_renderer_render().
    • @p flags is render flags.
  • get_is_expanded ()

    Checks whether the given GtkCellRenderer is expanded.

  • get_is_expander ()

    Checks whether the given GtkCellRenderer is an expander.

  • get_request_mode ()

    Gets whether the cell renderer prefers a height-for-width layout or a width-for-height layout.

  • get_sensitive ()

    Returns the cell renderer’s sensitivity.

  • get_state (object widget, string cell_state)

    Translates the cell renderer state to GtkStateFlags, based on the cell renderer and widget sensitivity, and the given GtkCellRendererState.

    • @p widget is a GtkWidget.
    • @p cell_state is cell renderer state.
  • get_visible ()

    Returns the cell renderer’s visibility.

  • is_activatable ()

    Checks whether the cell renderer can do something when activated.

  • set_alignment (double xalign, double yalign)

    Sets the renderer’s alignment within its available space.

    • @p xalign is the x alignment of the cell renderer.
    • @p yalign is the y alignment of the cell renderer.
    • @r None.
  • set_fixed_size (int width, int height)

    Sets the renderer size to be explicit, independent of the properties set.

    • @p width is the width of the cell renderer, or -1.
    • @p height is the height of the cell renderer, or -1.
    • @r None.
  • set_is_expanded (bool is_expanded)

    Sets whether the given GtkCellRenderer is expanded.

    • @p is_expanded is whether @cell should be expanded.
    • @r None.
  • set_is_expander (bool is_expander)

    Sets whether the given GtkCellRenderer is an expander.

    • @p is_expander is whether @cell is an expander.
    • @r None.
  • set_padding (int xpad, int ypad)

    Sets the renderer’s padding.

    • @p xpad is the x padding of the cell renderer.
    • @p ypad is the y padding of the cell renderer.
    • @r None.
  • set_sensitive (bool sensitive)

    Sets the cell renderer’s sensitivity.

    • @p sensitive is the sensitivity of the cell.
    • @r None.
  • set_visible (bool visible)

    Sets the cell renderer’s visibility.

    • @p visible is the visibility of the cell.
    • @r None.
  • snapshot (object snapshot, object widget, background_area, cell_area, string flags)

    Invokes the virtual render function of the GtkCellRenderer. The three passed-in rectangles are areas in @cr. Most renderers will draw within

    • @cell_area; the xalign, yalign, xpad, and ypad fields of the GtkCellRenderer should be honored with respect to @cell_area.
    • @background_area includes the blank space around the cell, and also the area containing the tree expander; so the @background_area rectangles for all cells tile to cover the entire @window.
    • @p snapshot is a GtkSnapshot to draw to.
    • @p widget is the widget owning @window.
    • @p background_area is entire cell area (including tree expanders and maybe padding on the sides).
    • @p cell_area is area normally rendered by a cell renderer.
    • @p flags is flags that affect rendering.
    • @r None.
  • start_editing (object event, object widget, string path, background_area, cell_area, string flags)

    Starts editing the contents of this @cell, through a new GtkCellEditable widget created by the GtkCellRendererClass.start_editing virtual function.

    • @p event is a GdkEvent.
    • @p widget is widget that received the event.
    • @p path is widget-dependent string representation of the event location; e.g. for GtkTreeView, a string representation of GtkTreePath.
    • @p background_area is background area as passed to gtk_cell_renderer_render().
    • @p cell_area is cell area as passed to gtk_cell_renderer_render().
    • @p flags is render flags.
  • stop_editing (bool canceled)

    Informs the cell renderer that the editing is stopped. If @canceled is %TRUE, the cell renderer will emit the GtkCellRenderer::editing-canceled signal. This function should be called by cell renderer implementations in response to the GtkCellEditable::editing-done signal of GtkCellEditable.

    • @p canceled is %TRUE if the editing has been canceled.
    • @r None.

class: CellRendererMeta

[782:14] static extends: object

Generated metadata helpers for CellRenderer class surfaces.

Methods

  • properties ()

    Returns property metadata for CellRenderer.

    • @r A list.
  • signals ()

    Returns signal metadata for CellRenderer.

    • @r A list.

class: CellRendererEditingcanceledCallback

[641:7] extends: object

Generated low-level callback wrapper for GIR callback editing-canceled.

Members

  • callbackObj
  • userFn
  • userData
  • hasUserData

Methods

  • CellRendererEditingcanceledCallback (callback Fn, UserData = null)

    Creates one native callback wrapper. The wrapper owns a trampoline that converts native pointers into generated wrapper objects before invoking Fn.

    • @p Fn is the Aussom callback implementation.
    • @p UserData is retained and passed through to Fn on each invocation when provided.
  • trampoline (nativeSelf, nativeUserData)

    Internal trampoline. Converts native pointer arguments into generated wrapper instances, then invokes the user's callback.

  • callback ()

    Returns the wrapped NativeCallback.

  • handle ()

    Returns the callback as a NativeHandle.

  • close ()

    Closes the underlying NativeCallback.

  • isClosed ()

    Returns true when the callback has been closed.

class: CellRendererEditingstartedCallback

[711:7] extends: object

Generated low-level callback wrapper for GIR callback editing-started.

Members

  • callbackObj
  • userFn
  • userData
  • hasUserData

Methods

  • CellRendererEditingstartedCallback (callback Fn, UserData = null)

    Creates one native callback wrapper. The wrapper owns a trampoline that converts native pointers into generated wrapper objects before invoking Fn.

    • @p Fn is the Aussom callback implementation.
    • @p UserData is retained and passed through to Fn on each invocation when provided.
  • trampoline (nativeSelf, editable, path, nativeUserData)

    Internal trampoline. Converts native pointer arguments into generated wrapper instances, then invokes the user's callback.

  • callback ()

    Returns the wrapped NativeCallback.

  • handle ()

    Returns the callback as a NativeHandle.

  • close ()

    Closes the underlying NativeCallback.

  • isClosed ()

    Returns true when the callback has been closed.