⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 memocomponentunit.hpp

📁 这是一个有关文本编辑器的源程序,支持彩色语法,你可以任意修改,修改后发给我一份
💻 HPP
📖 第 1 页 / 共 2 页
字号:
	AnsiString FText;
	TMCRanges* FTrackedRanges;
	TCustomRange* FWholeText;
	Classes::TStrings* FLines;
	TVisibleRange* FVisibleRange;
	TSelectionRange* FSelection;
	int FLongestLineLength;
	bool FAlwaysShowCaret;
	int FLeftMargin;
	int FTopMargin;
	int FTabSize;
	Classes::TNotifyEvent FOnSelectionChange;
	int FTextLength;
	bool FBitmapped;
	Classes::TNotifyEvent FOnChangePrivate;
	bool FAllowUndo;
	TReplaceEvent FOnReplaceText;
	Graphics::TFontStyles FForbiddenFontStyles;
	bool FDrawingSuspended;
	bool FDragDropEditing;
	bool FRemoveTrailingSpaces;
	HIDESBASE MESSAGE void __fastcall CMFontChanged(Messages::TMessage &Message);
	HIDESBASE MESSAGE void __fastcall WMSize(Messages::TWMSize &Message);
	HIDESBASE MESSAGE void __fastcall WMHScroll(Messages::TWMScroll &Message);
	HIDESBASE MESSAGE void __fastcall WMVScroll(Messages::TWMScroll &Message);
	HIDESBASE MESSAGE void __fastcall WMSetFocus(Messages::TWMSetFocus &Message);
	HIDESBASE MESSAGE void __fastcall WMKillFocus(Messages::TWMKillFocus &Message);
	HIDESBASE MESSAGE void __fastcall WMEraseBkgnd(Messages::TWMEraseBkgnd &Message);
	MESSAGE void __fastcall CMWantSpecialKey(Messages::TWMKey &Message);
	HIDESBASE MESSAGE void __fastcall WMKeyDown(Messages::TWMKey &Message);
	HIDESBASE MESSAGE void __fastcall WMKeyUp(Messages::TWMKey &Message);
	MESSAGE void __fastcall WMClear(Messages::TWMNoParams &Message);
	MESSAGE void __fastcall WMCut(Messages::TWMNoParams &Message);
	MESSAGE void __fastcall WMCopy(Messages::TWMNoParams &Message);
	MESSAGE void __fastcall WMPaste(Messages::TWMNoParams &Message);
	MESSAGE void __fastcall WMSetText(Messages::TWMSetText &Message);
	MESSAGE void __fastcall WMGetText(Messages::TWMGetText &Message);
	MESSAGE void __fastcall WMGetTextLength(Messages::TWMNoParams &Message);
	MESSAGE void __fastcall WMTimer(Messages::TWMTimer &Message);
	MESSAGE void __fastcall EMUndo(Messages::TMessage &Message);
	MESSAGE void __fastcall EMCanUndo(Messages::TMessage &Message);
	HIDESBASE MESSAGE void __fastcall CMMouseWheel(Controls::TCMMouseWheel &Message);
	HIDESBASE void __fastcall SetText(const AnsiString Value);
	void __fastcall SetScrollBars(const Stdctrls::TScrollStyle Value);
	void __fastcall SetBorderStyle(const Forms::TBorderStyle Value);
	void __fastcall SetReadOnly(const bool Value);
	void __fastcall SetLines(const Classes::TStrings* Value);
	int __fastcall GetLineCount(void);
	int __fastcall GetLineLength(int LineIndex);
	int __fastcall GetVisualLineLength(int LineIndex);
	int __fastcall GetSelLength(void);
	int __fastcall GetSelStart(void);
	void __fastcall SetSelLength(const int Value);
	void __fastcall SetSelStart(const int Value);
	void __fastcall SetAlwaysShowCaret(const bool Value);
	void __fastcall SetLeftMargin(const int Value);
	void __fastcall SetTopMargin(const int Value);
	void __fastcall SetTabSize(const int Value);
	bool __fastcall GetCanRedo(void);
	bool __fastcall GetCanUndo(void);
	void __fastcall SetBitmapped(const bool Value);
	void __fastcall SetAllowUndo(const bool Value);
	void __fastcall SetRemoveTrailingSpaces(const bool Value);
	
