libyui

libYUI

Authors:
Stefan Hundhammer <sh@suse.de>
Michael Andres <ma@suse.de>
Stephan Kulow <coolo@suse.de>
Arvin Schnell <aschnell@suse.de>
Thomas Goettlicher <tgoettlicher@suse.de>

Introduction

libYUI is a user interface engine that provides abstraction from graphical user interfaces (Qt, Gtk) and text based user interfaces (ncurses). Originally developed for YaST, it can now be used independently of YaST for generic (C++) applications.


Quick Start

Here is a traditional HelloWorld program using libYUI to help you get started.

 // Filename : HelloWorld.cc
 #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();
 }

More examples can be found in the examples directory of the source tarball.


Compiling

To compile, you would need the libyui and libyui-devel (or the relevant development package depending on your operating system). After installing the packages, use the following syntax to compile :

g++ HelloWorld.cc -o HelloWorld -I/usr/include/yui -lyui

If libyui or the devel packages are not installed in standard locations, replace the appropriate paths.


Running Compiled Code

In the above case, to run the program using the Qt plugin (Default), use : ./HelloWorld

If you wish to run using the GTK plugin, use : ./HelloWorld --gtk

For ncurses plugin, the DISPLAY environment variable has to be unset. Thus, use the following commands for the ncurses UI : unset DISPLAY; ./HelloWorld

 All Classes Functions Variables Enumerations Friends