1 xtk_notebook
liquibyte edited this page 2026-11-19 16:23:20 -06:00

xtk_notebook.h

A tabbed container: a strip of tabs over a stack of pages, one shown at a time.

A notebook shows one page at a time and a tab for each page; a click on a tab shows its page. Each page is an X window that the notebook makes; the program puts the page's widgets in it (xtk_notebook_get_page_window()). A tab shows a label, and can also show an icon, a label color of its own and a close button.

The tabs are above the pages by default; they can also be below, or in a column at the left or the right (xtk_notebook_set_tab_position()), or not shown at all. In a strip (above or below), the tabs can be made closable, reorderable by dragging, and scrollable when they do not fit; these three are off by default. A column is meant for a fixed set of pages, as in a settings dialog: its tabs are never closable, reorderable or scrolled.

Making it. Call xtk_notebook_create() with the parent window, the whole XtkConfig and the box (the tabs included). The notebook maps its window. Add pages with xtk_notebook_append_page(); the first page added is shown. The program owns the notebook and frees it with xtk_notebook_destroy(), which destroys every page window and so every window inside the pages: destroy the page widgets first.

Events. Pass each XEvent to xtk_notebook_handle_event(). It handles the events of the notebook's own window (the tabs) and returns 0 for those of the page windows, which the page widgets handle. A click on a tab shows its page and gives the notebook the keyboard focus. While it has the focus:

  • Left or Up shows the previous page, Right or Down the next one (both wrap around at the ends);
  • Home shows the first page and End the last;
  • other keys are not used, so a focus manager still sees Ctrl+Tab.

With scrolling on and too many tabs, two arrows appear at the right end of the strip: they show the previous or the next page, and the strip scrolls to keep the current tab in view; the mouse wheel over the strip scrolls it. There is no callback when the page changes; the close and reorder callbacks are described at their types.

Theme keys. Section [notebook]:

  • font-family (or font): the tab label font. Default sans.
  • font-size: the tab label size in pixels. Default 11.
  • color: the tab label text. Default #F2F2F2.
  • background: an inactive tab (a gradient is allowed). Default #404040.
  • border: the tab borders and the line between the tabs and the pages; also a dimmed scroll arrow. Default #262626.
  • hover-background: a tab under the pointer (a gradient is allowed). Default #4D4D4D.
  • active-background: the current tab (a gradient is allowed). Default #595959.
  • active-border: the current tab's border. Default #80B3FF.
  • focus-border: the current tab's border while the notebook has the keyboard focus. Default #80B3FF.
  • tab-bar-background: the strip behind the tabs (a gradient is allowed). Default: the background value, #404040.
  • content-background: the pages' background (a gradient is allowed). Default #2E2E2E.
  • content-foreground: a text color for the pages' own widgets to use; the notebook itself does not draw with it. Default #E6E6E6.

The section may also give highlight and shade for a bevel on the tabs (see xtk_paint.h).

