C-Menu 0.2.9
A User Interface Toolkit
Loading...
Searching...
No Matches
ui_backend.h File Reference

Backend API for terminal UI library. More...

#include <poll.h>
#include <stdbool.h>
#include <stddef.h>
#include <stdint.h>
Include dependency graph for ui_backend.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

union  border_wide
struct  ext_fd_reg_t
struct  GCluster
struct  RGB
struct  SIO
struct  STDRGB
struct  ui_context_t
struct  UiCaps
struct  UiCchar64
struct  UiCell
union  UiChannels
struct  UiConfig
struct  UiEvent
struct  UiMultiMedia
struct  UiRect
struct  UiRuntime
struct  UiSurface
struct  UiSurfaceMeta

Macros

#define _GNU_SOURCE
#define _XOPEN_SOURCE_EXTENDED   1
#define ALLWINS   (uint)1000
#define AS_ENUM(NAME)
#define AS_ENUM(NAME)
#define AS_ENUM(NAME)
#define AS_ENUM(NAME)
#define AS_ENUM(NAME)
#define BG_COLOR   0
#define BO_COLOR   1
#define BORDER_STYLE(X)
#define bw_bl   bw.bl
#define bw_br   bw.br
#define bw_bt   bw.bt
#define bw_cr   bw.cr
#define bw_ho   bw.ho
#define bw_lt   bw.lt
#define bw_rt   bw.rt
#define bw_tl   bw.tl
#define bw_tr   bw.tr
#define bw_tt   bw.tt
#define bw_ve   bw.ve
#define CCHARW_MAX   5
#define CELL_CHAR_INITIALIZER(c)
#define CELL_INITIALIZER(c, s, chan)
#define CHYRON_KEY_MAXLEN   64
#define CHYRON_KEYS   20
#define COLOR_LEN   8
#define ERR   -1
#define FG_COLOR   2
#define FILE_TYPE_LIST(X)
#define KEY_ALTDEL   0x20e
#define KEY_ALTDOWN   0x214
#define KEY_ALTEND   0x219
#define KEY_ALTHOME   0x21e
#define KEY_ALTINS   0x223
#define KEY_ALTLEFT   0x228
#define KEY_ALTPGDN   0x22d
#define KEY_ALTPGUP   0x232
#define KEY_ALTRIGHT   0x237
#define KEY_ALTUP   0x23d
#define LN_BG_COLOR   7
#define LN_COLOR   4
#define LOG_LEVEL_LIST(X)
#define MAX_EXT_FDS   8
#define MAXLEN   256
#define MOUSE_ACTION(X)
#define SFC_MAX   30
#define SUB_SURFACE_LIST(X)
#define UI_COLORS   512
#define UI_PAIRS   512
#define UI_SFC_MAX   30
#define XTERM_256COLOR   1

Typedefs

typedef uint16_t attr_t
typedef union border_wide BorderWide
typedef struct ncinput NcInput
typedef struct ncplane NcPlane
typedef struct ncplane_options NcPlaneOptions
typedef struct ncvisual NcVisual
typedef struct notcurses NotCurses
typedef struct notcurses_options NotCursesOptions
typedef struct SIO SIO
typedef nccell UiCell
typedef union UiChannels UiChannels
typedef struct UiColor UiColor
typedef uint UiColorIdx
typedef uint32_t UiKey
typedef struct UiMB UiMB
typedef struct UiPair UiPair
typedef uint16_t UiPairIdx
typedef struct UiRuntime UiRuntime
typedef struct UiSplitSurface UiSplitSurface
typedef uint16_t UiStyle
typedef struct UiSurface UiSurface

Enumerations

enum  ColorsEnum {
  CLR_BLACK , CLR_RED , CLR_GREEN , CLR_YELLOW ,
  CLR_BLUE , CLR_MAGENTA , CLR_CYAN , CLR_WHITE ,
  CLR_BBLACK , CLR_BRED , CLR_BGREEN , CLR_BYELLOW ,
  CLR_BBLUE , CLR_BMAGENTA , CLR_BCYAN , CLR_BWHITE ,
  CLR_BORANGE , CLR_FG , CLR_BG , CLR_BOX_FG ,
  CLR_BOX_BG , CLR_IND_FG , CLR_IND_BG , CLR_BRACKETS_FG ,
  CLR_BRACKETS_BG , CLR_FILL_CHAR_FG , CLR_FILL_CHAR_BG , CLR_LN_FG ,
  CLR_LN_BG , CLR_CMDLN_FG , CLR_CMDLN_BG , CLR_NT_FG ,
  CLR_NT_BG , CLR_NT_REV_FG , CLR_NT_REV_BG , CLR_NT_HL_FG ,
  CLR_NT_HL_BG , CLR_NT_HL_REV_FG , CLR_NT_HL_REV_BG , CLR_TITLE_FG ,
  CLR_TITLE_BG , CLR_NCOLORS
}
enum  FileType { FT_MAX }
enum  ss_t { SUB_SFC_MAX }
enum  UiBackend { UI_BACKEND_NCURSES = 0 , UI_BACKEND_NOTCURSES }
enum  UiBorderStyle { BORDER_MAX }
enum  UiLogLevel { LOG_LEVEL_COUNT }
enum  UiMouseAction { MOUSE_ACTION_MAX }

Functions

int ui_bkgd (UiSurface *s, ss_t w, const UiCell *cell)
 Set the background of a specific window within a UiSurface.
int ui_bkgdset (UiSurface *s, ss_t w, const UiCell *cell)
 Set the background for new content to be written to a specific window within a UiSurface.
int ui_bkgrnd (UiSurface *s, ss_t w, const UiCell *cell)
 Set the background of a specific window within a UiSurface.
int ui_bkgrndset (UiSurface *s, ss_t w, const UiCell *cell)
 Set the background for new content to be written to a specific window within a UiSurface.
int ui_border_draw (UiSurface *sfc)
int ui_border_title (UiSurface *sfc, const char *title)
 Draw a box with a title around the specified window.
int ui_border_ysplit (UiSurface *sfc, uint y)
 Draw a box with a separator line around the specified window.
int ui_border_ysplit_text (UiSurface *sfc, char *text, uint separator_line)
 Draw a box with a separator line and text around the specified window.
int ui_clear ()
 Clear the entire screen.
int ui_cm_surface_destroy (UiSurface *sfc)
 Destroy the most recently created surface.
int ui_curs_set (int visibility)
 Set the visibility of the cursor.
int ui_cursor_enable (UiSurface *s, ss_t w, bool visible)
 Enable or disable the cursor for a UiSurface.
int ui_cursor_enable_yx (UiSurface *s, ss_t w, uint y, uint x, bool visible)
 Enable or disable the cursor at a specific position within a UiSurface.
int ui_cursor_move (UiSurface *s, ss_t w, uint y, uint x)
 Move the cursor to a specified position within a UiSurface.
int ui_doupdate ()
 Refresh the display by updating the screen.
int ui_draw_ch (UiSurface *s, ss_t w, const char c)
 Draw a character in a surface window.
int ui_draw_ch_yx (UiSurface *s, ss_t w, uint y, uint x, const char c)
 Draw a character at a specific position in a surface window.
int ui_draw_hline (UiSurface *s, ss_t w, uint y, uint x, uint len, const UiStyle *style)
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
int ui_draw_text_fill (UiSurface *s, ss_t w, uint y, uint x, const char *text, int m)
 Draw a text string at a specific position in a surface window, filling the remaining space with spaces if the string is shorter than n.
int ui_draw_text_n (UiSurface *s, ss_t w, uint y, uint x, const char *text, int m)
 Draw a text string at a specific position in a surface window.
void ui_endwin ()
 End the UI application, cleaning up resources and shutting down the UI runtime.
int ui_erase ()
 Erase the entire screen.
UiBackend ui_get_backend ()
 Get the UI backend type.
void ui_get_caps (UiCaps *caps)
 Get the UI backend capabilities.
int ui_get_event_no_mouse (UiSurface *surface, ss_t w, UiEvent *ev)
 Wait for an input event on target (or stdscr if NULL) without mouse support.
void ui_get_screen_size (uint *lines, uint *cols)
 Get the current screen size (number of lines and columns).
int ui_getch ()
 Wait for a single input character from the NotCurses context.
int ui_getmaxx (UiSurface *s, ss_t w)
 Get the maximum number of columns of a UiSurface.
int ui_getmaxy (UiSurface *s, ss_t w)
 Get the maximum number of lines (rows) of a UiSurface.
void ui_getmaxyx (UiSurface *s, ss_t w, uint *lines, uint *cols)
 Get the maximum dimensions of a UiSurface.
void ui_getyx (UiSurface *s, ss_t w, uint *lines, uint *cols)
 Get the current cursor position within a window of a UI surface.
int ui_idcok (UiSurface *s, ss_t w, bool enable)
 Enable or disable the use of the insert/delete character capabilities for a UiSurface.
int ui_idlok (UiSurface *s, ss_t w, bool enable)
 Enable or disable the use of the insert/delete line capabilities for a UiSurface.
UiRuntime * ui_init (const UiConfig *config, SIO *sio)
 Initialize the UI runtime with the given configuration and SIO.
void ui_initialize_sio (SIO *sio)
int ui_keypad (UiSurface *s, ss_t w, bool enable)
 Enable or disable the keypad for a UiSurface.
int ui_mice_enable (int mask)
 Enable or disable mouse support.
int ui_mousemask (int mask)
 Enable or disable mouse support.
void ui_render ()
 Render the UI by updating panels and refreshing the display.
void ui_restore_wins ()
 Restore the state of all windows in the UI. This function refreshes the standard screen and all surface windows, ensuring that their contents are displayed correctly.
int ui_resume ()
 Resume the UI, restoring the previous program state and updating the display.
int ui_scrollok (UiSurface *s, ss_t w, bool enable)
 Enable or disable scrolling for a UiSurface.
int ui_setscrreg (UiSurface *s, ss_t w, uint top, uint bottom)
 Set the scrolling region for a UiSurface.
void ui_shutdown ()
 Shutdown the UI runtime, cleaning up resources and freeing memory.
const char * ui_sub_surface_str (ss_t w)
int ui_surface_addpad (UiSurface *s, ss_t w, uint view_win, uint lines, uint cols, uint begy, uint begx)
 Add a new pad to the specified UiSurface.
int ui_surface_addwin (UiSurface *s, ss_t w, uint p, uint lines, uint cols, uint y, uint x)
 Add a new window to the specified UiSurface.
UiSurface * ui_surface_box (UiSurface *parent, uint p, uint lines, uint cols, uint y, uint x, const char *title)
 Create a new UI surface with a border box and optional title.
void ui_surface_destroy (UiSurface *s)
 Destroy a UiSurface, cleaning up its windows and panels.
int ui_surface_hide (UiSurface *s, ss_t w)
 Hide a UiSurface, making it invisible on the screen.
int ui_surface_move (UiSurface *s, ss_t w, uint y, uint x)
 Move a UiSurface to a new position on the screen.
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.
int ui_surface_resize (UiSurface *s, ss_t w, uint lines, uint cols)
 Resize a UiSurface to new dimensions.
int ui_surface_show (UiSurface *s, ss_t w)
 Show a UiSurface, making it visible on the screen.
int ui_suspend ()
 Suspend the UI, saving the current program state and ending the window session.
int ui_top_surface (UiSurface *s, ss_t w)
 Hide a UiSurface, making it invisible on the screen.
int ui_tracked_sfc_box (uint wlines, uint wcols, uint wbegy, uint wbegx, const char *wtitle)
 Create a new surface with a box window.
int ui_tracked_sfc_split_box (uint wlines, uint wcols, uint split_y, uint split_x, uint wbegy, uint wbegx, const char *wtitle)
 Create a new surface with a split box window.
void ui_update_panels ()
 Update the panels in the UI.
int ui_wclear (UiSurface *s, ss_t w)
 Clear the contents of a UiSurface or all surfaces.
int ui_wclrtobot (UiSurface *s, ss_t w)
 Set the style of a surface window.
int ui_wclrtoeol (UiSurface *s, ss_t w)
 Clear to the end of the line in a surface window.
int ui_werase (UiSurface *s, ss_t w)
 Erase the contents of a UiSurface or all surfaces.
int ui_whide (UiSurface *s, ss_t w)
int ui_wmove (UiSurface *s, ss_t w, uint y, uint x)
 Move the cursor to a specified position within a UiSurface.
int ui_wnoutrefresh (UiSurface *s, ss_t w)
 Refresh a specific window within a UiSurface.
int ui_wresize (UiSurface *s, ss_t w, uint lines, uint cols)
int ui_wscrl (UiSurface *s, ss_t w, int rows)
 Scroll the contents of a UiSurface by a specified number of lines.
int ui_wshow (UiSurface *s, ss_t w)

Variables

const wchar_t * border_double = L"═║╠╣╦╩╬╔╗╚╝"
const wchar_t * border_heavy = L"━┃┣┫┳┻╋┏┓┗┛"
const wchar_t * border_none = L" "
const wchar_t * border_rounded = L"─│├┤┬┴┼╭╮╰╯"
const wchar_t * border_single = L"─│├┤┬┴┼┌┐└┘"
BorderWide bw
const wchar_t * bw_chk = L"\u2611"
const wchar_t * bw_da = L"\u2193"
const wchar_t * bw_h09 = L"\u23BD"
const wchar_t * bw_la = L"\u2190"
const wchar_t * bw_lan = L"\u276E"
const wchar_t * bw_ra = L"\u2192"
const wchar_t * bw_ran = L"\u276F"
const wchar_t * bw_rbl = L"\u2570"
const wchar_t * bw_rbr = L"\u256f"
const wchar_t * bw_rtl = L"\u256d"
const wchar_t * bw_rtr = L"\u256e"
const wchar_t * bw_sp = L"\x20"
const wchar_t * bw_ua = L"\u2191"
UiCell cell_bl
UiCell cell_box
UiCell cell_br
UiCell cell_brktl
UiCell cell_brktr
UiCell cell_bs
UiCell cell_bt
UiCell cell_chk
UiCell cell_cmdln
UiCell cell_cr
UiCell cell_default
UiCell cell_fill_char
UiCell cell_ho
UiCell cell_ind
UiCell cell_ln
UiCell cell_ls
UiCell cell_lt
UiCell cell_nt
UiCell cell_nt_hl
UiCell cell_nt_hl_rev
UiCell cell_nt_rev
UiCell cell_ran
UiCell cell_rs
UiCell cell_rt
UiCell cell_sp
UiCell cell_title
UiCell cell_tl
UiCell cell_tr
UiCell cell_ts
UiCell cell_tt
UiCell cell_ve
int click_x
int click_y
uint clr_cnt
uint clr_idx
uint clr_pair_cnt
uint clr_pair_idx
char const colors_text [][10]
 Color names for .minitrc overrides.
uint COLS
ushort cp_blue
ushort cp_bold
ushort cp_box
ushort cp_brackets
ushort cp_cmdln_bg
ushort cp_cmdln_fg
ushort cp_default
ushort cp_fill_char
ushort cp_green
ushort cp_highlight
ushort cp_ind
ushort cp_ln_bg
ushort cp_ln_fg
ushort cp_nt
ushort cp_nt_hl
ushort cp_nt_hl_rev
ushort cp_nt_rev
ushort cp_red
ushort cp_title
ushort cp_yellow
char em0 [MAXLEN]
char em1 [MAXLEN]
char em2 [MAXLEN]
char em3 [MAXLEN]
bool f_ncurses_open = false
bool f_notcurses_open = false
uint LINES
int sfc_ptr = -1
NcPlane * stdplane
UiSurface * stdsfc
ui_context_t ui_ctx
int win_ptr

Detailed Description

Backend API for terminal UI library.

Definition in file ui_backend.h.

Macro Definition Documentation

◆ _GNU_SOURCE

#define _GNU_SOURCE

Definition at line 13 of file ui_backend.h.

◆ _XOPEN_SOURCE_EXTENDED

#define _XOPEN_SOURCE_EXTENDED   1

Definition at line 12 of file ui_backend.h.

◆ ALLWINS

#define ALLWINS   (uint)1000

Definition at line 195 of file ui_backend.h.

◆ AS_ENUM [1/5]

#define AS_ENUM ( NAME)
Value:
NAME,

Definition at line 44 of file ui_backend.h.

◆ AS_ENUM [2/5]

#define AS_ENUM ( NAME)
Value:
NAME,

Definition at line 44 of file ui_backend.h.

◆ AS_ENUM [3/5]

#define AS_ENUM ( NAME)
Value:
NAME,

Definition at line 44 of file ui_backend.h.

◆ AS_ENUM [4/5]

#define AS_ENUM ( NAME)
Value:
NAME,

Definition at line 44 of file ui_backend.h.

◆ AS_ENUM [5/5]

#define AS_ENUM ( NAME)
Value:
NAME,

Definition at line 44 of file ui_backend.h.

◆ BG_COLOR

#define BG_COLOR   0

default background color

Definition at line 500 of file ui_backend.h.

◆ BO_COLOR

#define BO_COLOR   1

default bold foreground color

Definition at line 501 of file ui_backend.h.

◆ BORDER_STYLE

#define BORDER_STYLE ( X)
Value:
X(UI_BORDER_NONE) \
X(UI_BORDER_SINGLE) \
X(UI_BORDER_DOUBLE) \
X(UI_BORDER_ROUNDED) \
X(UI_BORDER_HEAVY)

Definition at line 170 of file ui_backend.h.

170#define BORDER_STYLE(X) \
171 X(UI_BORDER_NONE) \
172 X(UI_BORDER_SINGLE) \
173 X(UI_BORDER_DOUBLE) \
174 X(UI_BORDER_ROUNDED) \
175 X(UI_BORDER_HEAVY)

◆ bw_bl

#define bw_bl   bw.bl

Definition at line 590 of file ui_backend.h.

◆ bw_br

#define bw_br   bw.br

Definition at line 591 of file ui_backend.h.

◆ bw_bt

#define bw_bt   bw.bt

Definition at line 586 of file ui_backend.h.

◆ bw_cr

#define bw_cr   bw.cr

Definition at line 587 of file ui_backend.h.

◆ bw_ho

#define bw_ho   bw.ho

Definition at line 581 of file ui_backend.h.

◆ bw_lt

#define bw_lt   bw.lt

Definition at line 583 of file ui_backend.h.

◆ bw_rt

#define bw_rt   bw.rt

Definition at line 584 of file ui_backend.h.

◆ bw_tl

#define bw_tl   bw.tl

Definition at line 588 of file ui_backend.h.

◆ bw_tr

#define bw_tr   bw.tr

Definition at line 589 of file ui_backend.h.

◆ bw_tt

#define bw_tt   bw.tt

Definition at line 585 of file ui_backend.h.

◆ bw_ve

#define bw_ve   bw.ve

Definition at line 582 of file ui_backend.h.

◆ CCHARW_MAX

#define CCHARW_MAX   5

Definition at line 192 of file ui_backend.h.

◆ CELL_CHAR_INITIALIZER

#define CELL_CHAR_INITIALIZER ( c)
Value:
{ \
.gcluster = (c), \
.gcluster_backstop = 0, \
.stylemask = 0, \
.channels = 0, \
}

Definition at line 428 of file ui_backend.h.

