|
C-Menu 0.2.9
A User Interface Toolkit
|
NCurses UI backend — lifecycle, surface management, and capabilities. More...
#include "cm.h"#include "ui_ncurses_internal.h"#include <locale.h>#include <stdint.h>#include <stdlib.h>#include <string.h>#include <unistd.h>Go to the source code of this file.
Macros | |
| #define | _XOPEN_SOURCE_EXTENDED 1 |
Functions | |
| void | fast_exit (UiSurface *s) |
| Exit the UI application quickly, cleaning up resources. | |
| uint | ui__mbstr_to_cellstr (UiCell *cmplx_buf, const char *str, const UiCell *cell_base, uint *p, const uint atmost) |
| uint | ui_add_pair (uint fg, uint bg) |
| Add a new color pair to the UI, or retrieve the index of an existing pair. | |
| 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. | |
| 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. | |
| int | ui_chg_color (uint16_t color_idx, uint32_t *color) |
| Change the RGB color value for a given color index. | |
| int | ui_chg_pair (uint pair, uint fg, uint bg) |
| Change the foreground and background colors of an existing color pair. | |
| int | ui_clear () |
| Clear the entire screen. | |
| int | ui_color_content (uint color, uint *r, uint *g, uint *b) |
| int | ui_color_from_rgb (RGB *rgb) |
| Convert RGB to curses color index, adding new color if necessary. | |
| 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. | |
| void | ui_def_prog_mode () |
| void | ui_destroy_curses () |
| int | ui_doupdate () |
| Refresh the display by updating the screen. | |
| 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. | |
| uint32_t | ui_get_color (uint16_t color_idx) |
| Get the RGB color value for a given color index. | |
| void | ui_get_screen_size (uint *lines, uint *cols) |
| Get the current screen size (number of lines and columns). | |
| int | ui_getcchar (const UiCell *cell, wchar_t *wstr, attr_t *attrs, short *pair, const void *opts) |
| Get the character and attributes from a UiCell. | |
| 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. | |
| RGB | ui_hex_to_rgb (char *s) |
| Convert a hexadecimal color string to an RGB structure. | |
| 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. | |
| struct UiRuntime * | ui_init (const UiConfig *cfg, SIO *sio) |
| Initialize the UI runtime with the given configuration and SIO. | |
| int | ui_init_color (uint color, uint r, uint g, uint b) |
| Initialize a color in the curses color table with specified RGB values. | |
| int | ui_init_pair (uint pair, uint fg, uint bg) |
| Initialize a color pair in the curses color table with specified foreground and background colors. | |
| int | ui_keypad (UiSurface *s, ss_t w, bool enable) |
| Enable or disable the keypad for a UiSurface. | |
| SCREEN * | ui_ncurses_get_screen () |
| Get the current SCREEN pointer used by the UI. | |
| PANEL * | ui_ncurses_surface_get_panel (const UiSurface *s, ss_t w) |
| Get the current PANEL pointer for a specific window within a UiSurface. | |
| WINDOW * | ui_ncurses_surface_get_win (const UiSurface *s, ss_t w) |
| Get the current FILE pointer for the TTY used by the UI. | |
| int | ui_pair_content (uint pair, uint *fg, uint *bg) |
| Get the foreground and background colors of a specified color pair. | |
| int | ui_pair_from_hex (const char *fg, const char *bg) |
| Convert hex color strings to a curses color pair index. | |
| void | ui_render () |
| Render the UI by updating panels and refreshing the display. | |
| 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_setcchar (UiCell *cell, const wchar_t *wstr, const attr_t attrs, short pair, const void *opts) |
| Set the character and attributes of a UiCell. | |
| 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. | |
| 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 *wtitle) |
| 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. | |
| 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_werase (UiSurface *s, ss_t w) |
| Erase the contents of a UiSurface or all surfaces. | |
| 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_wscrl (UiSurface *s, ss_t w, int n) |
| Scroll the contents of a UiSurface by a specified number of lines. | |
Variables | |
| int | sfc_ptr = -1 |
| UiSurface * | stdsfc |
| UiRuntime * | ui = NULL |
| uint | ui_color_cnt = 0 |
| uint | ui_pair_cnt = 0 |
| UiSurface * | ui_surface [UI_SFC_MAX] |
NCurses UI backend — lifecycle, surface management, and capabilities.
Implements all UiRuntime and UiSurface operations declared in ui_backend.h using the NCurses / panelw library.
When compiled as part of the main C-Menu build (UAL_LEGACY_COMPAT defined), the legacy globals screen and tty_fp from dwin.c are kept in sync so that code not yet migrated to the UAL API continues to work.
Definition in file ui_ncurses.c.
| #define _XOPEN_SOURCE_EXTENDED 1 |
Definition at line 13 of file ui_ncurses.c.
| void fast_exit | ( | UiSurface * | s | ) |
Exit the UI application quickly, cleaning up resources.
| s | Pointer to the UiSurface to be cleaned up before exiting. |
Definition at line 339 of file ui_ncurses.c.
References SUB_SFC_MAX.
| uint ui__mbstr_to_cellstr | ( | UiCell * | cmplx_buf, |
| const char * | str, | ||
| const UiCell * | cell_base, | ||
| uint * | p, | ||
| const uint | atmost ) |
Definition at line 1223 of file ui_ncurses.c.
| uint ui_add_pair | ( | uint | fg, |
| uint | bg ) |
Add a new color pair to the UI, or retrieve the index of an existing pair.
Add a new color pair to the UI color pair palette.
| fg | The foreground color index for the new color pair. |
| bg | The background color index for the new color pair. |
| fg | The foreground color index for the new color pair. |
| bg | The background color index for the new color pair. |
This function adds a new color pair to the UI color pair palette. It checks if the specified foreground and background colors already exist in the palette. If they do, it returns the existing index. If not, it adds the new color pair and returns its index. If the maximum number of pairs is exceeded, it displays an error message and returns EXIT_FAILURE.
Definition at line 1014 of file ui_ncurses.c.
References em0, em1, em2, ssnprintf(), ui_display_error(), ui_pair_cnt, and ui_pair_content().
Referenced by parse_ansi_str(), ui_cell_from_ucp(), ui_get_nccell(), ui_initialize_sio(), ui_pair_from_hex(), and ui_parse_ansi().
Set the background of a specific window within a UiSurface.
| s | Pointer to the UiSurface containing the window. |
| w | The index of the window within the surface for which to set the background. |
| cell | Pointer to a UiCell structure representing the desired background attributes. |
Definition at line 927 of file ui_ncurses.c.
Set the background for new content to be written to a specific window within a UiSurface.
| s | Pointer to the UiSurface containing the window. |
| w | The index of the window within the surface for which to set the background for new content. |
| cell | Pointer to a UiCell structure representing the desired background attributes for new content. |
Definition at line 941 of file ui_ncurses.c.
Set the background of a specific window within a UiSurface.
| s | Pointer to the UiSurface containing the window. |
| w | The index of the window within the surface for which to set the background. |
| cell | Pointer to a UiCell structure representing the desired background attributes. |
Definition at line 955 of file ui_ncurses.c.
Set the background for new content to be written to a specific window within a UiSurface.
| s | Pointer to the UiSurface containing the window. |
| w | The index of the window within the surface for which to set the background for new content. |
| cell | Pointer to a UiCell structure representing the desired background attributes for new content. |
Definition at line 969 of file ui_ncurses.c.
| 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.
Create a UiCell from a Unicode codepoint and specified foreground and background colors.
| ucp | Pointer to a wide character string containing the Unicode code point. |
| fg | Pointer to a 32-bit integer representing the foreground color in hex format (e.g., 0xRRGGBB). |
| bg | Pointer to a 32-bit integer representing the background color in hex format (e.g., 0xRRGGBB). |
| ucp | Pointer to a wide character string representing the Unicode codepoint. |
| fg | Pointer to a 32-bit unsigned integer representing the foreground color. |
| bg | Pointer to a 32-bit unsigned integer representing the background color. |
This function creates a UiCell from a Unicode codepoint and specified foreground and background colors. It initializes the cell, sets its width based on the Unicode codepoint, converts the codepoint to UTF-8, and sets the styles and channels for the cell. The resulting UiCell can be used for rendering text in a UI surface.
Definition at line 101 of file ui_ncurses.c.
References ui_add_pair(), and ui_color_from_rgb().
Referenced by ui_initialize_sio().
| int ui_chg_color | ( | uint16_t | color_idx, |
| uint32_t * | color ) |
Change the RGB color value for a given color index.
Change the color at a specified index in the UI color palette.
| color_idx | The index of the color in the curses color table to be changed. |
| color | Pointer to a 32-bit unsigned integer representing the new RGB color value (0xRRGGBB). |
| color_idx | The index of the color to change in the UI color palette. |
| color | Pointer to a 32-bit unsigned integer representing the new color value. |
This function changes the color at a specified index in the UI color palette. It applies gamma correction to the new color value and updates both the standard and UI color arrays with the new RGB components. If the color index is out of bounds, it returns -1.
Definition at line 1169 of file ui_ncurses.c.
References std_color, and ui_apply_gamma().
Referenced by ui_init_clr_palette().
| int ui_chg_pair | ( | uint | pair, |
| uint | fg, | ||
| uint | bg ) |
Change the foreground and background colors of an existing color pair.
| pair | The index of the color pair to be modified. |
| fg | The new foreground color index for the color pair. |
| bg | The new background color index for the color pair. |
Definition at line 1048 of file ui_ncurses.c.
| int ui_clear | ( | ) |
Clear the entire screen.
Definition at line 599 of file ui_ncurses.c.
| int ui_color_content | ( | uint | color, |
| uint * | r, | ||
| uint * | g, | ||
| uint * | b ) |
Definition at line 1116 of file ui_ncurses.c.
Referenced by ui_color_from_rgb(), ui_get_channels_from_pair(), and ui_set_nccell().
| uint ui_color_from_rgb | ( | RGB * | rgb | ) |
Convert RGB to curses color index, adding new color if necessary.
Convert an RGB color to a color index in the UI color palette.
was rgb_to_curses_clr
| rgb | Pointer to RGB struct with r, g, b values (0-255). |
| rgb | Pointer to an RGB structure representing the color to convert. |
This function converts an RGB color to a color index in the UI color palette. It applies gamma correction to the RGB values and checks if the color already exists in the palette. If it does, it returns the existing index. If not, it adds the new color to the palette and returns its index. If the palette is full, it returns -1.
Definition at line 1060 of file ui_ncurses.c.
References em0, em1, ssnprintf(), std_color, ui_apply_gamma(), and ui_color_cnt.
Referenced by parse_ansi_str(), ui_cell_from_ucp(), ui_get_nccell(), ui_pair_from_hex(), and ui_parse_ansi().
| int ui_curs_set | ( | int | visibility | ) |
Set the visibility of the cursor.
| visibility | An integer value indicating the desired cursor visibility: 0 - Invisible 1 - Visible 2 - Very visible (e.g., block cursor) |
Definition at line 840 of file ui_ncurses.c.
Enable or disable the cursor for a UiSurface.
| s | Pointer to the UiSurface where the cursor will be enabled or disabled. |
| w | The index of the window within the surface where the cursor will be enabled or disabled. |
| visible | A boolean value indicating whether to make the cursor visible (true) or invisible (false). |
Definition at line 870 of file ui_ncurses.c.
Enable or disable the cursor at a specific position within a UiSurface.
| s | Pointer to the UiSurface where the cursor will be enabled or disabled. |
| w | The index of the window within the surface where the cursor will be enabled or disabled. |
| y | The y-coordinate (row) for the cursor's position. |
| x | The x-coordinate (column) for the cursor's position. |
| visible | A boolean value indicating whether to make the cursor visible (true) or invisible (false). |
Definition at line 855 of file ui_ncurses.c.
Move the cursor to a specified position within a UiSurface.
| s | Pointer to the UiSurface where the cursor will be moved. |
| w | The index of the window within the surface where the cursor will be moved. |
| y | The new y-coordinate (row) for the cursor's position. |
| x | The new x-coordinate (column) for the cursor's position. |
Definition at line 666 of file ui_ncurses.c.
| void ui_def_prog_mode | ( | ) |
Definition at line 826 of file ui_ncurses.c.
Referenced by fork_exec().
| void ui_destroy_curses | ( | ) |
Definition at line 1264 of file ui_ncurses.c.
References f_ncurses_open, f_notcurses_open, restore_shell_tioctl(), sig_dfl_mode(), and ui_shutdown().
| int ui_doupdate | ( | ) |
Refresh the display by updating the screen.
Definition at line 895 of file ui_ncurses.c.
| void ui_endwin | ( | ) |
End the UI application, cleaning up resources and shutting down the UI runtime.
Destroy a UI surface and free its resources.
| s | Pointer 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.
| int ui_erase | ( | ) |
Erase the entire screen.
Definition at line 591 of file ui_ncurses.c.
| void ui_get_caps | ( | UiCaps * | caps | ) |
Get the UI backend capabilities.
| caps | Pointer to a UiCaps struct to be filled with the backend capabilities. |
Definition at line 62 of file ui_ncurses.c.
| uint32_t ui_get_color | ( | uint16_t | color_idx | ) |
Get the RGB color value for a given color index.
| color_idx | The index of the color in the curses color table. |
Definition at line 1101 of file ui_ncurses.c.
| void ui_get_screen_size | ( | uint * | lines, |
| uint * | cols ) |
Get the current screen size (number of lines and columns).
| lines | Pointer to a uint variable where the number of lines (rows) will be stored. |
| cols | Pointer to a uint variable where the number of columns will be stored. |
Definition at line 722 of file ui_ncurses.c.
| int ui_getcchar | ( | const UiCell * | cell, |
| wchar_t * | wstr, | ||
| attr_t * | attrs, | ||
| short * | pair, | ||
| const void * | opts ) |
Get the character and attributes from a UiCell.
| cell | Pointer to the UiCell from which to retrieve the character and attributes. |
| wstr | Pointer to a wchar_t array where the retrieved character will be stored. |
| attrs | Pointer to an attr_t variable where the retrieved attributes will be stored. |
| pair | Pointer to a short variable where the retrieved color pair will be stored. |
| opts | Pointer to additional options (not used in this implementation). |
Definition at line 987 of file ui_ncurses.c.
Get the maximum number of columns of a UiSurface.
| s | Pointer to the UiSurface for which to retrieve the maximum number of columns. |
| w | The index of the window within the surface for which to retrieve the maximum number of columns. |
Definition at line 712 of file ui_ncurses.c.
Get the maximum number of lines (rows) of a UiSurface.
| s | Pointer to the UiSurface for which to retrieve the maximum number of lines. |
| w | The index of the window within the surface for which to retrieve the maximum number of lines. |
Definition at line 701 of file ui_ncurses.c.
Get the maximum dimensions of a UiSurface.
| s | Pointer to the UiSurface for which to retrieve the maximum dimensions. |
| w | The index of the window within the surface for which to retrieve the maximum dimensions. |
| lines | Pointer to a uint variable where the maximum number of lines (rows) will be stored. |
| cols | Pointer to a uint variable where the maximum number of columns will be stored. |
Definition at line 690 of file ui_ncurses.c.
Get the current cursor position within a window of a UI surface.
| s | Pointer to the UiSurface containing the window. |
| w | The index of the window within the surface. |
| y | Pointer to an unsigned integer to store the y-coordinate of the cursor. |
| x | Pointer 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.
| RGB ui_hex_to_rgb | ( | char * | s | ) |
Convert a hexadecimal color string to an RGB structure.
| s | A string representing the color in hexadecimal format (e.g., "#RRGGBB"). |
This function converts a hexadecimal color string to an RGB structure. It uses sscanf to parse the hex string and extract the red, green, and blue components. The resulting RGB structure is returned.
Definition at line 1111 of file ui_ncurses.c.
Referenced by ui_init_color_hex().
Enable or disable the use of the insert/delete character capabilities for a UiSurface.
| s | Pointer to the UiSurface for which to enable or disable the insert/delete character capabilities. |
| w | The index of the window within the surface for which to enable or disable the insert/delete character capabilities. |
| enable | A boolean value indicating whether to enable (true) or disable (false) the insert/delete character capabilities. |
Definition at line 803 of file ui_ncurses.c.
Enable or disable the use of the insert/delete line capabilities for a UiSurface.
| s | Pointer to the UiSurface for which to enable or disable the insert/delete line capabilities. |
| w | The index of the window within the surface for which to enable or disable the insert/delete line capabilities. |
| enable | A boolean value indicating whether to enable (true) or disable (false) the insert/delete line capabilities. |
Definition at line 787 of file ui_ncurses.c.
Initialize the UI runtime with the given configuration and SIO.
| cfg | Pointer to a UiConfig structure containing the configuration settings. |
| sio | Pointer to an SIO structure for input/output operations. |
Definition at line 129 of file ui_ncurses.c.
| int ui_init_color | ( | uint | color, |
| uint | r, | ||
| uint | g, | ||
| uint | b ) |
Initialize a color in the curses color table with specified RGB values.
| color | The index of the color to be initialized. |
| r | The red component of the color (0-255). |
| g | The green component of the color (0-255). |
| b | The blue component of the color (0-255). |
Definition at line 1133 of file ui_ncurses.c.
Referenced by ui_color_from_rgb().
| int ui_init_pair | ( | uint | pair, |
| uint | fg, | ||
| uint | bg ) |
Initialize a color pair in the curses color table with specified foreground and background colors.
| pair | The index of the color pair to be initialized. |
| fg | The foreground color index for the color pair. |
| bg | The background color index for the color pair. |
Definition at line 1159 of file ui_ncurses.c.
Enable or disable the keypad for a UiSurface.
| s | Pointer to the UiSurface for which to enable or disable the keypad. |
| w | The index of the window within the surface for which to enable or disable the keypad. |
| enable | A boolean value indicating whether to enable (true) or disable (false) the keypad. |
Definition at line 771 of file ui_ncurses.c.
| SCREEN * ui_ncurses_get_screen | ( | ) |
Get the current SCREEN pointer used by the UI.
Definition at line 1195 of file ui_ncurses.c.
References ui.
Get the current PANEL pointer for a specific window within a UiSurface.
Return the raw NCurses PANEL* underlying a surface.
| s | Pointer to the UiSurface containing the window. |
| w | The index of the window within the surface for which to retrieve the PANEL pointer. |
Definition at line 1215 of file ui_ncurses.c.
Get the current FILE pointer for the TTY used by the UI.
Return the raw NCurses WINDOW* underlying a surface.
Definition at line 1204 of file ui_ncurses.c.
| int ui_pair_content | ( | uint | pair, |
| uint * | fg, | ||
| uint * | bg ) |
Get the foreground and background colors of a specified color pair.
| pair | The index of the color pair to be queried. |
| fg | Pointer to a uint variable where the foreground color index will be stored. |
| bg | Pointer to a uint variable where the background color index will be stored. |
Definition at line 1144 of file ui_ncurses.c.
Referenced by parse_ansi_str(), ui_add_pair(), and ui_parse_ansi().
| int ui_pair_from_hex | ( | const char * | fg, |
| const char * | bg ) |
Convert hex color strings to a curses color pair index.
| fg | Foreground color in hex format (e.g., "#RRGGBB"). |
| bg | Background color in hex format (e.g., "#RRGGBB"). |
Definition at line 86 of file ui_ncurses.c.
References ui_add_pair(), and ui_color_from_rgb().
| void ui_render | ( | ) |
Render the UI by updating panels and refreshing the display.
Render the UI.
This function renders the UI.
Definition at line 884 of file ui_ncurses.c.
| int ui_resume | ( | ) |
Resume the UI, restoring the previous program state and updating the display.
Definition at line 503 of file ui_ncurses.c.
Enable or disable scrolling for a UiSurface.
| s | Pointer to the UiSurface for which to enable or disable scrolling. |
| w | The index of the window within the surface for which to enable or disable scrolling. |
| enable | A boolean value indicating whether to enable (true) or disable (false) scrolling. |
Definition at line 755 of file ui_ncurses.c.
| int ui_setcchar | ( | UiCell * | cell, |
| const wchar_t * | wstr, | ||
| const attr_t | attrs, | ||
| short | pair, | ||
| const void * | opts ) |
Set the character and attributes of a UiCell.
| cell | Pointer to the UiCell to be modified. |
| wstr | Pointer to a wchar_t array containing the character to be set. |
| attrs | The attributes to be applied to the cell. |
| pair | The color pair to be applied to the cell. |
| opts | Pointer to additional options (not used in this implementation). |
Definition at line 1001 of file ui_ncurses.c.
Set the scrolling region for a UiSurface.
| s | Pointer to the UiSurface for which to set the scrolling region. |
| w | The index of the window within the surface for which to set the scrolling region. |
| top | The top line of the scrolling region (0-based). |
| bottom | The bottom line of the scrolling region (0-based). |
Definition at line 820 of file ui_ncurses.c.
| 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.
Definition at line 418 of file ui_ncurses.c.
| 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.
| s | Pointer to the UiSurface to which the pad will be added. |
| w | The index of the window within the surface where the pad will be created. |
| view_win | The index of the window that will be used to view the pad. |
| lines | The number of lines (rows) for the new pad. |
| cols | The number of columns for the new pad. |
| begy | The y-coordinate (row) for the new pad's position (ignored in this implementation). |
| begx | The x-coordinate (column) for the new pad's position (ignored in this implementation). |
Definition at line 369 of file ui_ncurses.c.
Add a new window to the specified UiSurface.
| s | Pointer to the UiSurface to which the window will be added. |
| w | The index of the window within the surface where the new window will be created. |
| p | The index of the parent window from which the new window will be derived. |
| lines | The number of lines (rows) for the new window. |
| cols | The number of columns for the new window. |
| y | The y-coordinate (row) for the new window's position relative to the parent window. |
| x | The x-coordinate (column) for the new window's position relative to the parent window. |
Definition at line 395 of file ui_ncurses.c.
| 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.
| parent | Pointer to the parent UiSurface, or NULL for a top-level surface. |
| p | The index of the parent window to derive from, if applicable. |
| lines | The number of lines (rows) for the new surface. |
| cols | The number of columns for the new surface. |
| y | The y-coordinate (row) for the new surface's position. |
| x | The x-coordinate (column) for the new surface's position. |
| wtitle | The title string to display in the border box, or NULL for no title. |
Definition at line 288 of file ui_ncurses.c.
| void ui_surface_destroy | ( | UiSurface * | s | ) |
Destroy a UiSurface, cleaning up its windows and panels.
| s | Pointer to the UiSurface to be destroyed. |
Definition at line 468 of file ui_ncurses.c.
Hide a UiSurface, making it invisible on the screen.
| s | Pointer to the UiSurface to be hidden. |
| w | The index of the window within the surface to be hidden. |
Definition at line 635 of file ui_ncurses.c.
Move a UiSurface to a new position on the screen.
| s | Pointer to the UiSurface to be moved. |
| w | The index of the window within the surface to be moved. |
| y | The new y-coordinate (row) for the surface's position. |
| x | The new x-coordinate (column) for the surface's position. |
Definition at line 521 of file ui_ncurses.c.
| 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.
| w | The index of the window within the surface. |
| parent | Pointer to the parent UiSurface, or NULL for a top-level surface. |
| p | The index of the parent window to derive from, if applicable. |
| lines | The number of lines (rows) for the new surface. |
| cols | The number of columns for the new surface. |
| y | The y-coordinate (row) for the new surface's position. |
| x | The x-coordinate (column) for the new surface's position. |
Definition at line 229 of file ui_ncurses.c.
Resize a UiSurface to new dimensions.
| s | Pointer to the UiSurface to be resized. |
| w | The index of the window within the surface to be resized. |
| lines | The new number of lines (rows) for the surface. |
| cols | The new number of columns for the surface. |
Definition at line 536 of file ui_ncurses.c.
Show a UiSurface, making it visible on the screen.
| s | Pointer to the UiSurface to be shown. |
| w | The index of the window within the surface to be shown. |
Definition at line 609 of file ui_ncurses.c.
| int ui_suspend | ( | ) |
Suspend the UI, saving the current program state and ending the window session.
Definition at line 494 of file ui_ncurses.c.
Hide a UiSurface, making it invisible on the screen.
| s | Pointer to the UiSurface to be hidden. |
| w | The index of the window within the surface to be hidden. |
Definition at line 623 of file ui_ncurses.c.
| 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.
Definition at line 890 of file ui_ncurses.c.
Clear the contents of a UiSurface or all surfaces.
| s | Pointer to the UiSurface to be cleared, or NULL to clear all surfaces. |
| w | The index of the window within the surface to be cleared, or ALLWINS to clear all windows. |
Definition at line 571 of file ui_ncurses.c.
Erase the contents of a UiSurface or all surfaces.
| s | Pointer to the UiSurface to be erased, or NULL to erase all surfaces. |
| w | The index of the window within the surface to be erased, or ALLWINS to erase all windows. |
Definition at line 551 of file ui_ncurses.c.
Move the cursor to a specified position within a UiSurface.
| s | Pointer to the UiSurface where the cursor will be moved. |
| w | The index of the window within the surface where the cursor will be moved. |
| y | The new y-coordinate (row) for the cursor's position. |
| x | The new x-coordinate (column) for the cursor's position. |
Definition at line 653 of file ui_ncurses.c.
Refresh a specific window within a UiSurface.
| s | Pointer to the UiSurface containing the window to be refreshed. |
| w | The index of the window within the surface to be refreshed. |
| s | Pointer to the UiSurface containing the window to be refreshed. |
| w | The index of the window within the surface to be refreshed. |
Definition at line 908 of file ui_ncurses.c.
Scroll the contents of a UiSurface by a specified number of lines.
| s | Pointer to the UiSurface to be scrolled. |
| w | The index of the window within the surface to be scrolled. |
| n | The number of lines to scroll. Positive values scroll down, negative values scroll up. |
Definition at line 738 of file ui_ncurses.c.
| int sfc_ptr = -1 |
Definition at line 42 of file ui_ncurses.c.
| UiSurface* stdsfc |
Definition at line 46 of file ui_ncurses.c.
| UiRuntime * ui = NULL |
Definition at line 39 of file ui_ncurses.c.
Referenced by ui_curs_set(), ui_cursor_enable(), ui_cursor_enable_yx(), ui_cursor_yx(), ui_flush_input(), ui_framed_surface_new(), ui_get_caps(), ui_get_event(), ui_get_event_no_mouse(), ui_get_screen_size(), ui_getch(), ui_init(), ui_init(), ui_initialize_sio(), ui_mice_enable(), ui_mousemask(), ui_ncurses_get_screen(), ui_notcurses_get_nc(), ui_render(), ui_resume(), ui_shutdown(), ui_surface_addpad(), ui_surface_addwin(), ui_surface_box(), ui_surface_box(), ui_surface_new(), ui_suspend(), and ui_update_panels().
| uint ui_color_cnt = 0 |
Definition at line 43 of file ui_ncurses.c.
Referenced by ui_color_from_rgb(), ui_init(), ui_init_clr_palette(), and ui_init_color_hex().
| uint ui_pair_cnt = 0 |
Definition at line 44 of file ui_ncurses.c.
Referenced by ui_add_pair(), and ui_init().
| UiSurface * ui_surface |
Definition at line 40 of file ui_ncurses.c.
Referenced by display_field(), display_form(), field_editor(), form_display_accept_field(), form_display_field(), form_display_fields(), form_engine(), form_post(), form_process(), init_form(), main(), menu_cmd_processor(), menu_engine(), open_pick_win(), popup_ckeys(), ui_action_disposition(), ui_answer_yn(), ui_display_error(), ui_perror(), ui_restore_wins(), ui_shutdown(), ui_timeout_prompt(), ui_tracked_sfc_box(), and ui_tracked_sfc_split_box().