[][src]Trait gtk::CellRendererExt

pub trait CellRendererExt: 'static {
    fn activate<P: IsA<Widget>>(
        &self,
        event: &Event,
        widget: &P,
        path: &str,
        background_area: &Rectangle,
        cell_area: &Rectangle,
        flags: CellRendererState
    ) -> bool;
fn get_aligned_area<P: IsA<Widget>>(
        &self,
        widget: &P,
        flags: CellRendererState,
        cell_area: &Rectangle
    ) -> Rectangle;
fn get_alignment(&self) -> (f32, f32);
fn get_fixed_size(&self) -> (i32, i32);
fn get_padding(&self) -> (i32, i32);
fn get_preferred_height<P: IsA<Widget>>(&self, widget: &P) -> (i32, i32);
fn get_preferred_height_for_width<P: IsA<Widget>>(
        &self,
        widget: &P,
        width: i32
    ) -> (i32, i32);
fn get_preferred_size<P: IsA<Widget>>(
        &self,
        widget: &P
    ) -> (Requisition, Requisition);
fn get_preferred_width<P: IsA<Widget>>(&self, widget: &P) -> (i32, i32);
fn get_preferred_width_for_height<P: IsA<Widget>>(
        &self,
        widget: &P,
        height: i32
    ) -> (i32, i32);
fn get_request_mode(&self) -> SizeRequestMode;
fn get_sensitive(&self) -> bool;
fn get_state<P: IsA<Widget>>(
        &self,
        widget: Option<&P>,
        cell_state: CellRendererState
    ) -> StateFlags;
fn get_visible(&self) -> bool;
fn is_activatable(&self) -> bool;
fn render<P: IsA<Widget>>(
        &self,
        cr: &Context,
        widget: &P,
        background_area: &Rectangle,
        cell_area: &Rectangle,
        flags: CellRendererState
    );
fn set_alignment(&self, xalign: f32, yalign: f32);
fn set_fixed_size(&self, width: i32, height: i32);
fn set_padding(&self, xpad: i32, ypad: i32);
fn set_sensitive(&self, sensitive: bool);
fn set_visible(&self, visible: bool);
fn start_editing<P: IsA<Widget>>(
        &self,
        event: Option<&Event>,
        widget: &P,
        path: &str,
        background_area: &Rectangle,
        cell_area: &Rectangle,
        flags: CellRendererState
    ) -> Option<CellEditable>;
fn stop_editing(&self, canceled: bool);
fn set_property_cell_background(&self, cell_background: Option<&str>);
fn get_property_cell_background_rgba(&self) -> Option<RGBA>;
fn set_property_cell_background_rgba(
        &self,
        cell_background_rgba: Option<&RGBA>
    );
fn get_property_cell_background_set(&self) -> bool;
fn set_property_cell_background_set(&self, cell_background_set: bool);
fn get_property_editing(&self) -> bool;
fn get_property_height(&self) -> i32;
fn set_property_height(&self, height: i32);
fn get_property_is_expanded(&self) -> bool;
fn set_property_is_expanded(&self, is_expanded: bool);
fn get_property_is_expander(&self) -> bool;
fn set_property_is_expander(&self, is_expander: bool);
fn get_property_mode(&self) -> CellRendererMode;
fn set_property_mode(&self, mode: CellRendererMode);
fn get_property_width(&self) -> i32;
fn set_property_width(&self, width: i32);
fn get_property_xalign(&self) -> f32;
fn set_property_xalign(&self, xalign: f32);
fn get_property_xpad(&self) -> u32;
fn set_property_xpad(&self, xpad: u32);
fn get_property_yalign(&self) -> f32;
fn set_property_yalign(&self, yalign: f32);
fn get_property_ypad(&self) -> u32;
fn set_property_ypad(&self, ypad: u32);
fn connect_editing_canceled<F: Fn(&Self) + 'static>(
        &self,
        f: F
    ) -> SignalHandlerId;
fn connect_editing_started<F: Fn(&Self, &CellEditable, TreePath) + 'static>(
        &self,
        f: F
    ) -> SignalHandlerId;
fn connect_property_cell_background_notify<F: Fn(&Self) + 'static>(
        &self,
        f: F
    ) -> SignalHandlerId;
fn connect_property_cell_background_rgba_notify<F: Fn(&Self) + 'static>(
        &self,
        f: F
    ) -> SignalHandlerId;
