on master help sign in
Get Input library in shape to compile
commitd6acea8b51be1d1ff4a38d477ea60508e882c1cb authorEvan Czaplicki <info@elm-lang.org> dateSat 27 Jul 2013, 12:37 (13 years ago) parentda346ea
1 file changed+8−1
libraries/Graphics/Input.elm+8−1
libraries/Graphics/Input.elm+8−1
@@ -2,8 +2,9 @@
22module Graphics.Input where
33
44import Signal (lift,dropRepeats)
5−import Native.Graphics.Input as N
5+import Native.Graphics.Input as Native
66import List
7+import Graphics.Element (Element)
78
89id x = x
910
@@ -17,6 +18,7 @@ id x = x
1718-- The `a` value is sent to `events` whenever the button is pressed.
1819buttons : a -> { events : Signal a,
1920 button : a -> String -> Element }
21+buttons = Native.buttons
2022
2123-- Create a button with a given label. The result is an `Element` and
2224-- a signal of units. This signal triggers whenever the button is pressed.
@@ -36,6 +38,7 @@ button txt =
3638-- The `a` value is sent to `events` whenever the button is pressed.
3739customButtons : a -> { events : Signal a,
3840 customButton : a -> Element -> Element -> Element -> Element }
41+customButtons = Native.customButtons
3942
4043-- Create a button with custom states for up, hovering, and down
4144-- (given in that order). The result is an `Element` and
@@ -57,6 +60,7 @@ customButton up hover down =
5760-- lets you add an ID to distinguish between checkboxes.
5861checkboxes : a -> { events : Signal a,
5962 checkbox : (Bool -> a) -> Bool -> Element }
63+checkboxes = Native.checkboxes
6064
6165-- Create a checkbox with a given start state. Unlike `button`, this result
6266-- is a *signal* of elements. That is because a checkbox has state that
@@ -69,6 +73,7 @@ checkbox b =
6973
7074hoverables : a -> { events : Signal a,
7175 hoverable : (Bool -> a) -> Element -> Element }
76+hoverables = Native.hoverables
7277
7378hoverable : Element -> (Element, Signal Bool)
7479hoverable elem =
@@ -98,6 +103,7 @@ type FieldState = { string:String, selectionStart:Int, selectionEnd:Int }
98103-- lets you add an ID to distinguish between input fields.
99104fields : a -> { events : Signal a,
100105 field : (FieldState -> a) -> String -> FieldState -> Element }
106+fields = Native.fields
101107
102108-- The empty field state:
103109--
@@ -138,6 +144,7 @@ email placeHolder =
138144-- value. This lets you avoid manually mapping the string onto
139145-- functions and values.
140146dropDown : [(String,a)] -> (Signal Element, Signal a)
147+dropDown = Native.dropDown
141148
142149-- Create a drop-down menu for selecting strings. The resulting
143150-- signal of strings represents the string that is currently selected.