Classes | |
struct | column_disposition |
struct | column |
struct | wchtype |
A structure that amalgamates a wchar_t together with attributes. More... | |
class | chstring |
A string class which stores attributes along with characters. More... | |
class | wchstring |
class | cwindow |
class | _text_fragment |
A fragment of text, possibly with attached attributes. More... | |
class | _newline_fragment |
This fragment just expands to a newline. More... | |
class | _style_fragment |
class | fragment_container |
A base class for fragment containers that supports caching information about the children. More... | |
class | _sequence_fragment |
A fragment generated by composing a sequence of other fragments. More... | |
class | _flowbox |
class | _fillbox |
class | _hardwrapbox |
class | _clipbox |
class | _indentbox |
class | _fragment_columns |
struct | argument |
class | fragment |
A fragment represents a logical unit of text. More... | |
struct | fragment_column_entry |
Stores information on a single column of fragments. More... | |
class | fragment_cache |
A fragment that caches its contents; a cached result is used if the same width is passed to the layout routine twice in a row. More... | |
class | fragment_contents |
This class represents the formatted contents of a fragment. More... | |
class | style |
A "style" is a setting to be applied to a display element (widget, text, etc). More... | |
Namespaces | |
namespace | threads |
C++ wrappers for the POSIX threading primitives. | |
Typedefs | |
typedef std::list< column > | column_list |
typedef std::list< column > | layout |
typedef wchstring | fragment_line |
The type used to represent a line of a fragment; it might be worthwhile to change this to a rope<chtype> if this class is used to format larger pieces of text. | |
Functions | |
wstring | columnify (const layout &format, int width) |
void | init_curses () |
void | resize () |
chtype | _getbkgd (WINDOW *win) |
int | _box (WINDOW *win, chtype verch, chtype horch) |
void | _getyx (WINDOW *win, int &y, int &x) |
void | _getparyx (WINDOW *win, int &y, int &x) |
void | _getbegyx (WINDOW *win, int &y, int &x) |
void | _getmaxyx (WINDOW *win, int &y, int &x) |
int | _getmaxy (WINDOW *win) |
int | _getmaxx (WINDOW *win) |
int | _touchwin (WINDOW *win) |
int | _untouchwin (WINDOW *win) |
fragment * | text_fragment (const wstring &s) |
fragment * | text_fragment (const wstring &s, const style &st) |
fragment * | text_fragment (const string &s, const char *encoding) |
fragment * | text_fragment (const string &s, const style &st, const char *encoding) |
fragment * | newline_fragment () |
Create a fragment which simply produces a newline wherever it occurs. | |
fragment * | style_fragment (fragment *f, const style &st) |
Create a fragment which alters the style of its contents. | |
fragment * | sequence_fragment (const vector< fragment * > &contents) |
fragment * | sequence_fragment (fragment *f,...) |
Create a fragment from a sequence of other fragments. | |
fragment * | join_fragments (const vector< fragment * > &fragments, const wstring &between) |
fragment * | flowbox (fragment *contents) |
Create a flowbox. | |
fragment * | fillbox (fragment *contents) |
Create a fillbox. | |
fragment * | hardwrapbox (fragment *contents) |
Create a hardwrapbox. | |
fragment * | clipbox (fragment *contents) |
Create a clipbox. | |
fragment * | indentbox (size_t firstindent, size_t restindent, fragment *contents) |
Create an indentbox. | |
fragment * | dropbox (fragment *header, fragment *contents) |
Indent a paragraph, placing the given text on the first line. | |
fragment * | fragment_columns (const vector< fragment_column_entry > &columns) |
string | char_to_str (char code) |
fragment * | fragf (const char *format,...) |
A printf-alike for fragments. | |
fragment * | text_fragment (const std::wstring &s) |
Create a fragment from a string of text. | |
fragment * | text_fragment (const std::wstring &s, const style &st) |
Create a fragment from a string of text. | |
fragment * | text_fragment (const std::string &s, const char *encoding=NULL) |
Create a fragment from a string of multibyte-encoded text. | |
fragment * | text_fragment (const std::string &s, const style &st, const char *encoding=NULL) |
Create a fragment from a string of multibyte-encoded text, wrapping an implicit style_fragment around it. | |
fragment * | text_fragment (const char *s, const style &st=style()) |
Create a fragment from a string of text. | |
fragment * | sequence_fragment (const std::vector< fragment * > &fragments) |
Create a fragment from a sequence of other fragments. | |
fragment * | join_fragments (const std::vector< fragment * > &fragments, const std::wstring &between) |
Join fragments into a single fragment, placing text between them. | |
fragment * | fragment_columns (const std::vector< fragment_column_entry > &columns) |
A fragment that formats its contents into columns. | |
const style & | get_style (const std::string &name) |
Look up a style in the global registry. | |
void | set_style (const std::string &name, const style &style) |
Place a style in the global registry. | |
style | style_fg (short fg) |
| |
style | style_bg (short bg) |
| |
style | style_attrs_on (attr_t attrs) |
| |
style | style_attrs_off (attr_t attrs) |
| |
style | style_attrs_flip (attr_t attrs) |
| |
std::string | version () |
Return the version number of the library. | |
Variables | |
cwindow | rootwin = NULL |
cwindow | rootwinhack = NULL |
map< string, style > | styles |
fragment * cwidget::clipbox | ( | fragment * | contents | ) |
Create a clipbox.
Each line of the fragment placed inside the clipbox will be clipped to the current width. The whole layout widget implicitly uses one of these, but there may be other uses for clipboxes as well.
contents | the contents of the clipbox |
fragment * cwidget::dropbox | ( | fragment * | header, | |
fragment * | contents | |||
) |
Indent a paragraph, placing the given text on the first line.
This just expands to an invocation of indentbox, with the indentation constants set appropriately. The result will consist of "header" prepended to the first line of "contents", with successive lines of "contents" indented to line up with the first line of "contents".
fragment * cwidget::fillbox | ( | fragment * | contents | ) |
Create a fillbox.
Each line of the fragment placed inside the fillbox will be reflowed (word-wrapped) and expanded to the current width, possibly to several lines.
The contents of a fillbox always have final_nl=true.
contents | the contents of the fillbox |
fragment * cwidget::flowbox | ( | fragment * | contents | ) |
Create a flowbox.
Each line of the fragment placed inside the flowbox will be reflowed (word-wrapped) to the current width, possibly to several lines.
The contents of a flowbox always have final_nl=true. (ie, a flowbox is always followed by a line break)
contents | the contents of the flowbox |
fragment * cwidget::fragf | ( | const char * | format, | |
... | ||||
) |
A printf-alike for fragments.
Formatting codes:
For instance,
fragf("%S%BWARNING%b: something bad happened in routine %s," "expect a segfault.", "Error", some_routine);
Note: if you use a parameter index multiple times, you are virtually GUARANTEED to segfault!
format | the format string |
fragment* cwidget::fragment_columns | ( | const std::vector< fragment_column_entry > & | columns | ) |
A fragment that formats its contents into columns.
If the fixed-width columns overflow the available space, they will be clipped hard.
This fragment may NOT be placed inside an indent box or any other box that alters the shape of its contents. Doing so will cause the program to abort.
columns | a list of column entry information ordered from left to right. |
const style & cwidget::get_style | ( | const std::string & | name | ) |
fragment * cwidget::hardwrapbox | ( | fragment * | contents | ) |
Create a hardwrapbox.
Each line of the fragment inside the box will be hard-wrapped to the current width.
The contents of a wrapbox always have final_nl=true.
contents | the contents of the hardwrapbox |
fragment * cwidget::indentbox | ( | size_t | firstindent, | |
size_t | restindent, | |||
fragment * | contents | |||
) |
Create an indentbox.
Each line of the indentbox will be indented by the specified amount. (this effectively decreases the width of each line) If desired, the first line can be indented a different amount (typically less) than the remaining lines, although it is formatted to the same width; this supports things like bulletted lists.
firstindent | the number of spaces of indentation to use for the first line | |
restindent | the number of spaces of indentation to use for later lines | |
contents | the contents of the indentbox |
fragment* cwidget::join_fragments | ( | const std::vector< fragment * > & | fragments, | |
const std::wstring & | between | |||
) |
fragment * cwidget::newline_fragment | ( | ) |
Create a fragment which simply produces a newline wherever it occurs.
fragment* cwidget::sequence_fragment | ( | const std::vector< fragment * > & | fragments | ) |
Create a fragment from a sequence of other fragments.
The fragment will simply "shove" the two sequences together, respecting the value of final_nl on each.
fragments | the fragments in the sequence |
fragment * cwidget::sequence_fragment | ( | fragment * | f, | |
... | ||||
) |
void cwidget::set_style | ( | const std::string & | name, | |
const style & | style | |||
) |
Place a style in the global registry.
style cwidget::style_attrs_flip | ( | attr_t | attrs | ) | [inline] |
style cwidget::style_attrs_off | ( | attr_t | attrs | ) | [inline] |
fragment * cwidget::style_fragment | ( | fragment * | f, | |
const style & | st | |||
) |
fragment* cwidget::text_fragment | ( | const char * | s, | |
const style & | st = style() | |||
) | [inline] |
fragment* cwidget::text_fragment | ( | const std::string & | s, | |
const char * | encoding = NULL | |||
) |
fragment* cwidget::text_fragment | ( | const std::wstring & | s, | |
const style & | st | |||
) |
fragment* cwidget::text_fragment | ( | const std::wstring & | s | ) |
std::string cwidget::version | ( | ) |
Return the version number of the library.