unit CaptionPanel; interface uses WebCore, WebUI, WebCtrls, WebForms, WebIcons; const CAPTION_ELEMENT_NAME = 'Caption'; CAPTION_ELEMENT_ICON = 'Icon'; type {$INTERFACE TCaptionPanel} TCaptionPanelIcon = class(TIconProperties) protected procedure InitializeProperties; override; function GetIconElement: TElement; override; end; TCaptionPanel = class(TControl) private { Private declarations } FCaption: string; FCaptionElement: TElement; FIcon: TIconProperties; FIconElement: TElement; function GetBackground: TBackground; function GetBorder: TBorder; function GetCorners: TCorners; function GetInsetShadow: TInsetShadow; function GetOutsetShadow: TOutsetShadow; function GetPadding: TPadding; function GetFont: TFont; function GetFormat: TFormat; procedure SetCaption(Value: string); protected { Protected declarations } property Background: TBackground read GetBackground; property Border: TBorder read GetBorder; property Corners: TCorners read GetCorners; property InsetShadow: TInsetShadow read GetInsetShadow; property OutsetShadow: TOutsetShadow read GetOutsetShadow; property Padding: TPadding read GetPadding; function CreateElement: TElement; override; procedure InitializeProperties; override; function GetInterfaceClassName: String; override; procedure CreateInterfaceElements; override; procedure UpdateInterfaceState; override; function DoClick: Boolean; override; property IconElement: TElement read FIconElement; public { Public declarations } published { Published declarations } property Caption: string read FCaption write SetCaption; property Icont: TIconProperties read FIcon; property Font: TFont read GetFont; property Format: TFormat read GetFormat; property Top; property Left; property Height; property Width; property ActivateOnClick; property AlwaysOnTop; property Animations; property Background; property Border; property Constraints; property Corners; property Cursor; property DisplayOrder; property InsetShadow; property Layout; property LayoutOrder; property Margins; property Opacity; property OutsetShadow; property Padding; property TabOrder; property TabStop default True; property Tag; property Visible; property OnAnimationComplete; property OnAnimationsComplete; property OnShow; property OnHide; property OnMove; property OnSize; property OnClick; property OnDblClick; property OnMouseDown; property OnMouseMove; property OnMouseUp; property OnMouseEnter; property OnMouseLeave; property OnTouchStart; property OnTouchMove; property OnTouchEnd; property OnTouchCancel; property OnKeyDown; property OnKeyPress; property OnKeyUp; end; implementation { TCaptionPanelIcon } procedure TCaptionPanelIcon.InitializeProperties; begin inherited InitializeProperties; CheckOwnerClass(TCaptionPanel); end; function TCaptionPanelIcon.GetIconElement: TElement; begin Result := TCaptionPanel(Owner).IconElement; end; { TCaptionPanel } function TCaptionPanel.CreateElement: TElement; begin Result := InterfaceManager.CreateElement(BASE_ELEMENT_NAME,nil,ELEMENT_CLASS_DIV,True); end; procedure TCaptionPanel.InitializeProperties; begin inherited InitializeProperties; FIcon := TCaptionPanelIcon.Create(Self); InterfaceState := NORMAL_STATE_NAME; FCaption := 'Caption'; end; function TCaptionPanel.GetInterfaceClassName: String; begin Result := TCaptionPanel.ClassName; end; procedure TCaptionPanel.CreateInterfaceElements; begin inherited CreateInterfaceElements; FCaptionElement := InterfaceManager.CreateElement(CAPTION_ELEMENT_NAME,Element,ELEMENT_CLASS_DIV); FIconElement := InterfaceManager.CreateElement(CAPTION_ELEMENT_ICON,Element,ELEMENT_CLASS_DIV); end; procedure TCaptionPanel.UpdateInterfaceState; begin inherited UpdateInterfaceState; end; function TCaptionPanel.DoClick: Boolean; begin inherited DoClick; end; procedure TCaptionPanel.SetCaption(Value: string); begin if Value <> FCaption then begin FCaption := Value; FCaptionElement.Content := FCaption; end; end; function TCaptionPanel.GetBackground: TBackground; begin Result := Element.Background; end; function TCaptionPanel.GetBorder: TBorder; begin Result := Element.Border; end; function TCaptionPanel.GetCorners: TCorners; begin Result := Element.Corners; end; function TCaptionPanel.GetInsetShadow: TInsetShadow; begin Result := Element.InsetShadow; end; function TCaptionPanel.GetPadding: TPadding; begin Result := Element.Padding; end; function TCaptionPanel.GetOutsetShadow: TOutsetShadow; begin Result := Element.OutsetShadow; end; function TCaptionPanel.GetFont: TFont; begin Result := FCaptionElement.Font; end; function TCaptionPanel.GetFormat: TFormat; begin Result := FCaptionElement.Format; end; end.