flexprops.hpp

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

HPP
966
字号
	__property Graphics::TFontCharset Charset = {read=GetCharset, write=SetCharset, default=1};
	__property Graphics::TColor Color = {read=GetColor, write=SetColor, default=0};
	__property int Height = {read=FFontHeight, write=SetHeight, stored=false, nodefault};
	__property Graphics::TFontName Name = {read=GetName, write=SetName};
	__property Graphics::TFontPitch Pitch = {read=GetPitch, write=SetPitch, default=0};
	__property int Size = {read=GetSize, write=SetSize, nodefault};
	__property Graphics::TFontStyles Style = {read=GetStyle, write=SetStyle, default=0};
};


typedef void __fastcall (__closure *TPicturePaintBufferEvent)(System::TObject* Sender, Flexalpha::TAlphaBuffer* Buffer, Graphics::TCanvas* Canvas, Graphics::TGraphic* Graphic, bool &DrawDefault);

class DELPHICLASS TPictureProp;
class PASCALIMPLEMENTATION TPictureProp : public TCustomProp
{
	typedef TCustomProp inherited;
	
private:
	Graphics::TPicture* FPicture;
	Graphics::TGraphicClass FGraphicClass;
	bool FEmpty;
	int FWidth;
	int FHeight;
	int FColumns;
	int FRows;
	bool FMasked;
	Graphics::TColor FMaskColor;
	bool FBuffered;
	Classes::TMemoryStream* FPictureBuffer;
	System::UnicodeString FLinkName;
	bool FUsePaintBuffer;
	bool FDrawing;
	TPicturePaintBufferEvent FOnPaintFastBuffer;
	bool __fastcall GetIsLoaded(void);
	Types::TRect __fastcall GetImgRect(int Index);
	Types::TRect __fastcall GetCellSizeRect();
	Graphics::TGraphic* __fastcall GetGraphic(void);
	void __fastcall PictureChange(System::TObject* Sender);
	void __fastcall SetGraphic(const Graphics::TGraphic* Value);
	void __fastcall SetColumns(const int Value);
	void __fastcall SetRows(const int Value);
	void __fastcall SetMaskColor(const Graphics::TColor Value);
	void __fastcall SetMasked(const bool Value);
	void __fastcall SetBuffered(const bool Value);
	void __fastcall SetFastBuffer(const bool Value);
	void __fastcall SetLinkName(const System::UnicodeString Value);
	bool __fastcall StoreGraphic(void);
	bool __fastcall StoreLinkName(void);
	
protected:
	Flexalpha::TAlphaBuffer* FPaintBuffer;
	virtual void __fastcall SetPropValue(const System::UnicodeString PropName, const System::Variant &Value);
	virtual System::Variant __fastcall GetPropValue(const System::UnicodeString PropName);
	virtual TPropType __fastcall GetPropType(const System::UnicodeString PropName);
	virtual System::UnicodeString __fastcall GetDisplayValue();
	virtual bool __fastcall GetIsRaster(void);
	virtual Graphics::TBitmap* __fastcall GetFrameBitmap(Graphics::TGraphic* Graphic, int FrameIndex);
	void __fastcall RefreshPaintBuffer(void);
	virtual void __fastcall PaintBufferStore(System::TObject* Sender, Graphics::TCanvas* Canvas, Graphics::TGraphic* Graphic);
	
public:
	__fastcall TPictureProp(TPropList* AOwner, const System::UnicodeString AName);
	__fastcall virtual ~TPictureProp(void);
	void __fastcall Draw(Graphics::TCanvas* Canvas, Types::TRect &R, int FrameIndex, bool ClipTransparent = false, Flexalpha::TAlphaBuffer* DestBuffer = (Flexalpha::TAlphaBuffer*)(0x0));
	void __fastcall Clear(bool RemoveLink = false);
	bool __fastcall UpdateImageLink(void);
	Graphics::TPicture* __fastcall CreatePictureFromBuffer(void);
	void __fastcall LoadFromStream(Classes::TStream* Stream);
	void __fastcall SaveToStream(Classes::TStream* Stream);
	void __fastcall LoadFromFile(const System::UnicodeString FileName);
	void __fastcall SaveToFile(const System::UnicodeString FileName);
	__property bool Buffered = {read=FBuffered, write=SetBuffered, nodefault};
	__property Graphics::TGraphicClass GraphicClass = {read=FGraphicClass};
	__property int Width = {read=FWidth, nodefault};
	__property int Height = {read=FHeight, nodefault};
	__property bool IsLoaded = {read=GetIsLoaded, nodefault};
	__property bool IsRaster = {read=GetIsRaster, nodefault};
	__property Types::TRect ImgRect[int Index] = {read=GetImgRect};
	__property Types::TRect CellSizeRect = {read=GetCellSizeRect};
	__property TPicturePaintBufferEvent OnPaintFastBuffer = {read=FOnPaintFastBuffer, write=FOnPaintFastBuffer};
	
__published:
	__property Graphics::TGraphic* Graphic = {read=GetGraphic, write=SetGraphic, stored=StoreGraphic};
	__property int Columns = {read=FColumns, write=SetColumns, default=1};
	__property int Rows = {read=FRows, write=SetRows, default=1};
	__property bool Masked = {read=FMasked, write=SetMasked, default=0};
	__property Graphics::TColor MaskColor = {read=FMaskColor, write=SetMaskColor, default=0};
	__property System::UnicodeString LinkName = {read=FLinkName, write=SetLinkName, stored=StoreLinkName};
	__property bool FastBuffer = {read=FUsePaintBuffer, write=SetFastBuffer, default=0};
};