fn connect_property_cell_background_set_notify<F: Fn(&Self) + 'static>(
        &self,
        f: F
    ) -> SignalHandlerId;
fn connect_property_editing_notify<F: Fn(&Self) + 'static>(
        &self,
        f: F
    ) -> SignalHandlerId;
fn connect_property_height_notify<F: Fn(&Self) + 'static>(
        &self,
        f: F
    ) -> SignalHandlerId;
fn connect_property_is_expanded_notify<F: Fn(&Self) + 'static>(
        &self,
        f: F
    ) -> SignalHandlerId;
fn connect_property_is_expander_notify<F: Fn(&Self) + 'static>(
        &self,
        f: F
    ) -> SignalHandlerId;
fn connect_property_mode_notify<F: Fn(&Self) + 'static>(
        &self,
        f: F
    ) -> SignalHandlerId;
fn connect_property_sensitive_notify<F: Fn(&Self) + 'static>(
        &self,
        f: F
    ) -> SignalHandlerId;
fn connect_property_visible_notify<F: Fn(&Self) + 'static>(
        &self,
        f: F
    ) -> SignalHandlerId;
fn connect_property_width_notify<F: Fn(&Self) + 'static>(
        &self,
        f: F
    ) -> SignalHandlerId;
fn connect_property_xalign_notify<F: Fn(&Self) + 'static>(
        &self,
        f: F
    ) -> SignalHandlerId;
fn connect_property_xpad_notify<F: Fn(&Self) + 'static>(
        &self,
        f: F
    ) -> SignalHandlerId;
fn connect_property_yalign_notify<F: Fn(&Self) + 'static>(
        &self,
        f: F
    ) -> SignalHandlerId;
fn connect_property_ypad_notify<F: Fn(&Self) + 'static>(
        &self,
        f: F
    ) -> SignalHandlerId; }

Trait containing all CellRenderer methods.

Implementors

CellRendererPixbuf, CellRendererProgress, CellRendererSpinner, CellRendererText, CellRendererToggle, CellRenderer

Required methods

fn activate<P: IsA<Widget>>(
    &self,
    event: &Event,
    widget: &P,
    path: &str,
    background_area: &Rectangle,
    cell_area: &Rectangle,
    flags: CellRendererState
) -> bool

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

event

a GdkEvent

widget

widget that received the event

path

widget-dependent string representation of the event location; e.g. for TreeView, a string representation of TreePath

background_area

background area as passed to CellRendererExt::render

cell_area

cell area as passed to CellRendererExt::render

flags

render flags

Returns

true if the event was consumed/handled

fn get_aligned_area<P: IsA<Widget>>(
    &self,
    widget: &P,
    flags: CellRendererState,
    cell_area: &Rectangle
) -> Rectangle

Gets the aligned area used by self inside cell_area. Used for finding the appropriate edit and focus rectangle.

widget

the Widget this cell will be rendering to

flags

render flags

cell_area

cell area which would be passed to CellRendererExt::render

aligned_area

the return location for the space inside cell_area that would acually be used to render.

fn get_alignment(&self) -> (f32, f32)

Fills in xalign and yalign with the appropriate values of self.

xalign

location to fill in with the x alignment of the cell, or None

yalign

location to fill in with the y alignment of the cell, or None

fn get_fixed_size(&self) -> (i32, i32)

Fills in width and height with the appropriate size of self.

width

location to fill in with the fixed width of the cell, or None

height

location to fill in with the fixed height of the cell, or None

fn get_padding(&self) -> (i32, i32)

Fills in xpad and ypad with the appropriate values of self.

xpad

location to fill in with the x padding of the cell, or None

ypad

location to fill in with the y padding of the cell, or None

fn get_preferred_height<P: IsA<Widget>>(&self, widget: &P) -> (i32, i32)

Retreives a renderer’s natural size when rendered to widget.

widget

the Widget this cell will be rendering to

minimum_size

location to store the minimum size, or None

natural_size

location to store the natural size, or None

fn get_preferred_height_for_width<P: IsA<Widget>>(
    &self,
    widget: &P,
    width: i32
) -> (i32, i32)

Retreives a cell renderers’s minimum and natural height if it were rendered to widget with the specified width.

widget

the Widget this cell will be rendering to

width

