]> git.lyx.org Git - lyx.git/blobdiff - src/frontends/qt4/ColorCache.cpp
fix completion painting for RTL (inline completion and completion list)
[lyx.git] / src / frontends / qt4 / ColorCache.cpp
index 16c4497eab66ea07afa86bce84cb34be57b26724..69520fc7384ab3de81d6d820e77fa78022752d3d 100644 (file)
 
 #include <string>
 
+
 namespace lyx {
 
 void ColorCache::init()
 {
        for (int col = 0; col <= Color_ignore; ++col)
                lcolors_[col] = QColor(lcolor.getX11Name(ColorCode(col)).c_str());
+       initialized_ = true;
+}
+
+
+/// get the given color
+QColor ColorCache::get(ColorCode color) const
+{
+       if (!initialized_)
+               const_cast<ColorCache *>(this)->init();
+       if (color <= Color_ignore)
+               return lcolors_[color];
+       // used by branches
+       return QColor(lcolor.getX11Name(color).c_str()); 
 }