[lazarus] multiplataform ?

Jeff Wormsley jwormsley at debitek.com
Fri May 21 17:51:15 EDT 1999


On 5/21/99, at 1:55 AM, Sergio A. Kessler wrote: 

>fpc/
>   fcl/            -> base classes (multiplataform)
>      gui/
>         inc/      -> gui high level (toolkit independent)
>         gtk/      -> gui base level (toolkit dependent)
>         qt/
>         gnome/

           win32   -> Even if gtk has a Win32 port, a direct solution might be nice...

How would you implement switching from one GUI to the other?  If each GUI has it's own unit, with a non-implementation specific calling interface, then a simple construct as follows in the GUI header would work and would only have to be done in one place.  

{$IFDEF GTK}
Uses GTKLIB;
{$ELSEIF QT}
Uses QTLIB;
{$ELSEIF GNOME}
Uses GNOMELIB;
{$ELSE
Uses WIN32LIB;
{$ENDIF}

If you embed the GUI code into each component, then you will have to have something like this for each and every unit.  Or worse, each component would need this construct for each GUI function it performed, which would be unreadable at best.

Abstracting the GUI toolkit functions at a level below the FCL seems to make a lot more sense, and should be easier to use in the long run.  Unfortunately, in the short term, it will be a pain in the rump, especially when we get to the point of implementing the next GUI toolkit, such as qt.  I would bet dollars to doughnuts that the abstraction needed for GTK will be different for QT, so that our nice CreateComponent that calls the GTK function can't be done that way for QT, so that implementing QT means rewriting GTK also to define a new abstraction layer that is suitable for both.  Arrrghhh.  As much trouble is that is, though, when all is said and done, the GUI independence will be well worth the effort.

I shudder to think what implementing a GUI independent TCanvas with OnPaint events would be like.  <cringe, shudder>

Jeff.


Jeff.






More information about the Lazarus mailing list