protected:
	int FontHeight;
	int FontWidth;
	int PageHeight;
	int PageWidth;
	Graphics::TBitmap* DrawBmp;
	TUndoOperation *FUndoStack;
	TUndoOperation *FRedoStack;
	bool FInUndo;
	bool DontNotify;
	TMCRange* DragOrigRange;
	virtual void __fastcall CreateParams(Controls::TCreateParams &Params);
	virtual void __fastcall CreateWnd(void);
	virtual void __fastcall ReplaceText(TCustomRange* Range, const AnsiString NewText);
	virtual void __fastcall DrawTextLine(TCustomRange* Range, int Left, int Top, int NextTabStop);
	virtual TFormattedRangeArray __fastcall CreateSplitRanges(TCustomRange* Range);
	virtual void __fastcall DrawBorder(const Types::TRect &LeftRect, const Types::TRect &TopRect, Graphics::TCanvas* Canvas);
	DYNAMIC void __fastcall TextChangeNotification(int StartPos, int OldLength, int NewLength);
	DYNAMIC void __fastcall TextChangeNotificationAfter(void);
	DYNAMIC void __fastcall Change(void);
	DYNAMIC void __fastcall SelectionChange(void);
	virtual void __fastcall UpdateFontSize(void);
	virtual void __fastcall UpdatePageSize(void);
	virtual void __fastcall UpdateDrawBmp(void);
	virtual void __fastcall ReCreateCaret(void);
	virtual void __fastcall FreeCaret(void);
	virtual void __fastcall Paint(void);
	DYNAMIC void __fastcall MouseDown(Controls::TMouseButton Button, Classes::TShiftState Shift, int X, int Y);
	DYNAMIC void __fastcall MouseMove(Classes::TShiftState Shift, int X, int Y);
	virtual void __fastcall MouseMoveInternal(int X, int Y);
	DYNAMIC void __fastcall MouseUp(Controls::TMouseButton Button, Classes::TShiftState Shift, int X, int Y);
	DYNAMIC void __fastcall KeyPress(char &Key);
	DYNAMIC void __fastcall DblClick(void);
	virtual TUndoOperation __fastcall GetLastUndo();
	virtual TUndoOperation __fastcall GetLastRedo();
	virtual PUndoOperation __fastcall CreateUndoBeginEndBlock(void);
	virtual bool __fastcall IsUndoBeginEndBlock(PUndoOperation Op);
	virtual void __fastcall MakeUndoOperation(PUndoOperation Op);
	virtual void __fastcall MakeRedoOperation(PUndoOperation Op);
	void __fastcall CancelDragging(void);
	
