DOF/sqr/User/UI/Widget/Scroll_Bar.nut

67 lines
1.4 KiB
Plaintext
Raw Normal View History

2024-12-14 11:14:20 +08:00
/*
文件名:Scroll_Bar.nut
路径:User/UI/Widget/Scroll_Bar.nut
创建日期:2024-12-13 23:17
文件用途:
*/
2024-12-14 23:16:14 +08:00
//滚动条
2024-12-14 11:14:20 +08:00
class Yosin_ScrollBar extends Yosin_CommonUi {
//控制器
Controller = null;
//是否焦点
IsFocus = false;
//上按钮
UpButton = null;
2024-12-14 16:14:16 +08:00
//滚动按钮
ScrollButton = null;
2024-12-14 11:14:20 +08:00
//下按钮
DownButton = null;
2024-12-14 23:16:14 +08:00
//回调函数
OnChange = null;
2024-12-14 11:14:20 +08:00
//Path
Path = "sprite/interface/lenheartwindowcommon.img";
2024-12-14 16:14:16 +08:00
constructor(X, Y, H, S_H) {
2024-12-14 11:14:20 +08:00
base.constructor(X, Y, 9, H > 26 ? H : 26);
Controller = {
CurPos = 0,
}
//上按钮
UpButton = Yosin_BaseButton(0, 0, 9, 13, Path, 16);
//点击事件回调
UpButton.OnClick = function(Button) {
}.bindenv(this);
AddUIChild(UpButton);
//滚动条
2024-12-14 16:14:16 +08:00
ScrollButton = Yosin_DragButton(0, 13, 9, S_H, Path, 184, false, false);
ScrollButton.SetMaxMoveValue(Height - 26);
AddUIChild(ScrollButton);
2024-12-14 11:14:20 +08:00
//下按钮
DownButton = Yosin_BaseButton(0, Height - 13, 9, 13, Path, 22);
//点击事件回调
DownButton.OnClick = function(Button) {
}.bindenv(this);
AddUIChild(DownButton);
}
function Proc(Dt) {
base.Proc(Dt);
2024-12-14 23:16:14 +08:00
Controller.CurPos = ScrollButton.Detect_Value;
}
function SetChangeCallBack(Func) {
ScrollButton.OnChange = Func;
2024-12-14 11:14:20 +08:00
}
}