wx 0.10.5 → 0.10.6
raw patch · 17 files changed
+427/−254 lines, 17 files
Files
- src/Graphics/UI/WX.hs +10/−10
- src/Graphics/UI/WX/Attributes.hs +32/−32
- src/Graphics/UI/WX/Classes.hs +17/−16
- src/Graphics/UI/WX/Controls.hs +158/−29
- src/Graphics/UI/WX/Dialogs.hs +8/−8
- src/Graphics/UI/WX/Draw.hs +9/−9
- src/Graphics/UI/WX/Events.hs +39/−46
- src/Graphics/UI/WX/Frame.hs +25/−9
- src/Graphics/UI/WX/Layout.hs +15/−15
- src/Graphics/UI/WX/Media.hs +8/−8
- src/Graphics/UI/WX/Menu.hs +62/−28
- src/Graphics/UI/WX/Timer.hs +7/−7
- src/Graphics/UI/WX/TopLevelWindow.hs +14/−14
- src/Graphics/UI/WX/Types.hs +7/−7
- src/Graphics/UI/WX/Variable.hs +7/−7
- src/Graphics/UI/WX/Window.hs +8/−8
- wx.cabal +1/−1
src/Graphics/UI/WX.hs view
@@ -1,17 +1,17 @@ ---------------------------------------------------------------------------------{-| Module : WX- Copyright : (c) Daan Leijen 2003- License : wxWindows+{-| Module : WX+ Copyright : (c) Daan Leijen 2003+ License : wxWindows - Maintainer : daan@cs.uu.nl- Stability : provisional- Portability : portable+ Maintainer : wxhaskell-devel@lists.sourceforge.net+ Stability : provisional+ Portability : portable - The WX module just re-exports functionality from helper modules and- defines the 'start' function.+The WX module just re-exports functionality from helper modules and+defines the 'start' function. - The WX library provides a /haskellized/ interface to the raw wxWindows- functionality provided by the "Graphics.UI.WXCore" library.+The WX library provides a /haskellized/ interface to the raw wxWindows+functionality provided by the "Graphics.UI.WXCore" library. -} -------------------------------------------------------------------------------- module Graphics.UI.WX
src/Graphics/UI/WX/Attributes.hs view
@@ -1,56 +1,56 @@ {-# OPTIONS -fglasgow-exts #-} ---------------------------------------------------------------------------------{-| Module : Attributes- Copyright : (c) Daan Leijen 2003- License : wxWindows+{-| Module : Attributes+ Copyright : (c) Daan Leijen 2003+ License : wxWindows - Maintainer : daan@cs.uu.nl- Stability : provisional- Portability : portable+ Maintainer : wxhaskell-devel@lists.sourceforge.net+ Stability : provisional+ Portability : portable - Widgets @w@ can have attributes of type @a@ represented by the type 'Attr' @w a@.- An example of an attribute is 'Graphics.UI.WX.Classes.text' with type:+Widgets @w@ can have attributes of type @a@ represented by the type 'Attr' @w a@.+An example of an attribute is 'Graphics.UI.WX.Classes.text' with type: - > text :: Attr (Window a) String+> text :: Attr (Window a) String - This means that any object derived from 'Window' has a 'Graphics.UI.WX.Classes.text' attribute of type 'String'.- An attribute can be read with the 'get' function:+This means that any object derived from 'Window' has a 'Graphics.UI.WX.Classes.text' attribute of type 'String'.+An attribute can be read with the 'get' function: - > get w title :: IO String+> get w title :: IO String - When an attribute is associated with a value, we call it a /property/ of type 'Prop' @w@.- Properties are constructed by assigning a value to an attribute with the (':=') constructor:+When an attribute is associated with a value, we call it a /property/ of type 'Prop' @w@.+Properties are constructed by assigning a value to an attribute with the (':=') constructor: - > text := "hello world" :: Prop (Window a)+> text := "hello world" :: Prop (Window a) - A list of properties can be set with the 'set' function:+A list of properties can be set with the 'set' function: - > set w [text := "Hi"] :: IO ()+> set w [text := "Hi"] :: IO () - The (':~') constructor is used to transform an attribute value with an update function.- For example, the 'interval' on a timer can be doubled with the following expression.+The (':~') constructor is used to transform an attribute value with an update function.+For example, the 'interval' on a timer can be doubled with the following expression. - > set timer [interval :~ (*2)]+> set timer [interval :~ (*2)] - The functions 'get', 'set', (':='), and (':~') are polymorphic and work for all widgets, but- the @text@ attribute just works for windows. Many attributes work for different kind- of objects and are organised into type classes. Actually, the real type of the- 'Graphics.UI.WX.Classes.text' attribute is:+The functions 'get', 'set', (':='), and (':~') are polymorphic and work for all widgets, but+the @text@ attribute just works for windows. Many attributes work for different kind+of objects and are organised into type classes. Actually, the real type of the+'Graphics.UI.WX.Classes.text' attribute is: - > Textual w => Attr w String+> Textual w => Attr w String - and 'Window' derived objects are part of this class:+and 'Window' derived objects are part of this class: - > instance Textual (Window a)+> instance Textual (Window a) - But also menus and status fields:+But also menus and status fields: - > instance Textual (Menu a)- > instance Textual (StatusField)+> instance Textual (Menu a)+> instance Textual (StatusField) - Sometimes, it is convenient to also get a reference to the object itself when setting- a property. The operators ('::=') and ('::~') provide this reference.+Sometimes, it is convenient to also get a reference to the object itself when setting+a property. The operators ('::=') and ('::~') provide this reference. -} -------------------------------------------------------------------------------- module Graphics.UI.WX.Attributes
src/Graphics/UI/WX/Classes.hs view
@@ -1,24 +1,24 @@ {-# OPTIONS -fglasgow-exts #-} ---------------------------------------------------------------------------------{-| Module : Classes- Copyright : (c) Daan Leijen 2003- License : wxWindows+{-| Module : Classes+ Copyright : (c) Daan Leijen 2003+ License : wxWindows - Maintainer : daan@cs.uu.nl- Stability : provisional- Portability : portable+ Maintainer : wxhaskell-devel@lists.sourceforge.net+ Stability : provisional+ Portability : portable - This modules defines attributes common to many widgets and- organizes them into Haskell classes. Look at the instance definitions- to see what kind of widgets support the attributes. +This modules defines attributes common to many widgets and+organizes them into Haskell classes. Look at the instance definitions+to see what kind of widgets support the attributes. - Sometimes it is- hard to find what attributes a certain widget supports since the instance- definitions might be on some class higher in the hierarchy. For example,- many instances are defined for 'Window' @a@ -- this means that all- those attributes are applicable to any kind of 'Window', i.e. frames,- buttons, panels etc. However, these attributes will not be explicitly- listed at the type definitions of those classes.+Sometimes it is+hard to find what attributes a certain widget supports since the instance+definitions might be on some class higher in the hierarchy. For example,+many instances are defined for 'Window' @a@ -- this means that all+those attributes are applicable to any kind of 'Window', i.e. frames,+buttons, panels etc. However, these attributes will not be explicitly+listed at the type definitions of those classes. -} -------------------------------------------------------------------------------- module Graphics.UI.WX.Classes@@ -270,6 +270,7 @@ -- | Enable, or disable, the widget. enabled :: Attr w Bool +{-# DEPRECATED enable "Use enabled instead" #-} -- | Deprecated: use 'enabled' instead enable :: Able w => Attr w Bool enable = enabled
src/Graphics/UI/WX/Controls.hs view
@@ -1,22 +1,15 @@ {-# OPTIONS -fglasgow-exts #-} ---------------------------------------------------------------------------------{-| Module : Controls- Copyright : (c) Daan Leijen 2003- (c) Shelarcy (shelarcy@gmail.com) 2006- License : wxWindows-- Maintainer : daan@cs.uu.nl- Stability : provisional- Portability : portable+{-| Module : Controls+ Copyright : (c) Daan Leijen 2003+ (c) Shelarcy (shelarcy@gmail.com) 2006+ License : wxWindows - Defines common GUI controls.--}+ Maintainer : wxhaskell-devel@lists.sourceforge.net+ Stability : provisional+ Portability : portable -{-- Modification History:- When Who What- 300806 jeremy.odonoghue@gmail.com Set list item mask (wxLIST_MASK_TEXT)- (on behalf of shelarcy@gmail.com)+Defines common GUI controls. -} -------------------------------------------------------------------------------- module Graphics.UI.WX.Controls@@ -30,33 +23,34 @@ , focusOn -- * Controls -- ** Button- , Button, button, buttonEx, smallButton- , BitmapButton, bitmapButton+ , Button, button, buttonEx, smallButton, buttonRes+ , BitmapButton, bitmapButton, bitmapButtonRes -- ** Text entry , TextCtrl, entry, textEntry, textCtrl, textCtrlRich, textCtrlEx- , processEnter, processTab+ , textCtrlRes, processEnter, processTab -- ** CheckBox- , CheckBox, checkBox+ , CheckBox, checkBox, checkBoxRes -- ** Choice- , Choice, choice, choiceEx+ , Choice, choice, choiceEx, choiceRes -- ** ComboBox- , ComboBox, comboBox, comboBoxEx+ , ComboBox, comboBox, comboBoxEx, comboBoxRes -- ** ListBox- , ListBox, SingleListBox, MultiListBox, singleListBox, multiListBox+ , ListBox, SingleListBox, MultiListBox+ , singleListBox, singleListBoxRes, multiListBox, multiListBoxRes -- ** RadioBox- , RadioBox, radioBox+ , RadioBox, radioBox, radioBoxRes -- ** Spin Control- , SpinCtrl, spinCtrl+ , SpinCtrl, spinCtrl, spinCtrlRes -- ** Slider- , Slider, hslider, vslider, sliderEx+ , Slider, hslider, vslider, sliderEx, sliderRes -- ** Gauge- , Gauge, hgauge, vgauge, gaugeEx+ , Gauge, hgauge, vgauge, gaugeEx, gaugeRes -- ** Tree control- , TreeCtrl, treeCtrl, treeCtrlEx, treeEvent+ , TreeCtrl, treeCtrl, treeCtrlEx, treeEvent, treeCtrlRes -- ** List control- , ListCtrl, listCtrl, listCtrlEx, listEvent, columns+ , ListCtrl, listCtrl, listCtrlEx, listCtrlRes, listEvent, columns -- ** Static text- , StaticText, staticText+ , StaticText, staticText, staticTextRes -- ** SplitterWindow , SplitterWindow, splitterWindow -- ** ImageList@@ -182,6 +176,18 @@ set b props return b +-- | Complete the construction of a push button instance which has been loaded+-- from a resource file.+--+-- * Instances: 'Commanding' -- 'Textual', 'Literate', 'Dimensions', 'Colored', 'Visible', 'Child',+-- 'Able', 'Tipped', 'Identity', 'Styled', 'Reactive', 'Paint'.+--+buttonRes :: Window a -> String -> [Prop (Button ())] -> IO (Button ())+buttonRes parent name props =+ do b <- xmlResourceGetButton parent name+ set b props+ return b+ instance Commanding (Button a) where command = newEvent "command" buttonGetOnCommand buttonOnCommand @@ -199,6 +205,18 @@ set bb props return bb +-- | Complete the construction of a bitmap button instance which has been loaded+-- from a resource file.+--+-- * Instances: 'Commanding' -- 'Textual', 'Literate', 'Dimensions', 'Colored', 'Visible', 'Child',+-- 'Able', 'Tipped', 'Identity', 'Styled', 'Reactive', 'Paint'.+--+bitmapButtonRes :: Window a -> String -> [Prop (BitmapButton ())] -> IO (BitmapButton ())+bitmapButtonRes parent name props =+ do b <- xmlResourceGetBitmapButton parent name+ set b props+ return b+ instance Pictured (BitmapButton a) where picture = writeAttr "picture" setter@@ -351,6 +369,17 @@ set e props return e +-- | Complete the construction of a text control instance which has been loaded+-- from a resource file.+--+-- * Instances: 'Wrap', 'Aligned', 'Commanding' -- 'Textual', 'Literate', 'Dimensions', 'Colored', 'Visible', 'Child',+-- 'Able', 'Tipped', 'Identity', 'Styled', 'Reactive', 'Paint'.+--+textCtrlRes :: Window a -> String -> [Prop (TextCtrl ())] -> IO (TextCtrl ())+textCtrlRes parent name props =+ do t <- xmlResourceGetTextCtrl parent name+ set t props+ return t instance Commanding (TextCtrl a) where command = newEvent "command" textCtrlGetOnTextEnter textCtrlOnTextEnter@@ -397,6 +426,13 @@ set t props return t +-- | Complete the construction of a static text label instance which has been loaded+-- from a resource file.+staticTextRes :: Window a -> String -> [Prop (StaticText ())] -> IO (StaticText ())+staticTextRes parent name props =+ do t <- xmlResourceGetStaticText parent name+ set t props+ return t {-------------------------------------------------------------------------------- Check box@@ -425,6 +461,18 @@ set c props return c +-- | Complete the construction of a check box instance which has been loaded+-- from a resource file.+--+-- * Instances: 'Commanding','Checkable' -- 'Textual', 'Literate', 'Dimensions', 'Colored', 'Visible', 'Child',+-- 'Able', 'Tipped', 'Identity', 'Styled', 'Reactive', 'Paint'.+--+checkBoxRes :: Window a -> String -> [Prop (CheckBox ())] -> IO (CheckBox ())+checkBoxRes parent name props =+ do c <- xmlResourceGetCheckBox parent name+ set c props+ return c+ {-------------------------------------------------------------------------------- Choice --------------------------------------------------------------------------------}@@ -494,6 +542,14 @@ set c props return c +-- | Complete the construction of a choice instance which has been loaded+-- from a resource file.+choiceRes :: Window a -> String -> [Prop (Choice ())] -> IO (Choice ())+choiceRes parent name props =+ do c <- xmlResourceGetChoice parent name+ set c props+ return c+ {-------------------------------------------------------------------------------- ComboBox --------------------------------------------------------------------------------}@@ -557,6 +613,13 @@ set cb props return cb +-- | Complete the construction of a combo box instance which has been loaded+-- from a resource file.+comboBoxRes :: Window a -> String -> [Prop (ComboBox ())] -> IO (ComboBox ())+comboBoxRes parent name props =+ do c <- xmlResourceGetComboBox parent name+ set c props+ return c {-------------------------------------------------------------------------------- ListBox@@ -635,6 +698,15 @@ set sl props return sl +-- | Complete the construction of a single list box instance which has been loaded+-- from a resource file.+singleListBoxRes :: Window a -> String -> [Prop (SingleListBox ())] -> IO (SingleListBox ())+singleListBoxRes parent name props =+ do l <- xmlResourceGetListBox parent name+ let sl = (objectCast l :: SingleListBox())+ set sl props+ return sl+ -- | Create a multi selection list box. ---- -- * Instances: 'Sorted', 'Selecting','Selections','Items' -- 'Textual', 'Literate', 'Dimensions', 'Colored', 'Visible', 'Child',@@ -650,6 +722,15 @@ set ml props return ml +-- | Complete the construction of a single list box instance which has been loaded+-- from a resource file.+multiListBoxRes :: Window a -> String -> [Prop (MultiListBox ())] -> IO (MultiListBox ())+multiListBoxRes parent name props =+ do l <- xmlResourceGetListBox parent name+ let ml = (objectCast l :: MultiListBox())+ set ml props+ return ml+ {-------------------------------------------------------------------------------- RadioBox --------------------------------------------------------------------------------}@@ -690,6 +771,14 @@ set r props return r +-- | Complete the construction of a radio box instance which has been loaded+-- from a resource file.+radioBoxRes :: Window a -> String -> [Prop (RadioBox ())] -> IO (RadioBox ())+radioBoxRes parent name props =+ do rb <- xmlResourceGetRadioBox parent name+ set rb props+ return rb+ {-------------------------------------------------------------------------------- Gauge --------------------------------------------------------------------------------}@@ -725,6 +814,13 @@ set g props return g +-- | Complete the construction of a gauge instance which has been loaded+-- from a resource file.+gaugeRes :: Window a -> String -> [Prop (Gauge ())] -> IO (Gauge ())+gaugeRes parent name props =+ do g <- xmlResourceGetGauge parent name+ set g props+ return g instance Selection (Gauge a) where selection@@ -779,6 +875,14 @@ set s props return s +-- | Complete the construction of a slider instance which has been loaded+-- from a resource file.+sliderRes :: Window a -> String -> [Prop (Slider ())] -> IO (Slider ())+sliderRes parent name props =+ do s <- xmlResourceGetSlider parent name+ set s props+ return s+ instance Selection (Slider a) where selection = newAttr "selection" getter setter@@ -813,6 +917,15 @@ set sc props return sc +-- | Complete the construction of a spin control instance which has been loaded+-- from a resource file.+spinCtrlRes :: Window a -> String -> [Prop (SpinCtrl ())] -> IO (SpinCtrl ())+spinCtrlRes parent name props =+ do s <- xmlResourceGetSpinCtrl parent name+ set s props+ return s++ instance Selection (SpinCtrl a) where selection = newAttr "selection" getter setter@@ -868,6 +981,14 @@ set t props return t +-- | Complete the construction of a tree control instance which has been loaded+-- from a resource file.+treeCtrlRes :: Window a -> String -> [Prop (TreeCtrl ())] -> IO (TreeCtrl ())+treeCtrlRes parent name props =+ do t <- xmlResourceGetTreeCtrl parent name+ set t props+ return t+ {-------------------------------------------------------------------------------- ListCtrl --------------------------------------------------------------------------------}@@ -970,6 +1091,14 @@ = feed2 props style $ initialContainer $ \id rect -> \props flags -> do l <- listCtrlCreate parent id rect flags+ set l props+ return l++-- | Complete the construction of a list control instance which has been loaded+-- from a resource file.+listCtrlRes :: Window a -> String -> [Prop (ListCtrl ())] -> IO (ListCtrl ())+listCtrlRes parent name props =+ do l <- xmlResourceGetListCtrl parent name set l props return l
src/Graphics/UI/WX/Dialogs.hs view
@@ -1,16 +1,16 @@ {-# OPTIONS -fglasgow-exts #-} ---------------------------------------------------------------------------------{-| Module : Dialogs- Copyright : (c) Daan Leijen 2003- License : wxWindows+{-| Module : Dialogs+ Copyright : (c) Daan Leijen 2003+ License : wxWindows - Maintainer : daan@cs.uu.nl- Stability : provisional- Portability : portable+ Maintainer : wxhaskell-devel@lists.sourceforge.net+ Stability : provisional+ Portability : portable - Defines common dialogs.+Defines common dialogs. - * Instances: 'Form', 'Framed' -- +* Instances: 'Form', 'Framed' -- 'Textual', 'Literate', 'Dimensions', 'Colored', 'Visible', 'Child', 'Able', 'Tipped', 'Identity', 'Styled', 'Reactive', 'Paint'. -}
src/Graphics/UI/WX/Draw.hs view
@@ -1,17 +1,17 @@ {-# OPTIONS -fglasgow-exts #-} ---------------------------------------------------------------------------------{-| Module : Draw- Copyright : (c) Daan Leijen 2003- License : wxWindows+{-| Module : Draw+ Copyright : (c) Daan Leijen 2003+ License : wxWindows - Maintainer : daan@cs.uu.nl- Stability : provisional- Portability : portable+ Maintainer : wxhaskell-devel@lists.sourceforge.net+ Stability : provisional+ Portability : portable - Drawing.+Drawing. - A /Device Context/ or 'DC', is an instance of 'Drawn', 'Brushed',- 'Literate', and 'Colored'.+A /Device Context/ or 'DC', is an instance of 'Drawn', 'Brushed',+'Literate', and 'Colored'. -} -------------------------------------------------------------------------------- module Graphics.UI.WX.Draw
src/Graphics/UI/WX/Events.hs view
@@ -1,65 +1,58 @@ {-# OPTIONS -fglasgow-exts #-} ---------------------------------------------------------------------------------{-| Module : Events- Copyright : (c) Daan Leijen 2003- (c) Shelarcy (shelarcy@gmail.com) 2006- License : wxWindows-- Maintainer : daan@cs.uu.nl- Stability : provisional- Portability : portable+{-| Module : Events+ Copyright : (c) Daan Leijen 2003+ (c) Shelarcy (shelarcy@gmail.com) 2006+ License : wxWindows - Define event handling. Events are parametrised by the widget that can- correspond to a certain event and the type of the event handler.- For example, the 'resize' event has type:+ Maintainer : wxhaskell-devel@lists.sourceforge.net+ Stability : provisional+ Portability : portable - > Reactive w => Event w (IO ())+Define event handling. Events are parametrised by the widget that can+correspond to a certain event and the type of the event handler.+For example, the 'resize' event has type: - This means that all widgets in the 'Reactive' class can respond to- 'resize' events. (and since 'Window' is an instance of this class, this- means that basically all visible widgets are reactive).+> Reactive w => Event w (IO ()) - An @Event w a@ can be transformed into an attribute of type 'Attr' @w a@- using the 'on' function.+This means that all widgets in the 'Reactive' class can respond to+'resize' events. (and since 'Window' is an instance of this class, this+means that basically all visible widgets are reactive). - > do f <- frame [text := "test"]- > set f [on resize := set f [text := "resizing"]]+An @Event w a@ can be transformed into an attribute of type 'Attr' @w a@+using the 'on' function. - For convenience, the 'mouse' and 'keyboard' have a serie of /event filters/:- 'click', 'drag', 'enterKey', 'charKey', etc. These filters are write-only- and do not overwrite any previous mouse or keyboard handler but all stay- active at the same time. However, all filter will be overwritten again- when 'mouse' or 'keyboard' is set again. For example, the following program- makes sense:+> do f <- frame [text := "test"]+> set f [on resize := set f [text := "resizing"]] - > set w [on click := ..., on drag := ...]+For convenience, the 'mouse' and 'keyboard' have a serie of /event filters/:+'click', 'drag', 'enterKey', 'charKey', etc. These filters are write-only+and do not overwrite any previous mouse or keyboard handler but all stay+active at the same time. However, all filter will be overwritten again+when 'mouse' or 'keyboard' is set again. For example, the following program+makes sense: - But in the following program, only the handler for 'mouse' will be called:+> set w [on click := ..., on drag := ...] - > set w [on click := ..., on mouse := ...]+But in the following program, only the handler for 'mouse' will be called: - If you want to set the 'mouse' later but retain the old event filters,- you can first read the current 'mouse' handler and call it in the - new handler (and the same for the 'keyboard' of course). This implemenation- technique is used to implement event filters themselves and is also- very useful when setting an event handler for a 'closing' event:+> set w [on click := ..., on mouse := ...] - > set w [on closing :~ \previous -> do{ ...; previous }]+If you want to set the 'mouse' later but retain the old event filters,+you can first read the current 'mouse' handler and call it in the +new handler (and the same for the 'keyboard' of course). This implemenation+technique is used to implement event filters themselves and is also+very useful when setting an event handler for a 'closing' event: - Note that you should call 'propagateEvent' (or 'Graphics.UI.WXCore.Events.skipCurrentEvent') whenever- you do not process the event yourself in an event handler. This propagates- the event to the parent event handlers and give them a chance to- handle the event in an appropiate way. This gives another elegant way to install- a 'closing' event handler:+> set w [on closing :~ \previous -> do{ ...; previous }] - > set w [on closing := do{ ...; propagateEvent }]--}+Note that you should call 'propagateEvent' (or 'Graphics.UI.WXCore.Events.skipCurrentEvent') whenever+you do not process the event yourself in an event handler. This propagates+the event to the parent event handlers and give them a chance to+handle the event in an appropiate way. This gives another elegant way to install+a 'closing' event handler: -{-- Modification History:- When Who What- 300806 jeremy.odonoghue@gmail.com Add support for calendar event- (on behalf of shelarcy@gmail.com)+> set w [on closing := do{ ...; propagateEvent }] -} -------------------------------------------------------------------------------- module Graphics.UI.WX.Events
src/Graphics/UI/WX/Frame.hs view
@@ -1,17 +1,17 @@ {-# OPTIONS -fglasgow-exts #-} ---------------------------------------------------------------------------------{-| Module : Frame- Copyright : (c) Daan Leijen 2003- Copyright : (c) Jeremy O'Donoghue 2007- License : wxWindows+{-| Module : Frame+ Copyright : (c) Daan Leijen 2003+ (c) Jeremy O'Donoghue 2007+ License : wxWindows - Maintainer : daan@cs.uu.nl- Stability : provisional- Portability : portable+ Maintainer : wxhaskell-devel@lists.sourceforge.net+ Stability : provisional+ Portability : portable - Frames.+Frames. - * Instances: 'HasImage', 'Form', 'Closeable', 'Framed' -- +* Instances: 'HasImage', 'Form', 'Closeable', 'Framed' -- 'Textual', 'Literate', 'Dimensions', 'Colored', 'Visible', 'Child', 'Able', 'Tipped', 'Identity', 'Styled', 'Reactive', 'Paint', 'HasDefault'.@@ -22,6 +22,7 @@ module Graphics.UI.WX.Frame ( -- * Frames Frame, frame, frameFixed, frameTool, frameEx+ , frameLoadRes, frameLoadChildRes , initialFrame -- * MDI Frames , MDIParentFrame, MDIChildFrame@@ -76,6 +77,21 @@ set f props return f +-- | Complete the construction of a top level frame which has been loaded+-- from a resource file.+frameLoadRes :: FilePath -> String -> [Prop (Frame ())] -> IO (Frame ())+frameLoadRes rc name props = + frameLoadChildRes objectNull rc name props++-- | Complete the construction of a frame whcih is the child of some+-- existing parent window.+frameLoadChildRes :: Window a -> FilePath -> String -> [Prop (Frame ())] -> IO (Frame ())+frameLoadChildRes parent rc name props =+ do res <- xmlResourceCreateFromFile rc wxXRC_USE_LOCALE+ f <- xmlResourceLoadFrame res parent name+ set f props+ return f+ -- | initial Frame flags initialFrame :: (Id -> Rect -> String -> [Prop (Window w)] -> Style -> a) -> [Prop (Window w)] -> Style -> a initialFrame cont
src/Graphics/UI/WX/Layout.hs view
@@ -1,24 +1,24 @@ {-# OPTIONS -fglasgow-exts #-} ------------------------------------------------------------------------------------------{-| Module : Layout- Copyright : (c) Daan Leijen 2003- License : BSD-style+{-| Module : Layout+ Copyright : (c) Daan Leijen 2003+ License : BSD-style - Maintainer : daan@cs.uu.nl- Stability : provisional- Portability : portable+ Maintainer : wxhaskell-devel@lists.sourceforge.net+ Stability : provisional+ Portability : portable - Just re-exports functionality of "Graphics.UI.WXCore.Layout". See that module- for a description of layout combinators. +Just re-exports functionality of "Graphics.UI.WXCore.Layout". See that module+for a description of layout combinators. - Any object in the 'Form' class has a 'layout' attribute to specify the - layout. Here is a short example:+Any object in the 'Form' class has a 'layout' attribute to specify the +layout. Here is a short example: - > do f <- frame [text := "layout demo"]- > q <- button f [text := "quit", on command := close f]- > set f [layout := margin 10 $- > floatCentre $- > column 5 [label "hi",widget q]]+> do f <- frame [text := "layout demo"]+> q <- button f [text := "quit", on command := close f]+> set f [layout := margin 10 $+> floatCentre $+> column 5 [label "hi",widget q]] -} -----------------------------------------------------------------------------------------
src/Graphics/UI/WX/Media.hs view
@@ -1,15 +1,15 @@ {-# OPTIONS -fglasgow-exts #-} ---------------------------------------------------------------------------------{-| Module : Media- Copyright : (c) Daan Leijen 2003- Copyright : (c) shelarcy 2007- License : wxWindows+{-| Module : Media+ Copyright : (c) Daan Leijen 2003+ (c) shelarcy 2007+ License : wxWindows - Maintainer : shelarcy@gmail.com- Stability : provisional- Portability : portable+ Maintainer : wxhaskell-devel@lists.sourceforge.net+ Stability : provisional+ Portability : portable - Images, Media, Sounds, and action!+Images, Media, Sounds, and action! -} -------------------------------------------------------------------------------- module Graphics.UI.WX.Media
src/Graphics/UI/WX/Menu.hs view
@@ -1,46 +1,41 @@ {-# OPTIONS -fglasgow-exts #-} ---------------------------------------------------------------------------------{-| Module : Menu- Copyright : (c) Daan Leijen 2003- (c) Shelarcy (shelarcy@gmail.com) 2006- License : wxWindows+{-| Module : Menu+ Copyright : (c) Daan Leijen 2003+ (c) Shelarcy (shelarcy@gmail.com) 2006+ License : wxWindows - Maintainer : daan@cs.uu.nl- Stability : provisional- Portability : portable+ Maintainer : wxhaskell-devel@lists.sourceforge.net+ Stability : provisional+ Portability : portable - Defines Menus, toolbars, and statusbars.+Defines Menus, toolbars, and statusbars. - The function 'menuPane' is used to create a menu- that can contain 'menuItem's. Menu items can contain event handlers- using ('on' 'command'), but they can also be set, using the 'menu'- function, on a frame or (mdi) window so that the menu command is handled- in the context of the active window instead of the context of the- entire application. +The function 'menuPane' is used to create a menu+that can contain 'menuItem's. Menu items can contain event handlers+using ('on' 'command'), but they can also be set, using the 'menu'+function, on a frame or (mdi) window so that the menu command is handled+in the context of the active window instead of the context of the+entire application. - > do frame <- frame [text := "Demo"]- > file <- menuPane [text := "&File"]- > mclose <- menuItem file [text := "&Close\tCtrl+C", help := "Close the document"] - > set frame [menuBar := [file] - > ,on (menu mclose) := ...] +> do frame <- frame [text := "Demo"]+> file <- menuPane [text := "&File"]+> mclose <- menuItem file [text := "&Close\tCtrl+C", help := "Close the document"] +> set frame [menuBar := [file] +> ,on (menu mclose) := ...] -}-{-- Modification History:- When Who What- 300806 jeremy.odonoghue@gmail.com Add support for toolbar divider- (on behalf of shelarcy@gmail.com)--} -------------------------------------------------------------------------------- module Graphics.UI.WX.Menu ( -- * Menu -- ** Menu containers MenuBar, Menu, menuBar, menuPopup, menuPane, menuHelp+ , menuRes, menuBarLoadRes -- ** Menu events , menu, menuId -- ** Menu items , MenuItem, menuItem, menuQuit, menuAbout, menuItemEx- , menuLine, menuSub, menuRadioItem+ , menuItemOnCommandRes, menuLine, menuSub, menuRadioItem -- * Tool bar , ToolBar, toolBar, toolBarEx , ToolBarItem, toolMenu, toolItem, toolControl, tool@@ -66,6 +61,7 @@ {-------------------------------------------------------------------------------- Menubar --------------------------------------------------------------------------------}+{-# DEPRECATED menubar "Use menuBar instead" #-} -- | /Deprecated/: use 'menuBar'. menubar :: WriteAttr (Frame a) [Menu ()] menubar@@ -95,6 +91,15 @@ menuSetTitle menu "" menuBarAppend mb menu title +-- | Retrieve a menu bar instance which has been constructed by loading+-- a resource file for a given top level window.+menuBarLoadRes :: Window a -> FilePath -> String -> IO (MenuBar ())+menuBarLoadRes parent rc name =+ do+ res <- xmlResourceCreateFromFile rc wxXRC_USE_LOCALE+ m <- xmlResourceLoadMenuBar res parent name+ return m+ -- | Show a popup menu for a certain window. menuPopup :: Menu b -> Point -> Window a -> IO () menuPopup menu pt parent@@ -104,6 +109,7 @@ {-------------------------------------------------------------------------------- Menu --------------------------------------------------------------------------------}+{-# DEPRECATED menuList "Use menuPane instead" #-} -- | /Deprecated/: use 'menuPane'. menuList :: [Prop (Menu ())] -> IO (Menu ()) menuList @@ -125,6 +131,19 @@ menuHelp props = menuPane ([text := "&Help"] ++ props) +-- | Complete the construction of a menu which has been loaded+-- from a resource file.+-- | Get a menu by name from a menu loaded from a resource file, +-- given the frame which owns the menu. You+-- can directly set properties on the item as part of the call, which+-- enables simple connection of event handlers (e.g. on command).+menuRes :: Window a -> String -> [Prop (Menu ())] -> IO (Menu ())+menuRes parent menu_name props =+ do+ menu <- xmlResourceGetMenu parent menu_name+ set menu props+ return menu+ instance Textual (Menu a) where text = newAttr "text" menuGetTitle menuSetTitle@@ -145,7 +164,7 @@ menuSetTitle menu "" -- remove title on submenus menuAppendSub parent id label menu "" menuPropagateEvtHandlers menu -- move the evtHandlers to the parent- item <- menuFindItem parent id nullPtr+ item <- menuFindItem parent id set item props return item @@ -240,7 +259,7 @@ = do if (kind == wxITEM_RADIO) then menuAppendRadioItem menu id label "" else menuAppend menu id label "" (kind == wxITEM_CHECK)- item <- menuFindItem menu id nullPtr+ item <- menuFindItem menu id set item props return item @@ -317,7 +336,21 @@ insert key val ((k,v):xs) | key == k = (key,val):xs | otherwise = (k,v):insert key val xs +-- | When setting event handlers on menu items which have been loaded from+-- XRC resource files, properties cannot be used as the menu item+-- instances are opaque to wxHaskell.+--+-- This function offers a convenient way to attach menu item event+-- handlers, given the identity of the window which owns the menu containing+-- the menu item, and the name of the menu item +menuItemOnCommandRes :: Window a -> String -> IO () -> IO ()+menuItemOnCommandRes win item_name handler =+ do+ res <- xmlResourceGet+ item_id <- xmlResourceGetXRCID res item_name+ evtHandlerOnMenuCommand win item_id handler+ -- Propagate the (delayed) event handlers of a submenu to the parent menu. -- This is necessary for event handlers set on menu items in a submenu that -- was not yet assigned to a parent menu.@@ -599,6 +632,7 @@ +{-# DEPRECATED statusbar "Use statusBar instead" #-} -- | /Deprecated/: use 'statusBar'. statusbar :: WriteAttr (Frame a) [StatusField] statusbar
src/Graphics/UI/WX/Timer.hs view
@@ -1,14 +1,14 @@ {-# OPTIONS -fglasgow-exts #-} ---------------------------------------------------------------------------------{-| Module : Timer- Copyright : (c) Daan Leijen 2003- License : wxWindows+{-| Module : Timer+ Copyright : (c) Daan Leijen 2003+ License : wxWindows - Maintainer : daan@cs.uu.nl- Stability : provisional- Portability : portable+ Maintainer : wxhaskell-devel@lists.sourceforge.net+ Stability : provisional+ Portability : portable - Support for milli-second timers.+Support for milli-second timers. -} -------------------------------------------------------------------------------- module Graphics.UI.WX.Timer
src/Graphics/UI/WX/TopLevelWindow.hs view
@@ -1,23 +1,23 @@ {-# OPTIONS -fglasgow-exts #-} -------------------------------------------------------------------------------- -{-| Module : TopLevelWindow - Copyright : (c) Jeremy O'Donoghue, 2007 - License : wxWindows +{-| Module : TopLevelWindow + Copyright : (c) Jeremy O'Donoghue, 2007 + License : wxWindows - Maintainer : jeremy.odonoghue@gamil.com - Stability : provisional - Portability : portable + Maintainer : wxhaskell-devel@lists.sourceforge.net + Stability : provisional + Portability : portable - wxTopLevelwindow (wxWidgets >= 2.8.0) defines an (abstract) common base class - for wxFrame and wxDialog. +wxTopLevelwindow (wxWidgets >= 2.8.0) defines an (abstract) common base class +for wxFrame and wxDialog. - In the wxHaskell implementation, TopLevel has been added to encapsulate - some of the common functionality between the 'Dialog' and 'Frame' modules. +In the wxHaskell implementation, TopLevel has been added to encapsulate +some of the common functionality between the 'Dialog' and 'Frame' modules. - * Instances: 'HasDefault' - * Instances inherited from 'Window': 'Textual', 'Literate', 'Dimensions', - 'Colored', 'Visible', 'Child', 'Able', 'Tipped', 'Identity', - 'Styled', 'Reactive', 'Paint'. +* Instances: 'HasDefault' +* Instances inherited from 'Window': 'Textual', 'Literate', 'Dimensions', + 'Colored', 'Visible', 'Child', 'Able', 'Tipped', 'Identity', + 'Styled', 'Reactive', 'Paint'. -} --------------------------------------------------------------------------------
src/Graphics/UI/WX/Types.hs view
@@ -1,14 +1,14 @@ {-# OPTIONS -fglasgow-exts #-} ---------------------------------------------------------------------------------{-| Module : Types- Copyright : (c) Daan Leijen 2003- License : wxWindows+{-| Module : Types+ Copyright : (c) Daan Leijen 2003+ License : wxWindows - Maintainer : daan@cs.uu.nl- Stability : provisional- Portability : portable+ Maintainer : wxhaskell-devel@lists.sourceforge.net+ Stability : provisional+ Portability : portable - Basic types.+Basic types. -} -------------------------------------------------------------------------------- module Graphics.UI.WX.Types
src/Graphics/UI/WX/Variable.hs view
@@ -1,13 +1,13 @@ ---------------------------------------------------------------------------------{-| Module : Variable- Copyright : (c) Daan Leijen 2003- License : wxWindows+{-| Module : Variable+ Copyright : (c) Daan Leijen 2003+ License : wxWindows - Maintainer : daan@cs.uu.nl- Stability : provisional- Portability : portable+ Maintainer : wxhaskell-devel@lists.sourceforge.net+ Stability : provisional+ Portability : portable - Mutable variables.+Mutable variables. -} -------------------------------------------------------------------------------- module Graphics.UI.WX.Variable
src/Graphics/UI/WX/Window.hs view
@@ -1,16 +1,16 @@ {-# OPTIONS -fglasgow-exts #-} ---------------------------------------------------------------------------------{-| Module : Window- Copyright : (c) Daan Leijen 2003- License : wxWindows+{-| Module : Window+ Copyright : (c) Daan Leijen 2003+ License : wxWindows - Maintainer : daan@cs.uu.nl- Stability : provisional- Portability : portable+ Maintainer : wxhaskell-devel@lists.sourceforge.net+ Stability : provisional+ Portability : portable - Exports default instances for generic windows.+Exports default instances for generic windows. - * Instances: 'Textual', 'Literate', 'Dimensions', 'Colored', 'Visible', 'Child', +* Instances: 'Textual', 'Literate', 'Dimensions', 'Colored', 'Visible', 'Child', 'Able', 'Tipped', 'Identity', 'Styled', 'Reactive', 'Paint'. -} --------------------------------------------------------------------------------
wx.cabal view
@@ -1,5 +1,5 @@ Name: wx-Version: 0.10.5+Version: 0.10.6 License: LGPL License-file: license.txt Author: Daan Leijen