Class CellRenderer
- All Implemented Interfaces:
Proxy
- Direct Known Subclasses:
CellRenderer.CellRendererImpl
,CellRendererPixbuf
,CellRendererProgress
,CellRendererSpinner
,CellRendererText
,CellRendererToggle
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 GObject
s 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 GtkCellRenderer
Toggle,
which toggles when it gets activated by a mouse click, or it can be
“editable” like GtkCellRenderer
Text, 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 GtkCellRenderer
Class.activate or
GtkCellRenderer
Class.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.
-
Nested Class Summary
Modifier and TypeClassDescriptionstatic class
CellRenderer.Builder<B extends CellRenderer.Builder<B>>
Deprecated.Inner class implementing a builder pattern to construct a GObject with properties.static class
Deprecated.static class
Deprecated.The CellRendererImpl type represents a native instance of the abstract CellRenderer class.static interface
Deprecated.Functional interface declaration of theEditingCanceledCallback
callback.static interface
Deprecated.Functional interface declaration of theEditingStartedCallback
callback.Nested classes/interfaces inherited from class org.gnome.gobject.InitiallyUnowned
InitiallyUnowned.InitiallyUnownedClass
Nested classes/interfaces inherited from class org.gnome.gobject.GObject
GObject.NotifyCallback, GObject.ObjectClass
-
Constructor Summary
ConstructorDescriptionCellRenderer
(MemorySegment address) Deprecated.Create a CellRenderer proxy instance for the provided memory address. -
Method Summary
Modifier and TypeMethodDescriptionboolean
activate
(Event event, Widget widget, String path, Rectangle backgroundArea, Rectangle cellArea, Set<CellRendererState> flags) Deprecated.boolean
activate
(Event event, Widget widget, String path, Rectangle backgroundArea, Rectangle cellArea, CellRendererState... flags) Deprecated.protected CellRenderer
asParent()
Deprecated.Returns this instance as if it were its parent type.static CellRenderer.Builder
<? extends CellRenderer.Builder> builder()
Deprecated.ACellRenderer.Builder
object constructs aCellRenderer
with the specified properties.protected void
Deprecated.Signal gets emitted when the user cancels the process of editing a cell.protected void
editingStarted
(CellEditable editable, String path) Deprecated.Signal gets emitted when a cell starts to be edited.void
Deprecated.Emits the "editing-canceled" signal.void
emitEditingStarted
(CellEditable editable, String path) Deprecated.Emits the "editing-started" signal.void
getAlignedArea
(Widget widget, Set<CellRendererState> flags, Rectangle cellArea, Rectangle alignedArea) Deprecated.void
getAlignedArea
(Widget widget, CellRendererState flags, Rectangle cellArea, Rectangle alignedArea) Deprecated.void
getAlignment
(@Nullable Out<Float> xalign, @Nullable Out<Float> yalign) Deprecated.void
getFixedSize
(@Nullable Out<Integer> width, @Nullable Out<Integer> height) Deprecated.boolean
Deprecated.boolean
Deprecated.static MemoryLayout
Deprecated.The memory layout of the native struct.void
getPadding
(@Nullable Out<Integer> xpad, @Nullable Out<Integer> ypad) Deprecated.void
getPreferredHeight
(Widget widget, @Nullable Out<Integer> minimumSize, @Nullable Out<Integer> naturalSize) Deprecated.void
getPreferredHeightForWidth
(Widget widget, int width, @Nullable Out<Integer> minimumHeight, @Nullable Out<Integer> naturalHeight) Deprecated.void
getPreferredSize
(Widget widget, @Nullable Requisition minimumSize, @Nullable Requisition naturalSize) Deprecated.void
getPreferredWidth
(Widget widget, @Nullable Out<Integer> minimumSize, @Nullable Out<Integer> naturalSize) Deprecated.void
getPreferredWidthForHeight
(Widget widget, int height, @Nullable Out<Integer> minimumWidth, @Nullable Out<Integer> naturalWidth) Deprecated.Deprecated.boolean
Deprecated.getState
(@Nullable Widget widget, Set<CellRendererState> cellState) Deprecated.getState
(@Nullable Widget widget, CellRendererState... cellState) Deprecated.static Type
getType()
Deprecated.Get the GType of the CellRenderer classboolean
Deprecated.boolean
Deprecated.Deprecated.This signal gets emitted when the user cancels the process of editing a cell.Deprecated.This signal gets emitted when a cell starts to be edited.void
setAlignment
(float xalign, float yalign) Deprecated.void
setFixedSize
(int width, int height) Deprecated.void
setIsExpanded
(boolean isExpanded) Deprecated.void
setIsExpander
(boolean isExpander) Deprecated.void
setPadding
(int xpad, int ypad) Deprecated.void
setSensitive
(boolean sensitive) Deprecated.void
setVisible
(boolean visible) Deprecated.void
snapshot
(Snapshot snapshot, Widget widget, Rectangle backgroundArea, Rectangle cellArea, Set<CellRendererState> flags) Deprecated.void
snapshot
(Snapshot snapshot, Widget widget, Rectangle backgroundArea, Rectangle cellArea, CellRendererState... flags) Deprecated.startEditing
(@Nullable Event event, Widget widget, String path, Rectangle backgroundArea, Rectangle cellArea, Set<CellRendererState> flags) Deprecated.startEditing
(@Nullable Event event, Widget widget, String path, Rectangle backgroundArea, Rectangle cellArea, CellRendererState... flags) Deprecated.void
stopEditing
(boolean canceled) Deprecated.Methods inherited from class org.gnome.gobject.GObject
addToggleRef, addWeakPointer, bindProperty, bindProperty, bindProperty, bindPropertyFull, bindPropertyFull, bindPropertyWithClosures, bindPropertyWithClosures, compatControl, connect, connect, connect, constructed, disconnect, dispatchPropertiesChanged, dispose, dupData, dupQdata, emit, emitNotify, finalize_, forceFloating, freezeNotify, get, getData, getProperty, getProperty, getProperty, getQdata, getv, interfaceFindProperty, interfaceInstallProperty, interfaceListProperties, isFloating, newInstance, newInstance, newInstance, newInstance, newv, notify_, notify_, notifyByPspec, onNotify, ref, refSink, removeToggleRef, removeWeakPointer, replaceData, replaceQdata, runDispose, set, setData, setDataFull, setProperty, setProperty, setProperty, setQdata, setQdataFull, setv, stealData, stealQdata, takeRef, thawNotify, unref, watchClosure, weakRef, weakUnref, withProperties
Methods inherited from class org.gnome.gobject.TypeInstance
callParent, callParent, getPrivate, readGClass, writeGClass
Methods inherited from class io.github.jwharm.javagi.base.ProxyInstance
equals, handle, hashCode
-
Constructor Details
-
CellRenderer
Deprecated.Create a CellRenderer proxy instance for the provided memory address.- Parameters:
address
- the memory address of the native object
-
-
Method Details
-
getType
-
getMemoryLayout
Deprecated.The memory layout of the native struct.- Returns:
- the memory layout
-
asParent
Deprecated.Returns this instance as if it were its parent type. This is mostly synonymous to the Javasuper
keyword, but will set the native typeclass function pointers to the parent type. When overriding a native virtual method in Java, "chaining up" withsuper.methodName()
doesn't work, because it invokes the overridden function pointer again. To chain up, callasParent().methodName()
. This will call the native function pointer of this virtual method in the typeclass of the parent type.- Overrides:
asParent
in classInitiallyUnowned
-
activate
@Deprecated public boolean activate(Event event, Widget widget, String path, Rectangle backgroundArea, Rectangle cellArea, Set<CellRendererState> flags) Deprecated.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.- Parameters:
event
- aGdkEvent
widget
- widget that received the eventpath
- widget-dependent string representation of the event location; e.g. forGtkTreeView
, a string representation ofGtkTreePath
backgroundArea
- background area as passed to gtk_cell_renderer_render()cellArea
- cell area as passed to gtk_cell_renderer_render()flags
- render flags- Returns:
true
if the event was consumed/handled
-
activate
@Deprecated public boolean activate(Event event, Widget widget, String path, Rectangle backgroundArea, Rectangle cellArea, CellRendererState... flags) Deprecated.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.- Parameters:
event
- aGdkEvent
widget
- widget that received the eventpath
- widget-dependent string representation of the event location; e.g. forGtkTreeView
, a string representation ofGtkTreePath
backgroundArea
- background area as passed to gtk_cell_renderer_render()cellArea
- cell area as passed to gtk_cell_renderer_render()flags
- render flags- Returns:
true
if the event was consumed/handled
-
getAlignedArea
@Deprecated public void getAlignedArea(Widget widget, Set<CellRendererState> flags, Rectangle cellArea, Rectangle alignedArea) Deprecated.Gets the aligned area used by this CellRenderer insidecellArea
. Used for finding the appropriate edit and focus rectangle.- Parameters:
widget
- theGtkWidget
this cell will be rendering toflags
- render flagscellArea
- cell area which would be passed to gtk_cell_renderer_render()alignedArea
- the return location for the space insidecellArea
that would actually be used to render.
-
getAlignedArea
@Deprecated public void getAlignedArea(Widget widget, CellRendererState flags, Rectangle cellArea, Rectangle alignedArea) Deprecated.Gets the aligned area used by this CellRenderer insidecellArea
. Used for finding the appropriate edit and focus rectangle.- Parameters:
widget
- theGtkWidget
this cell will be rendering toflags
- render flagscellArea
- cell area which would be passed to gtk_cell_renderer_render()alignedArea
- the return location for the space insidecellArea
that would actually be used to render.
-
getAlignment
@Deprecated public void getAlignment(@Nullable @Nullable Out<Float> xalign, @Nullable @Nullable Out<Float> yalign) Deprecated.Fills inxalign
andyalign
with the appropriate values of this CellRenderer.- Parameters:
xalign
- location to fill in with the x alignment of the cellyalign
- location to fill in with the y alignment of the cell
-
getFixedSize
@Deprecated public void getFixedSize(@Nullable @Nullable Out<Integer> width, @Nullable @Nullable Out<Integer> height) Deprecated.Fills inwidth
andheight
with the appropriate size of this CellRenderer.- Parameters:
width
- location to fill in with the fixed width of the cellheight
- location to fill in with the fixed height of the cell
-
getIsExpanded
Deprecated.Checks whether the givenGtkCellRenderer
is expanded.- Returns:
true
if the cell renderer is expanded
-
getIsExpander
Deprecated.Checks whether the givenGtkCellRenderer
is an expander.- Returns:
true
if this CellRenderer is an expander, andfalse
otherwise
-
getPadding
@Deprecated public void getPadding(@Nullable @Nullable Out<Integer> xpad, @Nullable @Nullable Out<Integer> ypad) Deprecated.Fills inxpad
andypad
with the appropriate values of this CellRenderer.- Parameters:
xpad
- location to fill in with the x padding of the cellypad
- location to fill in with the y padding of the cell
-
getPreferredHeight
@Deprecated public void getPreferredHeight(Widget widget, @Nullable @Nullable Out<Integer> minimumSize, @Nullable @Nullable Out<Integer> naturalSize) Deprecated.Retrieves a renderer’s natural size when rendered towidget
.- Parameters:
widget
- theGtkWidget
this cell will be rendering tominimumSize
- location to store the minimum sizenaturalSize
- location to store the natural size
-
getPreferredHeightForWidth
@Deprecated public void getPreferredHeightForWidth(Widget widget, int width, @Nullable @Nullable Out<Integer> minimumHeight, @Nullable @Nullable Out<Integer> naturalHeight) Deprecated.Retrieves a cell renderers’s minimum and natural height if it were rendered towidget
with the specifiedwidth
.- Parameters:
widget
- theGtkWidget
this cell will be rendering towidth
- the size which is available for allocationminimumHeight
- location for storing the minimum sizenaturalHeight
- location for storing the preferred size
-
getPreferredSize
@Deprecated public void getPreferredSize(Widget widget, @Nullable @Nullable Requisition minimumSize, @Nullable @Nullable Requisition naturalSize) Deprecated.Retrieves the minimum and natural size of a cell taking into account the widget’s preference for height-for-width management.- Parameters:
widget
- theGtkWidget
this cell will be rendering tominimumSize
- location for storing the minimum sizenaturalSize
- location for storing the natural size
-
getPreferredWidth
@Deprecated public void getPreferredWidth(Widget widget, @Nullable @Nullable Out<Integer> minimumSize, @Nullable @Nullable Out<Integer> naturalSize) Deprecated.Retrieves a renderer’s natural size when rendered towidget
.- Parameters:
widget
- theGtkWidget
this cell will be rendering tominimumSize
- location to store the minimum sizenaturalSize
- location to store the natural size
-
getPreferredWidthForHeight
@Deprecated public void getPreferredWidthForHeight(Widget widget, int height, @Nullable @Nullable Out<Integer> minimumWidth, @Nullable @Nullable Out<Integer> naturalWidth) Deprecated.Retrieves a cell renderers’s minimum and natural width if it were rendered towidget
with the specifiedheight
.- Parameters:
widget
- theGtkWidget
this cell will be rendering toheight
- the size which is available for allocationminimumWidth
- location for storing the minimum sizenaturalWidth
- location for storing the preferred size
-
getRequestMode
Deprecated.Gets whether the cell renderer prefers a height-for-width layout or a width-for-height layout.- Returns:
- The
GtkSizeRequestMode
preferred by this renderer.
-
getSensitive
Deprecated.Returns the cell renderer’s sensitivity.- Returns:
true
if the cell renderer is sensitive
-
getState
@Deprecated public Set<StateFlags> getState(@Nullable @Nullable Widget widget, Set<CellRendererState> cellState) Deprecated.Translates the cell renderer state toGtkStateFlags
, based on the cell renderer and widget sensitivity, and the givenGtkCellRenderer
State.- Parameters:
widget
- aGtkWidget
cellState
- cell renderer state- Returns:
- the widget state flags applying to this CellRenderer
-
getState
@Deprecated public Set<StateFlags> getState(@Nullable @Nullable Widget widget, CellRendererState... cellState) Deprecated.Translates the cell renderer state toGtkStateFlags
, based on the cell renderer and widget sensitivity, and the givenGtkCellRenderer
State.- Parameters:
widget
- aGtkWidget
cellState
- cell renderer state- Returns:
- the widget state flags applying to this CellRenderer
-
getVisible
Deprecated.Returns the cell renderer’s visibility.- Returns:
true
if the cell renderer is visible
-
isActivatable
Deprecated.Checks whether the cell renderer can do something when activated.- Returns:
true
if the cell renderer can do anything when activated
-
setAlignment
Deprecated.Sets the renderer’s alignment within its available space.- Parameters:
xalign
- the x alignment of the cell rendereryalign
- the y alignment of the cell renderer
-
setFixedSize
Deprecated.Sets the renderer size to be explicit, independent of the properties set.- Parameters:
width
- the width of the cell renderer, or -1height
- the height of the cell renderer, or -1
-
setIsExpanded
Deprecated.Sets whether the givenGtkCellRenderer
is expanded.- Parameters:
isExpanded
- whether this CellRenderer should be expanded
-
setIsExpander
Deprecated.Sets whether the givenGtkCellRenderer
is an expander.- Parameters:
isExpander
- whether this CellRenderer is an expander
-
setPadding
Deprecated.Sets the renderer’s padding.- Parameters:
xpad
- the x padding of the cell rendererypad
- the y padding of the cell renderer
-
setSensitive
Deprecated.Sets the cell renderer’s sensitivity.- Parameters:
sensitive
- the sensitivity of the cell
-
setVisible
Deprecated.Sets the cell renderer’s visibility.- Parameters:
visible
- the visibility of the cell
-
snapshot
@Deprecated public void snapshot(Snapshot snapshot, Widget widget, Rectangle backgroundArea, Rectangle cellArea, Set<CellRendererState> flags) Deprecated.Invokes the virtual render function of theGtkCellRenderer
. The three passed-in rectangles are areas incr
. Most renderers will draw withincellArea
; the xalign, yalign, xpad, and ypad fields of theGtkCellRenderer
should be honored with respect tocellArea
.backgroundArea
includes the blank space around the cell, and also the area containing the tree expander; so thebackgroundArea
rectangles for all cells tile to cover the entirewindow
.- Parameters:
snapshot
- aGtkSnapshot
to draw towidget
- the widget owningwindow
backgroundArea
- entire cell area (including tree expanders and maybe padding on the sides)cellArea
- area normally rendered by a cell rendererflags
- flags that affect rendering
-
snapshot
@Deprecated public void snapshot(Snapshot snapshot, Widget widget, Rectangle backgroundArea, Rectangle cellArea, CellRendererState... flags) Deprecated.Invokes the virtual render function of theGtkCellRenderer
. The three passed-in rectangles are areas incr
. Most renderers will draw withincellArea
; the xalign, yalign, xpad, and ypad fields of theGtkCellRenderer
should be honored with respect tocellArea
.backgroundArea
includes the blank space around the cell, and also the area containing the tree expander; so thebackgroundArea
rectangles for all cells tile to cover the entirewindow
.- Parameters:
snapshot
- aGtkSnapshot
to draw towidget
- the widget owningwindow
backgroundArea
- entire cell area (including tree expanders and maybe padding on the sides)cellArea
- area normally rendered by a cell rendererflags
- flags that affect rendering
-
startEditing
@Deprecated public CellEditable startEditing(@Nullable @Nullable Event event, Widget widget, String path, Rectangle backgroundArea, Rectangle cellArea, Set<CellRendererState> flags) Deprecated.Starts editing the contents of this this CellRenderer, through a newGtkCellEditable
widget created by theGtkCellRenderer
Class.start_editing virtual function.- Parameters:
event
- aGdkEvent
widget
- widget that received the eventpath
- widget-dependent string representation of the event location; e.g. forGtkTreeView
, a string representation ofGtkTreePath
backgroundArea
- background area as passed to gtk_cell_renderer_render()cellArea
- cell area as passed to gtk_cell_renderer_render()flags
- render flags- Returns:
- A new
GtkCellEditable
for editing this this CellRenderer, ornull
if editing is not possible
-
startEditing
@Deprecated public CellEditable startEditing(@Nullable @Nullable Event event, Widget widget, String path, Rectangle backgroundArea, Rectangle cellArea, CellRendererState... flags) Deprecated.Starts editing the contents of this this CellRenderer, through a newGtkCellEditable
widget created by theGtkCellRenderer
Class.start_editing virtual function.- Parameters:
event
- aGdkEvent
widget
- widget that received the eventpath
- widget-dependent string representation of the event location; e.g. forGtkTreeView
, a string representation ofGtkTreePath
backgroundArea
- background area as passed to gtk_cell_renderer_render()cellArea
- cell area as passed to gtk_cell_renderer_render()flags
- render flags- Returns:
- A new
GtkCellEditable
for editing this this CellRenderer, ornull
if editing is not possible
-
stopEditing
Deprecated.Informs the cell renderer that the editing is stopped. Ifcanceled
istrue
, the cell renderer will emit theGtkCellRenderer
::editing-canceled signal.This function should be called by cell renderer implementations in response to the
GtkCellEditable::editing-done
signal ofGtkCellEditable
.- Parameters:
canceled
-true
if the editing has been canceled
-
editingCanceled
protected void editingCanceled()Deprecated.Signal gets emitted when the user cancels the process of editing a cell. -
editingStarted
Deprecated.Signal gets emitted when a cell starts to be edited. -
onEditingCanceled
public SignalConnection<CellRenderer.EditingCanceledCallback> onEditingCanceled(CellRenderer.EditingCanceledCallback handler) Deprecated.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().
- Parameters:
handler
- the signal handler- Returns:
- a signal handler ID to keep track of the signal connection
- See Also:
-
emitEditingCanceled
public void emitEditingCanceled()Deprecated.Emits the "editing-canceled" signal. SeeonEditingCanceled(org.gnome.gtk.CellRenderer.EditingCanceledCallback)
. -
onEditingStarted
public SignalConnection<CellRenderer.EditingStartedCallback> onEditingStarted(CellRenderer.EditingStartedCallback handler) Deprecated.This signal gets emitted when a cell starts to be edited. The intended use of this signal is to do special setup oneditable
, e.g. adding aGtkEntryCompletion
or setting up additional columns in aGtkComboBox
.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 therenderer
.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 char *path, gpointer data) { if (GTK_IS_ENTRY (editable)) { GtkEntry *entry = GTK_ENTRY (editable); // ... create a GtkEntryCompletion gtk_entry_set_completion (entry, completion); } }
- Parameters:
handler
- the signal handler- Returns:
- a signal handler ID to keep track of the signal connection
- See Also:
-
emitEditingStarted
Deprecated.Emits the "editing-started" signal. SeeonEditingStarted(org.gnome.gtk.CellRenderer.EditingStartedCallback)
. -
builder
Deprecated.ACellRenderer.Builder
object constructs aCellRenderer
with the specified properties. Use the variousset...()
methods to set properties, and finish construction withCellRenderer.Builder.build()
.
-