public interface EditorCustomElementRenderer
Modifier and Type | Method and Description |
---|---|
default GutterIconRenderer |
calcGutterIconRenderer(Inlay inlay)
Allows to show an icon in gutter and process corresponding mouse events for block custom elements (other types of custom elements are
not supported at the moment).
|
default int |
calcHeightInPixels(Inlay inlay)
Block element's renderer implementation can override this method to defines the height of element (in pixels).
|
default int |
calcWidthInPixels(Editor editor)
Deprecated.
Override/use
calcWidthInPixels(Inlay) instead. This method will be removed. |
default int |
calcWidthInPixels(Inlay inlay)
Renderer implementation should override this to define width of custom element (in pixels).
|
default ActionGroup |
getContextMenuGroup(Inlay inlay)
Returns an action group, which is to be used for the given custom element's context menu.
|
default java.lang.String |
getContextMenuGroupId()
Deprecated.
Override/use
getContextMenuGroupId(Inlay) instead. This method will be removed. |
default java.lang.String |
getContextMenuGroupId(Inlay inlay)
Returns a registered id of action group, which is to be used for displaying context menu for the given custom element.
|
default void |
paint(Editor editor,
java.awt.Graphics g,
java.awt.Rectangle targetRegion,
TextAttributes textAttributes)
Deprecated.
Override/use
paint(Inlay, Graphics, Rectangle, TextAttributes) instead. This method will be removed. |
default void |
paint(Inlay inlay,
java.awt.Graphics g,
java.awt.Rectangle targetRegion,
TextAttributes textAttributes)
Renderer implementation should override this to define the appearance of custom element.
|
default int calcWidthInPixels(Inlay inlay)
Inlay.getWidthInPixels()
and the width of targetRegion
parameter passed to renderer's
paint(Inlay, Graphics, Rectangle, TextAttributes)
method. For inline and after-line-end elements it should always be
a positive value.@Deprecated default int calcWidthInPixels(Editor editor)
calcWidthInPixels(Inlay)
instead. This method will be removed.default int calcHeightInPixels(Inlay inlay)
Inlay.getWidthInPixels()
and
the height of targetRegion
parameter passed to renderer's paint(Inlay, Graphics, Rectangle, TextAttributes)
method.
Returned value is currently not used for inline elements.default void paint(Inlay inlay, java.awt.Graphics g, java.awt.Rectangle targetRegion, TextAttributes textAttributes)
targetRegion
- region where painting should be performed, location of this rectangle is calculated by editor implementation,
dimensions of the rectangle match element's width and height (provided by calcWidthInPixels(Inlay)
and calcHeightInPixels(Inlay)
)textAttributes
- attributes of surrounding text@Deprecated default void paint(Editor editor, java.awt.Graphics g, java.awt.Rectangle targetRegion, TextAttributes textAttributes)
paint(Inlay, Graphics, Rectangle, TextAttributes)
instead. This method will be removed.default java.lang.String getContextMenuGroupId(Inlay inlay)
null
is returned (and getContextMenuGroup(Inlay)
also returns null
), standard editor's context menu will be
displayed upon corresponding mouse event.default ActionGroup getContextMenuGroup(Inlay inlay)
null
is returned (and
getContextMenuGroupId(Inlay)
also returns null
), standard editor's context menu will be displayed upon corresponding
mouse event.
This method takes preference over getContextMenuGroupId(Inlay)
, i.e. if it returns a non-null value, the latter method won't
be called.
@Deprecated default java.lang.String getContextMenuGroupId()
getContextMenuGroupId(Inlay)
instead. This method will be removed.default GutterIconRenderer calcGutterIconRenderer(Inlay inlay)
Returned provider should have a meaningful implementation of equals
method - Inlay.update()
will update the inlay's
provider (only) if newly returned instance is not equal to the previously defined one.