libYUI
What is libYUI?
libYUI is the YaST2-UI library. It is a C++ based abstraction toolkit for various UI frameworks.
What makes libYUI different?
Ofcourse, UI frameworks are everywhere these days. But what makes libYUI different is that it is NOT a separate framework. It is an abstraction layer for existing UI frameworks such as GTK, ncurses and Qt!
This means that as a developer, you only need to write one code using YUI and you automagically get your application using all three frameworks! Awesome right?
I have not heard of YUI. Is it new?
Yes and No. No because YUI is the core UI component for YaST and has been around for quite sometime. The fact that it was tightly coupled with YaST made it unavailable on other platforms.
Recently, libYUI has been ported to many platforms and is free of the YaST framework. The platforms include Fedora, Ubuntu, Debian and more recently Gentoo (Thanks to Michal Hrušecký). In that manner, yes. It's a brand new framework available for the entire community to use and develop.
Why is libYUI better?
Let's consider an application like a package manager. One would expect a package manager on all types of desktop, be it KDE, GNOME, Fluxbox or even on a server without any X server installed. The normal practice is to write separate applications for each target or make use of generic package managers available on a platform by customizing it for the need. While this would work well, it is not an easy task to maintain 3 applications which are supposed to do the same function, but on a different desktop environment. Maintenance would be a problem as all the apps are in essence separate programs with separate build procedures and separate bugs!
The advantage one gets by using libYUI is that though the output is scalable across different desktop environments with a single code. One can write a single code and get GUI (Qt or GTK) and TUI (ncurses) based outputs! There is absolutely no need to rewrite any part of the code. You dont even have to recompile! This is as easy as it gets.
GETTING STARTED
Let's get started so that you can see how easy a framework it is yourself.
HELLOWORLD!
#include "YUI.h"
#include "YWidgetFactory.h"
#include "YDialog.h"
#include "YLayoutBox.h"
#include "YEvent.h"
int main( int argc, char **argv )
{
YDialog * dialog = YUI::widgetFactory()->createPopupDialog();
YLayoutBox * vbox = YUI::widgetFactory()->createVBox( dialog );
YUI::widgetFactory()->createLabel ( vbox, "Hello, World!" );
YUI::widgetFactory()->createPushButton( vbox, "&OK" );
dialog->waitForEvent();
dialog->destroy();
}
And that's how easy it is!
RESOURCES