Table of Contents
- xtk_richtext_toolbar.h
- Types
- XtkRichTextToolbar
- XtkRichTextToolbarImageRequestCallback
- XtkRichTextToolbarColorRequestCallback
- XtkRichTextToolbarLinkRequestCallback
- XtkRichTextToolbarActionCallback
- XtkRichTextToolbarGroupsReorderedCallback
- Constants
- Functions
- xtk_richtext_toolbar_create
- xtk_richtext_toolbar_destroy
- xtk_richtext_toolbar_set_theme
- xtk_richtext_toolbar_set_border_sides
- xtk_richtext_toolbar_set_border_color
- xtk_richtext_toolbar_get_window
- xtk_richtext_toolbar_get_height
- xtk_richtext_toolbar_set_position
- xtk_richtext_toolbar_resize
- xtk_richtext_toolbar_set_target
- xtk_richtext_toolbar_handle_event
- xtk_richtext_toolbar_draw
- xtk_richtext_toolbar_set_formatting_enabled
- xtk_richtext_toolbar_set_plain_text
- xtk_richtext_toolbar_get_tooltip
- xtk_richtext_toolbar_sync_hover
- xtk_richtext_toolbar_set_focused
- xtk_richtext_toolbar_get_focused
- xtk_richtext_toolbar_get_focus_window
- xtk_richtext_toolbar_set_image_request_callback
- xtk_richtext_toolbar_set_color_request_callback
- xtk_richtext_toolbar_set_link_request_callback
- xtk_richtext_toolbar_set_action_callback
- xtk_richtext_toolbar_set_history
- xtk_richtext_toolbar_set_groups_reordered_callback
- xtk_richtext_toolbar_get_group_order
- xtk_richtext_toolbar_set_group_order
- xtk_richtext_toolbar_get_group_rows
- xtk_richtext_toolbar_set_group_rows
- xtk_richtext_toolbar_get_hovered
xtk_richtext_toolbar.h
A formatting toolbar for an XtkRichText editor.
The toolbar is a strip of icon buttons that format the text of one XtkRichText: bold, headings, lists, links and so on. It keeps no formatting of its own: each click calls the matching xtk_richtext_* function on its target, and the pressed state of the buttons shows the formatting at the target's caret. Each button has a tooltip.
The buttons, in eight groups (the action name the action callback is given is in brackets):
- History: Undo [undo], Redo [redo], and the Plain Text switch [plain-text], which shows the target's Markdown source (pressed) or its formatted text (released).
- Formatting: Bold [bold], Italic [italic], Underline [underline], Strikethrough [strikethrough], Superscript [superscript], Subscript [subscript], Inline Code [code], Highlight [highlight].
- Colors: Foreground Color [foreground-color], Background Color [background-color].
- Headings: Heading 1 to 6 [h1] to [h6].
- Lists: Bullet List [bullet-list], Numbered List [numbered-list], To-do List [todo-list].
- Blocks: Block Quote [quote], Horizontal Rule [horizontal-rule], Insert Image [image], Insert Link [link], Code Block [code-block], Insert Table [table] (a 2 by 2 table), Insert Footnote [footnote], Inline Math [math-inline], Display Math Block [math-block].
- Admonitions: Note [note], Tip [tip], Important [important], Warning [warning], Caution [caution].
- Indent: Indent [indent], Outdent [outdent].
The color, image and link buttons do not change the target. They call the program's request callback, so the program can show a color picker, a file dialog or a prompt for the address, and then call xtk_richtext_set_inline_color(), xtk_richtext_insert_image() or xtk_richtext_set_link() on the target itself.
Layout. The groups are laid out left to right and wrap to further rows when the toolbar is too narrow; the height follows from that (see xtk_richtext_toolbar_get_height()). When everything fits on one row, the row is centered. Each group has a grip of three dots on its left: the user drags it to move the group along its row, or up and down to another row. The toolbar does not save the order. A program that wants to keep it reads it with xtk_richtext_toolbar_get_group_order() and xtk_richtext_toolbar_get_group_rows() in the groups-reordered callback, and restores it after creating the toolbar.
Making the toolbar. xtk_richtext_toolbar_create() takes the toolbar's own background color, a ButtonBlock for the buttons (normally &config.button), a TooltipBlock for the tooltips (normally &config.tooltip), and the target editor. Later changes to those blocks reach the toolbar only through xtk_richtext_toolbar_set_theme(). The toolbar is mapped at once. The toolbar owns its window, its buttons and its tooltip; xtk_richtext_toolbar_destroy() frees them. The target is not owned and may be changed with xtk_richtext_toolbar_set_target().
Events. Pass every X event to xtk_richtext_toolbar_handle_event(). It returns 1 when the event was the toolbar's. A click applies the action to the target and redraws both. The toolbar does not see the target's caret move, so call xtk_richtext_toolbar_draw() after events the target handled (or from its change callback) to keep the pressed buttons right. Call xtk_tooltip_update() on xtk_richtext_toolbar_get_tooltip(), and xtk_richtext_toolbar_sync_hover(), from the program's timer tick, so tooltips appear and hover borders clear.
Keyboard. The toolbar is one Tab stop: register xtk_richtext_toolbar_get_focus_window() with the program's focus handling and call xtk_richtext_toolbar_set_focused(). Left and Right then move between the enabled buttons, and Space or Return clicks the focused one.
Theme keys. The toolbar has no section of its own. Its buttons use the ButtonBlock given (the [button] section when it is &config.button): the button background, border and hover colors, with the icons drawn in its color and disabled icons and the grips in its border color. The tooltips use the TooltipBlock given ([tooltip]). The background behind the buttons is the color passed to xtk_richtext_toolbar_create().
Example.
static void ask_for_link(XtkRichTextToolbar *toolbar, void *user_data) {
XtkRichText *editor = user_data;
(void)toolbar;
xtk_richtext_set_link(editor, "https://example.org/"); // a real program asks the user
xtk_richtext_draw(editor);
}
XtkRichTextToolbar *toolbar = xtk_richtext_toolbar_create(display, screen, window,
0, 0, 640, config.main.background, &config.button, &config.tooltip, editor);
xtk_richtext_toolbar_set_link_request_callback(toolbar, ask_for_link, editor);
xtk_richtext_set_position(editor, 0, xtk_richtext_toolbar_get_height(toolbar));
// In the event loop:
if (!xtk_richtext_toolbar_handle_event(toolbar, &event) &&
xtk_richtext_handle_event(editor, &event))
xtk_richtext_toolbar_draw(toolbar);
// On the timer tick:
xtk_tooltip_update(xtk_richtext_toolbar_get_tooltip(toolbar));
xtk_richtext_toolbar_sync_hover(toolbar);
xtk_richtext_toolbar_destroy(toolbar);
*
Limitations.
- The buttons are fixed: a program cannot add, remove or hide one, but it can take over any of them with
xtk_richtext_toolbar_set_action_callback(). - The pressed state shows formatting only while the target has focus.
#include "xtk_richtext_toolbar.h"
Types: XtkRichTextToolbar, XtkRichTextToolbarImageRequestCallback, XtkRichTextToolbarColorRequestCallback, XtkRichTextToolbarLinkRequestCallback, XtkRichTextToolbarActionCallback, XtkRichTextToolbarGroupsReorderedCallback
Constants: XTK_RICHTEXT_TOOLBAR_GROUP_COUNT
Functions: xtk_richtext_toolbar_create, xtk_richtext_toolbar_destroy, xtk_richtext_toolbar_set_theme, xtk_richtext_toolbar_set_border_sides, xtk_richtext_toolbar_set_border_color, xtk_richtext_toolbar_get_window, xtk_richtext_toolbar_get_height, xtk_richtext_toolbar_set_position, xtk_richtext_toolbar_resize, xtk_richtext_toolbar_set_target, xtk_richtext_toolbar_handle_event, xtk_richtext_toolbar_draw, xtk_richtext_toolbar_set_formatting_enabled, xtk_richtext_toolbar_set_plain_text, xtk_richtext_toolbar_get_tooltip, xtk_richtext_toolbar_sync_hover, xtk_richtext_toolbar_set_focused, xtk_richtext_toolbar_get_focused, xtk_richtext_toolbar_get_focus_window, xtk_richtext_toolbar_set_image_request_callback, xtk_richtext_toolbar_set_color_request_callback, xtk_richtext_toolbar_set_link_request_callback, xtk_richtext_toolbar_set_action_callback, xtk_richtext_toolbar_set_history, xtk_richtext_toolbar_set_groups_reordered_callback, xtk_richtext_toolbar_get_group_order, xtk_richtext_toolbar_set_group_order, xtk_richtext_toolbar_get_group_rows, xtk_richtext_toolbar_set_group_rows, xtk_richtext_toolbar_get_hovered
Types
XtkRichTextToolbar
typedef struct XtkRichTextToolbar XtkRichTextToolbar;
A formatting toolbar; opaque, made by xtk_richtext_toolbar_create().
XtkRichTextToolbarImageRequestCallback
typedef void (*XtkRichTextToolbarImageRequestCallback)(XtkRichTextToolbar *richtext_toolbar, void *user_data);
Called when the Insert Image button is clicked.
The toolbar has no file dialog of its own. The program shows one (for example with xtk_filedialog.h) and, when a file is chosen, calls xtk_richtext_insert_image() on the target and redraws it. The toolbar is not used again after the callback returns, so the callback may destroy it.
XtkRichTextToolbarColorRequestCallback
typedef void (*XtkRichTextToolbarColorRequestCallback)(XtkRichTextToolbar *richtext_toolbar, int is_background, void *user_data);
Called when the Foreground Color or Background Color button is clicked.
The program shows a color picker (for example with xtk_colorpicker.h) and, when a color is chosen, calls xtk_richtext_set_inline_color() on the target with XTK_RICHTEXT_SPAN_BACKGROUND_COLOR or XTK_RICHTEXT_SPAN_FOREGROUND_COLOR, and redraws it. Setting the same color again removes it.
XtkRichTextToolbarLinkRequestCallback
typedef void (*XtkRichTextToolbarLinkRequestCallback)(XtkRichTextToolbar *richtext_toolbar, void *user_data);
Called when the Insert Link button is clicked.
The program asks the user for the address and then calls xtk_richtext_set_link() on the target and redraws it.
XtkRichTextToolbarActionCallback
typedef int (*XtkRichTextToolbarActionCallback)(XtkRichTextToolbar *richtext_toolbar, const char *action, void *user_data);
Asked first when any button is clicked, so the program can do the action itself.
A program that shows the Markdown source in a view of its own uses it to edit that view while the source is shown.
XtkRichTextToolbarGroupsReorderedCallback
typedef void (*XtkRichTextToolbarGroupsReorderedCallback)(XtkRichTextToolbar *richtext_toolbar, void *user_data);
Called once after the user drags a group to a new place and lets go.
Not called for each step of the drag, nor for a click on a grip. Read the new layout here with xtk_richtext_toolbar_get_group_order() and xtk_richtext_toolbar_get_group_rows() to keep it; the height may have changed too.
Constants
XTK_RICHTEXT_TOOLBAR_GROUP_COUNT
#define XTK_RICHTEXT_TOOLBAR_GROUP_COUNT 8
The number of button groups: the length of the arrays that xtk_richtext_toolbar_get_group_order(), xtk_richtext_toolbar_set_group_order(), xtk_richtext_toolbar_get_group_rows() and xtk_richtext_toolbar_set_group_rows() use.
Functions
xtk_richtext_toolbar_create
XtkRichTextToolbar *xtk_richtext_toolbar_create(
Display *display,
int screen,
Window parent,
int x,
int y,
int width,
ConfigColor background,
const ButtonBlock *button_theme,
const TooltipBlock *tooltip_theme,
XtkRichText *target);
Make a formatting toolbar, mapped, as a child of a window.
Its height comes from the width: read it with xtk_richtext_toolbar_get_height().
| Parameter | Description |
|---|---|
display |
The X display |
screen |
The screen number |
parent |
The window the toolbar is made in |
x |
The x position in the parent |
y |
The y position in the parent |
width |
The width in pixels; the groups wrap to fit. 0 or less gives the narrowest toolbar. |
background |
The color behind the buttons and grips. It is separate from the buttons' own background, so the toolbar can match, for example, a menu bar while the buttons match a panel. |
button_theme |
The buttons' colors and font (normally &config.button) |
tooltip_theme |
The tooltips' colors and font (normally &config.tooltip), or NULL for the dark tooltip preset |
target |
The editor the buttons act on, or NULL (then the buttons that act on the editor do nothing until a target is set) |
Returns: The toolbar, or NULL if display is NULL or the window cannot be made
xtk_richtext_toolbar_destroy
void xtk_richtext_toolbar_destroy(XtkRichTextToolbar *richtext_toolbar);
Destroy the toolbar, its buttons and its tooltip.
The target editor is not destroyed.
| Parameter | Description |
|---|---|
richtext_toolbar |
The toolbar (NULL is ignored) |
xtk_richtext_toolbar_set_theme
void xtk_richtext_toolbar_set_theme(
XtkRichTextToolbar *richtext_toolbar,
ConfigColor background,
const ButtonBlock *button_theme,
const TooltipBlock *tooltip_theme);
Give the toolbar new colors and redraw it.
The border color set with xtk_richtext_toolbar_set_border_color() is not changed; set it again if it should follow the theme.
| Parameter | Description |
|---|---|
richtext_toolbar |
The toolbar |
background |
The color behind the buttons |
button_theme |
The buttons' colors and font; when NULL nothing changes |
tooltip_theme |
The tooltips' colors and font, or NULL to keep them |
xtk_richtext_toolbar_set_border_sides
void xtk_richtext_toolbar_set_border_sides(
XtkRichTextToolbar *richtext_toolbar,
int sides_mask);
Choose which edges of the toolbar get a one-pixel border line.
There is no border at first. A toolbar placed above an editor can draw only its top edge, for example, to line up with the title bars next to it.
| Parameter | Description |
|---|---|
richtext_toolbar |
The toolbar |
sides_mask |
An OR of XTK_RICHTEXT_BORDER_TOP, XTK_RICHTEXT_BORDER_RIGHT, XTK_RICHTEXT_BORDER_BOTTOM and XTK_RICHTEXT_BORDER_LEFT, or 0 for none |
xtk_richtext_toolbar_set_border_color
void xtk_richtext_toolbar_set_border_color(
XtkRichTextToolbar *richtext_toolbar,
ConfigColor color);
Set the color of the border lines.
At first it is the button theme's border color, so a program can set it to match another widget's border instead.
| Parameter | Description |
|---|---|
richtext_toolbar |
The toolbar |
color |
The border color |
xtk_richtext_toolbar_get_window
Window xtk_richtext_toolbar_get_window(const XtkRichTextToolbar *richtext_toolbar);
The toolbar's window.
| Parameter | Description |
|---|---|
richtext_toolbar |
The toolbar |
Returns: The window, or None if richtext_toolbar is NULL
xtk_richtext_toolbar_get_height
int xtk_richtext_toolbar_get_height(const XtkRichTextToolbar *richtext_toolbar);
The toolbar's height, which depends on its width.
Ask again after xtk_richtext_toolbar_resize(), and after the user moves a group to another row.
| Parameter | Description |
|---|---|
richtext_toolbar |
The toolbar |
Returns: The height in pixels, or 0 if richtext_toolbar is NULL
xtk_richtext_toolbar_set_position
void xtk_richtext_toolbar_set_position(
XtkRichTextToolbar *richtext_toolbar,
int x,
int y);
Move the toolbar in its parent.
| Parameter | Description |
|---|---|
richtext_toolbar |
The toolbar |
x |
The new x position in the parent |
y |
The new y position in the parent |
xtk_richtext_toolbar_resize
void xtk_richtext_toolbar_resize(XtkRichTextToolbar *richtext_toolbar, int width);
Change the toolbar's width and lay the groups out again.
The height can change; the caller moves whatever is below the toolbar.
| Parameter | Description |
|---|---|
richtext_toolbar |
The toolbar |
width |
The new width in pixels; 0 or less is ignored |
xtk_richtext_toolbar_set_target
void xtk_richtext_toolbar_set_target(
XtkRichTextToolbar *richtext_toolbar,
XtkRichText *target);
Make the buttons act on another editor, for example when the program switches documents.
The toolbar is not redrawn; call xtk_richtext_toolbar_draw().
| Parameter | Description |
|---|---|
richtext_toolbar |
The toolbar |
target |
The editor, or NULL for none |
xtk_richtext_toolbar_handle_event
int xtk_richtext_toolbar_handle_event(
XtkRichTextToolbar *richtext_toolbar,
XEvent *event);
Give the toolbar an X event.
It handles the buttons (hover, press, click, keys), their tooltips, the dragging of groups, and the toolbar's Expose. A click asks the action callback first, then either calls the request callback (color, image, link) or applies the action to the target and redraws the target and the toolbar.
| Parameter | Description |
|---|---|
richtext_toolbar |
The toolbar |
event |
The event |
Returns: 1 if the event was the toolbar's (an Expose included), 0 otherwise
xtk_richtext_toolbar_draw
void xtk_richtext_toolbar_draw(XtkRichTextToolbar *richtext_toolbar);
Redraw the toolbar, with the buttons pressed and enabled as the target's state says.
Call it after the target's caret or content changed, so the pressed buttons and Undo and Redo follow.
| Parameter | Description |
|---|---|
richtext_toolbar |
The toolbar (NULL is ignored) |
xtk_richtext_toolbar_set_formatting_enabled
void xtk_richtext_toolbar_set_formatting_enabled(
XtkRichTextToolbar *richtext_toolbar,
int enabled);
Disable every button but Plain Text, or enable them again.
For a program that shows the Markdown source in a view of its own while Plain Text is pressed: the buttons would change the target's text, which is not on screen then.
| Parameter | Description |
|---|---|
richtext_toolbar |
The toolbar |
enabled |
0 to disable them; 1 (the default) to enable them |
xtk_richtext_toolbar_set_plain_text
void xtk_richtext_toolbar_set_plain_text(
XtkRichTextToolbar *richtext_toolbar,
int pressed);
Show the Plain Text switch pressed or released as the program says.
Normally the switch follows the target's mode. After this call it shows what the program set, for a program that shows the source in a view of its own. There is no call to go back to following the target.
| Parameter | Description |
|---|---|
richtext_toolbar |
The toolbar |
pressed |
1 for pressed, 0 for released |
xtk_richtext_toolbar_get_tooltip
struct XtkTooltip *xtk_richtext_toolbar_get_tooltip(
const XtkRichTextToolbar *richtext_toolbar);
The toolbar's tooltip, for the program to call xtk_tooltip_update() on.
Call xtk_tooltip_update() on it from the timer tick, or the tooltips never appear.
| Parameter | Description |
|---|---|
richtext_toolbar |
The toolbar |
Returns: The tooltip, or NULL if richtext_toolbar is NULL or it could not be made
xtk_richtext_toolbar_sync_hover
void xtk_richtext_toolbar_sync_hover(XtkRichTextToolbar *richtext_toolbar);
Clear a hover border that X left on a button.
X does not always send the LeaveNotify that clears a button's hover look; this checks where the pointer really is (see xtk_button_sync_hover()). Call it from the same tick as xtk_tooltip_update().
| Parameter | Description |
|---|---|
richtext_toolbar |
The toolbar (NULL is ignored) |
xtk_richtext_toolbar_set_focused
void xtk_richtext_toolbar_set_focused(XtkRichTextToolbar *richtext_toolbar, int focused);
Give the toolbar keyboard focus, or take it away.
The toolbar is one Tab stop, not one per button. With focus, one button has the focus look (the first enabled one, or the one that had it before), and Left and Right move it between the enabled buttons.
| Parameter | Description |
|---|---|
richtext_toolbar |
The toolbar |
focused |
Non-zero to give it focus, 0 to take focus away |
xtk_richtext_toolbar_get_focused
int xtk_richtext_toolbar_get_focused(const XtkRichTextToolbar *richtext_toolbar);
Whether one of the toolbar's buttons has keyboard focus.
| Parameter | Description |
|---|---|
richtext_toolbar |
The toolbar |
Returns: 1 if a button has focus, 0 if not or if richtext_toolbar is NULL
xtk_richtext_toolbar_get_focus_window
Window xtk_richtext_toolbar_get_focus_window(const XtkRichTextToolbar *richtext_toolbar);
The window that has, or would get, the toolbar's keyboard focus.
Register this window with the program's Tab focus handling, and compare the focus window with it.
| Parameter | Description |
|---|---|
richtext_toolbar |
The toolbar |
Returns: The focused button's window (or the first enabled button's), or None if no button is enabled or richtext_toolbar is NULL
xtk_richtext_toolbar_set_image_request_callback
void xtk_richtext_toolbar_set_image_request_callback(
XtkRichTextToolbar *richtext_toolbar,
XtkRichTextToolbarImageRequestCallback callback,
void *user_data);
Set the function called when the Insert Image button is clicked.
| Parameter | Description |
|---|---|
richtext_toolbar |
The toolbar |
callback |
The function, or NULL for none (the button then does nothing) |
user_data |
Passed to the callback |
xtk_richtext_toolbar_set_color_request_callback
void xtk_richtext_toolbar_set_color_request_callback(
XtkRichTextToolbar *richtext_toolbar,
XtkRichTextToolbarColorRequestCallback callback,
void *user_data);
Set the function called when a color button is clicked.
| Parameter | Description |
|---|---|
richtext_toolbar |
The toolbar |
callback |
The function, or NULL for none (the buttons then do nothing) |
user_data |
Passed to the callback |
xtk_richtext_toolbar_set_link_request_callback
void xtk_richtext_toolbar_set_link_request_callback(
XtkRichTextToolbar *richtext_toolbar,
XtkRichTextToolbarLinkRequestCallback callback,
void *user_data);
Set the function called when the Insert Link button is clicked.
| Parameter | Description |
|---|---|
richtext_toolbar |
The toolbar |
callback |
The function, or NULL for none (the button then does nothing) |
user_data |
Passed to the callback |
xtk_richtext_toolbar_set_action_callback
void xtk_richtext_toolbar_set_action_callback(
XtkRichTextToolbar *richtext_toolbar,
XtkRichTextToolbarActionCallback callback,
void *user_data);
Set the action callback.
| Parameter | Description |
|---|---|
richtext_toolbar |
The toolbar |
callback |
The function, or NULL for none |
user_data |
Passed to it |
xtk_richtext_toolbar_set_history
void xtk_richtext_toolbar_set_history(
XtkRichTextToolbar *richtext_toolbar,
int can_undo,
int can_redo);
Enable Undo and Redo as the program says, or as the target's history says, and redraw.
For a program whose own source view has its own history.
| Parameter | Description |
|---|---|
richtext_toolbar |
The toolbar |
can_undo |
1 to enable Undo, 0 to disable it, -1 to follow the target |
can_redo |
1 to enable Redo, 0 to disable it, -1 to follow the target |
xtk_richtext_toolbar_set_groups_reordered_callback
void xtk_richtext_toolbar_set_groups_reordered_callback(
XtkRichTextToolbar *richtext_toolbar,
XtkRichTextToolbarGroupsReorderedCallback callback,
void *user_data);
Set the function called after the user moves a group.
| Parameter | Description |
|---|---|
richtext_toolbar |
The toolbar |
callback |
The function, or NULL for none |
user_data |
Passed to the callback |
xtk_richtext_toolbar_get_group_order
void xtk_richtext_toolbar_get_group_order(
const XtkRichTextToolbar *richtext_toolbar,
int *out_order);
The groups' order, left to right.
Each value is a group number, 0 to 7, in the order of the group list in the file description (0 is History, 7 is Indent). The numbers do not change between versions of the toolbar, so they can be saved and given to xtk_richtext_toolbar_set_group_order() in a later run.
| Parameter | Description |
|---|---|
richtext_toolbar |
The toolbar |
out_order |
Receives XTK_RICHTEXT_TOOLBAR_GROUP_COUNT group numbers, left to right |
xtk_richtext_toolbar_set_group_order
void xtk_richtext_toolbar_set_group_order(
XtkRichTextToolbar *richtext_toolbar,
const int *order);
Set the groups' order, left to right, and lay them out again.
Call it right after xtk_richtext_toolbar_create(). The array must hold each group number from 0 to XTK_RICHTEXT_TOOLBAR_GROUP_COUNT - 1 once; any other array is ignored and the order stays as it was.
| Parameter | Description |
|---|---|
richtext_toolbar |
The toolbar |
order |
XTK_RICHTEXT_TOOLBAR_GROUP_COUNT group numbers, left to right |
xtk_richtext_toolbar_get_group_rows
void xtk_richtext_toolbar_get_group_rows(
const XtkRichTextToolbar *richtext_toolbar,
int *out_rows);
The row each group is placed on.
The array is indexed by group number (not by place), and each value is a row number from 0. All groups are on row 0 at first; a row that is too long for the width still wraps. Rows with no group are skipped.
| Parameter | Description |
|---|---|
richtext_toolbar |
The toolbar |
out_rows |
Receives XTK_RICHTEXT_TOOLBAR_GROUP_COUNT row numbers |
xtk_richtext_toolbar_set_group_rows
void xtk_richtext_toolbar_set_group_rows(
XtkRichTextToolbar *richtext_toolbar,
const int *rows);
Set the row of each group, and lay them out again.
Call it right after xtk_richtext_toolbar_create(), like xtk_richtext_toolbar_set_group_order(). Each value must be from 0 to XTK_RICHTEXT_TOOLBAR_GROUP_COUNT - 1; if one is not, the array is ignored and the rows stay as they were.
| Parameter | Description |
|---|---|
richtext_toolbar |
The toolbar |
rows |
XTK_RICHTEXT_TOOLBAR_GROUP_COUNT row numbers, indexed by group number |
xtk_richtext_toolbar_get_hovered
int xtk_richtext_toolbar_get_hovered(const XtkRichTextToolbar *richtext_toolbar);
The button under the pointer, for showing a hover without moving the pointer.
| Parameter | Description |
|---|---|
richtext_toolbar |
The toolbar |
Returns: The button's number in the order of the action names listed at XtkRichTextToolbarActionCallback (0 is bold, 37 is plain-text), or -1 if the pointer is over no button or richtext_toolbar is NULL
xtk API
Widgets
- button
- checkbox
- radiobutton
- label
- entry
- textview
- edit_history
- spinbutton
- slider
- progressbar
- combobox
- scrollbar
- swatch
- panel
- statusbar
- tooltip
- toolbar
- icongrid
- iconview
- pathbar
- treeview
- datagrid
- graph
- scheme_wheel
- zoom
- tray
Containers and menus
Dialogs
Rich text
Drawing and images
Color
Configuration and themes
Input and the X server
Safety
Data formats