C-Menu 0.2.9
A User Interface Toolkit
Loading...
Searching...
No Matches
ui_layout.h
Go to the documentation of this file.
1#pragma once
2#ifdef __cplusplus
3extern "C" {
4#endif
5
6/** @file
7 @brief UI layout management.
8 @ingroup ui_backend
9
10 This module provides functions for creating and managing framed surfaces, which consist of an outer surface (the frame) and an inner surface (the content area).
11 */
12
13#include "ui_backend.h"
14
15/** @struct UiFramedSurface
16 @ingroup ui_backend
17 Represents a framed surface, consisting of an outer surface (the frame) and
18 an inner surface (the content area).
19 */
20typedef struct {
21 UiSurface *outer;
22 UiSurface *inner;
23} UiFramedSurface;
24
25/** @brief Creates a new framed surface with the specified parent and rectangle.
26 @ingroup ui_backend
27 @param ui The UI runtime context.
28 @param parent The parent surface to which the framed surface will be attached.
29 @param rect The rectangle defining the position and size of the framed surface.
30 @return A new UiFramedSurface instance, or NULL on failure.
31 */
32UiFramedSurface ui_framed_surface_new(UiSurface *parent, UiRect rect);
33/** @brief Destroys a framed surface and releases its resources.
34 @ingroup ui_backend
35 @param fs The UiFramedSurface to destroy.
36 */
37void ui_framed_surface_destroy(UiFramedSurface *fs);
38
39#ifdef __cplusplus
40}
41#endif
UiRuntime * ui_init(const UiConfig *config, SIO *sio)
Initialize the UI runtime with the given configuration and SIO.
Definition ui_ncurses.c:129
void ui_render()
Render the UI by updating panels and refreshing the display.
Definition ui_ncurses.c:884
int ui_draw_text(UiSurface *s, ss_t w, uint y, uint x, const char *text)
on specified window, move to y, x, add string
void ui_surface_destroy(UiSurface *s)
Destroy a UiSurface, cleaning up its windows and panels.
Definition ui_ncurses.c:468
void ui_get_screen_size(uint *lines, uint *cols)
Get the current screen size (number of lines and columns).
Definition ui_ncurses.c:722
void ui_shutdown()
Shutdown the UI runtime, cleaning up resources and freeing memory.
Definition ui_ncurses.c:418
UiSurface * ui_surface_new(ss_t w, UiSurface *parent, uint p, uint lines, uint cols, uint y, uint x)
Create a new UI surface with the specified parameters.
Definition ui_ncurses.c:229
uint16_t UiStyle
Definition ui_backend.h:158
void ui_get_caps(UiCaps *caps)
Get the UI backend capabilities.
Definition ui_ncurses.c:62
@ UI_BACKEND_NCURSES
Definition ui_backend.h:452
@ UI_BACKEND_NOTCURSES
Definition ui_backend.h:453
#define WA_NORMAL
int main(int argc, char **argv)
Capture the current terminal settings for later restoration.
Definition amort.c:41
UiFramedSurface ui_framed_surface_new(UiSurface *parent, UiRect rect)
Creates a new framed surface with the specified parent and rectangle.
Definition ui_layout.c:26
void ui_framed_surface_destroy(UiFramedSurface *fs)
Destroys a framed surface and releases its resources.
Definition ui_layout.c:54
UiBackend ui_get_backend()
Get the UI backend type.
Definition ui_ncurses.c:55
int cols
Definition ui_backend.h:186
int lines
Definition ui_backend.h:185
bool palette256
Definition ui_backend.h:458
bool mouse
Definition ui_backend.h:459
int color_pairs
Definition ui_backend.h:462
bool truecolor
Definition ui_backend.h:457
bool unicode
Definition ui_backend.h:460
bool resize
Definition ui_backend.h:461
UiSurface * inner
Definition ui_layout.h:22
UiSurface * outer
Definition ui_layout.h:21