| Safe Haskell | None |
|---|---|
| Language | Haskell2010 |
Graphics.UI.FLTK.Theme.Light.Common
Contents
Synopsis
- configureTheme :: IO Assets
- commonColor :: IO Color
- commonDarkGreyColor :: IO Color
- commonFillColor :: IO Color
- commonFont :: (?assets :: Assets) => Font
- commonFontSize :: FontSize
- commonLargeFontSize :: FontSize
- commonSelectionColor :: IO Color
- lightBackground :: Color
- angleToCoordinate :: PreciseAngle -> PrecisePosition
- centerInRectangle :: Rectangle -> Size -> Position
- centerInRectangleByRelativePosition :: Rectangle -> X -> Y -> Rectangle
- degreesPerRadian :: Double
- fromFltkAngle :: PreciseAngle -> PreciseAngle
- insideRectangle :: Position -> Rectangle -> Bool
- intDiv :: Int -> Int -> Int
- isWidget :: Parent a Widget => Ref a -> IO (Maybe (Ref b)) -> IO Bool
- percentOf :: Double -> Int -> Int
- percentOfSmallerEllipseRadius :: Double -> PreciseSize -> Double
- positionInside :: Rectangle -> Size -> X -> Y -> Rectangle
- splitVertically :: Rectangle -> Double -> (Rectangle, Rectangle)
- splitVerticallyByPixels :: Rectangle -> Int -> (Rectangle, Rectangle)
- splitHorizontally :: Rectangle -> Double -> (Rectangle, Rectangle)
- splitHorizontallyByPixels :: Rectangle -> Int -> (Rectangle, Rectangle)
- withPositionX :: Position -> (X -> X) -> Position
- withPositionY :: Position -> (Y -> Y) -> Position
- withSizeHeight :: Size -> (Height -> Height) -> Size
- withSizeWidth :: Size -> (Width -> Width) -> Size
- withCustomBoxDraw :: Boxtype -> BoxDrawF -> IO () -> IO ()
- data BorderBoxSpec = BorderBoxSpec {}
- drawBorderBox :: Parent a Widget => Ref a -> BorderBoxSpec -> Bool -> IO ()
- data FillSpec = FillSpec {}
- makeFillSpec :: Rectangle -> Color -> Color -> IO FillSpec
- borderRectangle :: FillSpec -> Bool -> Bool -> IO ()
- fillRectangle :: FillSpec -> Bool -> IO ()
- handleHover :: (Parent orig Widget, Match x ~ FindOp orig orig (Redraw ()), Op (Redraw ()) x orig (IO ()), Match y ~ FindOp orig orig (HandleSuper ()), Op (HandleSuper ()) y orig (Event -> IO (Either UnknownEvent ()))) => Ref orig -> Event -> IO (Either UnknownEvent ())
- data OpenBorder
- roundedBoxPoints :: Rectangle -> Maybe Int -> Maybe OpenBorder -> [Position]
Theme Loading
configureTheme :: IO Assets Source #
Needs to be called by every app to load the themes's resources and do some minor setup See Graphics.UI.FLTK.Theme.Light for more information.
Common Colors & Fonts
commonColor :: IO Color Source #
commonFont :: (?assets :: Assets) => Font Source #
Common Calculations For Drawing Widgets
angleToCoordinate :: PreciseAngle -> PrecisePosition Source #
Given a PreciseAngle in degrees return the corresponding location on the unit circle
degreesPerRadian :: Double Source #
pi/180
fromFltkAngle :: PreciseAngle -> PreciseAngle Source #
Converts from an FLTK angle to a unit circle's. FLTK starts its angles counter-clockwise from 270 so, for example, 45 degrees in FLTK is 270-45 = 225 degrees on a unit circle. Angle unit is in degrees.
intDiv :: Int -> Int -> Int Source #
A lossy division of 'Int'/'Int'. The result is truncated but it's good
enough for widget dimensions which is the primary use-case.
isWidget :: Parent a Widget => Ref a -> IO (Maybe (Ref b)) -> IO Bool Source #
Check if the given references point to the same Widget.
percentOfSmallerEllipseRadius :: Double -> PreciseSize -> Double Source #
Given the width and height of an ellipse via PreciseSize, return
the Double % of the smaller radius. % must be between 0.0 and 1.0.
Used in Dials and Clocks to measure the length of hands.
splitVerticallyByPixels :: Rectangle -> Int -> (Rectangle, Rectangle) Source #
Like splitVertically but takes a Int pixel width instead of a %. If the
width is greater than the Rectangle the first of the pair will be the
Rectangle passed in and the second will have the same dimensions but a 0
width.
splitHorizontallyByPixels :: Rectangle -> Int -> (Rectangle, Rectangle) Source #
Like splitHorizontally but takes a Int pixel height instead of a %. If the
height is greater than the Rectangle the first of the pair will be the
Rectangle passed in and the second will have the same dimensions but a 0
height.
Common Widget Drawing Helpers
withCustomBoxDraw :: Boxtype -> BoxDrawF -> IO () -> IO () Source #
Temporarily swap out the FLTK's box drawing function for a given Boxtype
with BoxDrawF. The IO '()' action will typically use the custom function
that was just swapped in some kind custom drawing routine. For example, if a
custom widget used a BorderBox on the FLTK side but you don't like the
default BorderBox look, you can override the draw function of the widget
with this one where the IO '()' action calls drawSuper. For an example
use-case see inputDraw.
NOTE: The IO '()' action is not exception safe.
data BorderBoxSpec Source #
Specifies how to draw a border around a Rectangle.
Constructors
| BorderBoxSpec | |
Fields
| |
Instances
| Show BorderBoxSpec Source # | |
Defined in Graphics.UI.FLTK.Theme.Light.Common Methods showsPrec :: Int -> BorderBoxSpec -> ShowS # show :: BorderBoxSpec -> String # showList :: [BorderBoxSpec] -> ShowS # | |
drawBorderBox :: Parent a Widget => Ref a -> BorderBoxSpec -> Bool -> IO () Source #
Draw a bordered rectangle for the given widget according to BorderBoxSpec, the Bool
determines if it should be filled with borderBoxFillColor.
Specifies how a Rectangle should be filled. Allows for a vertical color gradient.
Constructors
| FillSpec | |
Fields
| |
fillRectangle :: FillSpec -> Bool -> IO () Source #
Draw a box according to the FillSpec. It was originally intended for custom Graphics.UI.FLTK.Theme.Light.Button
which is why it takes a Bool specifies if the button is pressed but is used widely in the theme for any rounded
rectangular area.
handleHover :: (Parent orig Widget, Match x ~ FindOp orig orig (Redraw ()), Op (Redraw ()) x orig (IO ()), Match y ~ FindOp orig orig (HandleSuper ()), Op (HandleSuper ()) y orig (Event -> IO (Either UnknownEvent ()))) => Ref orig -> Event -> IO (Either UnknownEvent ()) Source #
The default FLTK widgets don't react to a mouse pointer hovering over them.
This handler when applied to a customized widget initiates a redraw when the
mouse enters and leaves the widget area.
data OpenBorder Source #
For drawing a rectangular widget that is borderless on the top or bottom. Guess it could be passed into a function as yet another Bool but we have too many of those as it is.
Constructors
| OpenBorderTop | Signifies a bordered rectangle with the top side. Useful, for example, for a bottom tab |
| OpenBorderBottom | Signifies a bordered rectangle without a bottom side. Useful, for example, for a top tab |
roundedBoxPoints :: Rectangle -> Maybe Int -> Maybe OpenBorder -> [Position] Source #
Return a set of vertices that circumscribe a region bounded by Rectangle.
The Maybe Int when provided means the rectangle has rounded corners of
Int radius. In a rounded rectangle the vertices don't meet stopping short
of the corners, the client is responsible for filling in the arcs.
Maybe OpenBorder determines whether the rectangle is whole (if not
provided) or has an open top or bottom.