#pragma option push -b-
enum TBackgroundPictureOption { bpOffsetLeft, bpOffsetTop, bpNewWidth, bpNewHeight, bpStretchHoriz, bpStretchVert, bpScaledSize, bpCenterHoriz, bpCenterVert, bpAlignRight, bpAlignBottom };
#pragma option pop

typedef Set<TBackgroundPictureOption, bpOffsetLeft, bpAlignBottom>  TBackgroundPictureOptions;

class DELPHICLASS TBackgroundOptionsProp;
class PASCALIMPLEMENTATION TBackgroundOptionsProp : public TCustomProp
{
	typedef TCustomProp inherited;
	
private:
	bool FBrushEnabled;
	bool FPictureEnabled;
	TBackgroundPictureOptions FPictureOptions;
	int FTop;
	int FLeft;
	int FWidth;
	int FHeight;
	bool __fastcall GetCenter(void);
	bool __fastcall GetStretch(void);
	void __fastcall SetBrushEnabled(const bool Value);
	void __fastcall SetPictureEnabled(const bool Value);
	void __fastcall SetPictureOptions(const TBackgroundPictureOptions Value);
	void __fastcall SetTop(int Value);
	void __fastcall SetLeft(int Value);
	void __fastcall SetWidth(int Value);
	void __fastcall SetHeight(int Value);
	void __fastcall SetStretch(bool Value);
	void __fastcall SetCenter(bool Value);
	
protected:
	virtual System::UnicodeString __fastcall GetDisplayValue();
	
public:
	__fastcall TBackgroundOptionsProp(TPropList* AOwner, const System::UnicodeString AName);
	Types::TRect __fastcall GetPicturePaintRect(TPictureProp* Picture, const Types::TRect &BackgroundRect, int Scale);
	void __fastcall Draw(Graphics::TCanvas* Canvas, Types::TRect &R, TPictureProp* Picture, TBrushProp* Brush, int Scale, const Types::TRect &PanelRefreshRect, bool ClipTransparent = false);
	__property bool Stretch = {read=GetStretch, write=SetStretch, default=1};
	__property bool Center = {read=GetCenter, write=SetCenter, default=0};
	
__published:
	__property bool PictureEnabled = {read=FPictureEnabled, write=SetPictureEnabled, default=1};
	__property bool BrushEnabled = {read=FBrushEnabled, write=SetBrushEnabled, default=1};
	__property TBackgroundPictureOptions PictureOptions = {read=FPictureOptions, write=SetPictureOptions, default=112};
	__property int Top = {read=FTop, write=SetTop, default=0};
	__property int Left = {read=FLeft, write=SetLeft, default=0};
	__property int Width = {read=FWidth, write=SetWidth, default=0};
	__property int Height = {read=FHeight, write=SetHeight, default=0};
public:
	/* TCustomProp.Destroy */ inline __fastcall virtual ~TBackgroundOptionsProp(void) { }
	
};


struct TPropRefItem;
typedef TPropRefItem *PPropRefItem;

struct TPropRefItem
{
	
public:
	TCustomProp* Prop;
	System::ShortString PropName;
	System::Variant *Data;
};


typedef int __fastcall (__closure *TGetIDAlias)(int OldID);

