openbox/otk/renderstyle.cc

478 lines
18 KiB
C++
Raw Normal View History

2003-01-18 04:56:30 +00:00
// -*- mode: C++; indent-tabs-mode: nil; c-basic-offset: 2; -*-
#ifdef HAVE_CONFIG_H
# include "../config.h"
#endif // HAVE_CONFIG_H
#include "renderstyle.hh"
2003-01-23 00:08:50 +00:00
#include "display.hh"
#include "screeninfo.hh"
2003-01-18 04:56:30 +00:00
namespace otk {
2003-01-22 22:20:26 +00:00
RenderStyle::RenderStyle(int screen, const std::string &stylefile)
2003-01-22 20:14:28 +00:00
: _screen(screen),
_file(stylefile)
{
2003-01-29 23:16:11 +00:00
// pick one..
2003-02-02 22:54:52 +00:00
#define FIERON
//#define MERRY
2003-01-29 23:16:11 +00:00
#ifdef FIERON
_root_color = new RenderColor(_screen, 0x272a2f);
2003-01-22 22:20:26 +00:00
_text_color_focus = new RenderColor(_screen, 0x272a2f);
_text_color_unfocus = new RenderColor(_screen, 0x676869);
_button_color_focus = new RenderColor(_screen, 0x96ba86);
_button_color_unfocus = new RenderColor(_screen, 0x676869);
2003-01-22 20:14:28 +00:00
_frame_border_color = new RenderColor(_screen, 0x181f24);
_frame_border_width = 1;
_client_border_color_focus = new RenderColor(_screen, 0x858687);
_client_border_color_unfocus = new RenderColor(_screen, 0x555657);
_client_border_width = 1;
2003-01-22 22:20:26 +00:00
_titlebar_focus = new RenderTexture(_screen,
false,
2003-01-22 20:14:28 +00:00
RenderTexture::Flat,
RenderTexture::Bevel1,
false,
RenderTexture::Vertical,
false,
0x858687,
0x373a3f,
0x0,
0x0);
2003-01-22 22:20:26 +00:00
_titlebar_unfocus = new RenderTexture(_screen,
false,
2003-01-22 20:14:28 +00:00
RenderTexture::Flat,
RenderTexture::Bevel1,
false,
RenderTexture::Vertical,
false,
0x555657,
0x171a1f,
0x0,
0x0);
2003-01-22 22:20:26 +00:00
_label_focus = new RenderTexture(_screen,
false,
2003-01-22 20:14:28 +00:00
RenderTexture::Flat,
RenderTexture::Bevel1,
true,
RenderTexture::Vertical,
false,
2003-01-23 02:08:04 +00:00
0x96ba86,
0x5a724c,
2003-01-22 20:14:28 +00:00
0x181f24,
0x0);
2003-01-22 22:20:26 +00:00
_label_unfocus = new RenderTexture(_screen,
false,
2003-01-22 20:14:28 +00:00
RenderTexture::Sunken,
RenderTexture::Bevel1,
false,
RenderTexture::CrossDiagonal,
false,
0x555657,
0x272a2f,
0x0,
0x0);
2003-01-22 22:20:26 +00:00
_handle_focus = new RenderTexture(_screen,
false,
2003-01-22 20:14:28 +00:00
RenderTexture::Flat,
RenderTexture::Bevel1,
2003-01-23 04:21:25 +00:00
false,
2003-01-22 20:14:28 +00:00
RenderTexture::Vertical,
false,
0x858687,
0x373a3f,
0x0,
0x0);
2003-01-22 22:20:26 +00:00
_handle_unfocus = new RenderTexture(_screen,
false,
2003-01-22 20:14:28 +00:00
RenderTexture::Flat,
RenderTexture::Bevel1,
false,
RenderTexture::Vertical,
false,
0x555657,
0x171a1f,
0x0,
0x0);
2003-01-22 22:20:26 +00:00
_button_unpress_focus = new RenderTexture(_screen,
false,
RenderTexture::Raised,
RenderTexture::Bevel2,
false,
RenderTexture::CrossDiagonal,
false,
0x858687,
0x272a2f,
0x0,
0x0);
_button_unpress_unfocus = new RenderTexture(_screen,
false,
RenderTexture::Raised,
RenderTexture::Bevel2,
false,
RenderTexture::CrossDiagonal,
false,
0x555657,
0x171a1f,
0x0,
0x0);
_button_press_focus = new RenderTexture(_screen,
false,
RenderTexture::Sunken,
RenderTexture::Bevel2,
false,
RenderTexture::CrossDiagonal,
false,
0x96ba86,
0x5a724c,
0x0,
0x0);
_button_press_unfocus = new RenderTexture(_screen,
false,
RenderTexture::Sunken,
RenderTexture::Bevel2,
false,
RenderTexture::CrossDiagonal,
false,
0x555657,
0x171a1f,
0x0,
0x0);
_grip_focus = new RenderTexture(_screen,
false,
RenderTexture::Flat,
RenderTexture::Bevel1,
false,
RenderTexture::Vertical,
false,
0x96ba86,
0x5a724c,
0x0,
0x0);
_grip_unfocus = new RenderTexture(_screen,
false,
RenderTexture::Flat,
RenderTexture::Bevel1,
false,
RenderTexture::Vertical,
false,
0x555657,
0x171a1f,
0x0,
0x0);
2003-01-24 05:23:46 +00:00
_label_font = new Font(_screen, "Arial,Sans-9:bold", true, 1, 0x40);
_label_justify = RightJustify;
2003-01-23 00:08:50 +00:00
_max_mask = new PixmapMask();
_max_mask->w = _max_mask->h = 8;
{
2003-01-23 03:04:43 +00:00
//char data[] = { 0x7e, 0xff, 0xc3, 0xc3, 0xc3, 0xc3, 0xff, 0x7e };
char data [] = {0x00, 0x00, 0x18, 0x3c, 0x66, 0x42, 0x00, 0x00 };
2003-01-23 02:08:04 +00:00
_max_mask->mask =
2003-01-23 01:21:39 +00:00
XCreateBitmapFromData(**display,
display->screenInfo(_screen)->rootWindow(),
data, 8, 8);
2003-01-23 00:08:50 +00:00
}
_icon_mask = new PixmapMask();
_icon_mask->w = _icon_mask->h = 8;
{
2003-01-23 03:04:43 +00:00
//char data[] = { 0x00, 0x00, 0xc3, 0xe7, 0x7e, 0x3c, 0x18, 0x00 };
char data[] = { 0x00, 0x00, 0x42, 0x66, 0x3c, 0x18, 0x00, 0x00 };
2003-01-23 02:08:04 +00:00
_icon_mask->mask =
2003-01-23 01:21:39 +00:00
XCreateBitmapFromData(**display,
display->screenInfo(_screen)->rootWindow(),
2003-01-23 03:04:43 +00:00
data, 8, 8);
2003-01-23 00:08:50 +00:00
}
_alldesk_mask = new PixmapMask();
_alldesk_mask->w = _alldesk_mask->h = 8;
2003-01-23 00:08:50 +00:00
{
2003-01-23 03:04:43 +00:00
//char data[] = { 0x00, 0x00, 0x18, 0x3c, 0x3c, 0x18, 0x00, 0x00 };
char data[] = { 0x00, 0x66, 0x66, 0x00, 0x00, 0x66, 0x66, 0x00 };
_alldesk_mask->mask =
2003-01-23 01:21:39 +00:00
XCreateBitmapFromData(**display,
display->screenInfo(_screen)->rootWindow(),
data, 8, 8);
2003-01-23 00:08:50 +00:00
}
_close_mask = new PixmapMask();
_close_mask->w = _close_mask->h = 8;
{
2003-01-23 03:04:43 +00:00
//char data[] = { 0xc3, 0xe7, 0x7e, 0x3c, 0x3c, 0x7e, 0xe7, 0xc3 };
char data[] = { 0x00, 0xc3, 0x66, 0x3c, 0x3c, 0x66, 0xc3, 0x00 };
2003-01-23 02:08:04 +00:00
_close_mask->mask =
2003-01-23 01:21:39 +00:00
XCreateBitmapFromData(**display,
display->screenInfo(_screen)->rootWindow(),
data, 8, 8);
2003-01-23 00:08:50 +00:00
}
_bevel_width = 1;
_handle_width = 4;
2003-01-29 23:16:11 +00:00
#else
# ifdef MERRY
_root_color = new RenderColor(_screen, 0x7b756a);
_text_color_focus = new RenderColor(_screen, 0xffffff);
_text_color_unfocus = new RenderColor(_screen, 0xffffff);
_button_color_focus = new RenderColor(_screen, 0x222222);
_button_color_unfocus = new RenderColor(_screen, 0x333333);
_frame_border_color = new RenderColor(_screen, 0x222222);
_frame_border_width = 1;
_client_border_color_focus = new RenderColor(_screen, 0x858687);
_client_border_color_unfocus = new RenderColor(_screen, 0x555657);
_client_border_width = 0;
_titlebar_focus = new RenderTexture(_screen,
false,
RenderTexture::Flat,
RenderTexture::Bevel1,
false,
RenderTexture::Solid,
false,
0xe6e6e6,
0xe6e6e6,
0x0,
0x0);
_titlebar_unfocus = new RenderTexture(_screen,
false,
RenderTexture::Flat,
RenderTexture::Bevel1,
false,
2003-02-02 22:54:52 +00:00
RenderTexture::Vertical,
2003-01-29 23:16:11 +00:00
false,
0xe6e6e6,
2003-02-02 22:54:52 +00:00
0xd9d9d9,
2003-01-29 23:16:11 +00:00
0x0,
0x0);
_label_focus = new RenderTexture(_screen,
false,
RenderTexture::Flat,
RenderTexture::Bevel1,
true,
2003-02-02 22:54:52 +00:00
RenderTexture::Vertical,
2003-01-29 23:16:11 +00:00
false,
//0x6a6973,
//0x6a6973,
0x4c59a6,
2003-02-02 22:54:52 +00:00
0x5a6dbd,
2003-01-29 23:16:11 +00:00
0x222222,
0x0);
2003-02-02 22:54:52 +00:00
//urg this ain't so hot
_label_unfocus = new RenderTexture(_screen,
2003-01-29 23:16:11 +00:00
false,
RenderTexture::Flat,
RenderTexture::Bevel1,
true,
2003-02-02 22:54:52 +00:00
RenderTexture::Vertical,
2003-01-29 23:16:11 +00:00
false,
2003-02-02 22:54:52 +00:00
0xb4b2ad,
0xc3c1bc,
0x6a696a,
2003-01-29 23:16:11 +00:00
0x0);
_handle_focus = new RenderTexture(_screen,
false,
RenderTexture::Flat,
RenderTexture::Bevel1,
false,
2003-02-02 22:54:52 +00:00
RenderTexture::Vertical,
2003-01-29 23:16:11 +00:00
false,
0xe6e6e6,
2003-02-02 22:54:52 +00:00
0xd9d9d9,
2003-01-29 23:16:11 +00:00
0x0,
0x0);
_handle_unfocus = new RenderTexture(_screen,
false,
RenderTexture::Flat,
RenderTexture::Bevel1,
false,
RenderTexture::Solid,
false,
0xe6e6e6,
0xe6e6e6,
0x0,
0x0);
_button_unpress_focus = new RenderTexture(_screen,
false,
RenderTexture::Flat,
RenderTexture::Bevel1,
false,
RenderTexture::Solid,
false,
0xe6e6e6,
0xe6e6e6,
0x0,
0x0);
_button_unpress_unfocus = new RenderTexture(_screen,
false,
RenderTexture::Flat,
RenderTexture::Bevel1,
false,
RenderTexture::Solid,
false,
0xe6e6e6,
0xe6e6e6,
0x0,
0x0);
_button_press_focus = new RenderTexture(_screen,
false,
RenderTexture::Sunken,
2003-02-02 22:54:52 +00:00
RenderTexture::Bevel2,
2003-01-29 23:16:11 +00:00
false,
2003-02-02 22:54:52 +00:00
RenderTexture::Vertical,
2003-01-29 23:16:11 +00:00
false,
0xe6e6e6,
0xe6e6e6,
0x0,
0x0);
_button_press_unfocus = new RenderTexture(_screen,
false,
RenderTexture::Sunken,
2003-02-02 22:54:52 +00:00
RenderTexture::Bevel2,
2003-01-29 23:16:11 +00:00
false,
2003-02-02 22:54:52 +00:00
RenderTexture::Vertical,
2003-01-29 23:16:11 +00:00
false,
0xe6e6e6,
0xe6e6e6,
0x0,
0x0);
_grip_focus = new RenderTexture(_screen,
false,
RenderTexture::Flat,
RenderTexture::Bevel1,
false,
2003-02-02 22:54:52 +00:00
RenderTexture::Vertical,
2003-01-29 23:16:11 +00:00
false,
0xe6e6e6,
2003-02-02 22:54:52 +00:00
0xd9d9d9,
2003-01-29 23:16:11 +00:00
0x0,
0x0);
_grip_unfocus = new RenderTexture(_screen,
false,
RenderTexture::Flat,
RenderTexture::Bevel1,
false,
RenderTexture::Solid,
false,
0xe6e6e6,
0xe6e6e6,
0x0,
0x0);
2003-01-30 23:06:24 +00:00
_label_font = new Font(_screen, "Arial,Sans-8", true, 1, 0x3e);
2003-01-29 23:16:11 +00:00
_label_justify = CenterJustify;
_max_mask = new PixmapMask();
_max_mask->w = _max_mask->h = 7;
{
char data [] = {0x7c, 0x44, 0x47, 0x47, 0x7f, 0x1f, 0x1f };
_max_mask->mask =
XCreateBitmapFromData(**display,
display->screenInfo(_screen)->rootWindow(),
data, 7, 7);
}
_icon_mask = new PixmapMask();
_icon_mask->w = _icon_mask->h = 7;
{
char data[] = {0x00, 0x00, 0x00, 0x00, 0x3e, 0x3e, 0x3e };
_icon_mask->mask =
XCreateBitmapFromData(**display,
display->screenInfo(_screen)->rootWindow(),
data, 7, 7);
}
_alldesk_mask = new PixmapMask();
_alldesk_mask->w = _alldesk_mask->h = 7;
{
char data[] = {0x00, 0x36, 0x36, 0x00, 0x36, 0x36, 0x00 };
_alldesk_mask->mask =
XCreateBitmapFromData(**display,
display->screenInfo(_screen)->rootWindow(),
data, 7, 7);
}
_close_mask = new PixmapMask();
_close_mask->w = _close_mask->h = 7;
{
char data[] = { 0x22, 0x77, 0x3e, 0x1c, 0x3e, 0x77, 0x22 };
_close_mask->mask =
XCreateBitmapFromData(**display,
display->screenInfo(_screen)->rootWindow(),
data, 7, 7);
}
_bevel_width = 1;
_handle_width = 3;
# else
# error 1
# endif
#endif
2003-01-22 20:14:28 +00:00
}
2003-01-22 22:20:26 +00:00
RenderStyle::~RenderStyle()
2003-01-22 20:14:28 +00:00
{
delete _root_color;
2003-01-22 22:20:26 +00:00
delete _text_color_focus;
delete _text_color_unfocus;
delete _button_color_focus;
delete _button_color_unfocus;
delete _frame_border_color;
delete _client_border_color_focus;
delete _client_border_color_unfocus;
delete _titlebar_focus;
delete _titlebar_unfocus;
delete _label_focus;
delete _label_unfocus;
delete _handle_focus;
delete _handle_unfocus;
delete _button_unpress_focus;
delete _button_unpress_unfocus;
delete _button_press_focus;
delete _button_press_unfocus;
delete _grip_focus;
delete _grip_unfocus;
delete _label_font;
2003-01-23 00:08:50 +00:00
delete _max_mask;
delete _icon_mask;
delete _alldesk_mask;
2003-01-23 00:08:50 +00:00
delete _close_mask;
2003-01-22 20:14:28 +00:00
}
2003-01-18 04:56:30 +00:00
}