GUI for Standard ML? - user-interface

I started learning Standard ML recently out of curiosity. So what I know is that is has an efficient compiler (MLton) which allows us to freely use abstractions without worrying about performance.
It would be perfect if I could do some GUI programming with Standard ML, too. Is there anything like Gtk, Qt, or WxWidgets binding for Standard ML?
Thank you very much.

Here's a paper describing the mGTK project, which is a Standard ML binding to GTK. There are also a couple of interfaces to OpenGL, although this is more 2 and 3D graphics-oriented rather than specifically a GUI toolkit. eXene is a toolkit for X Windows. sml_tk is an interface to Tk.

There are bindings for foreign toolkits, but the eXene toolkit was designed to be native for SML and to exploit the features of Concurrent ML. I used it years ago and found it a very smooth fit for the language and a pleasure to use. But it does not have the ginormous library of components that you find in the more widely used toolkits.

Giraffe Library provides SML bindings to libraries that support GObject Introspection, which includes GTK. At the time of writing, bindings are available for the GTK 3 stack. Although the cairo graphics library does not support GObject Introspection, Giraffe Library provides bindings to some cairo functions.
Although SML has a very precise definition, the definition does not include an FFI, and there is considerable variation between compilers. At the time of writing, Giraffe Library supports only the FFIs of MLton and Poly/ML.

Related

How do I create graphics for WebAssembly in C++14, that are implemented similarly to X11?

I'm currently working on building Chess in C++ for a school project. It's coming along really well, and I'm going to need to implement graphics pretty soon. Although I'm going to implement the graphics in X11, I was wondering how I might do it with WebAssembly, specifically which libraries are most similar to X11 that I could use. The GraphicsDisplay would just be an Observer to my Game class.
You cannot program in X11 with WebAssembly, you need graphics frameworks.
Currently the only GUI framework that officially support WebAssembly is Qt. Have a look at its official documentation on WebAssembly. I recommend learning Qt Widgets in a common desktop environment (Linux, Windows, Mac...) then try to port it in WebAssembly.
The other way to implement graphics with WebAssembly is using frameworks for game. Emscripten (C/C++ to WebAssembly toolchain) has a strong support for OpenGL-based games. You probably want to look at SDL.

What language can create relatively quick starting cross-platform applications with custom widgets?

