flexutils.hpp

来自「FlexGraphics是一套创建矢量图形的VCL组件」· HPP 代码 · 共 589 行 · 第 1/2 页

HPP
589
字号
	void __fastcall WriteSimpleCommand(System::Word Command, int KeyCount = 0x0, const System::UnicodeString Key1 = L"", const System::UnicodeString Key2 = L"", bool DontStoreKey1 = false, bool DontStoreKey2 = false);
	void __fastcall WriteDataCommand(System::Word Command, void *Data, int DataSize, int KeyCount = 0x0, const System::UnicodeString Key1 = L"", const System::UnicodeString Key2 = L"", bool DontStoreKey1 = false, bool DontStoreKey2 = false);
	int __fastcall GetPropertyType(const System::Variant &PropValue);
	__property TFlexFilerProcess Process = {read=FProcess, nodefault};
	__property TFlexBinKeyStoreSet KeyDontStore = {read=FKeyDontStore, write=FKeyDontStore, nodefault};
	__property bool Finished = {read=FFinished, nodefault};
	__property int DicCapacity = {read=FDicCapacity, write=SetDicCapacity, nodefault};
	__property int DicDeleteCount = {read=FDicDeleteCount, write=SetDicDeleteCount, nodefault};
	__property System::Word ReadCmdCommand = {read=FCmdReadHeader.Command, nodefault};
	__property int ReadCmdSize = {read=FCmdReadHeader.Size, nodefault};
	__property int ReadCmdDataSize = {read=FCmdReadDataSize, nodefault};
	__property System::Word ReadCmdKeyCount = {read=FCmdReadHeader.KeyCount, nodefault};
	__property System::UnicodeString ReadCmdKeys[int Index] = {read=GetReadKey};
	__property int ReadCmdKeysSize = {read=FCmdKeysSize, nodefault};
};


typedef void __fastcall (__closure *TFlexProgressEvent)(System::TObject* Sender, int Progress, TFlexFilerProcess Process);

class PASCALIMPLEMENTATION TFlexFiler : public System::TObject
{
	typedef System::TObject inherited;
	
private:
	Classes::TStream* FStream;
	void *FBuffer;
	int FBufSize;
	int FBufPos;
	int FBufEnd;
	int FTotal;
	int FSaved;
	int FLoaded;
	int FProgress;
	TFlexFilerProcess FLastProcess;
	bool FBinary;
	bool FCompleteBinary;
	TFlexBinaryData* FBinaryData;
	TFlexProgressEvent FOnProgress;
	void __fastcall SetSaved(const int Value);
	void __fastcall SetTotal(const int Value);
	void __fastcall SetBinary(const bool Value);
	
protected:
	void __fastcall ReadBuffer(void);
	void __fastcall DoProgress(TFlexFilerProcess Process);
	int __fastcall GetStreamSize(void);
	bool __fastcall ReadBufCheck(void * Buf, int BufSize);
	void __fastcall ReadBuf(void *Buf, int BufSize);
	bool __fastcall ReadSkipBuf(int BufSize);
	void __fastcall WriteBuf(const void *Buf, int BufSize);
	virtual void __fastcall ReadError(const System::UnicodeString Msg = L"");
	virtual void __fastcall WriteError(const System::UnicodeString Msg = L"");
	__property Classes::TStream* Stream = {read=FStream};
	
public:
	__fastcall TFlexFiler(Classes::TStream* AStream, bool ACompleteBinary);
	__fastcall virtual ~TFlexFiler(void);
	void __fastcall SaveStr(const System::UnicodeString s);
	void __fastcall SaveBuf(void * Buf, int BufSize);
	System::UnicodeString __fastcall LoadStr();
	bool __fastcall LoadStrCheck(/* out */ System::UnicodeString &s);
	void __fastcall LoadSkipToEnd(void);
	bool __fastcall CheckLoadSkipToEnd(const System::UnicodeString First);
	bool __fastcall IsEndOfStream(void);
	void __fastcall Rewind(void);
	__property bool Binary = {read=FBinary, write=SetBinary, nodefault};
	__property bool CompleteBinary = {read=FCompleteBinary, nodefault};
	__property TFlexBinaryData* BinaryData = {read=FBinaryData};
	__property int Total = {read=FTotal, write=SetTotal, nodefault};
	__property int Saved = {read=FSaved, write=SetSaved, nodefault};
	__property int Loaded = {read=FLoaded, nodefault};
	__property int StreamSize = {read=GetStreamSize, nodefault};
	__property int Progress = {read=FProgress, nodefault};
	__property TFlexProgressEvent OnProgress = {read=FOnProgress, write=FOnProgress};
};