class DELPHICLASS TPropRefList;
class PASCALIMPLEMENTATION TPropRefList : public System::TObject
{
	typedef System::TObject inherited;
	
private:
	Classes::TList* FList;
	Flexutils::TIdPool* FIdExist;
	Classes::TList* FIdRecode;
	int __fastcall GetCount(void);
	PPropRefItem __fastcall GetPropRefItem(int Index);
	int __fastcall IndexOfRecode(int OldID);
	
public:
	__fastcall TPropRefList(void);
	__fastcall virtual ~TPropRefList(void);
	int __fastcall AddRef(TCustomProp* AProp, const System::ShortString &APropName, System::PVariant AData);
	bool __fastcall AddIDAlias(int OldID, int NewID);
	int __fastcall GetIDAlias(int OldID);
	void __fastcall DeleteRef(int Index);
	void __fastcall ResolveRef(int Index);
	void __fastcall ResolveAllRefs(void);
	void __fastcall Clear(void);
	__property int Count = {read=GetCount, nodefault};
	__property PPropRefItem Refs[int Index] = {read=GetPropRefItem};
};


#pragma option push -b-
enum TPropListDataMode { plmNone, plmLoading, plmSaving };
#pragma option pop

class PASCALIMPLEMENTATION TPropList : public System::TObject
{
	typedef System::TObject inherited;
	
public:
	TCustomProp* operator[](const System::UnicodeString Name) { return Props[Name]; }
	
private:
	System::TObject* FOwner;
	TPropRefList* FRefList;
	Classes::TStringList* FPropList;
	Flexutils::TNotifyLink* FNotifyLink;
	Flexhistory::THistory* FHistory;
	bool FHistoryIgnoreReadOnly;
	Flexhistory::THistoryState FHistoryStateForList;
	bool FPropValueLoading;
	TPropChangedEvent FOnPropChanged;
	TPropChangedEvent FOnPropBeforeChanged;
	TPropStoredEvent FOnPropStored;
	TPropReadOnlyEvent FOnPropReadOnly;
	TPropHistoryActionEvent FOnPropHistoryAction;
	TCustomProp* __fastcall GetPropByIndex(int Index);
	int __fastcall GetPropsCount(void);
	TCustomProp* __fastcall GetPropByName(const System::UnicodeString Name);
	System::UnicodeString __fastcall GetPropName(int Index);
	int __fastcall GetVisibleCount(void);
	TCustomProp* __fastcall GetVisibleProp(int Index);
	System::UnicodeString __fastcall GetVisiblePropName(int Index);
	bool __fastcall GetResolving(void);
	Flexutils::TNotifyLink* __fastcall GetNotifyLink(void);
	
protected:
	int FResolveCount;
	TPropListDataMode FDataMode;
	int FDataModeCount;
	void __fastcall DoBeforeChanged(TCustomProp* Prop);
	void __fastcall DoChanged(TCustomProp* Prop);
	bool __fastcall DoPropIsStored(TCustomProp* Prop, const System::UnicodeString PropName = L"");
	bool __fastcall IsNameValid(const System::UnicodeString AName);
	TCustomProp* __fastcall GetComplexPropInstance(TCustomProp* Prop, const System::UnicodeString PropName);
	void __fastcall SavePropValue(Flexutils::TFlexFiler* Filer, const System::UnicodeString Indent, TCustomProp* Prop, const System::UnicodeString PropName, bool IsComplex);
	void __fastcall SaveComplexProp(Flexutils::TFlexFiler* Filer, TCustomProp* Prop, const System::UnicodeString PropName, const System::UnicodeString Indent, bool ForceSave = false);
	TCustomProp* __fastcall LoadPropValue(Flexutils::TFlexFiler* Filer, TCustomProp* ComplexProp, const System::UnicodeString First);
	bool __fastcall LoadComplexProp(Flexutils::TFlexFiler* Filer, const System::UnicodeString First, TCustomProp* Prop);
	__property bool PropValueLoading = {read=FPropValueLoading, nodefault};
	
public:
	__fastcall TPropList(System::TObject* AOwner);
	__fastcall virtual ~TPropList(void);
	bool __fastcall Assign(TPropList* PropList);
	void __fastcall BeginResolve(TPropRefList* ARefList);
	void __fastcall EndResolve(void);
	void __fastcall Clear(void);
	void __fastcall BeginLoading(void);
	void __fastcall BeginSaving(void);
	void __fastcall EndLoadSave(void);
	int __fastcall Add(TCustomProp* Prop, const System::UnicodeString AName);
	bool __fastcall AddLoadedIDAlias(int LoadedID, int NewID);
	int __fastcall IndexOf(TCustomProp* Prop);
	bool __fastcall IsReadOnly(TCustomProp* Prop);
	int __fastcall VisibleIndexOf(TCustomProp* Prop);
	int __fastcall GetRealIndex(int VisibleIndex);
	int __fastcall GetVisibleIndex(int RealIndex);
	void __fastcall Delete(int Index);
	bool __fastcall SaveProperty(Flexutils::TFlexFiler* Filer, TCustomProp* Prop, const System::UnicodeString Indent, System::UnicodeString PropName = L"", bool ForceSave = false);
	TCustomProp* __fastcall LoadProperty(Flexutils::TFlexFiler* Filer, const System::UnicodeString First, bool WithoutBeginLoading = false);
	bool __fastcall SaveToFiler(Flexutils::TFlexFiler* Filer, const System::UnicodeString Indent, bool ForceSave = false);
	void __fastcall LoadFromFiler(Flexutils::TFlexFiler* Filer, const System::UnicodeString First, TPropRefList* RefList);
	__property System::TObject* Owner = {read=FOwner};
	__property TPropListDataMode DataMode = {read=FDataMode, nodefault};
	__property int Count = {read=GetPropsCount, nodefault};
	__property TCustomProp* Props[const System::UnicodeString Name] = {read=GetPropByName/*, default*/};
	__property System::UnicodeString PropNames[int Index] = {read=GetPropName};
	__property TCustomProp* ByIndex[int Index] = {read=GetPropByIndex};
	__property int VisibleCount = {read=GetVisibleCount, nodefault};
	__property TCustomProp* VisibleProps[int Index] = {read=GetVisibleProp};
	__property System::UnicodeString VisiblePropNames[int Index] = {read=GetVisiblePropName};
	__property bool Resolving = {read=GetResolving, nodefault};
	__property TPropRefList* RefList = {read=FRefList, write=FRefList};
	__property Flexutils::TNotifyLink* NotifyLink = {read=GetNotifyLink, write=FNotifyLink};
	__property Flexhistory::THistory* History = {read=FHistory, write=FHistory};
	__property bool HistoryIgnoreReadOnly = {read=FHistoryIgnoreReadOnly, write=FHistoryIgnoreReadOnly, nodefault};
	__property Flexhistory::THistoryState HistoryStateForList = {read=FHistoryStateForList, write=FHistoryStateForList, nodefault};
	__property TPropChangedEvent OnPropChanged = {read=FOnPropChanged, write=FOnPropChanged};
	__property TPropChangedEvent OnPropBeforeChanged = {read=FOnPropBeforeChanged, write=FOnPropBeforeChanged};
	__property TPropStoredEvent OnPropStored = {read=FOnPropStored, write=FOnPropStored};
	__property TPropReadOnlyEvent OnPropReadOnly = {read=FOnPropReadOnly, write=FOnPropReadOnly};
	__property TPropHistoryActionEvent OnPropHistoryAction = {read=FOnPropHistoryAction, write=FOnPropHistoryAction};
};


