Back
1 //------------------------------------------------------------------------------
2 // Module: ItemStyle.h //
3 // //
4 // Class TItemStyle which represents a syntax highlighting style //
5 // //
6 // Copyright (c) 2000-2004 by Lars Haendel //
7 // Home: http://www.newty.de //
8 // //
9 // This program is free software; you can redistribute it and/or modify //
10 // it under the terms of the GNU General Public License as published by //
11 // the Free Software Foundation as version 2 of the License. //
12 // //
13 // This program is distributed in the hope that it will be useful, //
14 // but WITHOUT ANY WARRANTY; without even the implied warranty of //
15 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the //
16 // GNU General Public License for more details. //
17 // //
18 // You should have received a copy of the GNU General Public License //
19 // along with this program; if not, write to the Free Software //
20 // Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. //
21 // //
22 //------------------------------------------------------------------------------
23
24
25 #ifndef ItemStyleH
26 #define ItemStyleH
27
28 #include <stdio> // due to: sprintf()
29
30 #include "defines.h" // general defines
31
32
33 #define MAX_TYPE_LEN 32
34 #define MAX_STYLE_NAME_LEN 256
35
36
37 //----------------------------------------------------------------------------------------------------------------------
38 // class for a syntax highlighting style
39 static const nItemType = 13; // number of known code item types
40 class TItemStyle
41 {
42 public:
43
44 // constructor
45 TItemStyle();
46
47
48 char szName[MAX_STYLE_NAME_LEN]; // name of the style
49
50 // styles which are defined for each code item
51 char szColor [nItemType][16];
52 bool f_Bold [nItemType];
53 bool f_Italic[nItemType];
54
55
56 // known code items:
57 enum ItemType { Bkgnd=0, Comment=1, Keyword=2, Identifier=3, Symbol=4,
58 String=5, Number=6, Character=7, Preproc=8,
59 Custom1=9, Custom2=10, Custom3=11, Custom4=12 };
60 };
61
62 //----------------------------------------------------------------------------------------------------------------------
63 // utility functions
64
65 // return i'th item's name
66 const char* GetItemName(const TItemStyle::ItemType& type);
67
68 // Try to identify string as valid item name. Return index if match found, '-1' otherwise.
69 int IdentifyItemName(const char*const& szString);
70
71 #endif
Top |