wx 0.12.1.6 → 0.13.2
raw patch · 15 files changed
+81/−19 lines, 15 filesdep ~wxcore
Dependency ranges changed: wxcore
Files
- src/Graphics/UI/WX/Attributes.hs +1/−1
- src/Graphics/UI/WX/Classes.hs +1/−1
- src/Graphics/UI/WX/Controls.hs +60/−2
- src/Graphics/UI/WX/Dialogs.hs +1/−1
- src/Graphics/UI/WX/Draw.hs +1/−1
- src/Graphics/UI/WX/Events.hs +1/−1
- src/Graphics/UI/WX/Frame.hs +1/−1
- src/Graphics/UI/WX/Layout.hs +1/−1
- src/Graphics/UI/WX/Media.hs +1/−1
- src/Graphics/UI/WX/Menu.hs +1/−1
- src/Graphics/UI/WX/Timer.hs +1/−1
- src/Graphics/UI/WX/TopLevelWindow.hs +1/−1
- src/Graphics/UI/WX/Types.hs +1/−1
- src/Graphics/UI/WX/Window.hs +1/−1
- wx.cabal +8/−4
src/Graphics/UI/WX/Attributes.hs view
@@ -1,4 +1,4 @@-{-# OPTIONS -fglasgow-exts #-}+{-# LANGUAGE ExistentialQuantification #-} -------------------------------------------------------------------------------- {-| Module : Attributes Copyright : (c) Daan Leijen 2003
src/Graphics/UI/WX/Classes.hs view
@@ -1,4 +1,4 @@-{-# OPTIONS -fglasgow-exts #-}+{-# LANGUAGE MultiParamTypeClasses, FunctionalDependencies, DeriveDataTypeable, ScopedTypeVariables #-} -------------------------------------------------------------------------------- {-| Module : Classes Copyright : (c) Daan Leijen 2003
src/Graphics/UI/WX/Controls.hs view
@@ -1,4 +1,5 @@-{-# OPTIONS -fglasgow-exts #-}++{-# LANGUAGE TypeSynonymInstances, FlexibleInstances, MultiParamTypeClasses, DeriveDataTypeable #-} -------------------------------------------------------------------------------- {-| Module : Controls Copyright : (c) Daan Leijen 2003@@ -48,7 +49,8 @@ -- ** Tree control , TreeCtrl, treeCtrl, treeCtrlEx, treeEvent, treeCtrlRes -- ** List control- , ListCtrl, listCtrl, listCtrlEx, listCtrlRes, listEvent, columns+ , ListCtrl, listCtrl, listCtrlEx, listCtrlRes, listCtrlSetColumnWidths, listEvent, columns+ , ListView(..), listViewLayout, listViewSetHandler, listViewSelectHandle, listViewSetItems, listViewGetItems, listViewAddItem, listView -- ** Static text , StaticText, staticText, staticTextRes -- ** SplitterWindow@@ -69,8 +71,10 @@ import Graphics.UI.WX.Events import Graphics.UI.WX.Layout import Graphics.UI.WX.Media (Media(..))+import Graphics.UI.WX.Variable (variable) import Graphics.UI.WX.Window +import Control.Monad (forM_) import Data.Dynamic -- for "alignment" @@ -1100,6 +1104,60 @@ do l <- xmlResourceGetListCtrl parent name set l props return l++-- TODO: figure out how to set a resize handler in addition to the+-- default one. this will allow us to expand as needed upon resize+-- events.+listCtrlSetColumnWidths :: ListCtrl () -> Int -> IO ()+listCtrlSetColumnWidths ctrl w = do+-- size <- (realToFrac.sizeW) `fmap` get ctrl clientSize+ cols <- listCtrlGetColumnCount ctrl+-- let w = 65 --ceiling $ size / realToFrac cols+ forM_ [0 .. cols - 1] $ \i -> listCtrlSetColumnWidth ctrl i w++-- | A small wrapper over WX's ListCtrl, allowing us to keep the data+-- we're representing as well as its string form (shown to the user as+-- rows).+data ListView a = ListView {+ listViewCtrl :: ListCtrl (),+ listViewItems :: Var [a],+ listViewToRow :: a -> [String]+}++listViewLayout :: ListView a -> Layout+listViewLayout = fill . widget . listViewCtrl++listViewSetHandler :: ListView a -> (EventList -> IO ()) -> IO ()+listViewSetHandler list handler =+ set (listViewCtrl list) [on listEvent := handler]++listViewSelectHandle :: ListView a -> (Maybe a -> IO ()) -> EventList -> IO ()+listViewSelectHandle _ _ (ListItemActivated (-1)) = propagateEvent+listViewSelectHandle list end (ListItemActivated n ) = end . Just =<< (!! n) `fmap` listViewGetItems list+listViewSelectHandle _ _ _ = propagateEvent++listViewSetItems :: ListView a -> [a] -> IO ()+listViewSetItems list its = do+ set (listViewItems list) [value := its]+ set (listViewCtrl list) [items := map (listViewToRow list) its]++listViewGetItems :: ListView a -> IO [a]+listViewGetItems list = get (listViewItems list) value++listViewAddItem :: ListView a -> a -> IO ()+listViewAddItem list it = do+ its <- (it:) `fmap` get (listViewItems list) value+ listViewSetItems list its++listViewSetColumnWidths :: ListView a -> Int -> IO ()+listViewSetColumnWidths list w = do+ listCtrlSetColumnWidths (listViewCtrl list) w++listView :: Window b -> [String] -> (a -> [String]) -> IO (ListView a)+listView parent cols toRow = do+ ctrl <- listCtrl parent [columns := map (\n -> (n, AlignLeft, -1)) cols]+ var <- variable [value := []]+ return $ ListView ctrl var toRow {-------------------------------------------------------------------------------- SplitterWindow
src/Graphics/UI/WX/Dialogs.hs view
@@ -1,4 +1,4 @@-{-# OPTIONS -fglasgow-exts #-}+{-# LANGUAGE TypeSynonymInstances #-} -------------------------------------------------------------------------------- {-| Module : Dialogs Copyright : (c) Daan Leijen 2003
src/Graphics/UI/WX/Draw.hs view
@@ -1,4 +1,4 @@-{-# OPTIONS -fglasgow-exts #-}+{-# LANGUAGE TypeSynonymInstances #-} -------------------------------------------------------------------------------- {-| Module : Draw Copyright : (c) Daan Leijen 2003
src/Graphics/UI/WX/Events.hs view
@@ -1,4 +1,4 @@-{-# OPTIONS -fglasgow-exts #-}+ -------------------------------------------------------------------------------- {-| Module : Events Copyright : (c) Daan Leijen 2003
src/Graphics/UI/WX/Frame.hs view
@@ -1,4 +1,4 @@-{-# OPTIONS -fglasgow-exts #-}+ -------------------------------------------------------------------------------- {-| Module : Frame Copyright : (c) Daan Leijen 2003
src/Graphics/UI/WX/Layout.hs view
@@ -1,4 +1,4 @@-{-# OPTIONS -fglasgow-exts #-}+ ----------------------------------------------------------------------------------------- {-| Module : Layout Copyright : (c) Daan Leijen 2003
src/Graphics/UI/WX/Media.hs view
@@ -1,4 +1,4 @@-{-# OPTIONS -fglasgow-exts #-}+{-# LANGUAGE TypeSynonymInstances #-} -------------------------------------------------------------------------------- {-| Module : Media Copyright : (c) Daan Leijen 2003
src/Graphics/UI/WX/Menu.hs view
@@ -1,4 +1,4 @@-{-# OPTIONS -fglasgow-exts #-}+{-# LANGUAGE TypeSynonymInstances #-} -------------------------------------------------------------------------------- {-| Module : Menu Copyright : (c) Daan Leijen 2003
src/Graphics/UI/WX/Timer.hs view
@@ -1,4 +1,4 @@-{-# OPTIONS -fglasgow-exts #-}+{-# LANGUAGE TypeSynonymInstances #-} -------------------------------------------------------------------------------- {-| Module : Timer Copyright : (c) Daan Leijen 2003
src/Graphics/UI/WX/TopLevelWindow.hs view
@@ -1,4 +1,4 @@-{-# OPTIONS -fglasgow-exts #-} +{-# LANGUAGE TypeSynonymInstances #-} -------------------------------------------------------------------------------- {-| Module : TopLevelWindow Copyright : (c) Jeremy O'Donoghue, 2007
src/Graphics/UI/WX/Types.hs view
@@ -1,4 +1,4 @@-{-# OPTIONS -fglasgow-exts #-}+{-# LANGUAGE ScopedTypeVariables #-} -------------------------------------------------------------------------------- {-| Module : Types Copyright : (c) Daan Leijen 2003
src/Graphics/UI/WX/Window.hs view
@@ -1,4 +1,4 @@-{-# OPTIONS -fglasgow-exts #-}+{-# LANGUAGE TypeSynonymInstances #-} -------------------------------------------------------------------------------- {-| Module : Window Copyright : (c) Daan Leijen 2003
wx.cabal view
@@ -1,13 +1,17 @@ Name: wx-Version: 0.12.1.6-License: LGPL+Version: 0.13.2+License: OtherLicense License-file: license.txt Homepage: http://haskell.org/haskellwiki/WxHaskell Author: Daan Leijen Build-Type: Simple Category: GUI, User interfaces Cabal-Version: >= 1.2-Description: wxHaskell is a portable and native GUI library for Haskell. It is built on top of wxWidgets - a comprehensive C++ library that is portable across all major GUI platforms; including GTK, Windows, X11, and MacOS X. This version works with wxWidgets 2.8 only.+Description: wxHaskell is a portable and native GUI library for Haskell. + It is built on top of wxWidgets - a comprehensive C+++ library that is portable across all major GUI platforms;+ including GTK, Windows, X11, and MacOS X. This version+ works with wxWidgets 2.8 and 2.9. Maintainer: wxhaskell-devel@lists.sourceforge.net Synopsis: wxHaskell Data-Files: wx.cabal@@ -20,7 +24,7 @@ Library if flag(splitBase)- build-depends: wxcore >= 0.12.1.6,+ build-depends: wxcore >= 0.13.1, stm if flag(newBase) build-depends: