* System.Windows.Forms.dll.sources: Add TreeNode love to the build.
[mono.git] / mcs / class / Managed.Windows.Forms / Design
1       Design of new implementation of SWF
2       ===================================
3
4 0. About SWF:
5 =============
6
7 SWF stands for System.Windows.Forms. This is a class library that
8 provides a set of controls for designing application UI.
9
10
11 1. Architecture:
12 ================
13
14 The new implementation of SWF is based on drivers providing access to
15 the native windowing system of the host OS. The old implementation was
16 based on Wine library. The motivation for new implementation comes from
17 the problems faced with the Wine approach:
18 - Wine was missing features that .NET provided over Win32; to add those
19   features we would have had to write the controls managed anyway
20 - Installation became much more difficult due to the Wine dependencies
21   and the relatively akward way we had to initialize Wine.
22
23 The new implementation takes advantage of Win32 APIs on Windows and
24 emulates the same on Linux using X11 for window management and events.
25 Following gives a high level idea of the new implementation of SWF.
26
27          --------------------------
28          |      Managed SWF       |
29          --------------------------
30          |XplatUI Driver Interface|
31          --------------------------
32          | X11 Driver|Win32 Driver|
33          |           |            |
34          |  Mono on  |  Mono on   |
35          | Linux/Mac |  Windows   |
36          --------------------------
37
38 The above picture explains how the window management is done in the new
39 implementation. For drawing the controls System.Drawing library is used.
40
41
42 2. Design:
43 ==========
44
45 The new design of SWF makes porting of the library to Linux/Windows/Mac
46 very easy.
47 All the controls in SWF inherit from Control class and most of the painting
48 operations are done using ControlPaint class. At the low level, XplatUI class
49 provides the abstraction over the underlying window management system. It
50 contains a XplatUIDriver for providing the window management. XplatUIDriver
51 is an abstract class which is implemented by XplatX11 and XplatWin32 classes
52 respectively for Linux/Mac and Windows platforms. Support for any new platform
53 can be added simply by implementing XplatUIDriver for the new platform.
54
55
56 2a. Double Buffering:
57 =====================
58
59 For drawing controls double buffering used, so that a better performance
60 can be achieved. Every controls maintains a bitmap image of itself. This
61 image is used for painting the screen when a paint event is raised. When
62 a control property changes the look of the control, it redraws the bitmap
63 image. [Please see the guidelines document]
64
65
66 2b. Themes:
67 ===========
68
69 The look of any control is supposed to be controlled by the chosen theme.
70 All control drawing needs to be done by the currently selected theme class.
71 The ThemeEngine class manages the themes. All the themes implement 
72 Theme abstract class. The Theme class provides the drawing primitives for 
73 all controls. The current implementation supports the Windows Classic theme 
74 through the ThemeWin32Classic class and the Gnome theme through the ThemeGtk
75 class. Gnome support is still very incomplete (even more incomplete than SWF
76 itself)
77
78
79 2c. Multi-threading:
80 ====================
81
82    - To be added.
83
84
85
86 2d. Issues:
87 ===========
88
89    - To be added.
90