the size which is available for allocation

minimum_height

location for storing the minimum size, or None

natural_height

location for storing the preferred size, or None

fn get_preferred_size<P: IsA<Widget>>(
    &self,
    widget: &P
) -> (Requisition, Requisition)

Retrieves the minimum and natural size of a cell taking into account the widget’s preference for height-for-width management.

widget

the Widget this cell will be rendering to

minimum_size

location for storing the minimum size, or None

natural_size

location for storing the natural size, or None

fn get_preferred_width<P: IsA<Widget>>(&self, widget: &P) -> (i32, i32)

Retreives a renderer’s natural size when rendered to widget.

widget

the Widget this cell will be rendering to

minimum_size

location to store the minimum size, or None

natural_size

location to store the natural size, or None

fn get_preferred_width_for_height<P: IsA<Widget>>(
    &self,
    widget: &P,
    height: i32
) -> (i32, i32)

Retreives a cell renderers’s minimum and natural width if it were rendered to widget with the specified height.

widget

the Widget this cell will be rendering to

height

the size which is available for allocation

minimum_width

location for storing the minimum size, or None

natural_width

location for storing the preferred size, or None

fn get_request_mode(&self) -> SizeRequestMode

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

Returns

The SizeRequestMode preferred by this renderer.

fn get_sensitive(&self) -> bool

Returns the cell renderer’s sensitivity.

Returns

true if the cell renderer is sensitive

fn get_state<P: IsA<Widget>>(
    &self,
    widget: Option<&P>,
    cell_state: CellRendererState
) -> StateFlags

Translates the cell renderer state to StateFlags, based on the cell renderer and widget sensitivity, and the given CellRendererState.

widget

a Widget, or None

cell_state

cell renderer state

Returns

the widget state flags applying to self

fn get_visible(&self) -> bool

Returns the cell renderer’s visibility.

Returns

true if the cell renderer is visible

fn is_activatable(&self) -> bool

Checks whether the cell renderer can do something when activated.

Returns

true if the cell renderer can do anything when activated

fn render<P: IsA<Widget>>(
    &self,
    cr: &Context,
    widget: &P,
    background_area: &Rectangle,
    cell_area: &Rectangle,
    flags: CellRendererState
)

Invokes the virtual render function of the CellRenderer. 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 CellRenderer 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.

cr

a cairo context to draw to

widget

the widget owning window

background_area

entire cell area (including tree expanders and maybe padding on the sides)

cell_area

area normally rendered by a cell renderer

flags

flags that affect rendering

fn set_alignment(&self, xalign: f32, yalign: f32)

Sets the renderer’s alignment within its available space.

xalign

the x alignment of the cell renderer

yalign

the y alignment of the cell renderer

fn set_fixed_size(&self, width: i32, height: i32)

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

width

the width of the cell renderer, or -1

height

the height of the cell renderer, or -1

fn set_padding(&self, xpad: i32, ypad: i32)

Sets the renderer’s padding.

xpad

the x padding of the cell renderer

ypad

the y padding of the cell renderer

fn set_sensitive(&self, sensitive: bool)

Sets the cell renderer’s sensitivity.

sensitive

the sensitivity of the cell

fn set_visible(&self, visible: bool)

Sets the cell renderer’s visibility.

visible

the visibility of the cell

fn start_editing<P: IsA<Widget>>(
    &self,
    event: Option<&Event>,
    widget: &P,
    path: &str,
    background_area: &Rectangle,
    cell_area: &Rectangle,
    flags: CellRendererState
) -> Option<CellEditable>

Starts editing the contents of this self, through a new CellEditable widget created by the CellRendererClass.start_editing virtual function.

event

a GdkEvent

widget

widget that received the event

path

widget-dependent string representation of the event location; e.g. for TreeView, a string representation of TreePath

background_area

background area as passed to CellRendererExt::render

cell_area

cell area as passed to CellRendererExt::render

flags

render flags

Returns

A new CellEditable for editing this self, or None if editing is not possible

fn stop_editing(&self, canceled: bool)

Informs the cell renderer that the editing is stopped. If canceled is true, the cell renderer will emit the CellRenderer::editing-canceled signal.

This function should be called by cell renderer implementations in response to the CellEditable::editing-done signal of CellEditable.

canceled

true if the editing has been canceled

fn set_property_cell_background(&self, cell_background: Option<&str>)

