|
C-Menu 0.2.9
A User Interface Toolkit
|
Backend API for terminal UI library. More...
#include <stdbool.h>#include <stddef.h>#include <stdint.h>Go to the source code of this file.
Data Structures | |
| struct | UiColor |
| Structure representing a color in the UI. More... | |
| struct | UiColorPair |
| struct | UiConfig |
| Structure representing the configuration options for the UI runtime. More... | |
| struct | UiEvent |
| Structure representing an input event in the UI. More... | |
| struct | UiRect |
| Structure representing a rectangular area in the UI. More... | |
| struct | UiStyle |
| Structure representing the style attributes for UI elements. More... | |
Macros | |
| #define | MAXWIN 30 |
Typedefs | |
| typedef struct UiRuntime | UiRuntime |
| typedef struct UiSurface | UiSurface |
Enumerations | |
| enum | UiBorderKind { UI_BORDER_NONE = 0 , UI_BORDER_ASCII , UI_BORDER_LIGHT , UI_BORDER_ROUNDED } |
| Enumeration of possible border styles for UI surfaces. More... | |
| enum | UiKey { UI_KEY_NONE = 0 , UI_KEY_CHAR , UI_KEY_ENTER , UI_KEY_ESCAPE , UI_KEY_BACKSPACE , UI_KEY_TAB , UI_KEY_BTAB , UI_KEY_UP , UI_KEY_DOWN , UI_KEY_LEFT , UI_KEY_RIGHT , UI_KEY_HOME , UI_KEY_END , UI_KEY_PGUP , UI_KEY_PGDN , UI_KEY_INSERT , UI_KEY_DELETE , UI_KEY_RESIZE , UI_KEY_MOUSE , UI_KEY_F1 , UI_KEY_F2 , UI_KEY_F3 , UI_KEY_F4 , UI_KEY_F5 , UI_KEY_F6 , UI_KEY_F7 , UI_KEY_F8 , UI_KEY_F9 , UI_KEY_F10 , UI_KEY_F11 , UI_KEY_F12 } |
| Enumeration of possible key events in the UI. More... | |
| enum | UiMouseAction { UI_MOUSE_NONE = 0 , UI_MOUSE_PRESS , UI_MOUSE_RELEASE , UI_MOUSE_DRAG , UI_MOUSE_SCROLL_UP , UI_MOUSE_SCROLL_DOWN } |
| Enumeration of possible mouse actions in the UI. More... | |
Functions | |
| int | ui_bkgd_set (UiSurface *, const UiStyle *, const char *) |
| int | ui_bkgrnd (UiSurface *, const UiStyle *, const char *) |
| int | ui_clear_screen (UiRuntime *ui) |
| Clear the entire screen. | |
| int | ui_cursor_enable (UiRuntime *ui, bool visible) |
| Enable or disable the cursor visibility. | |
| int | ui_cursor_move (UiSurface *s, int y, int x) |
| Move the cursor within a UI surface. | |
| int | ui_draw_border (UiSurface *s, UiBorderKind kind, const UiStyle *style) |
| Draw a border around a UiSurface.This function draws a border around the UiSurface's window based on the specified UiBorderKind. It uses the ncurses box function to draw the border with the appropriate characters. If a style is provided, it applies that style before drawing the border. | |
| int | ui_draw_box_title (UiSurface *s, int x, const UiStyle *style, const char *title) |
| Draw a title on the top border of a UiSurface.This function draws the provided title string at the specified x-coordinate on the top border of the UiSurface's window. It uses the ncurses mvwaddstr function to place the title. If a style is provided, it applies that style before drawing the title. | |
| int | ui_draw_hline (UiSurface *s, int y, int x, int len, const UiStyle *style) |
| Draw a horizontal line on a UiSurface.This function uses the ncurses mvwhline function to draw a horizontal line of a specified length at the given (y, x) coordinates on the UiSurface's window. If a style is provided, it applies that style before drawing the line. | |
| int | ui_draw_text (UiSurface *s, int y, int x, const UiStyle *style, const char *text) |
| Draw text on a UiSurface at a specified position with a given style.This function uses the ncurses mvwaddstr function to draw the provided text at the specified (y, x) coordinates on the UiSurface's window. If a style is provided, it applies that style before drawing the text. | |
| int | ui_draw_text_n (UiSurface *s, int y, int x, const UiStyle *style, const char *text, size_t n) |
| Draw a specified number of characters from a string on a UiSurface.This function is similar to ui_draw_text but allows specifying the number of characters to draw from the provided string. It uses the ncurses mvwaddnstr function to achieve this. If a style is provided, it applies that style before drawing the text. | |
| int | ui_draw_vline (UiSurface *s, int y, int x, int len, const UiStyle *style) |
| Draw a vertical line on a UiSurface.This function uses the ncurses mvwvline function to draw a vertical line of a specified length at the given (y, x) coordinates on the UiSurface's window. If a style is provided, it applies that style before drawing the line. | |
| int | ui_get_event (UiRuntime *ui, UiSurface *target, UiEvent *ev, int timeout_ms) |
| Retrieves an input event from the specified UI surface. | |
| void | ui_get_screen_size (UiRuntime *ui, int *rows, int *cols) |
| Get the current screen size. | |
| UiRuntime * | ui_init (const UiConfig *cfg) |
| Initialize NCUrses. | |
| int | ui_render (UiRuntime *ui) |
| Render the UI by updating panels and refreshing the screen. | |
| int | ui_resume (UiRuntime *ui) |
| Resume the UI after being suspended, reinitializing the screen. | |
| void | ui_shutdown (UiRuntime *ui) |
| Shutdown the UI runtime and free its resources. | |
| int | ui_surface_clear (UiSurface *s) |
| Clear the contents of a UI surface. | |
| void | ui_surface_destroy (UiSurface *s) |
| Destroy a UI surface and free its resources. | |
| int | ui_surface_erase (UiSurface *s) |
| Erase the contents of a UI surface. | |
| int | ui_surface_hide (UiSurface *s) |
| Hide a UI surface. | |
| int | ui_surface_move (UiSurface *s, int y, int x) |
| Move a UI surface to a new position. | |
| UiSurface * | ui_surface_new (UiRuntime *ui, UiSurface *parent, UiRect rect) |
| Create a new UI surface. | |
| int | ui_surface_resize (UiSurface *s, int rows, int cols) |
| Resize a UI surface to new dimensions. | |
| int | ui_surface_set_base (UiSurface *s, const UiStyle *style, uint32_t fill_ch) |
| Set the base fill character and style for a UiSurface.This function sets the background fill character for the UiSurface's ncurses window and applies the given UiStyle. If fill_ch is 0, it defaults to a space character. | |
| int | ui_surface_set_style (UiSurface *s, const UiStyle *style) |
| Set the style for a UiSurface.This function applies the given UiStyle to the ncurses window associated with the UiSurface. It uses the ui_ncurses_style_apply function to set the appropriate attributes on the window. | |
| int | ui_surface_show (UiSurface *s) |
| Show a UI surface. | |
| int | ui_suspend (UiRuntime *ui) |
| Suspend the UI, restoring the terminal to its normal state. | |
Variables | |
| UiSurface * | ui_surface_box [MAXWIN] |
| UiSurface * | ui_surface_win [MAXWIN] |
| UiSurface * | ui_surface_win2 [MAXWIN] |
Backend API for terminal UI library.
Definition in file ui_backend.h.
| #define MAXWIN 30 |
Definition at line 13 of file ui_backend.h.
| typedef struct UiRuntime UiRuntime |
Definition at line 39 of file ui_backend.h.
| typedef struct UiSurface UiSurface |
Definition at line 49 of file ui_backend.h.
Definition at line 330 of file ui_ncurses.c.
References ui_style_to_cch(), and UiSurface::win.
Definition at line 26 of file ui_ncurses.c.
Definition at line 27 of file ui_ncurses.c.
Definition at line 28 of file ui_ncurses.c.