Commits

Gideon Sireling  committed 68b3b76

documentation

  • Participants
  • Parent commits fa6d3b6
  • Tags 0.2 Binding Lists

Comments (0)

Files changed (11)

File binding-core/LICENSE

+Copyright (c)2011, Gideon Sireling
+
+All rights reserved.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions are met:
+
+    * Redistributions of source code must retain the above copyright
+      notice, this list of conditions and the following disclaimer.
+
+    * Redistributions in binary form must reproduce the above
+      copyright notice, this list of conditions and the following
+      disclaimer in the documentation and/or other materials provided
+      with the distribution.
+
+    * Neither the name of Gideon Sireling nor the names of other
+      contributors may be used to endorse or promote products derived
+      from this software without specific prior written permission.
+
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

File binding-core/binding-core.cabal

 name:           binding-core
 version:        0.2
 cabal-version:  >= 1.9.2
+license:        BSD3
+license-file:   LICENSE
 author:         Gideon Sireling
 maintainer:     code@accursoft.com
 homepage:       http://code.accursoft.com/binding
 synopsis:       Data Binding
 build-type:     Simple
 category:       GUI, User Interfaces
+description:    Bind mutable data and lists to IO objects.
+                Wrappers for binding to graphical widgets are provided by binding-gtk and binding-wx.
 
 library
-  build-depends:   base, stm
+  build-depends:   base <5, stm
   hs-source-dirs:  src
   exposed-modules: Data.Binding.Simple, Data.Binding.List, Data.Variable
 

File binding-core/src/Data/Binding/List.hs

 
 import Data.Binding.Simple
 
--- | Associates a binding source with a list of data sources.
+-- | Binding List
 data BindingList v a = Variable v => BindingList {source :: Source v a -- ^ the list's binding source
                                                  ,list   :: v [v a]    -- ^ the bound list
                                                  ,pos    :: v Int}     -- ^ the current position

File binding-core/src/Data/Binding/Simple.hs

 -- @d -> t -> IO ()@ is a function that applies data to the target
 data Binding a = forall d t. Binding (a -> d) t (t -> d -> IO ())
 
--- | A simple binding source.
+-- | Binding Source
 data Source v a = Variable v => Source {bindings :: v [Binding a] -- ^ the source's bindings
                                        ,var      :: v a}          -- ^ the bound variable
 
                        update s
                        return b
 
--- | Binding sources.
+-- | Sources for data binding.
 class Variable b => Bindable b where
    -- | Create a data binding
    bind :: b a               -- ^ the binding source

File binding-core/src/Data/Variable.hs

--- | Mutable variables in the IO Monad
+-- | Mutable variables in the IO Monad.
 module Data.Variable where
 
 import Data.IORef

File binding-gtk/LICENSE

+Copyright (c)2011, Gideon Sireling
+
+All rights reserved.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions are met:
+
+    * Redistributions of source code must retain the above copyright
+      notice, this list of conditions and the following disclaimer.
+
+    * Redistributions in binary form must reproduce the above
+      copyright notice, this list of conditions and the following
+      disclaimer in the documentation and/or other materials provided
+      with the distribution.
+
+    * Neither the name of Gideon Sireling nor the names of other
+      contributors may be used to endorse or promote products derived
+      from this software without specific prior written permission.
+
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

File binding-gtk/binding-gtk.cabal

 name:               binding-gtk
 version:            0.2
-cabal-version:      >= 1.2
+cabal-version:      >= 1.6
+license:            BSD3
+license-file:       LICENSE
 author:             Gideon Sireling
 maintainer:         code@accursoft.com
 homepage:           http://code.accursoft.com/binding
 bug-reports:        http://code.accursoft.com/binding/issues
-synopsis:           binding-core wrapper for Gtk2Hs
+synopsis:           Data Binding in Gtk2Hs
 build-type:         Simple
 category:           GUI, User Interfaces
 extra-source-files: demo/simple.hs demo/lists.hs, demo/in.txt
+description:        Bind mutable data and lists to Gtk2Hs widgets.
+                    Examples are provided by the included demo programs.
 
 library
-  build-depends:   base, gtk, binding-core, mtl
+  build-depends:   base <5, gtk, binding-core, mtl
   hs-source-dirs:  src
   exposed-modules: Graphics.UI.Gtk.Binding
 

File binding-gtk/src/Graphics/UI/Gtk/Binding.hs

                                                       on b buttonActivated c
                                                       return b
 
+                       --disable the delete button when there's only one element
                        let del = last buttons
                        del `on` buttonActivated $ do l <- B.length bl
                                                      del `set` [widgetSensitive := l > 1]
 
-                       (buttons !! 2) `on` buttonActivated $ del `set` [widgetSensitive := True] --"+"
+                       --inserting enables the delete button
+                       (buttons !! 2) `on` buttonActivated $ del `set` [widgetSensitive := True]
 
                        box <- hButtonBoxNew
                        containerAdd box spin

File binding-wx/LICENSE

+Copyright (c)2011, Gideon Sireling
+
+All rights reserved.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions are met:
+
+    * Redistributions of source code must retain the above copyright
+      notice, this list of conditions and the following disclaimer.
+
+    * Redistributions in binary form must reproduce the above
+      copyright notice, this list of conditions and the following
+      disclaimer in the documentation and/or other materials provided
+      with the distribution.
+
+    * Neither the name of Gideon Sireling nor the names of other
+      contributors may be used to endorse or promote products derived
+      from this software without specific prior written permission.
+
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

File binding-wx/binding-wx.cabal

 name:               binding-wx
 version:            0.2
-cabal-version:      >= 1.2
+cabal-version:      >= 1.6
+license:            BSD3
+license-file:       LICENSE
 author:             Gideon Sireling
 maintainer:         code@accursoft.com
 homepage:           http://code.accursoft.com/binding
 bug-reports:        http://code.accursoft.com/binding/issues
-synopsis:           binding-core wrapper for WxHaskell
+synopsis:           Data Binding in WxHaskell
 build-type:         Simple
 category:           GUI, User Interfaces
 extra-source-files: demo/simple.hs demo/lists.hs, demo/in.txt
+description:        Bind mutable data and lists to WxHaskell widgets.
+                    Examples are provided by the included demo programs.
 
 library
-  build-depends:   base, wxcore, wx, binding-core, stm
+  build-depends:   base <5, wxcore, wx, binding-core, stm
   hs-source-dirs:  src
   exposed-modules: Graphics.UI.WX.Binding
-  
+
 source-repository head
   type:     hg
   location: https://bitbucket.org/accursoft/binding

File binding-wx/src/Graphics/UI/WX/Binding.hs

                                              ,("-", remove bl >>= go >> setRange)]
                                              $ \(t,c) -> button owner [text := t, on command := c]
 
+                             --disable the delete button when there's only one element
                              let del = last buttons
                              del `set` [on command :~ (>> do l <- B.length bl
                                                              del `set` [enabled := l > 1])                                                               ]
 
-                             (buttons !! 2) `set` [on command :~ (>> del `set` [enabled := True])] --"+"
+                             --inserting enables the delete button
+                             (buttons !! 2) `set` [on command :~ (>> del `set` [enabled := True])]
 
                              return $ row 0 $ widget spin : map widget buttons