OSDN Git Service

compiler-calculated maximum value for `m_SourceDefs` (#966)
[winmerge-jp/winmerge-jp.git] / Externals / crystaledit / editlib / SyntaxColors.h
1 /** 
2  * @file  SyntaxColors.h
3  *
4  * @brief Declaration file for SyntaxColors class
5  */
6 // ID line follows -- this is updated by SVN
7 // $Id$
8
9 #pragma once
10
11 #include <array>
12
13 /** 
14  * @brief Indexes to color table
15  */
16 enum COLORINDEX
17 {
18         //
19         COLORINDEX_NONE,
20     //  Base colors
21     COLORINDEX_WHITESPACE,
22     COLORINDEX_BKGND,
23     COLORINDEX_NORMALTEXT,
24     COLORINDEX_SELMARGIN,
25     COLORINDEX_SELBKGND,
26     COLORINDEX_SELTEXT,
27     //  Syntax colors
28     COLORINDEX_KEYWORD,
29     COLORINDEX_FUNCNAME,
30     COLORINDEX_COMMENT,
31     COLORINDEX_NUMBER,
32     COLORINDEX_OPERATOR,
33     COLORINDEX_STRING,
34     COLORINDEX_PREPROCESSOR,
35     //
36     COLORINDEX_HIGHLIGHTBKGND1, // standard
37     COLORINDEX_HIGHLIGHTTEXT1,
38     COLORINDEX_HIGHLIGHTBKGND2, // changed
39     COLORINDEX_HIGHLIGHTTEXT2,
40     COLORINDEX_HIGHLIGHTBKGND3, //  not selected insert/delete
41         COLORINDEX_HIGHLIGHTBKGND4, // selected insert/delete
42         //
43         COLORINDEX_USER1,
44     COLORINDEX_USER2,
45     //
46     COLORINDEX_MARKERBKGND0,
47     COLORINDEX_MARKERBKGND1,
48     COLORINDEX_MARKERBKGND2,
49     COLORINDEX_MARKERBKGND3,
50     //  ...
51     //  Expandable: custom elements are allowed.
52         COLORINDEX_LAST, // Please keep this as last item (not counting masks or
53                          // other special values)
54     //
55     COLORINDEX_INTERMEDIATECOLOR = 0x40000000,
56     COLORINDEX_APPLYFORCE = 0x80000000,
57     COLORINDEX_MASK = 0xC0000000,
58 };
59
60 const int COLORINDEX_COUNT = COLORINDEX_LAST - COLORINDEX_NONE;
61
62 /** 
63  * @brief Wrapper for Syntax coloring colors.
64  *
65  * This class is wrapper for syntax colors. We can use this class in editor
66  * class and everywhere we need to refer to syntax colors. Class uses our
67  * normal options-manager for loading / saving values to storage.
68  *
69  * @todo We don't really need those arrays to store color values since we now
70  * use options-manager.
71  */
72 class SyntaxColors
73 {
74 public:
75         typedef unsigned COLORREF;
76         SyntaxColors();
77         explicit SyntaxColors(const SyntaxColors *pColors);
78         void Clone(const SyntaxColors *pColors);
79         COLORREF GetColor(unsigned index) const { return m_colors[index]; }
80         void SetColor(unsigned index, COLORREF color);
81         bool GetBold(unsigned index) const { return m_bolds[index]; }
82         void SetBold(unsigned index, bool bold);
83         void SetDefaults();
84         bool IsThemeableColorIndex(int nColorIndex) const;
85         bool GetSystemColorIndex(int nColorIndex, int * pSysIndex) const;
86
87 // Implementation data
88 private:
89         std::array<COLORREF, COLORINDEX_COUNT> m_colors; /**< Syntax highlight colors */
90         std::array<bool, COLORINDEX_COUNT> m_bolds; /**< Bold font enable/disable */
91 };