]> icculus.org git repositories - mikachu/openbox.git/blob - otk/style.hh
pretty sure all frame elements are placed correctly now
[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 class Style {
17 public:
18
19   enum TextJustify { LeftJustify = 1, RightJustify, CenterJustify };
20   enum BulletType { RoundBullet = 1, TriangleBullet, SquareBullet, NoBullet };
21
22   struct PixmapMask {
23     Pixmap mask;
24     unsigned int w, h;
25   };
26
27 // private:
28
29   BImageControl *image_control;
30
31   BColor
32     l_text_focus, l_text_unfocus,
33     b_pic_focus, b_pic_unfocus;
34   
35   BColor border_color;
36
37   BFont *font;
38
39   BTexture
40     f_focus, f_unfocus,
41     t_focus, t_unfocus,
42     l_focus, l_unfocus,
43     h_focus, h_unfocus,
44     b_focus, b_unfocus,
45     b_pressed, b_pressed_focus, b_pressed_unfocus,
46     g_focus, g_unfocus;
47
48   PixmapMask close_button, max_button, icon_button, stick_button;
49   TextJustify justify;
50
51   unsigned int handle_width, bevel_width, frame_width, border_width;
52
53   unsigned int screen_number;
54
55   bool shadow_fonts, aa_fonts;
56
57 public:
58
59   Style();
60   Style(unsigned int);
61   Style(unsigned int, BImageControl *);
62   ~Style();
63
64   void doJustify(const std::string &text, int &start_pos,
65                  unsigned int max_length, unsigned int modifier) const;
66
67   void readDatabaseMask(const std::string &rname,
68                         PixmapMask &pixmapMask,
69                         const Configuration &style);
70   
71   BTexture readDatabaseTexture(const std::string &rname,
72                                     const std::string &default_color,
73                                     const Configuration &style, 
74                                     bool allowNoTexture = false);
75
76   BColor readDatabaseColor(const std::string &rname,
77                                 const std::string &default_color,
78                                 const Configuration &style);
79
80   BFont *readDatabaseFont(const std::string &rbasename,
81                                const Configuration &style);
82
83   void load(Configuration &);
84
85   inline unsigned int getHandleWidth(void) const { return handle_width; }
86   inline unsigned int getBevelWidth(void) const { return bevel_width; }
87   inline unsigned int getFrameWidth(void) const { return frame_width; }
88   inline unsigned int getBorderWidth(void) const { return border_width; }
89
90   inline const BFont *getFont() const { return font; }
91
92   inline const BColor &getBorderColor() const { return border_color; }
93
94   inline void setImageControl(BImageControl *c) { image_control = c; }
95   inline void setScreenNumber(unsigned int scr) { screen_number = scr; }
96
97   // XXX add inline accessors for the rest of the bummy
98 };
99
100 }
101
102 #endif // __style_hh