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