Class CellRenderer
- All Implemented Interfaces:
Proxy
- Direct Known Subclasses:
CellRenderer.CellRenderer$Impl,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 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.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classCellRenderer.Builder<B extends CellRenderer.Builder<B>>Deprecated.Inner class implementing a builder pattern to construct a GObject with properties.static classDeprecated.The CellRenderer$Impl type represents a native instance of the abstract CellRenderer class.static classDeprecated.static interfaceDeprecated.Functional interface declaration of theEditingCanceledCallbackcallback.static interfaceDeprecated.Functional interface declaration of theEditingStartedCallbackcallback.Nested classes/interfaces inherited from class org.gnome.gobject.InitiallyUnowned
InitiallyUnowned.InitiallyUnownedClassNested classes/interfaces inherited from class org.gnome.gobject.GObject
GObject.NotifyCallback, GObject.ObjectClass -
Constructor Summary
ConstructorsConstructorDescriptionDeprecated.Creates a new CellRenderer.CellRenderer(MemorySegment address) Deprecated.Create a CellRenderer proxy instance for the provided memory address. -
Method Summary
Modifier and TypeMethodDescriptionbooleanactivate(Event event, Widget widget, String path, Rectangle backgroundArea, Rectangle cellArea, Set<CellRendererState> flags) Deprecated.booleanactivate(Event event, Widget widget, String path, Rectangle backgroundArea, Rectangle cellArea, CellRendererState... flags) Deprecated.protected CellRendererasParent()Deprecated.Returns this instance as if it were its parent type.protected voidDeprecated.Signal gets emitted when the user cancels the process of editing a cell.protected voideditingStarted(CellEditable editable, String path) Deprecated.Signal gets emitted when a cell starts to be edited.voidDeprecated.Emits the "editing-canceled" signal.voidemitEditingStarted(@Nullable CellEditable editable, String path) Deprecated.Emits the "editing-started" signal.voidgetAlignedArea(Widget widget, Set<CellRendererState> flags, Rectangle cellArea, Rectangle alignedArea) Deprecated.voidgetAlignedArea(Widget widget, CellRendererState flags, Rectangle cellArea, Rectangle alignedArea) Deprecated.voidgetAlignment(@Nullable Out<Float> xalign, @Nullable Out<Float> yalign) Deprecated.voidgetFixedSize(@Nullable Out<Integer> width, @Nullable Out<Integer> height) Deprecated.booleanDeprecated.booleanDeprecated.static MemoryLayoutDeprecated.The memory layout of the native struct.voidgetPadding(@Nullable Out<Integer> xpad, @Nullable Out<Integer> ypad) Deprecated.voidgetPreferredHeight(Widget widget, @Nullable Out<Integer> minimumSize, @Nullable Out<Integer> naturalSize) Deprecated.voidgetPreferredHeightForWidth(Widget widget, int width, @Nullable Out<Integer> minimumHeight, @Nullable Out<Integer> naturalHeight) Deprecated.voidgetPreferredSize(Widget widget, @Nullable Requisition minimumSize, @Nullable Requisition naturalSize) Deprecated.voidgetPreferredWidth(Widget widget, @Nullable Out<Integer> minimumSize, @Nullable Out<Integer> naturalSize) Deprecated.voidgetPreferredWidthForHeight(Widget widget, int height, @Nullable Out<Integer> minimumWidth, @Nullable Out<Integer> naturalWidth) Deprecated.Deprecated.booleanDeprecated.getState(@Nullable Widget widget, Set<CellRendererState> cellState) Deprecated.getState(@Nullable Widget widget, CellRendererState... cellState) Deprecated.static @Nullable TypegetType()Deprecated.Get the GType of the CellRenderer classbooleanDeprecated.booleanDeprecated.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.voidsetAlignment(float xalign, float yalign) Deprecated.voidsetFixedSize(int width, int height) Deprecated.voidsetIsExpanded(boolean isExpanded) Deprecated.voidsetIsExpander(boolean isExpander) Deprecated.voidsetPadding(int xpad, int ypad) Deprecated.voidsetSensitive(boolean sensitive) Deprecated.voidsetVisible(boolean visible) Deprecated.voidsnapshot(Snapshot snapshot, Widget widget, Rectangle backgroundArea, Rectangle cellArea, Set<CellRendererState> flags) Deprecated.voidsnapshot(Snapshot snapshot, Widget widget, Rectangle backgroundArea, Rectangle cellArea, CellRendererState... flags) Deprecated.@Nullable CellEditablestartEditing(@Nullable Event event, Widget widget, String path, Rectangle backgroundArea, Rectangle cellArea, Set<CellRendererState> flags) Deprecated.@Nullable CellEditablestartEditing(@Nullable Event event, Widget widget, String path, Rectangle backgroundArea, Rectangle cellArea, CellRendererState... flags) Deprecated.voidstopEditing(boolean canceled) Deprecated.Methods inherited from class org.gnome.gobject.InitiallyUnowned
builderMethods 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, 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, withPropertiesMethods inherited from class org.gnome.gobject.TypeInstance
callParent, callParent, cast, getPrivate, readGClass, writeGClassMethods inherited from class org.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
-
CellRenderer
public CellRenderer()Deprecated.Creates a new CellRenderer.
-
-
Method Details
-
getType
Deprecated.Get the GType of the CellRenderer class- Returns:
- the GType
-
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 Javasuperkeyword, 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:
asParentin 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,GtkCellRendererToggletoggles when it gets a mouse click.- Parameters:
event- aGdkEventwidget- widget that received the eventpath- widget-dependent string representation of the event location; e.g. forGtkTreeView, a string representation ofGtkTreePathbackgroundArea- background area as passed to gtk_cell_renderer_render()cellArea- cell area as passed to gtk_cell_renderer_render()flags- render flags- Returns:
trueif 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,GtkCellRendererToggletoggles when it gets a mouse click.- Parameters:
event- aGdkEventwidget- widget that received the eventpath- widget-dependent string representation of the event location; e.g. forGtkTreeView, a string representation ofGtkTreePathbackgroundArea- background area as passed to gtk_cell_renderer_render()cellArea- cell area as passed to gtk_cell_renderer_render()flags- render flags- Returns:
trueif 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- theGtkWidgetthis 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 insidecellAreathat 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- theGtkWidgetthis 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 insidecellAreathat would actually be used to render.
-
getAlignment
Deprecated.Fills inxalignandyalignwith the appropriate values ofcell.- 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.Fills inwidthandheightwith the appropriate size ofcell.- 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 givenGtkCellRendereris expanded.- Returns:
trueif the cell renderer is expanded
-
getIsExpander
Deprecated.Checks whether the givenGtkCellRendereris an expander.- Returns:
trueif this CellRenderer is an expander, andfalseotherwise
-
getPadding
Deprecated.Fills inxpadandypadwith the appropriate values ofcell.- 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 Out<Integer> minimumSize, @Nullable Out<Integer> naturalSize) Deprecated.Retrieves a renderer’s natural size when rendered towidget.- Parameters:
widget- theGtkWidgetthis 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 Out<Integer> minimumHeight, @Nullable Out<Integer> naturalHeight) Deprecated.Retrieves a cell renderers’s minimum and natural height if it were rendered towidgetwith the specifiedwidth.- Parameters:
widget- theGtkWidgetthis 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 Requisition minimumSize, @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- theGtkWidgetthis 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 Out<Integer> minimumSize, @Nullable Out<Integer> naturalSize) Deprecated.Retrieves a renderer’s natural size when rendered towidget.- Parameters:
widget- theGtkWidgetthis 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 Out<Integer> minimumWidth, @Nullable Out<Integer> naturalWidth) Deprecated.Retrieves a cell renderers’s minimum and natural width if it were rendered towidgetwith the specifiedheight.- Parameters:
widget- theGtkWidgetthis 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
GtkSizeRequestModepreferred by this renderer.
-
getSensitive
Deprecated.Returns the cell renderer’s sensitivity.- Returns:
trueif the cell renderer is sensitive
-
getState
@Deprecated public Set<StateFlags> getState(@Nullable Widget widget, Set<CellRendererState> cellState) Deprecated.Translates the cell renderer state toGtkStateFlags, based on the cell renderer and widget sensitivity, and the givenGtkCellRendererState.- Parameters:
widget- aGtkWidgetcellState- cell renderer state- Returns:
- the widget state flags applying to this CellRenderer
-
getState
@Deprecated public Set<StateFlags> getState(@Nullable Widget widget, CellRendererState... cellState) Deprecated.Translates the cell renderer state toGtkStateFlags, based on the cell renderer and widget sensitivity, and the givenGtkCellRendererState.- Parameters:
widget- aGtkWidgetcellState- cell renderer state- Returns:
- the widget state flags applying to this CellRenderer
-
getVisible
Deprecated.Returns the cell renderer’s visibility.- Returns:
trueif the cell renderer is visible
-
isActivatable
Deprecated.Checks whether the cell renderer can do something when activated.- Returns:
trueif 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 givenGtkCellRendereris expanded.- Parameters:
isExpanded- whether this CellRenderer should be expanded
-
setIsExpander
Deprecated.Sets whether the givenGtkCellRendereris 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 theGtkCellRenderershould be honored with respect tocellArea.backgroundAreaincludes the blank space around the cell, and also the area containing the tree expander; so thebackgroundArearectangles for all cells tile to cover the entirewindow.- Parameters:
snapshot- aGtkSnapshotto draw towidget- the widget owningwindowbackgroundArea- 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 theGtkCellRenderershould be honored with respect tocellArea.backgroundAreaincludes the blank space around the cell, and also the area containing the tree expander; so thebackgroundArearectangles for all cells tile to cover the entirewindow.- Parameters:
snapshot- aGtkSnapshotto draw towidget- the widget owningwindowbackgroundArea- 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 @Nullable CellEditable startEditing(@Nullable Event event, Widget widget, String path, Rectangle backgroundArea, Rectangle cellArea, Set<CellRendererState> flags) Deprecated.Starts editing the contents of thiscell,through a newGtkCellEditablewidget created by theGtkCellRendererClass.start_editing virtual function.- Parameters:
event- aGdkEventwidget- widget that received the eventpath- widget-dependent string representation of the event location; e.g. forGtkTreeView, a string representation ofGtkTreePathbackgroundArea- 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
GtkCellEditablefor editing thiscell,ornullif editing is not possible
-
startEditing
@Deprecated public @Nullable CellEditable startEditing(@Nullable Event event, Widget widget, String path, Rectangle backgroundArea, Rectangle cellArea, CellRendererState... flags) Deprecated.Starts editing the contents of thiscell,through a newGtkCellEditablewidget created by theGtkCellRendererClass.start_editing virtual function.- Parameters:
event- aGdkEventwidget- widget that received the eventpath- widget-dependent string representation of the event location; e.g. forGtkTreeView, a string representation ofGtkTreePathbackgroundArea- 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
GtkCellEditablefor editing thiscell,ornullif editing is not possible
-
stopEditing
Deprecated.Informs the cell renderer that the editing is stopped. Ifcanceledistrue, the cell renderer will emit theGtkCellRenderer::editing-canceled signal.This function should be called by cell renderer implementations in response to the
GtkCellEditable::editing-donesignal ofGtkCellEditable.- Parameters:
canceled-trueif 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 aGtkEntryCompletionor setting up additional columns in aGtkComboBox.See gtk_cell_editable_start_editing() for information on the lifecycle of the
editableand 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
editablebefore 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).
-