#include <style.h>
Public Member Functions | |
style () | |
Initialize an "empty" style. | |
void | set_fg (short _fg) |
Set the foreground color. | |
void | set_bg (short _bg) |
Set the background color. | |
void | attrs_on (attr_t attrs) |
Set the given attribute(s). | |
void | attrs_off (attr_t attrs) |
Clear the given attribute(s). | |
void | attrs_flip (attr_t attrs) |
Flip the given attribute(s). | |
void | apply_style (const style &other) |
Update this style by applying the settings in the other style. | |
style | operator+ (const style &other) const |
| |
style & | operator+= (const style &other) |
Shorthand for apply_style. | |
bool | operator== (const style &other) const |
bool | operator!= (const style &other) const |
short | get_fg () const |
| |
short | get_bg () const |
| |
attr_t | get_attrs () const |
| |
chtype | apply_to (chtype ch) const |
| |
wchtype | apply_to (wchtype ch) const |
|
This means color (foreground and background) and attributes. A style may contain settings for any or all of these; settings which are unspecified are taken from the context in which the display element occurs. For instance, the "button highlighted" style might simply toggle the REVERSE flag.
The interface of styles is high-level: each style is viewed as a function that applies to the current text attributes; you can also extract the style's "current" state in order to merge it with a cchar (this is the style applied to the "null" or default style). However, as there are only a relatively limited number of things each style can change, the representation doesn't rely on virtual functions or even on keeping an array of operations to be applied; instead, it just keeps a summary of the operations it represents.
cwidget::style::style | ( | ) | [inline] |
Initialize an "empty" style.
void cwidget::style::set_fg | ( | short | _fg | ) | [inline] |
Set the foreground color.
There is no change if the new foreground color is "empty".
void cwidget::style::set_bg | ( | short | _bg | ) | [inline] |
Set the background color.
There is no change if the new background color is "empty".
void cwidget::style::attrs_on | ( | attr_t | attrs | ) | [inline] |
Set the given attribute(s).
void cwidget::style::attrs_off | ( | attr_t | attrs | ) | [inline] |
Clear the given attribute(s).
void cwidget::style::attrs_flip | ( | attr_t | attrs | ) | [inline] |
Flip the given attribute(s).
short cwidget::style::get_fg | ( | ) | const [inline] |
short cwidget::style::get_bg | ( | ) | const [inline] |
attr_t cwidget::style::get_attrs | ( | ) | const [inline] |
chtype cwidget::style::apply_to | ( | chtype | ch | ) | const [inline] |