.TH TICKIT_PEN 7 .SH NAME TickitPen \- store a collection of terminal rendering attributes .SH SYNOPSIS .EX .B #include .sp .BI "typedef struct " TickitPen ; .EE .sp .SH DESCRIPTION A \fBTickitPen\fP instance stores a collection of terminal rendering attributes. For each known attribute, a pen instance may store a value for this attribute. A pen instance is used in the \fBtickit_term_chpen\fP(3) and \fBtickit_term_setpen\fP(3) functions. .SH FUNCTIONS A new \fBTickitPen\fP instance is created using the \fBtickit_pen_new\fP(3) function. A pen instance stores a reference count to make it easier for applications to manage the lifetime of pens. A new pen starts with a count of one, and it can be adjusted using \fBtickit_pen_ref\fP(3) and \fBtickit_pen_unref\fP(3). When the count reaches zero the instance is destroyed. .SH ATTRIBUTES The \fBTickitPenAttr\fP enumeration lists the attributes known by a pen. Each attribute has a type, as given by the \fBTickitPenAttrType\fP enumeration. The \fBtickit_penattr_type\fP(3) function gives the type of a given attribute. The \fBtickit_penattr_name\fP(3) function gives the name of a given attribute, which is also given below in parentheses. The \fBtickit_penattr_lookup\fP(3) function looks up an attribute constant from a string containing the name. .TP \fBTICKIT_PEN_FG\fP ("fg"), \fBTICKIT_PEN_BG\fP ("bg") foreground and background colours. These are of type \fBTICKIT_PENTYPE_COLOUR\fP. This gives an integer from 0 to 255 to use as the colour index. It may also be set to the value -1, which sets the terminal's default, which may be a colour distinct from any of the others. Some terminals may not support more than 8 or 16 colours, however. When setting a pen colour on a terminal, it may be converted to one that is supported by the terminal \fBtickit_term_setpen\fP(3) or \fBtickit_term_chpen\fP(3) functions. .PP These colour attributes also support a secondary RGB8 (24-bit) specification, which some terminal drivers may prefer over the indexed version. .TP \fBTICKIT_PEN_BOLD\fP ("b"), \fBTICKIT_PEN_ITALIC\fP ("i"), \fBTICKIT_PEN_REVERSE\fP ("rv"), \fBTICKIT_PEN_STRIKE\fP ("strike"), \fBTICKIT_PEN_BLINK\fP ("blink") boolean rendering attributes. These are of type \fBTICKIT_PENTYPE_BOOL\fP. They are either true or false. Most terminals should support at least bold, underline, reverse and blink, though italic and strikethrough are less commonly supported. Applications are advised not to use these two alone to distinguish significant parts of the user interface. .TP \fBTICKIT_PEN_UNDER\fP ("u") underline. This is of type \fBTICKIT_PENTYPE_INT\fP. Its value is one of the values from the \fBTickitPenUnderline\fP enumeration. Most terminals should support the single underline value, however other values are less commonly supported, and may be drawn instead as a single underline. Applications are advised not to make use of underline style alone to distinguish significant parts of the user interface. .IP Valid values are: .RS .TP \fBTICKIT_PEN_UNDER_NONE\fB No underline. .TP \fBTICKIT_PEN_UNDER_SINGLE\fB Single underline. .TP \fBTICKIT_PEN_UNDER_DOUBLE\fB Double underline. .TP \fBTICKIT_PEN_UNDER_WAVY\fB Single wavy underline, sometimes called "undercurl". .RE .IP For backward-compatibility this attribute will also behave like a boolean-typed attribute. When set to any value other than none, it appears true as a boolean. Setting it to true as a booelan will set its value to single. .TP \fBTICKIT_PEN_ALTFONT\fP ("af") alternate font index. This is of type \fBTICKIT_PENTYPE_INT\fP. It is a value 0 to 9, which selects from the terminal's available fonts. Few terminals actually support this in practice. .SH FUNCTIONS The values of attributes are set or queried on a pen instance by using functions depending on the type of the attribute. Boolean attributes use \fBtickit_pen_set_bool_attr\fP(3) and \fBtickit_pen_get_bool_attr\fP(3). Integer attributes use \fBtickit_pen_set_int_attr\fP(3) and \fBtickit_pen_get_int_attr\fP(3). Colour attributes use \fBtickit_pen_set_colour_attr\fP(3), \fBtickit_pen_set_colour_attr_desc\fP(3) and \fBtickit_pen_get_colour_attr\fP(3). The RGB8 secondary field for colours can be set with \fBtickit_pen_set_colour_attr_rgb8\fP(3), and queried with \fBtickit_pen_has_colour_attr_rgb8\fP(3) and \fBtickit_pen_get_colour_attr_rgb8\fP(3). .PP To test if an attribute has a value set, use \fBtickit_pen_has_attr\fP(3), and to remove the attribute entirely use \fBtickit_pen_clear_attr\fP(3). To test if a pen has any attributes set at all, use \fBtickit_pen_is_nonempty\fP(3), and to test if it has any attributes set to a non-default value use \fBtickit_pen_is_nondefault\fP(3). To remove all the attributes use \fBtickit_pen_clear\fP(3). To copy the value of one attribute from a pen into another pen use \fBtickit_pen_copy_attr\fP(3), to copy the entire pen use \fBtickit_pen_copy\fP(3), and to compare two pens for equality use \fBtickit_pen_equiv_attr\fP(3). .SH EVENTS A pen instance stores a list of event handlers. Each event handler is associated with one event type and stores a function pointer, and an arbitrary pointer containing user data. Event handlers may be installed using \fBtickit_pen_bind_event\fP(3) and removed using \fBtickit_pen_unbind_event_id\fP(3). .PP The event types recognised are: .TP .B TICKIT_PEN_ON_DESTROY The pen instance is being destroyed. .TP .B TICKIT_PEN_ON_CHANGE The stored attributes on the pen have changed. The \fIinfo\fP pointer will be \fBNULL\fP.