flexcontrols.hpp

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

HPP
628
字号
	typedef System::TObject inherited;
	
private:
	tagLOGFONTW FLogFont;
	bool FLogFontValid;
	TTextCharWidth FCharWidth;
	TTextCharABCs FCharABC;
	int FEMSquare;
	double FPixelSize;
	int FHeight;
	int FLineSpace;
	HDC FDC;
	_ABC __fastcall GetCharABC(System::WideChar AChar);
	int __fastcall GetCharWidth(System::WideChar AChar);
	
protected:
	tagSIZE FLineSize;
	int FLineLeftSpace;
	int FLineRightSpace;
	bool __fastcall CheckFontIdentical(HDC DC);
	bool __fastcall SkipWhite(TTextLine &Line, bool &NeedBreak);
	void __fastcall GetWord(TTextLine &Line);
	bool __fastcall GetLine(TTextLine &Line, int LineWidth, int &LineBegin, int &LineEnd, bool WordWrap);
	void __fastcall LineExtent(System::WideChar * ALine, int ACount);
	
public:
	bool __fastcall Setup(HDC DC, const double PixelSize, bool DivideOnEMSquare = false, bool RoundHeight = true);
	tagSIZE __fastcall CharExtent(System::WideChar * Text, int CharCount, bool LineBreaks = false, bool WordWrap = false, int PaintWidth = 0x0, bool InLogicalUnits = false, System::PInteger LineCount = (void *)(0x0));
	void __fastcall CharWordInfos(System::WideChar * Text, int CharCount, TTextWordInfoArray &WordInfos, int &WordCount, int &WordWidth, bool InLogicalUnits = false);
	tagSIZE __fastcall TextExtent(const System::UnicodeString Text);
	int __fastcall TextHeight(const System::UnicodeString Text);
	int __fastcall TextWidth(const System::UnicodeString Text);
	void __fastcall TextOut(int X, int Y, const System::UnicodeString Text);
	void __fastcall CharOut(int X, int Y, System::WideChar * Text, int CharCount);
	void __fastcall TextRect(const Types::TRect &Rect, const System::UnicodeString Text, bool WordWrap, Classes::TAlignment Align = (Classes::TAlignment)(0x0), Stdctrls::TTextLayout ALayout = (Stdctrls::TTextLayout)(0x0), bool WidthJustify = false, int LogicalWidth = 0x0, int Rotation = 0x0);
	__property int Height = {read=FHeight, nodefault};
	__property int LineSpace = {read=FLineSpace, nodefault};
	__property int EMSquare = {read=FEMSquare, nodefault};
	__property double PixelSize = {read=FPixelSize};
	__property _ABC CharABC[System::WideChar AChar] = {read=GetCharABC};
	__property int CharWidth[System::WideChar AChar] = {read=GetCharWidth};
public:
	/* TObject.Create */ inline __fastcall TTextFormator(void) : System::TObject() { }
	/* TObject.Destroy */ inline __fastcall virtual ~TTextFormator(void) { }
	
};


class DELPHICLASS TFlexText;
class PASCALIMPLEMENTATION TFlexText : public TFlexBox
{
	typedef TFlexBox inherited;
	
private:
	Flexprops::TBoolProp* FAutoSizeProp;
	Flexprops::TStrListProp* FTextProp;
	Flexprops::TFontProp* FFontProp;
	Flexprops::TBoolProp* FWordWrapProp;
	Flexprops::TBoolProp* FGrayedProp;
	Flexprops::TEnumProp* FAlignmentProp;
	Flexprops::TEnumProp* FLayoutProp;
	Flexprops::TIntProp* FAngleProp;
	Flexprops::TBoolProp* FPreciseProp;
	Flexprops::TBoolProp* FPreciseJustifyProp;
	Flexprops::TBoolProp* FAutoScaleFontSizeProp;
	Flexprops::TIntProp* FMaxFontSizeProp;
	bool FAutoSizeChanging;
	Classes::TAlignment __fastcall GetAlignment(void);
	Stdctrls::TTextLayout __fastcall GetLayout(void);
	bool __fastcall GetWordWrap(void);
	void __fastcall SetAlignment(const Classes::TAlignment Value);
	void __fastcall SetLayout(const Stdctrls::TTextLayout Value);
	void __fastcall SetWordWrap(const bool Value);
	bool __fastcall GetGrayed(void);
	void __fastcall SetGrayed(const bool Value);
	tagSIZE __fastcall GetTextSize();
	
protected:
	TTextFormator* FFormator;
	Types::TRect FRefreshRect;
	int FRefreshScale;
	void __fastcall GetLeftRightExtra(HDC DC, int &Left, int &Right);
	void __fastcall DoDrawText(Graphics::TCanvas* Canvas, Types::TRect &Rect, int Flags, const System::UnicodeString Text);
	virtual void __fastcall CreateProperties(void);
	virtual void __fastcall ControlCreate(void);
	virtual void __fastcall ControlDestroy(void);
	virtual void __fastcall ControlTranslate(const Flexutils::TTranslateInfo &TranslateInfo);
	virtual Flexbase::TFlexControl* __fastcall CreateCurveControl(void);
	virtual void __fastcall Paint(Graphics::TCanvas* Canvas, Types::TRect &PaintRect);
	virtual void __fastcall PropChanged(System::TObject* Sender, Flexprops::TCustomProp* Prop);
	virtual void __fastcall PropStored(System::TObject* Sender, Flexprops::TCustomProp* Prop, bool &IsStored, const System::UnicodeString PropName = L"");
	virtual Types::TRect __fastcall GetRefreshRect(int RefreshX, int RefreshY);
	void __fastcall AutoSizeChanged(void);
	__property tagSIZE TextSize = {read=GetTextSize};
	
public:
	__classmethod virtual Controls::TCursor __fastcall CursorInCreate();
	void __fastcall DrawTextEx(Graphics::TCanvas* Canvas, Types::TRect &R, bool CalcOnly, bool Scaled, const System::UnicodeString AText, Classes::TAlignment AAlignment, Stdctrls::TTextLayout ALayout, bool AWordWrap, bool APrecise, bool APreciseJustify, int LogSize = 0x0, int AFontHeight = 0x0);
	virtual void __fastcall DrawTextCpp(Graphics::TCanvas* Canvas, Types::TRect &R, bool CalcOnly, bool Scaled);
	__property TTextFormator* Formator = {read=FFormator};
	__property Flexprops::TBoolProp* AutoSizeProp = {read=FAutoSizeProp};
	__property Flexprops::TStrListProp* TextProp = {read=FTextProp};
	__property Flexprops::TFontProp* FontProp = {read=FFontProp};
	__property Flexprops::TBoolProp* WordWrapProp = {read=FWordWrapProp};
	__property Flexprops::TEnumProp* AlignmentProp = {read=FAlignmentProp};
	__property Flexprops::TEnumProp* LayoutProp = {read=FLayoutProp};
	__property Flexprops::TIntProp* AngleProp = {read=FAngleProp};
	__property Flexprops::TBoolProp* PreciseProp = {read=FPreciseProp};
	__property Flexprops::TBoolProp* PreciseJustifyProp = {read=FPreciseJustifyProp};
	__property Flexprops::TBoolProp* AutoScaleFontSizeProp = {read=FAutoScaleFontSizeProp};
	__property Flexprops::TIntProp* MaxFontSizeProp = {read=FMaxFontSizeProp};
	__property bool Grayed = {read=GetGrayed, write=SetGrayed, nodefault};
	__property bool WordWrap = {read=GetWordWrap, write=SetWordWrap, nodefault};
	__property Classes::TAlignment Alignment = {read=GetAlignment, write=SetAlignment, nodefault};
	__property Stdctrls::TTextLayout Layout = {read=GetLayout, write=SetLayout, nodefault};
public:
	/* TFlexControl.Create */ inline __fastcall virtual TFlexText(Flexbase::TFlexPanel* AOwner, Flexbase::TFlexControl* AParent, Flexbase::TFlexLayer* ALayer) : TFlexBox(AOwner, AParent, ALayer) { }
	/* TFlexControl.Destroy */ inline __fastcall virtual ~TFlexText(void) { }
	
};


