]> git.lyx.org Git - lyx.git/blob - src/frontends/qt4/ColorCache.h
rename buffer parameter math_number_before to math_numbering_side
[lyx.git] / src / frontends / qt4 / ColorCache.h
1 // -*- C++ -*-
2 /**
3  * \file ColorCache.h
4  * This file is part of LyX, the document processor.
5  * Licence details can be found in the file COPYING.
6  *
7  * \author John Levon
8  *
9  * Full author contact details are available in file CREDITS.
10  */
11
12 #ifndef COLORCACHE_H
13 #define COLORCACHE_H
14
15 #include "Color.h"
16
17 #include <QColor>
18 #include <QPalette>
19
20 namespace lyx {
21
22 struct RGBColor;
23
24 /**
25  * Cache from Color to QColor.
26  */
27 class ColorCache
28 {
29 public:
30         ///
31         ColorCache() : initialized_(false) {}
32
33         /// get the given color (depends on LyXRC::use_system_color)
34         QColor get(Color const & color) const;
35
36         /// get the given color
37         QColor get(Color const & color, bool use_system_colors) const;
38
39         /// is this color replaced when LyXRC::use_system_color is true?
40         bool isSystem(ColorCode color) const;
41
42         /// change the undelying palette
43         void setPalette(QPalette const pal) { pal_ = pal; clear(); }
44
45         /// clear all colors
46         void clear() { initialized_ = false; }
47
48 private:
49         ///
50         void init();
51         ///
52         QColor lcolors_[Color_ignore + 1];
53         ///
54         bool initialized_;
55         ///
56         QPalette pal_;
57 };
58
59 ///
60 QColor const rgb2qcolor(RGBColor const &);
61
62 } // namespace lyx
63
64 #endif // COLORCACHE_H