Portable GUI toolkit (IUP) version 3.0 (RC2)

Headers, Bindings, Libraries for use with FreeBASIC, Please include example of use to help ensure they are tested and usable.
AGS
Posts: 1284
Joined: Sep 25, 2007 0:26
Location: the Netherlands

Portable GUI toolkit (IUP) version 3.0 (RC2)

Post by AGS »

This is the second release of the FreeBASIC bindings for IUP version 3.0 (RC2) .
(Windows version).

This release consists of the following:

- IUP 3.0 binaries (static libraries) and header files.
- CD binaries (static library).
- Freetype binary (static libary).
- FreeBASIC IUP examples.
- buildall.bat (compiles the provided examples)
- readme.txt

The latest archive can be downloaded here

Short description of IUP

IUP is a toolkit that can be used to build a graphical user interface. To
this end IUP wraps either native widgets (WIN32) or GTK+/Motif (Linux)
widgets into a convenient interface.

IUP is available for both Windows and Linux.

On Windows IUP uses either native widgets or GTK+ widgets.
On Linux IUP uses either Motif widgets or, since version 3.0 (the current version), GTK+.

Due to problems with the Gtk library (the import libraries released with the current version of FreeBASIC
are broken) it is not yet possible to use IUP in combination with GTK.

IUP consist of several static libraries and depends on the CD (Canvas Draw) library. Because of this
dependency the CD library needs to be downloaded/installed as well (binaries only,
no include files needed). The binaries of the CD library have been packaged with the IUP binaries
to make for an easier download/install.


The static libraries inside the IUP package are:

IUP binaries:

libiupcd.a
libiupcontrols.a
libiupgl.a
libiupim.a
libiupole.a
libiup_pplot.a
libiupgtk.a
libiup.a

CD binaries:
libcd.a
libcdpdf.a
libfreetype6.a


Available widgets

