]> icculus.org git repositories - mikachu/openbox.git/blob - otk/renderstyle.cc
only ignore NotifyGrab again
[mikachu/openbox.git] / otk / renderstyle.cc
1 // -*- mode: C++; indent-tabs-mode: nil; c-basic-offset: 2; -*-
2
3 #ifdef    HAVE_CONFIG_H
4 #  include "../config.h"
5 #endif // HAVE_CONFIG_H
6
7 #include "renderstyle.hh"
8 #include "display.hh"
9 #include "screeninfo.hh"
10
11 namespace otk {
12
13 RenderStyle::RenderStyle(int screen, const std::string &stylefile)
14   : _screen(screen),
15     _file(stylefile)
16 {
17   _root_color = new RenderColor(_screen, 0x272a2f);
18   
19   _text_color_focus = new RenderColor(_screen, 0x272a2f);
20   _text_color_unfocus = new RenderColor(_screen, 0x676869);
21
22   _button_color_focus = new RenderColor(_screen, 0x96ba86);
23   _button_color_unfocus = new RenderColor(_screen, 0x676869);
24
25   _frame_border_color = new RenderColor(_screen, 0x181f24);
26   _frame_border_width = 1;
27
28   _client_border_color_focus = new RenderColor(_screen, 0x858687);
29   _client_border_color_unfocus = new RenderColor(_screen, 0x555657);
30   _client_border_width = 1;
31
32   _titlebar_focus = new RenderTexture(_screen,
33                                       false,
34                                       RenderTexture::Flat,
35                                       RenderTexture::Bevel1,
36                                       false,
37                                       RenderTexture::Vertical,
38                                       false,
39                                       0x858687,
40                                       0x373a3f,
41                                       0x0,
42                                       0x0);
43   _titlebar_unfocus = new RenderTexture(_screen,
44                                         false,
45                                         RenderTexture::Flat,
46                                         RenderTexture::Bevel1,
47                                         false,
48                                         RenderTexture::Vertical,
49                                         false,
50                                         0x555657,
51                                         0x171a1f,
52                                         0x0,
53                                         0x0);
54
55   _label_focus = new RenderTexture(_screen,
56                                    false,
57                                    RenderTexture::Flat,
58                                    RenderTexture::Bevel1,
59                                    true,
60                                    RenderTexture::Vertical,
61                                    false,
62                                    0x96ba86,
63                                    0x5a724c,
64                                    0x181f24,
65                                    0x0);
66   _label_unfocus = new RenderTexture(_screen,
67                                      false,
68                                      RenderTexture::Sunken,
69                                      RenderTexture::Bevel1,
70                                      false,
71                                      RenderTexture::CrossDiagonal,
72                                      false,
73                                      0x555657,
74                                      0x272a2f,
75                                      0x0,
76                                      0x0);
77
78
79   _handle_focus = new RenderTexture(_screen,
80                                     false,
81                                     RenderTexture::Flat,
82                                     RenderTexture::Bevel1,
83                                     false,
84                                     RenderTexture::Vertical,
85                                     false,
86                                     0x858687,
87                                     0x373a3f,
88                                     0x0,
89                                     0x0);
90   _handle_unfocus = new RenderTexture(_screen,
91                                       false,
92                                       RenderTexture::Flat,
93                                       RenderTexture::Bevel1,
94                                       false,
95                                       RenderTexture::Vertical,
96                                       false,
97                                       0x555657,
98                                       0x171a1f,
99                                       0x0,
100                                       0x0);
101
102   
103   _button_unpress_focus = new RenderTexture(_screen,
104                                             false,
105                                             RenderTexture::Raised,
106                                             RenderTexture::Bevel2,
107                                             false,
108                                             RenderTexture::CrossDiagonal,
109                                             false,
110                                             0x858687,
111                                             0x272a2f,
112                                             0x0,
113                                             0x0);
114   _button_unpress_unfocus = new RenderTexture(_screen,
115                                               false,
116                                               RenderTexture::Raised,
117                                               RenderTexture::Bevel2,
118                                               false,
119                                               RenderTexture::CrossDiagonal,
120                                               false,
121                                               0x555657,
122                                               0x171a1f,
123                                               0x0,
124                                               0x0);
125
126   _button_press_focus = new RenderTexture(_screen,
127                                           false,
128                                           RenderTexture::Sunken,
129                                           RenderTexture::Bevel2,
130                                           false,
131                                           RenderTexture::CrossDiagonal,
132                                           false,
133                                           0x96ba86,
134                                           0x5a724c,
135                                           0x0,
136                                           0x0);
137   _button_press_unfocus = new RenderTexture(_screen,
138                                             false,
139                                             RenderTexture::Sunken,
140                                             RenderTexture::Bevel2,
141                                             false,
142                                             RenderTexture::CrossDiagonal,
143                                             false,
144                                             0x555657,
145                                             0x171a1f,
146                                             0x0,
147                                             0x0);
148
149   _grip_focus = new RenderTexture(_screen,
150                                   false,
151                                   RenderTexture::Flat,
152                                   RenderTexture::Bevel1,
153                                   false,
154                                   RenderTexture::Vertical,
155                                   false,
156                                   0x96ba86,
157                                   0x5a724c,
158                                   0x0,
159                                   0x0);
160   _grip_unfocus = new RenderTexture(_screen,
161                                     false,
162                                     RenderTexture::Flat,
163                                     RenderTexture::Bevel1,
164                                     false,
165                                     RenderTexture::Vertical,
166                                     false,
167                                     0x555657,
168                                     0x171a1f,
169                                     0x0,
170                                     0x0);
171
172   _label_font = new Font(_screen, "Arial,Sans-9:bold", true, 1, 0x40);
173   _label_justify = RightJustify;
174
175   _max_mask = new PixmapMask();
176   _max_mask->w = _max_mask->h = 8;
177   {
178     //char data[] = { 0x7e, 0xff, 0xc3, 0xc3, 0xc3, 0xc3, 0xff, 0x7e };
179     char data []  = {0x00, 0x00, 0x18, 0x3c, 0x66, 0x42, 0x00, 0x00 };
180     _max_mask->mask =
181       XCreateBitmapFromData(**display,
182                             display->screenInfo(_screen)->rootWindow(),
183                             data, 8, 8);
184   }
185
186   _icon_mask = new PixmapMask();
187   _icon_mask->w = _icon_mask->h = 8;
188   {
189     //char data[] = { 0x00, 0x00, 0xc3, 0xe7, 0x7e, 0x3c, 0x18, 0x00 };
190     char data[] = { 0x00, 0x00, 0x42, 0x66, 0x3c, 0x18, 0x00, 0x00 };
191     _icon_mask->mask =
192       XCreateBitmapFromData(**display,
193                             display->screenInfo(_screen)->rootWindow(),
194                             data, 8, 8);
195   }
196   
197   _alldesk_mask = new PixmapMask();
198   _alldesk_mask->w = _alldesk_mask->h = 8;
199   {
200     //char data[] = { 0x00, 0x00, 0x18, 0x3c, 0x3c, 0x18, 0x00, 0x00 };
201     char data[] = { 0x00, 0x66, 0x66, 0x00, 0x00, 0x66, 0x66, 0x00 };
202     _alldesk_mask->mask =
203       XCreateBitmapFromData(**display,
204                             display->screenInfo(_screen)->rootWindow(),
205                             data, 8, 8);
206   }
207   
208   _close_mask = new PixmapMask();
209   _close_mask->w = _close_mask->h = 8;
210   {
211     //char data[] = { 0xc3, 0xe7, 0x7e, 0x3c, 0x3c, 0x7e, 0xe7, 0xc3 };
212     char data[] = { 0x00, 0xc3, 0x66, 0x3c, 0x3c, 0x66, 0xc3, 0x00 };
213     _close_mask->mask =
214       XCreateBitmapFromData(**display,
215                             display->screenInfo(_screen)->rootWindow(),
216                             data, 8, 8);
217   }
218
219   _bevel_width = 1;
220   _handle_width = 4;
221 }
222
223 RenderStyle::~RenderStyle()
224 {
225   delete _root_color;
226   
227   delete _text_color_focus;
228   delete _text_color_unfocus;
229
230   delete _button_color_focus;
231   delete _button_color_unfocus;
232
233   delete _frame_border_color;
234
235   delete _client_border_color_focus; 
236   delete _client_border_color_unfocus;
237  
238   delete _titlebar_focus;
239   delete _titlebar_unfocus;
240
241   delete _label_focus;
242   delete _label_unfocus;
243
244   delete _handle_focus;
245   delete _handle_unfocus;
246
247   delete _button_unpress_focus;
248   delete _button_unpress_unfocus;
249   delete _button_press_focus;
250   delete _button_press_unfocus;
251
252   delete _grip_focus;
253   delete _grip_unfocus;
254
255   delete _label_font;
256
257   delete _max_mask;
258   delete _icon_mask;
259   delete _alldesk_mask;
260   delete _close_mask;
261 }
262
263 }