mwcustomedit.hpp

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

HPP
768
字号
	void __fastcall SetVisible(const bool Value);
	void __fastcall SetInternalImage(const bool Value);
	bool __fastcall GetIsBookmark(void);
	void __fastcall SetIsBookmark(const bool Value);
	
public:
	__fastcall TMark(TmwCustomEdit* owner);
	__property int Line = {read=fLine, write=SetLine, nodefault};
	__property int Column = {read=fColumn, write=SetColumn, nodefault};
	__property int ImageIndex = {read=fImage, write=SetImage, nodefault};
	__property int BookmarkNumber = {read=fBookmarkNum, write=fBookmarkNum, nodefault};
	__property bool Visible = {read=fVisible, write=SetVisible, nodefault};
	__property bool InternalImage = {read=fInternalImage, write=SetInternalImage, nodefault};
	__property bool IsBookmark = {read=GetIsBookmark, write=SetIsBookmark, nodefault};
public:
	#pragma option push -w-inl
	/* TObject.Destroy */ inline __fastcall virtual ~TMark(void) { }
	#pragma option pop
	
};


typedef TMark* TMarks[16];

class PASCALIMPLEMENTATION TMarkList : public Classes::TList 
{
	typedef Classes::TList inherited;
	
protected:
	TmwCustomEdit* fEdit;
	Classes::TNotifyEvent fOnChange;
	HIDESBASE TMark* __fastcall Get(int Index);
	HIDESBASE void __fastcall Put(int Index, TMark* Item);
	void __fastcall DoChange(void);
	
public:
	__fastcall TMarkList(TmwCustomEdit* owner);
	HIDESBASE int __fastcall Add(TMark* Item);
	HIDESBASE TMark* __fastcall First(void);
	HIDESBASE TMark* __fastcall Last(void);
	HIDESBASE void __fastcall Insert(int Index, TMark* Item);
	HIDESBASE int __fastcall Remove(TMark* Item);
	HIDESBASE void __fastcall Delete(int Index);
	void __fastcall ClearLine(int line);
	void __fastcall Place(TMark* mark);
	void __fastcall GetMarksForLine(int line, TMark* * marks);
	__property TMark* Items[int Index] = {read=Get, write=Put/*, default*/};
	__property Classes::TNotifyEvent OnChange = {read=fOnChange, write=fOnChange};
public:
	#pragma option push -w-inl
	/* TList.Destroy */ inline __fastcall virtual ~TMarkList(void) { }
	#pragma option pop
	
};


typedef void __fastcall (__closure *TPlaceMarkEvent)(System::TObject* Sender, TMark* &mark);

