]> Dogcows Code - chaz/openbox/commitdiff
part of a hardcoded style done
authorDana Jansens <danakj@orodu.net>
Wed, 22 Jan 2003 20:14:28 +0000 (20:14 +0000)
committerDana Jansens <danakj@orodu.net>
Wed, 22 Jan 2003 20:14:28 +0000 (20:14 +0000)
otk/rendercolor.cc
otk/rendercolor.hh
otk/renderstyle.cc
otk/renderstyle.hh
otk/rendertexture.hh

index 1a95ded992c8063f5beb286271a6973695d81317..568e2c7c752e547ed2426b819b0da9188ed8a76e 100644 (file)
@@ -29,6 +29,32 @@ RenderColor::RenderColor(int screen, unsigned char red,
     _green(green),
     _blue(blue),
     _gc(0)
     _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;
   
 {
   unsigned long color = _blue | _green << 8 | _red << 16;
   
index fbfe2aef6e69a3eba6cc0768a1a6032091018cfa..6000646acd94c3bf6f703bf7f255f819109bcc4f 100644 (file)
@@ -11,6 +11,18 @@ extern "C" {
 namespace otk {
 
 class RenderColor {
 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;
   struct CacheItem {
     GC gc;
     int count;
@@ -25,12 +37,15 @@ class RenderColor {
 
   GC _gc;
 
 
   GC _gc;
 
+  void create();
+  
 public:
   static void initialize();
   static void destroy();
   
   RenderColor(int screen, unsigned char red,
              unsigned char green, unsigned char blue);
 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; }
   virtual ~RenderColor();
 
   inline int screen() const { return _screen; }
index 18c5324f18ecb528fea945969990f3cf3b38ba1d..8803c7797a786989c7ae493d609124eb520937ba 100644 (file)
@@ -5,7 +5,105 @@
 #endif // HAVE_CONFIG_H
 
 #include "renderstyle.hh"
 #endif // HAVE_CONFIG_H
 
 #include "renderstyle.hh"
+#include "rendercolor.hh"
+#include "rendertexture.hh"
 
 namespace otk {
 
 
 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()
+{
+}
+
 }
 }
index 4385e6b9af6f4eedc4f09f6a3e56652996557b30..0ecb8e4d974176318ce34814932a689fa9288d71 100644 (file)
@@ -4,6 +4,8 @@
 
 #include "rendertexture.hh"
 
 
 #include "rendertexture.hh"
 
+#include <string>
+
 namespace otk {
 
 class RenderStyle {
 namespace otk {
 
 class RenderStyle {
@@ -16,6 +18,7 @@ public:
 
 private:
   int _screen;
 
 private:
   int _screen;
+  std::string _file;
   
   RenderColor *_text_focus_color;
   RenderColor *_text_unfocus_color;
   
   RenderColor *_text_focus_color;
   RenderColor *_text_unfocus_color;
@@ -48,6 +51,50 @@ private:
 
   int _handle_width;
   int _bevel_width;
 
   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; }
 };
 
 }
 };
 
 }
index df38ddf679229415f2d5901876ccdd52a78dc87e..6afd6209d5ab8b655cc03aa3612a9816e48a5922 100644 (file)
@@ -67,29 +67,39 @@ private:
 public:
   RenderTexture(bool parent_relative, ReliefType relief, BevelType bevel,
                 bool border, GradientType gradient, bool interlaced,
 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),
     : _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; }
 
   //! If true, the texture is not rendered at all, so all options are ignored
   inline bool parentRelative() const { return _parent_relative; }
This page took 0.030746 seconds and 4 git commands to generate.