|
C-Menu 0.2.9
A User Interface Toolkit
|
Backend API for terminal UI library. More...
Files | |
| file | ui_backend.h |
| Backend API for terminal UI library. | |
| file | ui_layout.h |
| UI layout management. | |
| file | ui_ncurses_internal.h |
| Internal header for ncurses UI backend. This header defines internal structures and functions used by the ncurses implementation of the UI backend. It should not be included directly by external code. | |
| file | ui_theme.h |
| UI theme definitions. | |
Data Structures | |
| struct | UiColor |
| Structure representing a color in the UI. More... | |
| struct | UiConfig |
| Structure representing the configuration options for the UI runtime. More... | |
| struct | UiEvent |
| Structure representing an input event in the UI. More... | |
| struct | UiFramedSurface |
| struct | UiRect |
| Structure representing a rectangular area in the UI. More... | |
| struct | UiRuntime |
| Opaque structure representing the UI runtime environment. More... | |
| struct | UiStyle |
| Structure representing the style attributes for UI elements. More... | |
| struct | UiSurface |
| Opaque structure representing a drawable surface in the UI. More... | |
Functions | |
| void | ui_framed_surface_destroy (UiFramedSurface *fs) |
| Destroys a framed surface and releases its resources. | |
| UiFramedSurface | ui_framed_surface_new (UiRuntime *ui, UiSurface *parent, UiRect rect) |
| Creates a new framed surface with the specified parent and rectangle. | |
| const UiStyle * | ui_theme_style (const UiTheme *theme, UiRole role) |
| Get the style for a given UI role. | |
Backend API for terminal UI library.
This module defines the API for implementing a backend for the terminal UI library. It includes types and functions for managing the UI runtime, surfaces, drawing operations, input handling, and cursor control.
The backend is responsible for rendering the UI to the terminal, handling user input events, and managing the lifecycle of the UI runtime and surfaces.
To implement a backend, you need to define the functions declared in this header file according to the specifications provided in the function comments.
| enum UiBorderKind |
Enumeration of possible border styles for UI surfaces.
The UiBorderKind enumeration defines the various border styles that can be applied to UI surfaces. This includes no border, ASCII borders, light borders, and rounded borders. Each border style is represented by a unique value in the enumeration, allowing for easy selection and application of borders when drawing UI elements. The chosen border style will affect the appearance of the surface's edges when rendered.
| Enumerator | |
|---|---|
| UI_BORDER_NONE | |
| UI_BORDER_ASCII | |
| UI_BORDER_LIGHT | |
| UI_BORDER_ROUNDED | |
Definition at line 115 of file ui_backend.h.
| enum UiKey |
Enumeration of possible key events in the UI.
The UiKey enumeration defines the various key events that can be captured in the UI. This includes character input, special keys (like Enter, Escape, Arrow keys), function keys (F1-F12), and mouse events. Each key event is represented by a unique value in the enumeration, allowing for easy identification and handling of user input. When a key event occurs, it is captured in a UiEvent structure, which includes additional information such as modifier keys (Alt, Ctrl, Shift) and mouse actions.
Definition at line 58 of file ui_backend.h.
| enum UiMouseAction |
Enumeration of possible mouse actions in the UI.
The UiMouseAction enumeration defines the various mouse actions that can be captured in the UI. This includes mouse button presses, releases, drags, and scroll events. Each mouse action is represented by a unique value in the enumeration, allowing for easy identification and handling of mouse input. When a mouse event occurs, it is captured in a UiEvent structure, which includes additional information such as the position of the mouse and any modifier keys (Alt, Ctrl, Shift) that were active at the time of the event.
| Enumerator | |
|---|---|
| UI_MOUSE_NONE | |
| UI_MOUSE_PRESS | |
| UI_MOUSE_RELEASE | |
| UI_MOUSE_DRAG | |
| UI_MOUSE_SCROLL_UP | |
| UI_MOUSE_SCROLL_DOWN | |
Definition at line 99 of file ui_backend.h.
| enum UiRole |
UI role definitions.These are used to identify the purpose of a UI element, and can be used to apply different styles to different elements. The default theme will use these roles to apply different colors and styles to different elements.
Definition at line 16 of file ui_theme.h.
| void ui_framed_surface_destroy | ( | UiFramedSurface * | fs | ) |
Destroys a framed surface and releases its resources.
| fs | The UiFramedSurface to destroy. |
| UiFramedSurface ui_framed_surface_new | ( | UiRuntime * | ui, |
| UiSurface * | parent, | ||
| UiRect | rect ) |
Creates a new framed surface with the specified parent and rectangle.
| ui | The UI runtime context. |
| parent | The parent surface to which the framed surface will be attached. |
| rect | The rectangle defining the position and size of the framed surface. |