Skip to main content

CellRendererImpl

Trait CellRendererImpl 

Source
pub trait CellRendererImpl: CellRendererImplExt + ObjectImpl {
    // Provided methods
    fn request_mode(&self) -> SizeRequestMode { ... }
    fn preferred_width<P: IsA<Widget>>(&self, widget: &P) -> (i32, i32) { ... }
    fn preferred_width_for_height<P: IsA<Widget>>(
        &self,
        widget: &P,
        height: i32,
    ) -> (i32, i32) { ... }
    fn preferred_height<P: IsA<Widget>>(&self, widget: &P) -> (i32, i32) { ... }
    fn preferred_height_for_width<P: IsA<Widget>>(
        &self,
        widget: &P,
        width: i32,
    ) -> (i32, i32) { ... }
    fn aligned_area<P: IsA<Widget>>(
        &self,
        widget: &P,
        flags: CellRendererState,
        cell_area: &Rectangle,
    ) -> Rectangle { ... }
    fn render<P: IsA<Widget>>(
        &self,
        cr: &Context,
        widget: &P,
        background_area: &Rectangle,
        cell_area: &Rectangle,
        flags: CellRendererState,
    ) { ... }
    fn activate<P: IsA<Widget>>(
        &self,
        event: Option<&Event>,
        widget: &P,
        path: &str,
        background_area: &Rectangle,
        cell_area: &Rectangle,
        flags: CellRendererState,
    ) -> 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 editing_canceled(&self) { ... }
    fn editing_started(&self, editable: &CellEditable, path: &str) { ... }
}

Provided Methods§

Source

fn 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.

Source

fn 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

§Returns
§minimum_size

location to store the minimum size, or None

§natural_size

location to store the natural size, or None

Source

fn 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

§Returns
§minimum_width

location for storing the minimum size, or None

§natural_width

location for storing the preferred size, or None

Source

fn 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

§Returns
§minimum_size

location to store the minimum size, or None

§natural_size

location to store the natural size, or None

Source

fn 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

§Returns
§minimum_height

location for storing the minimum size, or None

§natural_height

location for storing the preferred size, or None

Source

fn 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()

§Returns
§aligned_area

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

Source

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

Source

fn activate<P: IsA<Widget>>( &self, event: Option<&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

Source

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 GtkCellRendererClass.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

Source

fn editing_canceled(&self)

Source

fn editing_started(&self, editable: &CellEditable, path: &str)

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§