]> icculus.org git repositories - mikachu/openbox.git/blob - otk/style.hh
wrap otk with swig/python
[mikachu/openbox.git] / otk / style.hh
1 #ifndef __style_hh
2 #define __style_hh
3
4 #include <string>
5
6 #include "color.hh"
7 #include "font.hh"
8 #include "texture.hh"
9 #include "image.hh"
10 #include "configuration.hh"
11
12 // XXX: document
13
14 namespace otk {
15
16 struct PixmapMask {
17   Pixmap mask;
18   unsigned int w, h;
19 };
20
21 class Style {
22 public:
23
24   enum Type { ButtonFocus, ButtonUnfocus, TitleFocus, TitleUnfocus,
25               LabelFocus, LabelUnfocus, HandleFocus, HandleUnfocus,
26               GripFocus, GripUnfocus };
27
28   enum TextJustify { LeftJustify = 1, RightJustify, CenterJustify };
29   enum BulletType { RoundBullet = 1, TriangleBullet, SquareBullet, NoBullet };
30
31 // private:
32
33   BImageControl *image_control;
34
35   BColor
36     l_text_focus, l_text_unfocus,
37     b_pic_focus, b_pic_unfocus;
38   
39   BColor border_color;
40
41   BFont *font;
42
43   BTexture
44     f_focus, f_unfocus,
45     t_focus, t_unfocus,
46     l_focus, l_unfocus,
47     h_focus, h_unfocus,
48     b_focus, b_unfocus,
49     b_pressed, b_pressed_focus, b_pressed_unfocus,
50     g_focus, g_unfocus;
51
52   PixmapMask close_button, max_button, icon_button, stick_button;
53   TextJustify justify;
54   BulletType bullet_type;
55
56   unsigned int handle_width, bevel_width, frame_width, border_width;
57
58   unsigned int screen_number;
59
60   bool shadow_fonts, aa_fonts;
61
62 public:
63
64   Style();
65   Style(BImageControl *);
66   ~Style();
67
68   void readDatabaseMask(const std::string &rname,
69                         PixmapMask &pixmapMask,
70                         const Configuration &style);
71   
72   BTexture readDatabaseTexture(const std::string &rname,
73                                const std::string &default_color,
74                                const Configuration &style, 
75                                bool allowNoTexture = false);
76
77   BColor readDatabaseColor(const std::string &rname,
78                            const std::string &default_color,
79                            const Configuration &style);
80
81   BFont *readDatabaseFont(const std::string &rbasename,
82                           const Configuration &style);
83
84   void load(const Configuration &style);
85
86   inline BColor *getTextFocus(void) { return &l_text_focus; }
87   inline BColor *getTextUnfocus(void) { return &l_text_unfocus; }
88
89   inline BColor *getButtonPicFocus(void) { return &b_pic_focus; }
90   inline BColor *getButtonPicUnfocus(void) { return &b_pic_unfocus; }
91
92   inline BTexture *getTitleFocus(void) { return &t_focus; }
93   inline BTexture *getTitleUnfocus(void) { return &t_unfocus; }
94
95   inline BTexture *getLabelFocus(void) { return &l_focus; }
96   inline BTexture *getLabelUnfocus(void) { return &l_unfocus; }
97
98   inline BTexture *getHandleFocus(void) { return &h_focus; }
99   inline BTexture *getHandleUnfocus(void) { return &h_unfocus; }
100
101   inline BTexture *getButtonFocus(void) { return &b_focus; }
102   inline BTexture *getButtonUnfocus(void) { return &b_unfocus; }
103
104   inline BTexture *getButtonPressedFocus(void)
105   { return &b_pressed; }
106   inline BTexture *getButtonPressedUnfocus(void)
107   { return &b_pressed_unfocus; }
108
109   inline BTexture *getGripFocus(void) { return &g_focus; }
110   inline BTexture *getGripUnfocus(void) { return &g_unfocus; }
111
112   inline unsigned int getHandleWidth(void) const { return handle_width; }
113   inline unsigned int getBevelWidth(void) const { return bevel_width; }
114   inline unsigned int getFrameWidth(void) const { return frame_width; }
115   inline unsigned int getBorderWidth(void) const { return border_width; }
116
117   inline const BFont &getFont() const { return *font; }
118
119   inline void setShadowFonts(bool fonts) { shadow_fonts = fonts; }
120   inline bool hasShadowFonts(void) const { return shadow_fonts; }
121
122   inline void setAAFonts(bool fonts) { aa_fonts = fonts; }
123   inline bool hasAAFonts(void) const { return aa_fonts; }
124
125   inline TextJustify textJustify(void) { return justify; }
126   inline BulletType bulletType(void) { return bullet_type; }
127
128   inline const BColor &getBorderColor() const { return border_color; }
129
130   inline const BTexture &getFrameFocus() const { return f_focus; }
131   inline const BTexture &getFrameUnfocus() const { return f_unfocus; }
132
133   inline void setImageControl(BImageControl *c) {
134     image_control = c;
135     screen_number = c->getScreenInfo()->screen();
136   }
137   inline unsigned int getScreen(void) { return screen_number; }
138
139   // XXX add inline accessors for the rest of the bummy
140 };
141
142 }
143
144 #endif // __style_hh