public:
	__fastcall virtual TMemoComponent(Classes::TComponent* AOwner);
	__fastcall virtual ~TMemoComponent(void);
	virtual void __fastcall Clear(void);
	virtual TTextCell __fastcall CharIdxToCell(int CharIdx);
	virtual int __fastcall CellToCharIdx(const TTextCell &Cell);
	virtual TTextCell __fastcall ScrPointToScrCell(const Types::TPoint &P);
	virtual Types::TPoint __fastcall ScrCellToScrPoint(const TTextCell &Cell);
	virtual int __fastcall TabSpacesAtPos(int P);
	virtual int __fastcall CellToScrCol(const TTextCell &Cell);
	virtual void __fastcall CellFromScrCol(TTextCell &Cell);
	virtual int __fastcall CellFromScrColToScrCol(TTextCell &Cell);
	void __fastcall SelectAll(void);
	void __fastcall ClearSelection(void);
	void __fastcall CutToClipboard(void);
	void __fastcall CopyToClipboard(void);
	void __fastcall PasteFromClipboard(void);
	void __fastcall Undo(void);
	void __fastcall Redo(void);
	void __fastcall ClearUndo(void);
	void __fastcall ClearRedo(void);
	virtual void __fastcall ScrollCaret(void);
	virtual void __fastcall ChangeIndent(int Change);
	void __fastcall RemoveTrSp(void);
	void __fastcall RemoveTrSpFromLine(int LineIdx);
	void __fastcall RemoveTrSpFromString(AnsiString &Str, bool IncludeLastLine = false);
	__property AnsiString Text = {read=FText, write=SetText};
	__property int TextLength = {read=FTextLength, nodefault};
	__property TMCRanges* TrackedRanges = {read=FTrackedRanges};
	__property TCustomRange* WholeText = {read=FWholeText};
	__property int LineCount = {read=GetLineCount, nodefault};
	__property int LongestLineLength = {read=FLongestLineLength, nodefault};
	__property int LineLength[int LineIndex] = {read=GetLineLength};
	__property int VisualLineLength[int LineIndex] = {read=GetVisualLineLength};
	__property TVisibleRange* VisibleRange = {read=FVisibleRange};
	__property TSelectionRange* Selection = {read=FSelection};
	__property int SelStart = {read=GetSelStart, write=SetSelStart, nodefault};
	__property int SelLength = {read=GetSelLength, write=SetSelLength, nodefault};
	__property Graphics::TFontStyles ForbiddenFontStyles = {read=FForbiddenFontStyles, nodefault};
	__property bool CanUndo = {read=GetCanUndo, nodefault};
	__property bool CanRedo = {read=GetCanRedo, nodefault};
	__property bool DrawingSuspended = {read=FDrawingSuspended, write=FDrawingSuspended, nodefault};
	__property TReplaceEvent OnReplaceText = {read=FOnReplaceText, write=FOnReplaceText};
	__property Classes::TNotifyEvent OnChangePrivate = {read=FOnChangePrivate, write=FOnChangePrivate};
	
__published:
	__property Stdctrls::TScrollStyle ScrollBars = {read=FScrollBars, write=SetScrollBars, default=0};
	__property Forms::TBorderStyle BorderStyle = {read=FBorderStyle, write=SetBorderStyle, default=1};
	__property bool Bitmapped = {read=FBitmapped, write=SetBitmapped, nodefault};
	__property bool ReadOnly = {read=FReadOnly, write=SetReadOnly, default=0};
	__property bool AllowUndo = {read=FAllowUndo, write=SetAllowUndo, default=1};
	__property Classes::TNotifyEvent OnChange = {read=FOnChange, write=FOnChange};
	__property Classes::TNotifyEvent OnSelectionChange = {read=FOnSelectionChange, write=FOnSelectionChange};
	__property Classes::TStrings* Lines = {read=FLines, write=SetLines};
	__property bool AlwaysShowCaret = {read=FAlwaysShowCaret, write=SetAlwaysShowCaret, nodefault};
	__property int LeftMargin = {read=FLeftMargin, write=SetLeftMargin, nodefault};
	__property int TopMargin = {read=FTopMargin, write=SetTopMargin, nodefault};
	__property int TabSize = {read=FTabSize, write=SetTabSize, nodefault};
	__property bool DragDropEditing = {read=FDragDropEditing, write=FDragDropEditing, nodefault};
	__property bool RemoveTrailingSpaces = {read=FRemoveTrailingSpaces, write=SetRemoveTrailingSpaces, nodefault};
	__property TabStop  = {default=1};
	__property Align  = {default=0};
	__property Anchors  = {default=3};
	__property Color ;
	__property Constraints ;
	__property Ctl3D ;
	__property Enabled  = {default=1};
	__property Font ;
	__property ParentColor  = {default=1};
	__property ParentCtl3D  = {default=1};
	__property ParentFont  = {default=1};
	__property ParentShowHint  = {default=1};
	__property PopupMenu ;
	__property ShowHint ;
	__property TabOrder  = {default=-1};
	__property Visible  = {default=1};
	__property OnClick ;
	__property OnDblClick ;
	__property OnEnter ;
	__property OnExit ;
	__property OnKeyDown ;
	__property OnKeyPress ;
	__property OnKeyUp ;
	__property OnMouseDown ;
	__property OnMouseMove ;
	__property OnMouseUp ;
