All Projects → beijaflor-io → haskell-libui

beijaflor-io / haskell-libui

Licence: GPL-3.0 license
Haskell bindings to the libui C library.

Programming Languages

haskell
3896 projects
objective c
16641 projects - #2 most used programming language
Makefile
30231 projects

Projects that are alternatives of or similar to haskell-libui

Fficxx
Haskell-C++ Foreign Function Interface Generator
Stars: ✭ 117 (+160%)
Mutual labels:  wrapper, ffi
gpgme
GPGme bindings for Rust
Stars: ✭ 55 (+22.22%)
Mutual labels:  wrapper, ffi
genshinstats
A dead python library that can get the stats of Genshin Impact players using Mihoyo's API.
Stars: ✭ 217 (+382.22%)
Mutual labels:  wrapper
denoffi
Deno Foreign Function Interface.
Stars: ✭ 37 (-17.78%)
Mutual labels:  ffi
islpy
Python wrapper for isl, an integer set library
Stars: ✭ 58 (+28.89%)
Mutual labels:  wrapper
py-SMART
Wrapper for smartctl (smartmontools)
Stars: ✭ 42 (-6.67%)
Mutual labels:  wrapper
confirm-before
✅ Are you sure? No? Confirm Before - Sanity check for your shell commands
Stars: ✭ 16 (-64.44%)
Mutual labels:  wrapper
php-fuse
PHP FFI bindings for libfuse
Stars: ✭ 53 (+17.78%)
Mutual labels:  ffi
dokuwiki-plugin-bootswrapper
Bootstrap Wrapper for DokuWiki
Stars: ✭ 33 (-26.67%)
Mutual labels:  wrapper
asmdot
[Unstable] Fast, zero-copy and lightweight (Arm | Mips | x86) assembler in (C | C++ | C# | Go | Haskell | Javascript | Nim | OCaml | Python | Rust).
Stars: ✭ 23 (-48.89%)
Mutual labels:  ffi
dbots.js
A stats poster and API wrapper for all botlists.
Stars: ✭ 18 (-60%)
Mutual labels:  wrapper
nanoleaf-aurora
A java wrapper for the Nanoleaf Aurora API
Stars: ✭ 19 (-57.78%)
Mutual labels:  wrapper
viup
A V wrapper for the cross-platform UI library, IUP.
Stars: ✭ 36 (-20%)
Mutual labels:  wrapper
jodit-vue
Vue wrapper for Jodit Editor
Stars: ✭ 60 (+33.33%)
Mutual labels:  wrapper
node-atol-wrapper
Node.js обертка для ДТО версии 10 компании АТОЛ
Stars: ✭ 28 (-37.78%)
Mutual labels:  wrapper
deno bindgen
Simplified glue code generation for Deno FFI libraries written in Rust.
Stars: ✭ 142 (+215.56%)
Mutual labels:  ffi
packetevents
PacketEvents is a powerful packet library. Our packet wrappers are efficient and easy to use. We support many protocol versions. (1.8+)
Stars: ✭ 235 (+422.22%)
Mutual labels:  wrapper
adl
🍿 anime-downloader + trackma wrapper
Stars: ✭ 91 (+102.22%)
Mutual labels:  wrapper
node-freshdesk-api
Node wrapper for Freshdesk v2 API
Stars: ✭ 24 (-46.67%)
Mutual labels:  wrapper
Compiler-Principle
词法分析,LL(1) 文法分析,LR(1) 文法分析
Stars: ✭ 18 (-60%)
Mutual labels:  ffi

haskell-libui

GPLv3


Haskell bindings to the libui C library.

The library is currently only an FFI wrapper.

Useful top-level modules are:

  • Graphics.LibUI
  • Graphics.LibUI.OSX

They export general and OSX specific functionality in raw C and "wrapped" Haskell APIs. Currently implemented for OSX only are wrappers for Webkit and a partial wrapper to Mapviews, both of which have examples. This should go back to upstream libui once it's solid.

Important

This package needs some splitting and cleaning-up, as well as some more work, but the bits exposed by Graphics.LibUI.FFI (Graphics.LibUI.FFI.Wrapped, Graphics.LibUI.FFI.Raw & OSX variants) should be ok to use.

They aren't used in anything serious right now. You'd be courageous to do it.

Usage

import Graphics.LibUI
main = do
    uiInit
    wn <- uiNewWindow "Haskell on GUIs" 220 100 True
    btn <- uiNewButton "Click me"
    wn `setChild` btn
    wn `setMargined` True
    uiShow wn
    uiMain

You can run this example with:

git clone https://github.com/beijaflor-io/haskell-libui
cd haskell-libui
make READMEExample
./READMEExample

Examples

There're several examples on the examples directory. The Simple... examples only use the Graphics.LibUI.FFI part of the library and are what you want to look at first.

The ReactiveBanana... examples are playgrounds for showing how you could wrap the callback based API with FRP without much work.

markd - A simple GUI for Pandoc using a webview

apps/markd is an example application (currently only working on OSX), which previews how a file is rendered by pandoc.


Roadmap

  • Raw FFI available in Graphics.LibUI.FFI.Raw
    • All functions from the FFI mirror their libui names prefixed with c_
    • Document the FFI
  • Haskell callback based API in Graphics.LibUI.FFI.Wrapped
    • Data-wrappers for uiControl type
    • Callback based API
  • Higher-level API on examples and Graphics.LibUI.Types and Graphics.LibUI.MonadUI
    • Building concrete representations of UI controls based on declarative code
    • Currently in the examples Wrap the callback based code under an FRP layer
    • Library consistency
      • Containers return their concrete representation and their children's return value
      • MonadUI shouldn't wrap IO actions, but abstract commands:
        • data UI = UI [UIControl]
        • class MonadUI m b where runUI :: UI -> m b
        • instance MonadUI IO CUIControl where runUI = toCUIControlIO

The aim of Graphics.LibUI.Types and friends is to end-up with code that looks like:

runUILoop do
    menu "File" [ "Open"
                , "Save"
                , UIMenuItemQuit
                ]
    void $ window "libui Control Gallery" 640 300 True $
        void $ tabs $ do
            tab "Basic Controls" $ do
                hbox $
                    button "Button"
                    checkbox "Checkbox"
                label "This is a label. Right now, labels can only span one line."
                void $ group "Entries" $
                    form [ formItem "Entry" (entry "")
                         , formItem "Entry" (entry "")
                         , formItem "Search Entry" (searchEntry "")
                         ]
            tab "Basic Controls" $ hbox $ do
                void $ group "Numbers" (return ())
                void $ group "Lists" (return ())
            tab "Data Choosers" mempty

Tested on OSX, Fedora and Ubuntu 14.04. A Vagrantfile is available.

License

This code is published under the GPLv3 license

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].