class DELPHICLASS TFlexConnector;
class PASCALIMPLEMENTATION TFlexConnector : public TFlexCurve
{
	typedef TFlexCurve inherited;
	
private:
	Flexbase::TLinkPointProp* FLinkAProp;
	Flexbase::TLinkPointProp* FLinkBProp;
	Flexprops::TEnumProp* FRerouteModeProp;
	Flexprops::TBoolProp* FOrtogonalProp;
	Flexprops::TIntProp* FMinimalGapProp;
	bool FBlocked;
	int FLinkUpdateCount;
	bool FLinkPointsIniting;
	void __fastcall SetBlocked(bool Value);
	bool __fastcall GetLinked(void);
	bool __fastcall GetOrtogonal(void);
	void __fastcall SetOrtogonal(const bool Value);
	Flexpath::TRerouteMode __fastcall GetRerouteMode(void);
	void __fastcall SetRerouteMode(const Flexpath::TRerouteMode Value);
	
protected:
	bool FDesignMoving;
	int FDesignMovedFirst;
	int FDesignMovedNext;
	bool FInTransformation;
	virtual void __fastcall CreateProperties(void);
	virtual void __fastcall ControlCreate(void);
	virtual void __fastcall ControlDestroy(void);
	virtual void __fastcall CreateInDesign(Flexbase::TFlexCreateInDesignInfo &Info);
	virtual void __fastcall BeginSelectionTransformation(void);
	virtual void __fastcall EndSelectionTransformation(void);
	virtual void __fastcall ControlTranslate(const Flexutils::TTranslateInfo &TranslateInfo);
	virtual void __fastcall CreateCurveGuide(const Types::TPoint &NewPoint, Flexbase::TFlexEditPointGuide &Guide);
	virtual void __fastcall SetDocRect(const Types::TRect &Value);
	virtual void __fastcall MirrorInResize(bool HMirror, bool VMirror);
	virtual bool __fastcall MovePathPoints(int PointIndex, Types::TPoint &Delta, Flexpath::TSelectedArray Selected, bool Smooth = false, bool Symmetric = false);
	virtual bool __fastcall MovePathSegment(int FirstIndex, int NextIndex, Types::TPoint &Delta, const double SegmentCurvePos);
	virtual void __fastcall PointsChanged(void);
	virtual void __fastcall DoNotify(Flexutils::TFlexNotify Notify);
	void __fastcall LinkedNotify(System::TObject* Sender, Flexutils::TNotifyLink* Source, const Flexutils::TNotifyLinkInfo &Info);
	virtual void __fastcall GetLinkProps(Flexbase::TLinkPointProp* &LinkFirst, Flexbase::TLinkPointProp* &LinkLast);
	virtual void __fastcall PropChanged(System::TObject* Sender, Flexprops::TCustomProp* Prop);
	virtual void __fastcall PropStored(System::TObject* Sender, Flexprops::TCustomProp* Prop, bool &IsStored, const System::UnicodeString PropName = L"");
	virtual void __fastcall ConnectorMinGapChanged(void);
	void __fastcall Reroute(void);
	__property bool Blocked = {read=FBlocked, write=SetBlocked, nodefault};
	__property int LinkUpdateCount = {read=FLinkUpdateCount, nodefault};
	__property bool Linked = {read=GetLinked, nodefault};
	
public:
	__classmethod virtual bool __fastcall IsConnectorControl();
	virtual int __fastcall InsertPoint(int Index, const Types::TPoint &Point);
	virtual int __fastcall InsertNearestPoint(const Types::TPoint &Point);
	virtual void __fastcall DeletePoint(int Index);
	virtual void __fastcall EndPointsDesigning(void);
	void __fastcall BeginLinkUpdate(void);
	void __fastcall EndLinkUpdate(void);
	__property Flexbase::TLinkPointProp* LinkAProp = {read=FLinkAProp};
	__property Flexbase::TLinkPointProp* LinkBProp = {read=FLinkBProp};
	__property Flexprops::TEnumProp* RerouteModeProp = {read=FRerouteModeProp};
	__property Flexprops::TBoolProp* OrtogonalProp = {read=FOrtogonalProp};
	__property Flexprops::TIntProp* MinimalGapProp = {read=FMinimalGapProp};
	__property Flexpath::TRerouteMode RerouteMode = {read=GetRerouteMode, write=SetRerouteMode, nodefault};
	__property bool Ortogonal = {read=GetOrtogonal, write=SetOrtogonal, nodefault};
public:
	/* TFlexControl.Create */ inline __fastcall virtual TFlexConnector(Flexbase::TFlexPanel* AOwner, Flexbase::TFlexControl* AParent, Flexbase::TFlexLayer* ALayer) : TFlexCurve(AOwner, AParent, ALayer) { }
	/* TFlexControl.Destroy */ inline __fastcall virtual ~TFlexConnector(void) { }
	
};


