]> git.lyx.org Git - lyx.git/blobdiff - src/frontends/qt4/ColorCache.h
Fix the tab ordering of GuiDocument components.
[lyx.git] / src / frontends / qt4 / ColorCache.h
index 05dabea4b04e9c0b7316ba61f3ae3de2101dcaa5..e1ad6aed5eaea665ca46ec07f6d2bb0b977cc111 100644 (file)
 #include "Color.h"
 
 #include <QColor>
-
-#include <map>
+#include <QPalette>
 
 namespace lyx {
 
 struct RGBColor;
 
-
-// FIXME: use a fixed-size array not a map ?
-
 /**
  * Cache from Color to QColor.
  */
-class ColorCache {
+class ColorCache
+{
 public:
-       ColorCache() {}
+       ///
+       ColorCache() : initialized_(false) {}
+
+       /// get the given color (depends on LyXRC::use_system_color)
+       QColor get(Color const & color) const;
 
        /// get the given color
-       QColor const & get(Color_color color) const;
+       QColor get(Color const & color, bool use_system_colors) const;
+
+       /// is this color replaced when LyXRC::use_system_color is true?
+       bool isSystem(ColorCode color) const;
+
+       /// change the undelying palette
+       void setPalette(QPalette const pal) { pal_ = pal; clear(); }
 
        /// clear all colors
-       void clear();
+       void clear() { initialized_ = false; }
 
 private:
-       typedef std::map<Color_color, QColor> lcolor_map;
-
-       mutable lcolor_map colormap;
+       ///
+       void init();
+       ///
+       QColor lcolors_[Color_ignore + 1];
+       ///
+       bool initialized_;
+       ///
+       QPalette pal_;
 };
 
 ///