]> Dogcows Code - chaz/openbox/blobdiff - otk/renderstyle.cc
render images properly, minus the scaling
[chaz/openbox] / otk / renderstyle.cc
index e81bf685c9daa33de94814b1096470fc96056dc8..d45e421265666d323018284a98f897e3bd7d937f 100644 (file)
@@ -1,22 +1,61 @@
 // -*- mode: C++; indent-tabs-mode: nil; c-basic-offset: 2; -*-
 
-#ifdef    HAVE_CONFIG_H
-#  include "../config.h"
-#endif // HAVE_CONFIG_H
+#include "config.h"
 
 #include "renderstyle.hh"
 #include "display.hh"
 #include "screeninfo.hh"
 
+#include <cassert>
+
 namespace otk {
 
+RenderStyle **RenderStyle::_styles = 0;
+std::list<StyleNotify*> *RenderStyle::_notifies = 0;
+
+void RenderStyle::initialize()
+{
+  int screens = ScreenCount(**display);
+  _styles = new RenderStyle*[screens];
+  for (int i = 0; i < screens; ++i)
+    _styles[i] = new RenderStyle(i, ""); // XXX get a path
+  _notifies = new std::list<StyleNotify*>[screens];
+}
+
+void RenderStyle::destroy()
+{
+  int screens = ScreenCount(**display);
+  for (int i = 0; i < screens; ++i)
+    delete _styles[i];
+  delete [] _styles;
+  delete [] _notifies;
+}
+
+void RenderStyle::registerNotify(int screen, StyleNotify *n)
+{
+  assert(screen >= 0 && screen < ScreenCount(**display));
+  _notifies[screen].push_back(n);
+}
+
+void RenderStyle::unregisterNotify(int screen, StyleNotify *n)
+{
+  assert(screen >= 0 && screen < ScreenCount(**display));
+  _notifies[screen].remove(n);
+}
+
+RenderStyle *RenderStyle::style(int screen)
+{
+  assert(screen >= 0 && screen < ScreenCount(**display));
+  return _styles[screen];
+}
+
 RenderStyle::RenderStyle(int screen, const std::string &stylefile)
   : _screen(screen),
     _file(stylefile)
 {
 // pick one..
-//#define FIERON
-#define MERRY
+#define FIERON
+//#define MERRY
 
 #ifdef FIERON
   _root_color = new RenderColor(_screen, 0x272a2f);
@@ -175,7 +214,7 @@ RenderStyle::RenderStyle(int screen, const std::string &stylefile)
                                     0x0);
 
   _label_font = new Font(_screen, "Arial,Sans-9:bold", true, 1, 0x40);
-  _label_justify = RightJustify;
+  _label_justify = RightBottomJustify;
 
   _max_mask = new PixmapMask();
   _max_mask->w = _max_mask->h = 8;
@@ -256,10 +295,10 @@ RenderStyle::RenderStyle(int screen, const std::string &stylefile)
                                         RenderTexture::Flat,
                                         RenderTexture::Bevel1,
                                         false,
-                                        RenderTexture::Solid,
+                                        RenderTexture::Vertical,
                                         false,
                                         0xe6e6e6,
-                                        0xe6e6e6,
+                                        0xd9d9d9,
                                         0x0,
                                         0x0);
 
@@ -268,24 +307,25 @@ RenderStyle::RenderStyle(int screen, const std::string &stylefile)
                                    RenderTexture::Flat,
                                    RenderTexture::Bevel1,
                                    true,
-                                   RenderTexture::Solid,
+                                   RenderTexture::Vertical,
                                    false,
                                    //0x6a6973,
                                    //0x6a6973,
                                    0x4c59a6,
-                                  0x4c59a6,
+                                  0x5a6dbd,
                                   0x222222,
                                    0x0);