I want to create an application that "plays well as a tray icon". That is, it starts up quick and doesn't hog resources. The application will likely need some custom UI widgets as well, and although I mention "tray icon", cross-platform would be ideal as well.
Obviously, I can do this with C++ and some cross-platform UI library (I wouldn't know which one), but I was hoping for a language with garbage collection.
I can do this with Java, but I'm guessing even after compilation, it likely builds a relatively large and slow-starting .exe (maybe the SWT UI library would cut some bloat?). Another way to ask this question, is it possible in Java, and if so what is the best way to make quick/snappy app? I want it pop up similar as popping up Google Desktop search.
Is there something "between Java and C++?"
So,
* Higher-level than C++ (mainly GC)
* Quick starting and resource friendly/snappy (.exe or otherwise)
* Cross-platform desktop UI (even with custom UI widgets)
Try Python it is a high level cross-platform language with GC.
Use Qt and pick an arbitrary supported language
Here is the link to it : Qt - A cross-platform application and UI framework
You can use it freely if you don't develop commercial application.
The reference documentation is very good, and you can find a lot of help all over the net.
It uses a hierarchy of the objects, and if a parent object destroys, it frees up all the children. In a GUI app you don't have to bother with deallocations, if you use the proper syntax. I am developing a 2D presentation application for linux with it, and I am very satisfied with its performance.
Don't forget to use Qt Creator if you decide to use Qt, it simplifies project creation, contains "intellisense", very useful. Without it Qt is a pain..
Supported programming languages: (quoted from qt site)
Programming Language Support
The Qt API is implemented in C++, and
provides additional features for
easier cross-platform development. QML
– introduced with Qt 4.7 – QML is a
JavaScript-based declarative, language
designed to describe the user
interface of a program: both what it
looks like, and how it behaves.
Bindings to Qt exist for several other
languages, including Ada, Pascal,
Perl, PHP, Ruby, Python and Java™.

Differences that matter between GTK+ and QT?

What are the finer differences between QT and GTK+?
Specifically I need to know the finer differences.
Language neutral, Windows/Linux neutral. Just the finer points please...
How native are the widgets / controls to the window manger, from its standpoint? Example: If it were a text control, would it process: a WM_COMMAND or EM_SETSEL message sent to it? If not, how do third-party applications / screen readers interact with the control / widget?
Advanced widgets available in one toolkit and not available in the other? Add-Ons are fine to describe.
What is the quality of theming from a multimedia / special effects standpoint? like powerpoint style special effects such as fade-ins of widgets/docks. What's the ease of coding for these scenarios?
Note: I'm probably biased towards Qt as I never used GTK seriously.
Qt's graphics view and scene system is awesome, GTK only has low level Cairo.
Writing custom widgets seems easier with Qt, probably because of the OO design. I don't know which API has more "advanced" widgets, but the basic ones are probably enough for most applications with a little bit of customization.
If you want a completely custom display for your app with special effects and all, you can easily write one based on graphics view/scene. Qt 4.7 also adds Qt Quick to design fancy interfaces, I didn't have the opportunity to test it yet but it looks pretty cool.
Overall I think both are great frameworks and offer enough for any application, but with Qt you get everything in a nice package, when you have to use 3rd party additions or reinvent the wheel to get the same job done with GTK.
Although you didn't ask this, it's worth pointing out the different philosophies between Qt and Gtk+ (or Gtkmm, the C++ version of Gtk+).
Qt is a full application development toolkit. It includes XML parsers, concurrency framework and so on. Gtkmm is not. From the gtkmm documentation:
gtkmm is a GUI toolkit and nothing
more, and it strives to be the best
C++ GUI toolkit. That mandate does not
cover generic C++ data structures, an
XML parser, or database access.
The probably more fair comparison is between Qt and Gtkmm + a set of GNOME libraries.
For advanced widgets the GNOME libraries are really nice - take libgoffice, for example. But it doesn't have a beginner friendly documentation and you will end up having to ask questions in the mailing lists or the IRC channels. Qt is also very nice and have a much friendly documentation. The quality and availability are equivalent, in my opinion, but Qt usually have more documentation or, at least, is documented in a way more friendly to "outsiders".
Both have high quality presentation and effects. No meaningful difference. I like the Gtk+ appearance more than Qt, but it just a matter of personal taste.
Not a complete answer, but:
I find it really difficult to
customize widgets in Gtk+, e.g. I
want the behavior of widget X, but
need to tweak the look beyond the
usual style settings.
OTOH I don't like Qt's moc, but that's more of a
personal thing.
I'd also strongly
recommend Gtkmm (the C++ wrapper)
over plain Gtk+.
Sorry if this bias to qt and shallow
Qt has many eyecandy effect ( dont know about gtkmm).
Qt has Qtconcurrent, higher level api for multithreading. probably more readable
than Qthread Qmutex blablabla...
Based from your question I think you want to integrate desktop app to www,
so just compare for yourself between qtwebkit , gtkhtml and gtkwebkit which one is likely to fit you better.
I've narrowed it down to XULRunner or GTK+.
Here's why:
I need to quickly become familiar with the internals. QT makes this difficult for me with so much on their ease-of-use solutions.
QT is HUGE! I stopped a custom compile after it had been running for over 4hrs on my 3Ghz P4! to be fair, QT provides many precompiled binaries
Out of the box themes for QT are rather too 'professional' looking. I need something cool, GTK+ has some neat themes which I can modify.
I don't need / want to use the framework for networking, file management, multimedia, webkit, or anything besides a GUI frontend to other apps.
Note that the license in Qt is LGPL which is not good enough for many commercial projects. Same for GTK+, but at least you can pay for legally using Qt in commercial projects.

Favorite graphical subsystem to program in

Ok, this is an interesting question to ask because everyone has a say in it.
What is your favorite library to program in for GUI's and the language that you program it in. Give a short reason why. (ex. Gtk, Qt, Windows, etc..) Just an FYI, this includes any scripting language that you program a GUI in Python, Perl etc...
Frankly I've always done Gtk in C, but I'm starting to warm up to Qt in C++ with the new KDE. I've never been a big fan of Windows programming.
ChrisW. stated that I did not give a reason for Gtk/Qt so here goes. I started with Gtk because when I started programming GUI's I was working in Linux and there was more Gtk information available. Started utilizing Qt when I started working more in KDE but really the move to Qt was based on trying to move to C++ and learn more languages. I've never been a fan of basic Windows programming, but I do enjoy a little DirectX now and then :P
Recently I had the opportunity to work with both wxWindows and QT, while some time ago I wrote some small programs using FLTK and Gtk. My conclusion is that widget libraries tend to be very similar; each one has its strenghts and its quirks.
Instead of advocating a specific library, then, I would like to advocate the use of high level languages in GUI programming: the development cycle is way faster and GUI programs are rarely CPU bound, so the performance hit is rarely a problem.
If a GUI program has to perform some intense computations, just develop a core library in C or C++, but keep the interface in Python or whatever other interpreted language.
People like to bash Swing for being old, slow and ugly, but it's just not true. Swing is mature, is faster than ever on Java SE 6/10, looks decent enough, and is tolerable to program. Above all, I've found Java + Swing to be the most trouble-free cross-platform combination. It also works remarkably seamlessly with Jython (Python on JVM).
SWT could also be an option, but so far I've been happy with Swing.
I realise you're focusing on application GUIs but if you want a quick, powerful and fun way to visualize anything on your computer, you can't go past Processing
From the site:
Processing is an open source
programming language and environment
for people who want to program images,
animation, and interactions. It is
used by students, artists, designers,
researchers, and hobbyists for
learning, prototyping, and production.
It is created to teach fundamentals of
computer programming within a visual
context and to serve as a software
sketchbook and professional production
tool. Processing is an alternative to
proprietary software tools in the same
domain.
WPF in particular, and XAML in all its reincarnations (WPF, Silverlight, Moonlight).
C# on top of .Net 3.5/Mono: $0
Visual Studio Express/MonoDevelop: $0
Being able to tell the designer "make my program pretty" and continue coding features: priceless.
I liked writing to video memory under DOS: for an animated game (i.e. an Asteroids clone), that was as fast (performant) as I knew how to do it (certainly faster that using the BIOS API).
This is really a somewhat subjective question, so there is no best or correct answer to it. The following is based on my (limited) experience:
I personally like wxWidgets with PLT Scheme for writing simple but flexible GUIs. There are much more advanced toolkits, but I usually do not need their features. wxWidgets is flexible and the Scheme interface follows Scheme traditions of being powerful with a relatively simple structure. I like the fact that wxWidgets is portable, and yet tries not to actually draw its own widgets, but can use native or common toolkits of the environment it is used under. It is written in C++ but I never used its C++ interface.
That is not to say that in my opinion Scheme will generally be the optimal language to write your application in. In fact there are many kinds of applications I would not write in Scheme, even though I like the language. But regarding the GUI programming part, that is my favourite because of its straight-forwardness, and the way that a functional language like Scheme goes well with declarative-style GUI programming.
Of course you will not have the same level of control when using that as when having your program involved in every stage of the window construction and input reaction, by using an event loop (such as with Win32API or Xt/Intrinsics). But that is not always convenient and often unnecessary, and seems to become decreasingly common.
Note: The wxWindows toolkit was renamed wxWidgets, but my installation of a rather recent version of PLT Scheme still comes with the older wxWindows. I am not sure whether there is an updated package of wxWidgets available or if it is going to be included in a future version of PLT Scheme.
Qt4 without question for me. Now that it has an LGPL license it makes sense for all kinds of applications that previously weren't possible. Additionally, it changes C++ in ways that dramatically improve the experience of using the language. (Things like a foreach and forever loop, atomic operations on integers, and memory management)
Gtk and is the primary window-drawing graphical subsystem I have experience working with (and is therefore my favorite XD).
As far as general graphics subsystems go, however, OpenGL (typically in combination with GLUT) has been an easy and productive ride for me. Regrettably I have little DirectX experience to compare to, though :S
For writing souped-up versions of standard Windows components, I loved Borland's VCL, and am very pleased with .NET.

GUI Libraries for D

What is the current status of GUI programming with D Language? Are the language developers planning include GUI in the standard library?
The List (compiled from answers)
DWT (SWT binding)
GtkD (GTK binding)
wxD (wxWidgets binding)
QtD (Qt binding)
The most mature one is DWT, a port of SWT to D. There's also DFL and a whole host of bindings to GUI libraries written in other languages. Most of these aren't that mature yet, but DWT is. However, one thing to keep in mind is that D2 is on the horizon, so you might want to check whether the library is likely to be ported to D2 quickly.
I doubt that any of these will be included in the standard library anytime soon. The "official" standard library, Phobos, has a fairly minimalist attitude. The "unofficial" standard library, Tango, is not so minimalist, but still has a more systems programming bent to it. BTW, what's the difference if it's not in the standard library? I can see why this would be important for small, miscellaneous pieces of functionality where the effort to find, install, etc. a library for each one is significant compared to the amount of functionality the library adds, but not for big stuff like GUIs.
You might want to check out wxd, a wxWindows library for D.
It sounds like what you want.
From site dlang.org ( from FAQ dlang.org/faq.html ):
http://wiki.dlang.org/GUI_Libraries
I found to:
http://www.prowiki.org/wiki4d/wiki.cgi?action=browse&id=GuiLibraries&oldid=AvailableGuiLibraries
There are a list of GUI libraries and the status of them.
Finally, from http://www.dsource.org:
http://www.http://www.dsource.org/projects
There are a list of projects in groups.
One of group is named "Libraries-GUI".
I think there is a full list of GUI libraries for D language.
I think DWT looks like the most mature currently usable solution, especially if you need cross platform. As for a gui being included in the standard library, it is stated previously that it won't happen, neither for Phobos nor Tango.
Hybrid looks interesting (never tried that though). If you are a java dev then DWT is the natural migration from swt but otherwise I would recommend DFL. Have a look at the dsource list too and scroll down to GUI-Libraries.
I think it's a good thing that gui libraries are separate from standard library.
There is also on the works a binding for QT. Not useful at the moment, but it seems that is being done by QT engineers.
DWT now is not on dsource but on bitbucket: DWT2

Resources