class DELPHICLASS TFlexRegularPolygon;
class PASCALIMPLEMENTATION TFlexRegularPolygon : public Flexbase::TFlexControl
{
	typedef Flexbase::TFlexControl inherited;
	
private:
	struct _TFlexRegularPolygon__1
	{
		
public:
		double X;
		double Y;
	};
	
	
	typedef DynamicArray<_TFlexRegularPolygon__1> _TFlexRegularPolygon__2;
	
	
private:
	Flexprops::TBrushProp* FBrushProp;
	Flexprops::TPenProp* FPenProp;
	Flexprops::TIntProp* FAngleProp;
	Flexprops::TIntProp* FSidesProp;
	
protected:
	_TFlexRegularPolygon__2 FEtalon;
	double FEtalonDX;
	double FEtalonDY;
	double FEtalonDXDY;
	Flexpath::TPointArray FPoints;
	Flexpath::TPointTypeArray FPointTypes;
	virtual void __fastcall CreateProperties(void);
	virtual void __fastcall ControlCreate(void);
	virtual void __fastcall ControlTranslate(const Flexutils::TTranslateInfo &TranslateInfo);
	virtual Flexbase::TFlexControl* __fastcall CreateCurveControl(void);
	virtual void __fastcall Paint(Graphics::TCanvas* Canvas, Types::TRect &PaintRect);
	virtual Types::TPoint __fastcall GetAnchorPoint();
	virtual void __fastcall PropChanged(System::TObject* Sender, Flexprops::TCustomProp* Prop);
	virtual void __fastcall PropStored(System::TObject* Sender, Flexprops::TCustomProp* Prop, bool &IsStored, const System::UnicodeString PropName = L"");
	HRGN __fastcall CreatePolygonRegion(const Types::TRect &PaintRect, bool Inflate = false);
	virtual Types::TRect __fastcall GetRefreshRect(int RefreshX, int RefreshY);
	virtual Types::TPoint __fastcall GetDefaultLinkPoint(int Index);
	virtual int __fastcall GetDefaultLinkPointCount(void);
	void __fastcall RebuildEtalon(void);
	void __fastcall BuildPoints(Flexpath::TPointArray &Points, const Types::TRect &R);
	
public:
	virtual bool __fastcall IsPointInside(int PaintX, int PaintY);
	__property Flexprops::TBrushProp* BrushProp = {read=FBrushProp};
	__property Flexprops::TPenProp* PenProp = {read=FPenProp};
	__property Flexprops::TIntProp* AngleProp = {read=FAngleProp};
	__property Flexprops::TIntProp* SidesProp = {read=FSidesProp};
public:
	/* TFlexControl.Create */ inline __fastcall virtual TFlexRegularPolygon(Flexbase::TFlexPanel* AOwner, Flexbase::TFlexControl* AParent, Flexbase::TFlexLayer* ALayer) : Flexbase::TFlexControl(AOwner, AParent, ALayer) { }
	/* TFlexControl.Destroy */ inline __fastcall virtual ~TFlexRegularPolygon(void) { }
	
};


struct TLineCapInfo;
typedef TLineCapInfo *PLineCapInfo;

struct TLineCapInfo
{
	
public:
	int Size;
	int LineLength;
	Types::TRect Bounds;
};


struct TLineCapData;
typedef TLineCapData *PLineCapData;

struct TLineCapData
{
	
public:
	TLineCapInfo Info;
	Types::TPoint p0;
	Types::TPoint p1;
	Flexpath::TPointArray Points;
	Flexpath::TPointTypeArray PointTypes;
};


struct TRenderCapParams;
typedef TRenderCapParams *PRenderCapParams;

struct TRenderCapParams
{
	
public:
	int Style;
	Graphics::TColor OutlineColor;
	Graphics::TColor FillColor;
	int CapSize;
};


typedef void __fastcall (*TLineCapStyleResolve)(int LineCap, const Types::TPoint &p0, const Types::TPoint &p1, TLineCapData &Data, int CapSize, bool &Resolved);

//-- var, const, procedure ---------------------------------------------------
extern PACKAGE TLineCapStyleResolve ResolveLineCapStyle;
extern PACKAGE bool __fastcall GetLineCapInfo(int LineCap, TLineCapInfo &Info, int CapSize);
extern PACKAGE bool __fastcall GetLineCapData(int LineCap, const Types::TPoint &p0, const Types::TPoint &p1, TLineCapData &Data, int CapSize);
extern PACKAGE void __fastcall RenderCap(HDC DC, int LineCap, const Types::TPoint &p0, const Types::TPoint &p1, int CapSize);
extern PACKAGE void __fastcall RenderCaps(HDC DC, int PenWidth, const TRenderCapParams &BeginCap, const TRenderCapParams &EndCap, const Flexpath::TPointArray Points, const Flexpath::TPointTypeArray PointTypes, Flexpath::PPathInfo Info = (void *)(0x0));
extern PACKAGE void __fastcall RegisterStdControls(void);

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

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

⌨️ 快捷键说明

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