From: Dana Jansens Date: Wed, 22 Jan 2003 20:14:28 +0000 (+0000) Subject: part of a hardcoded style done X-Git-Url: https://git.brokenzipper.com/gitweb?a=commitdiff_plain;h=c487295c75094be3858b76b23fc9863ec9d46b59;p=chaz%2Fopenbox part of a hardcoded style done --- diff --git a/otk/rendercolor.cc b/otk/rendercolor.cc index 1a95ded9..568e2c7c 100644 --- a/otk/rendercolor.cc +++ b/otk/rendercolor.cc @@ -29,6 +29,32 @@ RenderColor::RenderColor(int screen, unsigned char red, _green(green), _blue(blue), _gc(0) +{ + create(); +} + +RenderColor::RenderColor(int screen, unsigned char red, + unsigned char green, unsigned char blue) + : _screen(screen), + _red(red), + _green(green), + _blue(blue), + _gc(0) +{ + create(); +} + +RenderColor::RenderColor(int screen, RGB rgb) + : _screen(screen), + _red(rgb.r), + _green(rgb.g), + _blue(rgb.b), + _gc(0) +{ + create(); +} + +void RenderColor::create() { unsigned long color = _blue | _green << 8 | _red << 16; diff --git a/otk/rendercolor.hh b/otk/rendercolor.hh index fbfe2aef..6000646a 100644 --- a/otk/rendercolor.hh +++ b/otk/rendercolor.hh @@ -11,6 +11,18 @@ extern "C" { namespace otk { class RenderColor { + struct RGB { + int r; + int g; + int b; + RGB(int red, int green, int blue) : r(red), g(green), b(blue) {} + // color is in ARGB format + RGB(unsigned long color) + : r((color >> 16) & 0xff), + g((color >> 8) & 0xff), + b((color) & 0xff) {} + }; + struct CacheItem { GC gc; int count; @@ -25,12 +37,15 @@ class RenderColor { GC _gc; + void create(); + public: static void initialize(); static void destroy(); RenderColor(int screen, unsigned char red, unsigned char green, unsigned char blue); + RenderColor(int screen, RGB rgb); virtual ~RenderColor(); inline int screen() const { return _screen; } diff --git a/otk/renderstyle.cc b/otk/renderstyle.cc index 18c5324f..8803c779 100644 --- a/otk/renderstyle.cc +++ b/otk/renderstyle.cc @@ -5,7 +5,105 @@ #endif // HAVE_CONFIG_H #include "renderstyle.hh" +#include "rendercolor.hh" +#include "rendertexture.hh" namespace otk { +RenderStyle(int screen, const std::string &stylefile) + : _screen(screen), + _file(stylefile) +{ + _text_focus_color = new RenderColor(_screen, 0x272a2f); + _text_unfocus_color = new RenderColor(_screen, 0x676869); + + _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; + + _titlebar_focus = new RenderTexture(false, + RenderTexture::Flat, + RenderTexture::Bevel1, + false, + RenderTexture::Vertical, + false, + 0x858687, + 0x373a3f, + 0x0, + 0x0, + 0x0, + 0x0); + _titlebar_unfocus = new RenderTexture(false, + RenderTexture::Flat, + RenderTexture::Bevel1, + false, + RenderTexture::Vertical, + false, + 0x555657, + 0x171a1f, + 0x0, + 0x0, + 0x0, + 0x0); + + _label_focus = new RenderTexture(false, + RenderTexture::Flat, + RenderTexture::Bevel1, + true, + RenderTexture::Vertical, + false, + 0x858687, + 0x373a3f, + 0x0, + 0x0, + 0x181f24, + 0x0); + _label_unfocus = new RenderTexture(false, + RenderTexture::Sunken, + RenderTexture::Bevel1, + false, + RenderTexture::CrossDiagonal, + false, + 0x555657, + 0x272a2f, + //XXX, + //XXX, + 0x0, + 0x0); + + + _handle_focus = new RenderTexture(false, + RenderTexture::Flat, + RenderTexture::Bevel1, + true, + RenderTexture::Vertical, + false, + 0x858687, + 0x373a3f, + 0x0, + 0x0, + 0x0, + 0x0); + _handle_unfocus = new RenderTexture(false, + RenderTexture::Flat, + RenderTexture::Bevel1, + false, + RenderTexture::Vertical, + false, + 0x555657, + 0x171a1f, + 0x0, + 0x0, + 0x0, + 0x0); + +} + +virtual ~RenderStyle() +{ +} + } diff --git a/otk/renderstyle.hh b/otk/renderstyle.hh index 4385e6b9..0ecb8e4d 100644 --- a/otk/renderstyle.hh +++ b/otk/renderstyle.hh @@ -4,6 +4,8 @@ #include "rendertexture.hh" +#include + namespace otk { class RenderStyle { @@ -16,6 +18,7 @@ public: private: int _screen; + std::string _file; RenderColor *_text_focus_color; RenderColor *_text_unfocus_color; @@ -48,6 +51,50 @@ private: int _handle_width; int _bevel_width; + +public: + RenderStyle(int screen, const std::string &stylefile); + virtual ~RenderStyle(); + + inline RenderColor *textFocusColor() const { return _text_color_focus; } + inline RenderColor *textUnfocusColor() const { return _text_color_unfocus; } + + inline RenderColor *frameBorderColor() const { return _frame_border_color; } + inline int frameBorderWidth() const { return _frame_border_wirth; } + inline RenderColor *clientBorderFocusColor() const + { return _client_border_color_focus; } + inline RenderColor *clientBorderUnfocusColor() const + { return _client_border_color_unfocus; } + inline int clientBorderWidth() const { return _client_border_width; } + + inline RenderTexture *titlebarFocusBackground() const + { return _titlebar_focus; } + inline RenderTexture *titlebarUnfocusBackground() const + { return _titlebar_unfocus; } + + inline RenderTexture *labelFocusBackground() const { return _label_focus; } + inline RenderTexture *labelUnfocusBackground() const { return _label_unfocus;} + + inline RenderTexture *handleFocusBackground() const { _handle_focus; } + inline RenderTexture *handleUnfocusBackground() const { _handle_unfocus; } + + inline RenderTexture *buttonUnpressFocusBackground() const + { return _button_unpress_focus; } + inline RenderTexture *buttonUnpressUnfocusBackground() const + { return _button_unpress_unfocus; } + inline RenderTexture *buttonPressFocusBackground() const + { return _button_press_focus; } + inline RenderTexture *buttonPressUnfocusBackgrounf() const + { return _button_press_unfocus; } + + inline RenderTexture *gripdFocusBackground() const { return _grip_focus; } + inline RenderTexture *gripUnfocusBackground() const { return _grip_unfocus; } + + inline Font *labelFont() const { return _label_font; } + inline TextJustify labelTextJustify() const { return _label_justify; } + + inline int handleWidth() const { return _handle_width; } + inline int bevelWidth() const { return _bevel_width; } }; } diff --git a/otk/rendertexture.hh b/otk/rendertexture.hh index df38ddf6..6afd6209 100644 --- a/otk/rendertexture.hh +++ b/otk/rendertexture.hh @@ -67,29 +67,39 @@ private: public: RenderTexture(bool parent_relative, ReliefType relief, BevelType bevel, bool border, GradientType gradient, bool interlaced, - const RenderColor *color, const RenderColor *secondary_color, - const RenderColor *bevel_dark_color, - const RenderColor *bevel_light_color, - const RenderColor *border_color, - const RenderColor *interlace_color) + const RenderColor::RGB &color, + const RenderColor::RGB &secondary_color, + const RenderColor::RGB &bevel_dark_color, + const RenderColor::RGB &bevel_light_color, + const RenderColor::RGB &border_color, + const RenderColor::RGB &interlace_color) : _parent_relative(parent_relative), _relief(relief), _bevel(bevel), _border(border), _gradient(gradient), _interlaced(interlaced), - _color(color), - _secondary_color(secondary_color), - _bevel_dark_color(bevel_dark_color), - _bevel_light_color(bevel_light_color), - _border_color(border_color), - _interlace_color(interlace_color) - { - assert(_relief == Flat || (_bevel_dark_color && _bevel_light_color)); - assert(!_border || _border_color); - assert(!_interlaced || _interlace_color); - assert(_color); - } + _color(new RenderColor(color)), + _secondary_color(new RenderColor(secondary_color)), + _bevel_dark_color(new RenderColor(bevel_dark_color)), + _bevel_light_color(new RenderColor(bevel_light_color)), + _border_color(new RenderColor(border_color)), + _interlace_color(new RenderColor(interlace_color)) + { + assert(_relief == Flat || (_bevel_dark_color && _bevel_light_color)); + assert(!_border || _border_color); + assert(!_interlaced || _interlace_color); + assert(_color); + } + + virtual ~RenderTexture() { + delete _color; + delete _secondary_color; + delete _bevel_dark_color; + delete _bevel_light_color; + delete _border_color; + delete _interlace_color; + } //! If true, the texture is not rendered at all, so all options are ignored inline bool parentRelative() const { return _parent_relative; }