public void Dispose() { if (_value != null) { StyleHandler.Detach(_value); } }
/// <summary> /// Adds a style for a widget handler /// </summary> /// <remarks> /// Styling a widget handler allows you to access both the widget and the platform-specifics for the widget. /// /// To use this, you would have to add a reference to one of the Eto.Platform.*.dll's so that you can utilize /// the platform handler directly. Typically this would be called before your application is run. /// </remarks> /// <typeparam name="H">Type of the handler that should be styled</typeparam> /// <param name="style">Identifier for the style</param> /// <param name="styleHandler">Delegate with your logic to style the widget and/or platform control</param> public static void Add <H> (string style, StyleHandler <H> styleHandler) where H : class, IWidget { var list = GetStyleList((object)style ?? typeof(H)); list.Add(delegate(InstanceWidget widget) { var handler = widget.Handler as H; if (handler != null) { styleHandler(handler); } }); }
/// <summary> /// Adds a style for a widget handler /// </summary> /// <remarks> /// Styling a widget handler allows you to access both the widget and the platform-specifics for the widget. /// /// To use this, you would have to add a reference to one of the Eto.*.dll's so that you can utilize /// the platform handler directly. Typically this would be called before your application is run. /// </remarks> /// <typeparam name="THandler">Type of the handler that should be styled</typeparam> /// <param name="style">Identifier for the style</param> /// <param name="styleHandler">Delegate with your logic to style the widget and/or platform control</param> public static void Add <THandler>(string style, StyleHandler <THandler> styleHandler) where THandler : class, Widget.IHandler { var list = GetStyleList((object)style ?? typeof(THandler)); list.Add(widget => { var handler = widget.Handler as THandler; if (handler != null) { styleHandler(handler); } }); }
public static void AddHandler <H> (string style, StyleHandler <H> styleHandler) where H : class, IWidget { Style.Add <H> (style, styleHandler); }
/// <summary> /// Adds a style for a widget handler /// </summary> /// <remarks> /// Styling a widget handler allows you to access both the widget and the platform-specifics for the widget. /// /// To use this, you would have to add a reference to one of the Eto.*.dll's so that you can utilize /// the platform handler directly. Typically this would be called before your application is run. /// </remarks> /// <typeparam name="THandler">Type of the handler that should be styled</typeparam> /// <param name="style">Identifier for the style</param> /// <param name="styleHandler">Delegate with your logic to style the widget and/or platform control</param> public static void Add <THandler>(string style, StyleHandler <THandler> styleHandler) where THandler : class, Widget.IHandler { Styles.Add <THandler>(style, w => styleHandler(w)); }
public static void AddHandler <THandler>(string style, StyleHandler <THandler> styleHandler) where THandler : class, IWidget { Style.Add <THandler>(style, styleHandler); }