iPXE
|
Soft label key functions. More...
#include <curses.h>
#include <stddef.h>
#include <stdlib.h>
#include <string.h>
#include <assert.h>
#include "mucurses.h"
#include "cursor.h"
Go to the source code of this file.
Data Structures | |
struct | _softlabel |
struct | _softlabelkeys |
Macros | |
#define | MIN_SPACE_SIZE 2 |
#define | SLK_MAX_LABEL_LEN 8 |
#define | SLK_MAX_NUM_LABELS 12 |
#define | SLK_MAX_NUM_SPACES 2 |
Functions | |
FILE_LICENCE (GPL2_OR_LATER_OR_UBDL) | |
static void | _enter_slk (void) |
static void | _leave_slk (void) |
static void | _print_label (struct _softlabel sl) |
attr_t | slk_attr (void) |
Return the attribute used for the soft function keys. More... | |
int | slk_attroff (const chtype attrs) |
Turn off soft function key attributes. More... | |
int | slk_attron (const chtype attrs) |
Turn on soft function key attributes. More... | |
int | slk_attrset (const chtype attrs) |
Set soft function key attributes. More... | |
int | slk_attr_off (const attr_t attrs, void *opts __unused) |
Turn off soft function key attributes. More... | |
int | slk_attr_on (attr_t attrs, void *opts __unused) |
Turn on soft function key attributes. More... | |
int | slk_attr_set (const attr_t attrs, short colour_pair_number, void *opts __unused) |
Set soft function key attributes. More... | |
int | slk_clear (void) |
Clear the soft function key labels from the screen. More... | |
int | slk_colour (short colour_pair_number) |
Set soft label colour pair. More... | |
int | slk_init (int fmt) |
Initialise the soft function keys. More... | |
char * | slk_label (int labnum) |
Return the label for the specified soft key. More... | |
int | slk_restore (void) |
Restore soft function key labels to the screen. More... | |
int | slk_set (int labnum, const char *label, int fmt) |
Configure specified soft key. More... | |
Variables | |
static struct _softlabelkeys * | slks |
Soft label key functions.
Definition in file slk.c.
FILE_LICENCE | ( | GPL2_OR_LATER_OR_UBDL | ) |
|
static |
Definition at line 64 of file slk.c.
References _store_curs_pos(), _softlabelkeys::attrs, LINES, NULL, _softlabelkeys::saved_attrs, _softlabelkeys::saved_cursor, _softlabelkeys::saved_pair, slks, stdscr, wattr_get(), wattrset(), and wmove().
Referenced by slk_clear(), and slk_restore().
|
static |
Definition at line 72 of file slk.c.
References _restore_curs_pos(), LINES, NULL, _softlabelkeys::saved_attrs, _softlabelkeys::saved_cursor, _softlabelkeys::saved_pair, slks, stdscr, and wattr_set().
Referenced by slk_clear(), and slk_restore().
|
static |
Definition at line 78 of file slk.c.
References _wputstr(), assert(), _softlabelkeys::max_label_len, memset(), NOWRAP, sl, SLK_MAX_LABEL_LEN, slks, stdscr, strcat(), and strlen().
Referenced by slk_restore().
attr_t slk_attr | ( | void | ) |
Return the attribute used for the soft function keys.
attrs | the current attributes of the soft function keys |
Definition at line 118 of file slk.c.
References _softlabelkeys::attrs, NULL, and slks.
int slk_attroff | ( | const chtype | attrs | ) |
Turn off soft function key attributes.
attrs | attribute bit mask |
rc | return status code |
Definition at line 128 of file slk.c.
References A_ATTRIBUTES, attrs, _softlabelkeys::attrs, ERR, NULL, OK, and slks.
Referenced by slk_attr_off().
int slk_attron | ( | const chtype | attrs | ) |
Turn on soft function key attributes.
attrs | attribute bit mask |
rc | return status code |
Definition at line 141 of file slk.c.
References A_ATTRIBUTES, attrs, _softlabelkeys::attrs, ERR, NULL, OK, and slks.
Referenced by slk_attr_on().
int slk_attrset | ( | const chtype | attrs | ) |
Set soft function key attributes.
attrs | attribute bit mask |
rc | return status code |
Definition at line 154 of file slk.c.
References A_ATTRIBUTES, attrs, _softlabelkeys::attrs, ERR, NULL, OK, and slks.
Turn off soft function key attributes.
attrs | attribute bit mask |
*opts | undefined (for future implementation) |
rc | return status code |
Definition at line 168 of file slk.c.
References attrs, and slk_attroff().
Turn on soft function key attributes.
attrs | attribute bit mask |
*opts | undefined (for future implementation) |
rc | return status code |
Definition at line 179 of file slk.c.
References attrs, and slk_attron().
Set soft function key attributes.
attrs | attribute bit mask |
colour_pair_number | colour pair integer |
*opts | undefined (for future implementation) |
rc | return status code |
Definition at line 191 of file slk.c.
References A_ATTRIBUTES, attrs, _softlabelkeys::attrs, COLORS, CPAIR_SHIFT, ERR, NULL, OK, and slks.
int slk_clear | ( | void | ) |
Clear the soft function key labels from the screen.
rc | return status code |
Definition at line 209 of file slk.c.
References _enter_slk(), _leave_slk(), ERR, NULL, OK, slks, stdscr, and wclrtoeol().
Referenced by slk_refresh().
int slk_colour | ( | short | colour_pair_number | ) |
Set soft label colour pair.
Definition at line 223 of file slk.c.
References A_ATTRIBUTES, _softlabelkeys::attrs, COLORS, CPAIR_SHIFT, ERR, NULL, OK, and slks.
int slk_init | ( | int | fmt | ) |
Initialise the soft function keys.
fmt | format of keys |
rc | return status code |
Definition at line 241 of file slk.c.
References A_DEFAULT, _softlabelkeys::attrs, calloc(), COLS, ERR, _softlabelkeys::fmt, fmt, LINES, _softlabelkeys::maj_space_len, _softlabelkeys::max_label_len, MIN_SPACE_SIZE, _softlabelkeys::num_labels, _softlabelkeys::num_spaces, OK, slks, and _softlabelkeys::spaces.
char* slk_label | ( | int | labnum | ) |
Return the label for the specified soft key.
labnum | soft key identifier |
label | return label |
Definition at line 295 of file slk.c.
References _softlabelkeys::fkeys, _softlabel::label, NULL, and slks.
int slk_restore | ( | void | ) |
Restore soft function key labels to the screen.
rc | return status code |
Definition at line 307 of file slk.c.
References _enter_slk(), _leave_slk(), _print_label(), _wputch(), _softlabelkeys::attrs, COLS, ERR, _softlabelkeys::fkeys, _softlabelkeys::maj_space_len, _softlabelkeys::max_label_len, NOWRAP, NULL, _softlabelkeys::num_labels, _softlabelkeys::num_spaces, OK, slks, _softlabelkeys::spaces, and stdscr.
Referenced by slk_refresh().
int slk_set | ( | int | labnum, |
const char * | label, | ||
int | fmt | ||
) |
Configure specified soft key.
labnum | soft label position to configure |
*label | string to use as soft key label |
fmt | justification format of label |
rc | return status code |
Definition at line 352 of file slk.c.
References ERR, _softlabelkeys::fkeys, _softlabel::fmt, fmt, _softlabel::label, NULL, _softlabelkeys::num_labels, OK, slks, and strncpy().
|
static |
Definition at line 55 of file slk.c.
Referenced by _enter_slk(), _leave_slk(), _print_label(), slk_attr(), slk_attr_set(), slk_attroff(), slk_attron(), slk_attrset(), slk_clear(), slk_colour(), slk_init(), slk_label(), slk_restore(), and slk_set().