class DELPHICLASS TIdPool;
class PASCALIMPLEMENTATION TIdPool : public System::TObject
{
	typedef System::TObject inherited;
	
private:
	Classes::TList* FPool;
	bool __fastcall GetUsed(unsigned Value);
	
public:
	__fastcall TIdPool(void);
	__fastcall virtual ~TIdPool(void);
	unsigned __fastcall Generate(void);
	bool __fastcall Use(unsigned Value);
	bool __fastcall Release(unsigned Value);
	unsigned __fastcall NextUsed(unsigned Value, int &Index);
	void __fastcall Clear(void);
	__property bool Used[unsigned Value] = {read=GetUsed};
	__property Classes::TList* PoolList = {read=FPool};
};


#pragma option push -b-
enum TNotifyLinkCode { ncInfo, ncDestroy, ncPropBeforeChanged, ncPropChanged, ncControlNotify };
#pragma option pop

struct TNotifyLinkInfo;
typedef TNotifyLinkInfo *PNotifyLinkInfo;

struct TNotifyLinkInfo
{
	
	#pragma pack(push,1)
	
public:
	TNotifyLinkCode Code;
	union
	{
		struct 
		{
			unsigned:24;
			System::TObject* Control;
			TFlexNotify ControlNotify;
			
		};
		struct 
		{
			unsigned:24;
			System::TObject* Prop;
			
		};
		struct 
		{
			unsigned:24;
			int WParam;
			int LParam;
			
		};
		
	};
	#pragma pack(pop)
};


class DELPHICLASS TNotifyLink;
typedef void __fastcall (__closure *TNotifyLinkEvent)(System::TObject* Sender, TNotifyLink* Source, const TNotifyLinkInfo &Info);

class PASCALIMPLEMENTATION TNotifyLink : public System::TObject
{
	typedef System::TObject inherited;
	
public:
	TNotifyLink* operator[](int Index) { return Links[Index]; }
	
private:
	Classes::TList* FLinks;
	System::TObject* FOwner;
	int FTag;
	bool FDestroying;
	TNotifyLinkEvent FOnNotify;
	TNotifyLinkEvent FOnFreeNotify;
	TNotifyLink* __fastcall GetLink(int Index);
	int __fastcall GetLinkCount(void);
	int __fastcall GetLinkRefCount(int Index);
	
public:
	__fastcall TNotifyLink(System::TObject* AOwner);
	__fastcall virtual ~TNotifyLink(void);
	int __fastcall IndexOf(TNotifyLink* Link);
	int __fastcall Subscribe(TNotifyLink* Link);
	int __fastcall Unsubscribe(TNotifyLink* Link);
	int __fastcall Notify(const TNotifyLinkInfo &Info);
	void __fastcall DestroyNotify(void);
	int __fastcall PropNotify(System::TObject* AProp, bool IsBeforeNotify);
	int __fastcall ControlNotify(System::TObject* AControl, TFlexNotify ANotify);
	__property System::TObject* Owner = {read=FOwner};
	__property int LinkCount = {read=GetLinkCount, nodefault};
	__property TNotifyLink* Links[int Index] = {read=GetLink/*, default*/};
	__property int LinksRefCount[int Index] = {read=GetLinkRefCount};
	__property int Tag = {read=FTag, write=FTag, nodefault};
	__property bool Destroying = {read=FDestroying, nodefault};
	__property TNotifyLinkEvent OnNotify = {read=FOnNotify, write=FOnNotify};
	__property TNotifyLinkEvent OnFreeNotify = {read=FOnFreeNotify, write=FOnFreeNotify};
};


