• 深入Delphi FMX从FMX.Types开始(一、原理)


    深入Delphi FMX从FMX.Types开始(一、原理)

    一、FMX.Types中那些个有用的东西(倒序),你们记着晃一眼及时用哟

    1.001、虚拟键盘相关(2083、572行次)

    1.002、共享内容个克隆缓存中的属性相关(2090行次)

    1.003、Caret及其光标闪烁相关(2071、872行次),  TFlasherInterval = -1..1000;

    1.004、Screen屏幕显示区域和边界相关(2048行次)

    1.005、TFmxObject及泛型的枚举过滤器相关(2014行次)

    1.006、全局的系统空闲消息类相关(2045行次),你可以用它去实现系统空闲消息的发布、订阅和监听

    1.007、移除字符串中的&符号但保留原始位置及格式相关(2010行次)

    1.008、提供debug调试消息的静态方法日志输出相关(1940行次)

    1.009、元素为TAlignLayout的全局布局TAnchors数组变量,已枚举各种可能的情况进行赋值(1836行次),可用于遍历或枚举

    1.010、注册FMX类为持久类相关(1831行次)

    1.011、忽略ARC引用计数并强制释放对象:将AObject赋值为nil,从内存地址中清除(1829行次)

    1.012、判断并捕获FMX应用的句柄是否有效相关(1826行次), TFmxHandle = THandle;  THandle = NativeUInt;  Result := (Hnd <> 0);

    1.013、FMX文字语言及翻译类相关(1496、1784及1802行次)

    1.014、动态计算并部署FMX对象Align布局的相关方法(1790行次)

    1.015、动态维护StyleLookup的相关方法(1773行次)

    1.016、FMX中的TPixelFormat像素格式、颜色及其转化的相关方法(1756行次)

    1.017、FMX中的持久类TPersistent相关的维护接口(1700行次)

    1.018、FMX中的TGuillotineBinPack矩形区域截取类相关(1594行次)

    1.019、FMX中的线条的索引及长短的捕获类相关(1566行次)

    1.020、FMX内置的TTimer毫秒计时器及其计时接口服务相关(1530行次)

    1.021、FMX的弹出菜单PopupMenu相关(1243行次)

    1.022、FMX的TTabList类及其接口相关(1219、676行次)

     1.023、通过StyleName快速访问FMX对象的相关类(1034行次)

    1.024、TEnumProcResult枚举过程结果的全局枚举类型(1031行次)

    1.025、FMX对象TFmxObject相关类(1053行次)

    1.026、FMX对象列表类TFmxObjectList及其子对象TFmxChildrenList的枚举列表类、FMX对象间的比较匿名函数的参照全局类(1053行次)

    1.027、FMX对象的位置、纵横比、旋转的外观转化的本地持久类(967行次)

    1.028、FMX曲线类TSpline(699行次)

    1.029、FMX中Items类型等容器接口(669行次)

     1.030、FMX原生控件的句柄接口(555行次)

    1.031、FMX对象及其子对象重新布局接口IAlignRoot(549行次)

    1.032、FMX对象的IRoot祖先根节点接口(524行次)

    1.033、FMX对象嵌套的内容捕获接口(407行次)

    1.034、FMX控件的行为的释放通知接口(430行次),比如焦点等等各种事件

    1.035、FMX的其它与布局和显示相关的基础常量和枚举类型(193、74行次)

    深入Delphi FMX从FMX.Types开始(一、原理)
    Delphi中System.Types和FMX.Types和Androidapi.JNI.JavaTypes等平台属性的对应关系:

    Androidapi.JNI.JavaTypes等平台属性======》FMX.Types======》System.Types====》System.TypInfo

    一、FMX.Types中那些个有用的东西(倒序),你们记着晃一眼及时用哟
    1.001、虚拟键盘相关(2083、572行次)

    type
    TShowVirtualKeyboard = procedure (const Displayed: boolean;
    const Caret: TCustomCaret;
    var VirtualKeyboardState: TVirtualKeyboardStates);

    procedure RegisterShowVKProc(const ShowVirtualKeyboard: TShowVirtualKeyboard);

    type
    TKeyKind = (Usual, Functional, Unknown);

    TKeyKindHelper = record helper for TKeyKind
    TVirtualKeyboardType = (Default, NumbersAndPunctuation, NumberPad, PhonePad, Alphabet, URL, NamePhonePad,
    EmailAddress, DecimalNumberPad);

    TVirtualKeyboardTypeHelper = record helper for TVirtualKeyboardType
    const
    vktDefault = TVirtualKeyboardType.Default deprecated 'Use TVirtualKeyboardType.Default';
    vktNumbersAndPunctuation = TVirtualKeyboardType.NumbersAndPunctuation deprecated 'Use TVirtualKeyboardType.NumbersAndPunctuation';
    vktNumberPad = TVirtualKeyboardType.NumberPad deprecated 'Use TVirtualKeyboardType.NumberPad';
    vktPhonePad = TVirtualKeyboardType.PhonePad deprecated 'Use TVirtualKeyboardType.PhonePad';
    vktAlphabet = TVirtualKeyboardType.Alphabet deprecated 'Use TVirtualKeyboardType.Alphabet';
    vktURL = TVirtualKeyboardType.URL deprecated 'Use TVirtualKeyboardType.URL';
    vktNamePhonePad = TVirtualKeyboardType.NamePhonePad deprecated 'Use TVirtualKeyboardType.NamePhonePad';
    vktEmailAddress = TVirtualKeyboardType.EmailAddress deprecated 'Use TVirtualKeyboardType.EmailAddress';
    end;

    TVirtualKeyboardState = (AutoShow, Visible, Error, Transient);

    TVirtualKeyboardStateHelper = record helper for TVirtualKeyboardState
    const
    vksAutoShow = TVirtualKeyboardState.AutoShow deprecated 'Use TVirtualKeyboardState.AutoShow';
    vksVisible = TVirtualKeyboardState.Visible deprecated 'Use TVirtualKeyboardState.Visible';
    vksError = TVirtualKeyboardState.Error deprecated 'Use TVirtualKeyboardState.Error';
    vksTransient = TVirtualKeyboardState.Transient deprecated 'Use TVirtualKeyboardState.Transient';
    end;

    TVirtualKeyboardStates = set of TVirtualKeyboardState;

    TReturnKeyType = (Default, Done, Go, Next, Search, Send);

    TReturnKeyTypeHelper = record helper for TReturnKeyType
    const
    rktDefault = TReturnKeyType.Default deprecated 'Use TReturnKeyType.Default';
    rktDone = TReturnKeyType.Done deprecated 'Use TReturnKeyType.Done';
    rktGo = TReturnKeyType.Go deprecated 'Use TReturnKeyType.Go';
    rktNext = TReturnKeyType.Next deprecated 'Use TReturnKeyType.Next';
    rktSearch = TReturnKeyType.Search deprecated 'Use TReturnKeyType.Search';
    rktSend = TReturnKeyType.Send deprecated 'Use TReturnKeyType.Send';
    end;

    IVirtualKeyboardControl = interface
    ['{41127080-97FC-4C30-A880-AB6CD351A6C4}']
    procedure SetKeyboardType(Value: TVirtualKeyboardType);
    function GetKeyboardType: TVirtualKeyboardType;
    property KeyboardType: TVirtualKeyboardType read GetKeyboardType write SetKeyboardType;
    //
    procedure SetReturnKeyType(Value: TReturnKeyType);
    function GetReturnKeyType: TReturnKeyType;
    property ReturnKeyType: TReturnKeyType read GetReturnKeyType write SetReturnKeyType;
    //
    function IsPassword: Boolean;
    end;
     

    1.002、共享内容个克隆缓存中的属性相关(2090行次)


    var
    SharedContext: TRttiContext;
    ClonePropertiesCache: TDictionary<string, TList<TRttiProperty>>;

    1.003、Caret及其光标闪烁相关(2071、872行次),  TFlasherInterval = -1..1000;

    /// <summary>Registers the flasher class for the TCustomCaret object specified
    /// in the CaretClass parameter.</summary>
    procedure RegisterFlasherClass(const FlasherClass: TFmxObjectClass; const CaretClass: TCaretClass);
    /// <summary>Returns the class of a flasher registered for the TCustomCaret
    /// object specified in the CaretClass parameter.</summary>
    function FlasherClass(const CaretClass: TCaretClass): TFmxObjectClass;
    /// <summary>Returns the flasher object registered for the TCustomCaret object
    /// specified in the CaretClass parameter.</summary>
    function Flasher(const CaretClass: TCaretClass): TFmxObject;
    /// <summary>Checks whether a flasher is registered for the TCustomCaret object
    /// specified in the CaretClass parameter.</summary>
    function AssignedFlasher(const CaretClass: TCaretClass): boolean;

    TCaretDisplayChanged = procedure (Sender: TCustomCaret; const VirtualKeyboardState: TVirtualKeyboardStates) of object;

    TCaretClass = class of TCustomCaret;

    TCustomCaret = class (TPersistent)
    private
    [Weak]FOwner: TFMXObject;
    FIControl: IControl;
    FVisible: Boolean;
    FDisplayed: Boolean;
    FTemporarilyHidden: Boolean;
    FChanged: Boolean;
    FUpdateCount: Integer;
    FOnDisplayChanged: TCaretDisplayChanged;
    FColor: TAlphaColor;
    FDefaultColor: TAlphaColor;
    FPos: TPointF;
    FSize: TSizeF;
    FInterval: TFlasherInterval;
    FReadOnly: Boolean;
    procedure SetColor(const Value: TAlphaColor);
    procedure SetPos(const Value: TPointF);
    procedure SetSize(const Value: TSizeF);
    procedure SetTemporarilyHidden(const Value: boolean);
    procedure SetVisible(const Value: Boolean);
    procedure SetInterval(const Value: TFlasherInterval);
    procedure SetReadOnly(const Value: boolean);
    procedure StartTimer;
    function GetWidth: Word;
    procedure SetWidth(const Value: Word);
    function GetFlasher: IFlasher;
    procedure SetDefaultColor(const Value: TAlphaColor);
    protected
    function GetOwner: TPersistent; override;
    procedure DoDisplayChanged(const VirtualKeyboardState: TVirtualKeyboardStates); virtual;
    procedure DoUpdateFlasher; virtual;
    public
    constructor Create(const AOwner: TFMXObject); virtual;
    destructor Destroy; override;
    procedure Assign(Source: TPersistent); override;
    /// <summary>
    /// hide the caret
    /// </summary>
    procedure Hide; virtual;
    /// <summary>
    /// if possible (CanShow = True and Visible = True), the caret show.
    /// </summary>
    procedure Show; virtual;
    /// <summary>
    /// This method is performed after changing the Displayed
    /// </summary>
    property Pos: TPointF read FPos write SetPos;
    property Size: TSizeF read FSize write SetSize;
    property Color: TAlphaColor read FColor write SetColor default TAlphaColorRec.Null;
    property DefaultColor: TAlphaColor read FDefaultColor write SetDefaultColor;
    property Interval: TFlasherInterval read FInterval write SetInterval default 0;
    property Owner: TFMXObject read FOwner;
    property Control: IControl read FIControl;
    procedure BeginUpdate;
    procedure EndUpdate;
    class function FlasherName: string; virtual; abstract;
    property UpdateCount: integer read FUpdateCount;
    /// <summary>
    /// The update of the "Flasher", if UpdateCount = 0.
    /// </summary>
    procedure UpdateFlasher;
    /// <summary>
    /// This property controls the visibility of a caret, for the control in which the input focus.
    /// </summary>
    property Visible: Boolean read FVisible write SetVisible;
    /// <summary>
    /// The function returns true, if the control is visible, enabled,
    /// has the input focus and it in an active form
    /// </summary>
    function CanShow: Boolean; virtual;
    /// <summary>
    /// This property is set to True, after the successful execution of
    /// method Show, and is set to False after method Hide
    /// </summary>
    property Displayed: Boolean read FDisplayed;
    /// <summary>
    /// If this property is 'true', the blinking control is invisible
    /// and does not take values of Visible, Displayed.
    /// When you change the properties, methods DoShow, DoHide, DoDisplayChanged not met.
    /// </summary>
    property TemporarilyHidden: boolean read FTemporarilyHidden write SetTemporarilyHidden;
    /// <summary>
    /// Blinking visual component is displayed.
    /// Usually this line, having a thickness of one or two pixels.
    /// </summary>
    property Flasher: IFlasher read GetFlasher;
    property ReadOnly: boolean read FReadOnly write SetReadOnly;
    property Width: Word read GetWidth write SetWidth default 0;

    property OnDisplayChanged: TCaretDisplayChanged read FOnDisplayChanged write FOnDisplayChanged;
    end;
     

    1.004、Screen屏幕显示区域和边界相关(2048行次)

    TDisplay = record

    1.005、TFmxObject及泛型的枚举过滤器相关(2014行次)

    type
    TEnumerableFilter<F; T: TFmxObject> = class(TEnumerable<T>)
    public
    constructor Create(const FullEnum: TEnumerable<F>; SelfDestruct: Boolean = False; const Pred: TPredicate<T> = nil);
    class function Filter(const Src: TEnumerable<F>; const Predicate: TPredicate<T> = nil): TEnumerableFilter<F,T>;

    type
    TFilterEnumerator = class(TEnumerator<T>)
    public
    constructor Create(const Enumerable: TEnumerable<F>; const Cleanup: TEnumerableFilter<F,T>;
    const Pred: TPredicate<T>);
    destructor Destroy; override;
    property Current: T read GetCurrent;
    function MoveNext: Boolean;
    end;
    end;
    1.006、全局的系统空闲消息类相关(2045行次),你可以用它去实现系统空闲消息的发布、订阅和监听
    TIdleMessage = class(System.Messaging.TMessage)
    1.007、移除字符串中的&符号但保留原始位置及格式相关(2010行次)
    //但保留原始位置及格式
    function DelAmp(const AText: string): string
    1.008、提供debug调试消息的静态方法日志输出相关(1940行次)
    { Debugging }
    type
    /// <summary>Provides static methods for debug messages.</summary>
    Log = class abstract
    public type
    /// <summary>A conversion function used to convert array elements in ArrayToString</summary>
    TToStringFunc = reference to function(const AObject: TObject): string;
    /// <summary>A timestamp of specific point in procedure execution. TLogMarks are used by Log.Trace.
    /// See Trace and TLogToken.</summary>
    TLogMark = record
    /// <summary>A short message</summary>
    Msg: string;
    /// <summary>Timestamp</summary>
    Time: TDateTime;
    end;
    /// <summary>A token received in Trace callback. Token can be used to mark specific points in time during
    /// procedure execution. Use Mark(Message) to mark specific moment in time. Marks will be printed
    /// in sequence with their elapsed times in Trace output.</summary>
    TLogToken = class
    public
    /// <summary>Mark time during timed execution of a procedure.</summary>
    procedure Mark(const Msg: string);
    /// <summary>Get a mark at Index.</summary>
    property MarkAt[const Index: Integer]: TLogMark read GetMarkAt;
    /// <summary>Count of accumulated Marks.</summary>
    property Count: Integer read GetCount;
    end;
    public
    /// <summary>Log a debug message. Same arguments as Format.</summary>
    class procedure d(const Fmt: string; const Args: array of const); overload;
    /// <summary>Log a simple debug message.</summary>
    class procedure d(const Msg: string); overload; inline;
    /// <summary>Log a debug message with Tag, object data of Instance, Method that invokes the logger and message Msg.
    /// </summary>
    class procedure d(const Tag: string; const Instance: TObject; const Method, Msg: string); overload; inline;
    /// <summary>Log a debug message with Tag, object data of Instance and a message Msg</summary>
    class procedure d(const Tag: string; const Instance: TObject; const Msg: string); overload; inline;
    /// <summary>Log a time stamp with message Msg</summary>
    class procedure TimeStamp(const Msg: string); overload;
    /// <summary>Perform a timed execution of Func and print execution times, return function result.
    /// Proc receives a parameter TLogToken which can be used to mark specific points where timestamps should be taken
    /// in addition to complete procedure time.</summary>
    class function Trace<TResult>(const Tag: string; const Func: TFunc<TLogToken, TResult>;
    const Threshold: Integer = -1): TResult; overload;
    /// <summary>A convenience variant of Trace&lt;TResult&gt; when token is not needed.</summary>
    class function Trace<TResult>(const Tag: string; const Func: TFunc<TResult>; const Threshold: Integer = -1): TResult; overload;
    /// <summary>A convenience variant of Trace&lt;TResult&gt; for procedures.</summary>
    class procedure Trace(const Tag: string; const Proc: TProc<TLogToken>; const Threshold: Integer = -1); overload;
    /// <summary>A convenience variant of Trace&lt;TResult&gt; for procedures when token is not needed.</summary>
    class procedure Trace(const Tag: string; const Proc: TProc; const Threshold: Integer = -1); overload;
    /// <summary>Get a basic string representation of an object, consisting of ClassName and its pointer</summary>
    class function ObjToString(const Instance: TObject): string;
    /// <summary>Get a string representation of array using MakeStr function to convert individual elements.</summary>
    class function ArrayToString(const AArray: TEnumerable<TFmxObject>; const MakeStr: TToStringFunc): string; overload;
    /// <summary>Get a string representation of array using TObject.ToString to convert individual elements.</summary>
    class function ArrayToString(const AArray: TEnumerable<TFmxObject>): string; overload;
    /// <summary>转储导出指定的TFmxObject及其所有子对象字符串Dump complete TFmxObject with all its children.</summary>
    class procedure DumpFmxObject(const AObject: TFmxObject; const Nest: Integer = 0);
    end;

    1.009、元素为TAlignLayout的全局布局TAnchors数组变量,已枚举各种可能的情况进行赋值(1836行次),可用于遍历或枚举
    var
    AnchorAlign: array [TAlignLayout] of TAnchors
    1.010、注册FMX类为持久类相关(1831行次)

    procedure RegisterFmxClasses(const RegClasses: array of TPersistentClass); overload;
    procedure RegisterFmxClasses(const RegClasses: array of TPersistentClass;
    const GroupClasses: array of TPersistentClass); overload;
    1.011、忽略ARC引用计数并强制释放对象:将AObject赋值为nil,从内存地址中清除(1829行次)
    procedure DisposeOfAndNil(var AObject);
    1.012、判断并捕获FMX应用的句柄是否有效相关(1826行次), TFmxHandle = THandle;  THandle = NativeUInt;  Result := (Hnd <> 0);
    function IsHandleValid(Hnd: TFmxHandle): Boolean;
    1.013、FMX文字语言及翻译类相关(1496、1784及1802行次)
    { TLang }

    TLang = class(TFmxObject)
    private
    //..........
    protected
    { vcl }
    //..........
    public
    constructor Create(AOwner: TComponent); override;
    destructor Destroy; override;
    procedure AddLang(const AName: string);
    procedure LoadFromFile(const AFileName: string);
    procedure SaveToFile(const AFileName: string);
    property Original: TStrings read FOriginal;
    property Resources: TStrings read FResources;
    property LangStr[const Index: string]: TStrings read GetLangStr;
    published
    property AutoSelect: Boolean read FAutoSelect write FAutoSelect default True;
    property FileName: string read FFileName write FFileName;
    property StoreInForm: Boolean read FStoreInForm write FStoreInForm default True;
    property Lang: string read FLang write SetLang;
    end;

    { Lang }

    procedure LoadLangFromFile(const AFileName: string);
    procedure LoadLangFromStrings(const AStr: TStrings);
    procedure ResetLang;

    type
    TCustomTranslateProc = function(const AText: string): string;

    var
    CustomTranslateProc: TCustomTranslateProc;

    { This function use to collect string which can be translated. Just place this function at Application start. }

    procedure CollectLangStart;
    procedure CollectLangFinish;
    { This function return Strings with collected text }
    function CollectLangStrings: TStrings;

    function Translate(const AText: string): string;
    function TranslateText(const AText: string): string;
    1.014、动态计算并部署FMX对象Align布局的相关方法(1790行次)
    { Align }

    procedure ArrangeControl(const Control: IAlignableObject; AAlign: TAlignLayout; const AParentWidth, AParentHeight: Single;
    const ALastWidth, ALastHeight: Single; var R: TRectF);

    procedure AlignObjects(const AParent: TFmxObject; APadding: TBounds; AParentWidth, AParentHeight: Single;
    var ALastWidth, ALastHeight: Single; var ADisableAlign: Boolean);

    procedure RecalcAnchorRules(const Parent : TFmxObject; Anchors : TAnchors; const BoundsRect : TRectF;
    var AOriginalParentSize:TPointF; var AAnchorOrigin:TPointF; var AAnchorRules:TPointF);
    procedure RecalcControlOriginalParentSize(const Parent: TFmxObject; ComponentState : TComponentState;
    const Anchoring: Boolean; var AOriginalParentSize : TPointF);
    1.015、动态维护StyleLookup的相关方法(1773行次)
    { Resources }

    type
    TCustomFindStyleResource = function(const AStyleLookup: string; const Clone: Boolean = False): TFmxObject of object;

    procedure AddCustomFindStyleResource(const ACustomProc: TCustomFindStyleResource);
    procedure RemoveCustomFindStyleResource(const ACustomProc: TCustomFindStyleResource);

    procedure AddResource(const AObject: TFmxObject);
    procedure RemoveResource(const AObject: TFmxObject);
    function FindStyleResource(const AStyleLookup: string; const Clone: Boolean = False): TFmxObject;
    1.016、FMX中的TPixelFormat像素格式、颜色及其转化的相关方法(1756行次)
    { Pixel Formats }

    function PixelToFloat4(Input: Pointer; InputFormat: TPixelFormat): TAlphaColorF;
    procedure Float4ToPixel(const Input: TAlphaColorF; Output: Pointer; OutputFormat: TPixelFormat);

    function PixelToAlphaColor(Input: Pointer; InputFormat: TPixelFormat): TAlphaColor;
    procedure AlphaColorToPixel(Input: TAlphaColor; Output: Pointer; OutputFormat: TPixelFormat);

    procedure ScanlineToAlphaColor(Input: Pointer; Output: PAlphaColor; PixelCount: Integer; InputFormat: TPixelFormat);
    procedure AlphaColorToScanline(Input: PAlphaColor; Output: Pointer; PixelCount: Integer; OutputFormat: TPixelFormat);
    procedure ChangePixelFormat(const AInput: Pointer; const AOutput: Pointer; const APixelCount: Integer;
    const AInputFormat, AOutputFormat: TPixelFormat);

    function PixelFormatToString(Format: TPixelFormat): string;
    function FindClosestPixelFormat(Format: TPixelFormat; const FormatList: TPixelFormatList): TPixelFormat;
    1.017、FMX中的持久类TPersistent相关的维护接口(1700行次)
    ///<summary>Provider a persistent object for the designer. A different TPersistent can be routed into the
    /// designer using this interface. This can be used to expose properties of non-controls in the
    /// Object Inspector.</summary>
    IPersistentProvider = interface
    ['{B0B03758-A2F5-49B9-9A39-C2C2405B2EAD}']
    ///<summary>Return the provided persistent</summary>
    function GetPersistent: TPersistent;
    end;

    ///<summary>Shim is a representative of a visual non-control object in the Designer. The shim needs to implement
    /// this interface in order to let the Designer know about its bounding rectangles.
    ///</summary>
    IPersistentShim = interface
    ['{B6F815C7-BFD1-489D-A661-0CD4639EC920}']
    ///<summary>Return bounding rectangle of shim.</summary>
    function GetBoundsRect: TRect;
    end;

    ///<summary>Extension of TPersistent directly exposed to the Designer.</summary>
    IDesignablePersistent = interface
    ['{4A731994-9060-4F3C-92D7-C123B04601D4}']
    ///<summary>GetDesignParent should return a TPersistent known to the designer, e.g. its parent TControl.</summary>
    function GetDesignParent: TPersistent;
    ///<summary>Bounding rectangle representing this TPersistent in the designer</summary>
    function GetBoundsRect: TRect;
    ///<summary>
    /// Bind this persistent with its shim, thus enabling GetBoundsRect without using the host.
    /// Example: TItemAppearanceProperties as IDesignablePersistent are bound to the TListItemShim
    /// Their counterpart FmxReg.TListViewObjectsProperties are bound to the same TListItemShim
    ///</summary>
    procedure Bind(AShim: IPersistentShim);
    ///<summary>
    /// Unbind this persistent. The implementation would normally clear its reference to IPersistentShim.
    ///</summary>
    procedure Unbind;
    ///<summary>True if this TPersistent is currently in Design mode and wants the Designer to create
    ///IItem for itself.</summary>
    function BeingDesigned: Boolean;
    end;

    ///<summary>Interface for TPersistent to receive bounding rectangle changes from the Designer.</summary>
    IMovablePersistent = interface
    ['{A86F9221-09E9-40A7-AF0E-5C3EB859C297}']
    /// <summary>Set bounds rectangle.</summary>
    procedure SetBoundsRect(const AValue: TRect);
    end;

    ///<summary>Interface that allows binding a TPersistent with a TreeView Sprig in StructureView</summary>
    ISpriggedPersistent = interface
    1.018、FMX中的TGuillotineBinPack矩形区域截取类相关(1594行次)
    { TGuillotineBinPack }

    TFreeChoiceHeuristic = (BestAreaFit, BestShortSideFit, BestLongSideFit, WorstAreaFit, WorstShortSideFit,
    WorstLongSideFit);

    TSplitMethodHeuristic = (ShorterLeftoverAxis, LongerLeftoverAxis, MinimizeArea, MaximizeArea, ShorterAxis,
    LongerAxis);

    TGuillotineBinPack = class
    private
    //..........
    public
    constructor Create; overload;
    constructor Create(const ASize: TPoint); overload;
    destructor Destroy; override;

    procedure Init(const ASize: TPoint);
    procedure MergeFreeList;

    function Insert(const NodeSize: TPoint; const Merge: Boolean = True;
    const FreeChoice: TFreeChoiceHeuristic = TFreeChoiceHeuristic.BestAreaFit;
    const SplitMethod: TSplitMethodHeuristic = TSplitMethodHeuristic.MinimizeArea): TRect;

    property Size: TPoint read FSize;
    property Occupancy: Single read GetOccupancy;
    property SupportsRectangleInversion: Boolean read FSupportsRectangleInversion write FSupportsRectangleInversion;
    end;
    1.019、FMX中的线条的索引及长短的捕获类相关(1566行次)
    { TLineInfo }

    PLineMetric = ^TLineMetric;
    TLineMetric = record
    Index: integer;
    Len: integer;
    end;

    TLineMetricInfo = class
    protected
    //.........
    public
    constructor Create;
    destructor Destroy; override;
    procedure Clear; virtual;
    property Count: integer read GetCount write SetCount;
    property Metrics[ind: integer]: PLineMetric read GetMetrics;
    end;
    1.020、FMX内置的TTimer毫秒计时器及其计时接口服务相关(1530行次)
    { TTimer }

    TTimerProc = procedure of object;

    IFMXTimerService = interface(IInterface)
    ['{856E938B-FF7B-4E13-85D4-3414A6A9FF2F}']
    function CreateTimer(Interval: Integer; TimerFunc: TTimerProc): TFmxHandle;
    function DestroyTimer(Timer: TFmxHandle): Boolean;
    function GetTick: Double;
    end;

    TTimer = class(TFmxObject)
    const
    cIdNoTimer: TFmxHandle = TFmxHandle(-1);
     

    1.021、FMX的弹出菜单PopupMenu相关(1243行次)
    { TCustomPopupMenu }

    TCustomPopupMenu = class(TFmxObject)
    private
    [Weak] FPopupComponent: TComponent;
    FOnPopup: TNotifyEvent;
    protected
    procedure DoPopup; virtual;
    property OnPopup: TNotifyEvent read FOnPopup write FOnPopup;
    public
    procedure Popup(X, Y: Single); virtual; abstract;
    property PopupComponent: TComponent read FPopupComponent write FPopupComponent;
    end;
    1.022、FMX的TTabList类及其接口相关(1219、676行次)
    TTabList = class(TAggregatedObject, ITabList)
    strict private
    //.........
    protected
    //.........
    public
    constructor Create(const TabStopController: ITabStopController);
    destructor Destroy; override;
    procedure Clear;
    procedure Add(const TabStop: IControl); virtual;
    procedure Remove(const TabStop: IControl); virtual;
    procedure Update(const TabStop: IControl; const NewValue: TTabOrder);
    function IndexOf(const TabStop: IControl): Integer; virtual;
    function GetCount: Integer; virtual;
    function GetItem(const Index: Integer): IControl; virtual;
    function GetTabOrder(const TabStop: IControl): TTabOrder;
    function FindNextTabStop(const Current: IControl; const MoveForward: Boolean; const Climb: Boolean): IControl;
    end;
    TTabListClass = class of TTabList;
    ITabList = interface
    ['{80C67BA2-3064-4d90-A8E1-B00028CA670E}']
    procedure Add(const TabStop: IControl);
    procedure Remove(const TabStop: IControl);
    procedure Update(const TabStop: IControl; const NewValue: TTabOrder);
    function GetTabOrder(const TabStop: IControl): TTabOrder;
    function GetCount: Integer;
    function GetItem(const Index: Integer): IControl;
    function FindNextTabStop(const Current: IControl; const MoveForward: Boolean; const Climb: Boolean): IControl;
    property Count: Integer read GetCount;
    end;

    ITabStopController = interface
    ['{E7D2E0C5-EA3B-40bd-B728-5E4BB264EFC1}']
    function GetTabList: ITabList;
    property TabList: ITabList read GetTabList;
    end;
     1.023、通过StyleName快速访问FMX对象的相关类(1034行次)
    /// <summary>Index for getting fast access to nested objects by <c>StyleName</c>.</summary>
    TStyleIndexer = class
    private
    //.....
    public
    constructor Create(const AStyle: TFmxObject);
    destructor Destroy; override;

    /// <summary>Marks index for lazy update.</summary>
    procedure NeedRebuild;
    /// <summary>Updates index, if it's required only.</summary>
    procedure RebuildIfNeeded;
    /// <summary>Finds style object by specified <c>StyleLookup</c> value and returns object in <c>AObject</c>.</summary>
    function FindStyleObject(const AStyleLookup: string; var AObject: TFmxObject): Boolean;
    /// <summary>Clears index.</summary>
    procedure Clear;
    end;
    1.024、TEnumProcResult枚举过程结果的全局枚举类型(1031行次)
    TEnumProcResult = (Continue, Discard, Stop);
    1.025、FMX对象TFmxObject相关类(1053行次)
    { TFmxObject }

    TEnumProcResult = (Continue, Discard, Stop);

    /// <summary>Index for getting fast access to nested objects by <c>StyleName</c>.</summary>
    TStyleIndexer = class
    end;

    TFmxObject = class(TComponent, IFreeNotification, IActionClient)
    public type
    /// <summary> Determines the current state of the object
    /// <para>CallingFreeNotify - state is set before sending notifications in <b>BeforeDestruction</b> method.
    /// See also <b>IFreeNotification</b></para>
    /// <para>CallingRelease - state is set in <b>Release</b> method</para>
    /// </summary>
    TObjectState = set of (CallingFreeNotify, CallingRelease) deprecated 'Support to this state will be removed';
    strict private
    //..........
    private
    //..........
    protected
    //..........
    public
    function GetParentComponent: TComponent; override;
    function HasParent: Boolean; override;
    protected
    //..........
    public
    constructor Create(AOwner: TComponent); override;
    destructor Destroy; override;
    procedure BeforeDestruction; override;
    procedure Release; virtual; deprecated 'Support for this method will be removed';
    function Released: Boolean; deprecated 'Support for this method will be removed';
    /// <summary> Describes the current state of this instance. Indicates that a component needs to avoid certain
    /// actions. <para>See also <b>TComponent.ComponentState</b></para></summary>
    function ObjectState: TObjectState; deprecated 'Support for this funcionality will be removed';
    procedure SetRoot(ARoot: IRoot);
    { design }
    procedure SetDesign(Value: Boolean; SetChildren: Boolean = True);
    { clone }
    function Clone(const AOwner: TComponent): TFmxObject;
    { childs }
    procedure AddObject(const AObject: TFmxObject);
    procedure InsertObject(Index: Integer; const AObject: TFmxObject);
    procedure RemoveObject(const AObject: TFmxObject); overload;
    procedure RemoveObject(Index: Integer); overload;
    function ContainsObject(AObject: TFmxObject): Boolean; virtual;
    procedure Exchange(const AObject1, AObject2: TFmxObject); virtual;
    procedure DeleteChildren;
    function IsChild(AObject: TFmxObject): Boolean; virtual;
    procedure BringChildToFront(const Child: TFmxObject);
    procedure SendChildToBack(const Child: TFmxObject);
    procedure BringToFront; virtual;
    procedure SendToBack; virtual;
    procedure AddObjectsToList(const AList: TFmxObjectList);
    procedure Sort(Compare: TFmxObjectSortCompare); virtual;
    /// <summary>Loops through the children of this object, and runs the specified procedure once per object as the first parameter in each call.</summary>
    procedure EnumObjects(const Proc: TFunc<TFmxObject, TEnumProcResult>);
    { animation property }
    procedure AnimateFloat(const APropertyName: string; const NewValue: Single; Duration: Single = 0.2;
    AType: TAnimationType = TAnimationType.In; AInterpolation: TInterpolationType = TInterpolationType.Linear);
    deprecated 'Use FMX.Ani.TAnimator instead';
    procedure AnimateFloatDelay(const APropertyName: string; const NewValue: Single; Duration: Single = 0.2;
    Delay: Single = 0.0; AType: TAnimationType = TAnimationType.In;
    AInterpolation: TInterpolationType = TInterpolationType.Linear);
    deprecated 'Use FMX.Ani.TAnimator instead';
    procedure AnimateFloatWait(const APropertyName: string; const NewValue: Single; Duration: Single = 0.2;
    AType: TAnimationType = TAnimationType.In; AInterpolation: TInterpolationType = TInterpolationType.Linear);
    deprecated 'Use FMX.Ani.TAnimator instead';
    procedure AnimateInt(const APropertyName: string; const NewValue: Integer; Duration: Single = 0.2;
    AType: TAnimationType = TAnimationType.In; AInterpolation: TInterpolationType = TInterpolationType.Linear);
    deprecated 'Use FMX.Ani.TAnimator instead';
    procedure AnimateIntWait(const APropertyName: string; const NewValue: Integer; Duration: Single = 0.2;
    AType: TAnimationType = TAnimationType.In; AInterpolation: TInterpolationType = TInterpolationType.Linear);
    deprecated 'Use FMX.Ani.TAnimator instead';
    procedure AnimateColor(const APropertyName: string; NewValue: TAlphaColor; Duration: Single = 0.2;
    AType: TAnimationType = TAnimationType.In; AInterpolation: TInterpolationType = TInterpolationType.Linear);
    deprecated 'Use FMX.Ani.TAnimator instead';
    procedure StopPropertyAnimation(const APropertyName: string);
    { notify }
    procedure AddFreeNotify(const AObject: IFreeNotification);
    procedure RemoveFreeNotify(const AObject: IFreeNotification);
    { resource }
    function FindStyleResource(const AStyleLookup: string; const AClone: Boolean = False): TFmxObject; overload; virtual;
    { }
    property Root: IRoot read FRoot;
    property Stored: Boolean read FStored write SetStored;
    { tags }
    property TagObject: TObject read FTagObject write FTagObject;
    property TagFloat: Single read FTagFloat write FTagFloat;
    property TagString: string read FTagString write FTagString;
    { children }
    property ChildrenCount: Integer read GetChildrenCount;
    property Children: TFmxChildrenList read FChildrenList;
    property Data: TValue read GetData write SetData;
    property Parent: TFmxObject read FParent write SetParent;
    property Index: Integer read GetIndex write SetIndex;
    property ActionClient: boolean read GetActionClient;
    published
    property StyleName: string read FStyleName write SetStyleName;
    end;

    TTabList = class(TAggregatedObject, ITabList)
    end;
    TTabListClass = class of TTabList;

    1.026、FMX对象列表类TFmxObjectList及其子对象TFmxChildrenList的枚举列表类、FMX对象间的比较匿名函数的参照全局类(1053行次)
    TFmxObjectSortCompare = reference to function (Left, Right: TFmxObject): Integer;

    TFmxObjectList = TList<TFmxObject>;

    TFmxChildrenList = class(TEnumerable<TFmxObject>)
    strict private
    //......
    protected
    //......
    public
    constructor Create(const AChildren: TFmxObjectList);
    destructor Destroy; override;
    property Count: Integer read GetChildCount;
    function IndexOf(const Obj: TFmxObject): Integer; virtual;
    property Items[Index: Integer]: TFmxObject read GetChild; default;
    end;
    1.027、FMX对象的位置、纵横比、旋转的外观转化的本地持久类(967行次)
    { TTransform }

    TTransform = class(TPersistent)
    private
    //......
    protected
    //......
    public
    constructor Create; virtual;
    destructor Destroy; override;
    procedure Assign(Source: TPersistent); override;
    property Matrix: TMatrix read FMatrix;
    property OnChanged: TNotifyEvent read FOnChanged write FOnChanged;
    published
    property Position: TPosition read FPosition write SetPosition;
    property Scale: TPosition read FScale write SetScale;
    property RotationAngle: Single read FRotationAngle write SetRotationAngle;
    property RotationCenter: TPosition read FRotationCenter write FRotationCenter;
    end;
    1.028、FMX曲线类TSpline(699行次)
    TSpline = class(TObject)
    private
    //.........
    public
    constructor Create(const Polygon: TPolygon);
    destructor Destroy; override;
    procedure SplineXY(const t: Single; var X, Y: Single);
    end;
    1.029、FMX中Items类型等容器接口(669行次)
    IItemsContainer = interface
    ['{100B2F87-5DCB-4699-B751-B4439588E82A}']
    function GetItemsCount: Integer;
    function GetItem(const AIndex: Integer): TFmxObject;
    function GetObject: TFmxObject;
    end;
    IContainerObject = interface
    ['{DE635E60-CB00-4741-92BB-3B8F1F29A67C}']
    function GetContainerWidth: Single;
    function GetContainerHeight: Single;
    property ContainerWidth: single read GetContainerWidth;
    property ContainerHeight: single read GetContainerHeight;
    end;
     1.030、FMX原生控件的句柄接口(555行次)
    INativeControl = interface
    ['{3E6F1A17-BAE3-456C-8551-5F6EA92EEE32}']
    function GetHandle: TFmxHandle;
    procedure SetHandle(const Value: TFmxHandle);
    function GetHandleSupported: boolean;
    property HandleSupported: boolean read GetHandleSupported;
    property Handle: TFmxHandle read GetHandle write SetHandle;
    end;
    1.031、FMX对象及其子对象重新布局接口IAlignRoot(549行次)
    IAlignRoot = interface
    ['{86DF30A6-0394-4a0e-8722-1F2CDB242CE8}']
    procedure Realign;
    procedure ChildrenAlignChanged;
    end;
    1.032、FMX对象的IRoot祖先根节点接口(524行次)
    IRoot = interface
    ['{7F7BB7B0-5932-49dd-9D35-712B2BA5D8EF}']
    procedure AddObject(const AObject: TFmxObject);
    procedure InsertObject(Index: Integer; const AObject: TFmxObject);
    procedure RemoveObject(const AObject: TFmxObject); overload;
    procedure RemoveObject(Index: Integer); overload;
    procedure BeginInternalDrag(const Source: TObject; const ABitmap: TObject);
    function GetActiveControl: IControl;
    procedure SetActiveControl(const AControl: IControl);
    function GetCaptured: IControl;
    procedure SetCaptured(const Value: IControl);
    function GetFocused: IControl;
    procedure SetFocused(const Value: IControl);
    function NewFocusedControl(const Value: IControl): IControl;
    function GetHovered: IControl;
    procedure SetHovered(const Value: IControl);
    function GetObject: TFmxObject;
    function GetBiDiMode: TBiDiMode;
    { access }
    property Captured: IControl read GetCaptured write SetCaptured;
    property Focused: IControl read GetFocused write SetFocused;
    property Hovered: IControl read GetHovered write SetHovered;
    property BiDiMode: TBiDiMode read GetBiDiMode;
    end;
    1.033、FMX对象嵌套的内容捕获接口(407行次)
    IContent = interface
    ['{96E89B94-2AD6-4AD3-A07C-92E66B2E6BC8}']
    function GetParent: TFmxObject;
    function GetObject: TFmxObject;
    function GetChildrenCount: Integer;
    property Parent: TFmxObject read GetParent;
    property ChildrenCount: Integer read GetChildrenCount;
    procedure Changed;
    end;
    1.034、FMX控件的行为的释放通知接口(430行次),比如焦点等等各种事件
    IControl = interface(IFreeNotificationBehavior)
    ['{7318D022-D048-49DE-BF55-C5C36A2AD1AC}']
    function GetObject: TFmxObject;
    procedure SetFocus;
    function GetIsFocused: Boolean;
    function GetCanFocus: Boolean;
    function GetCanParentFocus: Boolean;
    function GetEnabled: Boolean;
    function GetAbsoluteEnabled: Boolean;
    function GetPopupMenu: TCustomPopupMenu;
    function EnterChildren(AObject: IControl): Boolean;
    function ExitChildren(AObject: IControl): Boolean;
    procedure DoEnter;
    procedure DoExit;
    procedure DoActivate;
    procedure DoDeactivate;
    procedure DoMouseEnter;
    procedure DoMouseLeave;
    function ShowContextMenu(const ScreenPosition: TPointF): Boolean;
    function ScreenToLocal(P: TPointF): TPointF;
    function LocalToScreen(P: TPointF): TPointF;
    function ObjectAtPoint(P: TPointF): IControl;
    procedure MouseDown(Button: TMouseButton; Shift: TShiftState; X, Y: Single);
    procedure MouseMove(Shift: TShiftState; X, Y: Single);
    procedure MouseUp(Button: TMouseButton; Shift: TShiftState; X, Y: Single);
    procedure MouseWheel(Shift: TShiftState; WheelDelta: Integer; var Handled: Boolean);
    procedure MouseClick(Button: TMouseButton; Shift: TShiftState; X, Y: Single);
    procedure KeyDown(var Key: Word; var KeyChar: WideChar; Shift: TShiftState);
    procedure KeyUp(var Key: Word; var KeyChar: WideChar; Shift: TShiftState);
    procedure Tap(const Point: TPointF);
    procedure DialogKey(var Key: Word; Shift: TShiftState);
    procedure AfterDialogKey(var Key: Word; Shift: TShiftState);
    function FindTarget(P: TPointF; const Data: TDragObject): IControl;
    procedure DragEnter(const Data: TDragObject; const Point: TPointF);
    procedure DragOver(const Data: TDragObject; const Point: TPointF; var Operation: TDragOperation);
    procedure DragDrop(const Data: TDragObject; const Point: TPointF);
    procedure DragLeave;
    procedure DragEnd;
    function CheckForAllowFocus: Boolean;
    procedure Repaint;
    function GetDragMode: TDragMode;
    procedure SetDragMode(const ADragMode: TDragMode);
    procedure BeginAutoDrag;
    function GetParent: TFmxObject;
    function GetLocked: Boolean;
    function GetVisible: Boolean;
    procedure SetVisible(const Value: Boolean);
    function GetHitTest: Boolean;
    function GetCursor: TCursor;
    function GetInheritedCursor: TCursor;
    function GetDesignInteractive: Boolean;
    function GetAcceptsControls: Boolean;
    procedure SetAcceptsControls(const Value: Boolean);
    procedure BeginUpdate;
    procedure EndUpdate;
    function GetTabStopController: ITabStopController;
    function GetTabStop: Boolean;
    procedure SetTabStop(const TabStop: Boolean);
    /// <summary>This method returns true if the control has an available hint to display.</summary>
    function HasHint: Boolean;
    /// <summary>If HasHint is true, this method is invoked in order to know if the control has an available
    /// string to swho as hint.</summary>
    function GetHintString: string;
    /// <summary>If HasHint is true, this method is invoked in order to know if the control has a custom hint
    /// object to manage the hint display. This usually returns an instance of THint to allow the form to manage
    /// it.</summary>
    function GetHintObject: TObject;
    { access }
    property AbsoluteEnabled: Boolean read GetAbsoluteEnabled;
    property Cursor: TCursor read GetCursor;
    property InheritedCursor: TCursor read GetInheritedCursor;
    property DragMode: TDragMode read GetDragMode write SetDragMode;
    property DesignInteractive: Boolean read GetDesignInteractive;
    property Enabled: Boolean read GetEnabled;
    property Parent: TFmxObject read GetParent;
    property Locked: Boolean read GetLocked;
    property HitTest: Boolean read GetHitTest;
    property PopupMenu: TCustomPopupMenu read GetPopupMenu;
    property Visible: Boolean read GetVisible write SetVisible;
    property AcceptsControls: Boolean read GetAcceptsControls write SetAcceptsControls;
    property IsFocused: Boolean read GetIsFocused;
    property TabStop: Boolean read GetTabStop write SetTabStop;
    end;
    IFreeNotificationBehavior = interface
    ['{83F052C5-8696-4AFA-88F5-DCDFEF005480}']
    procedure AddFreeNotify(const AObject: IFreeNotification);
    procedure RemoveFreeNotify(const AObject: IFreeNotification);
    end;
    1.035、FMX的其它与布局和显示相关的基础常量和枚举类型(193、74行次)
    TPixelFormat = (None, RGB, RGBA, BGR, BGRA, RGBA16, BGR_565, BGRA4, BGR4, BGR5_A1, BGR5, BGR10_A2, RGB10_A2, L, LA,
    LA4, L16, A, R16F, RG16F, RGBA16F, R32F, RG32F, RGBA32F);

    TPixelFormatList = TList<TPixelFormat>;

    const
    PixelFormatBytes: array[TPixelFormat] of Integer = ({ None } 0, { RGB } 4, { RGBA } 4, { BGR } 4, { BGRA } 4,
    { RGBA16 } 8, { BGR_565 } 2, { BGRA4 } 2, { BGR4 } 2, { BGR5_A1 } 2, { BGR5 } 2, { BGR10_A2 } 4, { RGB10_A2 } 4,
    { L } 1, { LA } 2, { LA4 } 1, { L16 } 2, { A } 1, { R16F } 2, { RG16F } 4, { RGBA16F } 8, { R32F } 4, { RG32F } 8,
    { RGBA32F } 16);

    NullRect: TRectF = (Left: 0; Top: 0; Right: 0; Bottom: 0);

    AllCorners: TCorners = [TCorner.TopLeft, TCorner.TopRight,
    TCorner.BottomLeft, TCorner.BottomRight];

    AllSides: TSides = [TSide.Top, TSide.Left, TSide.Bottom, TSide.Right];

    ClosePolygon: TPointF = (X: $FFFF; Y: $FFFF) deprecated 'Non-closed polygons are not supported.';

    /// <summary>A special polygon point marker typically used for converting paths to polygons and vice-versa,
    /// usually indicating path closure. For the rendering methods, this marker has no meaning and the actual
    /// interpretation may be platform-dependent.</summary>
    PolygonPointBreak: TPointF = (X: $FFFFFF; Y: $FFFFFF);

    AllStyledSettings: TStyledSettings = [TStyledSetting.Family,
    TStyledSetting.Size,
    TStyledSetting.Style,
    TStyledSetting.FontColor,
    TStyledSetting.Other];
    DefaultStyledSettings: TStyledSettings = [TStyledSetting.Family,
    TStyledSetting.Size,
    TStyledSetting.Style,
    TStyledSetting.FontColor];

    InvalidSize : TSizeF = (cx: -1; cy: -1);

    AlignmentToTTextAlign: array [TAlignment] of TTextAlign =
    (TTextAlign.Leading, TTextAlign.Trailing, TTextAlign.Center);
    type

    TOSPlatform = (Windows, OSX, iOS, Android, Linux);

    TPointArray = array [0..0] of TPointF;

    TLongByteArray = array [0..MaxInt - 1] of Byte;
    PLongByteArray = ^TLongByteArray;
     
    ————————————————
    版权声明:本文为CSDN博主「pulledup」的原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接及本声明。
    原文链接:https://blog.csdn.net/pulledup/article/details/105162617

  • 相关阅读:
    Java中的线程安全问题
    谈谈你对Spring的理解
    Word 2016问题导致无法创建其他博客账号
    JS中 Cookie、 LocalStorage 与 SessionStorage
    CSDN代码块显示颜色
    Java中创建线程的两种方式
    毕业设计每日博客——第五周1
    毕业设计每日博客--第四周5
    毕业设计每日博客--第四周4
    毕业设计每日博客--第四周3
  • 原文地址:https://www.cnblogs.com/Thenext/p/14544563.html
Copyright © 2020-2023  润新知