Welcome to mirror list, hosted at ThFree Co, Russian Federation.

Design « System.Windows.Forms « class « mcs - github.com/mono/mono.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: c9fa450d553d2d0c85bf5a67f5e4d02bd0e470ed (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
      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