Widgets - SmartCL.Components
This unit is where visual controls are first introduced. The most fundamental class which implements the mechanism for self creation, attaching itself to – and detaching itself from another element, is TW3tagobj. From this basic object the following hierarchy is built:
TW3component
TW3Movablecontrol
TW3Customcontrol
Just like the object hierarchy in delphi, from TWinControl to TCustomcontrol, each descendant adds specific behavior and properties to the model it has inherited.
Smart Mobile Studio Property Inspector
TW3component adds the ability to house child components. It also introduces the familiar delphi component constructor, which takes an owner component as a parameter.
Properties:
public
function ChildByName(const compName: String): TW3Component;
function ChildByHandle(const aHandle: THandle): TW3Component;
procedure EnumChildren(childProc: procedure (child: TW3Component));
function TopLevelParent : TW3Component;
property Parent: TW3Component read FParent;
published
property Name: String read FName write setName;
TW3Movablecontrol adds properties like left, top, width and height (and associated methods like moveto, setbounds, etc.) and thus allows you to move an element around. This class was added between TW3component and TW3Customcontrol to provide a lightweight alternative for game and multimedia programmers. It is especially suited as a "sprite" (see unit w3sprites) which can be manipulated in both 2d and 3d via the built in Sprite3d engine (see w3sprite3d).
Properties:
public
property Constraints: TW3Constraints read getConstraints;
property BoundsRect: TRect read getBoundsRect;
property Background: TW3ControlBackground read GetBackGround;
property Border: TW3Borders read getBorder;
procedure AdjustToParentBox; virtual;
function ClientWidth: Integer;
function ClientHeight: Integer;
function ClientRect: TRect;
function ScreenRect: TRect;
function ClientToScreen(pt: TPoint): TPoint;
function ScreenToClient(pt: TPoint): TPoint;
procedure MoveTo(aLeft, aTop: Integer); virtual;
procedure SetSize(aWidth, aHeight: Integer); virtual;
procedure SetBounds(aLeft, aTop, aWidth, aHeight: Integer); overload; virtual;
procedure SetBounds(aRect: TRect); overload; virtual;
published
property Color: TColor read FColor write setColor;
property Visible: Boolean read getVisible write setVisible;
property Left: Integer read GetLeft write setLeft;
property Top: Integer read GetTop write setTop;
property Width: Integer read GetWidth write SetWidth;
property Height: Integer read GetHeight write setHeight;
property Opacity: Integer read FAlpha write setAlpha;
property AlphaBlend: Boolean read FUseAlpha write setUseAlpha;
property Transparent: Boolean read FTransparent write setTransparent;
TW3Customcontrol is the class all visual controls inherit from. It inherits the full richness of methods and properties from it’s ancestors, but adds sub-objects like background, font, border management, size restriction, CSS style management and scroll information. These sub objects are created on demand, so unless you access these from your code they remain dormant.
TW3Customcontrol is also the class that introduces support for gestures, touch and multi-touch – and all the events standard html entities expose. Depending on the entity a TW3Customcontrol represents, some events may not fire. For instance, if the control represents a html5 canvas the onScroll event will naturally never fire. Since there is a limited number of events under the DOM TW3Customcontrol publishes all of them.
Properties:
public
property CSSClasses: TW3CSSClassStyleNames read getClassNames;
property ScrollInfo: TW3ScrollInfo read getScrollInfo;
property Font: TW3ControlFont read getFont;
property BoundsRect: TRect read getBoundsRect;
function GetMaxZIndex: integer;
procedure SendToBack;
procedure BringToFront;
procedure SetFocus;
procedure LayoutChildren; virtual;
function GetSizeInfo: TW3ControlSizeInfo; virtual;
function GetChildrenSortedByYPos: TW3ComponentArray; virtual;
procedure Invalidate; virtual;
published
property OnResize: TReSizeEvent read FOnResize write _setResize;
property OnMouseDown: TMouseDownEvent read FOnMouseDown write _setMouseDown;
property OnMouseUp: TMouseUpEvent read FOnMouseUp write _setMouseUp;
property OnMouseMove: TMouseMoveEvent read FOnMouseMove write _setMouseMove;
property OnMouseEnter: TMouseEnterEvent read FOnMouseEnter write _setMouseEnter;
property OnMouseExit: TMouseExitEvent read FOnMouseExit write _setMouseExit;
property OnMouseWheel: TMouseWheelEvent read FOnMouseWheel write _setMouseWheel;
property OnClick: TMouseClickEvent read FOnClick write _setMouseClick;
property OnDblClick: TMouseDblClickEvent read FOnDblClick write _setMouseDblClick;
property OnContextPopup : TContextPopupEvent read FOnContextPopup write _setContextPopup;
property OnKeyDown: TKeyDownEvent read FOnKeyDown write _setKeyDown;
property OnKeyUp: TKeyUpEvent read FOnKeyUp write _setKeyUp;
property OnKeyPress: TKeyPressEvent read FOnKeyPress write _setKeyPress;
property OnAnimationBegins: TAnimationBeginsEvent read FOnAnimationBegins write _setAnimationBegins;
property OnAnimationEnds: TAnimationEndsEvent read FOnAnimationEnds write _setAnimationEnds;
property OnChanged: TChangedEvent read FOnChanged write _setChanged;
property OnGotFocus: TGotFocusEvent read FOnGotFocus write _setGotFocus;
property OnLostFocus: TLostFocusEvent read FOnLostFocus write _setLostFocus;
property OnTouchBegin: TTouchBeginEvent read FOnTouchBegins write _setTouchBegins;
property OnTouchMove: TTouchMoveEvent read FOnTouchMoves write _setTouchMoves;
property OnTouchEnd: TTouchEndEvent read FOnTouchEnds write _setTouchEnds;
property OnGestureStart: TGestureStartEvent read FOnGestureStart write _setGestureStart;
property OnGestureChange: TGestureChangeEvent read FOnGestureChange write _setGestureChange;
property OnGestureEnd: TGestureEndEvent read FOnGestureEnd write _setGestureEnd;
property Enabled: Boolean read getEnabled write setEnabled;
property Angle: Float read FAngle write setAngle;
property Zoom: Float read getZoom write setZoom;
property BorderRadius: Integer read getBorderRadius write setBorderRadius;
property StyleClass: String read getStyleClass write setStyleClass;
property Visible: Boolean read getVisible write setVisible;
property Left: Integer read GetLeft write setLeft;
property Top: Integer read GetTop write setTop;
property Width: Integer read GetWidth write SetWidth;
property Height: Integer read GetHeight write setHeight;
property Focused: Boolean read gethasFocus;
|