class PASCALIMPLEMENTATION TmwCustomEdit : public Controls::TCustomControl 
{
	typedef Controls::TCustomControl inherited;
	
private:
	Windows::TPoint fBlockBegin;
	Windows::TPoint fBlockEnd;
	int fCaretX;
	int fCaretY;
	int fCharsInWindow;
	int fCharWidth;
	Graphics::TFont* fFontDummy;
	int fGutterWidth;
	int fImeCount;
	bool fMBCSStepAside;
	bool fInserting;
	Classes::TStrings* fLines;
	int fLinesInWindow;
	int fLeftChar;
	int fMaxLeftChar;
	int fPaintLock;
	bool fReadOnly;
	int fRightEdge;
	Graphics::TColor fRightEdgeColor;
	Stdctrls::TScrollStyle FScrollBars;
	int fTextHeight;
	int fTextOffset;
	int fTopLine;
	Mwhighlighter::TmwCustomHighLighter* fHighLighter;
	Mwsupportclasses::TmwSelectedColor* fSelectedColor;
	TUndoList* fUndoList;
	TUndoList* fRedoList;
	TMark* fBookMarks[10];
	Windows::TPoint fDragBlockBegin;
	Windows::TPoint fDragBlockEnd;
	int fMouseDownX;
	int fMouseDownY;
	Mwsupportclasses::TmwBookMarkOpt* fBookMarkOpt;
	TPaintEvent fOnPaint;
	Classes::TNotifyEvent fOnChange;
	Classes::TNotifyEvent fSelectionChange;
	Forms::TFormBorderStyle fBorderStyle;
	bool fHideSelection;
	int fMouseWheelAccumulator;
	TCaretType fOverwriteCaret;
	TCaretType fInsertCaret;
	Windows::TPoint fCaretOffset;
	TProcessCommandEvent fOnProcessCommand;
	TProcessCommandEvent fOnProcessUserCommand;
	Mwkeycmds::TmwKeyStrokes* fKeyStrokes;
	bool fModified;
	TMarkList* fMarkList;
	TPlaceMarkEvent fOnPlaceMark;
	int fExtraLineSpacing;
	Classes::TNotifyEvent fOnCommandDone;
	TSelectionMode fSelectionMode;
	TPrintStatusEvent fOnPrintStatus;
	bool fWantTabs;
	Mwsupportclasses::TmwGutter* fGutter;
	TmwEditExporters fClipboardFormats;
	int fTabWidth;
	TSpecialLineColorsEvent fOnSpecialLineColors;
	Utextdrawer::TheTextDrawer* fTextDrawer;
	Windows::TRect fInvalidateRect;
	TmwStateFlags fStateFlags;
	TmwEditorOptions fOptions;
	Mwsupportclasses::TmwInternalImage* fInternalImage;
	TmwStatusChanges fStatusChanges;
	TStatusChangeEvent fOnStatusChange;
	Word fLastKey;
	Classes::TShiftState fLastShiftState;
	char fProcChar;
	TDropFilesEvent fOnDropFiles;
	Mweditsearch::TmwEditSearch* fTSearch;
	TReplaceTextEvent fOnReplaceText;
	void __fastcall ComputeCaret(int X, int Y);
	Windows::TPoint __fastcall GetBlockBegin();
	Windows::TPoint __fastcall GetBlockEnd();
	int __fastcall GetCaretX(void);
	int __fastcall GetCaretY(void);
	Graphics::TFont* __fastcall GetFont(void);
	int __fastcall GetLeftChar(void);
	int __fastcall GetLineCount(void);
	AnsiString __fastcall GetLineText();
	bool __fastcall GetSelAvail(void);
	HIDESBASE AnsiString __fastcall GetText();
	int __fastcall GetTopLine(void);
	HIDESBASE void __fastcall FontChanged(System::TObject* Sender);
	int __fastcall LeftSpaces(const AnsiString Line);
	void __fastcall LinesChanging(System::TObject* Sender);
	void __fastcall LinesChanged(System::TObject* Sender);
	void __fastcall SetBlockBegin(const Windows::TPoint &Value);
	void __fastcall SetBlockEnd(const Windows::TPoint &Value);
	void __fastcall SetWordBlock(const Windows::TPoint &Value);
	void __fastcall SetCaretX(int Value);
	void __fastcall SetCaretY(int Value);
	void __fastcall SetGutterWidth(int Value);
	HIDESBASE void __fastcall SetFont(const Graphics::TFont* Value);
	void __fastcall SetLeftChar(int Value);
	void __fastcall SetLines(Classes::TStrings* Value);
	void __fastcall SetLineText(AnsiString Value);
	void __fastcall SetScrollBars(const Stdctrls::TScrollStyle Value);
	HIDESBASE void __fastcall SetText(const AnsiString Value);
	void __fastcall SetTopLine(int Value);
	void __fastcall UpdateCaret(void);
	void __fastcall UpdateScrollBars(bool Force);
	AnsiString __fastcall GetSelText();
	void __fastcall SetSelText(const AnsiString Value);
	int __fastcall ScanFrom(int Index);
	bool __fastcall GetCanUndo(void);
	bool __fastcall GetCanRedo(void);
	bool __fastcall GetCanPaste(void);
	void __fastcall SetRightEdge(int Value);
	void __fastcall SetRightEdgeColor(Graphics::TColor Value);
	void __fastcall SetMaxUndo(const int Value);
	int __fastcall GetMaxUndo(void);
	void __fastcall SetHighlighter(const Mwhighlighter::TmwCustomHighLighter* Value);
	void __fastcall SetBorderStyle(Forms::TBorderStyle Value);
	void __fastcall SetHideSelection(const bool Value);
	void __fastcall SetInsertMode(const bool Value);
	void __fastcall SetInsertCaret(const TCaretType Value);
	void __fastcall SetOverwriteCaret(const TCaretType Value);
	Windows::TPoint __fastcall GetCaretXY();
	void __fastcall SetKeystrokes(const Mwkeycmds::TmwKeyStrokes* Value);
	void __fastcall SetMaxLeftChar(int Value);
	void __fastcall SetExtraLineSpacing(const int Value);
	void __fastcall SetSelTextExternal(const AnsiString Value);
	void __fastcall SetSelectionMode(const TSelectionMode Value);
	void __fastcall SetGutter(const Mwsupportclasses::TmwGutter* Value);
	void __fastcall SelectedColorsChanged(System::TObject* Sender);
	void __fastcall GutterChanged(System::TObject* Sender);
	void __fastcall BookMarkOptionsChanged(System::TObject* Sender);
	void __fastcall SetWantTabs(const bool Value);
	void __fastcall SetTabWidth(int Value);
	void __fastcall LockUndo(void);
	void __fastcall UnLockUndo(void);
	bool __fastcall IsPointInSelection(const Windows::TPoint &Value);
	void __fastcall SetOptions(TmwEditorOptions Value);
	void __fastcall SizeOrFontChanged(bool bFont);
	void __fastcall MoveCaretHorz(int DX, bool SelectionCommand);
	void __fastcall MoveCaretVert(int DY, bool SelectionCommand);
	void __fastcall MoveCaretAndSelection(const Windows::TPoint &ptBefore, const Windows::TPoint &ptAfter
		, bool SelectionCommand);
	void __fastcall StatusChanged(TmwStatusChanges AChanges);
	void __fastcall DoTabKey(void);
	MESSAGE void __fastcall WMDropFiles(Messages::TMessage &Message);
	HIDESBASE MESSAGE void __fastcall WMEraseBkgnd(Messages::TMessage &Message);
	MESSAGE void __fastcall WMGetDlgCode(Messages::TWMNoParams &Msg);
	HIDESBASE MESSAGE void __fastcall WMHScroll(Messages::TWMScroll &Message);
	MESSAGE void __fastcall WMImeComposition(Messages::TMessage &Msg);
	MESSAGE void __fastcall WMImeNotify(Messages::TMessage &Message);
	HIDESBASE MESSAGE void __fastcall WMKillFocus(Messages::TWMKillFocus &Message);
	HIDESBASE MESSAGE void __fastcall WMSetCursor(Messages::TWMSetCursor &Msg);
	HIDESBASE MESSAGE void __fastcall WMSetFocus(Messages::TWMSetFocus &Message);
	HIDESBASE MESSAGE void __fastcall WMSize(Messages::TWMSize &Message);
	HIDESBASE MESSAGE void __fastcall WMVScroll(Messages::TWMScroll &Message);
	HIDESBASE MESSAGE void __fastcall WMMouseWheel(Messages::TMessage &Msg);
	
protected:
	virtual void __fastcall CreateParams(Controls::TCreateParams &Params);
	void __fastcall DecPaintLock(void);
	void __fastcall HideCaret(void);
	void __fastcall IncPaintLock(void);
	void __fastcall ListAdded(System::TObject* Sender);
	void __fastcall ListCleared(System::TObject* Sender);
	void __fastcall ListDeleted(int Index);
	void __fastcall ListInserted(int Index);
	void __fastcall ListLoaded(System::TObject* Sender);
	void __fastcall ListPutted(int Index);
	void __fastcall ListScanRanges(System::TObject* Sender);
	DYNAMIC void __fastcall MouseDown(Controls::TMouseButton Button, Classes::TShiftState Shift, int X, 
		int Y);
	DYNAMIC void __fastcall MouseUp(Controls::TMouseButton Button, Classes::TShiftState Shift, int X, int 
		Y);
	DYNAMIC void __fastcall MouseMove(Classes::TShiftState Shift, int X, int Y);
	DYNAMIC void __fastcall DblClick(void);
	DYNAMIC void __fastcall KeyPress(char &Key);
	DYNAMIC void __fastcall KeyDown(Word &Key, Classes::TShiftState Shift);
	virtual void __fastcall PaintGutter(const Windows::TRect &AClip, int FirstLine, int LastLine);
	virtual void __fastcall PaintTextLines(const Windows::TRect &AClip, int FirstLine, int LastLine, int 
		FirstCol, int LastCol);
	virtual void __fastcall Paint(void);
	virtual void __fastcall SetName(const AnsiString Value);
	void __fastcall ShowCaret(void);
	virtual void __fastcall Loaded(void);
	int __fastcall CoorToIndex(const Windows::TPoint &CPos);
	Windows::TPoint __fastcall IndexToCoor(int ind);
	DYNAMIC void __fastcall DragOver(System::TObject* Source, int X, int Y, Controls::TDragState State, 
		bool &Accept);
	void __fastcall InitializeCaret(void);
	void __fastcall MarkListChange(System::TObject* Sender);
	virtual void __fastcall ProcessCommand(Mwkeycmds::TmwEditorCommand &Command, char &AChar, void * Data
		);
	Mwkeycmds::TmwEditorCommand __fastcall TranslateKeyCode(Word Code, Classes::TShiftState Shift, void * 
		&Data);
	virtual void __fastcall SelectionChange(void);
	void __fastcall SetSelTextPrimitive(TSelectionMode PasteMode, char * Value, Windows::PInteger Tag);
		

⌨️ 快捷键说明

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