]> Dogcows Code - chaz/openbox/blob - otk/renderstyle.hh
Add the "obsetroot" tool. Use it to set the root background.
[chaz/openbox] / otk / renderstyle.hh
1 // -*- mode: C++; indent-tabs-mode: nil; c-basic-offset: 2; -*-
2 #ifndef __renderstyle_hh
3 #define __renderstyle_hh
4
5 #include "rendertexture.hh"
6 #include "rendercolor.hh"
7 #include "font.hh"
8 #include "ustring.hh"
9
10 #include <list>
11 #include <string>
12
13 namespace otk {
14
15 struct PixmapMask {
16 Pixmap mask;
17 unsigned int w, h;
18 PixmapMask() { mask = None; w = h = 0; }
19 };
20
21 class RenderStyle;
22
23 class StyleNotify {
24 public:
25 //! Called when the style is changed on the same screen as the handler.
26 virtual void styleChanged(const RenderStyle &) {}
27 };
28
29 class RenderStyle {
30 static RenderStyle **_styles;
31 static std::list<StyleNotify*> *_notifies;
32 public:
33 static void initialize();
34 static void destroy();
35 static void registerNotify(int screen, StyleNotify *n);
36 static void unregisterNotify(int screen, StyleNotify *n);
37 static RenderStyle *style(int screen);
38 static bool setStyle(int screen, const ustring &stylefile);
39
40 enum Justify {
41 LeftTopJustify,
42 RightBottomJustify,
43 CenterJustify
44 };
45
46 private:
47 static bool loadStyle(RenderStyle *s, int screen, const ustring &stylefile);
48 static void defaultStyle(RenderStyle *s, int screen);
49
50 int _screen;
51 ustring _file;
52
53 std::string _root_args;
54
55 RenderColor *_text_color_focus;
56 RenderColor *_text_color_unfocus;
57
58 RenderColor *_button_color_focus;
59 RenderColor *_button_color_unfocus;
60
61 RenderColor *_frame_border_color;
62 int _frame_border_width;
63
64 RenderColor *_client_border_color_focus;
65 RenderColor *_client_border_color_unfocus;
66 int _client_border_width;
67
68 RenderTexture *_titlebar_focus;
69 RenderTexture *_titlebar_unfocus;
70
71 RenderTexture *_label_focus;
72 RenderTexture *_label_unfocus;
73
74 RenderTexture *_handle_focus;
75 RenderTexture *_handle_unfocus;
76
77 RenderTexture *_button_unpress_focus;
78 RenderTexture *_button_unpress_unfocus;
79 RenderTexture *_button_press_focus;
80 RenderTexture *_button_press_unfocus;
81
82 RenderTexture *_grip_focus;
83 RenderTexture *_grip_unfocus;
84
85 Font *_label_font;
86 Justify _label_justify;
87
88 PixmapMask *_max_mask;
89 PixmapMask *_icon_mask;
90 PixmapMask *_alldesk_mask;
91 PixmapMask *_close_mask;
92
93 int _handle_width;
94 int _bevel_width;
95
96 public:
97 virtual ~RenderStyle();
98
99 inline int screen() const { return _screen; }
100
101 inline const std::string& rootArgs() const { return _root_args; }
102
103 inline RenderColor *textFocusColor() const { return _text_color_focus; }
104 inline RenderColor *textUnfocusColor() const { return _text_color_unfocus; }
105
106 inline RenderColor *buttonFocusColor() const { return _button_color_focus; }
107 inline RenderColor *buttonUnfocusColor() const
108 { return _button_color_unfocus; }
109
110 inline RenderColor *frameBorderColor() const { return _frame_border_color; }
111 inline int frameBorderWidth() const { return _frame_border_width; }
112
113 inline RenderColor *clientBorderFocusColor() const
114 { return _client_border_color_focus; }
115 inline RenderColor *clientBorderUnfocusColor() const
116 { return _client_border_color_unfocus; }
117 inline int clientBorderWidth() const { return _client_border_width; }
118
119 inline RenderTexture *titlebarFocusBackground() const
120 { return _titlebar_focus; }
121 inline RenderTexture *titlebarUnfocusBackground() const
122 { return _titlebar_unfocus; }
123
124 inline RenderTexture *labelFocusBackground() const { return _label_focus; }
125 inline RenderTexture *labelUnfocusBackground() const { return _label_unfocus;}
126
127 inline RenderTexture *handleFocusBackground() const { return _handle_focus; }
128 inline RenderTexture *handleUnfocusBackground() const
129 { return _handle_unfocus; }
130
131 inline RenderTexture *buttonUnpressFocusBackground() const
132 { return _button_unpress_focus; }
133 inline RenderTexture *buttonUnpressUnfocusBackground() const
134 { return _button_unpress_unfocus; }
135 inline RenderTexture *buttonPressFocusBackground() const
136 { return _button_press_focus; }
137 inline RenderTexture *buttonPressUnfocusBackground() const
138 { return _button_press_unfocus; }
139
140 inline RenderTexture *gripFocusBackground() const { return _grip_focus; }
141 inline RenderTexture *gripUnfocusBackground() const { return _grip_unfocus; }
142
143 inline Font *labelFont() const { return _label_font; }
144 inline Justify labelTextJustify() const { return _label_justify; }
145
146 inline PixmapMask *maximizeMask() const { return _max_mask; }
147 inline PixmapMask *iconifyMask() const { return _icon_mask; }
148 inline PixmapMask *alldesktopsMask() const { return _alldesk_mask; }
149 inline PixmapMask *closeMask() const { return _close_mask; }
150
151 inline int handleWidth() const { return _handle_width; }
152 inline int bevelWidth() const { return _bevel_width; }
153 };
154
155 }
156
157 #endif // __renderstyle_hh
This page took 0.040281 seconds and 4 git commands to generate.