mirror of
https://github.com/ultimatepp/ultimatepp.git
synced 2026-05-21 06:45:39 -06:00
LEDCtrl: New LED control by Christian (cb31_fr)
git-svn-id: svn://ultimatepp.org/upp/trunk@2585 f0d560ea-af0d-0410-9eb7-867de7ffcac7
This commit is contained in:
parent
a5087202de
commit
a9918fcf41
10 changed files with 671 additions and 0 deletions
43
bazaar/LEDCtrl/LEDCtrl.usc
Normal file
43
bazaar/LEDCtrl/LEDCtrl.usc
Normal file
|
|
@ -0,0 +1,43 @@
|
|||
|
||||
|
||||
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 ;
|
||||
}
|
||||
|
||||
Loading…
Add table
Add a link
Reference in a new issue