C-Menu
0.2.9
A User Interface Toolkit
Toggle main menu visibility
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
6
int
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:"
)
)
;
15
ui_render
(
)
;
16
UiEvent ev;
17
ui_get_event
(
sfc
,
WIN
,
NULL
,
&ev
,
-1
)
;
18
ui_shutdown
(
)
;
19
destroy_init
(
init
)
;
20
exit(EXIT_SUCCESS);
21
}
ui_init
UiRuntime * ui_init(const UiConfig *config, SIO *sio)
Initialize the UI runtime with the given configuration and SIO.
Definition
ui_ncurses.c:129
ui_render
void ui_render()
Render the UI by updating panels and refreshing the display.
Definition
ui_ncurses.c:884
ui_shutdown
void ui_shutdown()
Shutdown the UI runtime, cleaning up resources and freeing memory.
Definition
ui_ncurses.c:418
sfc_ptr
int sfc_ptr
Definition
ui_ncurses.c:42
ui_tracked_sfc_box
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
ui_get_event
int ui_get_event(UiSurface *s, ss_t w, UiChyron *chyron, UiEvent *ev, int timeout_ms)
Read input events.
Definition
ui_ncurses_input.c:116
ui_surface
UiSurface * ui_surface[UI_SFC_MAX]
Definition
ui_ncurses.c:40
ui_mvwaddstr
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.
Definition
ui_ncurses_draw.c:174
_
#define _(String)
Definition
amort.c:23
main
int main(int argc, char **argv)
Capture the current terminal settings for later restoration.
Definition
amort.c:41
mapp_initialization
void mapp_initialization(Init *, int, char **)
Main initialization function for MAPP - Menu Application.
Definition
init.c:498
new_init
Init * new_init(int argc, char **argv)
Create and initialize Init structure.
Definition
mem.c:60
destroy_init
Init * destroy_init(Init *init)
Destroy Init structure.
Definition
mem.c:91
UiConfig::border_style
UiBorderStyle border_style
Definition
ui_backend.h:445
Init::sio
SIO * sio
Definition
common.h:117
ui_hello.c
Generated by
1.17.0