Wednesday, October 12, 2011

Teaser: Project NGtk - Native Gui ToolKit

Recently, I wasn't exactly active in GIMP and other projects. The main reason for that is an open-source university project I am doing as part of my studies, in the course Advanced Topics in Operating Systems. I believe pictures can demonstrate better than words, so take a look:

Click on the image to view it in fullsize

Project NGtk is an extremly light-weight library for creating GUI's on different platforms. It includes the following features/concepts:
  • Has support for the following widgets and events:
    • Button (stable)
    • Labels (stable)
    • Text-Entries (stable on 2 of 3 platforms)
    • Windows (stable)
    • Mouse up/down/click events
    • Keyboard key type events, with translation from key code to ascii
  • Works on the following platforms:
    • Windows - Uses native Windows widgets via the windows API.
      For this backend, the only dependancy is the windows libraries which already ship with Windows.
    • Unix/Linux Terminal - Any terminal which NCurses works on (which should be most modern terminals). This means you can also use this via SSH without X11-forwarding! Unlike many curses applications, NGtk includes full support for mouse cursor in the terminal.
      For this backend, the only dependancy is NCurses, which is shipped with most (if not all) modern linux distributions. NCurses supports a large variety of terminals.
    • Xlib - Any operating system which has an Xlib (X11) client library. This means graphical Linux/Unix work environments.
      The only dependancy for this backend is an Xlib implementation, which is shipped with all modern graphical Linux/Unix environments.
    • Gtk+ wrapper - Support planned for near future. This will practically be a simple API wrapper to give API consistent with other NGtk backends.
  • 30 KB for the core library + 30 KB for each "adapter" (backend library). Just for comparision, Gtk+-3 is approximatly 4 MB (130 times bigger), not including it's dependancies.
  • Written in C
  • Object-Oriented structure - NGtk uses a very small C object system that was written as part of this project to make it easy to rogram, and without requiring C++. The object system is easy to learn and well documented.
  • Display "Resolution" Independant - Forget the term pixel, as it doesn't exist in NGtk. Since NGtk is meant for a wide amount of platforms, such as the terminal (where a the smallest unit, a "pixel", can actually be a whole letter), NGtk will handle sizing of widgets itself. You can specify logic layouts, but no need to actually specify a size for widgets. There is a built-in interface for accepting custom made layouts (anything from grids, relative sizings, etc.), and writing new layouts is easy.
As you can see, NGtk doesn't have any real dependancy - the only dependancy it has is the existance of the graphical system that you wish to use. It is also not a replacement for Gtk+/Qt/etc. - it's targetted only at people who want very light-weight GUIs (both in features and in actual library disk size), and want to acheive maximal support. The NGtk goal is to achieve a state where every platform with a compiler will have an NGtk backend that will work on it without requiring any library which isn't already on the platform.

The first stable release of NGtk will happen this week when I hand in the project to my university. You can already find the project source by googling it, but I do recommend waiting for the official stable release.

Regarding my GSoC project: no I haven't forgotten. It won't make it in time for 2.8, but I will work on it as soon as I can hand in NGtk to my proffessor. Sorry to disappoint the people who wanted to see it soon, but it just won't happen...

2 comments:

  1. This might be something I very much need. A "C" based GUI that can easily have a Common Lisp binding added to it...looking forward to this..

    ReplyDelete
  2. Why use own object system instead GObject?
    Gobject can give a lot of benefits... like gobject-introspection and autmatic bindings.

    ReplyDelete