all repos — openbox @ c487295c75094be3858b76b23fc9863ec9d46b59

openbox fork - make it a bit more like ryudo

part of a hardcoded style done
Dana Jansens danakj@orodu.net
commit

c487295c75094be3858b76b23fc9863ec9d46b59

parent

c8702ceb70886786fad53bddacfdf8b9ffc9c3f1

5 files changed, 213 insertions(+), 17 deletions(-)

jump to
M otk/rendercolor.ccotk/rendercolor.cc

@@ -30,6 +30,32 @@ _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; // try get a gc from the cache
M otk/rendercolor.hhotk/rendercolor.hh

@@ -11,6 +11,18 @@

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 @@ unsigned char _blue;

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; }
M otk/renderstyle.ccotk/renderstyle.cc

@@ -5,7 +5,105 @@ # include "../config.h"

#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() +{ +} }
M otk/renderstyle.hhotk/renderstyle.hh

@@ -4,6 +4,8 @@ #define __renderstyle_hh

#include "rendertexture.hh" +#include <string> + namespace otk { class RenderStyle {

@@ -16,6 +18,7 @@ };

private: int _screen; + std::string _file; RenderColor *_text_focus_color; RenderColor *_text_unfocus_color;

@@ -48,6 +51,50 @@ TextJustify _label_justify;

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; } }; }
M otk/rendertexture.hhotk/rendertexture.hh

@@ -67,29 +67,39 @@

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; }