1 // Scintilla source code edit control 2 /** @file ViewStyle.h 3 ** Store information on how the document is to be viewed. 4 **/ 5 // Copyright 1998-2001 by Neil Hodgson <neilh@scintilla.org> 6 // The License.txt file describes the conditions under which this software may be distributed. 7 8 #ifndef VIEWSTYLE_H 9 #define VIEWSTYLE_H 10 11 /** 12 */ 13 class MarginStyle { 14 public: 15 int style; 16 int width; 17 int mask; 18 bool sensitive; 19 MarginStyle(); 20 }; 21 22 /** 23 */ 24 class FontNames { 25 private: 26 char *names[STYLE_MAX + 1]; 27 int max; 28 29 public: 30 FontNames(); 31 ~FontNames(); 32 void Clear(); 33 const char *Save(const char *name); 34 }; 35 36 enum WhiteSpaceVisibility {wsInvisible=0, wsVisibleAlways=1, wsVisibleAfterIndent=2}; 37 38 /** 39 */ 40 class ViewStyle { 41 public: 42 FontNames fontNames; 43 Style styles[STYLE_MAX + 1]; 44 LineMarker markers[MARKER_MAX + 1]; 45 Indicator indicators[INDIC_MAX + 1]; 46 int lineHeight; 47 unsigned int maxAscent; 48 unsigned int maxDescent; 49 unsigned int aveCharWidth; 50 unsigned int spaceWidth; 51 bool selforeset; 52 ColourPair selforeground; 53 bool selbackset; 54 ColourPair selbackground; 55 ColourPair selbackground2; 56 int selAlpha; 57 bool whitespaceForegroundSet; 58 ColourPair whitespaceForeground; 59 bool whitespaceBackgroundSet; 60 ColourPair whitespaceBackground; 61 ColourPair selbar; 62 ColourPair selbarlight; 63 bool foldmarginColourSet; 64 ColourPair foldmarginColour; 65 bool foldmarginHighlightColourSet; 66 ColourPair foldmarginHighlightColour; 67 bool hotspotForegroundSet; 68 ColourPair hotspotForeground; 69 bool hotspotBackgroundSet; 70 ColourPair hotspotBackground; 71 bool hotspotUnderline; 72 bool hotspotSingleLine; 73 /// Margins are ordered: Line Numbers, Selection Margin, Spacing Margin 74 enum { margins=5 }; 75 int leftMarginWidth; ///< Spacing margin on left of text 76 int rightMarginWidth; ///< Spacing margin on left of text 77 bool symbolMargin; 78 int maskInLine; ///< Mask for markers to be put into text because there is nowhere for them to go in margin 79 MarginStyle ms[margins]; 80 int fixedColumnWidth; 81 int zoomLevel; 82 WhiteSpaceVisibility viewWhitespace; 83 bool viewIndentationGuides; 84 bool viewEOL; 85 bool showMarkedLines; 86 ColourPair caretcolour; 87 bool showCaretLineBackground; 88 ColourPair caretLineBackground; 89 int caretLineAlpha; 90 ColourPair edgecolour; 91 int edgeState; 92 int caretWidth; 93 bool someStylesProtected; 94 bool extraFontFlag; 95 96 ViewStyle(); 97 ViewStyle(const ViewStyle &source); 98 ~ViewStyle(); 99 void Init(); 100 void RefreshColourPalette(Palette &pal, bool want); 101 void Refresh(Surface &surface); 102 void ResetDefaultStyle(); 103 void ClearStyles(); 104 void SetStyleFontName(int styleIndex, const char *name); 105 bool ProtectionActive() const; 106 }; 107 108 #endif 109