-  _label_unfocus = new RenderTexture(_screen,
+  //urg this ain't so hot
+_label_unfocus = new RenderTexture(_screen,
                                        false,
                                    RenderTexture::Flat,
                                    RenderTexture::Bevel1,
                                    true,
-                                   RenderTexture::Solid,
+                                   RenderTexture::Vertical,
                                    false,
-                                   0xcdcac7,
-                                   0xcdcac7,
-                               0xb0ada9,
+                                   0xb4b2ad,
+                                   0xc3c1bc,
+                               0x6a696a,
                                    0x0);
 
 
@@ -294,10 +334,10 @@ RenderStyle::RenderStyle(int screen, const std::string &stylefile)
                                     RenderTexture::Flat,
                                     RenderTexture::Bevel1,
                                     false,
-                                    RenderTexture::Solid,
+                                    RenderTexture::Vertical,
                                     false,
                                     0xe6e6e6,
-                                        0xe6e6e6,
+                                        0xd9d9d9,
                                     0x0,
                                     0x0);
   _handle_unfocus = new RenderTexture(_screen,
@@ -339,9 +379,9 @@ RenderStyle::RenderStyle(int screen, const std::string &stylefile)
   _button_press_focus = new RenderTexture(_screen,
                                           false,
                                             RenderTexture::Sunken,
-                                            RenderTexture::Bevel1,
+                                            RenderTexture::Bevel2,
                                           false,
-                                          RenderTexture::Solid,
+                                          RenderTexture::Vertical,
                                           false,
                                           0xe6e6e6,
                                           0xe6e6e6,
@@ -350,9 +390,9 @@ RenderStyle::RenderStyle(int screen, const std::string &stylefile)
   _button_press_unfocus = new RenderTexture(_screen,
                                             false,
                                               RenderTexture::Sunken,
-                                            RenderTexture::Bevel1,
+                                            RenderTexture::Bevel2,
                                             false,
-                                            RenderTexture::Solid,
+                                            RenderTexture::Vertical,
                                             false,
                                               0xe6e6e6,
                                         0xe6e6e6,
@@ -364,10 +404,10 @@ RenderStyle::RenderStyle(int screen, const std::string &stylefile)
                                   RenderTexture::Flat,
                                   RenderTexture::Bevel1,
                                   false,
-                                  RenderTexture::Solid,
+                                  RenderTexture::Vertical,
                                   false,
                                     0xe6e6e6,
-                                        0xe6e6e6,
+                                        0xd9d9d9,
                                   0x0,
                                   0x0);
   _grip_unfocus = new RenderTexture(_screen,
@@ -382,13 +422,12 @@ RenderStyle::RenderStyle(int screen, const std::string &stylefile)
                                     0x0,
                                     0x0);
 
-  _label_font = new Font(_screen, "Arial,Sans-9", true, 1, 0x3e);
+  _label_font = new Font(_screen, "Arial,Sans-8", true, 1, 0x3e);
   _label_justify = CenterJustify;
 
   _max_mask = new PixmapMask();
   _max_mask->w = _max_mask->h = 7;
   {
-    //char data[] = { 0x7e, 0xff, 0xc3, 0xc3, 0xc3, 0xc3, 0xff, 0x7e };
     char data []  = {0x7c, 0x44, 0x47, 0x47, 0x7f, 0x1f, 0x1f  };
     _max_mask->mask =
       XCreateBitmapFromData(**display,
@@ -399,7 +438,6 @@ RenderStyle::RenderStyle(int screen, const std::string &stylefile)
   _icon_mask = new PixmapMask();
   _icon_mask->w = _icon_mask->h = 7;
   {
-    //char data[] = { 0x00, 0x00, 0xc3, 0xe7, 0x7e, 0x3c, 0x18, 0x00 };
     char data[] = {0x00, 0x00, 0x00, 0x00, 0x3e, 0x3e, 0x3e };
     _icon_mask->mask =
       XCreateBitmapFromData(**display,
@@ -410,7 +448,6 @@ RenderStyle::RenderStyle(int screen, const std::string &stylefile)
   _alldesk_mask = new PixmapMask();
   _alldesk_mask->w = _alldesk_mask->h = 7;
   {
-    //char data[] = { 0x00, 0x00, 0x18, 0x3c, 0x3c, 0x18, 0x00, 0x00 };
     char data[] = {0x00, 0x36, 0x36, 0x00, 0x36, 0x36, 0x00 };
     _alldesk_mask->mask =
       XCreateBitmapFromData(**display,
@@ -421,7 +458,6 @@ RenderStyle::RenderStyle(int screen, const std::string &stylefile)
   _close_mask = new PixmapMask();
   _close_mask->w = _close_mask->h = 7;
   {
-    //char data[] = { 0xc3, 0xe7, 0x7e, 0x3c, 0x3c, 0x7e, 0xe7, 0xc3 };
     char data[] = {  0x22, 0x77, 0x3e, 0x1c, 0x3e, 0x77, 0x22 };
     _close_mask->mask =
       XCreateBitmapFromData(**display,
This page took 0.027355 seconds and 4 git commands to generate.