style.h 2.46 KB
Newer Older
Arturo Espinosa's avatar
Arturo Espinosa committed
1 2
#ifndef GNUMERIC_STYLE_H
#define GNUMERIC_STYLE_H
Arturo Espinosa's avatar
Arturo Espinosa committed
3

Morten Welinder's avatar
Morten Welinder committed
4
#include <gdk/gdk.h>
5
#include <libgnomeprint/gnome-font.h>
6
#include "gnumeric.h"
Morten Welinder's avatar
Morten Welinder committed
7

8
#define DEFAULT_FONT "Helvetica"
9
#define DEFAULT_SIZE 9.0
Arturo Espinosa's avatar
Arturo Espinosa committed
10 11

/* Alignment definitions */
12
typedef enum _StyleHAlignFlags {
13 14 15 16
	HALIGN_GENERAL =  0x01,
	HALIGN_LEFT    =  0x02,
	HALIGN_RIGHT   =  0x04,
	HALIGN_CENTER  =  0x08,
Arturo Espinosa's avatar
Arturo Espinosa committed
17
	HALIGN_FILL    =  0x10,
18 19
	HALIGN_JUSTIFY =  0x20,
	HALIGN_CENTER_ACROSS_SELECTION =  0x40
20
} StyleHAlignFlags;
Arturo Espinosa's avatar
Arturo Espinosa committed
21

22
typedef enum _StyleVAlignFlags {
Arturo Espinosa's avatar
Arturo Espinosa committed
23 24 25 26
	VALIGN_TOP     = 1,
	VALIGN_BOTTOM  = 2,
	VALIGN_CENTER  = 4,
	VALIGN_JUSTIFY = 8
27
} StyleVAlignFlags;
Arturo Espinosa's avatar
Arturo Espinosa committed
28

29
typedef enum _StyleUnderlineType {
Jody Goldberg's avatar
Jody Goldberg committed
30 31
	UNDERLINE_NONE   = 0,
	UNDERLINE_SINGLE = 1,
32
	UNDERLINE_DOUBLE = 2
33
} StyleUnderlineType;
Jody Goldberg's avatar
Jody Goldberg committed
34

35
typedef enum _StyleOrientation {
Arturo Espinosa's avatar
Arturo Espinosa committed
36 37 38 39
	ORIENT_HORIZ           = 1,
	ORIENT_VERT_HORIZ_TEXT = 2,
	ORIENT_VERT_VERT_TEXT  = 4,
	ORIENT_VERT_VERT_TEXT2 = 8
40
} StyleOrientation;
Arturo Espinosa's avatar
Arturo Espinosa committed
41

42
struct _StyleFont {
Jody Goldberg's avatar
Jody Goldberg committed
43 44 45 46
	int	 ref_count;
	char	*font_name;
	float	 size_pts;
	float	 scale;
47
	struct {
Jody Goldberg's avatar
Jody Goldberg committed
48 49
		float pixels;   /* this does not belong here */
		float pts;
50
	} approx_width;
Jody Goldberg's avatar
Jody Goldberg committed
51 52 53 54 55
	struct {
		PangoFont	  	*font;
		PangoFontDescription	*desc;
		PangoFontMetrics	*metrics;
	} pango;
56

Jody Goldberg's avatar
Jody Goldberg committed
57
	GdkFont	*gdk_font;
58 59 60

	unsigned int is_bold:1;
	unsigned int is_italic:1;
61
};
62

Arturo Espinosa's avatar
Arturo Espinosa committed
63
void           style_init  	      (void);
Morten Welinder's avatar
Morten Welinder committed
64 65
void	       style_shutdown         (void);

66
StyleFont     *style_font_new         (const char *font_name,
Jody Goldberg's avatar
Jody Goldberg committed
67
				       double size_pts, double scale,
Jody Goldberg's avatar
Jody Goldberg committed
68
				       gboolean bold, gboolean italic);
69
StyleFont     *style_font_new_simple  (const char *font_name,
Jody Goldberg's avatar
Jody Goldberg committed
70
				       double size_pts, double scale,
Jody Goldberg's avatar
Jody Goldberg committed
71
				       gboolean bold, gboolean italic);
Jody Goldberg's avatar
Jody Goldberg committed
72 73
GdkFont       *style_font_gdk_font    (StyleFont const *sf);
int            style_font_get_height  (StyleFont const *sf);
74
float	       style_font_get_width_pts(StyleFont const *sf);
75 76 77
void           style_font_ref         (StyleFont *sf);
void           style_font_unref       (StyleFont *sf);

78 79 80 81 82 83
/*
 * For hashing Styles
 */
guint          style_hash    (gconstpointer a);
gint           style_compare (gconstpointer a, gconstpointer b);

Jon K Hellan's avatar
Jon K Hellan committed
84 85 86
guint          style_font_hash_func (gconstpointer v);
gint           style_font_equal (gconstpointer v, gconstpointer v2);

87
SpanCalcFlags	 required_updates_for_style (MStyle *style);
88 89
StyleHAlignFlags style_default_halign (MStyle const *mstyle, Cell const *c);

90 91
extern StyleFont *gnumeric_default_font;
extern StyleFont *gnumeric_default_bold_font;
92
extern StyleFont *gnumeric_default_italic_font;
93

94
#include "mstyle.h"
95

96
#endif /* GNUMERIC_STYLE_H */