2020-08-07 22:41:08 +00:00
|
|
|
{-# LANGUAGE NamedFieldPuns #-}
|
|
|
|
|
2020-08-04 06:15:06 +00:00
|
|
|
module MetaBrush.Asset.WindowIcons
|
|
|
|
( drawMinimise, drawRestoreDown, drawMaximise, drawClose )
|
|
|
|
where
|
|
|
|
|
|
|
|
-- gi-cairo-render
|
|
|
|
import qualified GI.Cairo.Render as Cairo
|
|
|
|
|
|
|
|
-- MetaBrush
|
2020-08-07 22:41:08 +00:00
|
|
|
import MetaBrush.Asset.Colours
|
|
|
|
( ColourRecord(..), Colours )
|
2020-09-01 19:56:59 +00:00
|
|
|
import MetaBrush.Util
|
2020-08-07 19:39:24 +00:00
|
|
|
( withRGBA )
|
2020-08-04 06:15:06 +00:00
|
|
|
|
|
|
|
--------------------------------------------------------------------------------
|
|
|
|
|
2020-08-07 19:39:24 +00:00
|
|
|
-- | Minimise window icon.
|
2020-08-07 22:41:08 +00:00
|
|
|
drawMinimise :: Colours -> Cairo.Render Bool
|
|
|
|
drawMinimise ( Colours { plain } ) = do
|
2020-08-07 19:39:24 +00:00
|
|
|
|
2020-08-07 22:41:08 +00:00
|
|
|
withRGBA plain Cairo.setSourceRGBA
|
2020-08-07 19:39:24 +00:00
|
|
|
|
|
|
|
Cairo.newPath
|
2020-09-07 13:37:55 +00:00
|
|
|
Cairo.moveTo 6 13
|
|
|
|
Cairo.lineTo 6 17
|
|
|
|
Cairo.lineTo 18 17
|
|
|
|
Cairo.lineTo 18 13
|
2020-08-07 19:39:24 +00:00
|
|
|
Cairo.closePath
|
|
|
|
Cairo.fillPreserve
|
|
|
|
|
|
|
|
pure True
|
2020-08-04 06:15:06 +00:00
|
|
|
|
|
|
|
-- | Restore down window icon.
|
2020-08-07 22:41:08 +00:00
|
|
|
drawRestoreDown :: Colours -> Cairo.Render Bool
|
|
|
|
drawRestoreDown ( Colours { plain } ) = do
|
2020-08-07 19:39:24 +00:00
|
|
|
|
2020-08-07 22:41:08 +00:00
|
|
|
withRGBA plain Cairo.setSourceRGBA
|
2020-08-07 19:39:24 +00:00
|
|
|
|
|
|
|
Cairo.newPath
|
2020-09-07 13:37:55 +00:00
|
|
|
Cairo.moveTo 8 4
|
|
|
|
Cairo.lineTo 8 9
|
|
|
|
Cairo.lineTo 4 9
|
|
|
|
Cairo.lineTo 4 19
|
|
|
|
Cairo.lineTo 15 19
|
|
|
|
Cairo.lineTo 15 14
|
|
|
|
Cairo.lineTo 19 14
|
|
|
|
Cairo.lineTo 19 4
|
2020-08-07 19:39:24 +00:00
|
|
|
Cairo.closePath
|
2020-09-07 13:37:55 +00:00
|
|
|
Cairo.moveTo 9 7
|
|
|
|
Cairo.lineTo 18 7
|
|
|
|
Cairo.lineTo 18 13
|
|
|
|
Cairo.lineTo 15 13
|
|
|
|
Cairo.lineTo 15 9
|
|
|
|
Cairo.lineTo 9 9
|
2020-08-07 19:39:24 +00:00
|
|
|
Cairo.closePath
|
2020-09-07 13:37:55 +00:00
|
|
|
Cairo.moveTo 5 12
|
|
|
|
Cairo.lineTo 14 12
|
|
|
|
Cairo.lineTo 14 18
|
|
|
|
Cairo.lineTo 5 18
|
2020-08-07 19:39:24 +00:00
|
|
|
Cairo.closePath
|
|
|
|
Cairo.fillPreserve
|
|
|
|
|
|
|
|
pure True
|
2020-08-04 06:15:06 +00:00
|
|
|
|
|
|
|
-- | Maximise window icon.
|
2020-08-07 22:41:08 +00:00
|
|
|
drawMaximise :: Colours -> Cairo.Render Bool
|
|
|
|
drawMaximise ( Colours { plain } ) = do
|
2020-08-07 19:39:24 +00:00
|
|
|
|
2020-08-07 22:41:08 +00:00
|
|
|
withRGBA plain Cairo.setSourceRGBA
|
2020-08-07 19:39:24 +00:00
|
|
|
|
|
|
|
Cairo.newPath
|
2020-09-07 13:37:55 +00:00
|
|
|
Cairo.moveTo 6 5
|
|
|
|
Cairo.lineTo 6 18
|
|
|
|
Cairo.lineTo 19 18
|
|
|
|
Cairo.lineTo 19 5
|
2020-08-07 19:39:24 +00:00
|
|
|
Cairo.closePath
|
2020-09-07 13:37:55 +00:00
|
|
|
Cairo.moveTo 7 9
|
|
|
|
Cairo.lineTo 18 9
|
|
|
|
Cairo.lineTo 18 17
|
|
|
|
Cairo.lineTo 7 17
|
2020-08-07 19:39:24 +00:00
|
|
|
Cairo.closePath
|
|
|
|
Cairo.fillPreserve
|
|
|
|
|
|
|
|
pure True
|
2020-08-04 06:15:06 +00:00
|
|
|
|
|
|
|
-- | Close window icon.
|
2020-08-07 22:41:08 +00:00
|
|
|
drawClose :: Colours -> Cairo.Render Bool
|
|
|
|
drawClose ( Colours { plain } ) = do
|
2020-08-07 19:39:24 +00:00
|
|
|
|
|
|
|
Cairo.setLineWidth 2
|
2020-08-07 22:41:08 +00:00
|
|
|
withRGBA plain Cairo.setSourceRGBA
|
2020-08-07 19:39:24 +00:00
|
|
|
|
2020-09-07 13:37:55 +00:00
|
|
|
Cairo.setLineCap Cairo.LineCapSquare
|
2020-08-07 19:39:24 +00:00
|
|
|
Cairo.setLineJoin Cairo.LineJoinMiter
|
|
|
|
|
|
|
|
Cairo.newPath
|
2020-09-07 13:37:55 +00:00
|
|
|
Cairo.moveTo 6.5 6.5
|
|
|
|
Cairo.lineTo 17.5 17.5
|
2020-08-07 19:39:24 +00:00
|
|
|
Cairo.strokePreserve
|
|
|
|
|
|
|
|
Cairo.newPath
|
2020-09-07 13:37:55 +00:00
|
|
|
Cairo.moveTo 6.5 17.5
|
|
|
|
Cairo.lineTo 17.5 6.5
|
2020-08-07 19:39:24 +00:00
|
|
|
Cairo.strokePreserve
|
|
|
|
|
|
|
|
pure True
|