Simplify button drawing

This commit is contained in:
2025-06-25 15:40:12 +01:00
parent bf0bc22720
commit 6e9d4918a1
9 changed files with 40 additions and 46 deletions
+6 -7
View File
@@ -18,8 +18,7 @@ makeButton
-> WdWd -- ^ Effect when pressed
-> Button
makeButton col eff = defaultButton
{ _btPict = DefaultDrawButton col
, _btEvent = ButtonPress BtInactive ButtonDoNothing click1S eff
{ _btEvent = ButtonPress BtInactive ButtonDoNothing click1S eff col
, _btState = BtOff
}
@@ -37,13 +36,13 @@ drawSwitchWire col1 col2 bt
)
makeSwitchSPic
:: ButtonDraw
:: Color
-> Color
-> WdWd -- ^ Switch on effect
-> WdWd -- ^ Switch off effect
-> Button
makeSwitchSPic dswitch effOn effOff = defaultButton
{ _btPict = dswitch
, _btEvent = ButtonSimpleSwith effOn effOff
makeSwitchSPic c1 c2 effOn effOff = defaultButton
{ _btEvent = ButtonSimpleSwith effOn effOff c1 c2
, _btState = BtOff
}
@@ -53,4 +52,4 @@ makeSwitch
-> WdWd -- ^ Switch on effect
-> WdWd -- ^ Switch off effect
-> Button
makeSwitch col1 col2 = makeSwitchSPic (DefaultDrawSwitch col1 col2)
makeSwitch col1 col2 = makeSwitchSPic col1 col2