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

Guidelines « System.Windows.Forms « class « mcs - github.com/mono/mono.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 967ef6c7f6d4c8f939567b7a63c39f2cc41b6477 (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
                Guidelines for hacking SWF
                ==========================

This document describes some of the minimal coding guidelines
to be followed while hacking the new SWF implementation. These
guidelines are for the sake of consistency.

1. Please refer to the design document of SWF to understand the
   implementation.

2. Please follow the general coding style described for the Mono
   project (/cvs/mcs/class/README).

3. Method stubbing is highly discouraged. It's recommended to submit
   an implemented method instead of just the signature. If you have
   to stub a property or method, please use the [MonoTODO ("what")]
   attribute to document what still needs to be done.

4. When you implement the drawing method for a control in a theme, it
   should make call to ControlPaint class methods and System.Drawing
   classes. If it is not possible to implement a control's draw method
   under these restrictions and you need some functionality from
   XplatUIDriver, please let us know. We will try to enhance the
   driver, if *really* required.

5. Minimize redraws as much as possible by utilizing the clipRectangle 
   when possible.

6. Setting the size of a control raises a resize event even if the
   control size is same. Be careful is setting the size and it's better
   to avoid changing the control size as much as possible. Wherever
   possible try scaling the control bitmap as per the size needs.

7. Make sure to call the base class event methods when overriding them.

8. Define regions in your code, as it makes it easy to browse the code
   in the editors which can collapse/expand regions. Also, keep the 
   methods and properties sorted alphabetically.

9. Last but not the least, please let others on the mono-winforms-list
    know about your work, so that duplication can be avoided.
    
10. Theme.cs provides Pen and Brush caching. This allows to share
    the same brushes and pens between different controls and also to avoid
    to create and destroy them in every draw operation. You should not create
    Brushes or Pens directly, you should ask the Resource Pool for them. For
    example, instead of:

    new SolidBrush(button.BackColor);
    
    you should use:
    
    ResPool.GetSolidBrush (button.BackColor);
    
    Look at SystemResPool class for more details.

Happy hacking!