4
4
using System . Globalization ;
5
5
using System . Threading ;
6
6
7
- namespace Eto
7
+ namespace Eto ;
8
+
9
+ /// <summary>
10
+ /// Attribute to specify whether the handler interface should be initialized automatically
11
+ /// </summary>
12
+ /// <remarks>
13
+ /// Handler interfaces that defer creation of the control to various Create() methods can apply this attribute
14
+ /// so that the initialization can be done afterwards.
15
+ ///
16
+ /// If auto initialization is disabled, the widget author must call Widget.Initialize() after the control is created.
17
+ ///
18
+ /// Initialization applies styles to the widget and the handler, sets up events based on overridden event methods, etc.
19
+ ///
20
+ /// This is only needed by widget authors in advanced scenarios. The default is to auto initialize, so this is
21
+ /// only needed if you want to disable this behaviour.
22
+ /// </remarks>
23
+ /// <example>
24
+ /// An example handler that implements this behaviour:
25
+ /// <code>
26
+ /// [AutoInitialize(false)]
27
+ /// public interface IMyWidget : IControl
28
+ /// {
29
+ /// void CreateWithParams(int param1, bool param2);
30
+ /// }
31
+ ///
32
+ /// [Handler(typeof(IMyWidget))]
33
+ /// public class MyWidget : Control
34
+ /// {
35
+ /// public MyWidget(int param1, bool param2)
36
+ /// {
37
+ /// ((IMyWidget)Handler).CreateWithParams(param1, param2);
38
+ /// Initialize(); // ensure you call this on any constructor of your widget
39
+ /// }
40
+ /// }
41
+ /// </code>
42
+ /// </example>
43
+ /// <copyright>(c) 2014 by Curtis Wensley</copyright>
44
+ /// <license type="BSD-3">See LICENSE for full terms</license>
45
+ [ AttributeUsage ( AttributeTargets . Interface ) ]
46
+ public sealed class AutoInitializeAttribute : Attribute
8
47
{
9
48
/// <summary>
10
- /// Attribute to specify whether the handler interface should be initialized automatically
49
+ /// Gets a value indicating whether to auto initialize the handler, false to defer this to the widget author
11
50
/// </summary>
12
- /// <remarks>
13
- /// Handler interfaces that defer creation of the control to various Create() methods can apply this attribute
14
- /// so that the initialization can be done afterwards.
15
- ///
16
- /// If auto initialization is disabled, the widget author must call Widget.Initialize() after the control is created.
17
- ///
18
- /// Initialization applies styles to the widget and the handler, sets up events based on overridden event methods, etc.
19
- ///
20
- /// This is only needed by widget authors in advanced scenarios. The default is to auto initialize, so this is
21
- /// only needed if you want to disable this behaviour.
22
- /// </remarks>
23
- /// <example>
24
- /// An example handler that implements this behaviour:
25
- /// <code>
26
- /// [AutoInitialize(false)]
27
- /// public interface IMyWidget : IControl
28
- /// {
29
- /// void CreateWithParams(int param1, bool param2);
30
- /// }
31
- ///
32
- /// [Handler(typeof(IMyWidget))]
33
- /// public class MyWidget : Control
34
- /// {
35
- /// public MyWidget(int param1, bool param2)
36
- /// {
37
- /// ((IMyWidget)Handler).CreateWithParams(param1, param2);
38
- /// Initialize(); // ensure you call this on any constructor of your widget
39
- /// }
40
- /// }
41
- /// </code>
42
- /// </example>
43
- /// <copyright>(c) 2014 by Curtis Wensley</copyright>
44
- /// <license type="BSD-3">See LICENSE for full terms</license>
45
- [ AttributeUsage ( AttributeTargets . Interface ) ]
46
- public sealed class AutoInitializeAttribute : Attribute
47
- {
48
- /// <summary>
49
- /// Gets a value indicating whether to auto initialize the handler, false to defer this to the widget author
50
- /// </summary>
51
- /// <value><c>true</c> if initialize; otherwise, <c>false</c>.</value>
52
- public bool Initialize { get ; private set ; }
51
+ /// <value><c>true</c> if initialize; otherwise, <c>false</c>.</value>
52
+ public bool Initialize { get ; private set ; }
53
53
54
- /// <summary>
55
- /// Initializes a new instance of the <see cref="Eto.AutoInitializeAttribute"/> class.
56
- /// </summary>
57
- /// <param name="initialize">If set to <c>true</c> initialize the widget automatically, otherwise <c>false</c>.</param>
58
- public AutoInitializeAttribute ( bool initialize )
59
- {
60
- Initialize = initialize ;
61
- }
54
+ /// <summary>
55
+ /// Initializes a new instance of the <see cref="Eto.AutoInitializeAttribute"/> class.
56
+ /// </summary>
57
+ /// <param name="initialize">If set to <c>true</c> initialize the widget automatically, otherwise <c>false</c>.</param>
58
+ public AutoInitializeAttribute ( bool initialize )
59
+ {
60
+ Initialize = initialize ;
62
61
}
63
- }
62
+ }
0 commit comments