Fix miscalculations and infinite loops in tab width calculation
[notion/jeffpc.git] / de / style.h
blob073f14554c3a075cd49c6981c58c80d47527ecf3
1 /*
2 * ion/de/style.h
4 * Copyright (c) Tuomo Valkonen 1999-2009.
6 * See the included file LICENSE for details.
7 */
9 #ifndef ION_DE_STYLE_H
10 #define ION_DE_STYLE_H
12 #include <libextl/extl.h>
14 #include <ioncore/common.h>
15 #include <ioncore/gr.h>
16 #include <ioncore/rectangle.h>
18 INTRSTRUCT(DEBorder);
19 INTRSTRUCT(DEStyle);
21 #include "font.h"
22 #include "colour.h"
24 enum{
25 DEBORDER_INLAID=0, /* -\xxxxxx/- */
26 DEBORDER_RIDGE, /* /-\xxxx/-\ */
27 DEBORDER_ELEVATED, /* /-xxxxxx-\ */
28 DEBORDER_GROOVE /* \_/xxxx\_/ */
31 enum{
32 DEBORDER_ALL=0,
33 DEBORDER_TB,
34 DEBORDER_LR
38 enum{
39 DEALIGN_LEFT=0,
40 DEALIGN_RIGHT=1,
41 DEALIGN_CENTER=2
45 DECLSTRUCT(DEBorder){
46 uint sh, hl, pad;
47 uint style;
48 uint sides;
52 DECLSTRUCT(DEStyle){
53 GrStyleSpec spec;
54 int usecount;
55 bool is_fallback;
57 WRootWin *rootwin;
59 DEStyle *based_on;
61 GC normal_gc;
63 DEBorder border;
64 bool cgrp_alloced;
65 DEColourGroup cgrp;
66 int n_extra_cgrps;
67 DEColourGroup *extra_cgrps;
68 GrTransparency transparency_mode;
69 DEFont *font;
70 int textalign;
71 uint spacing;
73 ExtlTab extras_table;
75 /* Only initialised if used as a DETabBrush */
76 bool tabbrush_data_ok;
77 GC stipple_gc;
78 GC copy_gc;
80 Pixmap tag_pixmap;
81 int tag_pixmap_w;
82 int tag_pixmap_h;
84 DEStyle *next, *prev;
88 extern bool destyle_init(DEStyle *style, WRootWin *rootwin, const char *name);
89 extern void destyle_deinit(DEStyle *style);
90 extern DEStyle *de_create_style(WRootWin *rootwin, const char *name);
91 extern void destyle_unref(DEStyle *style);
93 extern void destyle_create_tab_gcs(DEStyle *style);
95 extern void de_reset();
96 extern void de_deinit_styles();
98 extern DEStyle *de_get_style(WRootWin *rootwin, const GrStyleSpec *spec);
100 extern void destyle_add(DEStyle *style);
101 extern void destyle_dump(DEStyle *style);
104 #endif /* ION_DE_STYLE_H */