428#define CELL_CHAR_INITIALIZER(c) { \
429 .gcluster = (c), \
430 .gcluster_backstop = 0, \
431 .stylemask = 0, \
432 .channels = 0, \
433}

◆ CELL_INITIALIZER

#define CELL_INITIALIZER ( c,
s,
chan )
Value:
{ \
.gcluster = (c), \
.gcluster_backstop = 0, \
.stylemask = (s), \
.channels = (chan), \
}

Definition at line 434 of file ui_backend.h.

434#define CELL_INITIALIZER(c, s, chan) { \
435 .gcluster = (c), \
436 .gcluster_backstop = 0, \
437 .stylemask = (s), \
438 .channels = (chan), \
439}

◆ CHYRON_KEY_MAXLEN

#define CHYRON_KEY_MAXLEN   64

maximum length of the command text

Definition at line 49 of file ui_backend.h.

◆ CHYRON_KEYS

#define CHYRON_KEYS   20

maximum number of key bindings for the chyron

Definition at line 50 of file ui_backend.h.

◆ COLOR_LEN

#define COLOR_LEN   8

length of color code strings

Definition at line 498 of file ui_backend.h.

◆ ERR

#define ERR   -1

Definition at line 427 of file ui_backend.h.

◆ FG_COLOR

#define FG_COLOR   2

default foreground color

Definition at line 499 of file ui_backend.h.

◆ FILE_TYPE_LIST

#define FILE_TYPE_LIST ( X)
Value:
X(FT_TEXT) \
X(FT_IMAGE) \
X(FT_VIDEO) \
X(FT_AUDIO) \
X(FT_BINARY_GARBAGE) \
X(FT_EMPTY) \
X(FT_UNREADABLE)

Definition at line 85 of file ui_backend.h.

85#define FILE_TYPE_LIST(X) \
86 X(FT_TEXT) \
87 X(FT_IMAGE) \
88 X(FT_VIDEO) \
89 X(FT_AUDIO) \
90 X(FT_BINARY_GARBAGE) \
91 X(FT_EMPTY) \
92 X(FT_UNREADABLE)

◆ KEY_ALTDEL

#define KEY_ALTDEL   0x20e

Definition at line 645 of file ui_backend.h.

◆ KEY_ALTDOWN

#define KEY_ALTDOWN   0x214

Definition at line 650 of file ui_backend.h.

◆ KEY_ALTEND

#define KEY_ALTEND   0x219

Definition at line 646 of file ui_backend.h.

◆ KEY_ALTHOME

#define KEY_ALTHOME   0x21e

Definition at line 643 of file ui_backend.h.

◆ KEY_ALTINS

#define KEY_ALTINS   0x223

Definition at line 642 of file ui_backend.h.

◆ KEY_ALTLEFT

#define KEY_ALTLEFT   0x228

Definition at line 649 of file ui_backend.h.

◆ KEY_ALTPGDN

#define KEY_ALTPGDN   0x22d

Definition at line 647 of file ui_backend.h.

◆ KEY_ALTPGUP

#define KEY_ALTPGUP   0x232

Definition at line 644 of file ui_backend.h.

◆ KEY_ALTRIGHT

#define KEY_ALTRIGHT   0x237

Definition at line 651 of file ui_backend.h.

◆ KEY_ALTUP

#define KEY_ALTUP   0x23d

Definition at line 648 of file ui_backend.h.

◆ LN_BG_COLOR

#define LN_BG_COLOR   7

default line number background

Definition at line 503 of file ui_backend.h.

◆ LN_COLOR

#define LN_COLOR   4

default line number color

Definition at line 502 of file ui_backend.h.

◆ LOG_LEVEL_LIST

#define LOG_LEVEL_LIST ( X)
Value:
X(FATAL) \
X(ERROR) \
X(WARN) \
X(INFO) \
X(VERBOSE) \
X(DEBUG) \
X(SILENT)

Definition at line 69 of file ui_backend.h.

69#define LOG_LEVEL_LIST(X) \
70 X(FATAL) \
71 X(ERROR) \
72 X(WARN) \
73 X(INFO) \
74 X(VERBOSE) \
75 X(DEBUG) \
76 X(SILENT)

◆ MAX_EXT_FDS

#define MAX_EXT_FDS   8

Definition at line 131 of file ui_backend.h.

◆ MAXLEN

#define MAXLEN   256

Definition at line 198 of file ui_backend.h.

◆ MOUSE_ACTION

#define MOUSE_ACTION ( X)
Value:
X(UI_MOUSE_NONE) \
X(UI_MOUSE_PRESS) \
X(UI_MOUSE_RELEASE) \
X(UI_MOUSE_DRAG) \
X(UI_MOUSE_SCROLL_UP) \
X(UI_MOUSE_SCROLL_DOWN)

Definition at line 52 of file ui_backend.h.

52#define MOUSE_ACTION(X) \
53 X(UI_MOUSE_NONE) \
54 X(UI_MOUSE_PRESS) \
55 X(UI_MOUSE_RELEASE) \
56 X(UI_MOUSE_DRAG) \
57 X(UI_MOUSE_SCROLL_UP) \
58 X(UI_MOUSE_SCROLL_DOWN)

◆ SFC_MAX

#define SFC_MAX   30

Definition at line 197 of file ui_backend.h.

◆ SUB_SURFACE_LIST

#define SUB_SURFACE_LIST ( X)
Value:
X(BOX) \
X(WIN) \
X(WIN2) \
X(LNNO) \
X(CMDLN) \
X(PAD) \
X(WIN3)

Definition at line 36 of file ui_backend.h.

36#define SUB_SURFACE_LIST(X) \
37 X(BOX) \
38 X(WIN) \
39 X(WIN2) \
40 X(LNNO) \
41 X(CMDLN) \
42 X(PAD) \
43 X(WIN3)

◆ UI_COLORS

#define UI_COLORS   512

Definition at line 193 of file ui_backend.h.

◆ UI_PAIRS

#define UI_PAIRS   512

Definition at line 194 of file ui_backend.h.

◆ UI_SFC_MAX

#define UI_SFC_MAX   30

Definition at line 196 of file ui_backend.h.

◆ XTERM_256COLOR

#define XTERM_256COLOR   1

Definition at line 640 of file ui_backend.h.

Typedef Documentation

◆ attr_t

typedef uint16_t attr_t

Definition at line 417 of file ui_backend.h.

◆ BorderWide

typedef union border_wide BorderWide

◆ NcInput

typedef struct ncinput NcInput

Definition at line 161 of file ui_backend.h.

◆ NcPlane

typedef struct ncplane NcPlane

Definition at line 419 of file ui_backend.h.

◆ NcPlaneOptions

typedef struct ncplane_options NcPlaneOptions

Definition at line 422 of file ui_backend.h.

◆ NcVisual

typedef struct ncvisual NcVisual

Definition at line 162 of file ui_backend.h.

◆ NotCurses

typedef struct notcurses NotCurses

Definition at line 420 of file ui_backend.h.

◆ NotCursesOptions

typedef struct notcurses_options NotCursesOptions

Definition at line 421 of file ui_backend.h.

◆ SIO

typedef struct SIO SIO

Definition at line 153 of file ui_backend.h.

◆ UiCell

typedef nccell UiCell

Definition at line 418 of file ui_backend.h.

◆ UiChannels

typedef union UiChannels UiChannels

Definition at line 156 of file ui_backend.h.

◆ UiColor

typedef struct UiColor UiColor

Definition at line 424 of file ui_backend.h.

◆ UiColorIdx

typedef uint UiColorIdx

Definition at line 160 of file ui_backend.h.

◆ UiKey

typedef uint32_t UiKey

Definition at line 65 of file ui_backend.h.

◆ UiMB

typedef struct UiMB UiMB

Definition at line 157 of file ui_backend.h.

◆ UiPair

typedef struct UiPair UiPair

Definition at line 423 of file ui_backend.h.

◆ UiPairIdx

typedef uint16_t UiPairIdx

Definition at line 159 of file ui_backend.h.

◆ UiRuntime

typedef struct UiRuntime UiRuntime

Definition at line 152 of file ui_backend.h.

◆ UiSplitSurface

Definition at line 155 of file ui_backend.h.

◆ UiStyle

typedef uint16_t UiStyle

Definition at line 158 of file ui_backend.h.

◆ UiSurface

typedef struct UiSurface UiSurface

Definition at line 154 of file ui_backend.h.

Enumeration Type Documentation

◆ ColorsEnum

enum ColorsEnum
Enumerator
CLR_BLACK 
CLR_RED 
CLR_GREEN 
CLR_YELLOW 
CLR_BLUE 
CLR_MAGENTA 
CLR_CYAN 
CLR_WHITE 
CLR_BBLACK 
CLR_BRED 
CLR_BGREEN 
CLR_BYELLOW 
CLR_BBLUE 
CLR_BMAGENTA 
CLR_BCYAN 
CLR_BWHITE 
CLR_BORANGE 
CLR_FG 
CLR_BG 
CLR_BOX_FG 
CLR_BOX_BG 
CLR_IND_FG 
CLR_IND_BG 
CLR_BRACKETS_FG 
CLR_BRACKETS_BG 
CLR_FILL_CHAR_FG 
CLR_FILL_CHAR_BG 
CLR_LN_FG 
CLR_LN_BG 
CLR_CMDLN_FG 
CLR_CMDLN_BG 
CLR_NT_FG 
CLR_NT_BG 
CLR_NT_REV_FG 
CLR_NT_REV_BG 
CLR_NT_HL_FG 
CLR_NT_HL_BG 
CLR_NT_HL_REV_FG 
CLR_NT_HL_REV_BG 
CLR_TITLE_FG 
CLR_TITLE_BG 
CLR_NCOLORS 

Definition at line 505 of file ui_backend.h.

505 {
506 CLR_BLACK,
507 CLR_RED,
508 CLR_GREEN,
510 CLR_BLUE,
512 CLR_CYAN,
513 CLR_WHITE,
515 CLR_BRED,
518 CLR_BBLUE,
520 CLR_BCYAN,
523 CLR_FG,
524 CLR_BG,
533 CLR_LN_FG,
534 CLR_LN_BG,
537 CLR_NT_FG,
538 CLR_NT_BG,
548} ColorsEnum;
ColorsEnum
Definition ui_backend.h:505
@ CLR_CMDLN_BG
Definition ui_backend.h:536
@ CLR_FILL_CHAR_BG
Definition ui_backend.h:532
@ CLR_BOX_BG
Definition ui_backend.h:526
@ CLR_FILL_CHAR_FG
Definition ui_backend.h:531
@ CLR_FG
Definition ui_backend.h:523
@ CLR_RED
Definition ui_backend.h:507
@ CLR_NT_FG
Definition ui_backend.h:537
@ CLR_BRACKETS_FG
Definition ui_backend.h:529
@ CLR_YELLOW
Definition ui_backend.h:509
@ CLR_IND_FG
Definition ui_backend.h:527
@ CLR_BCYAN
Definition ui_backend.h:520
@ CLR_TITLE_FG
Definition ui_backend.h:545
@ CLR_WHITE
Definition ui_backend.h:513
@ CLR_MAGENTA
Definition ui_backend.h:511
@ CLR_BRACKETS_BG
Definition ui_backend.h:530
@ CLR_NT_REV_BG
Definition ui_backend.h:540
@ CLR_BLACK
Definition ui_backend.h:506
@ CLR_BWHITE
Definition ui_backend.h:521
@ CLR_LN_BG
Definition ui_backend.h:534
@ CLR_NT_HL_REV_BG
Definition ui_backend.h:544
@ CLR_BBLACK
Definition ui_backend.h:514
@ CLR_LN_FG
Definition ui_backend.h:533
@ CLR_NT_HL_FG
Definition ui_backend.h:541
@ CLR_BBLUE
Definition ui_backend.h:518
@ CLR_BGREEN
Definition ui_backend.h:516
@ CLR_BYELLOW
Definition ui_backend.h:517
@ CLR_BMAGENTA
Definition ui_backend.h:519
@ CLR_BORANGE
Definition ui_backend.h:522
@ CLR_NT_HL_BG
Definition ui_backend.h:542
@ CLR_NT_HL_REV_FG
Definition ui_backend.h:543
@ CLR_BG
Definition ui_backend.h:524
@ CLR_BOX_FG
Definition ui_backend.h:525
@ CLR_NT_BG
Definition ui_backend.h:538
@ CLR_TITLE_BG
Definition ui_backend.h:546
@ CLR_BRED
Definition ui_backend.h:515
@ CLR_NCOLORS
Definition ui_backend.h:547
@ CLR_BLUE
Definition ui_backend.h:510
@ CLR_IND_BG
Definition ui_backend.h:528
@ CLR_GREEN
Definition ui_backend.h:508
@ CLR_CMDLN_FG
Definition ui_backend.h:535
@ CLR_NT_REV_FG
Definition ui_backend.h:539
@ CLR_CYAN
Definition ui_backend.h:512

◆ FileType

enum FileType
Enumerator
FT_MAX 

Definition at line 94 of file ui_backend.h.

94 {
96 FT_MAX
97} FileType;
FileType
Definition ui_backend.h:94
@ FT_MAX
Definition ui_backend.h:96
#define AS_ENUM(NAME)
Definition ui_backend.h:44
#define FILE_TYPE_LIST(X)
Definition ui_backend.h:85

◆ ss_t

enum ss_t
Enumerator
SUB_SFC_MAX 

Definition at line 45 of file ui_backend.h.

45 {
48} ss_t;
#define SUB_SURFACE_LIST(X)
Definition ui_backend.h:36
ss_t
Definition ui_backend.h:45
@ SUB_SFC_MAX
Definition ui_backend.h:47

◆ UiBackend

enum UiBackend
Enumerator
UI_BACKEND_NCURSES 

NCurses / NCursesW backend

UI_BACKEND_NOTCURSES 

NotCurses backend

Definition at line 451 of file ui_backend.h.

451 {
454} UiBackend;
UiBackend
Definition ui_backend.h:451
@ UI_BACKEND_NCURSES
Definition ui_backend.h:452
@ UI_BACKEND_NOTCURSES
Definition ui_backend.h:453

◆ UiBorderStyle

Enumerator
BORDER_MAX 

Definition at line 177 of file ui_backend.h.