//-- var, const, procedure ---------------------------------------------------
static const Word DefaultLineCapSize = 0x1f40;
static const ShortInt psNoCap = 0x0;
static const ShortInt psArrow0 = -1;
static const ShortInt psDblArrow0 = -2;
static const ShortInt psBackArrow0 = -3;
static const ShortInt psBackDblArrow0 = -4;
static const ShortInt psArrow1 = -5;
static const ShortInt psDblArrow1 = -6;
static const ShortInt psBackArrow1 = -7;
static const ShortInt psBackDblArrow1 = -8;
static const ShortInt psArrow = -9;
static const ShortInt psTriangle = -10;
static const ShortInt psDblTriangle = -11;
static const ShortInt psBackTriangle = -12;
static const ShortInt psBackDblTriangle = -13;
static const ShortInt psSquare = -14;
static const ShortInt psCircle = -15;
static const ShortInt psDotCircle = -16;
static const ShortInt psRhombus = -17;
static const ShortInt psThinRect = -18;
static const ShortInt psLastStandard = -18;
extern PACKAGE TPictureLinkResolve ResolvePictureLink;
extern PACKAGE TBitmapLinkResolve ResolveBitmapLink;
extern PACKAGE bool GeometricPenChecked;
extern PACKAGE bool GeometricPenEnabled;
extern PACKAGE void __fastcall RegisterDefaultPropEditForm(TCustomPropClass PropClass, TEditFormClass EditFormClass);

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

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

⌨️ 快捷键说明

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