1. Eiffel IUP a GUI toolkit for GOBO Eiffel
Germán Arias edited this page 4 years ago

1 Eiffel IUP a GUI toolkit for GOBO Eiffel

Eiffel-IUP is a GOBO Eiffel library to the IUP toolkit. So, you can create your graphical application entirely on Eiffel language. Firs of all, why IUP? IUP is simple and its API is small. So, since I don't get paid to do this, the work is not to much and I can enjoy this. But IUP is powerfull and very flexible.

1.1 Prerequisites

On UNIX you need a functional GTK+ or Motif system.

1.2 Contents of the tarball

  • eiffel.el: To add support for Eiffel language in Emacs. This is based in the file of the Liberty Eiffel project but have some minor additions and improvements.

  • examples directory: Contain many examples including the tutorial examples.

  • library directory: The eiffel-iup library.

1.3 Install

Download and extract the content at some directory of your choice. Then set the environment variable EIFFEL_IUP to the "library" directory and the variable IUP_LIBS to the directory with the IUP libraries. You can do this at your .bashrc file (hidden file) at your home directory. For example:

export EIFFEL_IUP=/home/user_name/eiffel-iup/library
export IUP_LIBS=/lib64

1.4 Using eiffel-iup at your project

Now to use eiffel-iup at your project add the library "eiffel-iup" at your ecf file:

<library name="eiffel-iup" location="${EIFFEL_IUP}/library.ecf"/>

(The follow is an adaptation of the official documentation of IUP at http://webserver2.tecgraf.puc-rio.br/iup/)

1.5 Introduction

Hello and welcome to the Eiffel-IUP Tutorial. Our goal is to provide a walkthrough guide to develop IUP applications focused in people that haven't used IUP before. First of all it is necessary to describe what IUP is and how it can help you develop your application. IUP stands for "Interface com Usuário Portátil" in Portuguese, which translates to "Portable User Interface". It is a multi-platform toolkit for building graphical user interfaces, offering a simple API, and its purpose is to allow the user interface source code of an application to be compiled in different systems without any modification. Supported systems include: GTK+, Motif and Windows. As main advantages, IUP offers: high performance since it uses native interface elements, and a fast learning curve due to the simplicity of its API. Also, IUP uses an abstract layout model based on the boxes-and-glue paradigm from the TeX text editor making the dialog creation task more flexible and independent from the graphics system resolution.

IUP has 3 concepts that any user has to understand: Elements, Attributes and Callbacks.

Elements are every kind of interface element present in the application. IUP contains several user interface elements. The library's main characteristic is the use of native elements. This means that the drawing and management of a button or text box is done by the native interface system, not by IUP. This makes the application's appearance more similar to other applications in that system. On the other hand, the application's appearance can vary from one system to another. Besides, some additional controls are drawn by IUP, and are independent from the native system. Dialogs are special elements that represent every window created by IUP. Any application that uses IUP will be composed by one or more dialogs. Every dialog can contains one or more controls inside.

Attributes are used to change or consult properties of elements. Each element has a set of attributes that affects its behavior or its appearance. Each attribute may work differently for each elements, but usually attributes with the same name work the same.

Callbacks are functions which notify the application that some user interface event occurred. Usually callbacks will be called only when the user interacts with the application elements. If the application register the callback function, then the function will be called every time the event occurs.

So let's start learning how to initialize the Eiffel-IUP interface and some generalities about events and callbacks.