fn get_property_cell_background_rgba(&self) -> Option<RGBA>

Cell background as a gdk::RGBA

fn set_property_cell_background_rgba(&self, cell_background_rgba: Option<&RGBA>)

Cell background as a gdk::RGBA

fn get_property_cell_background_set(&self) -> bool

fn set_property_cell_background_set(&self, cell_background_set: bool)

fn get_property_editing(&self) -> bool

fn get_property_height(&self) -> i32

fn set_property_height(&self, height: i32)

fn get_property_is_expanded(&self) -> bool

fn set_property_is_expanded(&self, is_expanded: bool)

fn get_property_is_expander(&self) -> bool

fn set_property_is_expander(&self, is_expander: bool)

fn get_property_mode(&self) -> CellRendererMode

fn set_property_mode(&self, mode: CellRendererMode)

fn get_property_width(&self) -> i32

fn set_property_width(&self, width: i32)

fn get_property_xalign(&self) -> f32

fn set_property_xalign(&self, xalign: f32)

fn get_property_xpad(&self) -> u32

fn set_property_xpad(&self, xpad: u32)

fn get_property_yalign(&self) -> f32

fn set_property_yalign(&self, yalign: f32)

fn get_property_ypad(&self) -> u32

fn set_property_ypad(&self, ypad: u32)

fn connect_editing_canceled<F: Fn(&Self) + 'static>(
    &self,
    f: F
) -> SignalHandlerId

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: CellRendererExt::stop_editing.

fn connect_editing_started<F: Fn(&Self, &CellEditable, TreePath) + 'static>(
    &self,
    f: F
) -> SignalHandlerId

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 EntryCompletion or setting up additional columns in a ComboBox.

See CellEditable::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:

static void
text_editing_started (GtkCellRenderer *cell,
                      GtkCellEditable *editable,
                      const gchar     *path,
                      gpointer         data)
{
  if (GTK_IS_ENTRY (editable))
    {
      GtkEntry *entry = GTK_ENTRY (editable);

      // ... create a GtkEntryCompletion

      gtk_entry_set_completion (entry, completion);
    }
}

editable

the CellEditable

path

the path identifying the edited cell

fn connect_property_cell_background_notify<F: Fn(&Self) + 'static>(
    &self,
    f: F
) -> SignalHandlerId

fn connect_property_cell_background_rgba_notify<F: Fn(&Self) + 'static>(
    &self,
    f: F
) -> SignalHandlerId

fn connect_property_cell_background_set_notify<F: Fn(&Self) + 'static>(
    &self,
    f: F
) -> SignalHandlerId

fn connect_property_editing_notify<F: Fn(&Self) + 'static>(
    &self,
    f: F
) -> SignalHandlerId

fn connect_property_height_notify<F: Fn(&Self) + 'static>(
    &self,
    f: F
) -> SignalHandlerId

fn connect_property_is_expanded_notify<F: Fn(&Self) + 'static>(
    &self,
    f: F
) -> SignalHandlerId

fn connect_property_is_expander_notify<F: Fn(&Self) + 'static>(
    &self,
    f: F
) -> SignalHandlerId

fn connect_property_mode_notify<F: Fn(&Self) + 'static>(
    &self,
    f: F
) -> SignalHandlerId

fn connect_property_sensitive_notify<F: Fn(&Self) + 'static>(
    &self,
    f: F
) -> SignalHandlerId

fn connect_property_visible_notify<F: Fn(&Self) + 'static>(
    &self,
    f: F
) -> SignalHandlerId

fn connect_property_width_notify<F: Fn(&Self) + 'static>(
    &self,
    f: F
) -> SignalHandlerId

fn connect_property_xalign_notify<F: Fn(&Self) + 'static>(
    &self,
    f: F
) -> SignalHandlerId

fn connect_property_xpad_notify<F: Fn(&Self) + 'static>(
    &self,
    f: F
) -> SignalHandlerId

fn connect_property_yalign_notify<F: Fn(&Self) + 'static>(
    &self,
    f: F
) -> SignalHandlerId

fn connect_property_ypad_notify<F: Fn(&Self) + 'static>(
    &self,
    f: F
) -> SignalHandlerId

Loading content...

Implementors

impl<O: IsA<CellRenderer>> CellRendererExt for O[src]

Loading content...