]> Dogcows Code - chaz/openbox/blob - otk/renderstyle.hh
Brand spankin new widgets for otk (Label and Button).
[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
9 #include <string>
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
38 enum Justify {
39 LeftTopJustify,
40 RightBottomJustify,
41 CenterJustify
42 };
43
44 private:
45 int _screen;
46 std::string _file;
47
48 RenderColor *_root_color;
49
50 RenderColor *_text_color_focus;
51 RenderColor *_text_color_unfocus;
52
53 RenderColor *_button_color_focus;
54 RenderColor *_button_color_unfocus;
55
56 RenderColor *_frame_border_color;
57 int _frame_border_width;
58
59 RenderColor *_client_border_color_focus;
60 RenderColor *_client_border_color_unfocus;
61 int _client_border_width;
62
63 RenderTexture *_titlebar_focus;
64 RenderTexture *_titlebar_unfocus;
65
66 RenderTexture *_label_focus;
67 RenderTexture *_label_unfocus;
68
69 RenderTexture *_handle_focus;
70 RenderTexture *_handle_unfocus;
71
72 RenderTexture *_button_unpress_focus;
73 RenderTexture *_button_unpress_unfocus;
74 RenderTexture *_button_press_focus;
75 RenderTexture *_button_press_unfocus;
76
77 RenderTexture *_grip_focus;
78 RenderTexture *_grip_unfocus;
79
80 Font *_label_font;
81 Justify _label_justify;
82
83 PixmapMask *_max_mask;
84 PixmapMask *_icon_mask;
85 PixmapMask *_alldesk_mask;
86 PixmapMask *_close_mask;
87
88 int _handle_width;
89 int _bevel_width;
90
91 public:
92 RenderStyle(int screen, const std::string &stylefile);
93 virtual ~RenderStyle();
94
95 inline int screen() const { return _screen; }
96
97 inline RenderColor *rootColor() const { return _root_color; }
98
99 inline RenderColor *textFocusColor() const { return _text_color_focus; }
100 inline RenderColor *textUnfocusColor() const { return _text_color_unfocus; }
101
102 inline RenderColor *buttonFocusColor() const { return _button_color_focus; }
103 inline RenderColor *buttonUnfocusColor() const
104 { return _button_color_unfocus; }
105
106 inline RenderColor *frameBorderColor() const { return _frame_border_color; }
107 inline int frameBorderWidth() const { return _frame_border_width; }
108
109 inline RenderColor *clientBorderFocusColor() const
110 { return _client_border_color_focus; }
111 inline RenderColor *clientBorderUnfocusColor() const
112 { return _client_border_color_unfocus; }
113 inline int clientBorderWidth() const { return _client_border_width; }
114
115 inline RenderTexture *titlebarFocusBackground() const
116 { return _titlebar_focus; }
117 inline RenderTexture *titlebarUnfocusBackground() const
118 { return _titlebar_unfocus; }
119
120 inline RenderTexture *labelFocusBackground() const { return _label_focus; }
121 inline RenderTexture *labelUnfocusBackground() const { return _label_unfocus;}
122
123 inline RenderTexture *handleFocusBackground() const { return _handle_focus; }
124 inline RenderTexture *handleUnfocusBackground() const
125 { return _handle_unfocus; }
126
127 inline RenderTexture *buttonUnpressFocusBackground() const
128 { return _button_unpress_focus; }
129 inline RenderTexture *buttonUnpressUnfocusBackground() const
130 { return _button_unpress_unfocus; }
131 inline RenderTexture *buttonPressFocusBackground() const
132 { return _button_press_focus; }
133 inline RenderTexture *buttonPressUnfocusBackground() const
134 { return _button_press_unfocus; }
135
136 inline RenderTexture *gripFocusBackground() const { return _grip_focus; }
137 inline RenderTexture *gripUnfocusBackground() const { return _grip_unfocus; }
138
139 inline Font *labelFont() const { return _label_font; }
140 inline Justify labelTextJustify() const { return _label_justify; }
141
142 inline PixmapMask *maximizeMask() const { return _max_mask; }
143 inline PixmapMask *iconifyMask() const { return _icon_mask; }
144 inline PixmapMask *alldesktopsMask() const { return _alldesk_mask; }
145 inline PixmapMask *closeMask() const { return _close_mask; }
146
147 inline int handleWidth() const { return _handle_width; }
148 inline int bevelWidth() const { return _bevel_width; }
149 };
150
151 }
152
153 #endif // __rendertexture_hh
This page took 0.040636 seconds and 5 git commands to generate.