예제 #1
0
        public static void Add(string style, StyleWidgetHandler handler)
        {
            var list = GetStyleList(style);

            list.Add(delegate(InstanceWidget widget) {
                handler(widget);
            });
        }
예제 #2
0
        /// <summary>
        /// Adds a style for a widget
        /// </summary>
        /// <remarks>
        /// Styling a widget allows you to access the widget, but not the platform-specific controls (in a type-safe way).
        ///
        /// Typically, you'd use Style.Add&lt;H&gt;(string, StyleHandler&lt;H&gt;) instead, which will add a style based on the widget handler, which
        /// will give you direct and type safe access to platform-specifics of the widget.
        /// </remarks>
        /// <typeparam name="T">Type of the widget to style</typeparam>
        /// <param name="style">Identifier of the style</param>
        /// <param name="handler">Delegate with your logic to style the widget</param>
        public static void Add <T> (string style, StyleWidgetHandler <T> handler)
            where T : InstanceWidget
        {
            var list = GetStyleList((object)style ?? typeof(T));

            list.Add(delegate(InstanceWidget widget) {
                var control = widget as T;
                if (control != null)
                {
                    handler(control);
                }
            });
        }
예제 #3
0
        /// <summary>
        /// Adds a style for a widget
        /// </summary>
        /// <remarks>
        /// Styling a widget allows you to access the widget, but not the platform-specific controls (in a type-safe way).
        ///
        /// Typically, you'd use Style.Add&lt;H&gt;(string, StyleHandler&lt;H&gt;) instead, which will add a style based on the widget handler, which
        /// will give you direct and type safe access to platform-specifics of the widget.
        /// </remarks>
        /// <typeparam name="TWidget">Type of the widget to style</typeparam>
        /// <param name="style">Identifier of the style</param>
        /// <param name="handler">Delegate with your logic to style the widget</param>
        public static void Add <TWidget>(string style, StyleWidgetHandler <TWidget> handler)
            where TWidget : Widget
        {
            var list = GetStyleList((object)style ?? typeof(TWidget));

            list.Add(widget =>
            {
                var control = widget as TWidget;
                if (control != null)
                {
                    handler(control);
                }
            });
        }
예제 #4
0
파일: Style.cs 프로젝트: philstopford/Eto
 /// <summary>
 /// Adds a style for a widget
 /// </summary>
 /// <remarks>
 /// Styling a widget allows you to access the widget, but not the platform-specific controls (in a type-safe way).
 ///
 /// Typically, you'd use Style.Add&lt;H&gt;(string, StyleHandler&lt;H&gt;) instead, which will add a style based on the widget handler, which
 /// will give you direct and type safe access to platform-specifics of the widget.
 /// </remarks>
 /// <typeparam name="TWidget">Type of the widget to style</typeparam>
 /// <param name="style">Identifier of the style</param>
 /// <param name="handler">Delegate with your logic to style the widget</param>
 public static void Add <TWidget>(string style, StyleWidgetHandler <TWidget> handler)
     where TWidget : Widget
 {
     Styles.Add <TWidget>(style, w => handler(w));
 }