{-# LANGUAGE PatternSynonyms #-}
{-# LANGUAGE ImplicitParams, ConstraintKinds, KindSignatures #-}
{-# OPTIONS_GHC -fno-warn-unused-imports #-}
module JSDOM.Generated.SVGLength
(newValueSpecifiedUnits, convertToSpecifiedUnits,
pattern SVG_LENGTHTYPE_UNKNOWN, pattern SVG_LENGTHTYPE_NUMBER,
pattern SVG_LENGTHTYPE_PERCENTAGE, pattern SVG_LENGTHTYPE_EMS,
pattern SVG_LENGTHTYPE_EXS, pattern SVG_LENGTHTYPE_PX,
pattern SVG_LENGTHTYPE_CM, pattern SVG_LENGTHTYPE_MM,
pattern SVG_LENGTHTYPE_IN, pattern SVG_LENGTHTYPE_PT,
pattern SVG_LENGTHTYPE_PC, getUnitType, setValue, getValue,
setValueInSpecifiedUnits, getValueInSpecifiedUnits,
setValueAsString, getValueAsString, SVGLength(..), gTypeSVGLength)
where
import Prelude ((.), (==), (>>=), return, IO, Int, Float, Double, Bool(..), Maybe, maybe, fromIntegral, round, realToFrac, fmap, Show, Read, Eq, Ord, Maybe(..))
import qualified Prelude (error)
import Data.Typeable (Typeable)
import Data.Traversable (mapM)
import Language.Javascript.JSaddle (JSM(..), JSVal(..), JSString, strictEqual, toJSVal, valToStr, valToNumber, valToBool, js, jss, jsf, jsg, function, asyncFunction, new, array, jsUndefined, (!), (!!))
import Data.Int (Int64)
import Data.Word (Word, Word64)
import JSDOM.Types
import Control.Applicative ((<$>))
import Control.Monad (void)
import Control.Lens.Operators ((^.))
import JSDOM.EventTargetClosures (EventName, unsafeEventName, unsafeEventNameAsync)
import JSDOM.Enums
newValueSpecifiedUnits ::
(MonadDOM m) => SVGLength -> Word -> Float -> m ()
newValueSpecifiedUnits self unitType valueInSpecifiedUnits
= liftDOM
(void
(self ^. jsf "newValueSpecifiedUnits"
[toJSVal unitType, toJSVal valueInSpecifiedUnits]))
convertToSpecifiedUnits ::
(MonadDOM m) => SVGLength -> Word -> m ()
convertToSpecifiedUnits self unitType
= liftDOM
(void (self ^. jsf "convertToSpecifiedUnits" [toJSVal unitType]))
pattern SVG_LENGTHTYPE_UNKNOWN = 0
pattern SVG_LENGTHTYPE_NUMBER = 1
pattern SVG_LENGTHTYPE_PERCENTAGE = 2
pattern SVG_LENGTHTYPE_EMS = 3
pattern SVG_LENGTHTYPE_EXS = 4
pattern SVG_LENGTHTYPE_PX = 5
pattern SVG_LENGTHTYPE_CM = 6
pattern SVG_LENGTHTYPE_MM = 7
pattern SVG_LENGTHTYPE_IN = 8
pattern SVG_LENGTHTYPE_PT = 9
pattern SVG_LENGTHTYPE_PC = 10
getUnitType :: (MonadDOM m) => SVGLength -> m Word
getUnitType self
= liftDOM (round <$> ((self ^. js "unitType") >>= valToNumber))
setValue :: (MonadDOM m) => SVGLength -> Float -> m ()
setValue self val = liftDOM (self ^. jss "value" (toJSVal val))
getValue :: (MonadDOM m) => SVGLength -> m Float
getValue self
= liftDOM (realToFrac <$> ((self ^. js "value") >>= valToNumber))
setValueInSpecifiedUnits ::
(MonadDOM m) => SVGLength -> Float -> m ()
setValueInSpecifiedUnits self val
= liftDOM (self ^. jss "valueInSpecifiedUnits" (toJSVal val))
getValueInSpecifiedUnits :: (MonadDOM m) => SVGLength -> m Float
getValueInSpecifiedUnits self
= liftDOM
(realToFrac <$>
((self ^. js "valueInSpecifiedUnits") >>= valToNumber))
setValueAsString ::
(MonadDOM m, ToJSString val) => SVGLength -> val -> m ()
setValueAsString self val
= liftDOM (self ^. jss "valueAsString" (toJSVal val))
getValueAsString ::
(MonadDOM m, FromJSString result) => SVGLength -> m result
getValueAsString self
= liftDOM ((self ^. js "valueAsString") >>= fromJSValUnchecked)