1#ifndef UI_NCURSES_INTERNAL_H
2#define UI_NCURSES_INTERNAL_H 1
5
6
7
8
9
10
12#include "../include/ui_backend.h"
14#include <ncursesw/ncurses.h>
15#include <ncursesw/panel.h>
21
22
23
24
25
26
36
37
38
39
40
41
42
61int ui_bkgrnd(UiSurface *,
const UiStyle *,
const char *);
volatile sig_atomic_t sig_received
bool handle_signal(sig_atomic_t)
PANEL * panel_win2[MAXWIN]
WINDOW * win_win2[MAXWIN]
struct termios shell_tioctl curses_tioctl
int border_draw(WINDOW *)
#define CHYRON_KEY_MAXLEN
PANEL * panel_win[MAXWIN]
#define min(x, y)
min macro evaluates two expressions, returning least result
PANEL * panel_box[MAXWIN]
char const colors_text[][10]
Color names for .minitrc overrides.
#define max(a, b)
max macro evaluates two expressions, returning greatest result.
int ui_bkgrnd(UiSurface *, const UiStyle *, const char *)
int ui_bkgrnd_set(UiSurface *, const UiStyle *, const char *)
void ui_style_destroy(UiStyle *)
UiStyle * ui_style_from_cch(const cchar_t *)
cchar_t ui_style_to_cch(const UiStyle *, const char *)
UiSurface * ui_box[MAXWIN]
UiSurface * ui_win2[MAXWIN]
UiSurface * ui_win[MAXWIN]
bool open_curses(SIO *)
Initialize NCurses and color settings.
int border_title(WINDOW *, char *)
Draw a box with a title around the specified window.
int dxwgetch(WINDOW *, WINDOW *, WINDOW *, WINDOW *, WINDOW *, Chyron *, int)
Wrapper for wgetch that handles signals, mouse events, checks for clicks on the chyron line,...
int xwgetch(WINDOW *, Chyron *, int)
Wrapper for wgetch that handles signals, mouse events, checks for clicks on the chyron line,...
void restore_wins()
Restore all windows after a screen resize.
void win_del()
Delete the current window and its associated box window.
void check_panels(int)
Check and display the panels for a given window index.
int border_hsplit_text(WINDOW *, char *, int)
Draw a box with a separator line and text around the specified window.
int bare_box_new(int, int, int, int, char *)
Create a new window with optional box and title.
int win_new(int, int)
Create a new window with specified dimensions and position.
int border_hsplit(WINDOW *, int)
Draw a box with a separator line around the specified window.
void win_init_attrs()
Initialize window attributes.
void mvwaddstr_fill(WINDOW *, int, int, char *, int)
For lines shorter than their display area, fill the rest with spaces.
int box_new(int, int, int, int, char *)
Create a new window with optional box and title.
int box_hsplit_new(int, int, int, int, int, char *)
Create a new window with optional box and title, and a second window inside it, split horizontally.
int win2_new(int, int, int, int)
Create a new subwindow (win2) with specified dimensions and position.
int vgetch(WINDOW *, int)
Wrapper for wgetch that handles signals and mouse events, and accepts a single character answer.
void win_resize(int, int, char *)
Resize the current window and its box, and update the title.
void destroy_curses()
Gracefully shut down NCurses and restore terminal settings.
void win_redraw(WINDOW *)
Redraw the specified window.
int win2_box_new(int, int, int, int, char *)
Create a new window with optional box and title, and a second window inside it.
void initialize_local_colors(SIO *)
Initialize local color variables and color pairs based on SIO settings.
void display_cmplx_str(WINDOW *, cchar_t *, int, int)
Display a complex character string on a window.
RGB xterm256_idx_to_rgb(int)
Convert XTerm 256 color index to RGB.
size_t str_to_cc(cchar_t *, const char *, attr_t, int, size_t)
Convert a multibyte string to an array of cchar_t complex characters.
int clr_name_to_idx(char *)
Get color index from color name.
void list_colors()
list colors to stderr
int rgb_to_curses_clr(RGB *)
Get color index for RGB color.
size_t mk_cmplx_str(cchar_t *, char *, attr_t, int)
Convert a multibyte string to an array of cchar_t complex characters.
void init_hex_clr(int, char *)
Initialize extended ncurses color from HTML style hex string.
bool init_clr_palette(SIO *)
Initialize color palette based on SIO settings.
RGB hex_clr_str_to_rgb(char *)
Convert six-digit HTML style hex color code to RGB struct.
void apply_gamma(RGB *)
Apply gamma correction to RGB color.
int rgb_to_xterm256_idx(RGB *)
Convert RGB color to XTerm 256 color index.
cchar_t mkcc(int, attr_t, const char *)
Create a cchar_t with the specified color pair index.
int get_clr_pair(int, int)
Get color pair index for foreground and background colors.
WINDOW * message_win(char *)
Display a message in a window or print to stderr if curses is not available.
bool wait_destroy(Chyron *)
Destroy the waiting message window and chyron.
bool waitpid_with_timeout(pid_t, int)
Wait for a process to finish with a timeout and optional user cancellation.
bool action_disposition(char *eitle, char *action_str)
Display a simple action disposition message window or print to stderr.
int nf_error(int, char *)
Display error message and wait for key press.
int answer_yn(char *, char *, char *, char *)
Accept a single letter answer.
int wait_continue(WINDOW *, Chyron *, int)
Update the waiting message with remaining time and check for user input.
WINDOW * wait_mk_win(Chyron *, char *)
Display a popup waiting message.
int Perror(char *)
Display a simple error message window or print to stderr.
void abend(int, char *)
Abnormal program termination.
Chyron * wait_mk_chyron()
Create a Chyron struct for the waiting message.
int display_error(char *, char *, char *, char *)
Display an error message window or print to stderr.
bool is_set_chyron_key(Chyron *, int)
Check if function key label is set.
void set_chyron_key(Chyron *, int, char *, int)
Set chyron key with default color pair (cp_nt_rev).
void display_chyron(WINDOW *, Chyron *, int, int)
Display chyron on window.
Chyron * destroy_chyron(Chyron *chyron)
Destroy Chyron structure.
void activate_chyron_key(Chyron *, int)
Activate chyron key.
int get_chyron_key(Chyron *, int)
Get keycode from chyron.
void set_chyron_key_cp(Chyron *, int, char *, int, int)
Set chyron key with color pair (cp).
void compile_chyron(Chyron *)
construct the chyron string from the chyron structure
void activate_all_chyron_keys(Chyron *)
Deactivate chyron key.
void unset_chyron_key(Chyron *, int)
Unset chyron key.
int mb_to_cc(cchar_t *, char *, attr_t, int, int *, int)
Convert multibyte string to complex character array.
void deactivate_all_chyron_keys(Chyron *)
Deactivate all chyron keys.
void deactivate_chyron_key(Chyron *, int)
Deactivate chyron key.
Chyron * new_chyron()
Create and initialize Chyron structure.
size_t strnz__cpy(char *, const char *, size_t)
safer alternative to strncpy
bool str_to_lower(char *)
Converts a string to lowercase.
void ui_rect_set(UiRect *, int, int, int, int)
Set the properties of a UiRect structure.
size_t strnz(char *, size_t)
terminates string at New Line, Carriage Return, or max_len
size_t ssnprintf(char *, size_t, const char *,...)
ssnprintf was designed to be a safer alternative to snprintf.
int wccp_to_str(wchar_t, uint8_t *)
Converts a Unicode code point to a UTF-8 encoded string.
size_t strnz__cat(char *, const char *, size_t)
safer alternative to strncat
char di_getch()
get single character from terminal in raw mode
bool restore_curses_tioctl()
restore_curses_tioctl() - restore curses terminal settings
bool mk_raw_tioctl(struct termios *)
mk_raw_tioctl() - set terminal to raw mode
bool restore_shell_tioctl()
restore_shell_tioctl() - restore shell terminal settings
void sig_dfl_mode()
Set signal handlers to default behavior.
void ui_get_screen_size(UiRuntime *ui, int *rows, int *cols)
Get the current screen size.
int ui_ncurses_style_apply(WINDOW *win, const UiStyle *style)
Apply a UiStyle to an ncurses window.This function sets the appropriate attributes (bold,...
int ui_ncurses_color_pair_from_style(const UiStyle *style)
Convert an RGB value (0-255) to a 1000-based value for ncurses.Ncurses uses a 1000-based color system...
char text[CHYRON_KEY_MAXLEN]
cchar_t cmplx_buf[MAXLEN]
ChyronKey * key[CHYRON_KEYS]
char nt_hl_rev_bg[COLOR_LEN]
char nt_rev_bg[COLOR_LEN]
char nt_rev_fg[COLOR_LEN]
char brackets_fg[COLOR_LEN]
char fill_char_fg[COLOR_LEN]
char brackets_bg[COLOR_LEN]
char fill_char_bg[COLOR_LEN]
char nt_hl_rev_fg[COLOR_LEN]
Opaque structure representing the UI runtime environment.
Opaque structure representing a drawable surface in the UI.
struct UiSurface * parent
struct UiRuntime * runtime