Section [notebook-widget] (pixels): tab-height 32, tab-padding 12 (inside each tab, on each side), tab-min-width 80, border-width 1 and border-radius 4 (the tabs' top corners). These are the defaults; a theme or config file can set them, and a program can set the config.notebook_widget fields before it makes the notebook. Reading the section also copies each value to the matching field of config.notebook (tab_height and the rest), so the two always agree; the notebook draws with config.notebook_widget.

The close buttons use the [toolwindow] colors icon-foreground, icon-hover-foreground and icon-hover-background, to look like the close buttons of dock panels. A disabled notebook blends every tab color 40 percent of the way toward background. The defaults are those xtk_config_init_defaults() sets; a theme applied with xtk_theme_apply() replaces the colors.

Example.

XtkConfig config;
xtk_config_init_defaults(&config);
XtkTheme *theme = xtk_theme_new();
if (theme && xtk_theme_builtin("Dark", theme)) xtk_theme_apply(&config, theme);
xtk_theme_free(theme);

XtkNotebook *notebook = xtk_notebook_create(display, screen, window, &config,
                                            0, 0, 600, 400);
int general = xtk_notebook_append_page(notebook, "General");
xtk_notebook_append_page(notebook, "Advanced");
Window page = xtk_notebook_get_page_window(notebook, general);
// make the "General" widgets with page as their parent

XEvent event;
while (running) {
    XNextEvent(display, &event);
    if (xtk_notebook_handle_event(notebook, &event)) continue;
    // ... the page widgets and the program's other windows
}
xtk_notebook_destroy(notebook);
 * 

Limitations.

  • The tab height is read from the config only when the notebook is made; use xtk_notebook_set_tab_height() to change it later.
  • Labels keep at most 63 bytes.
  • The rail label (xtk_notebook_set_rail_label()) has fixed colors and is drawn only when the tabs are above or below the pages.
  • The notebook keeps the XtkConfig pointer, so the config must stay valid as long as the notebook does.
#include "xtk_notebook.h"

Types: XtkNotebook, XtkNotebookCloseCallback, XtkNotebookReorderCallback, XtkNotebookTabPosition

Functions: xtk_notebook_create, xtk_notebook_destroy, xtk_notebook_get_window, xtk_notebook_set_position, xtk_notebook_resize, xtk_notebook_set_enabled, xtk_notebook_get_enabled, xtk_notebook_show, xtk_notebook_hide, xtk_notebook_get_hidden, xtk_notebook_append_page, xtk_notebook_remove_page, xtk_notebook_get_page_window, xtk_notebook_set_page_icon, xtk_notebook_set_page_label, xtk_notebook_set_page_label_color, xtk_notebook_set_current_page, xtk_notebook_move_page, xtk_notebook_get_current_page, xtk_notebook_get_n_pages, xtk_notebook_handle_event, xtk_notebook_set_focused, xtk_notebook_get_focused, xtk_notebook_get_focus_window, xtk_notebook_draw, xtk_notebook_set_theme, xtk_notebook_set_tab_height, xtk_notebook_set_rail_label, xtk_notebook_set_tabs_left, xtk_notebook_get_tabs_left, xtk_notebook_set_tab_position, xtk_notebook_get_tab_position, xtk_notebook_set_tabs_shown, xtk_notebook_point_in_tabs, xtk_notebook_tab_at, xtk_notebook_animate, xtk_notebook_set_tabs_closable, xtk_notebook_get_tabs_closable, xtk_notebook_set_close_callback, xtk_notebook_set_tabs_reorderable, xtk_notebook_get_tabs_reorderable, xtk_notebook_set_reorder_callback, xtk_notebook_set_tabs_scrollable, xtk_notebook_get_tabs_scrollable, xtk_notebook_config_init_defaults, xtk_notebook_config_parse_styling, xtk_notebook_config_write_styling, xtk_notebook_widget_config_init_defaults, xtk_notebook_get_hover_tab, xtk_notebook_set_hover_tab

Types

XtkNotebook

typedef struct XtkNotebook XtkNotebook;

A tabbed container; opaque, made by xtk_notebook_create().

XtkNotebookCloseCallback

typedef void (*XtkNotebookCloseCallback)(XtkNotebook *notebook, int page_number, void *user_data);

Called when the user clicks a tab's close button (see xtk_notebook_set_tabs_closable()).

The notebook does not remove the page itself. The program decides, for example after asking whether to save changes, and calls xtk_notebook_remove_page() if the page is to go. It may do so inside the callback.

XtkNotebookReorderCallback

typedef void (*XtkNotebookReorderCallback)(XtkNotebook *notebook, int old_index, int new_index, void *user_data);

Called after the user has dragged a tab to a new place (see xtk_notebook_set_tabs_reorderable()).

The notebook has already moved the page (its tab and its window), and the current page number already follows the move. The callback is for a program that keeps page numbers of its own, so it can update them. It is called last, when the button is released, and may destroy the notebook. It is not called when the tab ends where it started, nor for xtk_notebook_move_page().

XtkNotebookTabPosition

Where a notebook's tabs are.

Name Value Description
XTK_NOTEBOOK_TABS_TOP
XTK_NOTEBOOK_TABS_BOTTOM
XTK_NOTEBOOK_TABS_LEFT
XTK_NOTEBOOK_TABS_RIGHT

Functions

xtk_notebook_create

XtkNotebook *xtk_notebook_create(
    Display *display,
    int screen,
    Window parent,
    XtkConfig *theme,
    int x,
    int y,
    int width,
    int height);

Create a notebook with no pages and map its window.

Parameter Description
display The X display
screen The screen number
parent The parent window
theme The configuration: its notebook, notebook_widget and toolwindow blocks are used. The notebook keeps the pointer, so it must stay valid as long as the notebook does.
x The X position in the parent, in pixels
y The Y position in the parent, in pixels
width The width in pixels; must be at least 1
height The height in pixels, the tabs included; must be more than the tab height

Returns: The new notebook, or NULL if display, parent or theme is missing or memory runs out

xtk_notebook_destroy

void xtk_notebook_destroy(XtkNotebook *notebook);

Destroy the notebook, every page window (with all windows inside the pages) and its own window.

Parameter Description
notebook The notebook (NULL does nothing)

xtk_notebook_get_window

Window xtk_notebook_get_window(const XtkNotebook *notebook);

Get the notebook's own window, which holds the tabs and, as its children, every page window.

Use it to put the notebook into another container, such as a slot of an xtk_splitpane.h split pane.

Parameter Description
notebook The notebook

Returns: The window, or None if notebook is NULL

xtk_notebook_set_position

void xtk_notebook_set_position(XtkNotebook *notebook, int x, int y);

Move the notebook within its parent.

Parameter Description
notebook The notebook (NULL does nothing)
x The new X position in the parent, in pixels
y The new Y position in the parent, in pixels

xtk_notebook_resize

void xtk_notebook_resize(XtkNotebook *notebook, int width, int height);

Resize the notebook and every page window, and redraw.

Parameter Description
notebook The notebook (NULL does nothing)
width The new width in pixels; 0 or less does nothing
height The new height in pixels, the tabs included; 0 or less does nothing

xtk_notebook_set_enabled

void xtk_notebook_set_enabled(XtkNotebook *notebook, int enabled);

Enable or disable the tabs.

A disabled notebook draws its tabs dimmed and ignores clicks, keys, the wheel and drags; it still redraws on Expose. The widgets in the pages are not changed.

Parameter Description
notebook The notebook (NULL does nothing)
enabled 1 to enable, 0 to disable

xtk_notebook_get_enabled

int xtk_notebook_get_enabled(const XtkNotebook *notebook);

Tell whether the tabs are enabled.

Parameter Description
notebook The notebook

Returns: 1 if enabled, 0 if disabled or notebook is NULL

xtk_notebook_show

void xtk_notebook_show(XtkNotebook *notebook);

Show the notebook (map its window) after xtk_notebook_hide().

The page windows are inside it, so they show and hide with it. xtk_notebook_create() already maps the notebook.

Parameter Description
notebook The notebook (NULL does nothing)

xtk_notebook_hide

void xtk_notebook_hide(XtkNotebook *notebook);

Hide the notebook (unmap its window), with all its pages.

Parameter Description
notebook The notebook (NULL does nothing)

xtk_notebook_get_hidden

int xtk_notebook_get_hidden(const XtkNotebook *notebook);

Tell whether the notebook was hidden with xtk_notebook_hide().

Parameter Description
notebook The notebook

Returns: 1 if hidden, 0 if not or notebook is NULL

xtk_notebook_append_page

int xtk_notebook_append_page(XtkNotebook *notebook, const char *label);

Add a page at the end, with a page window of its own.

The first page added is shown at once; later pages are shown when their tab is chosen. The page window has the content-background color.

Parameter Description
notebook The notebook
label The tab's label, copied (at most 63 bytes)

Returns: The new page's number (from 0), or -1 if notebook or label is NULL or memory runs out

xtk_notebook_remove_page

void xtk_notebook_remove_page(XtkNotebook *notebook, int page_number);

Remove a page and destroy its page window, with every window inside it.

The pages after it move one place down. If it was the current page, the page that takes its place (or the new last page) is shown. A tab drag in progress is cancelled. Destroy the page's widgets first.

Parameter Description
notebook The notebook (NULL does nothing)
page_number The page, from 0 (a number that is not a page does nothing)

xtk_notebook_get_page_window

Window xtk_notebook_get_page_window(XtkNotebook *notebook, int page_number);

Get a page's window, the parent for that page's widgets.

Parameter Description
notebook The notebook
page_number The page, from 0

Returns: The page window, or None if there is no such page

xtk_notebook_set_page_icon

void xtk_notebook_set_page_icon(
    XtkNotebook *notebook,
    int page_number,
    const char *icon_key);

Set or remove a page's tab icon, and redraw.

The icon is drawn at the left of the label, in the label's color, and the tab grows to fit it.

Parameter Description
notebook The notebook (NULL does nothing)
page_number The page, from 0
icon_key The key of an icon in xtk_icon.h (see xtk_icon_list()), copied (at most 31 bytes); NULL or "" to remove it. An unknown key draws nothing but still takes the space.

xtk_notebook_set_page_label

void xtk_notebook_set_page_label(
    XtkNotebook *notebook,
    int page_number,
    const char *label);

Change a page's label, for example when a document's name or state changes, and redraw.

Parameter Description
notebook The notebook (NULL does nothing)
page_number The page, from 0
label The new label, copied (at most 63 bytes); NULL does nothing

xtk_notebook_set_page_label_color

void xtk_notebook_set_page_label_color(
    XtkNotebook *notebook,
    int page_number,
    const ConfigColor *color);

Give a page's label a color of its own, for example for a page with news the user has not seen, and redraw.

The color replaces the theme's color in every state of the tab (current, under the pointer, plain); a disabled notebook dims it as it dims the theme's color. The color stays with the page when the page moves.

Parameter Description
notebook The notebook (NULL does nothing)
page_number The page, from 0
color The color, copied; NULL for the theme's color again

xtk_notebook_set_current_page

void xtk_notebook_set_current_page(XtkNotebook *notebook, int page_number);

Show a page.

The page's window is mapped, the old page's window unmapped, and the strip scrolls to keep the tab in view. No callback is called.

Parameter Description
notebook The notebook (NULL does nothing)
page_number The page, from 0 (a number that is not a page does nothing)

xtk_notebook_move_page

void xtk_notebook_move_page(XtkNotebook *notebook, int from, int to);

Move a page (its tab and its window) to another place.

The pages in between move one place to fill the gap; the current page stays the same page (its number may change). No callback is called: the program moved it, so it knows.

Parameter Description
notebook The notebook (NULL does nothing)
from The page's number now
to The number it is to have; both must be page numbers

xtk_notebook_get_current_page

int xtk_notebook_get_current_page(const XtkNotebook *notebook);

Get the page that is shown.

Parameter Description
notebook The notebook

Returns: The page's number, or -1 if there are no pages or notebook is NULL

xtk_notebook_get_n_pages

int xtk_notebook_get_n_pages(const XtkNotebook *notebook);

Get the number of pages.

Parameter Description
notebook The notebook

Returns: The number of pages, or 0 if notebook is NULL

xtk_notebook_handle_event

int xtk_notebook_handle_event(XtkNotebook *notebook, const XEvent *event);

Give an X event to the notebook.

The close and reorder callbacks are called from inside this call.

Parameter Description
notebook The notebook
event The event; must not be NULL

Returns: 1 if the event was for the notebook's own window and it used it; 0 for events of the page windows and other windows, for a key the notebook does not use, for any event but Expose while it is disabled, and if notebook is NULL

xtk_notebook_set_focused

void xtk_notebook_set_focused(XtkNotebook *notebook, int focused);

Give the tabs the keyboard focus, or draw them as not having it.

While the tabs have the focus, the arrow keys, Home and End change the page, and the current tab has the focus-border color. A click on a tab already gives the focus; this call is for a program's own focus handling (for example the Tab key).

Parameter Description
notebook The notebook (NULL does nothing)
focused Not 0: take the X input focus (if the notebook is viewable) and draw the focus border. 0: draw it without the focus border; the X focus stays until another window takes it.

xtk_notebook_get_focused

int xtk_notebook_get_focused(const XtkNotebook *notebook);

Tell whether the tabs have the keyboard focus.

Parameter Description
notebook The notebook

Returns: Not 0 if they have it, 0 if not or notebook is NULL

xtk_notebook_get_focus_window

Window xtk_notebook_get_focus_window(const XtkNotebook *notebook);

Get the window that takes the keyboard focus for the notebook.

Parameter Description
notebook The notebook

Returns: The notebook's own window, or None if notebook is NULL

xtk_notebook_draw

void xtk_notebook_draw(XtkNotebook *notebook);

Redraw the tabs now.

Parameter Description
notebook The notebook (NULL does nothing)

xtk_notebook_set_theme

void xtk_notebook_set_theme(XtkNotebook *notebook, XtkConfig *theme);

Use a configuration's new style: open the font again, repaint the page backgrounds, and redraw.

Call it after a new theme is applied to the configuration. The tab height is not read again.

Parameter Description
notebook The notebook (NULL does nothing)
theme The configuration (NULL does nothing). The notebook keeps this pointer in place of the old one.

xtk_notebook_set_tab_height

void xtk_notebook_set_tab_height(XtkNotebook *notebook, int height);

Set the height of the tabs (or of each tab in a column), resize every page window to match, and redraw.

Parameter Description
notebook The notebook (NULL does nothing)
height The height in pixels; less than 16 does nothing

xtk_notebook_set_rail_label

void xtk_notebook_set_rail_label(XtkNotebook *notebook, const char *text);

Show a short text in a green pill at the right end of the tab strip.

The pill has fixed colors (green text on dark green). It is drawn only when the tabs are above or below the pages, and it is drawn over any tab that reaches that far.

Parameter Description
notebook The notebook (NULL does nothing)
text The text, copied (at most 255 bytes); NULL for none

xtk_notebook_set_tabs_left

void xtk_notebook_set_tabs_left(XtkNotebook *notebook, int left);

Put the tabs in a column at the left of the pages, one under another, or back above the pages.

It is xtk_notebook_set_tab_position() with XTK_NOTEBOOK_TABS_LEFT or XTK_NOTEBOOK_TABS_TOP. The column is as wide as the widest tab (at least tab-min-width); the pages fill the rest. In the column, tabs are not closable, reorderable or scrolled, whatever the setters below say: it is meant for a fixed set of pages, as in a settings dialog.

Parameter Description
notebook The notebook (NULL does nothing)
left Not 0 for the column at the left; 0 for tabs above (also when they were below)

xtk_notebook_get_tabs_left

int xtk_notebook_get_tabs_left(const XtkNotebook *notebook);

Tell whether the tabs are in a column at the left.

Parameter Description
notebook The notebook

Returns: Not 0 if the tabs are at the left; 0 otherwise (also for a column at the right, and if notebook is NULL)

xtk_notebook_set_tab_position

void xtk_notebook_set_tab_position(
    XtkNotebook *notebook,
    XtkNotebookTabPosition position);

Put the tabs above, below, at the left or at the right of the pages, and redraw.

Left and right are a column, as described at xtk_notebook_set_tabs_left(). A tab drag in progress is cancelled.

Parameter Description
notebook The notebook (NULL does nothing)
position Where the tabs go. The values are XTK_NOTEBOOK_TABS_TOP (the default), XTK_NOTEBOOK_TABS_BOTTOM, XTK_NOTEBOOK_TABS_LEFT and XTK_NOTEBOOK_TABS_RIGHT.

xtk_notebook_get_tab_position

XtkNotebookTabPosition xtk_notebook_get_tab_position(const XtkNotebook *notebook);

Get where the tabs are.

Parameter Description
notebook The notebook

Returns: The tab position, or XTK_NOTEBOOK_TABS_TOP if notebook is NULL

xtk_notebook_set_tabs_shown

void xtk_notebook_set_tabs_shown(XtkNotebook *notebook, int shown);

Show or hide the tabs.

Without tabs, the pages fill the whole notebook and only the program can change the page.

Parameter Description
notebook The notebook (NULL does nothing)
shown 1 to show the tabs (the default), 0 to hide them

xtk_notebook_point_in_tabs

int xtk_notebook_point_in_tabs(const XtkNotebook *notebook, int x, int y);

Tell whether a point of the notebook's window is over the tab strip (or column), for example to act on a double click there.

Parameter Description
notebook The notebook
x The point's X in the notebook's window, in pixels
y The point's Y in the notebook's window, in pixels

Returns: 1 if the point is over the tabs' area, 0 if not, if the tabs are hidden or notebook is NULL

xtk_notebook_tab_at

int xtk_notebook_tab_at(const XtkNotebook *notebook, int x, int y);

Tell which tab a point of the notebook's window is over, for example to tell a double click on a tab from one on the empty strip beside the tabs.

Parameter Description
notebook The notebook
x The point's X in the notebook's window, in pixels
y The point's Y in the notebook's window, in pixels

Returns: The tab's page number; -2 if the point is over the scroll arrows; -1 if it is over the empty part of the strip, outside the strip, if the tabs are hidden or notebook is NULL

xtk_notebook_animate

int xtk_notebook_animate(XtkNotebook *notebook);

Move the tabs that slide one step on, and redraw them.

Call it from the program's main loop, at least 30 times a second while it returns 1. Once a program calls it, the tabs a drag moves slide to their new places (see xtk_notebook_set_tabs_reorderable()); without it they jump there. When no tab slides, it draws nothing.

Parameter Description
notebook The notebook (NULL does nothing)

Returns: 1 while a tab is still sliding, 0 when none is or notebook is NULL

xtk_notebook_set_tabs_closable

void xtk_notebook_set_tabs_closable(XtkNotebook *notebook, int closable);

Give every tab a small close button ("x"), or remove them, and redraw.

The button takes space of its own, so the tabs grow. A click on it calls the close callback and does not change the page; the notebook does not remove the page itself (see XtkNotebookCloseCallback).

Parameter Description
notebook The notebook (NULL does nothing)
closable 1 for close buttons, 0 for none

xtk_notebook_get_tabs_closable

int xtk_notebook_get_tabs_closable(const XtkNotebook *notebook);

Tell whether the tabs have close buttons.

Parameter Description
notebook The notebook

Returns: 1 if they have, 0 if not or notebook is NULL

xtk_notebook_set_close_callback

void xtk_notebook_set_close_callback(
    XtkNotebook *notebook,
    XtkNotebookCloseCallback callback,
    void *user_data);

Set the function called when a tab's close button is clicked.

Parameter Description
notebook The notebook (NULL does nothing)
callback The function, or NULL for none
user_data A pointer passed to the function

xtk_notebook_set_tabs_reorderable

void xtk_notebook_set_tabs_reorderable(XtkNotebook *notebook, int reorderable);

Let the user drag a tab sideways to a new place, or stop that.

The dragged tab follows the pointer, drawn over the others, and a gap in the strip shows where it would drop. It trades places with a neighbor as soon as the pointer passes the middle of that neighbor: the neighbor moves over into the gap, and the gap moves to the dragged tab's new place. When the button is released, the tab goes into the gap. In a program that calls xtk_notebook_animate(), the neighbors slide over and the dropped tab slides into its place; otherwise they jump there. A press that moves less than 4 pixels is a plain click and shows the page when the button is released (with dragging on, a click changes the page on release, not on press). When the drag ends, the reorder callback is called. Turning it off during a drag ends the drag.

Parameter Description
notebook The notebook (NULL does nothing)
reorderable 1 to allow dragging tabs, 0 to stop it

xtk_notebook_get_tabs_reorderable

int xtk_notebook_get_tabs_reorderable(const XtkNotebook *notebook);

Tell whether tabs can be dragged to new places.

Parameter Description
notebook The notebook

Returns: 1 if they can, 0 if not or notebook is NULL

xtk_notebook_set_reorder_callback

void xtk_notebook_set_reorder_callback(
    XtkNotebook *notebook,
    XtkNotebookReorderCallback callback,
    void *user_data);

Set the function called after the user drags a tab to a new place.

Parameter Description
notebook The notebook (NULL does nothing)
callback The function, or NULL for none
user_data A pointer passed to the function

xtk_notebook_set_tabs_scrollable

void xtk_notebook_set_tabs_scrollable(XtkNotebook *notebook, int scrollable);

Let the tab strip scroll when the tabs are wider than the notebook, or stop that, and redraw.

While the tabs do not fit, two arrows take the right end of the strip. The left arrow shows the previous page and the right arrow the next one; an arrow is dimmed at the first or the last page. The mouse wheel over the strip scrolls it 40 pixels at a time. Whenever the page changes, the strip scrolls to keep the current tab in view. While all tabs fit, nothing changes.

Parameter Description
notebook The notebook (NULL does nothing)
scrollable 1 to scroll the strip when needed, 0 not to

xtk_notebook_get_tabs_scrollable

int xtk_notebook_get_tabs_scrollable(const XtkNotebook *notebook);

Tell whether the tab strip scrolls when its tabs do not fit.

Parameter Description
notebook The notebook

Returns: 1 if it scrolls, 0 if not or notebook is NULL

xtk_notebook_config_init_defaults

void xtk_notebook_config_init_defaults(struct NotebookBlock *notebook_config);

Set a NotebookBlock to the [notebook] defaults (listed above).

xtk_config_init_defaults() already calls it for config.notebook.

Parameter Description
notebook_config The block to set (NULL does nothing)

xtk_notebook_config_parse_styling

int xtk_notebook_config_parse_styling(
    struct NotebookBlock *notebook_config,
    const char *key,
    const char *value);

Set one [notebook] key of a NotebookBlock from its text value.

The config file reader calls it for each key of the section.

Parameter Description
notebook_config The block to change
key The key, for example "active-border"
value The value as written in the file

Returns: 1 if the key is a [notebook] key, 0 if not or an argument is NULL

xtk_notebook_config_write_styling

int xtk_notebook_config_write_styling(
    FILE *file,
    const struct NotebookBlock *notebook_config);

Write a NotebookBlock as a [notebook] section, with every key.

Parameter Description
file The file to write to
notebook_config The block to write

Returns: 1 on success, 0 if an argument is NULL

xtk_notebook_widget_config_init_defaults

void xtk_notebook_widget_config_init_defaults(XtkConfig *config);

Set the [notebook-widget] defaults (listed above) in a configuration's notebook_widget block.

xtk_config_init_defaults() already calls it.

Parameter Description
config The configuration to change (NULL does nothing)

xtk_notebook_get_hover_tab

int xtk_notebook_get_hover_tab(const XtkNotebook *notebook);

Get the tab drawn as under the pointer.

Parameter Description
notebook The notebook

Returns: The tab's page number, or -1 if none or notebook is NULL

xtk_notebook_set_hover_tab

void xtk_notebook_set_hover_tab(XtkNotebook *notebook, int tab);

Draw a tab as under the pointer, without a pointer (for example to show where keyboard navigation is, or for a screenshot), and redraw.

The next pointer motion over the tabs replaces it.

Parameter Description
notebook The notebook (NULL does nothing)
tab The tab's page number, or -1 for none