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