diff options
author | Camil Staps | 2019-10-20 16:03:52 +0200 |
---|---|---|
committer | Camil Staps | 2019-10-20 16:03:52 +0200 |
commit | 3670cdea024845e211cbf840cd9aebb20b5e74ae (patch) | |
tree | 54f535e0873bea5ef4ed3fe11a151bdd0850d5f0 /src | |
parent | Add synonym type GtkM a :== State GtkState a (diff) |
Add tune class for margins
Diffstat (limited to 'src')
-rw-r--r-- | src/Gtk.dcl | 1 | ||||
-rw-r--r-- | src/Gtk.icl | 1 | ||||
-rw-r--r-- | src/Gtk/Tune.dcl | 12 | ||||
-rw-r--r-- | src/Gtk/Tune.icl | 15 |
4 files changed, 29 insertions, 0 deletions
diff --git a/src/Gtk.dcl b/src/Gtk.dcl index 75c7754..a77e2b1 100644 --- a/src/Gtk.dcl +++ b/src/Gtk.dcl @@ -2,5 +2,6 @@ definition module Gtk import Gtk.Signal import Gtk.State +import Gtk.Tune import Gtk.Types import Gtk.Widgets diff --git a/src/Gtk.icl b/src/Gtk.icl index d0e3c3a..88cb82b 100644 --- a/src/Gtk.icl +++ b/src/Gtk.icl @@ -2,5 +2,6 @@ implementation module Gtk import Gtk.Signal import Gtk.State +import Gtk.Tune import Gtk.Types import Gtk.Widgets diff --git a/src/Gtk/Tune.dcl b/src/Gtk/Tune.dcl new file mode 100644 index 0000000..07d0507 --- /dev/null +++ b/src/Gtk/Tune.dcl @@ -0,0 +1,12 @@ +definition module Gtk.Tune + +from Gtk.State import :: StateT, :: Identity, :: State, :: GtkState, :: GtkM +from Gtk.Types import :: GtkMargins +from Gtk.Widgets import :: GtkWidget, class gtkWidget + +class tune elem option :: !(GtkM elem) !option -> GtkM elem + +(<<@) infixl 2 +(<<@) elem option :== tune elem option + +instance tune w GtkMargins | gtkWidget w diff --git a/src/Gtk/Tune.icl b/src/Gtk/Tune.icl new file mode 100644 index 0000000..26a05f3 --- /dev/null +++ b/src/Gtk/Tune.icl @@ -0,0 +1,15 @@ +implementation module Gtk.Tune + +import Control.Applicative +import Control.Monad +import Control.Monad.Identity +import Control.Monad.State + +import Gtk + +instance tune w GtkMargins | gtkWidget w +where + tune widgetf margins = + widgetf >>= \widget -> + setMargins margins widget >>| + pure widget |