C-Menu 0.2.9
A User Interface Toolkit
Loading...
Searching...
No Matches
ui_hello.c
Go to the documentation of this file.
1// ui_hello.c
2// Small program to test the ncurses/notcurses UI backends
3#define _GNU_SOURCE
4#include "common.h"
5
6int main(int argc, char **argv) {
7 Init *init = new_init(argc, argv);
8 mapp_initialization(init, argc, argv);
9 UiConfig ui_config = {.border_style = UI_BORDER_ROUNDED};
10 ui_init(&ui_config, init->sio);
11 ui_tracked_sfc_box(12, 50, 5, 5, "Test UI Application");
12 UiSurface *sfc = ui_surface[sfc_ptr];
13 ui_mvwaddstr(sfc, WIN, 1, 4, _("Hello!"));
14 ui_mvwaddstr(sfc, WIN, 3, 4, _("Press a key or activate the mouse:"));
16 UiEvent ev;
17 ui_get_event(sfc, WIN, NULL, &ev, -1);
20 exit(EXIT_SUCCESS);
21}
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
void ui_shutdown()
Shutdown the UI runtime, cleaning up resources and freeing memory.
Definition ui_ncurses.c:418
int sfc_ptr
Definition ui_ncurses.c:42
int ui_tracked_sfc_box(uint wlines, uint wcols, uint wbegy, uint wbegx, const char *wtitle)
Create a new surface with a box window.
Definition ui_common.c:387
int ui_get_event(UiSurface *s, ss_t w, UiChyron *chyron, UiEvent *ev, int timeout_ms)
Read input events.
UiSurface * ui_surface[UI_SFC_MAX]
Definition ui_ncurses.c:40
int ui_mvwaddstr(UiSurface *s, ss_t w, uint y, uint x, const char *text)
Draw a text string at a specific position in a surface window.
#define _(String)
Definition amort.c:23
int main(int argc, char **argv)
Capture the current terminal settings for later restoration.
Definition amort.c:41
void mapp_initialization(Init *, int, char **)
Main initialization function for MAPP - Menu Application.
Definition init.c:498
Init * new_init(int argc, char **argv)
Create and initialize Init structure.
Definition mem.c:60
Init * destroy_init(Init *init)
Destroy Init structure.
Definition mem.c:91
UiBorderStyle border_style
Definition ui_backend.h:445
SIO * sio
Definition common.h:117