using HDL_ON.UI.Music;
using System;
using Shared;
namespace HDL_ON.UI.UI2.FuntionControlView.Aks.CommonView
{
public class TypeMultiFramLayout
{
///
/// 是否可以点击
///
private bool mIsClick = true;
///
/// 设置控制点击事件
///
/// false点击无效
public void setClick(bool isClick)
{
this.mIsClick = isClick;
}
private uint UpBackgroundColor =BaseFramLayout.unParentBackgroundColor;
private uint DownBackgroundColor =BaseFramLayout.seleBackgroundColor;
///
/// 多个类型容器
///
public FrameLayout multiFramLayout = new FrameLayout
{
BackgroundColor = MusicColor.ViewColor,
X = Application.GetRealWidth(16),
Width = Application.GetRealWidth(311),
Height = Application.GetRealHeight(40),
Radius = (uint)Application.GetRealHeight(20),
};
public FrameLayout leftFramLayout = new FrameLayout
{
X = Application.GetRealWidth(16),
Gravity = Gravity.CenterVertical,
Width = Application.GetRealWidth(139),
Height = Application.GetRealHeight(23),
Radius = (uint)Application.GetRealHeight(20),
};
public Button btnLeftImage = new Button
{
Width = Application.GetRealWidth(16),
Height = Application.GetRealWidth(16),
UnSelectedImagePath = "AksIcon/shixuqi.png",
Gravity = Gravity.CenterVertical,
Name = "btnBottonLeftImage",
};
public Button btnLeftName = new Button
{
Width = Application.GetRealWidth(100 + 10),
Height = Application.GetRealHeight(23),
TextID = StringId.shixuqi,
TextSize = TextSize.Text16,
TextColor = MusicColor.TextColor,
TextAlignment = TextAlignment.CenterLeft,
Gravity = Gravity.CenterVertical,
};
public FrameLayout lineFramLayout = new FrameLayout
{
BackgroundColor = MusicColor.TextColor,
Y = Application.GetRealHeight(10),
Width = Application.GetRealWidth(1),
Height = Application.GetRealHeight(20),
};
public FrameLayout rightFramLayout = new FrameLayout
{
Gravity = Gravity.CenterVertical,
Width = Application.GetRealWidth(138),
Height = Application.GetRealHeight(23),
Radius = (uint)Application.GetRealHeight(20),
};
public Button btnRightImage = new Button
{
Width = Application.GetRealWidth(16),
Height = Application.GetRealWidth(16),
UnSelectedImagePath = "AksIcon/xuanze.png",
Gravity = Gravity.CenterRight,
};
public Button btnRightName = new Button
{
Width = Application.GetRealWidth(100 + 16),
Height = Application.GetRealHeight(23),
TextID = StringId.bofangqi,
TextSize = TextSize.Text16,
TextColor = MusicColor.TextColor,
TextAlignment = TextAlignment.CenterRight,
Gravity = Gravity.CenterVertical,
Padding = new Padding(0, 0, 0, 0),
};
public void AddView(FrameLayout layout)
{
layout.AddChidren(multiFramLayout);
multiFramLayout.AddChidren(leftFramLayout);
leftFramLayout.AddChidren(btnLeftImage);
leftFramLayout.AddChidren(btnLeftName);
multiFramLayout.AddChidren(lineFramLayout);
multiFramLayout.AddChidren(rightFramLayout);
rightFramLayout.AddChidren(btnRightImage);
rightFramLayout.AddChidren(btnRightName);
btnLeftName.X = btnLeftImage.Right + Application.GetRealWidth(4);
lineFramLayout.X = leftFramLayout.Right;
rightFramLayout.X = lineFramLayout.Right;
btnRightName.X = Application.GetRealWidth(4);
}
public void SetClickUpBackgroundColor(uint backgroundColor)
{
this.UpBackgroundColor = backgroundColor;
}
public void SetClickDownBackgroundColor(uint backgroundColor)
{
this.DownBackgroundColor = backgroundColor;
}
///
/// 序时器类型容器
///
/// 回调(第一个是父类对象
public void SetLeftFlClickListener(Action action)
{
EventHandler UpClick = (sender, e) =>
{
//leftFramLayout.BackgroundColor = this.UpBackgroundColor;
//弹起来还原背景颜色
};
leftFramLayout.MouseUpEventHandler += UpClick;
btnLeftImage.MouseUpEventHandler += UpClick;
btnLeftName.MouseUpEventHandler += UpClick;
EventHandler DownClick = (sender, e) =>
{
//按下去改变背景颜色
//leftFramLayout.BackgroundColor = this.DownBackgroundColor;
action?.Invoke(leftFramLayout);
};
leftFramLayout.MouseDownEventHandler += DownClick;
btnLeftImage.MouseDownEventHandler += DownClick;
btnLeftName.MouseDownEventHandler += DownClick;
}
///
/// 播放器类型容器
///
/// 回调(第一个是父类对象
public void SetRightFlClickListener(Action action)
{
EventHandler UpClick = (sender, e) =>
{
action?.Invoke(rightFramLayout);
//rightFramLayout.BackgroundColor = this.UpBackgroundColor;
//弹起来还原背景颜色
};
rightFramLayout.MouseUpEventHandler += UpClick;
btnRightImage.MouseUpEventHandler += UpClick;
btnRightName.MouseUpEventHandler += UpClick;
EventHandler DownClick = (sender, e) =>
{
//按下去改变背景颜色
//rightFramLayout.BackgroundColor =AksCommonMethod.seleBackgroundColor;
};
rightFramLayout.MouseDownEventHandler += DownClick;
btnRightImage.MouseDownEventHandler += DownClick;
btnRightName.MouseDownEventHandler += DownClick;
}
}
}