Difference between revisions of "LGtk"

From HaskellWiki
Jump to navigation Jump to search
(→‎External links: remove dead link)
 
(37 intermediate revisions by the same user not shown)
Line 1: Line 1:
  +
[[Category:User interfaces]]
== What is it? ==
 
   
LGtk is a lens-based API for Gtk.
+
LGtk is a GUI Toolkit.
LGtk is built on Gtk2Hs.
 
   
  +
Main goals of LGtk:
Most Haskellers would like to use a mature FRP-based API for creating graphical user interfaces.
 
FRP may not be the best tool for special user interfaces, like interfaces which consists of buttons, checkboxes, combo boxes, text entries and menus only.
 
LGtk has a lens-based API which fits better these user interfaces.
 
   
  +
* Provide a Haskell EDSL for declarative description of interactive graphical applications
== Demo application ==
 
  +
* Provide an API for custom widget design
 
  +
* Provide a playground for high-level declarative features like derived state-save and undo-redo operations and type-driven GUI generation
You can try the demo application with the following commands:
 
 
cabal install gtk2hs-buildtools
 
cabal install lgtk
 
lgtkdemo
 
 
== Features ==
 
 
Features of lgtk-0.5
 
 
* The API is closed, you can safely use any constructs as long as you obey the documented laws.
 
* Support for asynchronous events. Using LGtk is a safe way for writing multithreaded Gtk applications.
 
 
== Examples ==
 
 
=== Hello World ===
 
 
<haskell>
 
main = runWidget $ label $ return "Hello World!"
 
</haskell>
 
 
<hask>return</hask> is neded because labels may be dynamic, see the next examples.
 
 
=== Copy ===
 
 
The following applications presents an entry and a label below.
 
When a text is entered in the entry, the label is changed to the entered text.
 
 
<haskell>
 
main = runWidget $ action $ do
 
r <- newRef "enter text here"
 
return $ vcat
 
[ entry r
 
, label $ readRef r
 
]
 
</haskell>
 
 
<hask>action</hask> gives acces to a monad in which new references can be made by <hask>newRef</hask>.
 
A crutial feature of LGtk is that you cannot change the value of references in this monad (you can read them though).
 
 
<hask>action</hask> gives acces to a monad in which you can read references but no reference creation or write is possible.
 
 
=== Addition ===
 
 
Two entries of integers and a label which shows the sum:
 
 
<haskell>
 
main = runWidget $ action $ do
 
r1 <- newRef (12 :: Integer)
 
r2 <- newRef 4
 
return $ vcat
 
[ entryShow r1
 
, entryShow r2
 
, label $ liftM2 (+) (readRef r1) (readRef r2)
 
]
 
</haskell>
 
 
=== Complex examples ===
 
 
You can find a more complex examples in the source code of LGtk.
 
More examples will be presented here also.
 
   
 
[[Image:Lgtkdemo.png]]
 
[[Image:Lgtkdemo.png]]
   
== Status ==
+
== Internal links ==
   
  +
Should be revised:
LGtk is actively developed. The semantics is getting stable but it is not yet documented.
 
   
  +
* [[LGtk/Semantics]]
TODO list:
 
  +
* [[LGtk/ADT_lenses]]
   
  +
== External links ==
* Add an efficient implementation for LGtk. LGtk has only a reference implementation currently.
 
* Add support for styles (layout, colors, etc).
 
* Support more Gtk constructs.
 
   
  +
* [http://hackage.haskell.org/package/lgtk Haddock documentation on HackageDB]
  +
* [https://github.com/divipp/lgtk GitHub repository]
  +
* [http://people.inf.elte.hu/divip/LGtk/LGtk.html Initial announcement]
  +
* [http://www.haskell.org/haskellwiki/LGtk haskell.org wiki page (this page)]
   
  +
Related Stackoverflow questions:
== Changelog ==
 
   
  +
* [http://stackoverflow.com/questions/16123588/what-is-this-special-functor-structure-called What is this special functor structure called?]
=== lgtk-0.5 ===
 
  +
* [http://stackoverflow.com/questions/16769579/howto-abort-getchar-safely Howto abort getChar safely?]
   
  +
Reddit comments:
* Do not use monadic lenses any more.
 
* Support for asynchronous events.
 
* Lazily created tabs.
 
* Unactive tabs are really unactive (event handlers are detached).
 
* File references watch the files. When the file changes, the GUI is updated.
 
* References with inherent identity (makes defining auto-sensitive buttons easier)
 
* Experimental support for colored buttons.
 
* More examples in the demo application.
 
* Lots of inner changes.
 
 
 
== External links ==
 
   
  +
* [http://www.reddit.com/r/haskell/comments/1cemr2/lgtk_lensbased_gtk_interface/ 15 April 2013]
* You can find the current API documentation [http://hackage.haskell.org/package/lgtk at HackageDB].
 
  +
* [http://www.reddit.com/r/haskell/comments/1cj0o6/lgtk_api_fixed/ 17 April 2013]
* There is [http://hub.darcs.net/divip/lgtk a darcs repo on hub.darcs.net].
 
  +
* [http://www.reddit.com/r/haskell/comments/1f5m5j/ann_lgtk_05/ 27 May 2013]
  +
* [http://www.reddit.com/r/haskell/comments/1fjerf/lens_chains_lgtk_semantics_first_part/ 2 June 2013]
  +
* [http://www.reddit.com/r/haskell/comments/25k9x1/ann_lgtk08/ 14 May 2014]

Latest revision as of 21:08, 22 July 2023


LGtk is a GUI Toolkit.

Main goals of LGtk:

  • Provide a Haskell EDSL for declarative description of interactive graphical applications
  • Provide an API for custom widget design
  • Provide a playground for high-level declarative features like derived state-save and undo-redo operations and type-driven GUI generation

Lgtkdemo.png

Internal links

Should be revised:

External links

Related Stackoverflow questions:

Reddit comments: