gtk from file ?



Andreas Jellinghaus wrote:
>after reading the gtk docs :
>what about writing a routine that can read a file and create the widgets and
>set the callbacks during runtime ? speed isn't a big issue, as e.g. the main
>window is only created once. could increase flexibility a lot.
>is someone working on this ?

This already exists, but it isn't GTK (not even C).
FormsVBT from Digital SRC was based on a Lisp like language that lets
you define widget hierarchies to be loaded at runtime by your app.  No
need to compile them, they're text (.fv) files:

(Rim (Pen 10) (Font (WeightName "Bold"))
  (VBox
    (HBox
      (Frame Lowered
        (TypeIn %filename))
      (Glue 10)
      (Button %exit "Quit"))
    (Glue 10)
    (Shape (Height 200 + inf) (Width 300 + inf)
      (Frame Lowered
        (TextEdit ReadOnly %editor)))))

There is support for macros.  Properties are inherited by children. 
Only named widgets ('filename', 'exit' and 'editor') can have callback
functions attached.  Of course, a fv file must define every widget the
app expects to attach a callback to; these will usually be 'leaf'
widgets, not the 'splits' and 'filters' that glue them together.

>the only problem i see, is that the parser had to be changed for every new
>widget written, but maybe someone can find a solution for that.

Sort of declaring some kind of 'builder' function, like the C++ default
constructor.  With generic arguments for standard atributes and maybe
specific ones as well.
IIRC FormsVBT was *not* extensible.

-Daniel



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]