typedef int __fastcall (__closure *TSortedListCompare)(void * Item1, void * Item2);

//-- var, const, procedure ---------------------------------------------------
extern PACKAGE System::Word CF_FLEXDOC;
#define fcDocument L"document"
#define fcClipboard L"clipboard"
#define fcLibrary L"library"
#define fcObject L"object"
#define fcProperty L"property"
#define fcEnd L"end"
#define fcBinary L"flexbinary"
extern PACKAGE FlexUtils__1 fcReserved;
#define IndentStep L"  "
extern PACKAGE FlexUtils__2 BooleanWords;
static const ShortInt fbcUnknown = 0x0;
static const ShortInt fbcDocument = 0x1;
static const ShortInt fbcClipboard = 0x2;
static const ShortInt fbcLibrary = 0x3;
static const ShortInt fbcObject = 0x4;
static const ShortInt fbcProperty = 0x5;
static const ShortInt fbcComplexProperty = 0x6;
static const ShortInt fbcEnd = 0x7;
static const ShortInt fbcReduceDictionary = 0x8;
static const ShortInt fbcBinaryEnd = 0x9;
static const Word fbcUser = 0x1000;
static const ShortInt fbkIndexSizeMask = 0x3;
static const ShortInt fbkIndexByte = 0x1;
static const ShortInt fbkIndexWord = 0x2;
static const ShortInt fbkIndexDWord = 0x3;
static const ShortInt fbkIsIndex = 0x4;
static const ShortInt fbkDontStore = 0x8;
static const ShortInt fbpEmpty = 0x0;
static const ShortInt fbpNull = 0x1;
static const ShortInt fbpSmallint = 0x2;
static const ShortInt fbpInteger = 0x3;
static const ShortInt fbpSingle = 0x4;
static const ShortInt fbpDouble = 0x5;
static const ShortInt fbpCurrency = 0x6;
static const ShortInt fbpDate = 0x7;
static const ShortInt fbpBoolean = 0xb;
static const ShortInt fbpShortInt = 0x10;
static const ShortInt fbpByte = 0x11;
static const ShortInt fbpWord = 0x12;
static const ShortInt fbpLongWord = 0x13;
static const ShortInt fbpInt64 = 0x14;
static const Word fbpString = 0x100;
static const Word fbpStrList = 0x200;
static const Word fbpHexData = 0x201;
static const ShortInt crShapeCursor = 0x1;
static const ShortInt crShapeAddCursor = 0x2;
static const ShortInt crShapeDelCursor = 0x3;
static const ShortInt crShapeCloseCursor = 0x4;
static const ShortInt crShapeMoveCursor = 0x5;
static const ShortInt crShapeMoveCurveCursor = 0x6;
static const ShortInt crCreateControlCursor = 0x7;
static const ShortInt crCreateRectCursor = 0x8;
static const ShortInt crCreateEllipseCursor = 0x9;
static const ShortInt crCreateTextCursor = 0xa;
static const ShortInt crCreatePicCursor = 0xb;
static const ShortInt crCreatePolyCursor = 0xc;
static const ShortInt crZoomInCursor = 0xd;
static const ShortInt crZoomOutCursor = 0xe;
static const ShortInt crPanCursor = 0xf;
static const ShortInt crPanningCursor = 0x10;
static const ShortInt crShapeContinueCursor = 0x11;
static const ShortInt crShapeMoveLineCursor = 0x12;
static const ShortInt crLastFlexCursor = 0x31;
extern PACKAGE System::UnicodeString FloatDisplayFormat;
static const Word PixelScaleFactor = 0x3e8;
extern PACKAGE bool SysGradientChecked;
extern PACKAGE bool SysGradientEnabled;
extern PACKAGE int SysGradientEllipticSteps;
extern PACKAGE void __fastcall LoadFlexCursors(void);
extern PACKAGE bool __fastcall StrBeginsFrom(const System::UnicodeString S1, const System::UnicodeString S2);
extern PACKAGE bool __fastcall FlexStrNeedQuote(const System::UnicodeString s);
extern PACKAGE System::UnicodeString __fastcall ExtractWord(const System::UnicodeString s, int NumWord, System::WideChar Delimiter);
extern PACKAGE System::Byte __fastcall HexCharsToByte(System::Word cw);
extern PACKAGE System::Word __fastcall ByteToHexChars(System::Byte b);
extern PACKAGE void __fastcall GetPicReadWrite(Graphics::TPicture* Picture, /* out */ Classes::TStreamProc &ReadProc, /* out */ Classes::TStreamProc &WriteProc);
extern PACKAGE Types::TRect __fastcall NormalizeRect(const Types::TRect &R);
extern PACKAGE bool __fastcall PointInRect(const Types::TPoint &p, const Types::TRect &R);
extern PACKAGE HRGN __fastcall IntersectClipRgn(Graphics::TCanvas* ACanvas, HRGN ClipRgn);
extern PACKAGE HRGN __fastcall IntersectClipPath(HDC DC);
extern PACKAGE void __fastcall PaintGradient(Graphics::TCanvas* ACanvas, const Types::TRect &ARect, TGradientStyle Style, Graphics::TColor Color, Graphics::TColor EndColor, Graphics::TPenMode PenMode);
extern PACKAGE HRGN __fastcall CreateTransparentClipRgn(HDC DC, int Width, int Height, Types::TRect &Dest, Graphics::TColor TransparentColor);
extern PACKAGE void __fastcall ExcludeBitmapTransparency(Graphics::TBitmap* Bmp, Types::TRect &R, HRGN &ClipRgn);
extern PACKAGE void __fastcall PaintTailed(Graphics::TCanvas* ACanvas, const Types::TRect &PaintRect, const Types::TRect &RefreshRect, Graphics::TBitmap* ABitmap, PTiledBitmapCache BitmapCache = (void *)(0x0));
extern PACKAGE void __fastcall PaintBitmap(Graphics::TCanvas* ACanvas, const Types::TRect &PaintRect, const Types::TRect &RefreshRect, Graphics::TBitmap* ABitmap, TBitmapDisplay BitmapDisplay, PTiledBitmapCache BitmapCache = (void *)(0x0), int Scale = 0x64, bool ClipTransparent = false);
extern PACKAGE int __fastcall ScaleValue(int Value, int Scale);
extern PACKAGE int __fastcall UnScaleValue(int Value, int Scale);
extern PACKAGE int __fastcall ScalePixels(int Value);
extern PACKAGE int __fastcall UnScalePixels(int Value);
extern PACKAGE int __fastcall ListScan(void * Value, void * List, int Count);
extern PACKAGE int __fastcall ListScanEx(void * Value, void * List, int Index, int Count);
extern PACKAGE int __fastcall ListScanLess(void * Value, void * List, int Count);
extern PACKAGE int __fastcall SortedListFind(Classes::PPointerList List, int Count, void * Item, TSortedListCompare Compare, bool Exact);
extern PACKAGE int __fastcall ListSortItem(Classes::PPointerList List, int Count, int ItemIndex, TSortedListCompare Compare);
extern PACKAGE void __fastcall ListQuickSort(Classes::PPointerList List, int L, int R, TSortedListCompare Compare);
extern PACKAGE bool __fastcall IsClassParent(System::TClass AClass, System::TClass AParentClass);
extern PACKAGE System::UnicodeString __fastcall DotFloatToStr(const System::Extended Value);
extern PACKAGE System::Extended __fastcall DotStrToFloat(System::UnicodeString Value);

}	/* namespace Flexutils */
using namespace Flexutils;
#pragma pack(pop)
#pragma option pop

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

⌨️ 快捷键说明

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