public:
	#pragma option push -w-inl
	/* TWinControl.CreateParented */ inline __fastcall TMemoComponent(HWND ParentWindow) : Controls::TCustomControl(ParentWindow) { }
	#pragma option pop
	
};


class DELPHICLASS TWholeTextRange;
class PASCALIMPLEMENTATION TWholeTextRange : public TCustomRange 
{
	typedef TCustomRange inherited;
	
protected:
	virtual int __fastcall GetREnd(void);
	virtual int __fastcall GetRStart(void);
public:
	#pragma option push -w-inl
	/* TCustomRange.Create */ inline __fastcall virtual TWholeTextRange(Objlist::TFastObjectContainer* Collection) : TCustomRange(Collection) { }
	#pragma option pop
	
public:
	#pragma option push -w-inl
	/* TFastContainerItem.Destroy */ inline __fastcall virtual ~TWholeTextRange(void) { }
	#pragma option pop
	
};


class DELPHICLASS TCustomFormattedRange;
class PASCALIMPLEMENTATION TCustomFormattedRange : public TMCRange 
{
	typedef TMCRange inherited;
	
protected:
	virtual Graphics::TColor __fastcall GetColor(void) = 0 ;
	virtual Graphics::TFont* __fastcall GetFont(void) = 0 ;
	virtual void __fastcall SetColor(const Graphics::TColor Value);
	virtual void __fastcall SetFont(const Graphics::TFont* Value);
	
public:
	bool FreeWhenDone;
	virtual void __fastcall AssignTo(Classes::TPersistent* Dest);
	virtual void __fastcall CleanUpFont(void);
	
__published:
	__property Graphics::TColor Color = {read=GetColor, write=SetColor, nodefault};
	__property Graphics::TFont* Font = {read=GetFont, write=SetFont};
public:
	#pragma option push -w-inl
	/* TMCRange.Create */ inline __fastcall virtual TCustomFormattedRange(Objlist::TFastObjectContainer* Collection) : TMCRange(Collection) { }
	#pragma option pop
	
public:
	#pragma option push -w-inl
	/* TFastContainerItem.Destroy */ inline __fastcall virtual ~TCustomFormattedRange(void) { }
	#pragma option pop
	
};


class DELPHICLASS TFormattedRange;
class PASCALIMPLEMENTATION TFormattedRange : public TCustomFormattedRange 
{
	typedef TCustomFormattedRange inherited;
	
private:
	Graphics::TFont* FFont;
	Graphics::TColor FColor;
	
protected:
	virtual Graphics::TColor __fastcall GetColor(void);
	virtual Graphics::TFont* __fastcall GetFont(void);
	virtual void __fastcall SetColor(const Graphics::TColor Value);
	virtual void __fastcall SetFont(const Graphics::TFont* Value);
	
public:
	__fastcall virtual TFormattedRange(Objlist::TFastObjectContainer* Collection);
	__fastcall virtual ~TFormattedRange(void);
};


class DELPHICLASS TNormalFormattedRange;
class PASCALIMPLEMENTATION TNormalFormattedRange : public TCustomFormattedRange 
{
	typedef TCustomFormattedRange inherited;
	
protected:
	virtual Graphics::TColor __fastcall GetColor(void);
	virtual Graphics::TFont* __fastcall GetFont(void);
public:
	#pragma option push -w-inl
	/* TMCRange.Create */ inline __fastcall virtual TNormalFormattedRange(Objlist::TFastObjectContainer* Collection) : TCustomFormattedRange(Collection) { }
	#pragma option pop
	
public:
	#pragma option push -w-inl
	/* TFastContainerItem.Destroy */ inline __fastcall virtual ~TNormalFormattedRange(void) { }
	#pragma option pop
	
};


//-- var, const, procedure ---------------------------------------------------
extern PACKAGE void __fastcall Register(void);
extern PACKAGE TTextCell __fastcall TextCell(int CellRow, int CellCol);

}	/* namespace Memocomponentunit */
using namespace Memocomponentunit;
#pragma option pop	// -w-
#pragma option pop	// -Vx

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

⌨️ 快捷键说明

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