Browse files

[wxhaskell-from-cvs @ 2003-10-01 09:13:27 by dleijen]

New samples + moved stuff to contrib directory

darcs-hash:20031001091329-deb31-88082473d84b57a71cf76c3fcdd59b0456425c34.gz
  • Loading branch information...
1 parent 2114dd1 commit 300e42515422f262963ed288babc6c36e8263f49 dleijen committed Oct 1, 2003
View
0 samples/wx/desert.bmp → samples/bitmaps/desert.bmp
File renamed without changes.
View
2 samples/wx/Camels.hs → samples/contrib/Camels.hs
@@ -63,7 +63,7 @@ main = start gui
gui :: IO ()
gui
= do desert <- varCreate (newBoard 3)
- b <- bitmapCreateLoad "desert.bmp" wxBITMAP_TYPE_ANY
+ b <- bitmapCreateLoad "../bitmaps/desert.bmp" wxBITMAP_TYPE_BMP
f <- frame [ text := "Camels", on closing := do bitmapDelete b; propagateEvent ]
q <- button f [ text := "quit" , on command := close f ]
h <- button f [ text := "help" , on command := chelp f ]
View
69 samples/contrib/NotebookRight.hs
@@ -0,0 +1,69 @@
+{-|
+ Author : Luc Taesch 2003
+ Portability : portable ? (tested on XP)
+
+ Illustrate more controls from wxHaskell, Hacked from Controls.hs ( Daan Leijen 2003)
+ namely bitmapButtons, righ click menus, vertical labels on notebooks, usage of tooltips
+-}
+
+module Main where
+
+import Graphics.UI.WX
+import Graphics.UI.WXCore
+
+main :: IO ()
+main
+ = start gui
+
+gui :: IO ()
+gui
+ = do -- main gui elements: frame, panel, text control, and the notebook
+ f <- frame [text := "Controls" ]
+ p <- panel f []
+
+ -- use text control as logger
+ textlog <- textCtrl p WrapLine [enable := False]
+ textCtrlMakeLogActiveTarget textlog
+ logMessage "logging enabled"
+
+ -- menu
+ file <- menuPane [text := "&File"]
+ aRightClick <- menuItem file [text := "Say Something\tCtrl+Q", help := "An interesting Message"]
+
+ -- button page
+ nb <- notebookRight p []
+ p1 <- panel nb []
+ ok <- bitmapButton p1 [image := "../bitmaps/wxwin16.png",
+ text := "Ok", on command := logMessage "bitmap button pressed",
+ tooltip := "tooltip",
+ on clickRight := (\pt -> menuPopup file pt p)]
+
+
+ -- specify layout
+ set f [menubar := [file]
+ ,layout :=
+ container p $
+ column 0
+ [ tabs nb
+ [tab "buttons" (container p1 $ margin 10 $ floatCentre $ row 5 $ [widget ok])
+ ]
+ , hfill $ widget textlog
+ ]
+ , on (menu aRightClick) := infoDialog f "Say.." "Something"
+ , clientSize := sz 400 300 ]
+ return ()
+
+ where
+ logSelect labels w
+ = do i <- get w selection
+ s <- get w (item i)
+ logMessage ("selected index: " ++ show i ++ ": " ++ s)
+
+
+
+-- like notebook, with labels created on the side ( rather than on top): wxNB_RIGHT
+notebookRight parent props
+ = do nb <- notebookCreate parent idAny rectNull ( wxCLIP_CHILDREN + wxNB_RIGHT)
+ set nb props
+ return nb
+
View
6 samples/wx/PaintDirect.hs → samples/contrib/PaintDirect.hs
@@ -1,3 +1,9 @@
+{--------------------------------------------------------------------------------
+ Author: Daan Leijen
+ Demo that shows how one can manipulate pixels directly in an image
+ to do fast customized drawing.
+--------------------------------------------------------------------------------}
+
module Main where
import Graphics.UI.WXCore

0 comments on commit 300e425

Please sign in to comment.