Top | ![]() |
![]() |
![]() |
![]() |
GtkSourceGutterRendererAlignmentMode | alignment-mode | Read / Write |
GtkSourceGutterLines * | lines | Read |
GtkTextView * | view | Read |
float | xalign | Read / Write |
int | xpad | Read / Write |
float | yalign | Read / Write |
int | ypad | Read / Write |
GEnum ╰── GtkSourceGutterRendererAlignmentMode GObject ╰── GInitiallyUnowned ╰── GtkWidget ╰── GtkSourceGutterRenderer ├── GtkSourceGutterRendererPixbuf ╰── GtkSourceGutterRendererText
GtkSourceGutterRenderer implements GtkAccessible, GtkBuildable and GtkConstraintTarget.
A GtkSourceGutterRenderer represents a column in a GtkSourceGutter. The column contains one cell for each visible line of the GtkTextBuffer. Due to text wrapping, a cell can thus span multiple lines of the GtkTextView. In this case, GtkSourceGutterRendererAlignmentMode controls the alignment of the cell.
The gutter renderer is a GtkWidget and is measured using the normal widget measurement facilities. The width of the gutter will be determined by the measurements of the gutter renderers.
The width of a gutter renderer generally takes into account the entire text buffer. For instance, to display the line numbers, if the buffer contains 100 lines, the gutter renderer will always set its width such as three digits can be printed, even if only the first 20 lines are shown. Another strategy is to take into account only the visible lines. In this case, only two digits are necessary to display the line numbers of the first 20 lines. To take another example, the gutter renderer for GtkSourceMarks doesn't need to take into account the text buffer to announce its width. It only depends on the icons size displayed in the gutter column.
When the available size to render a cell is greater than the required size to
render the cell contents, the cell contents can be aligned horizontally and
vertically with gtk_source_gutter_renderer_set_alignment()
.
The cells rendering occurs using gtk_widget_snapshot()
. Implementations
should use gtk_source_gutter_renderer_get_lines()
to retrieve information
about the lines to be rendered. To help with aligning content which takes
into account the padding and alignment of a cell, implementations may call
gtk_source_gutter_renderer_align_cell()
for a given line number with the
width and height measurement of the content they width to render.
GtkSourceBuffer *
gtk_source_gutter_renderer_get_buffer (GtkSourceGutterRenderer *renderer
);
Gets the GtkSourceBuffer for which the gutter renderer is drawing.
Since: 5.0
GtkSourceView *
gtk_source_gutter_renderer_get_view (GtkSourceGutterRenderer *renderer
);
Get the view associated to the gutter renderer
GtkSourceGutterRendererAlignmentMode
gtk_source_gutter_renderer_get_alignment_mode
(GtkSourceGutterRenderer *renderer
);
Get the alignment mode. The alignment mode describes the manner in which the renderer is aligned (see :xalign and :yalign).
void gtk_source_gutter_renderer_set_alignment_mode (GtkSourceGutterRenderer *renderer
,GtkSourceGutterRendererAlignmentMode mode
);
Set the alignment mode. The alignment mode describes the manner in which the renderer is aligned (see “xalign” and “yalign”).
gfloat
gtk_source_gutter_renderer_get_xalign (GtkSourceGutterRenderer *renderer
);
Gets the "xalign" property of the GtkSourceGutterRenderer. This may be used to adjust where within the cell rectangle the renderer will draw.
Since: 5.0
void gtk_source_gutter_renderer_set_xalign (GtkSourceGutterRenderer *renderer
,gfloat xalign
);
Adjusts the "xalign" property of the GtkSourceGutterRenderer. This may be used to adjust where within the cell rectangle the renderer will draw.
Since: 5.0
gint
gtk_source_gutter_renderer_get_xpad (GtkSourceGutterRenderer *renderer
);
Gets the "xpad" property of the GtkSourceGutterRenderer. This may be used to adjust the cell rectangle that the renderer will use to draw.
Since: 5.0
void gtk_source_gutter_renderer_set_xpad (GtkSourceGutterRenderer *renderer
,gint xpad
);
Adjusts the "xpad" property of the GtkSourceGutterRenderer. This may be used to adjust the cell rectangle that the renderer will use to draw.
Since: 5.0
gfloat
gtk_source_gutter_renderer_get_yalign (GtkSourceGutterRenderer *renderer
);
Gets the "yalign" property of the GtkSourceGutterRenderer. This may be used to adjust where within the cell rectangle the renderer will draw.
Since: 5.0
void gtk_source_gutter_renderer_set_yalign (GtkSourceGutterRenderer *renderer
,gfloat yalign
);
Adjusts the "yalign" property of the GtkSourceGutterRenderer. This may be used to adjust where within the cell rectangle the renderer will draw.
Since: 5.0
gint
gtk_source_gutter_renderer_get_ypad (GtkSourceGutterRenderer *renderer
);
Gets the "ypad" property of the GtkSourceGutterRenderer. This may be used to adjust the cell rectangle that the renderer will use to draw.
Since: 5.0
void gtk_source_gutter_renderer_set_ypad (GtkSourceGutterRenderer *renderer
,gint ypad
);
Adjusts the "ypad" property of the GtkSourceGutterRenderer. This may be used to adjust the cell rectangle that the renderer will use to draw.
Since: 5.0
void gtk_source_gutter_renderer_align_cell (GtkSourceGutterRenderer *renderer
,guint line
,gfloat width
,gfloat height
,gfloat *x
,gfloat *y
);
Locates where to render content that is width
x height
based on
the renderers alignment and padding.
The location will be placed into x
and y
and is relative to the
renderer's coordinates.
It is encouraged that renderers use this function when snappshotting to ensure consistent placement of their contents.
renderer |
||
line |
the line number for content |
|
width |
the width of the content to draw |
|
height |
the height of the content to draw |
|
x |
the X position to render the content. |
[out] |
y |
the Y position to render the content. |
[out] |
Since: 5.0
void gtk_source_gutter_renderer_activate (GtkSourceGutterRenderer *renderer
,const GtkTextIter *iter
,const GdkRectangle *area
,guint button
,GdkModifierType state
,gint n_presses
);
Emits the “activate” signal of the renderer. This is called from GtkSourceGutter and should never have to be called manually.
renderer |
||
iter |
a GtkTextIter at the start of the line where the renderer is activated |
|
area |
a GdkRectangle of the cell area where the renderer is activated |
|
button |
the button that was pressed |
|
state |
||
n_presses |
the number of button presses |
gboolean gtk_source_gutter_renderer_query_activatable (GtkSourceGutterRenderer *renderer
,const GtkTextIter *iter
,const GdkRectangle *area
);
Get whether the renderer is activatable at the location provided. This is called from GtkSourceGutter to determine whether a renderer is activatable using the mouse pointer.
renderer |
||
iter |
a GtkTextIter at the start of the line to be activated |
|
area |
a GdkRectangle of the cell area to be activated |
“alignment-mode”
property“alignment-mode” GtkSourceGutterRendererAlignmentMode
The alignment mode of the renderer. This can be used to indicate that in the case a cell spans multiple lines (due to text wrapping) the alignment should work on either the full cell, the first line or the last line.
Owner: GtkSourceGutterRenderer
Flags: Read / Write
Default value: GTK_SOURCE_GUTTER_RENDERER_ALIGNMENT_MODE_CELL
“lines”
property“lines” GtkSourceGutterLines *
The "lines" property contains information about the lines to be
rendered. It should be used by GtkSourceGutterRenderer
implementations from gtk_widget_snapshot()
.
Owner: GtkSourceGutterRenderer
Flags: Read
“view”
property“view” GtkTextView *
The view on which the renderer is placed.
Owner: GtkSourceGutterRenderer
Flags: Read
“xalign”
property “xalign” float
The horizontal alignment of the renderer. Set to 0 for a left alignment. 1 for a right alignment. And 0.5 for centering the cells. A value lower than 0 doesn't modify the alignment.
Owner: GtkSourceGutterRenderer
Flags: Read / Write
Allowed values: [0,1]
Default value: 0
“xpad”
property “xpad” int
The left and right padding of the renderer.
Owner: GtkSourceGutterRenderer
Flags: Read / Write
Allowed values: >= 0
Default value: 0
“yalign”
property “yalign” float
The vertical alignment of the renderer. Set to 0 for a top alignment. 1 for a bottom alignment. And 0.5 for centering the cells. A value lower than 0 doesn't modify the alignment.
Owner: GtkSourceGutterRenderer
Flags: Read / Write
Allowed values: [0,1]
Default value: 0
“activate”
signalvoid user_function (GtkSourceGutterRenderer *renderer, GtkTextIter *iter, GdkRectangle *area, guint button, GdkModifierType state, int n_presses, gpointer user_data)
The ::activate signal is emitted when the renderer is activated.
renderer |
the GtkSourceGutterRenderer who emits the signal |
|
iter |
||
area |
||
button |
the button that was pressed |
|
state |
a GdkModifierType of state |
|
n_presses |
the number of button presses |
|
user_data |
user data set when the signal handler was connected. |
Flags: Run Last
“query-activatable”
signalgboolean user_function (GtkSourceGutterRenderer *renderer, GtkTextIter *iter, GdkRectangle *area, gpointer user_data)
The ::query-activatable signal is emitted when the renderer can possibly be activated.
renderer |
the GtkSourceGutterRenderer who emits the signal |
|
iter |
||
area |
||
event |
the GdkEvent that is causing the activatable query |
|
user_data |
user data set when the signal handler was connected. |
Flags: Run Last
“query-data”
signalvoid user_function (GtkSourceGutterRenderer *sourcegutterrenderer, GObject *arg1, guint arg2, gpointer user_data)
Flags: Run Last