gutopia-dev
[Top][All Lists]
Advanced

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

[rgui-dev] project design proposal


From: Thorsten Roggendorf
Subject: [rgui-dev] project design proposal
Date: 14 Dec 2002 02:38:02 +0100

Hi,

I have a first draft of how to design the API. I'll show you the steps
required of the client programmer in defining his interface.
First he puts the following in a file metaDesign.rb:

interface = \
  [toplevel,
    [menu,
      ["File", "save", "open", seperator, "exit"],
      ["Help", "Help", seperator, "About"]
    ]
    [container,
      [container, 
        entry("Day",   integer(Time.now.day,     1..31  ) ),
        entry("Month", integer(Time.now.mon,     1..12  ) ),
        entry("Year",  integer(Time.now.year, 1900..2050) )],
      [container, button("Ok"), button("Apply"), button("Cancel")],
    callback(
      button("Action"),
      message(
        "Next eclipse ist at ",
        string(???),
        "day the ",
        integer(1..31),
        ". of ",
        integer(1..12),
        " ",
        integer,
        "."
      )
    statusbar
  ]

This will create a simple Interface for some App that calculates the
next eclipse or something.
The whole thing is a nested ruby Array. Every element that not itself an
Array or a String is a function call.
The first element of each nested Array is the container of further
nested elements. If the container is specified layout is up to the user,
otherwise the backend tries to make good choices.
A simple script can be run over this file and will replace the ??? with
a complete and informatively named argument list.
Another script call generates a couple things:
- metaDesign.gui.rb: the GUI-Code in GUItopia API
- metaDesign.xml: XML definition of possible parameter files
- metaDesign.COR: CORBA interface definition
- metaDesign.callback.rb: callback skeletons for the buttons and menus
- ...

metaDesign.callback.rb will start with "require 'metaDesign.gui.rb'".
The "Action" button will automatically display a message window. In
CORBA interfaces the constant strings will be removed from the return
message and an array of ints returned. In parameter file execution the
message will be printed to standard out.
Integer entries will automatically be labled spinbuttons and so on.
In metaDesign.callback.rb you can do things like:
$toplevel.container.container1.hide
$toplevel.container.container2.deactivate
$toplevel.button.deactivate
$topleve.statusbar = \
  "I don't want to calculate eclipses anymore, get me another job!"

Cheers

   Thorsten




reply via email to

[Prev in Thread] Current Thread [Next in Thread]