[Mono-list] How to select a GUI implementation?
Jonathan Pryor
jonpryor@vt.edu
16 May 2003 13:21:08 -0400
You could take a look at what Type Reflector does. It supports both
Gtk# and SWF front-ends, as well as a console front end. Type Reflector
is in the type-reflector CVS module and the mono-tools CVS module.
It's approach is a bit of a hack, but I've found it to work well.
Type Reflector has two levels of support: compile-time and run-time. By
default, all front-ends are built. If this fails (due to missing
assemblies, e.g. Gtk# isn't installed), it'll fall-back and attempt to
rebuild with a different set of front-ends. The problem with this
approach is it could result in a combinatoric explosion of build
choices, but with only 2 "optional" front-ends (SWF & Gtk#) this isn't
too bad.
The next level is run-time selection. Type Reflector uses an
application configuration file (type-reflector.exe.config) which has an
<appSettings/> tag, which contains a "displayer-order" key. This key
contains an ordering (space-delimited) of the front-ends to try to use.
An environment variable could be used instead. At runtime, each entry
is instantiated; the first displayer that instantiates is the one that
is used. This permits all GUI front-ends to fail, resulting in console
output.
Thus, the default GUI is the first entry in the "displayer-order" key.
The user can modify this by editing the .config file (non-ideal, though
the App could include functionality to edit the .config file or use an
IsolatedStorage file for per-user settings).
- Jon
On Fri, 2003-05-16 at 11:35, J. Perkins wrote:
> Alexandre has been hard at work building a quite nice back-end system
> for SWF and System.Drawing. He can support multiple native GUI libraries
> including Wine and Gtk. The last piece of the puzzle is choose which
> implementation to use at runtime. There's two pieces to consider here.
> First, which implementation should be used as the default on a given
> system, and second how can the user change the default if they don't
> like it?
>
> For the first, could we add a new switch to configure that adds a symbol
> to the builds of SWF and SD? Like USE_WINE or USE_GTK or similar. I
> tried looking at the build scripts myself, but being a Windows/IDE guy I
> couldn't make sense of them. Once this is in place, the package
> maintainers could choose the appropriate implementation for their target
> platform.
>
> For the second, we thought we would check an environment variable, maybe
> "MONO_GUI". If it was set (MONO_GUI=gtk for instance) we would override
> the default implementation in favor of Gtk.
>
> How does this sound to everyone? I don't know if Alexandre knows how to
> make the changes to configure so we might need some help there. The
> environment variable we could go ahead and add now. Then we'd need to
> package maintainers to choose the right implementation when they do
> their release builds.
>
> Jason
> 379
>
>
> _______________________________________________
> Mono-list maillist - Mono-list@lists.ximian.com
> http://lists.ximian.com/mailman/listinfo/mono-list