colorizr.h

Go to the documentation of this file.
00001 #ifndef GENERATING_DOXYGEN_OUTPUT
00002 /*********************************************************************
00003 
00004    Copyright (C) 2001 Smaller Animals Software, Inc.
00005 
00006    This software is provided 'as-is', without any express or implied
00007    warranty.  In no event will the authors be held liable for any damages
00008    arising from the use of this software.
00009 
00010    Permission is granted to anyone to use this software for any purpose,
00011    including commercial applications, and to alter it and redistribute it
00012    freely, subject to the following restrictions:
00013 
00014    1. The origin of this software must not be misrepresented; you must not
00015      claim that you wrote the original software. If you use this software
00016      in a product, an acknowledgment in the product documentation would be
00017      appreciated but is not required.
00018 
00019    2. Altered source versions must be plainly marked as such, and must not be
00020      misrepresented as being the original software.
00021 
00022    3. This notice may not be removed or altered from any source distribution.
00023 
00024    http://!www.smalleranimals.com
00025    smallest@smalleranimals.com
00026 
00027    --------
00028 
00029    This code is based, in part, on:
00030 
00031       "Syntax Coloring Text Edit Window Class " - Randy More (9, May 1998)
00032       http://!www.codeguru.com/editctrl/syntax_coloring.shtml
00033 
00034    Though probably only 5% of the original code remains.
00035 
00036  *
00037  * \if NODOC
00038  * $Log: colorizr.h_v $
00039  * Revision 1.3  2003/10/03 19:58:19  linux32build!build
00040  * Doxygen
00041  *
00042  * Revision 1.2  2003/09/15 13:49:32  fileserver!dwilliss
00043  * Doxygen
00044  *
00045  * \endif
00046 **********************************************************************/
00047 
00048 #ifndef INC_MGUI_COLORIZR_H
00049 #define INC_MGUI_COLORIZR_H
00050 
00051 #if !defined(_COLORIZE_) && defined(WIN32_MFC)
00052 #define _COLORIZE_
00053 
00054 #include <vector>
00055 using namespace std;
00056 
00057 #define KEYWORD_COLOR               RGB(0,0,160)
00058 #define NORMAL_COLOR                RGB(0,0,0)
00059 
00060 /*
00061    The base class only provides keyword coloring support.
00062 
00063    In this class, a "word" is a sequence of uninterrupted alpha-numeric
00064    characters. The keywords are loaded with the LoadKeywordFile member.
00065    One keyword per line in a plain text file.
00066 
00067    You can do more-complex processing here, or in a derived class.
00068 
00069 */
00070 
00071 class CColorizer
00072 {
00073 public:
00074    CColorizer();
00075 
00076    virtual ~CColorizer();
00077 
00078    //! called once per text line, when the line colors need updating.
00079    //! 'colors' will be filled with one COLORREF per text character.
00080    //!
00081    //! you will definitely rewrite this function (in a derived class, probably) for your own application.
00082    //! 
00083    virtual void SetLineColors(const CString &pString, vector<COLORREF>& colors); 
00084    
00085    //! load magic keywords.
00086    virtual void LoadKeywordFile(CString &keywordsFile);
00087 
00088    BOOL m_bCompareCase;
00089 
00090 protected:
00091 
00092    virtual BOOL IsKeyWord(CString & pTest);
00093    
00094    CStringList m_csaKeyWords;
00095 
00096 };
00097 
00098 #endif
00099 #endif // GENERATING_DOXYGEN_OUTPUT
00100 #endif  // INC_MGUI_COLORIZR_H

Generated on Wed May 31 15:26:43 2006 for TNTsdk by  doxygen 1.3.8-20040913