00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018 #ifndef CUFO_TERMSTYLE_H
00019 #define CUFO_TERMSTYLE_H
00020
00021 #include <cufo/fwd.h>
00022 #include <cucon/pmap.h>
00023
00024 CU_BEGIN_DECLARATIONS
00025
00026
00027
00028 #define CUFO_TERMFACE_FGCOLOUR 1
00029 #define CUFO_TERMFACE_BGCOLOUR 2
00030 #define CUFO_TERMFACE_ITALIC 4
00031 #define CUFO_TERMFACE_UNDERLINE 8
00032 #define CUFO_TERMFACE_BOLD 16
00033 #define CUFO_TERMFACE_REVERSE 32
00034
00035 struct cufo_termface
00036 {
00037 uint_least8_t enables;
00038 uint_least8_t booleans;
00039 uint_least8_t fgcolour, bgcolour;
00040 };
00041
00042 void cufo_termface_init(cufo_termface_t face);
00043
00044 cufo_termface_t cufo_termface_new(void);
00045
00046 void cufo_termface_set_fgcolour(cufo_termface_t face, int colour);
00047
00048 void cufo_termface_set_bgcolour(cufo_termface_t face, int colour);
00049
00050 cu_bool_t cufo_termface_set_fgcolour_cstr(cufo_termface_t face,
00051 char const *colour);
00052
00053 cu_bool_t cufo_termface_set_bgcolour_cstr(cufo_termface_t face,
00054 char const *colour);
00055
00056 void cufo_termface_set_bool(cufo_termface_t face, unsigned int attr, cu_bool_t val);
00057
00058 CU_SINLINE void cufo_termface_set_italic(cufo_termface_t face, cu_bool_t val)
00059 { cufo_termface_set_bool(face, CUFO_TERMFACE_ITALIC, val); }
00060
00061 CU_SINLINE void cufo_termface_set_underline(cufo_termface_t face, cu_bool_t val)
00062 { cufo_termface_set_bool(face, CUFO_TERMFACE_UNDERLINE, val); }
00063
00064 CU_SINLINE void cufo_termface_set_bold(cufo_termface_t face, cu_bool_t val)
00065 { cufo_termface_set_bool(face, CUFO_TERMFACE_BOLD, val); }
00066
00067 CU_SINLINE void cufo_termface_set_reverse(cufo_termface_t face, cu_bool_t val)
00068 { cufo_termface_set_bool(face, CUFO_TERMFACE_REVERSE, val); }
00069
00070
00071 struct cufo_termstyle
00072 {
00073 struct cucon_pmap face_map;
00074 };
00075
00076 void cufo_termstyle_init(cufo_termstyle_t style);
00077
00078 cufo_termstyle_t cufo_termstyle_new(void);
00079
00080 cu_bool_t cufo_termstyle_loadinto(cufo_termstyle_t style, cu_str_t name);
00081
00082 cufo_termface_t cufo_termstyle_get(cufo_termstyle_t style, cufo_tag_t tag);
00083
00084 cufo_termface_t cufo_termstyle_ref(cufo_termstyle_t style, cufo_tag_t tag);
00085
00086
00087 CU_END_DECLARATIONS
00088
00089 #endif