using System;
using HDL_ON.UI.CSS;
using Shared;
namespace HDL_ON.UI
{
///
/// 通用ListIconCellView
/// 支持定义 图标、主标题、go图标、下划线、点击事件
///
public class ListIconCellView : FrameLayout
{
///
/// 图标按钮
///
public Button BtnIcon;
///
/// 标题
///
public Button BtnTilte;
///
/// 箭头图标按钮
///
public Button BtnGo;
///
/// 分割线
///
public LineView LineView;
///
/// 点击触发对事件
///
public Action GoAction;
///
///
///
public ListIconCellView()
{
ShowView();
}
///
///
///
void ShowView()
{
this.Height = Application.GetRealHeight(50);
this.BackgroundColor = CSS_Color.MainBackgroundColor;
BtnIcon = new Button()
{
X = Application.GetRealWidth(16),
Width = Application.GetRealWidth(24),
Height = Application.GetRealWidth(24),
Gravity = Gravity.CenterVertical,
};
this.AddChidren(BtnIcon);
///
/// 标题
///
BtnTilte = new Button()
{
X = Application.GetRealWidth(52),
Width = Application.GetRealWidth(278),
TextAlignment = TextAlignment.CenterLeft,
TextColor = CSS_Color.FirstLevelTitleColor,
TextSize = CSS_FontSize.TextFontSize,
};
this.AddChidren(BtnTilte);
///
/// 前进图标
///
BtnGo = new Button()
{
X = Application.GetRealWidth(339),
Gravity = Gravity.CenterVertical,
Width = Application.GetMinRealAverage(16),
Height = Application.GetMinRealAverage(16),
UnSelectedImagePath = "Public/Right.png",
};
this.AddChidren(BtnGo);
LineView = new LineView(this.Height);
this.AddChidren(LineView);
//LineView.Y = this.Height - LineView.Height;
EventHandler eventHandler = (sender, e) =>
{
GoAction?.Invoke();
};
BtnTilte.MouseUpEventHandler = eventHandler;
BtnGo.MouseUpEventHandler = eventHandler;
}
}
}