gtk2hs-hello (empty) → 1.0.0.0
raw patch · 4 files changed
+94/−0 lines, 4 filesdep +basedep +glibdep +gtk3setup-changed
Dependencies added: base, glib, gtk3, transformers
Files
- LICENSE +23/−0
- Setup.hs +6/−0
- gtk2hs-hello.cabal +31/−0
- src/hello.hs +34/−0
+ LICENSE view
@@ -0,0 +1,23 @@+The MIT License (MIT)++Copyright (c) 2014 Hamish Mackenzie++Permission is hereby granted, free of charge, to any person obtaining+a copy of this software and associated documentation files (the+"Software"), to deal in the Software without restriction, including+without limitation the rights to use, copy, modify, merge, publish,+distribute, sublicense, and/or sell copies of the Software, and to+permit persons to whom the Software is furnished to do so, subject to+the following conditions:++The above copyright notice and this permission notice shall be+included in all copies or substantial portions of the Software.++THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND+NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE+LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION+OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION+WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.+
+ Setup.hs view
@@ -0,0 +1,6 @@+module Main (main) where++import Distribution.Simple++main :: IO ()+main = defaultMain
+ gtk2hs-hello.cabal view
@@ -0,0 +1,31 @@+name: gtk2hs-hello+version: 1.0.0.0+license: MIT+license-file: LICENSE+copyright: (c) Hamish Mackenzie+author: Hamish Mackenzie+maintainer: Hamish Mackenzie <Hamish.K.Mackenzie@gmail.com>+bug-reports: mailto:Hamish.K.Mackenzie@gmail.com+stability: stable+homepage: http://www.haskell.org/hello/+synopsis: Gtk2Hs Hello World, an example package+category: Graphics+cabal-version: >= 1.6+build-type: Simple++Description:+ This is an implementation of the classic "Hello World" program in+ Haskell using Gtk2Hs, as an example of how to create a minimal Gtk2Hs+ application. Please submit any suggestions and improvements.++source-repository head+ type: git+ location: https://github.com/gtk2hs/gtk2hs-hello++executable gtk2hs-hello+ hs-source-dirs: src+ main-is: hello.hs+ build-depends: base >= 4.2 && < 5,+ transformers >= 0.3.0.0 && < 0.4,+ gtk3 >= 0.12.5.6 && < 0.13,+ glib >= 0.12 && < 0.13
+ src/hello.hs view
@@ -0,0 +1,34 @@+module Main (main) where++import Graphics.UI.Gtk+ (dialogRun, messageDialogNew, containerAdd, widgetShowAll,+ widgetDestroy, windowTitle, mainGUI, mainQuit, objectDestroy,+ buttonActivated, buttonLabel, containerChild, on,+ containerBorderWidth, buttonNew, windowNew, initGUI, set,+ AttrOp(..), ButtonsType(..), MessageType(..))++main :: IO ()+main = do+ -- Initialise Gtk.+ initGUI+ -- Make our main window.+ window <- windowNew+ -- When the window is destroyed quit the application.+ on window objectDestroy mainQuit+ -- Set the border width and title of the window.+ set window [ containerBorderWidth := 10, windowTitle := "Hello, World!" ]+ -- Make a "Hello, World!" button.+ button <- buttonNew+ set button [ buttonLabel := "Hello, World!" ]+ -- When the button is clicked pop up a "Hello, World!" message dialog box.+ on button buttonActivated $ do+ md <- messageDialogNew (Just window) [] MessageInfo ButtonsOk "Hello, World!"+ set md [ windowTitle := "Hello, World!" ]+ dialogRun md+ widgetDestroy md+ -- Add the button into the window.+ containerAdd window button+ -- Show the window (otherwise it will remain hidden).+ widgetShowAll window+ -- Start the main loop (this will continue until mainQuit is called).+ mainGUI