mirror of
https://github.com/ultimatepp/ultimatepp.git
synced 2026-05-16 06:05:58 -06:00
43 lines
932 B
Text
43 lines
932 B
Text
|
|
|
|
ctrl LEDCtrl {
|
|
group "LEDCtrl";
|
|
|
|
GetMinSize() { sz = GetTextSize("X"); sz.cy = GetHeight( .SetLEDSize ) ; return sz; }
|
|
GetStdSize() { sz = GetMinSize(); sz.cx = GetWidth( .SetLEDSize, .SetStringSize ) ; return sz; }
|
|
|
|
Frame SetFrame = NullFrame() @2;
|
|
Text SetString ;
|
|
Color SetFgLightOnColor = :LtRed;
|
|
Color SetFgLightOffColor = :Black;
|
|
Color SetBgColor = :Black;
|
|
int SetStringSize = 20;
|
|
int SetLEDSize = 2;
|
|
|
|
Paint(w) {
|
|
r = GetRect();
|
|
r.right = r.left + GetWidth( .SetLEDSize, .SetStringSize ) ;
|
|
r.bottom = r.top + GetHeight( .SetLEDSize ) ;
|
|
DrawCtrlFrame(w, r, .SetFrame);
|
|
w.DrawRect(r, .SetBgColor);
|
|
}
|
|
};
|
|
|
|
|
|
fn GetWidth( LEDSize, MaxChar )
|
|
{
|
|
if( ( LEDSize <= 0 ) || ( MaxChar <= 0 ) )
|
|
return 0 ;
|
|
else
|
|
return ( ( LEDSize * 5 ) + 2 ) * MaxChar + 8 ;
|
|
}
|
|
|
|
|
|
fn GetHeight( LEDSize )
|
|
{
|
|
if( LEDSize <= 0 )
|
|
return 0 ;
|
|
else
|
|
return LEDSize * 7 + 8 ;
|
|
}
|
|
|