| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384 |
- Design of new implementation of SWF
- ===================================
- 0. About SWF:
- =============
- SWF stands for System.Windows.Forms. This is a class library that
- provides a set of controls for designing application UI.
- 1. Architecture:
- ================
- The new implementation of SWF is based on drivers providing access to
- the native windowing system of the host OS. The old implementation was
- based on Wine library. The motivation for new implementation comes from
- the problems faced with the Wine approach:
- - Wine was missing features that .NET provided over Win32; to add those
- features we would have had to write the controls managed anyway
- - Installation became much more difficult due to the Wine dependencies
- and the relatively akward way we had to initialize Wine.
- The new implementation takes advantage of Win32 APIs on Windows and
- emulates the same on Linux using X11 for window management and events.
- Following gives a high level idea of the new implementation of SWF.
- -------------------------------------
- | Managed SWF |
- -------------------------------------
- | XplatUI Driver Interface |
- -------------------------------------
- | X11 Driver|Win32 Driver|OSX Driver|
- | | | |
- | Mono on | Mono on | Mono on |
- | Linux/Mac | Windows | Mac OS/X |
- -------------------------------------
- The above picture explains how the window management is done in the new
- implementation. For drawing the controls System.Drawing library is used.
- To handle some special needs for different platforms, there are a few
- limited patches to System.Drawing to deal with calls from System.Windows.Forms
- 2. Design:
- ==========
- The new design of SWF makes porting of the library to Linux/Windows/Mac
- very easy.
- All the controls in SWF inherit from Control class and most of the painting
- operations are done using ControlPaint class. At the low level, XplatUI class
- provides the abstraction over the underlying window management system. It
- contains a XplatUIDriver for providing the window management. XplatUIDriver
- is an abstract class which is implemented by XplatX11 and XplatWin32 classes
- respectively for Linux/Mac and Windows platforms. Support for any new platform
- can be added simply by implementing XplatUIDriver for the new platform.
- 2b. Themes:
- ===========
- The look of any control is supposed to be controlled by the chosen theme.
- All control drawing needs to be done by the currently selected theme class.
- The ThemeEngine class manages the themes. All the themes implement
- Theme abstract class. The Theme class provides the drawing primitives for
- all controls. The current implementation supports the Windows Classic theme
- through the ThemeWin32Classic class and the Gnome theme through the ThemeGtk
- class. Gnome support is still very incomplete (even more incomplete than SWF
- itself)
- 2c. Multi-threading:
- ====================
- As of this writing, multi-threading was fully supported, provided the
- standard Microsoft implementation guidelines involving Invoke() are
- followed.
- 2d. Issues:
- ===========
- - To be added when MWF reaches completion
|