never executed always true always false
    1 {-|
    2 Module: Flaw.UI.Metrics
    3 Description: Style and look-n-feel information.
    4 License: MIT
    5 -}
    6 
    7 module Flaw.UI.Metrics
    8   ( Metric
    9   , Position
   10   , Size
   11   , Rect
   12   , Metrics(..)
   13   , HasPreferredSize(..)
   14   ) where
   15 
   16 import Flaw.Math
   17 
   18 -- | Base type for length values.
   19 type Metric = Int
   20 -- | Base type for two-dimensional position values.
   21 type Position = Vec2 Metric
   22 -- | Base type for two-dimensional length values.
   23 type Size = Vec2 Metric
   24 -- | Base type for rectangle (left, top, right, bottom).
   25 type Rect = Vec4 Metric
   26 
   27 -- | Set of "standard" metrics for UI.
   28 data Metrics = Metrics
   29   {
   30   -- | Normal gap between elements.
   31     metricsGap :: {-# UNPACK #-} !Metric
   32   -- | Big gap between elements.
   33   , metricsBigGap :: {-# UNPACK #-} !Metric
   34   -- | Frame client rect.
   35   , metricsFrameClient :: {-# UNPACK #-} !Rect
   36   -- | Frame top border height.
   37   , metricsFrameTopBorder :: {-# UNPACK #-} !Metric
   38   -- | Typical width of "main" control in a dialog.
   39   , metricsMainWidth :: {-# UNPACK #-} !Metric
   40   -- | Size of button.
   41   , metricsButtonSize :: {-# UNPACK #-} !Size
   42   -- | Height of edit box.
   43   , metricsEditBoxHeight :: {-# UNPACK #-} !Metric
   44   -- | Size of label.
   45   , metricsLabelSize :: {-# UNPACK #-} !Size
   46   -- | Height of title.
   47   , metricsTitleHeight :: {-# UNPACK #-} !Metric
   48   -- | Width of the slider piece.
   49   , metricsSliderPieceWidth :: {-# UNPACK #-} !Metric
   50   -- | Height of the slider.
   51   , metricsSliderHeight :: {-# UNPACK #-} !Metric
   52   -- | Width of resizing grip in pile box.
   53   , metricsPileBoxGripWidth :: {-# UNPACK #-} !Metric
   54   -- | Height of listbox column header.
   55   , metricsListBoxColumnHeaderHeight :: {-# UNPACK #-} !Metric
   56   -- | Height of listbox item.
   57   , metricsListBoxItemHeight :: {-# UNPACK #-} !Metric
   58   -- | Width of scroll bar.
   59   , metricsScrollBarWidth :: {-# UNPACK #-} !Metric
   60   }
   61 
   62 -- | Class of something which has preferred size in metrics.
   63 class HasPreferredSize a where
   64   preferredSize :: Metrics -> a -> Size