1 Guidelines for hacking SWF
2 ==========================
4 This document describes some of the minimal coding guidelines
5 to be followed while hacking the new SWF implementation. These
6 guidelines are for the sake of consistency.
8 1. Please refer to the design document of SWF to understand the
11 2. Please follow the general coding style described for the Mono
12 project (/cvs/mcs/class/README).
14 3. Method stubbing is highly discouraged. It's recommended to submit
15 an implemented method instead of just the signature. If you have
16 to stub a property or method, please use the [MonoTODO ("what")]
17 attribute to document what still needs to be done.
19 4. When you implement the drawing method for a control in a theme, it
20 should make call to ControlPaint class methods and System.Drawing
21 classes. If it is not possible to implement a control's draw method
22 under these restrictions and you need some functionality from
23 XplatUIDriver, please let us know. We will try to enhance the
24 driver, if *really* required.
26 5. Minimize redraws as much as possible by utilizing the clipRectangle
29 6. Setting the size of a control raises a resize event even if the
30 control size is same. Be careful is setting the size and it's better
31 to avoid changing the control size as much as possible. Wherever
32 possible try scaling the control bitmap as per the size needs.
34 7. Make sure to call the base class event methods when overriding them.
36 8. Define regions in your code, as it makes it easy to browse the code
37 in the editors which can collapse/expand regions. Also, keep the
38 methods and properties sorted alphabetically.
40 9. Last but not the least, please let others on the mono-winforms-list
41 know about your work, so that duplication can be avoided.
43 10. Theme.cs provides Pen and Brush caching. This allows to share
44 the same brushes and pens between different controls and also to avoid
45 to create and destroy them in every draw operation. You should not create
46 Brushes or Pens directly, you should ask the Resource Pool for them. For
49 new SolidBrush(button.BackColor);
53 ResPool.GetSolidBrush (button.BackColor);
55 Look at SystemResPool class for more details.