]> Dogcows Code - chaz/openbox/blob - otk/style.hh
manage and unmanage windows in OBScreen
[chaz/openbox] / 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 Type { ButtonFocus, ButtonUnfocus, TitleFocus, TitleUnfocus,
20 LabelFocus, LabelUnfocus, HandleFocus, HandleUnfocus,
21 GripFocus, GripUnfocus };
22
23 enum TextJustify { LeftJustify = 1, RightJustify, CenterJustify };
24 enum BulletType { RoundBullet = 1, TriangleBullet, SquareBullet, NoBullet };
25
26 struct PixmapMask {
27 Pixmap mask;
28 unsigned int w, h;
29 };
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 doJustify(const std::string &text, int &start_pos,
69 unsigned int max_length, unsigned int modifier) const;
70
71 void readDatabaseMask(const std::string &rname,
72 PixmapMask &pixmapMask,
73 const Configuration &style);
74
75 BTexture readDatabaseTexture(const std::string &rname,
76 const std::string &default_color,
77 const Configuration &style,
78 bool allowNoTexture = false);
79
80 BColor readDatabaseColor(const std::string &rname,
81 const std::string &default_color,
82 const Configuration &style);
83
84 BFont *readDatabaseFont(const std::string &rbasename,
85 const Configuration &style);
86
87 void load(const Configuration &style);
88
89 inline BColor *getBorderColor(void) { return &border_color; }
90
91 inline BColor *getTextFocus(void) { return &l_text_focus; }
92 inline BColor *getTextUnfocus(void) { return &l_text_unfocus; }
93
94 inline BColor *getButtonPicFocus(void) { return &b_pic_focus; }
95 inline BColor *getButtonPicUnfocus(void) { return &b_pic_unfocus; }
96
97 inline BTexture *getFrameFocus(void) { return &f_focus; }
98 inline BTexture *getFrameUnfocus(void) { return &f_unfocus; }
99
100 inline BTexture *getTitleFocus(void) { return &t_focus; }
101 inline BTexture *getTitleUnfocus(void) { return &t_unfocus; }
102
103 inline BTexture *getLabelFocus(void) { return &l_focus; }
104 inline BTexture *getLabelUnfocus(void) { return &l_unfocus; }
105
106 inline BTexture *getHandleFocus(void) { return &h_focus; }
107 inline BTexture *getHandleUnfocus(void) { return &h_unfocus; }
108
109 inline BTexture *getButtonFocus(void) { return &b_focus; }
110 inline BTexture *getButtonUnfocus(void) { return &b_unfocus; }
111
112 inline BTexture *getButtonPressedFocus(void)
113 { return &b_pressed_focus; }
114 inline BTexture *getButtonPressedUnfocus(void)
115 { return &b_pressed_unfocus; }
116
117 inline BTexture *getGripFocus(void) { return &g_focus; }
118 inline BTexture *getGripUnfocus(void) { return &g_unfocus; }
119
120 inline unsigned int getHandleWidth(void) const { return handle_width; }
121 inline unsigned int getBevelWidth(void) const { return bevel_width; }
122 inline unsigned int getFrameWidth(void) const { return frame_width; }
123 inline unsigned int getBorderWidth(void) const { return border_width; }
124
125 inline const BFont &getFont() const { return *font; }
126 inline bool hasAAFonts(void) const { return aa_fonts; }
127
128 inline TextJustify textJustify(void) { return justify; }
129 inline BulletType bulletType(void) { return bullet_type; }
130
131 inline const BColor &getBorderColor() const { return border_color; }
132
133 inline const BTexture &getFrameFocus() const { return f_focus; }
134 inline const BTexture &getFrameUnfocus() const { return f_unfocus; }
135
136 inline void setImageControl(BImageControl *c) {
137 image_control = c;
138 screen_number = c->getScreenInfo()->getScreenNumber();
139 }
140 inline unsigned int getScreen(void) { return screen_number; }
141
142 // XXX add inline accessors for the rest of the bummy
143 };
144
145 }
146
147 #endif // __style_hh
This page took 0.044043 seconds and 4 git commands to generate.