(taken from the IUP website, http://www.tecgraf.puc-rio.br/iup/)

Currently available interface elements can be categorized as follows:

* Primitives (effective user interaction): dialog, label, button, text, multi-line, list, toggle, canvas, frame, image.
* Composition (ways to show the elements): cbox, hbox, vbox, zbox, fill.
* Grouping (definition of a common functionality for a group of elements): radio.
* Menu (related both to menu bars and to pop-up menus): menu, submenu, item, separator.
* Additional (elements built outside the main library): dial, gauge, matrix, tabs, valuator, OpenGL canvas, color chooser, color browser.
* Dialogs (useful predefined dialogs): file selection, message, alarm, data input, list selection.

For a full description of IUP functionality see the IUP website.

For information on the CD library see http://www.tecgraf.puc-rio.br/cd/


Linux

The Linux binaries can be found at sourceforge
http://sourceforge.net/projects/iup/files/

Since the Linux version of IUP has not been tested there is no Linux release.

Changes from previous version

The first release contained dynamic link libraries. This
second version contains static libraries only.

Updated files

iup.bi
Added the follwing lines
#inclib "shell32"
#inclib "gdi32"
#inclib "comctl32"
#inclib "ole32"
#inclib "comdlg32"
#inclib "user32"
#inclib "advapi32.dll"

iupcontrols.bi
Added the following lines
#inclib "iupcd"
#inclib "cd"
#inclib "freetype6"

iupkey.bi
Keys now use ASCII values.
Names of macros K_x (where x is a lowercase letter)
changed to K_xlc (lc = lowercase).

tree.bas
This is a new example showing the usage of the tree widget.
When selecting one node the textcolor of the selected node turns to white.
When selecting multiple nodes the textcolor of the selected nodes remains black.
(note: the MULTISELECTION_CB has to be set to keep the example
application from crashing when selecting multiple nodes).

Installation

If you have FreeBASIC installed the 'old' IUP headerfiles (the ones shipped with the official
FreeBASIC distribution) are in INSTALL_DIR/inc/iup. The examples distributed with this release expect the
header files for IUP 3 RC2 to be in INSTALL_DIR/inc/iup3/ and the import libraries in INSTALL_DIR/lib/win32/

(INSTALL_DIR = path to FreeBASIC installation)

Note that the static libraries should be in the same place as the 'old' import libraries (INSTALL_DIR/lib/win32/)
Backup the old import libraries if you want to preserve them. Make sure the import libraries are not used by
FreeBASIC when compiling programs that use IUP (remove the import libraries after backing them up).

Compilation

A batch file has been provided to compile the examples (build_all.bat).
Look at the examples to see what files to include.

The compiler option -s gui ensures no console window is created when
a program using iup is executed. For debugging purposes it is possible to
compile without -s gui. This makes it possible to print messages to the console
using Print or some other function that prints to stdout.

Remarks

No examples have been provided for IupCanvas, IupOle and IupPPlot.
Last edited by AGS on Aug 15, 2009 7:03, edited 1 time in total.
D.J.Peters
Posts: 8586
Joined: May 28, 2005 3:28
Contact:

Post by D.J.Peters »

good job so far

but wait:
why do you need another UI to GTK
you can use GTK directly with Win and Lin
with the same code (C, C++, FreeBASIC, Pascal, Phyton, LUA ...)

Joshy
Merick
Posts: 1038
Joined: May 28, 2007 1:52

Post by Merick »

Because (unless you specifically force it to use gtk) on windows iup will work as a front end for the native windows gui controls, and on linux/unix it can use either gtk+ or Motif depending on what version of linux/unix is being used. This way you can use the same code on lin or win without forcing the windows users to install gtk+.
AGS
Posts: 1284
Joined: Sep 25, 2007 0:26
Location: the Netherlands

Post by AGS »

I'm going to add some more examples later this week because the examples I provided do not include the examples based on the CD library.

The CD library (CanvasDraw) is a bit like the FreeBASIC GFX library and the people developing IUP are also developing CD (and several other libraries). I have to create bindings/header files for the CD library to get those examples going.

I thank Joshy for his kind remarks and words of encouragement.
D.J.Peters
Posts: 8586
Joined: May 28, 2005 3:28
Contact:

Post by D.J.Peters »

Merick wrote:Because (unless you specifically force it to use gtk) on windows iup will work as a front end for the native windows gui controls, and on linux/unix it can use either gtk+ or Motif depending on what version of linux/unix is being used. This way you can use the same code on lin or win without forcing the windows users to install gtk+.
This way you can't use the same code on lin and win without forcing the windows user to install IUP ;-)

Joshy
Merick
Posts: 1038
Joined: May 28, 2007 1:52

Post by Merick »

Well, you could just use the static libraries.
AGS
Posts: 1284
Joined: Sep 25, 2007 0:26
Location: the Netherlands

Post by AGS »

Merick wrote:Well, you could just use the static libraries.
Merick, you are the best!!! I just succesfully linked an IUP application using static libraries so there is no need to install the DLLs' with an IUP app. I tried linking with IUP static libraries before but somehow I must have done something wrong. This time I used the mingw3 static binaries and... it worked. This is sooo much better and much more what I wanted.

I'm going to be updating my download package real soon because linking statically is much better than using dynamic link libraries. A little less DLL hell is always welcome.

I do need to include these windows files to get the examples going

Code: Select all

#include "iup.bi"
#include "windows.bi"
#include "win/commctrl.bi"
#include "win/ole2.bi"
#include "win/shellapi.bi"
#include "win/commdlg.bi"
I'll just put windows includes in iup.bi and include that with the examples. Some examples that worked with the DLL's now need the CD library so I've got to change some more things to make all examples I translated from C work with static libraries.

Many, many, ma-ny thanks Merick. At last a statically linked GUI app!
Merick
Posts: 1038
Joined: May 28, 2007 1:52

Post by Merick »

Yeah, in my experiments with the earlier version of IUP I've found that the MinGW versions of the static libs work better than the others, at least on windows.

In addition to the CD libs, it think some of the iup functions will require the IM lib as well.
Galeon
Posts: 563
Joined: Apr 08, 2009 5:30
Location: Philippines
Contact:

Post by Galeon »

Nice work.

What are the file names of the zip file containing the static libraries of IUP for Windows and Linux? There are lots of files.
Merick
Posts: 1038
Joined: May 28, 2007 1:52

Post by Merick »

You'll want to get one of the zip files that has "mingw" in the filename.
Amundo
Posts: 57
Joined: Feb 26, 2007 0:25

Post by Amundo »

Hi AGS and Merick,

Thanks for the work on this.

My static compile for the "helloworld.bas" incudled in the "iup_examples" archive, yielded 437KB exe ("iup3_0_rc2_Win32_mingw3_lib" files used).

Is this correct?
AGS
Posts: 1284
Joined: Sep 25, 2007 0:26
Location: the Netherlands

Post by AGS »

On my PC (Windows 2000) the size of the exe is 299kB. Make sure the compiler does not use the old .dll.a files because otherwise it will just link with dynamic libraries.

I'm using the package iup3_0_rc2_Win32_mingw3_lib.zip

(direct link)

If you compile a program using the static version of the libraries do not forget to use the commandline option -s gui otherwise you'll get a console window in the background when you run the program.

You can get the examples that came with the dynamic libraries to work with the static libraries as well by adding these lines to iupcontrols.bi

Code: Select all

#inclib "iupcontrols"
#inclib "iupcd"
#inclib "cd"
#inclib "freetype6"
And don't forget to add these lines

Code: Select all

#inclib "shell32"
#inclib "gdi32"
#inclib "comctl32"
#inclib "ole32"
#inclib "comdlg32"
#inclib "user32"
#inclib "advapi32.dll"
to iup.bi.


You'll need the CD library and the FreeType library to get the examples to work with the static version of the IUP libraries. The CD library can be found at sourceforge. It can be found here
http://sourceforge.net/projects/canvasdraw/files

The package you need is cd5_2_Win32_mingw3_lib.zip (static libraries).

The CD package contains a static version of FreeType.

I've tested the examples using static libraries (IUP and CD) and I got all of the examples to work.

About Linux binaries. I'd go with iup3_0_rc2_Linux26_lib.tar.gz (IUP library) and cd5_2_Linux26_lib.tar.gz (CD library).

These packages contain static libraries and shared objects. But I have not tested on Linux yet.

There is a description on the IUP site http://www.tecgraf.puc-rio.br/iup/ on the IUP library dependencies (click on 'guide' submenu 'building applications').
Last edited by AGS on Aug 15, 2009 7:10, edited 2 times in total.
Merick
Posts: 1038
Joined: May 28, 2007 1:52

Post by Merick »

What would be really cool would be if we could figure out a way to create an FB graphics window inside an IUP control
AGS
Posts: 1284
Joined: Sep 25, 2007 0:26
Location: the Netherlands

Post by AGS »

Merick wrote:What would be really cool would be if we could figure out a way to create an FB graphics window inside an IUP control
Do you mean something like this?
http://www.freebasic.net/wiki/wikka.php ... cPgGfxNull

The call to redrawwindow (hwnd,0,0,rdw_invalidate)

would have to be changed to something like

IupRedraw()

The HWND of an IUP control is accessible. So it should be possible to draw on an IupCanvas using Gfx.
Merick
Posts: 1038
Joined: May 28, 2007 1:52

Post by Merick »

Interesting, but that would only work on windows.

I just found some problems with iupkey.bi.

First, in the defines you have replaced the ' character with ", which causes them to resolve to the text inside the quotes. However, I believe that what the original C code is doing is setting the defines to the actual character codes, which would be someting like this in FB:

#define K_exclam asc("!") /' 33 '/

Second, all of the defines for the uppercase letters resolve to the same value as for the lowercase letters. I realize that this probably resulted from trying to work around FB's case insensitivity, but it won't allow you to use them to check for an uppercase letter from inside an iup callback.

Actually, don't really understand why Fb is allowing you to define the same thing twice - K_A and K_a, etc.. - even though you're setting them to the same thing - "a"
Post Reply