mwhighlighter.hpp

来自「本人买的<<VC++项目开发实例>>源代码配套光盘.」· HPP 代码 · 共 167 行

HPP
167
字号
// Borland C++ Builder
// Copyright (c) 1995, 1999 by Borland International
// All rights reserved

// (DO NOT EDIT: machine generated header) 'mwHighlighter.pas' rev: 5.00

#ifndef mwHighlighterHPP
#define mwHighlighterHPP

#pragma delphiheader begin
#pragma option push -w-
#pragma option push -Vx
#include <mwSupportClasses.hpp>	// Pascal unit
#include <Registry.hpp>	// Pascal unit
#include <Graphics.hpp>	// Pascal unit
#include <Classes.hpp>	// Pascal unit
#include <SysUtils.hpp>	// Pascal unit
#include <Windows.hpp>	// Pascal unit
#include <SysInit.hpp>	// Pascal unit
#include <System.hpp>	// Pascal unit

//-- user supplied -----------------------------------------------------------

namespace Mwhighlighter
{
//-- type declarations -------------------------------------------------------
class DELPHICLASS TBetterRegistry;
class PASCALIMPLEMENTATION TBetterRegistry : public Registry::TRegistry 
{
	typedef Registry::TRegistry inherited;
	
public:
	#pragma option push -w-inl
	/* TRegistry.Create */ inline __fastcall TBetterRegistry(void)/* overload */ : Registry::TRegistry(
		) { }
	#pragma option pop
	#pragma option push -w-inl
	/* TRegistry.Destroy */ inline __fastcall virtual ~TBetterRegistry(void) { }
	#pragma option pop
	
};


class DELPHICLASS TmwHighLightAttributes;
class PASCALIMPLEMENTATION TmwHighLightAttributes : public Classes::TPersistent 
{
	typedef Classes::TPersistent inherited;
	
private:
	Graphics::TColor fBackground;
	Graphics::TColor fForeground;
	Graphics::TFontStyles fStyle;
	Classes::TNotifyEvent fOnChange;
	AnsiString fName;
	void __fastcall SetBackground(Graphics::TColor Value);
	void __fastcall SetForeground(Graphics::TColor Value);
	void __fastcall SetStyle(Graphics::TFontStyles Value);
	int __fastcall GetStyleFromInt(void);
	void __fastcall SetStyleFromInt(const int Value);
	
public:
	virtual void __fastcall Assign(Classes::TPersistent* Source);
	virtual bool __fastcall LoadFromBorlandRegistry(HKEY rootKey, AnsiString attrKey, AnsiString attrName
		, bool oldStyle);
	bool __fastcall LoadFromRegistry(TBetterRegistry* Reg);
	bool __fastcall SaveToRegistry(TBetterRegistry* Reg);
	__property int IntegerStyle = {read=GetStyleFromInt, write=SetStyleFromInt, nodefault};
	__property AnsiString Name = {read=fName};
	__property Classes::TNotifyEvent OnChange = {read=fOnChange, write=fOnChange};
	
__published:
	__fastcall TmwHighLightAttributes(AnsiString attribName);
	__property Graphics::TColor Background = {read=fBackground, write=SetBackground, nodefault};
	__property Graphics::TColor Foreground = {read=fForeground, write=SetForeground, nodefault};
	__property Graphics::TFontStyles Style = {read=fStyle, write=SetStyle, nodefault};
public:
	#pragma option push -w-inl
	/* TPersistent.Destroy */ inline __fastcall virtual ~TmwHighLightAttributes(void) { }
	#pragma option pop
	
};


typedef Set<char, 0, 255>  TIdentChars;

#pragma option push -b-
enum THighlighterCapabilities { hcUserSettings, hcRegistry, hcExportable };
#pragma option pop

typedef Set<THighlighterCapabilities, hcUserSettings, hcExportable>  THighlighterCapability;

typedef void __fastcall (__closure *TTokenEvent)(System::TObject* Sender, int TokenKind, AnsiString 
	TokenText, int LineNo);

class DELPHICLASS TmwCustomHighLighter;
class PASCALIMPLEMENTATION TmwCustomHighLighter : public Classes::TComponent 
{
	typedef Classes::TComponent inherited;
	
private:
	Classes::TStringList* fAttributes;
	Mwsupportclasses::TmwNotifyEventChain* fAttrChangeHooks;
	TTokenEvent fOnToken;
	Classes::TComponent* fExporter;
	
protected:
	AnsiString fDefaultFilter;
	virtual TIdentChars __fastcall GetIdentChars();
	virtual AnsiString __fastcall GetLanguageName(void) = 0 ;
	void __fastcall AddAttribute(TmwHighLightAttributes* AAttrib);
	void __fastcall DefHighlightChange(System::TObject* Sender);
	virtual int __fastcall GetAttribCount(void);
	virtual TmwHighLightAttributes* __fastcall GetAttribute(int idx);
	void __fastcall SetAttributesOnChange(Classes::TNotifyEvent AEvent);
	virtual THighlighterCapability __fastcall GetCapability(void);
	virtual AnsiString __fastcall GetDefaultFilter();
	virtual void __fastcall SetDefaultFilter(AnsiString Value);
	
public:
	__fastcall virtual TmwCustomHighLighter(Classes::TComponent* AOwner);
	__fastcall virtual ~TmwCustomHighLighter(void);
	virtual void __fastcall ExportNext(void) = 0 ;
	virtual bool __fastcall GetEol(void) = 0 ;
	virtual void * __fastcall GetRange(void) = 0 ;
	virtual AnsiString __fastcall GetToken(void) = 0 ;
	virtual TmwHighLightAttributes* __fastcall GetTokenAttribute(void) = 0 ;
	virtual int __fastcall GetTokenKind(void) = 0 ;
	virtual int __fastcall GetTokenPos(void) = 0 ;
	virtual void __fastcall Next(void) = 0 ;
	void __fastcall NextToEol(void);
	void __fastcall ScanAllLineTokens(const AnsiString Value, int LineNumber);
	virtual void __fastcall SetLine(AnsiString NewValue, int LineNumber) = 0 ;
	virtual void __fastcall SetLineForExport(AnsiString NewValue) = 0 ;
	virtual void __fastcall SetRange(void * Value) = 0 ;
	virtual void __fastcall ReSetRange(void) = 0 ;
	virtual bool __fastcall UseUserSettings(int settingIndex);
	virtual void __fastcall EnumUserSettings(Classes::TStrings* settings);
	virtual bool __fastcall LoadFromRegistry(HKEY RootKey, AnsiString Key);
	virtual bool __fastcall SaveToRegistry(HKEY RootKey, AnsiString Key);
	void __fastcall HookAttrChangeEvent(Classes::TNotifyEvent ANotifyEvent);
	void __fastcall UnhookAttrChangeEvent(Classes::TNotifyEvent ANotifyEvent);
	__property TIdentChars IdentChars = {read=GetIdentChars};
	__property AnsiString LanguageName = {read=GetLanguageName};
	__property int AttrCount = {read=GetAttribCount, nodefault};
	__property TmwHighLightAttributes* Attribute[int idx] = {read=GetAttribute};
	__property THighlighterCapability Capability = {read=GetCapability, nodefault};
	__property Classes::TComponent* Exporter = {read=fExporter, write=fExporter};
	
__published:
	__property AnsiString DefaultFilter = {read=GetDefaultFilter, write=SetDefaultFilter};
	__property TTokenEvent OnToken = {read=fOnToken, write=fOnToken};
};


//-- var, const, procedure ---------------------------------------------------

}	/* namespace Mwhighlighter */
#if !defined(NO_IMPLICIT_NAMESPACE_USE)
using namespace Mwhighlighter;
#endif
#pragma option pop	// -w-
#pragma option pop	// -Vx

#pragma delphiheader end.
//-- end unit ----------------------------------------------------------------
#endif	// mwHighlighter

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?