mirror of
https://github.com/fjvallarino/monomer.git
synced 2024-09-11 12:05:35 +03:00
Add style prefix to the six style combinators (avoid reserving some common names)
This commit is contained in:
parent
a38617c313
commit
44109ca217
200
app/Main.hs
200
app/Main.hs
@ -147,21 +147,21 @@ handleAppEvent wenv node model evt = case evt of
|
||||
buildUI :: WidgetEnv App AppEvent -> App -> WidgetNode App AppEvent
|
||||
buildUI wenv model = traceShow "Creating UI" widgetTree where
|
||||
widgetSizes = vgrid [
|
||||
hgrid [spacer `style` [bgColor darkGray], label "Test" `style` [textUnderline, border 1 violet, radius 50]],
|
||||
hgrid [spacer `style` [bgColor darkBlue], label "Test" `style` [textUnderline, border 1 salmon, radius 50]]
|
||||
hgrid [spacer `styleBasic` [bgColor darkGray], label "Test" `styleBasic` [textUnderline, border 1 violet, radius 50]],
|
||||
hgrid [spacer `styleBasic` [bgColor darkBlue], label "Test" `styleBasic` [textUnderline, border 1 salmon, radius 50]]
|
||||
]
|
||||
--widgetImgTest = vstack [hstack [widgetImgTest2]] `style` [border 40 (green & L.a .~ 0.5), borderL 50 (orange & L.a .~ 0.5), borderT 20 (orange & L.a .~ 0.5), borderB 20 (green & L.a .~ 0.5), radius 30, radiusTL 0, radiusBL 40, radiusBR 50]
|
||||
widgetImgTest = vstack [hstack [widgetImgTest2]] `style` [border 40 (green & L.a .~ 0.5), borderL 100 (orange & L.a .~ 0.5), borderT 20 (blue & L.a .~ 0.5), borderB 20 (violet & L.a .~ 0.5)]
|
||||
--widgetImgTest = vstack [hstack [widgetImgTest2]] `styleBasic` [border 40 (green & L.a .~ 0.5), borderL 50 (orange & L.a .~ 0.5), borderT 20 (orange & L.a .~ 0.5), borderB 20 (green & L.a .~ 0.5), radius 30, radiusTL 0, radiusBL 40, radiusBR 50]
|
||||
widgetImgTest = vstack [hstack [widgetImgTest2]] `styleBasic` [border 40 (green & L.a .~ 0.5), borderL 100 (orange & L.a .~ 0.5), borderT 20 (blue & L.a .~ 0.5), borderB 20 (violet & L.a .~ 0.5)]
|
||||
widgetImgTest2 = image_ "assets/images/pecans.jpg" [fitFill, imageRepeatX, imageRepeatY, onLoadError ImageMsg]
|
||||
`style` [bgColor orange, border 10 red, borderL 40 green, radius 60]
|
||||
`styleBasic` [bgColor orange, border 10 red, borderL 40 green, radius 60]
|
||||
--(pink & L.a .~ 0.5)
|
||||
-- `style` [bgColor green, width 60, height 60, radius 30]
|
||||
-- `styleBasic` [bgColor green, width 60, height 60, radius 30]
|
||||
{-
|
||||
widgetText = vstack [
|
||||
label "Test",
|
||||
hstack [
|
||||
label "Test",
|
||||
textArea textArea1 -- `style` [textSpaceH 0, textSpaceV 0]
|
||||
textArea textArea1 -- `styleBasic` [textSpaceH 0, textSpaceV 0]
|
||||
],
|
||||
hslider int1 0 100
|
||||
]
|
||||
@ -171,26 +171,26 @@ buildUI wenv model = traceShow "Creating UI" widgetTree where
|
||||
hstack [
|
||||
dateField_ testDay [validInput testDayValid, minValue (fromGregorian 1900 1 1)],
|
||||
spacer,
|
||||
spacer `style` [width 30, bgColor (if model ^. testDayValid then green else red)],
|
||||
spacer `styleBasic` [width 30, bgColor (if model ^. testDayValid then green else red)],
|
||||
filler
|
||||
],
|
||||
labelS (model ^. testDay) `style` [textFont "Bold", textSpacing 4],
|
||||
labelS (model ^. testDay) `styleBasic` [textFont "Bold", textSpacing 4],
|
||||
dateField_ mtestDay [caretMs 100, validInput mtestDayValid, minValue (Just $ fromGregorian 1900 1 1)]
|
||||
`style` [bgColor (if model ^. mtestDayValid then violet else red), textFont "Bold", textSpacing 4],
|
||||
`styleBasic` [bgColor (if model ^. mtestDayValid then violet else red), textFont "Bold", textSpacing 4],
|
||||
timeField_ testTimeOfDay [caretMs 1000, validInput testTimeOfDayValid, minValue (TimeOfDay 14 10 20), timeFormatHHMMSS]
|
||||
`style` [bgColor (if model ^. testTimeOfDayValid then green else red)],
|
||||
`styleBasic` [bgColor (if model ^. testTimeOfDayValid then green else red)],
|
||||
timeField_ mtestTimeOfDay [validInput mtestTimeOfDayValid, minValue (Just $ TimeOfDay 14 10 20), timeFormatHHMMSS]
|
||||
`style` [bgColor (if model ^. mtestTimeOfDayValid then green else red)],
|
||||
`styleBasic` [bgColor (if model ^. mtestTimeOfDayValid then green else red)],
|
||||
numericField_ int1 [validInput int1Valid] --, minValue 100, maxValue 200
|
||||
`style` [bgColor (if model ^. int1Valid then green else red)],
|
||||
`styleBasic` [bgColor (if model ^. int1Valid then green else red)],
|
||||
numericField_ mfloat1 [validInput mfloat1Valid, minValue (Just 10), maxValue (Just 100)]
|
||||
`style` [bgColor (if model ^. mfloat1Valid then green else red)],
|
||||
`styleBasic` [bgColor (if model ^. mfloat1Valid then green else red)],
|
||||
labelS (model ^. mfloat1),
|
||||
numericField_ mint1 [validInput mint1Valid, minValue (Just 10), maxValue (Just 100)]
|
||||
`style` [bgColor (if model ^. mint1Valid then green else red)],
|
||||
`styleBasic` [bgColor (if model ^. mint1Valid then green else red)],
|
||||
labelS (model ^. mint1),
|
||||
spacer,
|
||||
textArea_ textArea1 [caretWidth 1, caretMs 200] `style` [textFont "Bold", textSize 20, textSpacing 4]
|
||||
textArea_ textArea1 [caretWidth 1, caretMs 200] `styleBasic` [textFont "Bold", textSize 20, textSpacing 4]
|
||||
]
|
||||
-}
|
||||
widgetSlider = vstack [
|
||||
@ -202,14 +202,14 @@ buildUI wenv model = traceShow "Creating UI" widgetTree where
|
||||
hstack [
|
||||
vslider_ int1 (-100) 100 [radius 3, thumbVisible]
|
||||
]
|
||||
] `style` [paddingT 1]
|
||||
] `styleBasic` [paddingT 1]
|
||||
widgetSimple = vstack [
|
||||
label $ "Count: " <> showt (model ^. clickCount),
|
||||
button "Increase" IncButton
|
||||
]
|
||||
widgetAnimate = vstack [
|
||||
animSlideIn_ [slideLeft] (label "Hello!!!!" `style` [bgColor red]) `key` "anim1",
|
||||
animSlideOut_ [slideLeft] (label "Good bye!!!!" `style` [bgColor green]) `key` "anim2",
|
||||
animSlideIn_ [slideLeft] (label "Hello!!!!" `styleBasic` [bgColor red]) `key` "anim1",
|
||||
animSlideOut_ [slideLeft] (label "Good bye!!!!" `styleBasic` [bgColor green]) `key` "anim2",
|
||||
hstack [
|
||||
labelS (model ^. clickCount),
|
||||
button "Increase" IncButton
|
||||
@ -221,29 +221,29 @@ buildUI wenv model = traceShow "Creating UI" widgetTree where
|
||||
button "Confirm" ShowConfirm
|
||||
]
|
||||
widgetLabels = vstack [
|
||||
label "Underline |" `style` [textFont "Italic", textSize 100, textUnderline],
|
||||
label "Overline |" `style` [textFont "Italic", textSize 100, textOverline],
|
||||
label "Through |" `style` [textFont "Italic", textSize 100, textThroughline],
|
||||
label "This is a test: All styles |" `style` [textFont "Italic", textSize 100, textUnderline, textOverline, textThroughline]
|
||||
label "Underline |" `styleBasic` [textFont "Italic", textSize 100, textUnderline],
|
||||
label "Overline |" `styleBasic` [textFont "Italic", textSize 100, textOverline],
|
||||
label "Through |" `styleBasic` [textFont "Italic", textSize 100, textThroughline],
|
||||
label "This is a test: All styles |" `styleBasic` [textFont "Italic", textSize 100, textUnderline, textOverline, textThroughline]
|
||||
]
|
||||
widgetScroll = vscroll (hgrid [
|
||||
vstack [
|
||||
scroll (image "assets/images/pecans.jpg") `style` [height 200],
|
||||
scroll (image "assets/images/pecans.jpg") `style` [height 200],
|
||||
scroll (image "assets/images/pecans.jpg") `style` [height 200],
|
||||
scroll (image "assets/images/pecans.jpg") `style` [height 200],
|
||||
scroll (image "assets/images/pecans.jpg") `styleBasic` [height 200],
|
||||
scroll (image "assets/images/pecans.jpg") `styleBasic` [height 200],
|
||||
scroll (image "assets/images/pecans.jpg") `styleBasic` [height 200],
|
||||
scroll (image "assets/images/pecans.jpg") `styleBasic` [height 200],
|
||||
widgetDrag,
|
||||
scroll (image "assets/images/pecans.jpg") `style` [height 200],
|
||||
scroll (image "assets/images/pecans.jpg") `style` [height 200],
|
||||
scroll (image "assets/images/pecans.jpg") `style` [height 200],
|
||||
widgetLVs `style` [height 300],
|
||||
scroll (image "assets/images/pecans.jpg") `style` [height 200],
|
||||
scroll (image "assets/images/pecans.jpg") `style` [height 200],
|
||||
scroll (image "assets/images/pecans.jpg") `style` [height 200],
|
||||
selectList dropdown1 items label `style` [height 300],
|
||||
scroll (image "assets/images/pecans.jpg") `style` [height 200],
|
||||
scroll (image "assets/images/pecans.jpg") `style` [height 200],
|
||||
scroll (image "assets/images/pecans.jpg") `style` [height 200]
|
||||
scroll (image "assets/images/pecans.jpg") `styleBasic` [height 200],
|
||||
scroll (image "assets/images/pecans.jpg") `styleBasic` [height 200],
|
||||
scroll (image "assets/images/pecans.jpg") `styleBasic` [height 200],
|
||||
widgetLVs `styleBasic` [height 300],
|
||||
scroll (image "assets/images/pecans.jpg") `styleBasic` [height 200],
|
||||
scroll (image "assets/images/pecans.jpg") `styleBasic` [height 200],
|
||||
scroll (image "assets/images/pecans.jpg") `styleBasic` [height 200],
|
||||
selectList dropdown1 items label `styleBasic` [height 300],
|
||||
scroll (image "assets/images/pecans.jpg") `styleBasic` [height 200],
|
||||
scroll (image "assets/images/pecans.jpg") `styleBasic` [height 200],
|
||||
scroll (image "assets/images/pecans.jpg") `styleBasic` [height 200]
|
||||
],
|
||||
label "Test"
|
||||
])
|
||||
@ -253,17 +253,17 @@ buildUI wenv model = traceShow "Creating UI" widgetTree where
|
||||
label "Test",
|
||||
themeSwitch (darkTheme & L.basic . L.labelStyle . L.bgColor ?~ red) (label "Test")
|
||||
]
|
||||
labelDrag idx = draggable_ idx [transparency 0.8, draggableStyle [bgColor pink, border 20 blue]] (tooltip ("TT: " <> showt idx) $ label ("Label: " <> showt idx) `hover` [cursorIcon CursorHand])
|
||||
labelDrag idx = draggable_ idx [transparency 0.8, draggableStyle [bgColor pink, border 20 blue]] (tooltip ("TT: " <> showt idx) $ label ("Label: " <> showt idx) `styleHover` [cursorIcon CursorHand])
|
||||
widgetDrag = hgrid [
|
||||
dropTarget DropTo1 (scroll $ vstack (fmap labelDrag (model ^. dragList1))),
|
||||
dropTarget_ DropTo2 [dropTargetStyle [bgColor orange]] (scroll $ vstack (fmap labelDrag (model ^. dragList2)))
|
||||
]
|
||||
widgetAlign = vstack [
|
||||
hstack [
|
||||
label "Label 1 - ja - ^&~@$" `style` [textSize 10, textBottom],
|
||||
label "Label 2 - ja - ^&~@$" `style` [textSize 20, textBottom],
|
||||
label "Label 3 - ja - ^&~@$" `style` [textSize 40, textBottom]
|
||||
] `style` [bgColor orange]
|
||||
label "Label 1 - ja - ^&~@$" `styleBasic` [textSize 10, textBottom],
|
||||
label "Label 2 - ja - ^&~@$" `styleBasic` [textSize 20, textBottom],
|
||||
label "Label 3 - ja - ^&~@$" `styleBasic` [textSize 40, textBottom]
|
||||
] `styleBasic` [bgColor orange]
|
||||
]
|
||||
--widgetDialSingle = dial double1 (-100) 100
|
||||
widgetRow = hstack [
|
||||
@ -272,7 +272,7 @@ buildUI wenv model = traceShow "Creating UI" widgetTree where
|
||||
label "Label 2"
|
||||
],
|
||||
filler,
|
||||
image "assets/images/pecans.jpg" `style` [width 50, height 50]
|
||||
image "assets/images/pecans.jpg" `styleBasic` [width 50, height 50]
|
||||
]
|
||||
widgetDial = vstack [
|
||||
textDropdown_ dropdown1 items id [],
|
||||
@ -289,18 +289,18 @@ buildUI wenv model = traceShow "Creating UI" widgetTree where
|
||||
],
|
||||
numericField_ rational1 [minValue (-100), maxValue 100],
|
||||
tooltip "Hello!\nThis is a long message, that will hopefully be split into several lines" $ label "Test",
|
||||
box_ [expandContent] widgetRow `hover` [bgColor gray, cursorIcon CursorHand],
|
||||
box_ [expandContent] widgetRow `styleHover` [bgColor gray, cursorIcon CursorHand],
|
||||
dial rational1 (-100) 100,
|
||||
hstack [
|
||||
button "Test" RunShortTask,
|
||||
mainButton "Test" RunShortTask
|
||||
],
|
||||
image "assets/images/pecans.jpg",
|
||||
tooltip "Hello!\nThis is a long message, that will hopefully be split into several lines" (label "Test" `style` [border 1 pink]) `style` [bgColor orange, textSize 20]
|
||||
tooltip "Hello!\nThis is a long message, that will hopefully be split into several lines" (label "Test" `styleBasic` [border 1 pink]) `styleBasic` [bgColor orange, textSize 20]
|
||||
]
|
||||
widgetSplit = hsplit (button "Button" RunShortTask, button "Button!!!" RunShortTask)
|
||||
widgetSplitH = keystroke [("C-a", ShowAlert), ("C-c", ShowConfirm), ("C-S-p", ShowConfirm)] $ hsplit (image "assets/images/pecans.jpg", widgetTree)
|
||||
widgetSplitV = vsplit (image "assets/images/pecans.jpg" `style` [rangeHeight 200 1000], widgetTree `style` [rangeHeight 200 1000])
|
||||
widgetSplitV = vsplit (image "assets/images/pecans.jpg" `styleBasic` [rangeHeight 200 1000], widgetTree `styleBasic` [rangeHeight 200 1000])
|
||||
mkImg i = vstack [
|
||||
label ("Image: " <> showt i),
|
||||
image ("https://picsum.photos/600/400?ts=" <> showt i)
|
||||
@ -314,16 +314,16 @@ buildUI wenv model = traceShow "Creating UI" widgetTree where
|
||||
textDropdown dropdown1 items,
|
||||
textDropdown dropdown1 items,
|
||||
textDropdown dropdown1 items,
|
||||
scroll $ image_ "assets/images/pecans.jpg" [fitFill] `style` [width 1000, height 1000]
|
||||
scroll $ image_ "assets/images/pecans.jpg" [fitFill] `styleBasic` [width 1000, height 1000]
|
||||
]
|
||||
widgetHover = vstack [
|
||||
hstack [
|
||||
label "Test" `hover` [bgColor red, textSize 32],
|
||||
label "Test" `hover` [bgColor green],
|
||||
textField textField1 `hover` [bgColor orange, textSize 32]
|
||||
label "Test" `styleHover` [bgColor red, textSize 32],
|
||||
label "Test" `styleHover` [bgColor green],
|
||||
textField textField1 `styleHover` [bgColor orange, textSize 32]
|
||||
],
|
||||
textDropdown dropdown1 items,
|
||||
vstack $ fmap (\i -> label ("AAAA: " <> showt i) `hover` [textSize 40]) [1..10::Int],
|
||||
vstack $ fmap (\i -> label ("AAAA: " <> showt i) `styleHover` [textSize 40]) [1..10::Int],
|
||||
selectList dropdown1 items label
|
||||
]
|
||||
widgetIdChanged = vstack [
|
||||
@ -339,27 +339,27 @@ buildUI wenv model = traceShow "Creating UI" widgetTree where
|
||||
label "Username: ",
|
||||
textField textField1,
|
||||
label ""
|
||||
] `style` [padding 5],
|
||||
] `styleBasic` [padding 5],
|
||||
hgrid [
|
||||
label "Password: ",
|
||||
textField textField2,
|
||||
label ""
|
||||
] `style` [padding 5, paddingT 0],
|
||||
] `styleBasic` [padding 5, paddingT 0],
|
||||
hgrid [
|
||||
label "Integral: ",
|
||||
numericField_ integer1 [minValue 0],
|
||||
label ""
|
||||
] `style` [padding 5, paddingT 0],
|
||||
] `styleBasic` [padding 5, paddingT 0],
|
||||
hgrid [
|
||||
label "Floating: ",
|
||||
numericField_ float1 [minValue (-20), maxValue 20],
|
||||
label ""
|
||||
] `style` [padding 5, paddingT 0]
|
||||
] `styleBasic` [padding 5, paddingT 0]
|
||||
]
|
||||
widgetLV = vstack [
|
||||
scroll $ vstack $ (\i -> box $ label ("Label: " <> showt i)) <$> [0..1000::Int]
|
||||
label "aaa"
|
||||
, selectList dropdown1 items label `style` [height 300]
|
||||
, selectList dropdown1 items label `styleBasic` [height 300]
|
||||
, scroll $ image "assets/images/pecans.jpg"
|
||||
, dropdown_ dropdown1 items label label [maxHeight 200]
|
||||
]
|
||||
@ -403,55 +403,55 @@ buildUI wenv model = traceShow "Creating UI" widgetTree where
|
||||
vstack [
|
||||
label "test",
|
||||
button "Test" IncButton,
|
||||
textField textField1 `style` [bgColor blue],
|
||||
textField textField1 `style` [bgColor pink],
|
||||
textField textField1 `style` [bgColor orange]
|
||||
textField textField1 `styleBasic` [bgColor blue],
|
||||
textField textField1 `styleBasic` [bgColor pink],
|
||||
textField textField1 `styleBasic` [bgColor orange]
|
||||
]
|
||||
],
|
||||
box_ [alignRight] $
|
||||
hstack [
|
||||
vgrid [
|
||||
label "",
|
||||
textField textField1 `style` [bgColor lightBlue, width 200]
|
||||
textField textField1 `styleBasic` [bgColor lightBlue, width 200]
|
||||
]
|
||||
] `style` [height 480]
|
||||
] `styleBasic` [height 480]
|
||||
]
|
||||
{--
|
||||
widgetTree4 = hgrid [
|
||||
label "" `style` [bgColor blue],
|
||||
label "" `style` [bgColor gray],
|
||||
label "" `style` [bgColor blue],
|
||||
label "" `style` [bgColor orange],
|
||||
label "" `styleBasic` [bgColor blue],
|
||||
label "" `styleBasic` [bgColor gray],
|
||||
label "" `styleBasic` [bgColor blue],
|
||||
label "" `styleBasic` [bgColor orange],
|
||||
vstack [
|
||||
label "1" `style` [bgColor pink, border 1 pink],
|
||||
textField textField1 `style` [bgColor gray],
|
||||
label "2" `style` [bgColor pink, border 1 gray],
|
||||
textField textField1 `style` [textCenter, bgColor gray],
|
||||
label "3" `style` [bgColor pink],
|
||||
textField textField1 `style` [textRight, bgColor gray],
|
||||
label "4" `style` [bgColor pink]
|
||||
label "1" `styleBasic` [bgColor pink, border 1 pink],
|
||||
textField textField1 `styleBasic` [bgColor gray],
|
||||
label "2" `styleBasic` [bgColor pink, border 1 gray],
|
||||
textField textField1 `styleBasic` [textCenter, bgColor gray],
|
||||
label "3" `styleBasic` [bgColor pink],
|
||||
textField textField1 `styleBasic` [textRight, bgColor gray],
|
||||
label "4" `styleBasic` [bgColor pink]
|
||||
],
|
||||
vstack [
|
||||
--textDropdown_ dropdown1 items id [onChange DropdownVal, onChangeIdx DropdownIdx],
|
||||
label "1" `style` [bgColor pink, border 1 pink]
|
||||
label "1" `styleBasic` [bgColor pink, border 1 pink]
|
||||
] `visible` False,
|
||||
label "" `style` [bgColor orange],
|
||||
label "" `style` [bgColor gray],
|
||||
label "" `style` [bgColor blue],
|
||||
label "" `style` [bgColor gray]
|
||||
label "" `styleBasic` [bgColor orange],
|
||||
label "" `styleBasic` [bgColor gray],
|
||||
label "" `styleBasic` [bgColor blue],
|
||||
label "" `styleBasic` [bgColor gray]
|
||||
]
|
||||
--}
|
||||
widgetTree3 = hgrid [
|
||||
label "Hi!\nThis\nis\na\nnew\ttest\n\n Double!" `style` [bgColor pink, textBottom, textCenter],
|
||||
label "Hi!\nThis\nis\na\nnew\ttest\n\n Double!" `styleBasic` [bgColor pink, textBottom, textCenter],
|
||||
vgrid [
|
||||
label "1",
|
||||
label "2",
|
||||
label "3",
|
||||
label "4",
|
||||
label "5",
|
||||
label_ "This is a really long label used to check if line breaks and ellipsis are implemented correctly" [multiLine] `style` [bgColor blue],
|
||||
label_ "This is a really long label used to check if line breaks and ellipsis are implemented correctly" [multiLine] `styleBasic` [bgColor blue],
|
||||
label "6",
|
||||
label "This is a really long label used to check if line breaks and ellipsis are implemented correctly, using a longlonglonglonglonglonglonglonglonglonglonglonglonglonglonglong invalid word" `style` [bgColor blue, textBottom, textRight]
|
||||
label "This is a really long label used to check if line breaks and ellipsis are implemented correctly, using a longlonglonglonglonglonglonglonglonglonglonglonglonglonglonglong invalid word" `styleBasic` [bgColor blue, textBottom, textRight]
|
||||
],
|
||||
label "",
|
||||
label ""
|
||||
@ -474,7 +474,7 @@ buildUI wenv model = traceShow "Creating UI" widgetTree where
|
||||
--dropdown dropdown1 items id label
|
||||
label "Text",
|
||||
textField textField1
|
||||
]-- `style` [padding 10]
|
||||
]-- `styleBasic` [padding 10]
|
||||
]
|
||||
--}
|
||||
longMessage word = "Are you sure?\n\n\n\n" <> T.replicate 100 (word <> " ")
|
||||
@ -496,32 +496,32 @@ buildUI wenv model = traceShow "Creating UI" widgetTree where
|
||||
textDropdown_ dropdown1 items id [onChange DropdownVal, onChangeIdx DropdownIdx],
|
||||
hgrid [
|
||||
vstack [
|
||||
label "jLabel 1" `style` [bgColor darkGray] `hover` [textSize 40],
|
||||
label "Label 12" `style` [bgColor lightGray] `hover` [textSize 40],
|
||||
label "Label 123" `style` [bgColor darkGray] `hover` [textSize 40],
|
||||
label "Label 1234" `style` [bgColor lightGray] `hover` [textSize 40]
|
||||
] `style` [bgColor red],
|
||||
label "jLabel 1" `styleBasic` [bgColor darkGray] `styleHover` [textSize 40],
|
||||
label "Label 12" `styleBasic` [bgColor lightGray] `styleHover` [textSize 40],
|
||||
label "Label 123" `styleBasic` [bgColor darkGray] `styleHover` [textSize 40],
|
||||
label "Label 1234" `styleBasic` [bgColor lightGray] `styleHover` [textSize 40]
|
||||
] `styleBasic` [bgColor red],
|
||||
vstack [
|
||||
label "jLabel 1" `style` [bgColor lightGray, textBottom],
|
||||
label "Label 12" `style` [bgColor darkGray],
|
||||
label "Label 123" `style` [bgColor lightGray],
|
||||
label "Label 1234" `style` [bgColor darkGray]
|
||||
] `style` [bgColor blue]
|
||||
] `style` [bgColor green],
|
||||
label "jLabel 1" `styleBasic` [bgColor lightGray, textBottom],
|
||||
label "Label 12" `styleBasic` [bgColor darkGray],
|
||||
label "Label 123" `styleBasic` [bgColor lightGray],
|
||||
label "Label 1234" `styleBasic` [bgColor darkGray]
|
||||
] `styleBasic` [bgColor blue]
|
||||
] `styleBasic` [bgColor green],
|
||||
hgrid [
|
||||
label_ "This is a really long label used to check what I did works fine" [multiLine, ellipsis],
|
||||
label "Jj label" `hover` [textSize 40]
|
||||
] `hover` [bgColor red],
|
||||
label (model ^. dropdown1) `style` [bgColor lightBlue, textLeft],
|
||||
textField_ textField1 [fieldDisplayChar '*'] `style` [bgColor lightBlue, textLeft],
|
||||
label "Jj label" `styleHover` [textSize 40]
|
||||
] `styleHover` [bgColor red],
|
||||
label (model ^. dropdown1) `styleBasic` [bgColor lightBlue, textLeft],
|
||||
textField_ textField1 [fieldDisplayChar '*'] `styleBasic` [bgColor lightBlue, textLeft],
|
||||
colorPicker_ color [showAlpha],
|
||||
hstack [
|
||||
scroll_ [] (image_ "assets/images/pecans.jpg" [fitFill] `style` [radius 20]),
|
||||
scroll_ [] (image_ "assets/images/pecans.jpg" [fitFill] `styleBasic` [radius 20]),
|
||||
scroll_ [] $ image_ "assets/images/pecans.jpg" [fitFill],
|
||||
scroll_ [] $ image_ "assets/images/pecans.jpg" [fitFill],
|
||||
image_ "https://picsum.photos/1600/400" [fitFill, onLoadError ImageMsg] `style` [cursorIcon CursorInvalid, border 40 (orange & L.a .~ 0.5), radius 100, radiusBL 0, radiusBR 0]
|
||||
image_ "https://picsum.photos/1600/400" [fitFill, onLoadError ImageMsg] `styleBasic` [cursorIcon CursorInvalid, border 40 (orange & L.a .~ 0.5), radius 100, radiusBL 0, radiusBR 0]
|
||||
],
|
||||
textDropdown_ dropdown1 items id [onChange DropdownVal, onChangeIdx DropdownIdx],
|
||||
button_ "Click\nme!" (PrintMessage "Button clicked") [] --multiLine, ellipsis
|
||||
] `key` "main vstack" `style` [borderT 20 red, borderL 10 blue, borderR 10 green, borderB 10 gray, radius 50] --, padding 20
|
||||
] `key` "main vstack" `styleBasic` [borderT 20 red, borderL 10 blue, borderR 10 green, borderB 10 gray, radius 50] --, padding 20
|
||||
items = fmap (\i -> "This is a long label: " <> showt i) [1..100::Int]
|
||||
|
@ -76,5 +76,5 @@ buildComp wenv model = trace "Created composite UI" $
|
||||
button "Run Producer" StartProducer,
|
||||
label ("Produced: " <> showt (_csProduced model))
|
||||
]
|
||||
] `style` [bgColor gray]
|
||||
] `styleBasic` [bgColor gray]
|
||||
]
|
||||
|
@ -20,12 +20,12 @@ Once these declarations are in place, you can choose which font to use for any
|
||||
label or widget that displays text.
|
||||
|
||||
```haskell
|
||||
label text `style` [textFont "Bold", textSize 20]
|
||||
label text `styleBasic` [textFont "Bold", textSize 20]
|
||||
```
|
||||
|
||||
There are several functions you can use for modifying a widget node. These
|
||||
functions are generally used infix, since the intention is clearer that way. In
|
||||
particular, the `style` function allows providing different style options with a
|
||||
particular, the `styleBasic` function allows providing different style options with a
|
||||
list.
|
||||
|
||||
Since this style is used a few times in the example, it would be nice to avoid
|
||||
@ -33,7 +33,7 @@ duplicating the code all over the example. An easy way to avoid this is to
|
||||
create a function that returns the label styled as needed:
|
||||
|
||||
```haskell
|
||||
titleText text = label text `style` [textFont "Bold", textSize 20]
|
||||
titleText text = label text `styleBasic` [textFont "Bold", textSize 20]
|
||||
```
|
||||
|
||||
In general, all components which display text support the following styles:
|
||||
@ -74,7 +74,7 @@ priority to the latest value set. This allows, for instance, to easily set all
|
||||
sides to one padding size and leave the right side with a different value:
|
||||
|
||||
```haskell
|
||||
node `style` [padding 10, paddingR 0]
|
||||
node `styleBasic` [padding 10, paddingR 0]
|
||||
```
|
||||
|
||||
This concept of overriding values in the provided list also applies to regular
|
||||
@ -99,7 +99,7 @@ For reference, the colors mentioned by name in the examples come from
|
||||
|
||||
## Enabled and visible
|
||||
|
||||
Besides `style`, other two common attributes of a node you may be interested in
|
||||
Besides `styleBasic`, other two common attributes of a node you may be interested in
|
||||
controlling are `enabled` and `visible`, both boolean.
|
||||
|
||||
```haskell
|
||||
|
@ -35,16 +35,16 @@ The only context where you need to be careful is if the position of your widgets
|
||||
change. Just to clarify: this only is a concern if there are widgets with state
|
||||
involved, although it's probably safer to just always handle it.
|
||||
|
||||
In the example, a `key` is associated to each row. It works similarly to `style`
|
||||
In the example, a `key` is associated to each row. It works similarly to `styleBasic`
|
||||
but receives a Text argument.
|
||||
|
||||
```haskell
|
||||
listItem idx item = hstack [
|
||||
label (item ^. text) `style` [width 100],
|
||||
label (item ^. text) `styleBasic` [width 100],
|
||||
textField (items . singular (ix idx) . text),
|
||||
spacer,
|
||||
button "Delete" (RemoveItem idx)
|
||||
] `key` showt (item ^. ts) `style` [paddingT 5]
|
||||
] `key` showt (item ^. ts) `styleBasic` [paddingT 5]
|
||||
```
|
||||
|
||||
In the case of a `textField`, the internal state contains the current cursor
|
||||
|
@ -46,7 +46,7 @@ from lowest to highest layer level.
|
||||
pushLayers = zstack [
|
||||
image_ "./assets/images/red-button.png" [fitFill] `visible` not (model ^. hoverButton),
|
||||
image_ "./assets/images/red-button-hover.png" [fitFill] `visible` model ^. hoverButton,
|
||||
label "Push!" `style` [textFont "Bold", textSize 20, textCenter]
|
||||
label "Push!" `styleBasic` [textFont "Bold", textSize 20, textCenter]
|
||||
]
|
||||
```
|
||||
|
||||
|
@ -35,46 +35,46 @@ bookRow wenv b = row where
|
||||
rowContent b = hstack [
|
||||
vstack [
|
||||
label_ (b ^. title) [resizeFactor 1]
|
||||
`style` [textFont "Medium", textSize 16],
|
||||
`styleBasic` [textFont "Medium", textSize 16],
|
||||
spacer,
|
||||
label_ (T.intercalate ", " (b ^. authors)) [resizeFactor 1]
|
||||
`style` [textSize 14]
|
||||
`styleBasic` [textSize 14]
|
||||
],
|
||||
filler,
|
||||
vstack [
|
||||
label publishYear `style` [width 50, textSize 14],
|
||||
label publishYear `styleBasic` [width 50, textSize 14],
|
||||
spacer
|
||||
],
|
||||
bookImage (b ^. cover) "S" `style` [width 35]
|
||||
bookImage (b ^. cover) "S" `styleBasic` [width 35]
|
||||
]
|
||||
|
||||
row = box_ cfg content `style` [padding 10, paddingT 0] where
|
||||
row = box_ cfg content `styleBasic` [padding 10, paddingT 0] where
|
||||
cfg = [expandContent, onClick (BooksShowDetails b)]
|
||||
content = rowContent b
|
||||
`style` [height 80, padding 20, radius 5]
|
||||
`hover` [bgColor rowBgColor, cursorIcon CursorHand]
|
||||
`styleBasic` [height 80, padding 20, radius 5]
|
||||
`styleHover` [bgColor rowBgColor, cursorIcon CursorHand]
|
||||
|
||||
bookDetail :: Book -> WidgetNode s BooksEvt
|
||||
bookDetail b = content `style` [minWidth 500, paddingH 20] where
|
||||
bookDetail b = content `styleBasic` [minWidth 500, paddingH 20] where
|
||||
hasCover = isJust (b ^. cover)
|
||||
publishYear = maybe "" showt (b ^. year)
|
||||
|
||||
shortLabel value = label value `style` [textFont "Medium", textTop]
|
||||
shortLabel value = label value `styleBasic` [textFont "Medium", textTop]
|
||||
longLabel value = label_ value [multiLine, ellipsis, trimSpaces]
|
||||
|
||||
content = hstack . concat $ [[
|
||||
vstack [
|
||||
longLabel (b ^. title)
|
||||
`style` [textSize 20, textFont "Medium"],
|
||||
`styleBasic` [textSize 20, textFont "Medium"],
|
||||
spacer,
|
||||
longLabel (T.intercalate ", " (b ^. authors))
|
||||
`style` [textSize 16],
|
||||
`styleBasic` [textSize 16],
|
||||
spacer,
|
||||
label publishYear
|
||||
`style` [textSize 14]
|
||||
`styleBasic` [textSize 14]
|
||||
]],
|
||||
[filler | hasCover],
|
||||
[bookImage (b ^. cover) "M" `style` [width 200] | hasCover]
|
||||
[bookImage (b ^. cover) "M" `styleBasic` [width 200] | hasCover]
|
||||
]
|
||||
|
||||
buildUI
|
||||
@ -87,8 +87,8 @@ buildUI wenv model = widgetTree where
|
||||
bookOverlay = alert BooksCloseDetails content where
|
||||
content = maybe spacer bookDetail (model ^. selected)
|
||||
|
||||
searchOverlay = box content `style` [bgColor (darkGray & L.a .~ 0.8)] where
|
||||
content = label "Searching" `style` [textSize 20, textColor black]
|
||||
searchOverlay = box content `styleBasic` [bgColor (darkGray & L.a .~ 0.8)] where
|
||||
content = label "Searching" `styleBasic` [textSize 20, textColor black]
|
||||
|
||||
searchForm = keystroke [("Enter", BooksSearch)] $ vstack [
|
||||
hstack [
|
||||
@ -97,10 +97,10 @@ buildUI wenv model = widgetTree where
|
||||
textField query `key` "query",
|
||||
spacer,
|
||||
mainButton "Search" BooksSearch
|
||||
] `style` [bgColor sectionBgColor, padding 25]
|
||||
] `styleBasic` [bgColor sectionBgColor, padding 25]
|
||||
]
|
||||
|
||||
countLabel = label caption `style` [padding 10] where
|
||||
countLabel = label caption `styleBasic` [padding 10] where
|
||||
caption = "Books (" <> showt (length $ model ^. books) <> ")"
|
||||
|
||||
booksChanged old new = old ^. books /= new ^. books
|
||||
|
@ -31,7 +31,7 @@ buildUI wenv model = widgetTree where
|
||||
label "Width",
|
||||
vstack [
|
||||
dial_ (circlesCfg . itemWidth) 20 50 [dragRate 0.5],
|
||||
labelS (model ^. circlesCfg . itemWidth) `style` [textSize 14, textCenter]
|
||||
labelS (model ^. circlesCfg . itemWidth) `styleBasic` [textSize 14, textCenter]
|
||||
],
|
||||
label "Seed",
|
||||
seedDropdown (circlesCfg . seed)
|
||||
@ -41,7 +41,7 @@ buildUI wenv model = widgetTree where
|
||||
label "Width",
|
||||
vstack [
|
||||
dial_ (boxesCfg . itemWidth) 20 50 [dragRate 0.5],
|
||||
labelS (model ^. boxesCfg . itemWidth) `style` [textSize 14, textCenter]
|
||||
labelS (model ^. boxesCfg . itemWidth) `styleBasic` [textSize 14, textCenter]
|
||||
],
|
||||
label "Seed",
|
||||
seedDropdown (boxesCfg . seed),
|
||||
@ -51,7 +51,7 @@ buildUI wenv model = widgetTree where
|
||||
label "Palette size",
|
||||
vstack [
|
||||
dial_ (boxesCfg . paletteSize) 1 50 [dragRate 0.5],
|
||||
labelS (model ^. boxesCfg . paletteSize) `style` [textSize 14, textCenter]
|
||||
labelS (model ^. boxesCfg . paletteSize) `styleBasic` [textSize 14, textCenter]
|
||||
]
|
||||
]
|
||||
|
||||
@ -62,19 +62,19 @@ buildUI wenv model = widgetTree where
|
||||
textDropdown_ activeGen genTypes genTypeDesc [] `key` "activeType",
|
||||
spacer,
|
||||
labeledCheckbox "Show config:" showCfg
|
||||
] `style` [padding 20, bgColor sectionBg],
|
||||
] `styleBasic` [padding 20, bgColor sectionBg],
|
||||
zstack [
|
||||
hstack [
|
||||
circlesGrid (model ^. circlesCfg) `style` [padding 20],
|
||||
circlesGrid (model ^. circlesCfg) `styleBasic` [padding 20],
|
||||
widgetCircleCfg
|
||||
`visible` model ^. showCfg
|
||||
`style` [padding 20, width 200, bgColor sectionBg]
|
||||
`styleBasic` [padding 20, width 200, bgColor sectionBg]
|
||||
] `visible` (model ^. activeGen == CirclesGrid),
|
||||
hstack [
|
||||
boxesPalette (model ^. boxesCfg) `style` [padding 20],
|
||||
boxesPalette (model ^. boxesCfg) `styleBasic` [padding 20],
|
||||
widgetBoxCfg
|
||||
`visible` model ^. showCfg
|
||||
`style` [padding 20, width 200, bgColor sectionBg]
|
||||
`styleBasic` [padding 20, width 200, bgColor sectionBg]
|
||||
] `visible` (model ^. activeGen == BoxesPalette)
|
||||
]
|
||||
]
|
||||
|
@ -44,7 +44,7 @@ tickerPct t = pctLabel where
|
||||
| pct > 0 = rgbHex "#51A39A"
|
||||
| otherwise = rgbHex "#E25141"
|
||||
|
||||
pctLabel = label pctText `style` [width 100, textRight, textColor pctColor]
|
||||
pctLabel = label pctText `styleBasic` [width 100, textRight, textColor pctColor]
|
||||
|
||||
tickerRow :: TickerWenv -> Int -> Ticker -> TickerNode
|
||||
tickerRow wenv idx t = row where
|
||||
@ -55,20 +55,20 @@ tickerRow wenv idx t = row where
|
||||
trashBg = wenv ^. L.theme . L.userColorMap . at "trashBg" . non def
|
||||
trashFg = wenv ^. L.theme . L.userColorMap . at "trashFg" . non def
|
||||
trashIcon action = button remixDeleteBinLine action
|
||||
`style` [textFont "Remix", textMiddle, textColor trashFg, bgColor transparent, border 0 transparent]
|
||||
`hover` [bgColor trashBg]
|
||||
`styleBasic` [textFont "Remix", textMiddle, textColor trashFg, bgColor transparent, border 0 transparent]
|
||||
`styleHover` [bgColor trashBg]
|
||||
|
||||
dropTicker pair
|
||||
= dropTarget_ (TickerMovePair pair) [dropTargetStyle [bgColor darkGray]]
|
||||
|
||||
tickerInfo = hstack [
|
||||
label (t ^. symbolPair) `style` [width 100],
|
||||
label (t ^. symbolPair) `styleBasic` [width 100],
|
||||
spacer,
|
||||
label (formatTickerValue (t ^. close))
|
||||
`style` [textRight, minWidth 100],
|
||||
`styleBasic` [textRight, minWidth 100],
|
||||
spacer,
|
||||
tickerPct t
|
||||
] `style` [cursorHand]
|
||||
] `styleBasic` [cursorHand]
|
||||
|
||||
row = hstack [
|
||||
dropTicker (t ^. symbolPair) $
|
||||
@ -76,8 +76,8 @@ tickerRow wenv idx t = row where
|
||||
tickerInfo,
|
||||
spacer,
|
||||
trashIcon (TickerRemovePairBegin (t ^. symbolPair))
|
||||
] `style` [padding 10, borderB 1 rowSep]
|
||||
`hover` [bgColor rowBg]
|
||||
] `styleBasic` [padding 10, borderB 1 rowSep]
|
||||
`styleHover` [bgColor rowBg]
|
||||
|
||||
buildUI :: TickerWenv -> TickerModel -> TickerNode
|
||||
buildUI wenv model = widgetTree where
|
||||
@ -99,8 +99,8 @@ buildUI wenv model = widgetTree where
|
||||
keystroke [("Enter", TickerAddClick)] $ textField newPair `key` "newPair",
|
||||
spacer,
|
||||
button "Add" TickerAddClick
|
||||
] `style` [padding 20, bgColor sectionBg],
|
||||
scroll_ [scrollOverlay] $ tickerList `style` [padding 10]
|
||||
] `styleBasic` [padding 20, bgColor sectionBg],
|
||||
scroll_ [scrollOverlay] $ tickerList `styleBasic` [padding 10]
|
||||
]
|
||||
|
||||
handleEvent
|
||||
|
@ -38,25 +38,25 @@ todoRow wenv model idx t = animRow `key` todoKey where
|
||||
| otherwise = (pendingBg, pendingFg)
|
||||
|
||||
todoStatus = labelS (t ^. status)
|
||||
`style` [textFont "Medium", textSize 12, textAscender, textColor todoFg, padding 6, paddingH 8, radius 12, bgColor todoBg]
|
||||
`styleBasic` [textFont "Medium", textSize 12, textAscender, textColor todoFg, padding 6, paddingH 8, radius 12, bgColor todoBg]
|
||||
|
||||
rowButton caption action = button caption action
|
||||
`style` [textFont "Remix", textMiddle, textColor rowButtonColor, bgColor transparent, border 0 transparent]
|
||||
`hover` [bgColor sectionBg]
|
||||
`styleBasic` [textFont "Remix", textMiddle, textColor rowButtonColor, bgColor transparent, border 0 transparent]
|
||||
`styleHover` [bgColor sectionBg]
|
||||
|
||||
todoInfo = hstack [
|
||||
vstack [
|
||||
labelS (t ^. todoType) `style` [textSize 12, textColor darkGray],
|
||||
labelS (t ^. todoType) `styleBasic` [textSize 12, textColor darkGray],
|
||||
spacer_ [width 5],
|
||||
label (t ^. description) `style` [textThroughline_ todoDone]
|
||||
label (t ^. description) `styleBasic` [textThroughline_ todoDone]
|
||||
],
|
||||
filler,
|
||||
box_ [alignRight] todoStatus `style` [width 80],
|
||||
box_ [alignRight] todoStatus `styleBasic` [width 80],
|
||||
spacer,
|
||||
rowButton remixEdit2Line (TodoEdit idx t),
|
||||
spacer,
|
||||
rowButton remixDeleteBinLine (TodoDeleteBegin idx t)
|
||||
] `style` (paddingV 15 : [borderB 1 rowSepColor | not isLast])
|
||||
] `styleBasic` (paddingV 15 : [borderB 1 rowSepColor | not isLast])
|
||||
|
||||
animRow = animFadeOut_ [onFinished (TodoDelete idx t)] todoInfo
|
||||
|
||||
@ -97,14 +97,14 @@ todoEdit wenv model = editNode where
|
||||
spacer,
|
||||
button "Cancel" TodoCancel
|
||||
]
|
||||
] `style` [bgColor sectionBg, padding 20]
|
||||
] `styleBasic` [bgColor sectionBg, padding 20]
|
||||
|
||||
buildUI :: TodoWenv -> TodoModel -> TodoNode
|
||||
buildUI wenv model = widgetTree where
|
||||
sectionBg = wenv ^. L.theme . L.sectionColor
|
||||
isEditing = model ^. action /= TodoNone
|
||||
|
||||
countLabel = label caption `style` styles where
|
||||
countLabel = label caption `styleBasic` styles where
|
||||
caption = "Tasks (" <> showt (length $ model ^. todos) <> ")"
|
||||
styles = [textFont "Regular", textSize 16, padding 20, bgColor sectionBg]
|
||||
|
||||
@ -129,14 +129,14 @@ buildUI wenv model = widgetTree where
|
||||
keystroke [("Enter", saveAction), ("Esc", TodoCancel)] $
|
||||
todoEdit wenv model,
|
||||
filler
|
||||
] `style` [bgColor (grayDark & L.a .~ 0.5)]
|
||||
] `styleBasic` [bgColor (grayDark & L.a .~ 0.5)]
|
||||
|
||||
mainLayer = vstack [
|
||||
countLabel,
|
||||
scroll_ [] (todoList `style` [padding 20, paddingT 5]),
|
||||
scroll_ [] (todoList `styleBasic` [padding 20, paddingT 5]),
|
||||
filler,
|
||||
box_ [alignRight] newButton
|
||||
`style` [bgColor sectionBg, padding 20]
|
||||
`styleBasic` [bgColor sectionBg, padding 20]
|
||||
]
|
||||
|
||||
widgetTree = zstack [
|
||||
|
@ -30,7 +30,7 @@ buildUI
|
||||
buildUI wenv model = widgetTree where
|
||||
widgetTree = vstack [
|
||||
titleText "Text",
|
||||
box (textField sampleText) `style` [paddingV 10],
|
||||
box (textField sampleText) `styleBasic` [paddingV 10],
|
||||
|
||||
titleText "Font name",
|
||||
hgrid [
|
||||
@ -49,29 +49,29 @@ buildUI wenv model = widgetTree where
|
||||
radio "Italic" fontName,
|
||||
filler
|
||||
]
|
||||
] `style` [paddingV 10],
|
||||
] `styleBasic` [paddingV 10],
|
||||
|
||||
titleText "Font size",
|
||||
hslider fontSize 10 200
|
||||
`style` [paddingV 10, fgColor orange],
|
||||
`styleBasic` [paddingV 10, fgColor orange],
|
||||
|
||||
titleText "Font color",
|
||||
hstack [
|
||||
labeledCheckbox "Show color picker " showPicker,
|
||||
filler
|
||||
] `style` [paddingT 10, paddingB 5],
|
||||
] `styleBasic` [paddingT 10, paddingB 5],
|
||||
colorPicker fontColor
|
||||
`visible` (model ^. showPicker)
|
||||
`style` [paddingB 10],
|
||||
`styleBasic` [paddingB 10],
|
||||
|
||||
sampleTextLabel
|
||||
] `style` [padding 10]
|
||||
] `styleBasic` [padding 10]
|
||||
|
||||
titleText text = label text
|
||||
`style` [textFont "Medium", textSize 20]
|
||||
`styleBasic` [textFont "Medium", textSize 20]
|
||||
|
||||
sampleTextLabel = label_ (model ^. sampleText) [ellipsis]
|
||||
`style` [
|
||||
`styleBasic` [
|
||||
bgColor dimGray,
|
||||
border 4 lightGray,
|
||||
radius 10,
|
||||
|
@ -36,14 +36,14 @@ buildUI
|
||||
-> WidgetNode AppModel AppEvent
|
||||
buildUI wenv model = widgetTree where
|
||||
listItem idx item = vstack [
|
||||
label_ (item ^. text) [ellipsis] `style` [textSize 12, paddingH 8],
|
||||
label_ (item ^. text) [ellipsis] `styleBasic` [textSize 12, paddingH 8],
|
||||
spacer,
|
||||
hstack [
|
||||
textField (items . singular (ix idx) . text),
|
||||
spacer,
|
||||
button "Delete" (RemoveItem idx)
|
||||
]
|
||||
] `key` showt (item ^. ts) `style` [paddingT 10]
|
||||
] `key` showt (item ^. ts) `styleBasic` [paddingT 10]
|
||||
|
||||
widgetTree = vstack [
|
||||
keystroke [("Enter", AddItem)] $ hstack [
|
||||
@ -52,14 +52,14 @@ buildUI wenv model = widgetTree where
|
||||
textField_ newItemText [placeholder "Write here!"] `key` "description",
|
||||
spacer,
|
||||
button "Add" AddItem
|
||||
`style` [paddingH 5]
|
||||
`styleBasic` [paddingH 5]
|
||||
`enabled` (model ^. newItemText /= "")
|
||||
],
|
||||
|
||||
separatorLine `style` [paddingT 20, paddingB 10],
|
||||
separatorLine `styleBasic` [paddingT 20, paddingB 10],
|
||||
|
||||
vstack (zipWith listItem [0..] (model ^. items))
|
||||
] `style` [padding 20]
|
||||
] `styleBasic` [padding 20]
|
||||
|
||||
handleEvent
|
||||
:: WidgetEnv AppModel AppEvent
|
||||
|
@ -32,12 +32,12 @@ buildUI wenv model = widgetTree where
|
||||
pushLayers = zstack [
|
||||
image_ "./assets/images/red-button.png" [fitFill] `visible` not (model ^. hoverButton),
|
||||
image_ "./assets/images/red-button-hover.png" [fitFill] `visible` model ^. hoverButton,
|
||||
label "Push!" `style` [textFont "Bold", textSize 20, textCenter]
|
||||
label "Push!" `styleBasic` [textFont "Bold", textSize 20, textCenter]
|
||||
]
|
||||
pushButton = box_ [onClick AppGenRandom, onEnter AppOnEnterBtn, onLeave AppOnLeaveBtn] pushLayers
|
||||
`style` [width 160, height 160, cursorHand]
|
||||
`styleBasic` [width 160, height 160, cursorHand]
|
||||
numberLabel = labelS (model ^. selected)
|
||||
`style` [textFont "Bold", textSize 100, textColor black, textCenter, width 160]
|
||||
`styleBasic` [textFont "Bold", textSize 100, textColor black, textCenter, width 160]
|
||||
numberedImage url idx = scroll (image_ url [fitNone])
|
||||
`visible` (model ^. selected == idx)
|
||||
imageSet = hstack [
|
||||
@ -47,15 +47,15 @@ buildUI wenv model = widgetTree where
|
||||
numberedImage "https://picsum.photos/id/1025/800/600" 4,
|
||||
numberedImage "https://picsum.photos/id/1080/800/600" 5,
|
||||
numberedImage "https://picsum.photos/id/1059/800/600" 6
|
||||
] `style` [padding 10]
|
||||
] `styleBasic` [padding 10]
|
||||
widgetTree = vstack [
|
||||
hstack [
|
||||
tooltip "Click to pick a random number" pushButton
|
||||
`style` [textSize 16, bgColor steelBlue, paddingH 5, radius 5],
|
||||
`styleBasic` [textSize 16, bgColor steelBlue, paddingH 5, radius 5],
|
||||
numberLabel
|
||||
],
|
||||
imageSet
|
||||
] `style` [bgColor moccasin]
|
||||
] `styleBasic` [bgColor moccasin]
|
||||
|
||||
handleEvent
|
||||
:: WidgetEnv AppModel AppEvent
|
||||
|
@ -31,7 +31,7 @@ buildUI wenv model = widgetTree where
|
||||
timeString = T.pack . show $ model ^. currentTime
|
||||
|
||||
timeLabel = label (T.takeWhile (/= '.') timeString)
|
||||
`style` [textFont "Bold", textSize 80, textCenter, textMiddle, flexHeight 100]
|
||||
`styleBasic` [textFont "Bold", textSize 80, textCenter, textMiddle, flexHeight 100]
|
||||
|
||||
widgetTree = vstack [
|
||||
animFadeIn timeLabel `key` "fadeTimeLabel"
|
||||
|
@ -48,26 +48,26 @@ buildUIComp wenv model = widgetTree where
|
||||
textDrag = rgbHex "#E0FFFF"
|
||||
|
||||
itemA val = label ("Item: " <> showt val)
|
||||
`style` [textColor black, padding 5]
|
||||
`styleBasic` [textColor black, padding 5]
|
||||
|
||||
dragItem val = draggable_ val
|
||||
[draggableStyle [bgColor textDrag, radius 5]]
|
||||
(itemA val)
|
||||
`style` [cursorHand]
|
||||
`styleBasic` [cursorHand]
|
||||
|
||||
dragList items = vstack (dragItem <$> items)
|
||||
|
||||
dropContainer target list = dropTarget_ target
|
||||
[dropTargetStyle [radius 10, bgColor sectionHover]]
|
||||
(dragList (model ^. list))
|
||||
`style` [minWidth 100, flexHeight 100, padding 5, radius 10, bgColor sectionBg]
|
||||
`styleBasic` [minWidth 100, flexHeight 100, padding 5, radius 10, bgColor sectionBg]
|
||||
|
||||
dropTargetA = dropContainer DropToA listA
|
||||
dropTargetB = dropContainer DropToB listB
|
||||
|
||||
widgetTree = hstack [
|
||||
box dropTargetA `style` [paddingR 5],
|
||||
box dropTargetB `style` [paddingL 5]
|
||||
box dropTargetA `styleBasic` [paddingR 5],
|
||||
box dropTargetB `styleBasic` [paddingL 5]
|
||||
]
|
||||
|
||||
handleEventComp
|
||||
@ -102,10 +102,10 @@ buildUI wenv model = widgetTree where
|
||||
hstack [
|
||||
button "Show Dialog" ShowDialog
|
||||
]
|
||||
] `style` [padding 10]
|
||||
] `styleBasic` [padding 10]
|
||||
|
||||
closeIcon = icon IconClose
|
||||
`style` [width 16, height 16, fgColor black, cursorHand]
|
||||
`styleBasic` [width 16, height 16, fgColor black, cursorHand]
|
||||
|
||||
dialogLayer = vstack [
|
||||
hstack [
|
||||
@ -114,13 +114,13 @@ buildUI wenv model = widgetTree where
|
||||
],
|
||||
spacer,
|
||||
compWidget dialogModel
|
||||
] `style` [width 500, height 400, padding 10, radius 10, bgColor darkGray]
|
||||
] `styleBasic` [width 500, height 400, padding 10, radius 10, bgColor darkGray]
|
||||
|
||||
widgetTree = zstack [
|
||||
baseLayer,
|
||||
box_ [alignCenter, alignMiddle] dialogLayer
|
||||
`visible` model ^. showDialog
|
||||
`style` [bgColor (gray & L.a .~ 0.8)]
|
||||
`styleBasic` [bgColor (gray & L.a .~ 0.8)]
|
||||
]
|
||||
|
||||
handleEvent
|
||||
|
@ -139,9 +139,9 @@ buildUI wenv model = widgetTree where
|
||||
widgetTree = vstack [
|
||||
button "Reset canvas" AppResetCanvas,
|
||||
spacer,
|
||||
canvas `key` "mainCanvas" `style` [border 1 gray]
|
||||
-- canvas_ [canvasColor pink] `key` "mainCanvas" `style` [border 1 gray]
|
||||
] `style` [padding 10]
|
||||
canvas `key` "mainCanvas" `styleBasic` [border 1 gray]
|
||||
-- canvas_ [canvasColor pink] `key` "mainCanvas" `styleBasic` [border 1 gray]
|
||||
] `styleBasic` [padding 10]
|
||||
|
||||
handleEvent
|
||||
:: WidgetEnv AppModel AppEvent
|
||||
|
@ -72,7 +72,7 @@ buildUI wenv model = widgetTree where
|
||||
spacer,
|
||||
button "Decrease count" AppDecrease
|
||||
]
|
||||
] `style` [padding 20]
|
||||
] `styleBasic` [padding 20]
|
||||
|
||||
handleEvent
|
||||
:: WidgetEnv AppModel AppEvent
|
||||
|
@ -516,12 +516,12 @@ class CmbMaxDim t where
|
||||
infixl 5 `key`
|
||||
infixl 5 `enabled`
|
||||
infixl 5 `visible`
|
||||
infixl 5 `style`
|
||||
infixl 5 `hover`
|
||||
infixl 5 `focus`
|
||||
infixl 5 `focusHover`
|
||||
infixl 5 `active`
|
||||
infixl 5 `disabled`
|
||||
infixl 5 `styleBasic`
|
||||
infixl 5 `styleHover`
|
||||
infixl 5 `styleFocus`
|
||||
infixl 5 `styleFocusHover`
|
||||
infixl 5 `styleActive`
|
||||
infixl 5 `styleDisabled`
|
||||
|
||||
-- | Key combinator, used mainly infix for widgets.
|
||||
class CmbKey t a | t -> a where
|
||||
@ -536,32 +536,32 @@ class CmbVisible t where
|
||||
visible :: t -> Bool -> t
|
||||
|
||||
-- | Focusable combinator, used mainly infix for widgets.
|
||||
class CmbFocusable t where
|
||||
class CmbStyleFocusable t where
|
||||
focusable :: t -> Bool -> t
|
||||
|
||||
-- | Basic style combinator, used mainly infix for widgets as a list.
|
||||
class CmbStyle t where
|
||||
style :: t -> [StyleState] -> t
|
||||
class CmbStyleBasic t where
|
||||
styleBasic :: t -> [StyleState] -> t
|
||||
|
||||
-- | Hover style combinator, used mainly infix for widgets as a list.
|
||||
class CmbHover t where
|
||||
hover :: t -> [StyleState] -> t
|
||||
class CmbStyleHover t where
|
||||
styleHover :: t -> [StyleState] -> t
|
||||
|
||||
-- | Focus style combinator, used mainly infix for widgets as a list.
|
||||
class CmbFocus t where
|
||||
focus :: t -> [StyleState] -> t
|
||||
class CmbStyleFocus t where
|
||||
styleFocus :: t -> [StyleState] -> t
|
||||
|
||||
-- | Focus Hover style combinator, used mainly infix for widgets as a list.
|
||||
class CmbFocusHover t where
|
||||
focusHover :: t -> [StyleState] -> t
|
||||
class CmbStyleFocusHover t where
|
||||
styleFocusHover :: t -> [StyleState] -> t
|
||||
|
||||
-- | Active style combinator, used mainly infix for widgets as a list.
|
||||
class CmbActive t where
|
||||
active :: t -> [StyleState] -> t
|
||||
class CmbStyleActive t where
|
||||
styleActive :: t -> [StyleState] -> t
|
||||
|
||||
-- | Disabled style combinator, used mainly infix for widgets as a list.
|
||||
class CmbDisabled t where
|
||||
disabled :: t -> [StyleState] -> t
|
||||
class CmbStyleDisabled t where
|
||||
styleDisabled :: t -> [StyleState] -> t
|
||||
|
||||
-- | Ignore theme settings and start with blank style.
|
||||
class CmbIgnoreTheme t where
|
||||
@ -610,8 +610,8 @@ class CmbCursorIcon t where
|
||||
cursorIcon :: CursorIcon -> t
|
||||
|
||||
-- | Basic style for each item of a list.
|
||||
class CmbItemNormalStyle t s | t -> s where
|
||||
itemNormalStyle :: s -> t
|
||||
class CmbItemBasicStyle t s | t -> s where
|
||||
itemBasicStyle :: s -> t
|
||||
|
||||
-- | Hover style for an item of a list.
|
||||
class CmbItemHoverStyle t s | t -> s where
|
||||
|
@ -12,10 +12,6 @@ Helper functions for style types.
|
||||
{-# LANGUAGE MultiParamTypeClasses #-}
|
||||
|
||||
module Monomer.Core.StyleUtil (
|
||||
style,
|
||||
hover,
|
||||
focus,
|
||||
disabled,
|
||||
styleFont,
|
||||
styleFontSize,
|
||||
styleFontSpaceH,
|
||||
@ -59,28 +55,28 @@ getContentArea :: WidgetNode s e -> StyleState -> Rect
|
||||
getContentArea node style = fromMaybe def area where
|
||||
area = removeOuterBounds style (node ^. L.info . L.viewport)
|
||||
|
||||
instance CmbStyle Style where
|
||||
style oldStyle states = newStyle where
|
||||
instance CmbStyleBasic Style where
|
||||
styleBasic oldStyle states = newStyle where
|
||||
newStyle = oldStyle & L.basic .~ maybeConcat states
|
||||
|
||||
instance CmbHover Style where
|
||||
hover oldStyle states = newStyle where
|
||||
instance CmbStyleHover Style where
|
||||
styleHover oldStyle states = newStyle where
|
||||
newStyle = oldStyle & L.hover .~ maybeConcat states
|
||||
|
||||
instance CmbFocus Style where
|
||||
focus oldStyle states = newStyle where
|
||||
instance CmbStyleFocus Style where
|
||||
styleFocus oldStyle states = newStyle where
|
||||
newStyle = oldStyle & L.focus .~ maybeConcat states
|
||||
|
||||
instance CmbFocusHover Style where
|
||||
focusHover oldStyle states = newStyle where
|
||||
instance CmbStyleFocusHover Style where
|
||||
styleFocusHover oldStyle states = newStyle where
|
||||
newStyle = oldStyle & L.focusHover .~ maybeConcat states
|
||||
|
||||
instance CmbActive Style where
|
||||
active oldStyle states = newStyle where
|
||||
instance CmbStyleActive Style where
|
||||
styleActive oldStyle states = newStyle where
|
||||
newStyle = oldStyle & L.active .~ maybeConcat states
|
||||
|
||||
instance CmbDisabled Style where
|
||||
disabled oldStyle states = newStyle where
|
||||
instance CmbStyleDisabled Style where
|
||||
styleDisabled oldStyle states = newStyle where
|
||||
newStyle = oldStyle & L.disabled .~ maybeConcat states
|
||||
|
||||
instance CmbKey (WidgetNode s e) Text where
|
||||
@ -92,41 +88,41 @@ instance CmbEnabled (WidgetNode s e) where
|
||||
instance CmbVisible (WidgetNode s e) where
|
||||
visible node visibility = node & L.info . L.visible .~ visibility
|
||||
|
||||
instance CmbFocusable (WidgetNode s e) where
|
||||
instance CmbStyleFocusable (WidgetNode s e) where
|
||||
focusable node isFocusable = node & L.info . L.focusable .~ isFocusable
|
||||
|
||||
instance CmbStyle (WidgetNode s e) where
|
||||
style node states = node & L.info . L.style .~ newStyle where
|
||||
instance CmbStyleBasic (WidgetNode s e) where
|
||||
styleBasic node states = node & L.info . L.style .~ newStyle where
|
||||
state = mconcat states
|
||||
oldStyle = node ^. L.info . L.style
|
||||
newStyle = oldStyle & L.basic ?~ state
|
||||
|
||||
instance CmbHover (WidgetNode s e) where
|
||||
hover node states = node & L.info . L.style .~ newStyle where
|
||||
instance CmbStyleHover (WidgetNode s e) where
|
||||
styleHover node states = node & L.info . L.style .~ newStyle where
|
||||
state = mconcat states
|
||||
oldStyle = node ^. L.info . L.style
|
||||
newStyle = oldStyle & L.hover ?~ state
|
||||
|
||||
instance CmbFocus (WidgetNode s e) where
|
||||
focus node states = node & L.info . L.style .~ newStyle where
|
||||
instance CmbStyleFocus (WidgetNode s e) where
|
||||
styleFocus node states = node & L.info . L.style .~ newStyle where
|
||||
state = mconcat states
|
||||
oldStyle = node ^. L.info . L.style
|
||||
newStyle = oldStyle & L.focus ?~ state
|
||||
|
||||
instance CmbFocusHover (WidgetNode s e) where
|
||||
focusHover node states = node & L.info . L.style .~ newStyle where
|
||||
instance CmbStyleFocusHover (WidgetNode s e) where
|
||||
styleFocusHover node states = node & L.info . L.style .~ newStyle where
|
||||
state = mconcat states
|
||||
oldStyle = node ^. L.info . L.style
|
||||
newStyle = oldStyle & L.focusHover ?~ state
|
||||
|
||||
instance CmbActive (WidgetNode s e) where
|
||||
active node states = node & L.info . L.style .~ newStyle where
|
||||
instance CmbStyleActive (WidgetNode s e) where
|
||||
styleActive node states = node & L.info . L.style .~ newStyle where
|
||||
state = mconcat states
|
||||
oldStyle = node ^. L.info . L.style
|
||||
newStyle = oldStyle & L.active ?~ state
|
||||
|
||||
instance CmbDisabled (WidgetNode s e) where
|
||||
disabled node states = node & L.info . L.style .~ newStyle where
|
||||
instance CmbStyleDisabled (WidgetNode s e) where
|
||||
styleDisabled node states = node & L.info . L.style .~ newStyle where
|
||||
state = mconcat states
|
||||
oldStyle = node ^. L.info . L.style
|
||||
newStyle = oldStyle & L.disabled ?~ state
|
||||
|
@ -72,7 +72,7 @@ makeLabeledItem textSide caption labelCfg itemNode = widget where
|
||||
& collectStyleField_ L.sndColor nodeStyle
|
||||
& collectStyleField_ L.cursorIcon nodeStyle
|
||||
|
||||
baseLabel = label_ caption [labelCfg] `style` [cursorHand]
|
||||
baseLabel = label_ caption [labelCfg] `styleBasic` [cursorHand]
|
||||
labelNode = baseLabel
|
||||
& L.info . L.style <>~ labelStyle
|
||||
styledNode = itemNode
|
||||
|
@ -22,7 +22,7 @@ Configs:
|
||||
- onChangeIdxReq: WidgetRequest to generate when selected item changes. Includes
|
||||
index.
|
||||
- maxHeight: maximum height of the list when dropdown is expanded.
|
||||
- itemNormalStyle: style of an item in the list when not selected.
|
||||
- itemBasicStyle: style of an item in the list when not selected.
|
||||
- itemSelectedStyle: style of the selected item in the list.
|
||||
-}
|
||||
{-# LANGUAGE BangPatterns #-}
|
||||
@ -145,8 +145,8 @@ instance CmbMaxHeight (DropdownCfg s e a) where
|
||||
_ddcMaxHeight = Just h
|
||||
}
|
||||
|
||||
instance CmbItemNormalStyle (DropdownCfg s e a) Style where
|
||||
itemNormalStyle style = def {
|
||||
instance CmbItemBasicStyle (DropdownCfg s e a) Style where
|
||||
itemBasicStyle style = def {
|
||||
_ddcItemStyle = Just style
|
||||
}
|
||||
|
||||
@ -526,7 +526,7 @@ makeSelectList wenv value items makeRow config widgetId = selectListNode where
|
||||
selectOnBlur,
|
||||
onBlurReq (const $ SendMessage widgetId OnListBlur),
|
||||
onChangeIdxReq (\idx it -> SendMessage widgetId (OnChangeMessage idx it)),
|
||||
itemNormalStyle itemStyle,
|
||||
itemBasicStyle itemStyle,
|
||||
itemSelectedStyle itemSelStyle
|
||||
]
|
||||
slStyle = collectTheme wenv L.dropdownListStyle
|
||||
|
@ -22,7 +22,7 @@ Configs:
|
||||
index.
|
||||
- selectOnBlur: whether to select the currently highlighted item when navigating
|
||||
away from the widget with tab key.
|
||||
- itemNormalStyle: style of an item in the list when not selected.
|
||||
- itemBasicStyle: style of an item in the list when not selected.
|
||||
- itemSelectedStyle: style of the selected item in the list.
|
||||
- mergeRequired: whether merging children is required. Useful when select list
|
||||
is part of another widget such as dropdown.
|
||||
@ -153,8 +153,8 @@ instance CmbSelectOnBlur (SelectListCfg s e a) where
|
||||
_slcSelectOnBlur = Just select
|
||||
}
|
||||
|
||||
instance CmbItemNormalStyle (SelectListCfg s e a) Style where
|
||||
itemNormalStyle style = def {
|
||||
instance CmbItemBasicStyle (SelectListCfg s e a) Style where
|
||||
itemBasicStyle style = def {
|
||||
_slcItemStyle = Just style
|
||||
}
|
||||
|
||||
|
@ -185,19 +185,19 @@ buildUI config wenv model = mainTree where
|
||||
showAlpha = fromMaybe False (_cpcShowAlpha config)
|
||||
colorSample = zstack [
|
||||
patternImage 2 10 (rgb 255 255 255) (rgb 150 150 150),
|
||||
filler `style` [bgColor model]
|
||||
] `style` [width 32]
|
||||
filler `styleBasic` [bgColor model]
|
||||
] `styleBasic` [width 32]
|
||||
|
||||
compRow lensCol evt lbl minV maxV = hstack [
|
||||
label lbl `style` [width 48],
|
||||
label lbl `styleBasic` [width 48],
|
||||
spacer_ [width 2],
|
||||
hslider_ lensCol minV maxV [onChange evt, onFocus PickerFocus,
|
||||
onBlur PickerBlur]
|
||||
`style` [paddingV 5],
|
||||
`styleBasic` [paddingV 5],
|
||||
spacer_ [width 2],
|
||||
numericField_ lensCol [minValue minV, maxValue maxV, onChange evt,
|
||||
onFocus PickerFocus, onBlur PickerBlur]
|
||||
`style` [width 40, padding 0, textRight]
|
||||
`styleBasic` [width 40, padding 0, textRight]
|
||||
]
|
||||
|
||||
colorRow lens lbl = compRow lens ColorChanged lbl 0 255
|
||||
@ -214,8 +214,8 @@ buildUI config wenv model = mainTree where
|
||||
alphaRow L.a "Alpha" `visible` showAlpha
|
||||
],
|
||||
spacer_ [width 2],
|
||||
box_ [alignTop] colorSample `style` [flexHeight 50]
|
||||
] `style` [padding 0]
|
||||
box_ [alignTop] colorSample `styleBasic` [flexHeight 50]
|
||||
] `styleBasic` [padding 0]
|
||||
|
||||
handleEvent
|
||||
:: (WidgetModel sp, WidgetEvent ep)
|
||||
|
@ -22,7 +22,7 @@ Configs:
|
||||
- onChangeIdxReq: WidgetRequest to generate when selected item changes. Includes
|
||||
index.
|
||||
- maxHeight: maximum height of the list when dropdown is expanded.
|
||||
- itemNormalStyle: style of an item in the list when not selected.
|
||||
- itemBasicStyle: style of an item in the list when not selected.
|
||||
- itemSelectedStyle: style of the selected item in the list.
|
||||
-}
|
||||
{-# LANGUAGE ConstraintKinds #-}
|
||||
|
8
tasks.md
8
tasks.md
@ -797,16 +797,16 @@
|
||||
Next
|
||||
- Rename style combinators?
|
||||
- Document themes and how widgets use them.
|
||||
- Make resize process smarter
|
||||
- Keep list of widgets requesting resize
|
||||
- If children requested resize, it overrides viewport check
|
||||
- Can remove resize flag from Container/selectList
|
||||
- Remove dpr calculations from NanoVGRenderer.
|
||||
- Same with FontManager.
|
||||
- When testing Windows/Linux, check if scroll rate needs to be adjusted.
|
||||
- Create ContextMenu (could work similarly to Tooltip).
|
||||
|
||||
Future
|
||||
- Make resize process smarter
|
||||
- Keep list of widgets requesting resize
|
||||
- If children requested resize, it overrides viewport check
|
||||
- Can remove resize flag from Container/selectList
|
||||
- Check if Windows/Linux also miss top pixel
|
||||
- Fix for all if they do
|
||||
- If they don't, add custom handling for macOS
|
||||
|
@ -76,9 +76,9 @@ handleEventSimple = describe "handleEventSimple" $ do
|
||||
wenv = mockWenvEvtUnit ()
|
||||
node = vstack [
|
||||
label "Test",
|
||||
label "Test" `style` [cursorIcon CursorHand],
|
||||
label "Test" `style` [cursorIcon CursorIBeam],
|
||||
label "Test" `style` [cursorIcon CursorInvalid]
|
||||
label "Test" `styleBasic` [cursorIcon CursorHand],
|
||||
label "Test" `styleBasic` [cursorIcon CursorIBeam],
|
||||
label "Test" `styleBasic` [cursorIcon CursorInvalid]
|
||||
]
|
||||
icons egs = getIcons wenv node egs
|
||||
p1 = Point 100 10
|
||||
@ -105,17 +105,17 @@ handleEventNested = describe "handleEventNested" $ do
|
||||
label "Test",
|
||||
hgrid [
|
||||
hgrid [
|
||||
label "Test" `style` [cursorIcon CursorSizeH],
|
||||
label "Test" `styleBasic` [cursorIcon CursorSizeH],
|
||||
filler
|
||||
]
|
||||
] `style` [cursorIcon CursorHand],
|
||||
] `styleBasic` [cursorIcon CursorHand],
|
||||
hgrid [
|
||||
hgrid [
|
||||
label "Test" `style` [cursorIcon CursorSizeV],
|
||||
label "Test" `styleBasic` [cursorIcon CursorSizeV],
|
||||
filler
|
||||
] `style` [cursorIcon CursorInvalid],
|
||||
] `styleBasic` [cursorIcon CursorInvalid],
|
||||
spacer
|
||||
] `style` [cursorIcon CursorHand]
|
||||
] `styleBasic` [cursorIcon CursorHand]
|
||||
]
|
||||
icons egs = getIcons wenv node egs
|
||||
p11 = Point 100 10
|
||||
@ -147,7 +147,7 @@ handleEventOverlay = describe "handleEventOverlay" $ do
|
||||
node = vstack [
|
||||
textDropdown selectedItem [0..10::Int],
|
||||
filler
|
||||
] `style` [cursorIcon CursorInvalid]
|
||||
] `styleBasic` [cursorIcon CursorInvalid]
|
||||
icons egs = getIcons wenv node egs
|
||||
p1 = Point 100 10 -- Header
|
||||
p2 = Point 100 50 -- List overlay
|
||||
|
@ -209,7 +209,7 @@ handleEventResize = describe "handleEventResize" $ do
|
||||
_ -> [Model (model & clicks %~ (+1))]
|
||||
buildChild wenv model = vstack [
|
||||
button "Click" ChildBtnClicked,
|
||||
label "Test" `style` [height 3000] `visible` (model ^. clicks > 0)
|
||||
label "Test" `styleBasic` [height 3000] `visible` (model ^. clicks > 0)
|
||||
]
|
||||
handleEvent
|
||||
:: WidgetEnv MainModel MainEvt
|
||||
|
@ -123,7 +123,7 @@ handleEventIgnoreEmpty = describe "handleEventIgnoreEmpty" $ do
|
||||
|
||||
where
|
||||
wenv = mockWenv ()
|
||||
btn2 = button "Click 2" (BtnClick 2) `style` [height 10]
|
||||
btn2 = button "Click 2" (BtnClick 2) `styleBasic` [height 10]
|
||||
ignoredNode = zstack_ [onlyTopActive False] [
|
||||
button "Click 1" (BtnClick 1),
|
||||
box_ [ignoreEmptyArea_ True] btn2
|
||||
@ -140,7 +140,7 @@ handleEventSinkEmpty = describe "handleEventSinkEmpty" $ do
|
||||
|
||||
where
|
||||
wenv = mockWenv ()
|
||||
centeredBtn = button "Click 2" (BtnClick 2) `style` [height 10]
|
||||
centeredBtn = button "Click 2" (BtnClick 2) `styleBasic` [height 10]
|
||||
sunkNode = zstack_ [onlyTopActive False] [
|
||||
button "Click 1" (BtnClick 1),
|
||||
box_ [ignoreEmptyArea_ False] centeredBtn
|
||||
|
@ -100,8 +100,8 @@ getSizeReqMixedH = describe "several items, different reqSizes" $ do
|
||||
where
|
||||
wenv = mockWenv ()
|
||||
gridNode = hgrid [
|
||||
label "Label 1" `style` [width 100, height 100],
|
||||
label "Label 2" `style` [maxWidth 300, maxHeight 300],
|
||||
label "Label 1" `styleBasic` [width 100, height 100],
|
||||
label "Label 2" `styleBasic` [maxWidth 300, maxHeight 300],
|
||||
label "Label 3"
|
||||
]
|
||||
(sizeReqW, sizeReqH) = nodeGetSizeReq wenv gridNode
|
||||
@ -117,8 +117,8 @@ getSizeReqMixedV = describe "several items, different reqSizes" $ do
|
||||
where
|
||||
wenv = mockWenv ()
|
||||
gridNode = vgrid [
|
||||
label "Label 1" `style` [minWidth 100, minHeight 100],
|
||||
label "Label 2" `style` [maxWidth 300, maxHeight 300],
|
||||
label "Label 1" `styleBasic` [minWidth 100, minHeight 100],
|
||||
label "Label 2" `styleBasic` [maxWidth 300, maxHeight 300],
|
||||
label "Label 3"
|
||||
]
|
||||
(sizeReqW, sizeReqH) = nodeGetSizeReq wenv gridNode
|
||||
|
@ -70,10 +70,10 @@ handleChildrenFocus = describe "handleChildrenFocus" $ do
|
||||
evts3 = [evtK keyTab, evtK keyTab, evtK keyTab, evtClick point]
|
||||
st = [width 640, height 480]
|
||||
stackNode = vstack [
|
||||
button "Button 1" Button1 `style` st,
|
||||
button "Button 2" Button2 `style` st,
|
||||
button "Button 3" Button3 `style` st,
|
||||
button "Button 4" Button4 `style` st
|
||||
button "Button 1" Button1 `styleBasic` st,
|
||||
button "Button 2" Button2 `styleBasic` st,
|
||||
button "Button 3" Button3 `styleBasic` st,
|
||||
button "Button 4" Button4 `styleBasic` st
|
||||
]
|
||||
ignoreNode = scroll_ [scrollFollowFocus_ False] stackNode
|
||||
followNode = scroll stackNode
|
||||
@ -98,14 +98,14 @@ handleNestedWheel = describe "handleNestedWheel" $ do
|
||||
evts2 = [evtWheel pointWheel2, evtClick pointClick]
|
||||
st = [width 320, height 480]
|
||||
childNode = vscroll (vstack [
|
||||
button "Button 1" Button1 `style` st,
|
||||
button "Button 2" Button2 `style` st,
|
||||
button "Button 3" Button3 `style` st
|
||||
]) `style` [height 480]
|
||||
button "Button 1" Button1 `styleBasic` st,
|
||||
button "Button 2" Button2 `styleBasic` st,
|
||||
button "Button 3" Button3 `styleBasic` st
|
||||
]) `styleBasic` [height 480]
|
||||
mainNode = vstack [
|
||||
childNode,
|
||||
button "Button 4" Button4 `style` st
|
||||
] `style` [width 320]
|
||||
button "Button 4" Button4 `styleBasic` st
|
||||
] `styleBasic` [width 320]
|
||||
scrollNode = vscroll $ hstack [
|
||||
mainNode,
|
||||
filler
|
||||
@ -134,9 +134,9 @@ handleMessageReset = describe "handleMessageReset" $ do
|
||||
Button3 -> [Message "mainScroll" ScrollReset]
|
||||
_ -> []
|
||||
buildUI wenv model = scroll (vstack [
|
||||
button "Button 1" Button1 `style` [height 480],
|
||||
button "Button 2" Button2 `style` [height 480],
|
||||
button "Button 3" Button3 `style` [height 480]
|
||||
button "Button 1" Button1 `styleBasic` [height 480],
|
||||
button "Button 2" Button2 `styleBasic` [height 480],
|
||||
button "Button 3" Button3 `styleBasic` [height 480]
|
||||
]) `key` "mainScroll"
|
||||
cmpNode = composite "main" id buildUI handleEvent
|
||||
events es = nodeHandleEventEvts wenv es cmpNode
|
||||
@ -153,8 +153,8 @@ forwardStyle = describe "forwardStyle" $ do
|
||||
|
||||
where
|
||||
wenv = mockWenv () & L.windowSize .~ Size 640 480
|
||||
snode1 = scroll (label "Test") `style` [border 1 black, padding 10]
|
||||
snode2 = scroll_ [scrollFwdStyle scrollFwdDefault] (label "Test") `style` [border 1 black, padding 10]
|
||||
snode1 = scroll (label "Test") `styleBasic` [border 1 black, padding 10]
|
||||
snode2 = scroll_ [scrollFwdStyle scrollFwdDefault] (label "Test") `styleBasic` [border 1 black, padding 10]
|
||||
pnode1 = nodeInit wenv snode1
|
||||
cnode1 = pnode1 ^?! L.children . ix 0
|
||||
pnode2 = nodeInit wenv snode2
|
||||
@ -182,7 +182,7 @@ resizeLarge = describe "resizeLarge" $ do
|
||||
wenv = mockWenv () & L.windowSize .~ Size 640 480
|
||||
vp = Rect 0 0 640 480
|
||||
cvp1 = Rect 0 0 3000 2000
|
||||
scrollNode = scroll (label "" `style` [width 3000, height 2000])
|
||||
scrollNode = scroll (label "" `styleBasic` [width 3000, height 2000])
|
||||
newNode = nodeInit wenv scrollNode
|
||||
viewport = newNode ^. L.info . L.viewport
|
||||
childrenVp = roundRectUnits . _wniViewport . _wnInfo <$> newNode ^. L.children
|
||||
@ -199,7 +199,7 @@ resizeSmall = describe "resizeSmall" $ do
|
||||
wenv = mockWenv () & L.windowSize .~ Size 640 480
|
||||
vp = Rect 0 0 640 480
|
||||
cvp1 = Rect 0 0 640 480
|
||||
scrollNode = scroll (label "" `style` [width 300, height 200])
|
||||
scrollNode = scroll (label "" `styleBasic` [width 300, height 200])
|
||||
newNode = nodeInit wenv scrollNode
|
||||
viewport = newNode ^. L.info . L.viewport
|
||||
childrenVp = roundRectUnits . _wniViewport . _wnInfo <$> newNode ^. L.children
|
||||
@ -216,7 +216,7 @@ resizeOverlaySmall = describe "resizeOverlaySmall" $ do
|
||||
wenv = mockWenv () & L.windowSize .~ Size 640 480
|
||||
vp = Rect 0 0 640 480
|
||||
cvp1 = Rect 0 0 640 480
|
||||
scrollNode = scroll_ [scrollOverlay] (label "" `style` [width 300, height 200])
|
||||
scrollNode = scroll_ [scrollOverlay] (label "" `styleBasic` [width 300, height 200])
|
||||
newNode = nodeInit wenv scrollNode
|
||||
viewport = newNode ^. L.info . L.viewport
|
||||
childrenVp = roundRectUnits . _wniViewport . _wnInfo <$> newNode ^. L.children
|
||||
@ -233,7 +233,7 @@ resizeH = describe "resizeH" $ do
|
||||
wenv = mockWenv () & L.windowSize .~ Size 640 480
|
||||
vp = Rect 0 0 640 480
|
||||
cvp1 = Rect 0 0 3000 470
|
||||
scrollNode = hscroll (label "" `style` [width 3000, height 2000])
|
||||
scrollNode = hscroll (label "" `styleBasic` [width 3000, height 2000])
|
||||
newNode = nodeInit wenv scrollNode
|
||||
viewport = newNode ^. L.info . L.viewport
|
||||
childrenVp = roundRectUnits . _wniViewport . _wnInfo <$> newNode ^. L.children
|
||||
@ -250,7 +250,7 @@ resizeV = describe "resizeV" $ do
|
||||
wenv = mockWenv () & L.windowSize .~ Size 640 480
|
||||
vp = Rect 0 0 640 480
|
||||
cvp1 = Rect 0 0 630 2000
|
||||
scrollNode = vscroll (label "" `style` [width 3000, height 2000])
|
||||
scrollNode = vscroll (label "" `styleBasic` [width 3000, height 2000])
|
||||
newNode = nodeInit wenv scrollNode
|
||||
viewport = newNode ^. L.info . L.viewport
|
||||
childrenVp = roundRectUnits . _wniViewport . _wnInfo <$> newNode ^. L.children
|
||||
@ -267,7 +267,7 @@ resizeOverlayH = describe "resizeOverlayH" $ do
|
||||
wenv = mockWenv () & L.windowSize .~ Size 640 480
|
||||
vp = Rect 0 0 640 480
|
||||
cvp1 = Rect 0 0 3000 480
|
||||
scrollNode = hscroll_ [scrollOverlay] (label "" `style` [width 3000, height 2000])
|
||||
scrollNode = hscroll_ [scrollOverlay] (label "" `styleBasic` [width 3000, height 2000])
|
||||
newNode = nodeInit wenv scrollNode
|
||||
viewport = newNode ^. L.info . L.viewport
|
||||
childrenVp = roundRectUnits . _wniViewport . _wnInfo <$> newNode ^. L.children
|
||||
@ -284,7 +284,7 @@ resizeOverlayV = describe "resizeOverlayV" $ do
|
||||
wenv = mockWenv () & L.windowSize .~ Size 640 480
|
||||
vp = Rect 0 0 640 480
|
||||
cvp1 = Rect 0 0 640 2000
|
||||
scrollNode = vscroll_ [scrollOverlay] (label "" `style` [width 3000, height 2000])
|
||||
scrollNode = vscroll_ [scrollOverlay] (label "" `styleBasic` [width 3000, height 2000])
|
||||
newNode = nodeInit wenv scrollNode
|
||||
viewport = newNode ^. L.info . L.viewport
|
||||
childrenVp = roundRectUnits . _wniViewport . _wnInfo <$> newNode ^. L.children
|
||||
|
@ -91,8 +91,8 @@ handleEventMouseDragH = describe "handleEventMouseDragH" $ do
|
||||
|
||||
where
|
||||
wenv = mockWenv (TestModel 0.5)
|
||||
btn1 = button "Text" Button1 `style` [rangeWidth 200 400]
|
||||
btn2 = button "Longer" Button2 `style` [expandWidth 60]
|
||||
btn1 = button "Text" Button1 `styleBasic` [rangeWidth 200 400]
|
||||
btn2 = button "Longer" Button2 `styleBasic` [expandWidth 60]
|
||||
splitNode = hsplit_ [splitHandlePos sliderPos] (btn1, btn2)
|
||||
model es = nodeHandleEventModel wenv es splitNode
|
||||
areas es = vp where
|
||||
@ -139,8 +139,8 @@ handleEventMouseDragV = describe "handleEventMouseDragV" $ do
|
||||
where
|
||||
wenv = mockWenv (TestModel 0.5)
|
||||
-- Uses flexHeight otherwise buttons are fixed size and split will not move
|
||||
btn1 = button "Text" Button1 `style` [flexHeight 20]
|
||||
btn2 = button "Longer" Button2 `style` [rangeHeight 200 400]
|
||||
btn1 = button "Text" Button1 `styleBasic` [flexHeight 20]
|
||||
btn2 = button "Longer" Button2 `styleBasic` [rangeHeight 200 400]
|
||||
splitNode = vsplit_ [splitHandlePosV 0.5, onChange SliderChanged] (btn1, btn2)
|
||||
evts es = nodeHandleEventEvts wenv es splitNode
|
||||
areas es = vp where
|
||||
@ -163,7 +163,7 @@ getSizeReq = describe "getSizeReq" $ do
|
||||
|
||||
where
|
||||
wenv = mockWenv (TestModel 0)
|
||||
btn1 = button "Button" Button1 `style` [expandWidth 60]
|
||||
btn2 = button "Button" Button2 `style` [expandWidth 60]
|
||||
btn1 = button "Button" Button1 `styleBasic` [expandWidth 60]
|
||||
btn2 = button "Button" Button2 `styleBasic` [expandWidth 60]
|
||||
(hsizeReqW, hsizeReqH) = nodeGetSizeReq wenv (hsplit (btn1, btn2))
|
||||
(vsizeReqW, vsizeReqH) = nodeGetSizeReq wenv (vsplit (btn1, btn2))
|
||||
|
@ -130,9 +130,9 @@ resizeFlexibleH = describe "flexible items, horizontal" $ do
|
||||
cvp2 = Rect 112 0 256 640
|
||||
cvp3 = Rect 368 0 112 640
|
||||
hstackNode = hstack [
|
||||
label "Label 1" `style` [expandWidth 70],
|
||||
label "Label 2" `style` [expandWidth 160],
|
||||
label "Label 3" `style` [expandWidth 70]
|
||||
label "Label 1" `styleBasic` [expandWidth 70],
|
||||
label "Label 2" `styleBasic` [expandWidth 160],
|
||||
label "Label 3" `styleBasic` [expandWidth 70]
|
||||
]
|
||||
newNode = nodeInit wenv hstackNode
|
||||
viewport = newNode ^. L.info . L.viewport
|
||||
@ -153,9 +153,9 @@ resizeFlexibleV = describe "flexible items, vertical" $ do
|
||||
cvp2 = Rect 0 160 640 160
|
||||
cvp3 = Rect 0 320 640 160
|
||||
vstackNode = vstack [
|
||||
label "Label 1" `style` [flexHeight 20],
|
||||
label "Label Number Two" `style` [flexHeight 20],
|
||||
label "Label 3" `style` [flexHeight 20]
|
||||
label "Label 1" `styleBasic` [flexHeight 20],
|
||||
label "Label Number Two" `styleBasic` [flexHeight 20],
|
||||
label "Label 3" `styleBasic` [flexHeight 20]
|
||||
]
|
||||
newNode = nodeInit wenv vstackNode
|
||||
viewport = newNode ^. L.info . L.viewport
|
||||
@ -176,9 +176,9 @@ resizeStrictFlexH = describe "strict/flexible items, horizontal" $ do
|
||||
cvp2 = Rect 100 0 100 480
|
||||
cvp3 = Rect 200 0 440 480
|
||||
hstackNode = hstack [
|
||||
label "Label 1" `style` [width 100],
|
||||
label "Label 2" `style` [width 100],
|
||||
label "Label 3" `style` [expandWidth 70]
|
||||
label "Label 1" `styleBasic` [width 100],
|
||||
label "Label 2" `styleBasic` [width 100],
|
||||
label "Label 3" `styleBasic` [expandWidth 70]
|
||||
]
|
||||
newNode = nodeInit wenv hstackNode
|
||||
viewport = newNode ^. L.info . L.viewport
|
||||
@ -199,9 +199,9 @@ resizeStrictFlexV = describe "strict/flexible items, vertical" $ do
|
||||
cvp2 = Rect 0 100 640 20
|
||||
cvp3 = Rect 0 120 640 360
|
||||
vstackNode = vstack [
|
||||
label "Label 1" `style` [height 100],
|
||||
label "Label 1" `styleBasic` [height 100],
|
||||
label "Label 2",
|
||||
label "Label 3" `style` [flexHeight 100]
|
||||
label "Label 3" `styleBasic` [flexHeight 100]
|
||||
]
|
||||
newNode = nodeInit wenv vstackNode
|
||||
viewport = newNode ^. L.info . L.viewport
|
||||
@ -222,8 +222,8 @@ resizeMixedH = describe "mixed items, horizontal" $ do
|
||||
cvp2 = Rect 196 0 444 20
|
||||
hstackNode = vstack [
|
||||
hstack [
|
||||
label "Label 1" `style` [expandWidth 110],
|
||||
label "Label 2" `style` [expandWidth 250]
|
||||
label "Label 1" `styleBasic` [expandWidth 110],
|
||||
label "Label 2" `styleBasic` [expandWidth 250]
|
||||
]
|
||||
]
|
||||
newNode = nodeInit wenv hstackNode
|
||||
@ -248,8 +248,8 @@ resizeMixedV = describe "mixed items, vertical" $ do
|
||||
vstackNode = hstack [
|
||||
vstack [
|
||||
label "Label 1",
|
||||
label "Label 2" `style` [minHeight 250],
|
||||
label "Label 3" `style` [flexHeight 20]
|
||||
label "Label 2" `styleBasic` [minHeight 250],
|
||||
label "Label 3" `styleBasic` [flexHeight 20]
|
||||
]
|
||||
]
|
||||
newNode = nodeInit wenv vstackNode
|
||||
@ -274,11 +274,11 @@ resizeAllV = describe "all kinds of sizeReq, vertical" $ do
|
||||
cvp4 = Rect 0 300 640 80
|
||||
cvp5 = Rect 0 380 640 100
|
||||
vstackNode = vstack [
|
||||
label "Label 1" `style` [width 50, height 50],
|
||||
label "Label 2" `style` [flexWidth 60, flexHeight 60],
|
||||
label "Label 3" `style` [minWidth 70, minHeight 70],
|
||||
label "Label 4" `style` [maxWidth 80, maxHeight 80],
|
||||
label "Label 5" `style` [rangeWidth 90 100, rangeHeight 90 100]
|
||||
label "Label 1" `styleBasic` [width 50, height 50],
|
||||
label "Label 2" `styleBasic` [flexWidth 60, flexHeight 60],
|
||||
label "Label 3" `styleBasic` [minWidth 70, minHeight 70],
|
||||
label "Label 4" `styleBasic` [maxWidth 80, maxHeight 80],
|
||||
label "Label 5" `styleBasic` [rangeWidth 90 100, rangeHeight 90 100]
|
||||
]
|
||||
newNode = nodeInit wenv vstackNode
|
||||
viewport = newNode ^. L.info . L.viewport
|
||||
@ -302,11 +302,11 @@ resizeNoSpaceV = describe "vertical, without enough space" $ do
|
||||
cvp4 = Rect 0 400 640 200
|
||||
cvp5 = Rect 0 600 640 200
|
||||
vstackNode = vstack [
|
||||
label "Label 1" `style` [height 200],
|
||||
label "Label 2" `style` [height 200],
|
||||
label "Label 3" `style` [flexHeight 200],
|
||||
label "Label 4" `style` [height 200],
|
||||
label "Label 5" `style` [height 200]
|
||||
label "Label 1" `styleBasic` [height 200],
|
||||
label "Label 2" `styleBasic` [height 200],
|
||||
label "Label 3" `styleBasic` [flexHeight 200],
|
||||
label "Label 4" `styleBasic` [height 200],
|
||||
label "Label 5" `styleBasic` [height 200]
|
||||
]
|
||||
newNode = nodeInit wenv vstackNode
|
||||
viewport = newNode ^. L.info . L.viewport
|
||||
@ -327,9 +327,9 @@ resizeSpacerFlexH = describe "label flex and spacer, horizontal" $ do
|
||||
cvp2 = Rect 211 0 8 480
|
||||
cvp3 = Rect 219 0 421 480
|
||||
hstackNode = hstack [
|
||||
label "Label" `style` [flexWidth 100],
|
||||
label "Label" `styleBasic` [flexWidth 100],
|
||||
filler,
|
||||
label "Label" `style` [flexWidth 200]
|
||||
label "Label" `styleBasic` [flexWidth 200]
|
||||
]
|
||||
newNode = nodeInit wenv hstackNode
|
||||
viewport = newNode ^. L.info . L.viewport
|
||||
@ -350,9 +350,9 @@ resizeSpacerFixedH = describe "label fixed and spacer, horizontal" $ do
|
||||
cvp2 = Rect 100 0 340 480
|
||||
cvp3 = Rect 440 0 200 480
|
||||
hstackNode = hstack [
|
||||
label "Label" `style` [width 100],
|
||||
label "Label" `styleBasic` [width 100],
|
||||
filler,
|
||||
label "Label" `style` [width 200]
|
||||
label "Label" `styleBasic` [width 200]
|
||||
]
|
||||
newNode = nodeInit wenv hstackNode
|
||||
viewport = newNode ^. L.info . L.viewport
|
||||
|
@ -93,7 +93,7 @@ handleEventAllLayersActive = describe "handleEventAllLayersActive" $ do
|
||||
zstackNode = zstack_ [onlyTopActive False] [
|
||||
button "Click 1" (BtnClick 1),
|
||||
vstack [
|
||||
button "Click 2" (BtnClick 2) `style` [height 10]
|
||||
button "Click 2" (BtnClick 2) `styleBasic` [height 10]
|
||||
],
|
||||
button "Click 3" (BtnClick 3) `visible` False
|
||||
]
|
||||
@ -247,7 +247,7 @@ getSizeReqItemsFixed = describe "several items, horizontal" $ do
|
||||
vstack [
|
||||
label "Long b1",
|
||||
label "Long b2"
|
||||
] `style` [width 300]
|
||||
] `styleBasic` [width 300]
|
||||
]
|
||||
(sizeReqW, sizeReqH) = nodeGetSizeReq wenv zstackNode
|
||||
|
||||
|
@ -90,7 +90,7 @@ getSizeReq = describe "getSizeReq" $ do
|
||||
wenv = mockWenv ()
|
||||
btnNode1 = button "Click" BtnClick
|
||||
btnNode2 = button_ "Click 2" BtnClick [resizeFactorW 1, resizeFactorH 2]
|
||||
btnNode3 = button_ "Line line line" BtnClick [multiLine, trimSpaces] `style` [width 50]
|
||||
btnNode3 = button_ "Line line line" BtnClick [multiLine, trimSpaces] `styleBasic` [width 50]
|
||||
(sizeReqW1, sizeReqH1) = nodeGetSizeReq wenv btnNode1
|
||||
(sizeReqW2, sizeReqH2) = nodeGetSizeReq wenv btnNode2
|
||||
(sizeReqW3, sizeReqH3) = nodeGetSizeReq wenv btnNode3
|
||||
|
@ -74,7 +74,7 @@ getSizeReqMulti = describe "getSizeReq" $ do
|
||||
|
||||
where
|
||||
wenv = mockWenv ()
|
||||
lblNode = label_ "Line line line" [multiLine, trimSpaces] `style` [width 50]
|
||||
lblNode = label_ "Line line line" [multiLine, trimSpaces] `styleBasic` [width 50]
|
||||
(sizeReqW, sizeReqH) = nodeGetSizeReq wenv lblNode
|
||||
|
||||
getSizeReqMultiKeepSpaces :: Spec
|
||||
@ -88,7 +88,7 @@ getSizeReqMultiKeepSpaces = describe "getSizeReq" $ do
|
||||
where
|
||||
wenv = mockWenv ()
|
||||
caption = "Line line line"
|
||||
lblNode = label_ caption [multiLine, trimSpaces_ False] `style` [maxWidth 50]
|
||||
lblNode = label_ caption [multiLine, trimSpaces_ False] `styleBasic` [maxWidth 50]
|
||||
(sizeReqW, sizeReqH) = nodeGetSizeReq wenv lblNode
|
||||
|
||||
getSizeReqMultiMaxLines :: Spec
|
||||
@ -102,7 +102,7 @@ getSizeReqMultiMaxLines = describe "getSizeReq" $ do
|
||||
where
|
||||
wenv = mockWenv ()
|
||||
caption = "Line line line line line"
|
||||
lblNode = label_ caption [multiLine, trimSpaces_ False, maxLines 4] `style` [maxWidth 50]
|
||||
lblNode = label_ caption [multiLine, trimSpaces_ False, maxLines 4] `styleBasic` [maxWidth 50]
|
||||
(sizeReqW, sizeReqH) = nodeGetSizeReq wenv lblNode
|
||||
|
||||
getSizeReqMerge :: Spec
|
||||
@ -126,7 +126,7 @@ getSizeReqMerge = describe "getSizeReqMerge" $ do
|
||||
wenv = mockWenvEvtUnit ()
|
||||
& L.fontManager .~ fontMgr
|
||||
lblNode = nodeInit wenv (label "Test Label")
|
||||
lblNode2 = label "Test Label" `style` [textSize 60]
|
||||
lblNode2 = label "Test Label" `styleBasic` [textSize 60]
|
||||
lblRes = widgetMerge (lblNode2 ^. L.widget) wenv lblNode2 lblNode
|
||||
WidgetResult lblMerged _ = lblRes
|
||||
lblInfo = lblNode ^. L.info
|
||||
|
@ -356,8 +356,8 @@ handleShiftFocus = describe "handleShiftFocus" $ do
|
||||
& L.theme .~ darkTheme
|
||||
p = Point 100 30
|
||||
sliderNode = vstack [
|
||||
hslider_ sliderVal (-500) 500 [wheelRate 1] `style` [height 20],
|
||||
hslider_ sliderVal (-500) 500 [wheelRate 1, onFocus GotFocus] `style` [height 20]
|
||||
hslider_ sliderVal (-500) 500 [wheelRate 1] `styleBasic` [height 20],
|
||||
hslider_ sliderVal (-500) 500 [wheelRate 1, onFocus GotFocus] `styleBasic` [height 20]
|
||||
]
|
||||
evts es = nodeHandleEventEvts wenv es sliderNode
|
||||
|
||||
|
@ -268,7 +268,7 @@ handleEventMouseSelect = describe "handleEventMouseSelect" $ do
|
||||
wenv = mockWenvEvtUnit (TestModel "")
|
||||
txtNode = vstack [
|
||||
hstack [
|
||||
textArea textValue `style` [height 50]
|
||||
textArea textValue `styleBasic` [height 50]
|
||||
]
|
||||
]
|
||||
model es = nodeHandleEventModel wenv es txtNode
|
||||
|
@ -212,7 +212,7 @@ handleEventMouseSelect = describe "handleEventMouseSelect" $ do
|
||||
wenv = mockWenvEvtUnit (TestModel "")
|
||||
txtNode = vstack [
|
||||
hstack [
|
||||
textField textValue `style` [width 105],
|
||||
textField textValue `styleBasic` [width 105],
|
||||
hstack []
|
||||
]
|
||||
]
|
||||
|
Loading…
Reference in New Issue
Block a user