Trait gtk4::prelude::CellRendererExt
source · pub trait CellRendererExt: IsA<CellRenderer> + Sealed + 'static {
Show 63 methods
// Provided methods
fn activate(
&self,
event: impl AsRef<Event>,
widget: &impl IsA<Widget>,
path: &str,
background_area: &Rectangle,
cell_area: &Rectangle,
flags: CellRendererState
) -> bool { ... }
fn aligned_area(
&self,
widget: &impl IsA<Widget>,
flags: CellRendererState,
cell_area: &Rectangle
) -> Rectangle { ... }
fn alignment(&self) -> (f32, f32) { ... }
fn fixed_size(&self) -> (i32, i32) { ... }
fn is_expanded(&self) -> bool { ... }
fn is_expander(&self) -> bool { ... }
fn padding(&self) -> (i32, i32) { ... }
fn preferred_height(&self, widget: &impl IsA<Widget>) -> (i32, i32) { ... }
fn preferred_height_for_width(
&self,
widget: &impl IsA<Widget>,
width: i32
) -> (i32, i32) { ... }
fn preferred_size(
&self,
widget: &impl IsA<Widget>
) -> (Requisition, Requisition) { ... }
fn preferred_width(&self, widget: &impl IsA<Widget>) -> (i32, i32) { ... }
fn preferred_width_for_height(
&self,
widget: &impl IsA<Widget>,
height: i32
) -> (i32, i32) { ... }
fn request_mode(&self) -> SizeRequestMode { ... }
fn is_sensitive(&self) -> bool { ... }
fn state(
&self,
widget: Option<&impl IsA<Widget>>,
cell_state: CellRendererState
) -> StateFlags { ... }
fn is_visible(&self) -> bool { ... }
fn is_activatable(&self) -> bool { ... }
fn set_alignment(&self, xalign: f32, yalign: f32) { ... }
fn set_fixed_size(&self, width: i32, height: i32) { ... }
fn set_is_expanded(&self, is_expanded: bool) { ... }
fn set_is_expander(&self, is_expander: bool) { ... }
fn set_padding(&self, xpad: i32, ypad: i32) { ... }
fn set_sensitive(&self, sensitive: bool) { ... }
fn set_visible(&self, visible: bool) { ... }
fn snapshot(
&self,
snapshot: &impl IsA<Snapshot>,
widget: &impl IsA<Widget>,
background_area: &Rectangle,
cell_area: &Rectangle,
flags: CellRendererState
) { ... }
fn start_editing(
&self,
event: Option<impl AsRef<Event>>,
widget: &impl IsA<Widget>,
path: &str,
background_area: &Rectangle,
cell_area: &Rectangle,
flags: CellRendererState
) -> Option<CellEditable> { ... }
fn stop_editing(&self, canceled: bool) { ... }
fn set_cell_background(&self, cell_background: Option<&str>) { ... }
fn cell_background_rgba(&self) -> Option<RGBA> { ... }
fn set_cell_background_rgba(&self, cell_background_rgba: Option<&RGBA>) { ... }
fn is_cell_background_set(&self) -> bool { ... }
fn is_editing(&self) -> bool { ... }
fn height(&self) -> i32 { ... }
fn set_height(&self, height: i32) { ... }
fn mode(&self) -> CellRendererMode { ... }
fn set_mode(&self, mode: CellRendererMode) { ... }
fn width(&self) -> i32 { ... }
fn set_width(&self, width: i32) { ... }
fn xalign(&self) -> f32 { ... }
fn set_xalign(&self, xalign: f32) { ... }
fn xpad(&self) -> u32 { ... }
fn set_xpad(&self, xpad: u32) { ... }
fn yalign(&self) -> f32 { ... }
fn set_yalign(&self, yalign: f32) { ... }
fn ypad(&self) -> u32 { ... }
fn set_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_cell_background_notify<F: Fn(&Self) + 'static>(
&self,
f: F
) -> SignalHandlerId { ... }
fn connect_cell_background_rgba_notify<F: Fn(&Self) + 'static>(
&self,
f: F
) -> SignalHandlerId { ... }
fn connect_cell_background_set_notify<F: Fn(&Self) + 'static>(
&self,
f: F
) -> SignalHandlerId { ... }
fn connect_editing_notify<F: Fn(&Self) + 'static>(
&self,
f: F
) -> SignalHandlerId { ... }
fn connect_height_notify<F: Fn(&Self) + 'static>(
&self,
f: F
) -> SignalHandlerId { ... }
fn connect_is_expanded_notify<F: Fn(&Self) + 'static>(
&self,
f: F
) -> SignalHandlerId { ... }
fn connect_is_expander_notify<F: Fn(&Self) + 'static>(
&self,
f: F
) -> SignalHandlerId { ... }
fn connect_mode_notify<F: Fn(&Self) + 'static>(
&self,
f: F
) -> SignalHandlerId { ... }
fn connect_sensitive_notify<F: Fn(&Self) + 'static>(
&self,
f: F
) -> SignalHandlerId { ... }
fn connect_visible_notify<F: Fn(&Self) + 'static>(
&self,
f: F
) -> SignalHandlerId { ... }
fn connect_width_notify<F: Fn(&Self) + 'static>(
&self,
f: F
) -> SignalHandlerId { ... }
fn connect_xalign_notify<F: Fn(&Self) + 'static>(
&self,
f: F
) -> SignalHandlerId { ... }
fn connect_xpad_notify<F: Fn(&Self) + 'static>(
&self,
f: F
) -> SignalHandlerId { ... }
fn connect_yalign_notify<F: Fn(&Self) + 'static>(
&self,
f: F
) -> SignalHandlerId { ... }
fn connect_ypad_notify<F: Fn(&Self) + 'static>(
&self,
f: F
) -> SignalHandlerId { ... }
}
Expand description
Trait containing all CellRenderer
methods.
§Implementors
CellRendererPixbuf
, CellRendererProgress
, CellRendererSpinner
, CellRendererText
, CellRendererToggle
, CellRenderer
Provided Methods§
sourcefn activate(
&self,
event: impl AsRef<Event>,
widget: &impl IsA<Widget>,
path: &str,
background_area: &Rectangle,
cell_area: &Rectangle,
flags: CellRendererState
) -> bool
👎Deprecated: Since 4.10
fn activate( &self, event: impl AsRef<Event>, widget: &impl IsA<Widget>, 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.
§Deprecated since 4.10
§event
§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 gtk_cell_renderer_render()
§cell_area
cell area as passed to gtk_cell_renderer_render()
§flags
render flags
§Returns
true
if the event was consumed/handled
sourcefn aligned_area(
&self,
widget: &impl IsA<Widget>,
flags: CellRendererState,
cell_area: &Rectangle
) -> Rectangle
👎Deprecated: Since 4.10
fn aligned_area( &self, widget: &impl IsA<Widget>, 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.
§Deprecated since 4.10
§widget
the Widget
this cell will be rendering to
§flags
render flags
§cell_area
cell area which would be passed to gtk_cell_renderer_render()
§Returns
§aligned_area
the return location for the space inside @cell_area that would actually be used to render.
sourcefn fixed_size(&self) -> (i32, i32)
👎Deprecated: Since 4.10
fn fixed_size(&self) -> (i32, i32)
sourcefn is_expanded(&self) -> bool
👎Deprecated: Since 4.10
fn is_expanded(&self) -> bool
Checks whether the given CellRenderer
is expanded.
§Deprecated since 4.10
§Returns
true
if the cell renderer is expanded
sourcefn is_expander(&self) -> bool
👎Deprecated: Since 4.10
fn is_expander(&self) -> bool
sourcefn preferred_height_for_width(
&self,
widget: &impl IsA<Widget>,
width: i32
) -> (i32, i32)
👎Deprecated: Since 4.10
fn preferred_height_for_width( &self, widget: &impl IsA<Widget>, width: i32 ) -> (i32, i32)
Retrieves a cell renderers’s minimum and natural height if it were rendered to @widget with the specified @width.
§Deprecated since 4.10
§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
§natural_height
location for storing the preferred size
sourcefn preferred_size(
&self,
widget: &impl IsA<Widget>
) -> (Requisition, Requisition)
👎Deprecated: Since 4.10
fn preferred_size( &self, widget: &impl IsA<Widget> ) -> (Requisition, Requisition)
Retrieves the minimum and natural size of a cell taking into account the widget’s preference for height-for-width management.
§Deprecated since 4.10
§widget
the Widget
this cell will be rendering to
§Returns
§minimum_size
location for storing the minimum size
§natural_size
location for storing the natural size
sourcefn preferred_width_for_height(
&self,
widget: &impl IsA<Widget>,
height: i32
) -> (i32, i32)
👎Deprecated: Since 4.10
fn preferred_width_for_height( &self, widget: &impl IsA<Widget>, height: i32 ) -> (i32, i32)
Retrieves a cell renderers’s minimum and natural width if it were rendered to @widget with the specified @height.
§Deprecated since 4.10
§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
§natural_width
location for storing the preferred size
sourcefn request_mode(&self) -> SizeRequestMode
👎Deprecated: Since 4.10
fn request_mode(&self) -> SizeRequestMode
Gets whether the cell renderer prefers a height-for-width layout or a width-for-height layout.
§Deprecated since 4.10
§Returns
The SizeRequestMode
preferred by this renderer.
sourcefn is_sensitive(&self) -> bool
👎Deprecated: Since 4.10
fn is_sensitive(&self) -> bool
sourcefn state(
&self,
widget: Option<&impl IsA<Widget>>,
cell_state: CellRendererState
) -> StateFlags
👎Deprecated: Since 4.10
fn state( &self, widget: Option<&impl IsA<Widget>>, cell_state: CellRendererState ) -> StateFlags
Translates the cell renderer state to StateFlags
,
based on the cell renderer and widget sensitivity, and
the given CellRenderer
State.
§Deprecated since 4.10
§widget
a Widget
§cell_state
cell renderer state
§Returns
the widget state flags applying to @self
sourcefn is_visible(&self) -> bool
👎Deprecated: Since 4.10
fn is_visible(&self) -> bool
sourcefn is_activatable(&self) -> bool
👎Deprecated: Since 4.10
fn is_activatable(&self) -> bool
sourcefn set_alignment(&self, xalign: f32, yalign: f32)
👎Deprecated: Since 4.10
fn set_alignment(&self, xalign: f32, yalign: f32)
sourcefn set_fixed_size(&self, width: i32, height: i32)
👎Deprecated: Since 4.10
fn set_fixed_size(&self, width: i32, height: i32)
sourcefn set_is_expanded(&self, is_expanded: bool)
👎Deprecated: Since 4.10
fn set_is_expanded(&self, is_expanded: bool)
Sets whether the given CellRenderer
is expanded.
§Deprecated since 4.10
§is_expanded
whether @self should be expanded
sourcefn set_is_expander(&self, is_expander: bool)
👎Deprecated: Since 4.10
fn set_is_expander(&self, is_expander: bool)
Sets whether the given CellRenderer
is an expander.
§Deprecated since 4.10
§is_expander
whether @self is an expander
sourcefn set_padding(&self, xpad: i32, ypad: i32)
👎Deprecated: Since 4.10
fn set_padding(&self, xpad: i32, ypad: i32)
sourcefn set_sensitive(&self, sensitive: bool)
👎Deprecated: Since 4.10
fn set_sensitive(&self, sensitive: bool)
sourcefn set_visible(&self, visible: bool)
👎Deprecated: Since 4.10
fn set_visible(&self, visible: bool)
sourcefn snapshot(
&self,
snapshot: &impl IsA<Snapshot>,
widget: &impl IsA<Widget>,
background_area: &Rectangle,
cell_area: &Rectangle,
flags: CellRendererState
)
👎Deprecated: Since 4.10
fn snapshot( &self, snapshot: &impl IsA<Snapshot>, widget: &impl IsA<Widget>, 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.
§Deprecated since 4.10
§snapshot
a Snapshot
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
sourcefn start_editing(
&self,
event: Option<impl AsRef<Event>>,
widget: &impl IsA<Widget>,
path: &str,
background_area: &Rectangle,
cell_area: &Rectangle,
flags: CellRendererState
) -> Option<CellEditable>
👎Deprecated: Since 4.10
fn start_editing( &self, event: Option<impl AsRef<Event>>, widget: &impl IsA<Widget>, 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 CellRenderer
Class.start_editing virtual function.
§Deprecated since 4.10
§event
§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 gtk_cell_renderer_render()
§cell_area
cell area as passed to gtk_cell_renderer_render()
§flags
render flags
§Returns
A new CellEditable
for editing this
@self, or None
if editing is not possible
sourcefn stop_editing(&self, canceled: bool)
👎Deprecated: Since 4.10
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 GtkCellEditable::editing-done
signal of
CellEditable
.
§Deprecated since 4.10
§canceled
true
if the editing has been canceled
fn set_cell_background(&self, cell_background: Option<&str>)
sourcefn cell_background_rgba(&self) -> Option<RGBA>
👎Deprecated: Since 4.10
fn cell_background_rgba(&self) -> Option<RGBA>
Cell background as a gdk::RGBA
sourcefn set_cell_background_rgba(&self, cell_background_rgba: Option<&RGBA>)
👎Deprecated: Since 4.10
fn set_cell_background_rgba(&self, cell_background_rgba: Option<&RGBA>)
Cell background as a gdk::RGBA
fn is_cell_background_set(&self) -> bool
fn is_editing(&self) -> bool
fn height(&self) -> i32
fn set_height(&self, height: i32)
fn mode(&self) -> CellRendererMode
fn set_mode(&self, mode: CellRendererMode)
fn width(&self) -> i32
fn set_width(&self, width: i32)
fn xalign(&self) -> f32
fn set_xalign(&self, xalign: f32)
fn xpad(&self) -> u32
fn set_xpad(&self, xpad: u32)
fn yalign(&self) -> f32
fn set_yalign(&self, yalign: f32)
fn ypad(&self) -> u32
fn set_ypad(&self, ypad: u32)
sourcefn connect_editing_canceled<F: Fn(&Self) + 'static>(
&self,
f: F
) -> SignalHandlerId
👎Deprecated: Since 4.10
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: gtk_cell_renderer_stop_editing().
sourcefn connect_editing_started<F: Fn(&Self, &CellEditable, TreePath) + 'static>(
&self,
f: F
) -> SignalHandlerId
👎Deprecated: Since 4.10
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 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:
⚠️ The following code is in 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);
}
}
§editable
the CellEditable
§path
the path identifying the edited cell