Commit abf2a721 authored by David Davó's avatar David Davó

Added DesciptionStyle

parent 45fcace9
......@@ -106,6 +106,8 @@ library
IHaskell.Display.Widgets.String.Password
IHaskell.Display.Widgets.String.Text
IHaskell.Display.Widgets.String.TextArea
IHaskell.Display.Widgets.Style.ButtonStyle
IHaskell.Display.Widgets.Style.DescriptionStyle
IHaskell.Display.Widgets.Layout.Common
IHaskell.Display.Widgets.Layout.LayoutWidget
......
......@@ -55,6 +55,9 @@ import IHaskell.Display.Widgets.String.Password as X
import IHaskell.Display.Widgets.String.Text as X
import IHaskell.Display.Widgets.String.TextArea as X
import IHaskell.Display.Widgets.Style.ButtonStyle as X
import IHaskell.Display.Widgets.Style.DescriptionStyle as X
import IHaskell.Display.Widgets.Common as X
import IHaskell.Display.Widgets.Types as X (setField, getField, properties, triggerDisplay,
triggerChange, triggerClick, triggerSelection,
......
......@@ -27,6 +27,7 @@ import IHaskell.IPython.Message.UUID as U
import IHaskell.Display.Widgets.Types
import IHaskell.Display.Widgets.Common
import IHaskell.Display.Widgets.Layout.LayoutWidget
import IHaskell.Display.Widgets.Style.DescriptionStyle
-- | A 'CheckBox' represents a Checkbox widget from IPython.html.widgets.
type CheckBox = IPythonWidget 'CheckBoxType
......@@ -37,8 +38,9 @@ mkCheckBox = do
-- Default properties, with a random uuid
wid <- U.random
layout <- mkLayout
dstyle <- mkDescriptionStyle
let boolAttrs = defaultBoolWidget "CheckboxView" "CheckboxModel" layout
let boolAttrs = defaultBoolWidget "CheckboxView" "CheckboxModel" layout dstyle
checkBoxAttrs = (Indent =:: True)
:& RNil
widgetState = WidgetState $ boolAttrs <+> checkBoxAttrs
......
......@@ -27,6 +27,7 @@ import IHaskell.IPython.Message.UUID as U
import IHaskell.Display.Widgets.Types
import IHaskell.Display.Widgets.Common
import IHaskell.Display.Widgets.Layout.LayoutWidget
import IHaskell.Display.Widgets.Style.DescriptionStyle
-- | A 'ToggleButton' represents a ToggleButton widget from IPython.html.widgets.
type ToggleButton = IPythonWidget 'ToggleButtonType
......@@ -37,8 +38,9 @@ mkToggleButton = do
-- Default properties, with a random uuid
wid <- U.random
layout <- mkLayout
dstyle <- mkDescriptionStyle
let boolState = defaultBoolWidget "ToggleButtonView" "ToggleButtonModel" layout
let boolState = defaultBoolWidget "ToggleButtonView" "ToggleButtonModel" layout dstyle
toggleState = (Icon =:: "")
:& (ButtonStyle =:: DefaultButton)
:& RNil
......
......@@ -26,6 +26,7 @@ import IHaskell.IPython.Message.UUID as U
import IHaskell.Display.Widgets.Types
import IHaskell.Display.Widgets.Common
import IHaskell.Display.Widgets.Layout.LayoutWidget
import IHaskell.Display.Widgets.Style.DescriptionStyle
-- | A 'ValidWidget' represents a Valid widget from IPython.html.widgets.
type ValidWidget = IPythonWidget 'ValidType
......@@ -36,8 +37,9 @@ mkValidWidget = do
-- Default properties, with a random uuid
wid <- U.random
layout <- mkLayout
dstyle <- mkDescriptionStyle
let boolState = defaultBoolWidget "ValidView" "ValidModel" layout
let boolState = defaultBoolWidget "ValidView" "ValidModel" layout dstyle
validState = (ReadOutMsg =:: "") :& RNil
widgetState = WidgetState $ boolState <+> validState
......
......@@ -10,10 +10,6 @@ module IHaskell.Display.Widgets.Button
Button
-- * Create a new button
, mkButton
-- * Button style
, ButtonStyle
-- * Create a new button style
, mkButtonStyle
) where
-- To keep `cabal repl` happy when running from the ihaskell repo
......@@ -29,34 +25,9 @@ import IHaskell.IPython.Message.UUID as U
import IHaskell.Display.Widgets.Types
import IHaskell.Display.Widgets.Common
import IHaskell.Display.Widgets.Style.ButtonStyle
import IHaskell.Display.Widgets.Layout.LayoutWidget
-- | A 'ButtonStyle' represents a Button Style from IPython.html.widgets.
type ButtonStyle = IPythonWidget 'ButtonStyleType
-- | Create a new button style
mkButtonStyle :: IO ButtonStyle
mkButtonStyle = do
wid <- U.random
let stl = defaultStyleWidget "ButtonStyleModel"
but = (ButtonColor =:: Nothing)
:& (FontWeight =:: DefaultWeight)
:& RNil
btnStlState = WidgetState (stl <+> but)
stateIO <- newIORef btnStlState
let style = IPythonWidget wid stateIO
-- Open a comm for this widget, and store it in the kernel state
widgetSendOpen style $ toJSON btnStlState
-- Return the style widget
return style
instance IHaskellWidget ButtonStyle where
getCommUUID = uuid
import IHaskell.Display.Widgets.Style.DescriptionStyle
-- | A 'Button' represents a Button from IPython.html.widgets.
type Button = IPythonWidget 'ButtonType
......@@ -67,14 +38,14 @@ mkButton = do
-- Default properties, with a random uuid
wid <- U.random
layout <- mkLayout
dstyle <- mkDescriptionStyle
btnstyle <- mkButtonStyle
style <- mkButtonStyle
let ddw = defaultDescriptionWidget "ButtonView" "ButtonModel" layout
let ddw = defaultDescriptionWidget "ButtonView" "ButtonModel" layout dstyle
but = (Disabled =:: False)
:& (Icon =:: "")
:& (ButtonStyle =:: DefaultButton)
:& (StyleButton =:: style)
:& (StyleButton =:: btnstyle)
:& (ClickHandler =:: return ())
:& RNil
buttonState = WidgetState (ddw <+> but)
......
......@@ -26,6 +26,7 @@ import IHaskell.IPython.Message.UUID as U
import IHaskell.Display.Widgets.Types
import IHaskell.Display.Widgets.Common
import IHaskell.Display.Widgets.Layout.LayoutWidget
import IHaskell.Display.Widgets.Style.DescriptionStyle
-- | A 'ColorPicker' represents a ColorPicker from IPython.html.widgets.
type ColorPicker = IPythonWidget 'ColorPickerType
......@@ -36,8 +37,9 @@ mkColorPicker = do
-- Default properties, with a random uuid
wid <- U.random
layout <- mkLayout
dstyle <- mkDescriptionStyle
let ddw = defaultDescriptionWidget "ColorPickerView" "ColorPickerModel" layout
let ddw = defaultDescriptionWidget "ColorPickerView" "ColorPickerModel" layout dstyle
color = (StringValue =:: "black")
:& (Concise =:: False)
:& (Disabled =:: False)
......
......@@ -110,6 +110,7 @@ pattern Buttons = S.SButtons
pattern Axes = S.SAxes
pattern ButtonColor = S.SButtonColor
pattern FontWeight = S.SFontWeight
pattern DescriptionWidth = S.SDescriptionWidth
pattern StyleButton = S.SStyleButton
pattern StyleDescription = S.SStyleDescription
......
......@@ -28,6 +28,7 @@ import IHaskell.IPython.Message.UUID as U
import IHaskell.Display.Widgets.Types
import IHaskell.Display.Widgets.Common
import IHaskell.Display.Widgets.Layout.LayoutWidget
import IHaskell.Display.Widgets.Style.DescriptionStyle
-- | A 'DatePicker' represents a DatePicker from IPython.html.widgets.
type DatePicker = IPythonWidget 'DatePickerType
......@@ -38,8 +39,9 @@ mkDatePicker = do
-- Default properties, with a random uuid
wid <- U.random
layout <- mkLayout
dstyle <- mkDescriptionStyle
let ddw = defaultDescriptionWidget "DatePickerView" "DatePickerModel" layout
let ddw = defaultDescriptionWidget "DatePickerView" "DatePickerModel" layout dstyle
date = (DateValue =:: defaultDate)
:& (Disabled =:: False)
:& RNil
......
......@@ -28,6 +28,7 @@ import IHaskell.IPython.Message.UUID as U
import IHaskell.Display.Widgets.Types
import IHaskell.Display.Widgets.Common
import IHaskell.Display.Widgets.Layout.LayoutWidget
import IHaskell.Display.Widgets.Style.DescriptionStyle
-- | 'BoundedFloatText' represents an BoundedFloatText widget from IPython.html.widgets.
type BoundedFloatText = IPythonWidget 'BoundedFloatTextType
......@@ -38,8 +39,9 @@ mkBoundedFloatText = do
-- Default properties, with a random uuid
wid <- U.random
layout <- mkLayout
dstyle <- mkDescriptionStyle
let boundedFloatAttrs = defaultBoundedFloatWidget "FloatTextView" "BoundedFloatTextModel" layout
let boundedFloatAttrs = defaultBoundedFloatWidget "FloatTextView" "BoundedFloatTextModel" layout dstyle
textAttrs = (Disabled =:: False)
:& (ContinuousUpdate =:: False)
:& (StepFloat =:: Nothing)
......
......@@ -28,6 +28,7 @@ import IHaskell.IPython.Message.UUID as U
import IHaskell.Display.Widgets.Types
import IHaskell.Display.Widgets.Common
import IHaskell.Display.Widgets.Layout.LayoutWidget
import IHaskell.Display.Widgets.Style.DescriptionStyle
-- | 'FloatLogSlider' represents an FloatLogSlider widget from IPython.html.widgets.
type FloatLogSlider = IPythonWidget 'FloatLogSliderType
......@@ -38,8 +39,9 @@ mkFloatLogSlider = do
-- Default properties, with a random uuid
wid <- U.random
layout <- mkLayout
dstyle <- mkDescriptionStyle
let boundedLogFloatAttrs = defaultBoundedLogFloatWidget "FloatLogSliderView" "FloatLogSliderModel" layout
let boundedLogFloatAttrs = defaultBoundedLogFloatWidget "FloatLogSliderView" "FloatLogSliderModel" layout dstyle
sliderAttrs = (StepFloat =:: Just 0.1)
:& (Orientation =:: HorizontalOrientation)
:& (ReadOut =:: True)
......
......@@ -26,6 +26,7 @@ import IHaskell.IPython.Message.UUID as U
import IHaskell.Display.Widgets.Types
import IHaskell.Display.Widgets.Common
import IHaskell.Display.Widgets.Layout.LayoutWidget
import IHaskell.Display.Widgets.Style.DescriptionStyle
-- | 'FloatProgress' represents an FloatProgress widget from IPython.html.widgets.
type FloatProgress = IPythonWidget 'FloatProgressType
......@@ -36,8 +37,9 @@ mkFloatProgress = do
-- Default properties, with a random uuid
wid <- U.random
layout <- mkLayout
dstyle <- mkDescriptionStyle
let boundedFloatAttrs = defaultBoundedFloatWidget "ProgressView" "FloatProgressModel" layout
let boundedFloatAttrs = defaultBoundedFloatWidget "ProgressView" "FloatProgressModel" layout dstyle
progressAttrs = (Orientation =:: HorizontalOrientation)
:& (BarStyle =:: DefaultBar)
:& RNil
......
......@@ -28,6 +28,7 @@ import IHaskell.IPython.Message.UUID as U
import IHaskell.Display.Widgets.Types
import IHaskell.Display.Widgets.Common
import IHaskell.Display.Widgets.Layout.LayoutWidget
import IHaskell.Display.Widgets.Style.DescriptionStyle
-- | 'FloatSlider' represents an FloatSlider widget from IPython.html.widgets.
type FloatSlider = IPythonWidget 'FloatSliderType
......@@ -38,8 +39,9 @@ mkFloatSlider = do
-- Default properties, with a random uuid
wid <- U.random
layout <- mkLayout
dstyle <- mkDescriptionStyle
let boundedFloatAttrs = defaultBoundedFloatWidget "FloatSliderView" "FloatSliderModel" layout
let boundedFloatAttrs = defaultBoundedFloatWidget "FloatSliderView" "FloatSliderModel" layout dstyle
sliderAttrs = (StepFloat =:: Just 0.1)
:& (Orientation =:: HorizontalOrientation)
:& (ReadOut =:: True)
......
......@@ -29,6 +29,7 @@ import IHaskell.IPython.Message.UUID as U
import IHaskell.Display.Widgets.Types
import IHaskell.Display.Widgets.Common
import IHaskell.Display.Widgets.Layout.LayoutWidget
import IHaskell.Display.Widgets.Style.DescriptionStyle
-- | 'FloatRangeSlider' represents an FloatRangeSlider widget from IPython.html.widgets.
type FloatRangeSlider = IPythonWidget 'FloatRangeSliderType
......@@ -39,8 +40,9 @@ mkFloatRangeSlider = do
-- Default properties, with a random uuid
wid <- U.random
layout <- mkLayout
dstyle <- mkDescriptionStyle
let boundedFloatAttrs = defaultBoundedFloatRangeWidget "FloatRangeSliderView" "FloatRangeSliderModel" layout
let boundedFloatAttrs = defaultBoundedFloatRangeWidget "FloatRangeSliderView" "FloatRangeSliderModel" layout dstyle
sliderAttrs = (StepFloat =:: Just 0.1)
:& (Orientation =:: HorizontalOrientation)
:& (ReadOut =:: True)
......
......@@ -28,6 +28,7 @@ import IHaskell.IPython.Message.UUID as U
import IHaskell.Display.Widgets.Types
import IHaskell.Display.Widgets.Common
import IHaskell.Display.Widgets.Layout.LayoutWidget
import IHaskell.Display.Widgets.Style.DescriptionStyle
-- | 'FloatText' represents an FloatText widget from IPython.html.widgets.
type FloatText = IPythonWidget 'FloatTextType
......@@ -38,8 +39,9 @@ mkFloatText = do
-- Default properties, with a random uuid
wid <- U.random
layout <- mkLayout
dstyle <- mkDescriptionStyle
let floatAttrs = defaultFloatWidget "FloatTextView" "FloatTextModel" layout
let floatAttrs = defaultFloatWidget "FloatTextView" "FloatTextModel" layout dstyle
textAttrs = (Disabled =:: False)
:& (ContinuousUpdate =:: False)
:& (StepFloat =:: Nothing)
......
......@@ -28,6 +28,7 @@ import IHaskell.IPython.Message.UUID as U
import IHaskell.Display.Widgets.Types
import IHaskell.Display.Widgets.Common
import IHaskell.Display.Widgets.Layout.LayoutWidget
import IHaskell.Display.Widgets.Style.DescriptionStyle
-- | 'BoundedIntText' represents an BoundedIntText widget from IPython.html.widgets.
type BoundedIntText = IPythonWidget 'BoundedIntTextType
......@@ -38,8 +39,9 @@ mkBoundedIntText = do
-- Default properties, with a random uuid
wid <- U.random
layout <- mkLayout
dstyle <- mkDescriptionStyle
let boundedIntAttrs = defaultBoundedIntWidget "IntTextView" "BoundedIntTextModel" layout
let boundedIntAttrs = defaultBoundedIntWidget "IntTextView" "BoundedIntTextModel" layout dstyle
textAttrs = (Disabled =:: False)
:& (ContinuousUpdate =:: False)
:& (StepInt =:: Just 1)
......
......@@ -26,6 +26,7 @@ import IHaskell.IPython.Message.UUID as U
import IHaskell.Display.Widgets.Types
import IHaskell.Display.Widgets.Common
import IHaskell.Display.Widgets.Layout.LayoutWidget
import IHaskell.Display.Widgets.Style.DescriptionStyle
-- | 'IntProgress' represents an IntProgress widget from IPython.html.widgets.
type IntProgress = IPythonWidget 'IntProgressType
......@@ -36,8 +37,9 @@ mkIntProgress = do
-- Default properties, with a random uuid
wid <- U.random
layout <- mkLayout
dstyle <- mkDescriptionStyle
let boundedIntAttrs = defaultBoundedIntWidget "ProgressView" "IntProgressModel" layout
let boundedIntAttrs = defaultBoundedIntWidget "ProgressView" "IntProgressModel" layout dstyle
progressAttrs = (Orientation =:: HorizontalOrientation)
:& (BarStyle =:: DefaultBar)
:& RNil
......
......@@ -28,6 +28,7 @@ import IHaskell.Display (IHaskellWidget(..))
import IHaskell.Display.Widgets.Types
import IHaskell.Display.Widgets.Common
import IHaskell.Display.Widgets.Layout.LayoutWidget
import IHaskell.Display.Widgets.Style.DescriptionStyle
-- | 'IntSlider' represents an IntSlider widget from IPython.html.widgets.
type IntSlider = IPythonWidget 'IntSliderType
......@@ -38,8 +39,9 @@ mkIntSlider = do
-- Default properties, with a random uuid
wid <- U.random
layout <- mkLayout
dstyle <- mkDescriptionStyle
let boundedIntAttrs = defaultBoundedIntWidget "IntSliderView" "IntSliderModel" layout
let boundedIntAttrs = defaultBoundedIntWidget "IntSliderView" "IntSliderModel" layout dstyle
sliderAttrs = (StepInt =:: Just 1)
:& (Orientation =:: HorizontalOrientation)
:& (ReadOut =:: True)
......
......@@ -28,6 +28,7 @@ import IHaskell.Display (IHaskellWidget(..))
import IHaskell.Display.Widgets.Types
import IHaskell.Display.Widgets.Common
import IHaskell.Display.Widgets.Layout.LayoutWidget
import IHaskell.Display.Widgets.Style.DescriptionStyle
-- | 'Play' represents an Play widget from IPython.html.widgets.
type Play = IPythonWidget 'PlayType
......@@ -38,8 +39,9 @@ mkPlay = do
-- Default properties, with a random uuid
wid <- U.random
layout <- mkLayout
dstyle <- mkDescriptionStyle
let boundedIntAttrs = defaultBoundedIntWidget "PlayView" "PlayModel" layout
let boundedIntAttrs = defaultBoundedIntWidget "PlayView" "PlayModel" layout dstyle
playAttrs = (Playing =:: True)
:& (Repeat =:: True)
:& (Interval =:: 100)
......
......@@ -29,6 +29,7 @@ import IHaskell.IPython.Message.UUID as U
import IHaskell.Display.Widgets.Types
import IHaskell.Display.Widgets.Common
import IHaskell.Display.Widgets.Layout.LayoutWidget
import IHaskell.Display.Widgets.Style.DescriptionStyle
-- | 'IntRangeSlider' represents an IntRangeSlider widget from IPython.html.widgets.
type IntRangeSlider = IPythonWidget 'IntRangeSliderType
......@@ -39,8 +40,9 @@ mkIntRangeSlider = do
-- Default properties, with a random uuid
wid <- U.random
layout <- mkLayout
dstyle <- mkDescriptionStyle
let boundedIntAttrs = defaultBoundedIntRangeWidget "IntRangeSliderView" "IntRangeSliderModel" layout
let boundedIntAttrs = defaultBoundedIntRangeWidget "IntRangeSliderView" "IntRangeSliderModel" layout dstyle
sliderAttrs = (StepInt =:: Just 1)
:& (Orientation =:: HorizontalOrientation)
:& (ReadOut =:: True)
......
......@@ -28,6 +28,7 @@ import IHaskell.IPython.Message.UUID as U
import IHaskell.Display.Widgets.Types
import IHaskell.Display.Widgets.Common
import IHaskell.Display.Widgets.Layout.LayoutWidget
import IHaskell.Display.Widgets.Style.DescriptionStyle
-- | 'IntText' represents an IntText widget from IPython.html.widgets.
type IntText = IPythonWidget 'IntTextType
......@@ -38,8 +39,9 @@ mkIntText = do
-- Default properties, with a random uuid
wid <- U.random
layout <- mkLayout
dstyle <- mkDescriptionStyle
let intAttrs = defaultIntWidget "IntTextView" "IntTextModel" layout
let intAttrs = defaultIntWidget "IntTextView" "IntTextModel" layout dstyle
textAttrs = (Disabled =:: False)
:& (ContinuousUpdate =:: False)
:& (StepInt =:: Just 1)
......
......@@ -28,6 +28,7 @@ import IHaskell.IPython.Message.UUID as U
import IHaskell.Display.Widgets.Types
import IHaskell.Display.Widgets.Common
import IHaskell.Display.Widgets.Layout.LayoutWidget
import IHaskell.Display.Widgets.Style.DescriptionStyle
-- | A 'Dropdown' represents a Dropdown widget from IPython.html.widgets.
type Dropdown = IPythonWidget 'DropdownType
......@@ -38,8 +39,9 @@ mkDropdown = do
-- Default properties, with a random uuid
wid <- U.random
layout <- mkLayout
dstyle <- mkDescriptionStyle
let widgetState = WidgetState $ defaultSelectionWidget "DropdownView" "DropdownModel" layout
let widgetState = WidgetState $ defaultSelectionWidget "DropdownView" "DropdownModel" layout dstyle
stateIO <- newIORef widgetState
......
......@@ -27,6 +27,7 @@ import IHaskell.IPython.Message.UUID as U
import IHaskell.Display.Widgets.Types
import IHaskell.Display.Widgets.Common
import IHaskell.Display.Widgets.Layout.LayoutWidget
import IHaskell.Display.Widgets.Style.DescriptionStyle
-- | A 'RadioButtons' represents a RadioButtons widget from IPython.html.widgets.
type RadioButtons = IPythonWidget 'RadioButtonsType
......@@ -37,8 +38,9 @@ mkRadioButtons = do
-- Default properties, with a random uuid
wid <- U.random
layout <- mkLayout
dstyle <- mkDescriptionStyle
let widgetState = WidgetState $ defaultSelectionWidget "RadioButtonsView" "RadioButtonsModel" layout
let widgetState = WidgetState $ defaultSelectionWidget "RadioButtonsView" "RadioButtonsModel" layout dstyle
stateIO <- newIORef widgetState
......
......@@ -28,6 +28,7 @@ import IHaskell.IPython.Message.UUID as U
import IHaskell.Display.Widgets.Types
import IHaskell.Display.Widgets.Common
import IHaskell.Display.Widgets.Layout.LayoutWidget
import IHaskell.Display.Widgets.Style.DescriptionStyle
-- | A 'Select' represents a Select widget from IPython.html.widgets.
type Select = IPythonWidget 'SelectType
......@@ -38,8 +39,9 @@ mkSelect = do
-- Default properties, with a random uuid
wid <- U.random
layout <- mkLayout
dstyle <- mkDescriptionStyle
let selectionAttrs = defaultSelectionWidget "SelectView" "SelectModel" layout
let selectionAttrs = defaultSelectionWidget "SelectView" "SelectModel" layout dstyle
selectAttrs = (Rows =:: Just 5)
:& RNil
widgetState = WidgetState $ selectionAttrs <+> selectAttrs
......
......@@ -29,6 +29,7 @@ import IHaskell.IPython.Message.UUID as U
import IHaskell.Display.Widgets.Types
import IHaskell.Display.Widgets.Common
import IHaskell.Display.Widgets.Layout.LayoutWidget
import IHaskell.Display.Widgets.Style.DescriptionStyle
-- | A 'SelectMultiple' represents a SelectMultiple widget from IPython.html.widgets.
type SelectMultiple = IPythonWidget 'SelectMultipleType
......@@ -39,8 +40,9 @@ mkSelectMultiple = do
-- Default properties, with a random uuid
wid <- U.random
layout <- mkLayout
dstyle <- mkDescriptionStyle
let multipleSelectionAttrs = defaultMultipleSelectionWidget "SelectMultipleView" "SelectMultipleModel" layout
let multipleSelectionAttrs = defaultMultipleSelectionWidget "SelectMultipleView" "SelectMultipleModel" layout dstyle
selectMultipleAttrs = (Rows =:: Just 5)
:& RNil
widgetState = WidgetState $ multipleSelectionAttrs <+> selectMultipleAttrs
......
......@@ -29,6 +29,7 @@ import IHaskell.IPython.Message.UUID as U
import IHaskell.Display.Widgets.Types
import IHaskell.Display.Widgets.Common
import IHaskell.Display.Widgets.Layout.LayoutWidget
import IHaskell.Display.Widgets.Style.DescriptionStyle
-- | A 'SelectionRangeSlider' represents a SelectionSlider widget from IPyhon.widgets
type SelectionRangeSlider = IPythonWidget 'SelectionRangeSliderType
......@@ -38,8 +39,9 @@ mkSelectionRangeSlider :: IO SelectionRangeSlider
mkSelectionRangeSlider = do
wid <- U.random
layout <- mkLayout
dstyle <- mkDescriptionStyle
let selectionAttrs = defaultMultipleSelectionWidget "SelectionRangeSliderView" "SelectionRangeSliderModel" layout
let selectionAttrs = defaultMultipleSelectionWidget "SelectionRangeSliderView" "SelectionRangeSliderModel" layout dstyle
selectionRangeSliderAttrs = (Orientation =:: HorizontalOrientation)
:& (ReadOut =:: True)
:& (ContinuousUpdate =:: True)
......
......@@ -28,6 +28,7 @@ import IHaskell.IPython.Message.UUID as U
import IHaskell.Display.Widgets.Types
import IHaskell.Display.Widgets.Common
import IHaskell.Display.Widgets.Layout.LayoutWidget
import IHaskell.Display.Widgets.Style.DescriptionStyle
-- | A 'SelectionSlider' represents a SelectionSlider widget from IPyhon.widgets
type SelectionSlider = IPythonWidget 'SelectionSliderType
......@@ -37,8 +38,9 @@ mkSelectionSlider :: IO SelectionSlider
mkSelectionSlider = do
wid <- U.random
layout <- mkLayout
dstyle <- mkDescriptionStyle
let selectionAttrs = defaultSelectionNonemptyWidget "SelectionSliderView" "SelectionSliderModel" layout
let selectionAttrs = defaultSelectionNonemptyWidget "SelectionSliderView" "SelectionSliderModel" layout dstyle
selectionSliderAttrs = (Orientation =:: HorizontalOrientation)
:& (ReadOut =:: True)
:& (ContinuousUpdate =:: True)
......
......@@ -28,6 +28,7 @@ import IHaskell.IPython.Message.UUID as U
import IHaskell.Display.Widgets.Types
import IHaskell.Display.Widgets.Common
import IHaskell.Display.Widgets.Layout.LayoutWidget
import IHaskell.Display.Widgets.Style.DescriptionStyle
-- | A 'ToggleButtons' represents a ToggleButtons widget from IPython.html.widgets.
type ToggleButtons = IPythonWidget 'ToggleButtonsType
......@@ -38,8 +39,9 @@ mkToggleButtons = do
-- Default properties, with a random uuid
wid <- U.random
layout <- mkLayout
dstyle <- mkDescriptionStyle
let selectionAttrs = defaultSelectionWidget "ToggleButtonsView" "ToggleButtonsModel" layout
let selectionAttrs = defaultSelectionWidget "ToggleButtonsView" "ToggleButtonsModel" layout dstyle
toggleButtonsAttrs = (Tooltips =:: [])
:& (Icons =:: [])
:& (ButtonStyle =:: DefaultButton)
......
......@@ -118,6 +118,7 @@ singletons
| Axes
| ButtonColor
| FontWeight
| DescriptionWidth
-- Singletons for child style widgets
| StyleButton
| StyleDescription
......
......@@ -27,6 +27,7 @@ import IHaskell.IPython.Message.UUID as U
import IHaskell.Display.Widgets.Types
import IHaskell.Display.Widgets.Common
import IHaskell.Display.Widgets.Layout.LayoutWidget
import IHaskell.Display.Widgets.Style.DescriptionStyle
-- | A 'ComboboxWidget' represents a Combobox widget from IPython.html.widgets.
type ComboboxWidget = IPythonWidget 'ComboboxType
......@@ -37,8 +38,9 @@ mkComboboxWidget = do
-- Default properties, with a random uuid
wid <- U.random
layout <- mkLayout
dstyle <- mkDescriptionStyle
let txtWidget = defaultTextWidget "ComboboxView" "ComboboxModel" layout
let txtWidget = defaultTextWidget "ComboboxView" "ComboboxModel" layout dstyle
boxWidget = (Options =:: [])
:& (EnsureOption =:: False)
:& RNil
......
......@@ -24,6 +24,7 @@ import IHaskell.IPython.Message.UUID as U
import IHaskell.Display.Widgets.Types
import IHaskell.Display.Widgets.Layout.LayoutWidget
import IHaskell.Display.Widgets.Style.DescriptionStyle
-- | A 'HTMLWidget' represents a HTML widget from IPython.html.widgets.
type HTMLWidget = IPythonWidget 'HTMLType
......@@ -34,8 +35,9 @@ mkHTMLWidget = do
-- Default properties, with a random uuid
wid <- U.random
layout <- mkLayout
dstyle <- mkDescriptionStyle
let widgetState = WidgetState $ defaultStringWidget "HTMLView" "HTMLModel" layout
let widgetState = WidgetState $ defaultStringWidget "HTMLView" "HTMLModel" layout dstyle
stateIO <- newIORef widgetState
......
......@@ -24,6 +24,7 @@ import IHaskell.IPython.Message.UUID as U
import IHaskell.Display.Widgets.Types
import IHaskell.Display.Widgets.Layout.LayoutWidget
import IHaskell.Display.Widgets.Style.DescriptionStyle
-- | A 'HTMLMathWidget' represents a HTML Math widget from IPython.html.widgets.
type HTMLMathWidget = IPythonWidget 'HTMLMathType
......@@ -34,8 +35,9 @@ mkHTMLMathWidget = do
-- Default properties, with a random uuid
wid <- U.random
layout <- mkLayout
dstyle <- mkDescriptionStyle
let widgetState = WidgetState $ defaultStringWidget "HTMLMathView" "HTMLMathModel" layout
let widgetState = WidgetState $ defaultStringWidget "HTMLMathView" "HTMLMathModel" layout dstyle
stateIO <- newIORef widgetState
......
......@@ -24,6 +24,7 @@ import IHaskell.IPython.Message.UUID as U
import IHaskell.Display.Widgets.Types
import IHaskell.Display.Widgets.Layout.LayoutWidget
import IHaskell.Display.Widgets.Style.DescriptionStyle
-- | A 'LabelWidget' represents a Label widget from IPython.html.widgets.
type LabelWidget = IPythonWidget 'LabelType
......@@ -34,8 +35,9 @@ mkLabelWidget = do
-- Default properties, with a random uuid
wid <- U.random
layout <- mkLayout
dstyle <- mkDescriptionStyle
let widgetState = WidgetState $ defaultStringWidget "LabelView" "LabelModel" layout
let widgetState = WidgetState $ defaultStringWidget "LabelView" "LabelModel" layout dstyle
stateIO <- newIORef widgetState
......
......@@ -27,6 +27,7 @@ import IHaskell.IPython.Message.UUID as U
import IHaskell.Display.Widgets.Types
import IHaskell.Display.Widgets.Common
import IHaskell.Display.Widgets.Layout.LayoutWidget
import IHaskell.Display.Widgets.Style.DescriptionStyle
-- | A 'PasswordWidget' represents a Password widget from IPython.html.widgets.
type PasswordWidget = IPythonWidget 'PasswordType
......@@ -37,8 +38,9 @@ mkPasswordWidget = do
-- Default properties, with a random uuid
wid <- U.random
layout <- mkLayout
dstyle <- mkDescriptionStyle
let widgetState = WidgetState $ defaultTextWidget "PasswordView" "PasswordModel" layout
let widgetState = WidgetState $ defaultTextWidget "PasswordView" "PasswordModel" layout dstyle
stateIO <- newIORef widgetState
......
......@@ -27,6 +27,7 @@ import IHaskell.IPython.Message.UUID as U
import IHaskell.Display.Widgets.Types
import IHaskell.Display.Widgets.Common
import IHaskell.Display.Widgets.Layout.LayoutWidget
import IHaskell.Display.Widgets.Style.DescriptionStyle
-- | A 'TextWidget' represents a Text widget from IPython.html.widgets.
type TextWidget = IPythonWidget 'TextType
......@@ -37,8 +38,9 @@ mkTextWidget = do
-- Default properties, with a random uuid
wid <- U.random
layout <- mkLayout
dstyle <- mkDescriptionStyle
let widgetState = WidgetState $ defaultTextWidget "TextView" "TextModel" layout
let widgetState = WidgetState $ defaultTextWidget "TextView" "TextModel" layout dstyle
stateIO <- newIORef widgetState
......
......@@ -26,6 +26,7 @@ import IHaskell.IPython.Message.UUID as U
import IHaskell.Display.Widgets.Types
import IHaskell.Display.Widgets.Common
import IHaskell.Display.Widgets.Layout.LayoutWidget
import IHaskell.Display.Widgets.Style.DescriptionStyle
-- | A 'TextArea' represents a Textarea widget from IPython.html.widgets.
type TextArea = IPythonWidget 'TextAreaType
......@@ -36,8 +37,9 @@ mkTextArea = do
-- Default properties, with a random uuid
wid <- U.random
layout <- mkLayout
dstyle <- mkDescriptionStyle
let strAttrs = defaultStringWidget "TextareaView" "TextareaModel" layout
let strAttrs = defaultStringWidget "TextareaView" "TextareaModel" layout dstyle
wgtAttrs = (Rows =:: Nothing)
:& (Disabled =:: False)
:& (ContinuousUpdate =:: True)
......
{-# LANGUAGE FlexibleInstances #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE DataKinds #-}
{-# LANGUAGE TypeSynonymInstances #-}
{-# OPTIONS_GHC -fno-warn-orphans #-}
module IHaskell.Display.Widgets.Style.ButtonStyle
( -- * Button style
ButtonStyle
-- * Create a new button style
, mkButtonStyle
) where
-- To keep `cabal repl` happy when running from the ihaskell repo
import Prelude
import Data.Aeson
import Data.IORef (newIORef)
import Data.Vinyl (Rec(..), (<+>))
import IHaskell.Display
import IHaskell.Eval.Widgets
import IHaskell.IPython.Message.UUID as U
import IHaskell.Display.Widgets.Types
import IHaskell.Display.Widgets.Common
-- | A 'ButtonStyle' represents a Button Style from IPython.html.widgets.
type ButtonStyle = IPythonWidget 'ButtonStyleType
-- | Create a new button style
mkButtonStyle :: IO ButtonStyle
mkButtonStyle = do
wid <- U.random
let stl = defaultStyleWidget "ButtonStyleModel"
but = (ButtonColor =:: Nothing)
:& (FontWeight =:: DefaultWeight)
:& RNil
btnStlState = WidgetState (stl <+> but)
stateIO <- newIORef btnStlState
let style = IPythonWidget wid stateIO
-- Open a comm for this widget, and store it in the kernel state
widgetSendOpen style $ toJSON btnStlState
-- Return the style widget
return style
instance IHaskellWidget ButtonStyle where
getCommUUID = uuid
{-# LANGUAGE FlexibleInstances #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE DataKinds #-}
{-# LANGUAGE TypeSynonymInstances #-}
{-# OPTIONS_GHC -fno-warn-orphans #-}
module IHaskell.Display.Widgets.Style.DescriptionStyle
( -- * Description style
DescriptionStyle
-- * Create a new description style
, mkDescriptionStyle
) where
-- To keep `cabal repl` happy when running from the ihaskell repo
import Prelude
import Data.Aeson
import Data.IORef (newIORef)
import Data.Vinyl (Rec(..), (<+>))
import IHaskell.Display
import IHaskell.Eval.Widgets
import IHaskell.IPython.Message.UUID as U
import IHaskell.Display.Widgets.Types
import IHaskell.Display.Widgets.Common
-- | A 'DescriptionStyle' represents a Button Style from IPython.html.widgets.
type DescriptionStyle = IPythonWidget 'DescriptionStyleType
-- | Create a new button style
mkDescriptionStyle :: IO DescriptionStyle
mkDescriptionStyle = do
wid <- U.random
let stl = defaultStyleWidget "DescriptionStyleModel"
but = (DescriptionWidth =:: "")
:& RNil
btnStlState = WidgetState (stl <+> but)
stateIO <- newIORef btnStlState
let style = IPythonWidget wid stateIO
-- Open a comm for this widget, and store it in the kernel state
widgetSendOpen style $ toJSON btnStlState
-- Return the style widget
return style
instance IHaskellWidget DescriptionStyle where
getCommUUID = uuid
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment