|
C-Menu 0.2.9
A User Interface Toolkit
|
Implementation of drawing functions for the ncurses UI backend. More...
#include "ui_ncurses_internal.h"Go to the source code of this file.
Functions | |
| int | ui_draw_border (UiSurface *s, UiBorderKind kind, const UiStyle *style) |
| Draw a border around a UiSurface.This function draws a border around the UiSurface's window based on the specified UiBorderKind. It uses the ncurses box function to draw the border with the appropriate characters. If a style is provided, it applies that style before drawing the border. | |
| int | ui_draw_box_title (UiSurface *s, int x, const UiStyle *style, const char *title) |
| Draw a title on the top border of a UiSurface.This function draws the provided title string at the specified x-coordinate on the top border of the UiSurface's window. It uses the ncurses mvwaddstr function to place the title. If a style is provided, it applies that style before drawing the title. | |
| int | ui_draw_hline (UiSurface *s, int y, int x, int len, const UiStyle *style) |
| Draw a horizontal line on a UiSurface.This function uses the ncurses mvwhline function to draw a horizontal line of a specified length at the given (y, x) coordinates on the UiSurface's window. If a style is provided, it applies that style before drawing the line. | |
| int | ui_draw_text (UiSurface *s, int y, int x, const UiStyle *style, const char *text) |
| Draw text on a UiSurface at a specified position with a given style.This function uses the ncurses mvwaddstr function to draw the provided text at the specified (y, x) coordinates on the UiSurface's window. If a style is provided, it applies that style before drawing the text. | |
| int | ui_draw_text_n (UiSurface *s, int y, int x, const UiStyle *style, const char *text, size_t n) |
| Draw a specified number of characters from a string on a UiSurface.This function is similar to ui_draw_text but allows specifying the number of characters to draw from the provided string. It uses the ncurses mvwaddnstr function to achieve this. If a style is provided, it applies that style before drawing the text. | |
| int | ui_draw_vline (UiSurface *s, int y, int x, int len, const UiStyle *style) |
| Draw a vertical line on a UiSurface.This function uses the ncurses mvwvline function to draw a vertical line of a specified length at the given (y, x) coordinates on the UiSurface's window. If a style is provided, it applies that style before drawing the line. | |
| int | ui_ncurses_color_pair_from_style (const UiStyle *style) |
| Convert an RGB value (0-255) to a 1000-based value for ncurses.Ncurses uses a 1000-based color system, so we need to convert our 0-255 RGB values to that scale. | |
| int | ui_ncurses_style_apply (WINDOW *win, const UiStyle *style) |
| Apply a UiStyle to an ncurses window.This function sets the appropriate attributes (bold, underline, reverse) on the given ncurses window based on the properties of the UiStyle. | |
| int | ui_surface_set_base (UiSurface *s, const UiStyle *style, uint32_t fill_ch) |
| Set the base fill character and style for a UiSurface.This function sets the background fill character for the UiSurface's ncurses window and applies the given UiStyle. If fill_ch is 0, it defaults to a space character. | |
| int | ui_surface_set_style (UiSurface *s, const UiStyle *style) |
| Set the style for a UiSurface.This function applies the given UiStyle to the ncurses window associated with the UiSurface. It uses the ui_ncurses_style_apply function to set the appropriate attributes on the window. | |
Implementation of drawing functions for the ncurses UI backend.
This file contains the implementation of various drawing functions that utilize the ncurses library to render text, lines, borders, and other UI elements on the terminal. The functions take into account the styles defined in UiStyle and apply them accordingly when drawing.
Definition in file ui_ncurses_draw.c.