177 {
#define BORDER_STYLE(X)
Definition ui_backend.h:170
UiBorderStyle
Definition ui_backend.h:177
@ BORDER_MAX
Definition ui_backend.h:179

◆ UiLogLevel

enum UiLogLevel
Enumerator
LOG_LEVEL_COUNT 

Definition at line 78 of file ui_backend.h.

78 {
UiLogLevel
Definition ui_backend.h:78
@ LOG_LEVEL_COUNT
Definition ui_backend.h:80
#define LOG_LEVEL_LIST(X)
Definition ui_backend.h:69

◆ UiMouseAction

Enumerator
MOUSE_ACTION_MAX 

Definition at line 60 of file ui_backend.h.

60 {
#define MOUSE_ACTION(X)
Definition ui_backend.h:52
UiMouseAction
Definition ui_backend.h:60
@ MOUSE_ACTION_MAX
Definition ui_backend.h:62

Function Documentation

◆ ui_bkgd()

int ui_bkgd ( UiSurface * s,
ss_t w,
const UiCell * cell )

Set the background of a specific window within a UiSurface.

Set the background cell for the specified window within a UI surface.

Parameters
sPointer to the UiSurface containing the window.
wThe index of the window within the surface for which to set the background.
cellPointer to a UiCell structure representing the desired background attributes.
Returns
0 on success, or -1 on failure.
Parameters
sPointer to the UiSurface containing the window.
wThe index of the window within the surface.
cellPointer to the UiCell representing the background cell.
Returns
0 on success, -1 on failure.

This function sets the background cell for the specified window within a UI surface. It updates the styles and channels of the ncplane associated with the window and stores the background cell in the metadata. If the surface is not initialized, it returns -1.

Set the background of a specific window within a UiSurface.

Parameters
sPointer to the UiSurface containing the window.
wThe index of the window within the surface.
cellPointer to the UiCell representing the background cell.
Returns
0 on success, -1 on failure.

This function sets the background cell for the specified window within a UI surface. It updates the styles and channels of the ncplane associated with the window and stores the background cell in the metadata. If the surface is not initialized, it returns -1.

Definition at line 927 of file ui_ncurses.c.

927 {
928 if (!s)
929 return -1;
930 wbkgrnd(s->mwin[w], cell);
931 return 0;
932}

Referenced by init_view_boxwin(), init_view_full_screen(), ui_surface_addpad(), and ui_surface_addwin().

Here is the caller graph for this function:

◆ ui_bkgdset()

int ui_bkgdset ( UiSurface * s,
ss_t w,
const UiCell * cell )

Set the background for new content to be written to a specific window within a UiSurface.

Set the background cell for the specified window within a UI surface without changing the base character.

Parameters
sPointer to the UiSurface containing the window.
wThe index of the window within the surface for which to set the background for new content.
cellPointer to a UiCell structure representing the desired background attributes for new content.
Returns
0 on success, or -1 on failure.
Parameters
sPointer to the UiSurface containing the window.
wThe index of the window within the surface.
cellPointer to the UiCell representing the background cell.
Returns
0 on success, -1 on failure.

This function sets the background cell for the specified window within a UI surface without changing the base character. It updates the styles and channels of the ncplane associated with the window and stores the background cell in the metadata. If the surface is not initialized, it returns -1.

Set the background for new content to be written to a specific window within a UiSurface.

Parameters
sPointer to the UiSurface containing the window.
wThe index of the window within the surface.
cellPointer to the UiCell representing the background cell.
Returns
0 on success, -1 on failure.

This function sets the background cell for the specified window within a UI surface without changing the base character. It updates the styles and channels of the ncplane associated with the window and stores the background cell in the metadata. If the surface is not initialized, it returns -1.

Definition at line 941 of file ui_ncurses.c.

941 {
942 if (!s)
943 return -1;
944 wbkgrndset(s->mwin[w], cell);
945 return 0;
946}

Referenced by display_pick_page(), display_prompt(), get_cmd_arg(), init_view_boxwin(), init_view_full_screen(), menu_cmd_processor(), menu_engine(), popup_ckeys(), reverse_object(), ui_border_title(), ui_border_ysplit_text(), ui_surface_addpad(), ui_surface_addwin(), and unreverse_object().

Here is the caller graph for this function:

◆ ui_bkgrnd()

int ui_bkgrnd ( UiSurface * s,
ss_t w,
const UiCell * cell )

Set the background of a specific window within a UiSurface.

Set the background cell for the specified window within a UI surface without changing the base character.

Parameters
sPointer to the UiSurface containing the window.
wThe index of the window within the surface for which to set the background.
cellPointer to a UiCell structure representing the desired background attributes.
Returns
0 on success, or -1 on failure.
Parameters
sPointer to the UiSurface containing the window.
wThe index of the window within the surface.
cellPointer to the UiCell representing the background cell.
Returns
0 on success, -1 on failure.

This function sets the background cell for the specified window within a UI surface without changing the base character. It updates the styles and channels of the ncplane associated with the window and stores the background cell in the metadata. If the surface is not initialized, it returns -1.

Set the background of a specific window within a UiSurface.

Parameters
sPointer to the UiSurface containing the window.
wThe index of the window within the surface.
cellPointer to the UiCell representing the background cell.
Returns
0 on success, -1 on failure.

This function sets the background cell for the specified window within a UI surface without changing the base character. It updates the styles and channels of the ncplane associated with the window and stores the background cell in the metadata. If the surface is not initialized, it returns -1.

Definition at line 955 of file ui_ncurses.c.

955 {
956 if (!s->mwin[w])
957 return -1;
958 wbkgrnd(s->mwin[w], cell);
959 return 0;
960}

◆ ui_bkgrndset()

int ui_bkgrndset ( UiSurface * s,
ss_t w,
const UiCell * cell )

Set the background for new content to be written to a specific window within a UiSurface.

Set the background cell for the specified window within a UI surface without changing the base character.

Parameters
sPointer to the UiSurface containing the window.
wThe index of the window within the surface for which to set the background for new content.
cellPointer to a UiCell structure representing the desired background attributes for new content.
Returns
0 on success, or -1 on failure.
Parameters
sPointer to the UiSurface containing the window.
wThe index of the window within the surface.
cellPointer to the UiCell representing the background cell.
Returns
0 on success, -1 on failure.

This function sets the background cell for the specified window within a UI surface without changing the base character. It updates the styles and channels of the ncplane associated with the window and stores the background cell in the metadata. If the surface is not initialized, it returns -1.

Set the background for new content to be written to a specific window within a UiSurface.

Parameters
sPointer to the UiSurface containing the window.
wThe index of the window within the surface.
cellPointer to the UiCell representing the background cell.
Returns
0 on success, -1 on failure.

This function sets the background cell for the specified window within a UI surface without changing the base character. It updates the styles and channels of the ncplane associated with the window and stores the background cell in the metadata. If the surface is not initialized, it returns -1.

Definition at line 969 of file ui_ncurses.c.

969 {
970 if (!s->mwin[w])
971 return -1;
972 wbkgrndset(s->mwin[w], cell);
973 return 0;
974}

◆ ui_border_draw()

int ui_border_draw ( UiSurface * sfc)

Definition at line 474 of file ui_common.c.

474 {
475 uint maxy = ui_getmaxy(sfc, BOX);
476 uint maxx = ui_getmaxx(sfc, BOX);
477 uint y = 0;
478 uint x = 0;
479 ui_mvwadd_wchnstr(sfc, BOX, y, x++, &cell_tl, 1);
480 for (x = 1; x < maxx - 1; x++)
481 ui_mvwadd_wchnstr(sfc, BOX, y, x, &cell_ho, 1);
482 ui_mvwadd_wchnstr(sfc, BOX, y, maxx - 1, &cell_tr, 1);
483 for (y = 1; y < maxy - 1; y++) {
484 ui_mvwadd_wchnstr(sfc, BOX, y, 0, &cell_ve, 1);
485 ui_mvwadd_wchnstr(sfc, BOX, y, maxx - 1, &cell_ve, 1);
486 }
487 ui_mvwadd_wchnstr(sfc, BOX, y, 0, &cell_bl, 1);
488 for (x = 1; x < maxx - 1; x++)
489 ui_mvwadd_wchnstr(sfc, BOX, y, x, &cell_ho, 1);
490 ui_mvwadd_wchnstr(sfc, BOX, y, maxx - 1, &cell_br, 1);
491 return 0;
492}
UiCell cell_ve
Definition ui_common.c:124
UiCell cell_tr
Definition ui_common.c:122
UiCell cell_br
Definition ui_common.c:126
UiCell cell_tl
Definition ui_common.c:121
UiCell cell_ho
Definition ui_common.c:123
int ui_getmaxy(UiSurface *s, ss_t w)
Get the maximum number of lines (rows) of a UiSurface.
Definition ui_ncurses.c:701
int ui_getmaxx(UiSurface *s, ss_t w)
Get the maximum number of columns of a UiSurface.
Definition ui_ncurses.c:712
UiCell cell_bl
Definition ui_common.c:125
int ui_mvwadd_wchnstr(UiSurface *s, ss_t w, uint y, uint x, const UiCell *cmplx_buf, uint n)
Draw a complex character string at a specific position in a surface window, with a maximum length.

References cell_bl, cell_br, cell_ho, cell_tl, cell_tr, cell_ve, ui_getmaxx(), ui_getmaxy(), and ui_mvwadd_wchnstr().

Referenced by ui_surface_box(), and ui_surface_box().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ ui_border_title()

int ui_border_title ( UiSurface * sfc,
const char * title )

Draw a box with a title around the specified window.

border_title

Parameters
boxPointer to the window to draw the box around
titleTitle text to display at the top of the box

This function draws a box around the specified window, similar to border_draw(), but it also includes a title at the top of the box. The title is displayed in the center of the top edge of the box, and the horizontal line is drawn on either side of the title. Use this function when you want to visually label a window with a title.

Definition at line 563 of file ui_common.c.

563 {
564 if (!title || !*title)
565 return 0;
566 uint y = 0;
567 uint x = 0;
568 uint l;
569 uint maxx = ui_getmaxx(sfc, BOX);
570 ui_mvwadd_wchnstr(sfc, BOX, y, x++, &cell_tl, 1);
571 ui_mvwadd_wchnstr(sfc, BOX, y, x++, &cell_rt, 1);
572 ui_mvwadd_wchnstr(sfc, BOX, y, x++, &cell_sp, 1);
573 wchar_t *title_wc;
574 title_wc = ui_mbstr_to_wcstr(title);
575 l = wcswidth(title_wc, wcslen(title_wc));
576 l = min(l, maxx - 7);
577 ui_bkgdset(sfc, BOX, &cell_title);
578 ui_mvwaddnwstr(sfc, BOX, y, x, title_wc, l);
579 ui_bkgdset(sfc, BOX, &cell_box);
580 x += l;
581 free(title_wc);
582 ui_mvwadd_wchnstr(sfc, BOX, y, x++, &cell_sp, 1);
583 ui_mvwadd_wchnstr(sfc, BOX, y, x++, &cell_lt, 1);
584 while (x < maxx - 1) {
585 ui_mvwadd_wchnstr(sfc, BOX, y, x++, &cell_ho, 1);
586 }
587 return 0;
588}
#define min(x, y)
min macro evaluates two expressions, returning least result
Definition cm.h:104
UiCell cell_sp
Definition ui_common.c:132
UiCell cell_lt
Definition ui_common.c:127
UiCell cell_title
Definition ui_common.c:113
int ui_bkgdset(UiSurface *s, ss_t w, const UiCell *cell)
Set the background for new content to be written to a specific window within a UiSurface.
Definition ui_ncurses.c:941
UiCell cell_box
Definition ui_common.c:110
UiCell cell_rt
Definition ui_common.c:128
wchar_t * ui_mbstr_to_wcstr(const char *mb_str)
Convert a multibyte string to a wide character string.
Definition ui_common.c:322
int ui_mvwaddnwstr(UiSurface *s, ss_t w, uint y, uint x, const wchar_t *wstr, int m)
Draw a wide-character string at a specific position in a surface window, with a maximum length.

References cell_box, cell_ho, cell_lt, cell_rt, cell_sp, cell_title, cell_tl, ui_bkgdset(), ui_getmaxx(), ui_mbstr_to_wcstr(), ui_mvwadd_wchnstr(), and ui_mvwaddnwstr().

Referenced by new_view_file(), ui_surface_box(), ui_surface_box(), view_boxwin_resize(), and view_file().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ ui_border_ysplit()

int ui_border_ysplit ( UiSurface * sfc,
uint y )

Draw a box with a separator line around the specified window.

ui_border-ysplit

Parameters
boxPointer to the window to draw the box around
yLine number where the separator line should be drawn

This function draws a box around the specified window, similar to border_draw(), but it also includes a horizontal separator line that divides the box into two sections. The separator line is drawn at a fixed position (line 00, page 00) and extends across the width of the box. Use this function when you want to visually separate two sections within a window, such as for a header and content area.

Definition at line 504 of file ui_common.c.

504 {
505 uint maxx = ui_getmaxx(sfc, BOX);
506 ui_mvwadd_wchnstr(sfc, BOX, y, 0, &cell_lt, 1);
507 for (uint x = 1; x < maxx - 1; x++)
508 ui_mvwadd_wchnstr(sfc, BOX, y, x, &cell_ho, 1);
509 ui_mvwadd_wchnstr(sfc, BOX, y, maxx - 1, &cell_rt, 1);
510 return 0;
511}

References cell_ho, cell_lt, cell_rt, ui_getmaxx(), and ui_mvwadd_wchnstr().

Referenced by ui_tracked_sfc_split_box().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ ui_border_ysplit_text()

int ui_border_ysplit_text ( UiSurface * sfc,
char * text_in,
uint separator_line )

Draw a box with a separator line and text around the specified window.

ui_border_ysplit_text

Parameters
boxPointer to the window to draw the box around
textText to display in the middle of the separator line
separator_lineLine number where the separator line should be drawn

This function draws a box around the specified window, similar to border_draw(), but it also includes a horizontal separator line that divides the box into two sections. The separator line is drawn at the specified line number and extends across the width of the box, with the provided text displayed in the middle of the line. Use this function when you want to visually separate two sections within a window and label the separator with descriptive text.

Definition at line 524 of file ui_common.c.

524 {
525 char text[MAXLEN];
526 uint maxx = ui_getmaxx(sfc, BOX);
527 uint l;
528 uint y = separator_line;
529 uint x = 0;
530 // Draw the horizontal line with text in the middle, so we start by drawing
531 // the left edge, then the text, then the right edge, and finally fill in the
532 // horizontal line on either side of the text.
533 ui_mvwadd_wchnstr(sfc, BOX, y, x++, &cell_lt, 1);
534 ui_mvwadd_wchnstr(sfc, BOX, y, x++, &cell_ho, 1);
535 ui_mvwadd_wchnstr(sfc, BOX, y, x++, &cell_rt, 1);
536 ui_mvwadd_wchnstr(sfc, BOX, y, x++, &cell_sp, 1);
537 strnz__cpy(text, text_in, maxx - 7);
538 wchar_t *text_wc;
539 text_wc = ui_mbstr_to_wcstr(text);
540 l = wcswidth(text_wc, wcslen(text_wc));
541 ui_bkgdset(sfc, BOX, &cell_nt_hl);
542 ui_mvwaddnwstr(sfc, BOX, y, x, text_wc, l);
543 x += l;
544 l = min(l, maxx - 7);
545 free(text_wc);
546 ui_mvwadd_wchnstr(sfc, BOX, y, x++, &cell_sp, 1);
547 ui_mvwadd_wchnstr(sfc, BOX, y, x++, &cell_lt, 1);
548 while (x < maxx - 1)
549 ui_mvwadd_wchnstr(sfc, BOX, y, x++, &cell_ho, 1);
550 ui_mvwadd_wchnstr(sfc, BOX, y, x++, &cell_rt, 1);
551 return 0;
552}
UiCell cell_nt_hl
Definition ui_common.c:108
#define MAXLEN
Definition curskeys.c:15
size_t strnz__cpy(char *, const char *, size_t)
safer alternative to strncpy
Definition whence.c:291

References cell_ho, cell_lt, cell_nt_hl, cell_rt, cell_sp, strnz__cpy(), ui_bkgdset(), ui_getmaxx(), ui_mbstr_to_wcstr(), ui_mvwadd_wchnstr(), and ui_mvwaddnwstr().

Referenced by picker().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ ui_clear()

int ui_clear ( )

Clear the entire screen.

Clear the contents of the standard plane.

Returns
0 on success, or -1 on failure.
0 on success, -1 on failure.

This function clears the contents of the standard plane by erasing its contents. If the standard plane is not initialized, it returns -1.

Clear the entire screen.

Returns
0 on success, -1 on failure.

This function clears the contents of the standard plane by erasing its contents. If the standard plane is not initialized, it returns -1.

Definition at line 599 of file ui_ncurses.c.

599 {
600 clear();
601 return 0;
602}

◆ ui_cm_surface_destroy()

int ui_cm_surface_destroy ( UiSurface * sfc)

Destroy the most recently created surface.

ui_cm_destroy_surface

Returns
0 on success, -1 if no surfaces exist

This function destroys the most recently created surface and decrements the surface pointer. It should be called when a surface is no longer needed to free up resources. If there are no surfaces to destroy, it returns -1.

Note
The difference between this function and ui_surface_destroy() is that this function destroys the surface pointed to by the surface pointer (sfc_ptr) and decrements the surface pointer after destroying the surface.

Definition at line 466 of file ui_common.c.

466 {
468 sfc_ptr--;
469 return 0;
470}
void ui_surface_destroy(UiSurface *s)
Destroy a UiSurface, cleaning up its windows and panels.
Definition ui_ncurses.c:468
int sfc_ptr
Definition ui_ncurses.c:42

References sfc_ptr, and ui_surface_destroy().

Referenced by init_form(), init_pick(), menu_engine(), ui_action_disposition(), ui_answer_yn(), ui_display_error(), ui_perror(), and ui_timeout_prompt().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ ui_curs_set()

int ui_curs_set ( int visible)

Set the visibility of the cursor.

Enable or disable the cursor visibility.

Parameters
visibilityAn integer value indicating the desired cursor visibility: 0 - Invisible 1 - Visible 2 - Very visible (e.g., block cursor)
Returns
0 on success, or -1 on failure.
Parameters
visibleTrue to enable the cursor, false to disable it.
Returns
0 on success, -1 on failure.

This function enables or disables the cursor visibility. If the UI is not initialized, it returns -1. When enabling the cursor, it retrieves the current cursor position and enables the cursor at that position.

Set the visibility of the cursor.

Parameters
visibleTrue to enable the cursor, false to disable it.
Returns
0 on success, -1 on failure.

This function enables or disables the cursor visibility. If the UI is not initialized, it returns -1. When enabling the cursor, it retrieves the current cursor position and enables the cursor at that position.

Definition at line 840 of file ui_ncurses.c.

840 {
841 curs_set(visibility);
842 return 0;
843}

References ui.

Referenced by cf_accept(), field_editor(), fork_exec(), ui_answer_yn(), and ui_tracked_sfc_split_box().

Here is the caller graph for this function:

◆ ui_cursor_enable()

int ui_cursor_enable ( UiSurface * s,
ss_t w,
bool visible )

Enable or disable the cursor for a UiSurface.

Enable or disable the cursor at the current position on the surface and plane specified.

Parameters
sPointer to the UiSurface where the cursor will be enabled or disabled.
wThe index of the window within the surface where the cursor will be enabled or disabled.
visibleA boolean value indicating whether to make the cursor visible (true) or invisible (false).
Returns
0 on success, or -1 on failure.
Parameters
sPointer to the UiSurface containing the window.
wThe index of the window within the surface.
visibleTrue to enable the cursor, false to disable it.
Returns
0 on success, -1 on failure.

This function enables or disables the cursor at the current position on the surface and plane specified. If the UI is not initialized, it returns -1.

Enable or disable the cursor for a UiSurface.

Parameters
sPointer to the UiSurface containing the window.
wThe index of the window within the surface.
visibleTrue to enable the cursor, false to disable it.
Returns
0 on success, -1 on failure.

This function enables or disables the cursor at the current position on the surface and plane specified. If the UI is not initialized, it returns -1.

Definition at line 870 of file ui_ncurses.c.

870 {
871 (void)s;
872 (void)w;
873 if (!ui)
874 return -1;
875 ui->cursor_visible = visible;
876 curs_set(visible ? 1 : 0);
877 return 0;
878}
UiRuntime * ui
Definition ui_ncurses.c:39

References ui.

◆ ui_cursor_enable_yx()

int ui_cursor_enable_yx ( UiSurface * s,
ss_t w,
uint y,
uint x,
bool visible )

Enable or disable the cursor at a specific position within a UiSurface.

Enable or disable the cursor at a specific position on the surface and plane specified.

Parameters
sPointer to the UiSurface where the cursor will be enabled or disabled.
wThe index of the window within the surface where the cursor will be enabled or disabled.
yThe y-coordinate (row) for the cursor's position.
xThe x-coordinate (column) for the cursor's position.
visibleA boolean value indicating whether to make the cursor visible (true) or invisible (false).
Returns
0 on success, or -1 on failure.
Parameters
sPointer to the UiSurface containing the window.
wThe index of the window within the surface.
yThe y-coordinate for the cursor position.
xThe x-coordinate for the cursor position.
visibleTrue to enable the cursor, false to disable it.
Returns
0 on success, -1 on failure.

This function enables or disables the cursor at a specific position on the surface and plane specified. If the UI is not initialized, it returns -1.

Enable or disable the cursor at a specific position within a UiSurface.

Parameters
sPointer to the UiSurface containing the window.
wThe index of the window within the surface.
yThe y-coordinate for the cursor position.
xThe x-coordinate for the cursor position.
visibleTrue to enable the cursor, false to disable it.
Returns
0 on success, -1 on failure.

This function enables or disables the cursor at a specific position on the surface and plane specified. If the UI is not initialized, it returns -1.

Definition at line 855 of file ui_ncurses.c.

855 {
856 if (!ui)
857 return -1;
858 wmove(s->mwin[w], y, x);
859 ui->cursor_visible = visible;
860 curs_set(visible ? 2 : 0);
861 return 0;
862}

References ui.

Referenced by field_editor(), get_cmd_arg(), get_cmd_char(), and picker().

Here is the caller graph for this function:

◆ ui_cursor_move()

int ui_cursor_move ( UiSurface * s,
ss_t w,
uint y,
uint x )

Move the cursor to a specified position within a UiSurface.

Move the cursor to the specified position within a window of a UI surface.

Parameters
sPointer to the UiSurface where the cursor will be moved.
wThe index of the window within the surface where the cursor will be moved.
yThe new y-coordinate (row) for the cursor's position.
xThe new x-coordinate (column) for the cursor's position.
Returns
0 on success, or -1 on failure.
Parameters
sPointer to the UiSurface containing the window.
wThe index of the window within the surface.
yThe y-coordinate for the new cursor position.
xThe x-coordinate for the new cursor position.
Returns
0 on success, -1 on failure.

This function moves the cursor to the specified position within a window of a UI surface. If the surface or window is not initialized, it returns -1.

Move the cursor to a specified position within a UiSurface.

Parameters
sPointer to the UiSurface containing the window.
wThe index of the window within the surface.
yThe y-coordinate for the new cursor position.
xThe x-coordinate for the new cursor position.
Returns
0 on success, -1 on failure.

This function moves the cursor to the specified position within a window of a UI surface. If the surface or window is not initialized, it returns -1.

Definition at line 666 of file ui_ncurses.c.

666 {
667 if (!s || !s->mwin[w])
668 return -1;
669 return wmove(s->mwin[w], y, x);
670}

Referenced by cf_accept(), display_line(), display_line_eod(), display_prompt(), display_split_line(), form_post(), form_process(), get_cmd_arg(), get_cmd_char(), picker(), remove_right_angle(), scroll_next(), scroll_prev(), search(), unreverse_object(), and view_display_page().

Here is the caller graph for this function:

◆ ui_doupdate()

int ui_doupdate ( )

Refresh the display by updating the screen.

Definition at line 895 of file ui_ncurses.c.

895 {
896 doupdate();
897 return 0;
898}

◆ ui_draw_ch()

int ui_draw_ch ( UiSurface * s,
ss_t w,
char c )

Draw a character in a surface window.

on specified window, at current location, add character

Parameters
sThe surface to modify.
wThe window index within the surface.
cThe character to draw.
Returns
0 on success, -1 on error.
Parameters
ssurface
wwindow
ccharacter
Returns
0 on success, -1 on error

Draw a character in a surface window.

Parameters
ssurface
wwindow
ccharacter
Returns
0 on success, -1 on error

Definition at line 53 of file ui_ncurses_draw.c.

53 {
54 if (!s)
55 return -1;
56 waddch(s->mwin[w], c);
57 return 0;
58}

◆ ui_draw_ch_yx()

int ui_draw_ch_yx ( UiSurface * s,
ss_t w,
uint y,
uint x,
char c )

Draw a character at a specific position in a surface window.

on specified window, move to y, x, add character

Parameters
sThe surface to modify.
wThe window index within the surface.
yThe y-coordinate (row) to draw the character.
xThe x-coordinate (column) to draw the character.
cThe character to draw.
Returns
0 on success, -1 on error.
Parameters
ssurface
wwindow
yrow
xcolumn
ccharacter
Returns
0 on success, -1 on error

Draw a character at a specific position in a surface window.

Parameters
ssurface
wwindow
yrow
xcolumn
ccharacter
Returns
0 on success, -1 on error

Definition at line 67 of file ui_ncurses_draw.c.

67 {
68 if (!s)
69 return -1;
70 mvwaddch(s->mwin[w], y, x, c);
71 return 0;
72}

Referenced by menu_cmd_processor().

Here is the caller graph for this function:

◆ ui_draw_hline()

int ui_draw_hline ( UiSurface * s,
ss_t w,
uint y,
uint x,
uint len,
const UiStyle * style )

◆ ui_draw_text()

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

Parameters
ssurface
wwindow
yrow
xcolumn
textstring
Returns
0 on success, -1 on error

Definition at line 74 of file ui_ncurses_draw.c.

74 {
75 if (!s || !text)
76 return -1;
77 mvwaddstr(s->mwin[w], y, x, text);
78 return 0;
79}

Referenced by ui_action_disposition(), ui_answer_yn(), ui_display_error(), ui_perror(), ui_timeout_prompt(), and ui_update_timeout_prompt().

Here is the caller graph for this function:

◆ ui_draw_text_fill()

int ui_draw_text_fill ( UiSurface * s,
ss_t w,
uint y,
uint x,
const char * text,
int m )

Draw a text string at a specific position in a surface window, filling the remaining space with spaces if the string is shorter than n.

on specified window, move to y, x, add string, at most m columns, fill with spaces if text is shorter than m

Parameters
sThe surface to modify.
wThe window index within the surface.
yThe y-coordinate (row) to draw the text.
xThe x-coordinate (column) to draw the text.
textThe text string to draw.
nThe number of characters to draw, padding with spaces if necessary.
Returns
0 on success, -1 on error.
Parameters
ssurface
wwindow
yrow
xcolumn
textstring
mmaximum number of columns to write
Returns
0 on success, -1 on error

Draw a text string at a specific position in a surface window, filling the remaining space with spaces if the string is shorter than n.

Parameters
ssurface
wwindow
yrow
xcolumn
textstring
mmaximum number of columns to write
Returns
0 on success, -1 on error

Definition at line 103 of file ui_ncurses_draw.c.

103 {
104 if (!s || !text)
105 return -1;
106 uint l = strlen(text);
107 if (l < (uint)n) {
108 char *tmp_str = (char *)malloc(n + 1);
109 if (!tmp_str)
110 return -1;
111 strcpy(tmp_str, text);
112 for (int i = l; i < (int)n; i++) {
113 tmp_str[i] = ' ';
114 }
115 tmp_str[n] = '\0';
116 mvwaddstr(s->mwin[w], y, x, tmp_str);
117 free(tmp_str);
118 } else {
119 mvwaddnstr(s->mwin[w], y, x, text, (int)n);
120 }
121 return 0;
122}

References ui_render().

Referenced by menu_cmd_processor(), and menu_engine().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ ui_draw_text_n()

int ui_draw_text_n ( UiSurface * s,
ss_t w,
uint y,
uint x,
const char * text,
int m )

Draw a text string at a specific position in a surface window.

on specified window, move to y, x, add string, at most m columns

Parameters
sThe surface to modify.
wThe window index within the surface.
yThe y-coordinate (row) to draw the text.
xThe x-coordinate (column) to draw the text.
textThe text string to draw.
Returns
0 on success, -1 on error.
Parameters
ssurface
wwindow
yrow
xcolumn
textstring
mmaximum number of columns to write
Returns
0 on success, -1 on error

Draw a text string at a specific position in a surface window.

Parameters
ssurface
wwindow
yrow
xcolumn
textstring
mmaximum number of columns to write
Returns
0 on success, -1 on error

Definition at line 88 of file ui_ncurses_draw.c.

88 {
89 if (!s || !text)
90 return -1;
91 mvwaddnstr(s->mwin[w], y, x, text, (int)n);
92 return 0;
93}

◆ ui_endwin()

void ui_endwin ( )

End the UI application, cleaning up resources and shutting down the UI runtime.

Destroy a UI surface and free its resources.

Parameters
sPointer to the UiSurface to be destroyed.

This function destroys a UI surface by freeing its associated ncplanes and metadata. It also frees the memory allocated for the UiSurface structure. If the provided pointer is NULL, the function does nothing.

End the UI application, cleaning up resources and shutting down the UI runtime.

Parameters
sPointer to the UiSurface to be destroyed.

This function destroys a UI surface by freeing its associated ncplanes and metadata. It also frees the memory allocated for the UiSurface structure. If the provided pointer is NULL, the function does nothing.

Definition at line 412 of file ui_ncurses.c.

412 {
413 endwin();
414 // ui_shutdown();
415}

References ui_shutdown().

Referenced by exec_objects(), fork_exec(), and form_exec_receiver().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ ui_erase()

int ui_erase ( )

Erase the entire screen.

Clear the contents of the specified window within a UI surface.

Returns
0 on success, or -1 on failure.
Parameters
sPointer to the UiSurface containing the window to clear.
wThe index of the window to clear.
Returns
0 on success, -1 on failure.

This function clears the contents of the specified window within a UI surface by erasing its contents. If the surface or window is not initialized, it returns -1.

Erase the entire screen.

Parameters
sPointer to the UiSurface containing the window to clear.
wThe index of the window to clear.
Returns
0 on success, -1 on failure.

This function clears the contents of the specified window within a UI surface by erasing its contents. If the surface or window is not initialized, it returns -1.

Definition at line 591 of file ui_ncurses.c.

591 {
592 erase();
593 return 0;
594}

Referenced by view_full_screen_resize().

Here is the caller graph for this function:

◆ ui_get_caps()

void ui_get_caps ( UiCaps * caps)

Get the UI backend capabilities.

Get the capabilities of the current UI backend.

Parameters
capsPointer to a UiCaps struct to be filled with the backend capabilities.
capsPointer to a UiCaps structure to be filled with the capabilities.

This function populates the provided UiCaps structure with information about the capabilities of the current UI backend. It sets various fields in the structure, such as truecolor support, palette size, mouse support, Unicode support, and resize capability. If the provided pointer is NULL or if the UI runtime is not initialized, the function does nothing.

Get the UI backend capabilities.

Parameters
capsPointer to a UiCaps structure to be filled with the capabilities.

This function populates the provided UiCaps structure with information about the capabilities of the current UI backend. It sets various fields in the structure, such as truecolor support, palette size, mouse support, Unicode support, and resize capability. If the provided pointer is NULL or if the UI runtime is not initialized, the function does nothing.

Definition at line 62 of file ui_ncurses.c.

62 {
63 if (!caps)
64 return;
65 memset(caps, 0, sizeof(*caps));
66 if (!ui)
67 return;
68 // Will add code to actually check later. For now, just lie.
69 caps->truecolor = true;
70 caps->palette256 = true;
71 caps->mouse = ui->mouse_enabled;
72 caps->unicode = true;
73 caps->resize = true;
74 caps->color_pairs = 0;
75}
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

References UiCaps::color_pairs, UiCaps::mouse, UiCaps::palette256, UiCaps::resize, UiCaps::truecolor, ui, and UiCaps::unicode.

◆ ui_get_event_no_mouse()

int ui_get_event_no_mouse ( UiSurface * target,
ss_t w,
UiEvent * ev )

Wait for an input event on target (or stdscr if NULL) without mouse support.

Wait for an input event from the NotCurses context, ignoring mouse events.

Parameters
uiUI runtime context (unused — event comes from the window).
targetSurface to read from, or NULL for stdscr.
evOutput UiEvent structure.
Returns
0 on success, -1 if ev is NULL.
Parameters
targetUnused for NotCurses (events are global to the context).
evOutput UiEvent structure.
Returns
The NotCurses key code, or -1 if ui or ev is NULL.

Wait for an input event on target (or stdscr if NULL) without mouse support.

Parameters
targetUnused for NotCurses (events are global to the context).
evOutput UiEvent structure.
Returns
The NotCurses key code, or -1 if ui or ev is NULL.

Definition at line 234 of file ui_ncurses_input.c.

234 {
235 int ch;
236 mousemask(0, NULL);
237 curs_set(2);
239 cbreak();
240 do {
241 curs_set(2);
242 ch = wgetch(s->mwin[w]);
243 curs_set(0);
244 ev->key = translate_key(ch);
245 if (ev->key == UIKEY_CHAR) {
246 ev->ch = (uint32_t)ch;
247 break;
248 }
249 } while (ch == ERR);
250 curs_set(0);
251 return ch;
252}
#define ERR
Definition ui_backend.h:427
#define UIKEY_CHAR
void ui_flush_input()
Flush any pending input events from the NotCurses context. This function discards any input events th...
uint32_t ch
Definition ui_backend.h:104
UiKey key
Definition ui_backend.h:103

References UiEvent::alt, UiEvent::ch, UiEvent::ctrl, UiEvent::key, UiEvent::shift, ui, and ui_flush_input().

Here is the call graph for this function:

◆ ui_get_screen_size()

void ui_get_screen_size ( uint * lines,
uint * cols )

Get the current screen size (number of lines and columns).

Get the current screen size in lines and columns.

Parameters
linesPointer to a uint variable where the number of lines (rows) will be stored.
colsPointer to a uint variable where the number of columns will be stored.
linesPointer to an unsigned integer to store the number of lines (rows).
colsPointer to an unsigned integer to store the number of columns.

This function retrieves the current screen size in lines and columns.

Get the current screen size (number of lines and columns).

Parameters
linesPointer to an unsigned integer to store the number of lines (rows).
colsPointer to an unsigned integer to store the number of columns.

This function retrieves the current screen size in lines and columns.

Definition at line 722 of file ui_ncurses.c.

722 {
723 if (!ui)
724 return;
725 getmaxyx(stdscr, ui->lines, ui->cols);
726 if (lines)
727 *lines = ui->lines;
728 if (cols)
729 *cols = ui->cols;
730}

References ui.

Referenced by open_pick_win(), popup_ckeys(), ui_action_disposition(), ui_answer_yn(), ui_display_error(), ui_perror(), ui_surface_box(), ui_surface_new(), ui_timeout_prompt(), ui_tracked_sfc_box(), ui_tracked_sfc_split_box(), view_calc_boxwin_dimensions(), view_calc_full_screen_dimensions(), and view_cmd_processor().

Here is the caller graph for this function:

◆ ui_getch()

int ui_getch ( )

Wait for a single input character from the NotCurses context.

Returns
The NotCurses key code, or -1 if ui is NULL.

Definition at line 222 of file ui_notcurses_input.c.

222 {
223 if (!ui)
224 return -1;
225 ncinput ni;
226 do {
227 notcurses_get(ui->nc, NULL, &ni);
228 } while (ni.evtype == NCTYPE_RELEASE ||
229 ni.id == NCKEY_INVALID ||
230 ni.id == NCKEY_MOTION ||
231 ni.id == NCKEY_SIGNAL);
232 return ni.id;
233}

References ui.

◆ ui_getmaxx()

int ui_getmaxx ( UiSurface * s,
ss_t w )

Get the maximum number of columns of a UiSurface.

Get the maximum number of columns of a window within a UI surface.

Parameters
sPointer to the UiSurface for which to retrieve the maximum number of columns.
wThe index of the window within the surface for which to retrieve the maximum number of columns.
Returns
The maximum number of columns of the specified UiSurface, or -1 on failure.
Parameters
sPointer to the UiSurface containing the window.
wThe index of the window within the surface.
Returns
The maximum number of columns of the window, or -1 on failure.

This function retrieves the maximum number of columns of a window within a UI surface. If the surface or window is not initialized, it returns -1.

Get the maximum number of columns of a UiSurface.

Parameters
sPointer to the UiSurface containing the window.
wThe index of the window within the surface.
Returns
The maximum number of columns of the window, or -1 on failure.

This function retrieves the maximum number of columns of a window within a UI surface. If the surface or window is not initialized, it returns -1.

Definition at line 712 of file ui_ncurses.c.

712 {
713 if (!s->mwin[w])
714 return -1;
715 return (int)(getmaxx(s->mwin[w]));
716}

Referenced by ui_border_draw(), ui_border_title(), ui_border_ysplit(), and ui_border_ysplit_text().

Here is the caller graph for this function:

◆ ui_getmaxy()

int ui_getmaxy ( UiSurface * s,
ss_t w )

Get the maximum number of lines (rows) of a UiSurface.

Get the maximum number of lines (rows) of a window within a UI surface.

Parameters
sPointer to the UiSurface for which to retrieve the maximum number of lines.
wThe index of the window within the surface for which to retrieve the maximum number of lines.
Returns
The maximum number of lines (rows) of the specified UiSurface, or -1 on failure.
Parameters
sPointer to the UiSurface containing the window.
wThe index of the window within the surface.
Returns
The maximum number of lines (rows) of the window, or -1 on failure.

This function retrieves the maximum number of lines (rows) of a window within a UI surface. If the surface or window is not initialized, it returns -1.

Get the maximum number of lines (rows) of a UiSurface.

Parameters
sPointer to the UiSurface containing the window.
wThe index of the window within the surface.
Returns
The maximum number of lines (rows) of the window, or -1 on failure.

This function retrieves the maximum number of lines (rows) of a window within a UI surface. If the surface or window is not initialized, it returns -1.

Definition at line 701 of file ui_ncurses.c.

701 {
702 if (!s->mwin[w])
703 return -1;
704 return (int)(getmaxy(s->mwin[w]));
705}

Referenced by field_editor(), ui_assign_chyron_win(), and ui_border_draw().

Here is the caller graph for this function:

◆ ui_getmaxyx()

void ui_getmaxyx ( UiSurface * s,
ss_t w,
uint * y,
uint * x )

Get the maximum dimensions of a UiSurface.

Get the maximum dimensions of a window within a UI surface.

Parameters
sPointer to the UiSurface for which to retrieve the maximum dimensions.
wThe index of the window within the surface for which to retrieve the maximum dimensions.
linesPointer to a uint variable where the maximum number of lines (rows) will be stored.
colsPointer to a uint variable where the maximum number of columns will be stored.
sPointer to the UiSurface containing the window.
wThe index of the window within the surface.
yPointer to an unsigned integer to store the maximum number of lines (rows).
xPointer to an unsigned integer to store the maximum number of columns.

This function retrieves the maximum dimensions of a window within a UI surface. If the surface or window is not initialized, it does nothing.

Get the maximum dimensions of a UiSurface.

Parameters
sPointer to the UiSurface containing the window.
wThe index of the window within the surface.
yPointer to an unsigned integer to store the maximum number of lines (rows).
xPointer to an unsigned integer to store the maximum number of columns.

This function retrieves the maximum dimensions of a window within a UI surface. If the surface or window is not initialized, it does nothing.

Definition at line 690 of file ui_ncurses.c.

690 {
691 if (!s->mwin[w])
692 return;
693 getmaxyx(s->mwin[w], *lines, *cols);
694}

Referenced by form_post(), form_process(), and picker().

Here is the caller graph for this function:

◆ ui_getyx()

void ui_getyx ( UiSurface * s,
ss_t w,
uint * y,
uint * x )

Get the current cursor position within a window of a UI surface.

Parameters
sPointer to the UiSurface containing the window.
wThe index of the window within the surface.
yPointer to an unsigned integer to store the y-coordinate of the cursor.
xPointer to an unsigned integer to store the x-coordinate of the cursor.

This function retrieves the current cursor position within a window of a UI surface. If the surface or window is not initialized, it does nothing.

Definition at line 675 of file ui_ncurses.c.

675 {
676 if (!s->mwin[w])
677 return;
678 int _lines, _cols;
679 getyx(s->mwin[w], _lines, _cols);
680 *lines = (uint)(_lines);
681 *cols = (uint)(_cols);
682}

Referenced by display_prompt(), and get_cmd_char().

Here is the caller graph for this function:

◆ ui_idcok()

int ui_idcok ( UiSurface * s,
ss_t w,
bool enable )

Enable or disable the use of the insert/delete character capabilities for a UiSurface.

Enable or disable the keypad for the specified window within a UI surface.

Parameters
sPointer to the UiSurface for which to enable or disable the insert/delete character capabilities.
wThe index of the window within the surface for which to enable or disable the insert/delete character capabilities.
enableA boolean value indicating whether to enable (true) or disable (false) the insert/delete character capabilities.
Returns
0 on success, or -1 on failure.
Parameters
sPointer to the UiSurface containing the window.
wThe index of the window within the surface.
enableTrue to enable the keypad, false to disable the keypad.
Returns
0 on success, -1 on failure.

This function does nothing.

Enable or disable the use of the insert/delete character capabilities for a UiSurface.

Parameters
sPointer to the UiSurface containing the window.
wThe index of the window within the surface.
enableTrue to enable the keypad, false to disable the keypad.
Returns
0 on success, -1 on failure.

This function does nothing.

Definition at line 803 of file ui_ncurses.c.

803 {
804 if (!s->mwin[w])
805 return -1;
806 if (enable)
807 idcok(s->mwin[w], true);
808 else
809 idcok(s->mwin[w], false);
810 return 0;
811}

Referenced by init_view_boxwin(), and init_view_full_screen().

Here is the caller graph for this function:

◆ ui_idlok()

int ui_idlok ( UiSurface * s,
ss_t w,
bool enable )

Enable or disable the use of the insert/delete line capabilities for a UiSurface.

Enable or disable the use of the keypad for the specified window within a UI surface.

Parameters
sPointer to the UiSurface for which to enable or disable the insert/delete line capabilities.
wThe index of the window within the surface for which to enable or disable the insert/delete line capabilities.
enableA boolean value indicating whether to enable (true) or disable (false) the insert/delete line capabilities.
Returns
0 on success, or -1 on failure.
Parameters
sPointer to the UiSurface containing the window.
wThe index of the window within the surface.
enableTrue to enable the use of the keypad, false to disable it.
Returns
0 on success, -1 on failure.

This function does nothing.

Enable or disable the use of the insert/delete line capabilities for a UiSurface.

Parameters
sPointer to the UiSurface containing the window.
wThe index of the window within the surface.
enableTrue to enable the use of the keypad, false to disable it.
Returns
0 on success, -1 on failure.

This function does nothing.

Definition at line 787 of file ui_ncurses.c.

787 {
788 if (!s->mwin[w])
789 return -1;
790 if (enable)
791 idlok(s->mwin[w], true);
792 else
793 idlok(s->mwin[w], false);
794 return 0;
795}

Referenced by init_view_boxwin(), and init_view_full_screen().

Here is the caller graph for this function:

◆ ui_init()

UiRuntime * ui_init ( const UiConfig * cfg,
SIO * sio )

Initialize the UI runtime with the given configuration and SIO.

Initialize the UI runtime with the specified configuration and SIO.

Parameters
cfgPointer to a UiConfig structure containing the configuration settings.
sioPointer to an SIO structure for input/output operations.
Returns
A pointer to the initialized UiRuntime structure, or NULL on failure.
Parameters
cfgPointer to a UiConfig structure containing configuration options.
sioPointer to a SIO structure for input/output operations.
Returns
Pointer to the initialized UiRuntime structure, or NULL on failure.

This function initializes the UI runtime using the NotCurses library. It sets up the terminal, creates the standard plane, and initializes various UI components based on the provided configuration. If any step fails, it cleans up and returns NULL.

Initialize the UI runtime with the given configuration and SIO.

Parameters
cfgPointer to a UiConfig structure containing configuration options.
sioPointer to a SIO structure for input/output operations.
Returns
Pointer to the initialized UiRuntime structure, or NULL on failure.

This function initializes the UI runtime using the NotCurses library. It sets up the terminal, creates the standard plane, and initializes various UI components based on the provided configuration. If any step fails, it cleans up and returns NULL.

Definition at line 129 of file ui_ncurses.c.

129 {
130 setlocale(LC_ALL, "en_US.UTF-8");
131 ui = calloc(1, sizeof(*ui));
132 if (!ui)
133 return NULL;
134 char tty_name[MAXLEN];
135 if (ttyname_r(STDERR_FILENO, tty_name, sizeof(tty_name)) != 0) {
136 free(ui);
137 return NULL;
138 }
139 ui->tty_fp = fopen(tty_name, "r+");
140 if (!ui->tty_fp) {
141 free(ui);
142 return NULL;
143 }
144 ui->tty_fd = fileno(ui->tty_fp);
146
147 ui_log(INFO, _("ui_init: using tty: %s"), tty_name);
148 ui->screen = newterm(NULL, ui->tty_fp, ui->tty_fp);
149 f_ncurses_open = true;
150 if (!ui->screen) {
151 fclose(ui->tty_fp);
152 free(ui);
153 return NULL;
154 }
155 set_term(ui->screen);
156 if (!has_colors() || !can_change_color()) {
157 ui_shutdown();
158 return NULL;
159 }
160 start_color();
161 use_default_colors();
162 cbreak();
163 noecho();
164 keypad(stdscr, TRUE);
165 if (ui->mouse_enabled)
166 mousemask(ALL_MOUSE_EVENTS | REPORT_MOUSE_POSITION, NULL);
167 getmaxyx(stdscr, ui->lines, ui->cols);
168
169 stdsfc = calloc(1, sizeof(*stdsfc));
170 if (!stdsfc)
171 return NULL;
172 stdsfc->runtime = ui;
173 stdsfc->parent = NULL;
174 stdsfc->meta[BOX].lines = (int)ui->lines;
175 stdsfc->meta[BOX].cols = (int)ui->cols;
176 stdsfc->meta[BOX].y = 0;
177 stdsfc->meta[BOX].x = 0;
178 stdsfc->mwin[BOX] = stdscr;
179 stdsfc->mpan[BOX] = new_panel(stdsfc->mwin[BOX]);
180 if (!stdsfc->mpan[BOX]) {
181 free(stdsfc);
182 ui_log(ERROR, _("new_panel failed for stdsfc->mpan[BOX]"));
183 exit(EXIT_FAILURE);
184 }
185 if (cfg->border_style)
186 ui->border_style = cfg->border_style;
187 if (!ui->border_style)
188 ui->border_style = UI_BORDER_ROUNDED;
189 if (cfg) {
190 switch (ui->border_style) {
191 case UI_BORDER_SINGLE:
192 memcpy(bw.str, border_single, sizeof(bw.str));
193 break;
194 case UI_BORDER_DOUBLE:
195 memcpy(bw.str, border_double, sizeof(bw.str));
196 break;
197 case UI_BORDER_ROUNDED:
198 memcpy(bw.str, border_rounded, sizeof(bw.str));
199 break;
200 case UI_BORDER_HEAVY:
201 memcpy(bw.str, border_heavy, sizeof(bw.str));
202 break;
203 case UI_BORDER_NONE:
204 memcpy(bw.str, border_none, sizeof(bw.str));
205 break;
206 default:
207 memcpy(bw.str, border_rounded, sizeof(bw.str));
208 break;
209 }
210 }
212 ui_log(INFO, _("ui_init: stdsfc->mwin[BOX]: %p, stdsfc->mpan[BOX]: %p"), (void *)stdsfc->mwin[BOX], (void *)stdsfc->mpan[BOX]);
213 return ui;
214}
const wchar_t * border_none
Definition ui_common.c:72
bool f_ncurses_open
Definition ui_common.c:50
BorderWide bw
Definition ui_common.c:27
const wchar_t * border_double
Definition ui_common.c:69
const wchar_t * border_single
Definition ui_common.c:68
void ui_initialize_sio(SIO *sio)
Definition ui_common.c:182
UiSurface * stdsfc
Definition ui_ncurses.c:46
const wchar_t * border_heavy
Definition ui_common.c:71
const wchar_t * border_rounded
Definition ui_common.c:70
UiLogLevel ui_min_log_level
Definition ui_common.c:1390
void ui_shutdown()
Shutdown the UI runtime, cleaning up resources and freeing memory.
Definition ui_ncurses.c:418
#define TRUE
Definition iloan.c:31
#define _(String)
Definition amort.c:23
UiBorderStyle border_style
Definition ui_backend.h:445
UiLogLevel log_level
Definition ui_backend.h:447

References border_double, border_heavy, border_none, border_rounded, border_single, UiConfig::border_style, bw, f_ncurses_open, f_notcurses_open, UiConfig::log_level, sfc_ptr, stdplane, stdsfc, border_wide::str, SUB_SFC_MAX, ui, ui_color, ui_color_cnt, ui_initialize_sio(), ui_min_log_level, ui_pair, ui_pair_cnt, and ui_shutdown().

Referenced by main().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ ui_initialize_sio()

void ui_initialize_sio ( SIO * sio)

gamma correction values

These are read from ~/.minitrc

used when initializing colors

Definition at line 182 of file ui_common.c.

182 {
186 ui->sio = sio;
187 RED_GAMMA = sio->red_gamma;
189 BLUE_GAMMA = sio->blue_gamma;
190 GRAY_GAMMA = sio->gray_gamma;
192 //
193 // Initialize Standardized color pairs
194 //
211 //
212 // Initialize Standardized UiCells
213 //
216 mbstate_t mbstate;
217 memset(&mbstate, 0, sizeof(mbstate));
218 wchar_t brktl = sio->brackets[0];
219 cell_brktl = ui_cell_from_ucp(&brktl, &sio->brackets_fg, &sio->brackets_bg);
220 wchar_t brktr = sio->brackets[1];
221 cell_brktr = ui_cell_from_ucp(&brktr, &sio->brackets_fg, &sio->brackets_bg);
222 cell_nt = ui_cell_from_ucp(bw_sp, &sio->nt_fg, &sio->nt_bg);
229 cell_ln = ui_cell_from_ucp(bw_sp, &sio->ln_fg, &sio->ln_bg);
233 cell_tl = ui_cell_from_ucp(&bw_tl, &sio->box_fg, &sio->box_bg);
234 cell_tr = ui_cell_from_ucp(&bw_tr, &sio->box_fg, &sio->box_bg);
235 cell_bl = ui_cell_from_ucp(&bw_bl, &sio->box_fg, &sio->box_bg);
236 cell_br = ui_cell_from_ucp(&bw_br, &sio->box_fg, &sio->box_bg);
237 cell_ho = ui_cell_from_ucp(&bw_ho, &sio->box_fg, &sio->box_bg);
238 cell_ve = ui_cell_from_ucp(&bw_ve, &sio->box_fg, &sio->box_bg);
239 cell_lt = ui_cell_from_ucp(&bw_lt, &sio->box_fg, &sio->box_bg);
240 cell_rt = ui_cell_from_ucp(&bw_rt, &sio->box_fg, &sio->box_bg);
241 cell_tt = ui_cell_from_ucp(&bw_tt, &sio->box_fg, &sio->box_bg);
242 cell_bt = ui_cell_from_ucp(&bw_bt, &sio->box_fg, &sio->box_bg);
243 cell_cr = ui_cell_from_ucp(&bw_cr, &sio->box_fg, &sio->box_bg);
244 cell_sp = ui_cell_from_ucp(bw_sp, &sio->box_fg, &sio->box_bg);
245}
#define bw_ho
Definition ui_backend.h:581
const wchar_t * bw_sp
Definition ui_common.c:79
ushort cp_nt
Definition ui_common.c:142
UiCell cell_nt
Definition ui_common.c:106
const wchar_t * bw_ran
Definition ui_common.c:84
UiCell cell_nt_hl_rev
Definition ui_common.c:109
UiCell cell_bt
Definition ui_common.c:130
ushort cp_green
Definition ui_common.c:151
ushort cp_red
Definition ui_common.c:150
ushort cp_box
Definition ui_common.c:138
ushort cp_blue
Definition ui_common.c:153
UiCell cell_ln
Definition ui_common.c:114
#define bw_tr
Definition ui_backend.h:589
const wchar_t * bw_chk
Definition ui_common.c:86
ushort cp_nt_hl
Definition ui_common.c:144
#define bw_lt
Definition ui_backend.h:583
ushort cp_fill_char
Definition ui_common.c:148
UiCell cell_tt
Definition ui_common.c:129
ushort cp_brackets
Definition ui_common.c:149
#define bw_br
Definition ui_backend.h:591
ushort cp_yellow
Definition ui_common.c:152
#define bw_bl
Definition ui_backend.h:590
UiCell cell_default
Definition ui_common.c:102
ushort cp_nt_hl_rev
Definition ui_common.c:145
ushort cp_default
Definition ui_common.c:147
ushort cp_nt_rev
Definition ui_common.c:143
ushort cp_title
Definition ui_common.c:141
UiCell cell_brktl
Definition ui_common.c:104
#define bw_tt
Definition ui_backend.h:585
UiCell cell_cr
Definition ui_common.c:131
#define bw_cr
Definition ui_backend.h:587
UiCell cell_ind
Definition ui_common.c:111
UiCell cell_ran
Definition ui_common.c:115
#define bw_bt
Definition ui_backend.h:586
#define bw_ve
Definition ui_backend.h:582
UiCell cell_cmdln
Definition ui_common.c:112
#define bw_rt
Definition ui_backend.h:584
UiCell cell_brktr
Definition ui_common.c:105
ushort cp_ind
Definition ui_common.c:139
UiCell cell_fill_char
Definition ui_common.c:103
UiCell cell_chk
Definition ui_common.c:116
UiCell cell_nt_rev
Definition ui_common.c:107
#define bw_tl
Definition ui_backend.h:588
double BLUE_GAMMA
Definition ui_common.c:65
ushort cp_cmdln
Definition ui_common.c:140
bool ui_init_clr_palette(SIO *sio)
Definition ui_common.c:247
ushort cp_ln
Definition ui_common.c:146
double GRAY_GAMMA
Definition ui_common.c:62
double RED_GAMMA
Definition ui_common.c:63
double GREEN_GAMMA
Definition ui_common.c:64
uint ui_add_pair(uint fg, uint bg)
Add a new color pair to the UI, or retrieve the index of an existing pair.
UiCell ui_cell_from_ucp(const wchar_t *ucp, const uint32_t *fg, const uint32_t *bg)
Convert a Unicode code point to a curses UiCell with specified foreground and background colors.
Definition ui_ncurses.c:101
uint32_t ran_bg
Definition ui_backend.h:740
double green_gamma
Definition ui_backend.h:693
uint32_t ln_bg
Definition ui_backend.h:726
double blue_gamma
Definition ui_backend.h:694
char brackets[3]
Definition ui_backend.h:753
uint32_t cmdln_bg
Definition ui_backend.h:728
uint32_t cmdln_fg
Definition ui_backend.h:727
uint32_t nt_hl_rev_fg
Definition ui_backend.h:735
uint32_t ran_fg
Definition ui_backend.h:739
double red_gamma
Definition ui_backend.h:692
uint32_t nt_fg
Definition ui_backend.h:729
uint32_t fill_char_fg
Definition ui_backend.h:723
uint32_t box_fg
Definition ui_backend.h:717
uint32_t ln_fg
Definition ui_backend.h:725
uint32_t ind_bg
Definition ui_backend.h:720
uint32_t ind_fg
Definition ui_backend.h:719
uint32_t title_bg
Definition ui_backend.h:738
uint32_t nt_hl_rev_bg
Definition ui_backend.h:736
uint32_t title_fg
Definition ui_backend.h:737
uint32_t fill_char_bg
Definition ui_backend.h:724
uint32_t nt_rev_bg
Definition ui_backend.h:732
uint32_t brackets_bg
Definition ui_backend.h:722
uint32_t nt_bg
Definition ui_backend.h:730
uint32_t brackets_fg
Definition ui_backend.h:721
uint32_t box_bg
Definition ui_backend.h:718
uint32_t nt_hl_fg
Definition ui_backend.h:733
uint32_t nt_rev_fg
Definition ui_backend.h:731
double gray_gamma
Definition ui_backend.h:695
uint32_t nt_hl_bg
Definition ui_backend.h:734

References BLUE_GAMMA, SIO::blue_gamma, SIO::box_bg, SIO::box_fg, SIO::brackets, SIO::brackets_bg, SIO::brackets_fg, bw_chk, bw_ran, bw_sp, cell_bl, cell_box, cell_br, cell_brktl, cell_brktr, cell_bt, cell_chk, cell_cmdln, cell_cr, cell_default, cell_fill_char, cell_ho, cell_ind, cell_ln, cell_lt, cell_nt, cell_nt_hl, cell_nt_hl_rev, cell_nt_rev, cell_ran, cell_rt, cell_sp, cell_title, cell_tl, cell_tr, cell_tt, cell_ve, CLR_BG, CLR_BLUE, CLR_BOX_BG, CLR_BOX_FG, CLR_BRACKETS_BG, CLR_BRACKETS_FG, CLR_CMDLN_BG, CLR_CMDLN_FG, CLR_FG, CLR_FILL_CHAR_BG, CLR_FILL_CHAR_FG, CLR_GREEN, CLR_IND_BG, CLR_IND_FG, CLR_LN_BG, CLR_LN_FG, CLR_NT_BG, CLR_NT_FG, CLR_NT_HL_BG, CLR_NT_HL_FG, CLR_NT_HL_REV_BG, CLR_NT_HL_REV_FG, CLR_NT_REV_BG, CLR_NT_REV_FG, CLR_RED, CLR_TITLE_BG, CLR_TITLE_FG, CLR_YELLOW, SIO::cmdln_bg, SIO::cmdln_fg, cp_blue, cp_box, cp_brackets, cp_cmdln, cp_default, cp_fill_char, cp_green, cp_ind, cp_ln, cp_nt, cp_nt_hl, cp_nt_hl_rev, cp_nt_rev, cp_red, cp_title, cp_yellow, SIO::fill_char_bg, SIO::fill_char_fg, GRAY_GAMMA, SIO::gray_gamma, GREEN_GAMMA, SIO::green_gamma, SIO::ind_bg, SIO::ind_fg, SIO::ln_bg, SIO::ln_fg, SIO::nt_bg, SIO::nt_fg, SIO::nt_hl_bg, SIO::nt_hl_fg, SIO::nt_hl_rev_bg, SIO::nt_hl_rev_fg, SIO::nt_rev_bg, SIO::nt_rev_fg, SIO::ran_bg, SIO::ran_fg, RED_GAMMA, SIO::red_gamma, SIO::title_bg, SIO::title_fg, ui, ui_add_pair(), ui_cell_from_ucp(), and ui_init_clr_palette().

Referenced by read_theme(), ui_init(), and ui_init().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ ui_keypad()

int ui_keypad ( UiSurface * s,
ss_t w,
bool enable )

Enable or disable the keypad for a UiSurface.

Enable or disable the keypad for the specified window within a UI surface.

Parameters
sPointer to the UiSurface for which to enable or disable the keypad.
wThe index of the window within the surface for which to enable or disable the keypad.
enableA boolean value indicating whether to enable (true) or disable (false) the keypad.
Returns
0 on success, or -1 on failure.
Parameters
sPointer to the UiSurface containing the window.
wThe index of the window within the surface.
enableTrue to enable the keypad, false to disable it.
Returns
0 on success, -1 on failure.

This function does nothing.

Enable or disable the keypad for a UiSurface.

Parameters
sPointer to the UiSurface containing the window.
wThe index of the window within the surface.
enableTrue to enable the keypad, false to disable it.
Returns
0 on success, -1 on failure.

This function does nothing.

Definition at line 771 of file ui_ncurses.c.

771 {
772 if (!s->mwin[w])
773 return -1;
774 if (enable)
775 keypad(s->mwin[w], true);
776 else
777 keypad(s->mwin[w], false);
778 return 0;
779}

Referenced by fork_exec(), init_view_boxwin(), init_view_full_screen(), menu_cmd_processor(), open_pick_win(), picker(), and popup_ckeys().

Here is the caller graph for this function:

◆ ui_mice_enable()

int ui_mice_enable ( int mask)

Enable or disable mouse support.

Enable or disable mouse events for the NotCurses context.

Parameters
maskMouse event mask (0 to disable, non-zero to enable).
Returns
0 on success, -1 if UI is not initialized.
Parameters
maskThe mouse event mask to enable. If 0, all mouse events are enabled.
Returns
0 on success, or -1 if ui is NULL.

Enable or disable mouse support.

Parameters
maskThe mouse event mask to enable. If 0, all mouse events are enabled.
Returns
0 on success, or -1 if ui is NULL.

Definition at line 274 of file ui_ncurses_input.c.

274 {
275 if (!ui)
276 return -1;
277 if (mask)
278 mousemask(mask, nullptr);
279 else
280 mousemask(ALL_MOUSE_EVENTS | REPORT_MOUSE_POSITION, nullptr);
281 return 0;
282}

References ui.

◆ ui_mousemask()

int ui_mousemask ( int mask)

Enable or disable mouse support.

Set the mouse event mask for the NotCurses context.

Parameters
maskMouse event mask (0 to disable, non-zero to enable).
Returns
0 on success, -1 if UI is not initialized.
Parameters
maskThe mouse event mask to set. If 0, all mouse events are enabled.
Returns
0 on success, or -1 if ui is NULL.

Enable or disable mouse support.

Parameters
maskThe mouse event mask to set. If 0, all mouse events are enabled.
Returns
0 on success, or -1 if ui is NULL.

Definition at line 261 of file ui_ncurses_input.c.

261 {
262 if (!ui)
263 return -1;
264 if (mask)
265 mousemask(mask, nullptr);
266 else
267 mousemask(ALL_MOUSE_EVENTS | REPORT_MOUSE_POSITION, nullptr);
268 return 0;
269}

References ui.

Referenced by menu_cmd_processor(), and picker().

Here is the caller graph for this function:

◆ ui_render()

void ui_render ( )

Render the UI by updating panels and refreshing the display.

Render the UI.

This function renders the UI.

Render the UI by updating panels and refreshing the display.

This function renders the UI.

Definition at line 884 of file ui_ncurses.c.

884 {
885 update_panels();
886 doupdate();
887}

References ui.

Referenced by cf_accept(), display_form(), display_line(), display_pick_page(), field_editor(), form_display_accept_field(), form_display_field(), form_display_fields(), get_cmd_arg(), get_cmd_char(), init_pick(), main(), menu_cmd_processor(), menu_engine(), pad_refresh(), picker(), read_theme(), ui_draw_text_fill(), ui_get_event(), ui_restore_wins(), ui_surface_destroy(), ui_timeout_prompt(), ui_tracked_sfc_box(), ui_update_timeout_prompt(), view_boxwin_resize(), view_display_page(), and view_full_screen_resize().

Here is the caller graph for this function:

◆ ui_restore_wins()

void ui_restore_wins ( )

Restore the state of all windows in the UI. This function refreshes the standard screen and all surface windows, ensuring that their contents are displayed correctly.

Definition at line 371 of file ui_ncurses_draw.c.

371 {
372 touchwin(stdscr);
373 for (int s = 0; s <= sfc_ptr; s++) {
374 for (ss_t w = BOX; w < SUB_SFC_MAX; w++)
375 if (ui_surface[s]->mwin[w] != nullptr)
376 touchwin(ui_surface[s]->mwin[w]);
377 }
378 ui_render();
379}
void ui_render()
Render the UI by updating panels and refreshing the display.
Definition ui_ncurses.c:884
UiSurface * ui_surface[UI_SFC_MAX]
Definition ui_ncurses.c:40

References sfc_ptr, SUB_SFC_MAX, ui_render(), and ui_surface.

Referenced by enter_file_spec(), exec_objects(), fork_exec(), form_exec_receiver(), full_screen_shell(), menu_cmd_processor(), menu_engine(), view_cmd_processor(), view_init_input(), and write_view_buffer().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ ui_resume()

int ui_resume ( )

Resume the UI, restoring the previous program state and updating the display.

Resume the UI and enter the alternate screen.

Returns
0 on success, or -1 on failure.

This function resumes the UI and enters the alternate screen. It is typically used after a suspension of the UI, allowing the application to return to its previous state and continue rendering the UI.

Returns
0 on success, -1 on failure.

Resume the UI, restoring the previous program state and updating the display.

This function resumes the UI and enters the alternate screen. It is typically used after a suspension of the UI, allowing the application to return to its previous state and continue rendering the UI.

Returns
0 on success, -1 on failure.

Definition at line 503 of file ui_ncurses.c.

503 {
504 reset_prog_mode();
505 update_panels();
506 doupdate();
507 return 0;
508}

References ui.

Referenced by fork_exec().

Here is the caller graph for this function:

◆ ui_scrollok()

int ui_scrollok ( UiSurface * s,
ss_t w,
bool enable )

Enable or disable scrolling for a UiSurface.

Enable or disable scrolling for the specified window within a UI surface.

Parameters
sPointer to the UiSurface for which to enable or disable scrolling.
wThe index of the window within the surface for which to enable or disable scrolling.
enableA boolean value indicating whether to enable (true) or disable (false) scrolling.
Returns
0 on success, or -1 on failure.
Parameters
sPointer to the UiSurface containing the window.
wThe index of the window within the surface.
enableTrue to enable scrolling, false to disable scrolling.
Returns
0 on success, -1 on failure.

This function enables or disables scrolling for the specified window within a UI surface. If the surface or window is not initialized, it returns -1.

Enable or disable scrolling for a UiSurface.

Parameters
sPointer to the UiSurface containing the window.
wThe index of the window within the surface.
enableTrue to enable scrolling, false to disable scrolling.
Returns
0 on success, -1 on failure.

This function enables or disables scrolling for the specified window within a UI surface. If the surface or window is not initialized, it returns -1.

Definition at line 755 of file ui_ncurses.c.

755 {
756 if (!s->mwin[w])
757 return -1;
758 if (enable)
759 scrollok(s->mwin[w], true);
760 else
761 scrollok(s->mwin[w], false);
762 return 0;
763}

Referenced by init_view_boxwin(), init_view_full_screen(), menu_cmd_processor(), open_pick_win(), ui_surface_addpad(), and ui_surface_box().

Here is the caller graph for this function:

◆ ui_setscrreg()

int ui_setscrreg ( UiSurface * s,
ss_t w,
uint top,
uint bottom )

Set the scrolling region for a UiSurface.

Set the scrolling region for the specified window within a UI surface.

Parameters
sPointer to the UiSurface for which to set the scrolling region.
wThe index of the window within the surface for which to set the scrolling region.
topThe top line of the scrolling region (0-based).
bottomThe bottom line of the scrolling region (0-based).
Returns
0 on success, or -1 on failure.
Parameters
sPointer to the UiSurface containing the window.
wThe index of the window within the surface.
topThe top line of the scrolling region.
bottomThe bottom line of the scrolling region.
Returns
0 on success, -1 on failure.

This function does nothing.

Set the scrolling region for a UiSurface.

Parameters
sPointer to the UiSurface containing the window.
wThe index of the window within the surface.
topThe top line of the scrolling region.
bottomThe bottom line of the scrolling region.
Returns
0 on success, -1 on failure.

This function does nothing.

Definition at line 820 of file ui_ncurses.c.

820 {
821 if (!s->mwin[w])
822 return -1;
823 wsetscrreg(s->mwin[w], top, bottom);
824 return 0;
825}

Referenced by init_view_boxwin(), init_view_full_screen(), and open_pick_win().

Here is the caller graph for this function:

◆ ui_shutdown()

void ui_shutdown ( )

Shutdown the UI runtime, cleaning up resources and freeing memory.

Shutdown the UI runtime and free all associated resources.

This function shuts down the UI runtime by destroying all surfaces, freeing memory, and stopping the NotCurses library. It also closes the terminal file pointer if it was opened. If the UI runtime is not initialized, the function does nothing.

Shutdown the UI runtime, cleaning up resources and freeing memory.

This function shuts down the UI runtime by destroying all surfaces, freeing memory, and stopping the NotCurses library. It also closes the terminal file pointer if it was opened. If the UI runtime is not initialized, the function does nothing.

Definition at line 418 of file ui_ncurses.c.

418 {
419 if (ui == NULL)
420 return;
421 ui_log(INFO, _("ui_shutdown in progress..."));
422 while (sfc_ptr >= 0) {
423 if (ui_surface[sfc_ptr] != NULL) {
425 ui_surface[sfc_ptr] = NULL;
426 }
427 ui_log(INFO, _("surface destroy: %d"), sfc_ptr);
428 sfc_ptr--;
429 }
430 if (stdsfc->mpan[0] != NULL) {
431 ui_log(INFO, _("calling del_panel(stdsfc->mpan[BOX])"));
432 hide_panel(stdsfc->mpan[0]);
433 del_panel(stdsfc->mpan[0]);
434 stdsfc->mpan[0] = NULL;
435 }
436 ui_log(INFO, _("calling endwin()"));
437 endwin();
438 f_ncurses_open = false;
439 if (ui->screen != NULL) {
440 ui_log(INFO, _("calling delscreen(ui->screen)"));
441 delscreen(ui->screen);
442 ui->screen = NULL;
443 }
444 if (ui->tty_fp != NULL) {
445 ui_log(INFO, _("closing tty_fp"));
446 fclose(ui->tty_fp);
447 ui->tty_fp = NULL;
448 }
449 if (stdsfc != NULL) {
450 ui_log(INFO, _("freeing stdsfc"));
451 free(stdsfc);
452 stdsfc = NULL;
453 }
454 if (ui != NULL) {
455 if (ui->sio) {
456 free(ui->sio);
457 ui->sio = nullptr;
458 }
459 ui_log(INFO, _("freeing ui"));
460 free(ui);
461 ui = NULL;
462 }
463}
void ui_surface_destroy(UiSurface *s)
Destroy a UiSurface, cleaning up its windows and panels.
Definition ui_ncurses.c:468

References f_ncurses_open, f_notcurses_open, sfc_ptr, stdsfc, ui, ui_color, ui_pair, ui_surface, and ui_surface_destroy().

Referenced by cmenu_shutdown(), main(), ui_abend(), ui_destroy_curses(), ui_endwin(), and ui_init().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ ui_sub_surface_str()

const char * ui_sub_surface_str ( ss_t w)

Definition at line 1368 of file ui_common.c.

1368 {
1369 if (w < BOX || w >= SUB_SFC_MAX)
1370 return _("unknown");
1371 return subsfc_s[w];
1372}
const char * subsfc_s[]
Definition ui_common.c:1366

References SUB_SFC_MAX, and subsfc_s.

◆ ui_surface_addpad()

int ui_surface_addpad ( UiSurface * s,
ss_t w,
uint p,
uint lines,
uint cols,
uint y,
uint x )

Add a new pad to the specified UiSurface.

Add padding to an existing UI surface.

Parameters
sPointer to the UiSurface to which the pad will be added.
wThe index of the window within the surface where the pad will be created.
view_winThe index of the window that will be used to view the pad.
linesThe number of lines (rows) for the new pad.
colsThe number of columns for the new pad.
begyThe y-coordinate (row) for the new pad's position (ignored in this implementation).
begxThe x-coordinate (column) for the new pad's position (ignored in this implementation).
Returns
0 on success, or -1 on failure.
Parameters
sPointer to the UiSurface to which padding will be added.
wThe index of the new padded surface.
pThe index of the parent plane to attach to.
linesThe number of lines (rows) for the padded surface.
colsThe number of columns for the padded surface.
yThe y-coordinate for the padded surface's position.
xThe x-coordinate for the padded surface's position.
Returns
0 on success, -1 on failure.

This function adds padding to an existing UI surface by creating a new ncplane with the specified dimensions and position. It updates the metadata for the new padded surface and sets its background and scrolling properties. If any step fails, it cleans up and returns -1.

Add a new pad to the specified UiSurface.

Parameters
sPointer to the UiSurface to which padding will be added.
wThe index of the new padded surface.
pThe index of the parent plane to attach to.
linesThe number of lines (rows) for the padded surface.
colsThe number of columns for the padded surface.
yThe y-coordinate for the padded surface's position.
xThe x-coordinate for the padded surface's position.
Returns
0 on success, -1 on failure.

This function adds padding to an existing UI surface by creating a new ncplane with the specified dimensions and position. It updates the metadata for the new padded surface and sets its background and scrolling properties. If any step fails, it cleans up and returns -1.

Definition at line 369 of file ui_ncurses.c.

369 {
370 (void)begy;
371 (void)begx;
372 s->mwin[w] = newpad(lines, cols);
373 if (s->mwin[w] == nullptr)
374 return -1;
375 s->mwin[view_win] = subpad(s->mwin[PAD], lines, cols, 0, 0);
376 if (s->mwin[view_win] == nullptr)
377 return -1;
378 s->mpan[w] = new_panel(s->mwin[view_win]);
379 immedok(s->mwin[w], true);
380#ifdef DEBUG_UI
381#endif
382 return 0;
383}

References cell_nt, f_notcurses_open, ui, ui_bkgd(), ui_bkgdset(), and ui_scrollok().

Referenced by init_view_boxwin(), and init_view_full_screen().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ ui_surface_addwin()

int ui_surface_addwin ( UiSurface * s,
ss_t w,
uint p,
uint lines,
uint cols,
uint y,
uint x )

Add a new window to the specified UiSurface.

Add a new window to an existing UI surface.

Parameters
sPointer to the UiSurface to which the window will be added.
wThe index of the window within the surface where the new window will be created.
pThe index of the parent window from which the new window will be derived.
linesThe number of lines (rows) for the new window.
colsThe number of columns for the new window.
yThe y-coordinate (row) for the new window's position relative to the parent window.
xThe x-coordinate (column) for the new window's position relative to the parent window.
Returns
0 on success, or -1 on failure.
Parameters
sPointer to the UiSurface to which the window will be added.
wThe index of the new window.
pThe index of the parent plane to attach to.
linesThe number of lines (rows) for the new window.
colsThe number of columns for the new window.
yThe y-coordinate for the new window's position.
xThe x-coordinate for the new window's position.
Returns
0 on success, -1 on failure.

This function adds a new window to an existing UI surface by creating a new ncplane with the specified dimensions and position. It updates the metadata for the new window and sets its background properties. If any step fails, it cleans up and returns -1.

Add a new window to the specified UiSurface.

Parameters
sPointer to the UiSurface to which the window will be added.
wThe index of the new window.
pThe index of the parent plane to attach to.
linesThe number of lines (rows) for the new window.
colsThe number of columns for the new window.
yThe y-coordinate for the new window's position.
xThe x-coordinate for the new window's position.
Returns
0 on success, -1 on failure.

This function adds a new window to an existing UI surface by creating a new ncplane with the specified dimensions and position. It updates the metadata for the new window and sets its background properties. If any step fails, it cleans up and returns -1.

Definition at line 395 of file ui_ncurses.c.

395 {
396 s->mwin[w] = derwin(s->mwin[p], lines, cols, y, x);
397 if (!s->mwin[w]) {
398 free(s);
399 return -1;
400 }
401 s->mpan[w] = new_panel(s->mwin[w]);
402 keypad(s->mwin[w], true);
403 ui_bkgd(s, w, &cell_nt);
404 ui_bkgdset(s, w, &cell_nt);
405 immedok(s->mwin[w], true);
406#ifdef DEBUG_UI
407#endif
408 return 0;
409}
int ui_bkgd(UiSurface *s, ss_t w, const UiCell *cell)
Set the background of a specific window within a UiSurface.
Definition ui_ncurses.c:927
int ui_bkgdset(UiSurface *s, ss_t w, const UiCell *cell)
Set the background for new content to be written to a specific window within a UiSurface.
Definition ui_ncurses.c:941

References cell_nt, f_notcurses_open, ui, ui_bkgd(), and ui_bkgdset().

Referenced by init_view_boxwin(), init_view_full_screen(), ui_display_image(), ui_tracked_sfc_box(), and ui_tracked_sfc_split_box().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ ui_surface_box()

UiSurface * ui_surface_box ( UiSurface * parent,
uint p,
uint lines,
uint cols,
uint y,
uint x,
const char * wtitle )

Create a new UI surface with a border box and optional title.

Parameters
parentPointer to the parent UiSurface, or NULL for a top-level surface.
pThe index of the parent window to derive from, if applicable.
linesThe number of lines (rows) for the new surface.
colsThe number of columns for the new surface.
yThe y-coordinate (row) for the new surface's position.
xThe x-coordinate (column) for the new surface's position.
wtitleThe title string to display in the border box, or NULL for no title.
Returns
A pointer to the newly created UiSurface with a border box, or NULL on failure.
Parameters
parentPointer to the parent UiSurface, or NULL for no parent.
pThe index of the parent plane to attach to.
linesThe number of lines (rows) for the new surface.
colsThe number of columns for the new surface.
yThe y-coordinate for the new surface's position.
xThe x-coordinate for the new surface's position.
wtitleThe title to display on the border box, or NULL for no title.
Returns
Pointer to the newly created UiSurface, or NULL on failure.

This function creates a new UI surface with a border box and an optional title. It allocates memory for the surface, sets up its metadata, and creates a new ncplane for rendering. If any step fails, it cleans up and returns NULL.

Definition at line 288 of file ui_ncurses.c.

288 {
289 if (!ui)
290 return NULL;
291 uint maxy, maxx;
292 ui_get_screen_size(&maxy, &maxx);
293 if (lines > maxy || cols > maxx) {
294 ssnprintf(em0, MAXLEN - 1, _("%s, line: %d"), __FILE__, __LINE__ - 1);
295 ssnprintf(em1, MAXLEN - 1, _("ui_surface_box failed for lines: %d, cols: %d"), lines, cols);
296 ssnprintf(em2, MAXLEN - 1, _("maxy: %d, maxx: %d"), maxy, maxx);
297 ui_display_error(em0, em1, em2, nullptr);
298 return NULL;
299 }
300 UiSurface *s = calloc(1, sizeof(*s));
301 if (!s)
302 return NULL;
303 s->runtime = ui;
304 s->parent = parent;
305 s->meta[BOX].y = y;
306 s->meta[BOX].x = x;
307 s->meta[BOX].lines = lines;
308 s->meta[BOX].cols = cols;
309 if (parent && parent->mwin[p]) {
310 s->mwin[BOX] = derwin(parent->mwin[p], lines, cols, y, x);
311 if (!s->mwin[BOX]) {
312 free(s);
313 return NULL;
314 }
315 } else {
316 s->mwin[BOX] = newwin(lines, cols, y, x);
317 if (!s->mwin[BOX]) {
318 free(s);
319 return NULL;
320 }
321 s->mpan[BOX] = new_panel(s->mwin[BOX]);
322 if (!s->mpan[BOX]) {
323 delwin(s->mwin[BOX]);
324 return NULL;
325 }
326 }
327 ui_scrollok(s, BOX, false);
329 ui_border_title(s, wtitle);
330#ifdef DEBUG_UI
331 immedok(s->mwin[BOX], true);
332#endif
333 return s;
334}
int ui_border_draw(UiSurface *sfc)
Definition ui_common.c:474
char em1[MAXLEN]
Definition ui_common.c:47
char em2[MAXLEN]
Definition ui_common.c:48
int ui_border_title(UiSurface *sfc, const char *title)
Draw a box with a title around the specified window.
Definition ui_common.c:563
char em0[MAXLEN]
Definition ui_common.c:46
void ui_get_screen_size(uint *lines, uint *cols)
Get the current screen size (number of lines and columns).
Definition ui_ncurses.c:722
int ui_scrollok(UiSurface *s, ss_t w, bool enable)
Enable or disable scrolling for a UiSurface.
Definition ui_ncurses.c:755
size_t ssnprintf(char *, size_t, const char *,...)
ssnprintf was designed to be a safer alternative to snprintf.
Definition futil.c:390
int ui_display_error(char *msg0, char *msg1, char *msg2, char *msg3)
Display an error message window or print to stderr.
Definition ui_common.c:1200
unsigned int y
Definition ui_backend.h:328
unsigned int lines
Definition ui_backend.h:330
unsigned int cols
Definition ui_backend.h:331
unsigned int x
Definition ui_backend.h:329
struct UiSurface * parent
Definition ui_backend.h:356
struct UiSurfaceMeta meta[SUB_SFC_MAX]
Definition ui_backend.h:354
struct UiRuntime * runtime
Definition ui_backend.h:355

References cell_box, em0, em1, em2, ssnprintf(), stdplane, strnz__cpy(), ui, ui_border_draw(), ui_border_title(), ui_display_error(), ui_get_screen_size(), and ui_scrollok().

Referenced by init_view_boxwin(), ui_display_image(), ui_tracked_sfc_box(), and ui_tracked_sfc_split_box().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ ui_surface_destroy()

void ui_surface_destroy ( UiSurface * s)

Destroy a UiSurface, cleaning up its windows and panels.

Destroy a UI surface and free its resources.

Parameters
sPointer to the UiSurface to be destroyed.
sPointer to the UiSurface to be destroyed.

This function destroys a UI surface by freeing its associated ncplanes and metadata. It also frees the memory allocated for the UiSurface structure. If the provided pointer is NULL, the function does nothing.

Destroy a UiSurface, cleaning up its windows and panels.

Parameters
sPointer to the UiSurface to be destroyed.

This function destroys a UI surface by freeing its associated ncplanes and metadata. It also frees the memory allocated for the UiSurface structure. If the provided pointer is NULL, the function does nothing.

Definition at line 468 of file ui_ncurses.c.

468 {
469 if (!s)
470 return;
471 for (int i = SUB_SFC_MAX; i >= 0; i--) {
472 if (s->mpan[i] != NULL) {
473 hide_panel(s->mpan[i]);
474 ui_render();
475 del_panel(s->mpan[i]);
476 s->mpan[i] = NULL;
477 }
478 }
479 for (int i = SUB_SFC_MAX; i >= 0; i--) {
480 if (s->mwin[i] != NULL) {
481 delwin(s->mwin[i]);
482 s->mwin[i] = NULL;
483 }
484 }
485 if (s != NULL) {
486 free(s);
487 s = NULL;
488 }
489}
void ui_render()
Render the UI by updating panels and refreshing the display.
Definition ui_ncurses.c:884

References SUB_SFC_MAX, and ui_render().

Referenced by destroy_pick_view(), main(), ui_cm_surface_destroy(), ui_framed_surface_destroy(), ui_framed_surface_new(), ui_shutdown(), view_boxwin_resize(), view_file(), and view_full_screen_resize().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ ui_surface_hide()

int ui_surface_hide ( UiSurface * s,
ss_t w )

Hide a UiSurface, making it invisible on the screen.

Hide the specified window within a UI surface.

Parameters
sPointer to the UiSurface to be hidden.
wThe index of the window within the surface to be hidden.
Returns
0 on success, or -1 on failure.
Parameters
sPointer to the UiSurface containing the window to hide.
wThe index of the window to hide.
Returns
0 on success, -1 on failure.

This function hides the specified window within a UI surface by updating its metadata and moving it far off-screen. If the surface or window is not initialized, it returns -1.

Hide a UiSurface, making it invisible on the screen.

Parameters
sPointer to the UiSurface containing the window to hide.
wThe index of the window to hide.
Returns
0 on success, -1 on failure.

This function hides the specified window within a UI surface by updating its metadata and moving it far off-screen. If the surface or window is not initialized, it returns -1.

Definition at line 635 of file ui_ncurses.c.

635 {
636 if (!s)
637 return -1;
638 hide_panel(s->mpan[w]);
639 s->meta[w].hidden = true;
640 return 0;
641}

◆ ui_surface_move()

int ui_surface_move ( UiSurface * s,
ss_t w,
uint y,
uint x )

Move a UiSurface to a new position on the screen.

Move a UI surface to a new position on the screen.

Parameters
sPointer to the UiSurface to be moved.
wThe index of the window within the surface to be moved.
yThe new y-coordinate (row) for the surface's position.
xThe new x-coordinate (column) for the surface's position.
Returns
0 on success, or -1 on failure.
Parameters
sPointer to the UiSurface to be moved.
wThe index of the window within the surface to move.
yThe new y-coordinate for the surface's position.
xThe new x-coordinate for the surface's position.
Returns
0 on success, -1 on failure.

This function moves a UI surface to a new position on the screen by updating its metadata and moving the associated ncplane. If the surface is hidden, it only updates the metadata without moving the ncplane. If any step fails, it returns -1.

Move a UiSurface to a new position on the screen.

Parameters
sPointer to the UiSurface to be moved.
wThe index of the window within the surface to move.
yThe new y-coordinate for the surface's position.
xThe new x-coordinate for the surface's position.
Returns
0 on success, -1 on failure.

This function moves a UI surface to a new position on the screen by updating its metadata and moving the associated ncplane. If the surface is hidden, it only updates the metadata without moving the ncplane. If any step fails, it returns -1.

Definition at line 521 of file ui_ncurses.c.

521 {
522 if (!s)
523 return -1;
524 s->meta[w].y = y;
525 s->meta[w].x = x;
526 return move_panel(s->mpan[w], y, x);
527}

◆ ui_surface_new()

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.

Parameters
wThe index of the window within the surface.
parentPointer to the parent UiSurface, or NULL for a top-level surface.
pThe index of the parent window to derive from, if applicable.
linesThe number of lines (rows) for the new surface.
colsThe number of columns for the new surface.
yThe y-coordinate (row) for the new surface's position.
xThe x-coordinate (column) for the new surface's position.
Returns
A pointer to the newly created UiSurface, or NULL on failure.
Parameters
wThe index of the surface to create.
parentPointer to the parent UiSurface, or NULL for no parent.
pThe index of the parent plane to attach to.
linesThe number of lines (rows) for the new surface.
colsThe number of columns for the new surface.
yThe y-coordinate for the new surface's position.
xThe x-coordinate for the new surface's position.
Returns
Pointer to the newly created UiSurface, or NULL on failure.

This function creates a new UI surface and initializes its properties based on the provided parameters. It allocates memory for the surface, sets up its metadata, and creates a new ncplane for rendering. If any step fails, it cleans up and returns NULL.

Definition at line 229 of file ui_ncurses.c.

229 {
230 if (!ui)
231 return NULL;
232 uint maxy, maxx;
233 ui_get_screen_size(&maxy, &maxx);
234 if (lines > maxy || cols > maxx) {
235 ssnprintf(em0, MAXLEN - 1, _("%s, line: %d"), __FILE__, __LINE__ - 1);
236 ssnprintf(em1, MAXLEN - 1, _("ui_surface_new failed for lines: %d, cols: %d"), lines, cols);
237 ssnprintf(em2, MAXLEN - 1, _("maxy: %d, maxx: %d"), maxy, maxx);
238 ui_display_error(em0, em1, em2, nullptr);
239 return NULL;
240 }
241
242 UiSurface *s = calloc(1, sizeof(*s));
243 if (!s)
244 return NULL;
245 for (int i = 0; i < SUB_SFC_MAX; i++) {
246 s->mwin[i] = NULL;
247 s->mpan[i] = NULL;
248 }
249 s->runtime = ui;
250 s->parent = parent;
251 s->meta[w].lines = lines;
252 s->meta[w].cols = cols;
253 s->meta[w].y = y;
254 s->meta[w].x = x;
255
256 if (parent && parent->mwin[p]) {
257 s->mwin[w] = derwin(parent->mwin[p], lines, cols, y, x);
258 if (!s->mwin[w]) {
259 free(s);
260 return NULL;
261 }
262 } else {
263 s->mwin[w] = newwin(lines, cols, y, x);
264 if (!s->mwin[w]) {
265 free(s);
266 return NULL;
267 }
268 s->mpan[w] = new_panel(s->mwin[w]);
269 if (!s->mpan[w]) {
270 delwin(s->mwin[w]);
271 free(s);
272 return NULL;
273 }
274 }
275 return s;
276}

References em0, em1, em2, f_notcurses_open, ssnprintf(), stdplane, SUB_SFC_MAX, ui, ui_display_error(), and ui_get_screen_size().

Referenced by init_view_full_screen(), and ui_framed_surface_new().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ ui_surface_resize()

int ui_surface_resize ( UiSurface * s,
ss_t w,
uint lines,
uint cols )

Resize a UiSurface to new dimensions.

Resize a UI surface to new dimensions.

Parameters
sPointer to the UiSurface to be resized.
wThe index of the window within the surface to be resized.
linesThe new number of lines (rows) for the surface.
colsThe new number of columns for the surface.
Returns
0 on success, or -1 on failure.
Parameters
sPointer to the UiSurface to be resized.
wThe index of the window within the surface to resize.
linesThe new number of lines (rows) for the surface.
colsThe new number of columns for the surface.
Returns
0 on success, -1 on failure.

This function resizes a UI surface to new dimensions by updating its metadata and resizing the associated ncplane. If any step fails, it returns -1.

Resize a UiSurface to new dimensions.

Parameters
sPointer to the UiSurface to be resized.
wThe index of the window within the surface to resize.
linesThe new number of lines (rows) for the surface.
colsThe new number of columns for the surface.
Returns
0 on success, -1 on failure.

This function resizes a UI surface to new dimensions by updating its metadata and resizing the associated ncplane. If any step fails, it returns -1.

Definition at line 536 of file ui_ncurses.c.

536 {
537 if (!s)
538 return -1;
539 s->meta[w].lines = lines;
540 s->meta[w].cols = cols;
541 wresize(s->mwin[w], lines + 2, cols + 2);
542 wresize(s->mwin[w + 1], lines, cols);
543 return 0;
544}

◆ ui_surface_show()

int ui_surface_show ( UiSurface * s,
ss_t w )

Show a UiSurface, making it visible on the screen.

Show the specified window within a UI surface.

Parameters
sPointer to the UiSurface to be shown.
wThe index of the window within the surface to be shown.
Returns
0 on success, or -1 on failure.
Parameters
sPointer to the UiSurface containing the window to show.
wThe index of the window to show.
Returns
0 on success, -1 on failure.

This function shows the specified window within a UI surface by updating its metadata and moving it to its designated position. If the surface or window is not initialized, it returns -1.

Show a UiSurface, making it visible on the screen.

Parameters
sPointer to the UiSurface containing the window to show.
wThe index of the window to show.
Returns
0 on success, -1 on failure.

This function shows the specified window within a UI surface by updating its metadata and moving it to its designated position. If the surface or window is not initialized, it returns -1.

Definition at line 609 of file ui_ncurses.c.

609 {
610 if (!s)
611 return -1;
612 show_panel(s->mpan[w]);
613 s->meta[w].hidden = false;
614 return 0;
615 return 0;
616}

◆ ui_suspend()

int ui_suspend ( )

Suspend the UI, saving the current program state and ending the window session.

Suspend the UI and leave the alternate screen.

Returns
0 on success, or -1 on failure.

This function suspends the UI and leaves the alternate screen. It is typically used when the application needs to temporarily exit the UI mode, such as when executing a shell command or displaying a message outside of the UI context.

Returns
0 on success, -1 on failure.

Suspend the UI, saving the current program state and ending the window session.

This function suspends the UI and leaves the alternate screen. It is typically used when the application needs to temporarily exit the UI mode, such as when executing a shell command or displaying a message outside of the UI context.

Returns
0 on success, -1 on failure.

Definition at line 494 of file ui_ncurses.c.

494 {
495 def_prog_mode();
496 endwin();
497 return 0;
498}

References ui.

◆ ui_top_surface()

int ui_top_surface ( UiSurface * s,
ss_t w )

Hide a UiSurface, making it invisible on the screen.

Move the specified window within a UI surface to the top of the z-order.

Parameters
sPointer to the UiSurface to be hidden.
wThe index of the window within the surface to be hidden.
Returns
0 on success, or -1 on failure.
Parameters
sPointer to the UiSurface containing the window to move.
wThe index of the window to move to the top.
Returns
0 on success, -1 on failure.

This function moves the specified window within a UI surface to the top of the z-order, making it the foremost window. If the surface or window is not initialized, it returns -1.

Hide a UiSurface, making it invisible on the screen.

Parameters
sPointer to the UiSurface containing the window to move.
wThe index of the window to move to the top.
Returns
0 on success, -1 on failure.

This function moves the specified window within a UI surface to the top of the z-order, making it the foremost window. If the surface or window is not initialized, it returns -1.

Definition at line 623 of file ui_ncurses.c.

623 {
624 if (!s)
625 return -1;
626 top_panel(s->mpan[w]);
627 return 0;
628}

Referenced by get_cmd_char(), and picker().

Here is the caller graph for this function:

◆ 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.

ui_tracked_sfc_box_com

Parameters
wlinesNumber of lines for the window
wcolsNumber of columns for the window
wbegyStarting Y position for the window
wbegxStarting X position for the window
wtitleTitle for the window
Returns
0 on success, -1 on error

This function creates a new surface and adds a box window to it. It checks if the maximum number of surfaces has been exceeded and adjusts the window size based on the screen size. The new surface is stored in the global ui_surface array, and the surface pointer (sfc_ptr) is incremented. The window is then rendered on the screen.

Definition at line 387 of file ui_common.c.

387 {
388 if (sfc_ptr >= SFC_MAX) {
389 ui_log(ERROR, _("Maximum number of surfaces (%d) exceeded"), SFC_MAX);
390 exit(EXIT_FAILURE);
391 }
392 uint maxy, maxx;
393 ui_get_screen_size(&maxy, &maxx);
394 wlines = min(wlines, maxy);
395 wcols = min(wcols, maxx);
396 sfc_ptr++;
397 // -------------------> UI_win_box <-------------------
398 ui_surface[sfc_ptr] = ui_surface_box(nullptr, 0, wlines + 2, wcols + 2, wbegy, wbegx, wtitle);
400 ui_surface_addwin(sfc, WIN, BOX, wlines, wcols, 1, 1);
401 ui_render();
402 return 0;
403}
int ui_surface_addwin(UiSurface *s, ss_t w, uint p, uint lines, uint cols, uint y, uint x)
Add a new window to the specified UiSurface.
Definition ui_ncurses.c:395
UiSurface * ui_surface_box(UiSurface *parent, uint p, uint lines, uint cols, uint y, uint x, const char *title)
Create a new UI surface with a border box and optional title.
Definition ui_ncurses.c:288
void ui_get_screen_size(uint *lines, uint *cols)
Get the current screen size (number of lines and columns).
Definition ui_ncurses.c:722
#define SFC_MAX
Definition ui_backend.h:197

References sfc_ptr, ui_get_screen_size(), ui_render(), ui_surface, ui_surface_addwin(), and ui_surface_box().

Referenced by display_form(), main(), menu_engine(), popup_ckeys(), ui_action_disposition(), ui_answer_yn(), ui_display_error(), ui_perror(), and ui_timeout_prompt().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ ui_tracked_sfc_split_box()

int ui_tracked_sfc_split_box ( uint wlines,
uint wcols,
uint split_y,
uint split_x,
uint wbegy,
uint wbegx,
const char * wtitle )

Create a new surface with a split box window.

surface_split_box_win_new

Parameters
wlinesNumber of lines for the main window
wcolsNumber of columns for the main window
split_yY position for the split line
split_xX position for the split line (not implemented yet)
wbegyStarting Y position for the window
wbegxStarting X position for the window
wtitleTitle for the window
Returns
0 on success, -1 on error

This function creates a new surface and adds a split box window to it. It checks if the maximum number of surfaces has been exceeded and adjusts the window size based on the screen size. The new surface is stored in the global ui_surface array, and the surface pointer (sfc_ptr) is incremented. The main window and the split window are then rendered on the screen, with a separator line drawn at the specified Y position.

Definition at line 425 of file ui_common.c.

425 {
426 if (sfc_ptr >= SFC_MAX) {
427 ui_log(ERROR, _("Maximum number of surfaces (%d) exceeded"), SFC_MAX);
428 exit(EXIT_FAILURE);
429 }
430 if (wlines == 0 || wcols == 0) {
431 ui_log(ERROR, _("Invalid window size: lines=%d, cols=%d"), wlines, wcols);
432 return -1;
433 }
434 uint maxy, maxx;
435 ui_get_screen_size(&maxy, &maxx);
436 if (wbegy > maxy || wbegx > maxx) {
437 ui_log(ERROR, _("Invalid window position: wbegy=%d, wbegx=%d, wlines=%d, wcols=%d"), wbegy, wbegx, wlines, wcols);
438 return -1;
439 }
440 wlines = min(wlines, maxy);
441 wcols = min(wcols, maxx);
442 split_x = min(split_x, maxx); // not implemented yet
443 uint split_wlines = min(wlines + split_y + 1, maxy);
444 wcols = min(wcols, maxx);
445 sfc_ptr++;
446 // -------------------> surface_new <-------------------
447 ui_surface[sfc_ptr] = ui_surface_box(nullptr, 0, split_wlines + 2, wcols + 2, wbegy, wbegx, wtitle);
449
450 ui_surface_addwin(sfc, WIN, BOX, wlines, wcols, 1, 1);
451 ui_border_ysplit(sfc, wlines + 1);
452 ui_surface_addwin(sfc, WIN2, BOX, 2, wcols, wlines + 2, 1);
453 ui_curs_set(0);
454 return 0;
455}
int ui_curs_set(int visibility)
Set the visibility of the cursor.
Definition ui_ncurses.c:840
int ui_border_ysplit(UiSurface *sfc, uint y)
Draw a box with a separator line around the specified window.
Definition ui_common.c:504

References sfc_ptr, ui_border_ysplit(), ui_curs_set(), ui_get_screen_size(), ui_surface, ui_surface_addwin(), and ui_surface_box().

Referenced by open_pick_win().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ ui_update_panels()

void ui_update_panels ( )

Update the panels in the UI.

Update the panels and render the UI.

This function updates the panels and renders the UI.

Update the panels in the UI.

This function updates the panels and renders the UI.

Definition at line 890 of file ui_ncurses.c.

890 {
891 update_panels();
892}

References ui.

◆ ui_wclear()

int ui_wclear ( UiSurface * s,
ss_t w )

Clear the contents of a UiSurface or all surfaces.

Clear the contents of the specified window within a UI surface.

Parameters
sPointer to the UiSurface to be cleared, or NULL to clear all surfaces.
wThe index of the window within the surface to be cleared, or ALLWINS to clear all windows.
Returns
0 on success, or -1 on failure.
Parameters
sPointer to the UiSurface containing the window to clear.
wThe index of the window to clear.
Returns
0 on success, -1 on failure.

This function clears the contents of the specified window within a UI surface by erasing its contents. If the surface or window is not initialized, it returns -1.

Clear the contents of a UiSurface or all surfaces.

Parameters
sPointer to the UiSurface containing the window to clear.
wThe index of the window to clear.
Returns
0 on success, -1 on failure.

This function clears the contents of the specified window within a UI surface by erasing its contents. If the surface or window is not initialized, it returns -1.

Definition at line 571 of file ui_ncurses.c.

571 {
572 if (!s)
573 return -1;
574 if (w == ALLWINS) {
575 for (int i = 1; i < SUB_SFC_MAX; i++) {
576 if (s->mwin[i]) {
577 wclear(s->mwin[i]);
578 }
579 }
580 } else {
581 if (s->mwin[w]) {
582 wclear(s->mwin[w]);
583 }
584 }
585 return 0;
586}
#define ALLWINS
Definition ui_backend.h:195

References SUB_SFC_MAX.

◆ ui_wclrtobot()

int ui_wclrtobot ( UiSurface * s,
ss_t w )

Set the style of a surface window.

clear from current cursor position to bottom of window

Parameters
sThe surface to modify.
wThe window index within the surface.
styleThe style to apply (UiStyle).
Returns
0 on success, -1 on error.
Parameters
ssurface
wwindow
Returns
0 on success, -1 on error

Set the style of a surface window.

Parameters
ssurface
wwindow
Returns
0 on success, -1 on error

Definition at line 27 of file ui_ncurses_draw.c.

27 {
28 if (!s)
29 return -1;
30 wclrtobot(s->mwin[w]);
31 return 0;
32}

Referenced by display_line_eod(), scroll_next(), scroll_prev(), and search().

Here is the caller graph for this function:

◆ ui_wclrtoeol()

int ui_wclrtoeol ( UiSurface * s,
ss_t w )

Clear to the end of the line in a surface window.

clear the window from the current cursor position to the end of the window

Parameters
sThe surface to modify.
wThe window index within the surface.
Returns
0 on success, -1 on error.
Parameters
ssurface
wwindow
Returns
0 on success, -1 on error

Clear to the end of the line in a surface window.

Parameters
ssurface
wwindow
Returns
0 on success, -1 on error

Definition at line 38 of file ui_ncurses_draw.c.

38 {
39 if (!s)
40 return -1;
41 wclrtoeol(s->mwin[w]);
42 return 0;
43}

Referenced by cf_accept(), display_line(), display_prompt(), display_split_line(), form_post(), get_cmd_arg(), get_cmd_char(), pick_engine(), picker(), ui_display_chyron(), and ui_update_timeout_prompt().

Here is the caller graph for this function:

◆ ui_werase()

int ui_werase ( UiSurface * s,
ss_t w )

Erase the contents of a UiSurface or all surfaces.

Clear the contents of the specified window within a UI surface.

Parameters
sPointer to the UiSurface to be erased, or NULL to erase all surfaces.
wThe index of the window within the surface to be erased, or ALLWINS to erase all windows.
Returns
0 on success, or -1 on failure.
Parameters
sPointer to the UiSurface containing the window to clear.
wThe index of the window to clear.
Returns
0 on success, -1 on failure.

This function clears the contents of the specified window within a UI surface by erasing its contents. If the surface or window is not initialized, it returns -1.

Erase the contents of a UiSurface or all surfaces.

Parameters
sPointer to the UiSurface containing the window to clear.
wThe index of the window to clear.
Returns
0 on success, -1 on failure.

This function clears the contents of the specified window within a UI surface by erasing its contents. If the surface or window is not initialized, it returns -1.

Definition at line 551 of file ui_ncurses.c.

551 {
552 if (w == ALLWINS) {
553 for (int i = 1; i < SUB_SFC_MAX; i++) {
554 if (s->mwin[i]) {
555 werase(s->mwin[i]);
556 }
557 }
558 } else {
559 if (s->mwin[w]) {
560 werase(s->mwin[w]);
561 }
562 }
563 return 0;
564}

References SUB_SFC_MAX.

Referenced by exec_objects(), and full_screen_shell().

Here is the caller graph for this function:

◆ ui_whide()

int ui_whide ( UiSurface * s,
ss_t w )

◆ ui_wmove()

int ui_wmove ( UiSurface * s,
ss_t w,
uint y,
uint x )

Move the cursor to a specified position within a UiSurface.

Move the cursor to the specified position within a window of a UI surface.

Parameters
sPointer to the UiSurface where the cursor will be moved.
wThe index of the window within the surface where the cursor will be moved.
yThe new y-coordinate (row) for the cursor's position.
xThe new x-coordinate (column) for the cursor's position.
Returns
0 on success, or -1 on failure.
Parameters
sPointer to the UiSurface containing the window.
wThe index of the window within the surface.
yThe y-coordinate for the new cursor position.
xThe x-coordinate for the new cursor position.
Returns
0 on success, -1 on failure.

This function moves the cursor to the specified position within a window of a UI surface. If the surface or window is not initialized, it returns -1.

Move the cursor to a specified position within a UiSurface.

Parameters
sPointer to the UiSurface containing the window.
wThe index of the window within the surface.
yThe y-coordinate for the new cursor position.
xThe x-coordinate for the new cursor position.
Returns
0 on success, -1 on failure.

This function moves the cursor to the specified position within a window of a UI surface. If the surface or window is not initialized, it returns -1.

Definition at line 653 of file ui_ncurses.c.

653 {
654 if (!s || !s->mwin[w])
655 return -1;
656 return wmove(s->mwin[w], y, x);
657}

Referenced by full_screen_shell(), menu_cmd_processor(), ui_display_chyron(), ui_mvwadd_wchnstr(), and ui_mvwadd_wchstr().

Here is the caller graph for this function:

◆ ui_wnoutrefresh()

int ui_wnoutrefresh ( UiSurface * s,
ss_t w )

Refresh a specific window within a UiSurface.


Refreshing

Parameters
sPointer to the UiSurface containing the window to be refreshed.
wThe index of the window within the surface to be refreshed.
Returns
0 on success, or -1 on failure.

Refreshing

Parameters
sPointer to the UiSurface containing the window to be refreshed.
wThe index of the window within the surface to be refreshed.
Returns
0 on success, or -1 on failure.

Refreshing

Parameters
sPointer to the UiSurface containing the window to be refreshed.
wThe index of the window within the surface to be refreshed.
Returns
0 on success, or -1 on failure.

Definition at line 908 of file ui_ncurses.c.

908 {
909 if (!s)
910 return -1;
911 wnoutrefresh(s->mwin[w]);
912 return 0;
913}

◆ ui_wresize()

int ui_wresize ( UiSurface * s,
ss_t w,
uint lines,
uint cols )

◆ ui_wscrl()

int ui_wscrl ( UiSurface * s,
ss_t w,
int r )

Scroll the contents of a UiSurface by a specified number of lines.

Scroll the contents of the specified window up or down by the specified number of lines.

Parameters
sPointer to the UiSurface to be scrolled.
wThe index of the window within the surface to be scrolled.
nThe number of lines to scroll. Positive values scroll down, negative values scroll up.
Returns
0 on success, or -1 on failure.
Parameters
sThe surface containing the window to scroll.
wThe index of the window to scroll.
rThe number of lines to scroll. Positive values scroll up, negative values scroll down.
Returns
0 on success, -1 on error.

If r is positive, the contents of the plane are moved up, leaving blank lines at the bottom. In the view application, the view scope is moved toward end of file (eof). - scope_toward_eof()

Note
ui_wscrl(-n) - If r is negative, the contents of the plane are moved down, leaving blank lines at the top. In the view application, the view scope is moved toward beginning of file (bof). - scope_toward_bof()

Scroll the contents of a UiSurface by a specified number of lines.

Parameters
sThe surface containing the window to scroll.
wThe index of the window to scroll.
rThe number of lines to scroll. Positive values scroll up, negative values scroll down.
Returns
0 on success, -1 on error.

If r is positive, the contents of the plane are moved up, leaving blank lines at the bottom. In the view application, the view scope is moved toward end of file (eof). - scope_toward_eof()

Note
ui_wscrl(-n) - If r is negative, the contents of the plane are moved down, leaving blank lines at the top. In the view application, the view scope is moved toward beginning of file (bof). - scope_toward_bof()

Definition at line 738 of file ui_ncurses.c.

738 {
739 if (!s->mwin[w])
740 return -1;
741 wscrl(s->mwin[w], n);
742 return 0;
743}

Referenced by display_pick_page(), scroll_next(), and scroll_prev().

Here is the caller graph for this function:

◆ ui_wshow()

int ui_wshow ( UiSurface * s,
ss_t w )

Variable Documentation

◆ border_double

const wchar_t * border_double = L"═║╠╣╦╩╬╔╗╚╝"
extern

Definition at line 69 of file ui_common.c.

Referenced by ui_init(), and ui_init().

◆ border_heavy

const wchar_t * border_heavy = L"━┃┣┫┳┻╋┏┓┗┛"
extern

Definition at line 71 of file ui_common.c.

Referenced by ui_init(), and ui_init().

◆ border_none

const wchar_t * border_none = L" "
extern

Definition at line 72 of file ui_common.c.

Referenced by ui_init(), and ui_init().

◆ border_rounded

const wchar_t * border_rounded = L"─│├┤┬┴┼╭╮╰╯"
extern

Definition at line 70 of file ui_common.c.

Referenced by ui_init(), and ui_init().

◆ border_single

const wchar_t * border_single = L"─│├┤┬┴┼┌┐└┘"
extern

BOX WIDE UNICODE CODEPOINTS

Definition at line 68 of file ui_common.c.

Referenced by ui_init(), and ui_init().

◆ bw

BorderWide bw
extern

Definition at line 27 of file ui_common.c.

Referenced by ui_init(), and ui_init().

◆ bw_chk

const wchar_t * bw_chk = L"\u2611"
extern

left_angle

Definition at line 86 of file ui_common.c.

Referenced by ui_initialize_sio().

◆ bw_da

const wchar_t * bw_da = L"\u2193"
extern

large down arrow

Definition at line 83 of file ui_common.c.

◆ bw_h09

const wchar_t * bw_h09 = L"\u23BD"
extern

horizontal line 9

Definition at line 87 of file ui_common.c.

◆ bw_la

const wchar_t * bw_la = L"\u2190"
extern

large left arrow

Definition at line 81 of file ui_common.c.

◆ bw_lan

const wchar_t * bw_lan = L"\u276E"
extern

left_angle

Definition at line 85 of file ui_common.c.

◆ bw_ra

const wchar_t * bw_ra = L"\u2192"
extern

large right arrow

Definition at line 80 of file ui_common.c.

◆ bw_ran

const wchar_t * bw_ran = L"\u276F"
extern

right_angle

Definition at line 84 of file ui_common.c.

Referenced by ui_initialize_sio().

◆ bw_rbl

const wchar_t * bw_rbl = L"\u2570"
extern

rounded bottom left

Definition at line 77 of file ui_common.c.

◆ bw_rbr

const wchar_t * bw_rbr = L"\u256f"
extern

rounded bottom right

Definition at line 78 of file ui_common.c.

◆ bw_rtl

const wchar_t * bw_rtl = L"\u256d"
extern

MISCELANEOUS UNICODE CODEPOINTS rounded top left

Definition at line 75 of file ui_common.c.

◆ bw_rtr

const wchar_t * bw_rtr = L"\u256e"
extern

rounded top right

Definition at line 76 of file ui_common.c.

◆ bw_sp

const wchar_t * bw_sp = L"\x20"
extern

space

Definition at line 79 of file ui_common.c.

Referenced by ui_initialize_sio().

◆ bw_ua

const wchar_t * bw_ua = L"\u2191"
extern

large up arrow

Definition at line 82 of file ui_common.c.

◆ cell_bl

UiCell cell_bl
extern

Definition at line 125 of file ui_common.c.

Referenced by ui_border_draw(), and ui_initialize_sio().

◆ cell_box

UiCell cell_box
extern

Definition at line 110 of file ui_common.c.

Referenced by ui_border_title(), ui_initialize_sio(), and ui_surface_box().

◆ cell_br

UiCell cell_br
extern

Definition at line 126 of file ui_common.c.

Referenced by ui_border_draw(), and ui_initialize_sio().

◆ cell_brktl

UiCell cell_brktl
extern

Definition at line 104 of file ui_common.c.

Referenced by display_form(), and ui_initialize_sio().

◆ cell_brktr

UiCell cell_brktr
extern

Definition at line 105 of file ui_common.c.

Referenced by display_form(), and ui_initialize_sio().

◆ cell_bs

UiCell cell_bs
extern

Definition at line 120 of file ui_common.c.

◆ cell_bt

UiCell cell_bt
extern

Definition at line 130 of file ui_common.c.

Referenced by ui_initialize_sio().

◆ cell_chk

UiCell cell_chk
extern

◆ cell_cmdln

UiCell cell_cmdln
extern

Definition at line 112 of file ui_common.c.

Referenced by ui_initialize_sio().

◆ cell_cr

UiCell cell_cr
extern

Definition at line 131 of file ui_common.c.

Referenced by ui_initialize_sio().

◆ cell_default

UiCell cell_default
extern

Definition at line 102 of file ui_common.c.

Referenced by ui_initialize_sio().

◆ cell_fill_char

UiCell cell_fill_char
extern

Definition at line 103 of file ui_common.c.

Referenced by form_display_fields(), and ui_initialize_sio().

◆ cell_ho

◆ cell_ind

UiCell cell_ind
extern

Definition at line 111 of file ui_common.c.

Referenced by ui_initialize_sio().

◆ cell_ln

UiCell cell_ln
extern

Definition at line 114 of file ui_common.c.

Referenced by init_view_boxwin(), init_view_full_screen(), and ui_initialize_sio().

◆ cell_ls

UiCell cell_ls
extern

Definition at line 117 of file ui_common.c.

◆ cell_lt

UiCell cell_lt
extern

◆ cell_nt

◆ cell_nt_hl

UiCell cell_nt_hl
extern

◆ cell_nt_hl_rev

UiCell cell_nt_hl_rev
extern

Definition at line 109 of file ui_common.c.

Referenced by field_editor(), form_engine(), menu_cmd_processor(), picker(), and ui_initialize_sio().

◆ cell_nt_rev

◆ cell_ran

UiCell cell_ran
extern

Definition at line 115 of file ui_common.c.

Referenced by get_cmd_arg(), get_cmd_char(), picker(), and ui_initialize_sio().

◆ cell_rs

UiCell cell_rs
extern

Definition at line 118 of file ui_common.c.

◆ cell_rt

UiCell cell_rt
extern

◆ cell_sp

◆ cell_title

UiCell cell_title
extern

Definition at line 113 of file ui_common.c.

Referenced by ui_border_title(), and ui_initialize_sio().

◆ cell_tl

UiCell cell_tl
extern

Definition at line 121 of file ui_common.c.

Referenced by ui_border_draw(), ui_border_title(), and ui_initialize_sio().

◆ cell_tr

UiCell cell_tr
extern

Definition at line 122 of file ui_common.c.

Referenced by ui_border_draw(), and ui_initialize_sio().

◆ cell_ts

UiCell cell_ts
extern

Definition at line 119 of file ui_common.c.

◆ cell_tt

UiCell cell_tt
extern

Definition at line 129 of file ui_common.c.

Referenced by ui_initialize_sio().

◆ cell_ve

UiCell cell_ve
extern

Definition at line 124 of file ui_common.c.

Referenced by ui_border_draw(), and ui_initialize_sio().

◆ click_x

int click_x
extern

the x coordinate of a mouse click

Definition at line 30 of file ui_common.c.

Referenced by cf_accept(), field_editor(), form_post(), and form_process().

◆ click_y

int click_y
extern

the y coordinate of a mouse click

Definition at line 29 of file ui_common.c.

Referenced by cf_accept(), field_editor(), form_post(), and form_process().

◆ clr_cnt

uint clr_cnt
extern

number of colors used

◆ clr_idx

uint clr_idx
extern

current color index

◆ clr_pair_cnt

uint clr_pair_cnt
extern

number of color pairs supported by the terminal

◆ clr_pair_idx

uint clr_pair_idx
extern

current color pair index

◆ colors_text

char const colors_text
extern
Initial value:
= {
_("black"), _("red"), _("green"), _("yellow"), _("blue"), _("magenta"), _("cyan"),
_("white"), _("orange"), _("bg"), _("abg"), _("bblack"), _("bred"), _("bgreen"),
_("byellow"), _("bblue"), _("bcyan"), _("bmagenta"), _("bwhite"), _("borange"), ""}

Color names for .minitrc overrides.

color codes for the 16 basic colors

colors_text

These names are used in .minitrc to specify color overrides The order of these names corresponds to the ColorsEnum values

Definition at line 93 of file ui_common.c.

93 {
94 _("black"), _("red"), _("green"), _("yellow"), _("blue"), _("magenta"), _("cyan"),
95 _("white"), _("orange"), _("bg"), _("abg"), _("bblack"), _("bred"), _("bgreen"),
96 _("byellow"), _("bblue"), _("bcyan"), _("bmagenta"), _("bwhite"), _("borange"), ""};

◆ COLS

uint COLS

Definition at line 426 of file ui_backend.h.

◆ cp_blue

ushort cp_blue
extern

blue background color pair index

blue background - for testing

Definition at line 153 of file ui_common.c.

Referenced by ui_initialize_sio().

◆ cp_bold

ushort cp_bold
extern

bold color pair index

◆ cp_box

ushort cp_box
extern

box color pair index

border

Definition at line 138 of file ui_common.c.

Referenced by ui_initialize_sio().

◆ cp_brackets

ushort cp_brackets
extern

color pair index for field brackets

field enclosure brackets

Definition at line 149 of file ui_common.c.

Referenced by ui_initialize_sio().

◆ cp_cmdln_bg

ushort cp_cmdln_bg
extern

command line number background color pair index

◆ cp_cmdln_fg

ushort cp_cmdln_fg
extern

command line number color pair index

◆ cp_default

ushort cp_default
extern

default color pair index

default color pair

Definition at line 147 of file ui_common.c.

Referenced by ui_initialize_sio().

◆ cp_fill_char

ushort cp_fill_char
extern

fill character color pair index

field fill characters

Definition at line 148 of file ui_common.c.

Referenced by ui_initialize_sio().

◆ cp_green

ushort cp_green
extern

green background color pair index

green background - for testing

Definition at line 151 of file ui_common.c.

Referenced by ui_initialize_sio().

◆ cp_highlight

ushort cp_highlight
extern

highlight color pair index

◆ cp_ind

ushort cp_ind
extern

indicator color pair index

indicator character

Definition at line 139 of file ui_common.c.

Referenced by ui_initialize_sio().

◆ cp_ln_bg

ushort cp_ln_bg
extern

line number background color pair index

◆ cp_ln_fg

ushort cp_ln_fg
extern

line number color pair index

◆ cp_nt

ushort cp_nt
extern

normal color pair index

normal text

Definition at line 142 of file ui_common.c.

Referenced by fmt_line(), and ui_initialize_sio().

◆ cp_nt_hl

ushort cp_nt_hl
extern

highlight color pair index

normal text highlight

Definition at line 144 of file ui_common.c.

Referenced by ui_initialize_sio().

◆ cp_nt_hl_rev

ushort cp_nt_hl_rev
extern

highlight reverse color pair index

normal text highlight reverse

Definition at line 145 of file ui_common.c.

Referenced by ui_initialize_sio().

◆ cp_nt_rev

ushort cp_nt_rev
extern

reverse color pair index

normal text reverse

Definition at line 143 of file ui_common.c.

Referenced by search(), and ui_initialize_sio().

◆ cp_red

ushort cp_red
extern

red background color pair index

red background - for testing

Definition at line 150 of file ui_common.c.

Referenced by ui_initialize_sio().

◆ cp_title

ushort cp_title
extern

title color pair index

border title

Definition at line 141 of file ui_common.c.

Referenced by ui_initialize_sio().

◆ cp_yellow

ushort cp_yellow
extern

yellow background color pair index

yellow background - for testing

Definition at line 152 of file ui_common.c.

Referenced by ui_initialize_sio().

◆ em0

◆ em1

◆ em2

◆ em3

char em3
extern

error message string for error messages

Definition at line 49 of file ui_common.c.

Referenced by ui_open_log(), ui_timeout_prompt(), ui_update_timeout_prompt(), verify_dir(), and verify_file().

◆ f_ncurses_open

◆ f_notcurses_open

◆ LINES

uint LINES
extern

Definition at line 30 of file ui_notcurses.c.

◆ sfc_ptr

◆ stdplane

NcPlane * stdplane
extern

Definition at line 37 of file ui_notcurses.c.

Referenced by ui_init(), ui_surface_box(), and ui_surface_new().

◆ stdsfc

UiSurface * stdsfc
extern

◆ ui_ctx

ui_context_t ui_ctx
extern

◆ win_ptr

int win_ptr
extern