teapot-spreadsheet/src/common/style.h

63 lines
1.4 KiB
C

#ifndef STYLE_H
#define STYLE_H
#include <limits.h>
#include <stdbool.h>
#ifdef __cplusplus
extern "C" {
#endif
typedef short PrecisionLevel;
#define NO_PRECISION 0
#define MIN_PRECISION -FLT_T_DIG
#define MAX_PRECISION SHRT_MAX
#define PRECISION_FORMAT "%hd"
/* Note AUTOADJUST is treated exactly as though no Adjust value is set. */
typedef enum { AUTOADJUST = 0, LEFT, RIGHT, CENTER } Adjust;
extern const char *Adjust_Name[];
#define MAX_ADJUST_NAME_LENGTH 16
extern const char Adjust_Char[];
typedef enum
{ FLT_NO_FORMAT = 0, FLT_DECIMAL, FLT_SCIENTIFIC, FLT_COMPACT, FLT_HEXACT }
FloatFormat;
extern const char *FloatFormat_Name[];
#define MAX_FLOATFORM_NAME_LENGTH 16
extern const char FloatFormat_Char[];
typedef unsigned char ColorNum;
#define NO_COLOR_SET 0
#define MAX_MAX_COLORS UCHAR_MAX
#define COLOR_FORMAT "%hhu"
typedef enum { FOREGROUND = 0, BACKGROUND, NUM_COLOR_ASPECTS } ColorAspect;
extern const char *ColorAspect_Name[];
extern const ColorNum DefaultCN[];
typedef struct
{
PrecisionLevel precision;
ColorNum aspect[NUM_COLOR_ASPECTS];
Adjust adjust:3;
FloatFormat fform:3;
unsigned int shadowed:1;
unsigned int shadowed_set:1;
unsigned int transparent:1;
unsigned int transparent_set:1;
unsigned int bold:1;
unsigned int bold_set:1;
unsigned int underline:1;
unsigned int underline_set:1;
} Style;
void clearstyle(Style* s);
bool style_equal(Style l, Style r);
#ifdef __cplusplus
}
#endif
#endif