wx 0.90 → 0.90.0.1
raw patch · 3 files changed
+21/−7 lines, 3 files
Files
- src/Graphics/UI/WX/Controls.hs +19/−5
- src/Graphics/UI/WX/Window.hs +1/−1
- wx.cabal +1/−1
src/Graphics/UI/WX/Controls.hs view
@@ -77,6 +77,7 @@ import Control.Monad (forM_) import Data.Dynamic -- for "alignment"+import System.Info (os) defaultStyle@@ -315,15 +316,27 @@ = newAttr "enabled" textCtrlIsEditable textCtrlSetEditable -} +-- Workaround for Unexpected TextCtrl behaviour (https://github.com/jodonoghue/wxHaskell/issues/1#issuecomment-5202439)+-- Problem arises from the fact that wxTE_RICH is needed only on Windows platforms, but is essential there. However, on+-- wxMac > 2.9, wxTE_RICH seems not to be ignored as the documentation claims.+getRichTE = if (os == "mingw32") || (os == "win32")+ then wxTE_RICH+ else 0++getRichTE2 = if (os == "mingw32") || (os == "win32")+ then wxTE_RICH2+ else 0+ -- | Create a single-line text entry control. Note: 'alignment' has to -- be set at creation time (or the entry has default alignment (=left) ).+-- This is an alias for textEntry -- -- * Instances: 'Wrap', 'Aligned', 'Commanding' -- 'Textual', 'Literate', 'Dimensions', 'Colored', 'Visible', 'Child', -- 'Able', 'Tipped', 'Identity', 'Styled', 'Reactive', 'Paint'. -- entry :: Window a -> [Prop (TextCtrl ())] -> IO (TextCtrl ()) entry parent props- = textCtrlEx parent wxTE_RICH props+ = textCtrlEx parent getRichTE props -- | Create a single-line text entry control. Note: 'alignment' has to -- be set at creation time (or the entry has default alignment (=left) ).@@ -333,7 +346,7 @@ -- textEntry :: Window a -> [Prop (TextCtrl ())] -> IO (TextCtrl ()) textEntry parent props- = textCtrlEx parent wxTE_RICH props+ = textCtrlEx parent getRichTE props -- | Create a multi-line text control. Note: the 'wrap' and 'alignment' -- have to be set at creation time or the default to 'WrapNone' and 'AlignLeft' respectively.@@ -343,7 +356,7 @@ -- textCtrl :: Window a -> [Prop (TextCtrl ())] -> IO (TextCtrl ()) textCtrl parent props- = textCtrlEx parent (wxTE_MULTILINE .+. wxTE_RICH) props+ = textCtrlEx parent (wxTE_MULTILINE .+. getRichTE) props -- | Create a multi-line text rich-text control with a certain wrap mode@@ -356,7 +369,7 @@ -- textCtrlRich :: Window a -> [Prop (TextCtrl ())] -> IO (TextCtrl ()) textCtrlRich parent props- = textCtrlEx parent (wxTE_MULTILINE .+. wxTE_RICH2) props+ = textCtrlEx parent (wxTE_MULTILINE .+. getRichTE2) props -- | Create a generic text control given a certain style. --@@ -367,9 +380,10 @@ textCtrlEx parent stl props = feed2 props stl $ initialWindow $ \id rect ->+ initialText $ \txt -> initialWrap $ initialAlignment $ \props flags ->- do e <- textCtrlCreate parent id "" rect flags+ do e <- textCtrlCreate parent id txt rect flags set e props return e
src/Graphics/UI/WX/Window.hs view
@@ -131,7 +131,7 @@ = ifInstanceOf w classComboBox (\cb -> (comboBoxGetValue cb, \s -> do comboBoxClear cb; comboBoxAppend cb s)) $ ifInstanceOf w classTextCtrl- (\tc -> (textCtrlGetValue tc, \s -> do textCtrlClear tc; textCtrlWriteText tc s)) $+ (\tc -> (textCtrlGetValue tc, \s -> do textCtrlChangeValue tc s)) $ (windowGetLabel w,windowSetLabel w) appendText w s
wx.cabal view
@@ -1,5 +1,5 @@ Name: wx-Version: 0.90+Version: 0.90.0.1 License: OtherLicense License-file: license.txt Homepage: http://haskell.org/haskellwiki/WxHaskell