SvgVisualElementStyle.cs 1.99 KB
Newer Older
davescriven's avatar
davescriven committed
1
2
using System;
using System.Collections.Generic;
Eric Domke's avatar
Eric Domke committed
3
using System.Drawing;
davescriven's avatar
davescriven committed
4
5
6
using System.Text;
using System.Reflection;
using System.ComponentModel;
7
8
9
using Svg.DataTypes;
using System.Text.RegularExpressions;
using System.Linq;
davescriven's avatar
davescriven committed
10
11
12

namespace Svg
{
13
    public abstract partial class SvgVisualElement
davescriven's avatar
davescriven committed
14
15
16
17
    {
        /// <summary>
        /// Gets or sets a value to determine whether the element will be rendered.
        /// </summary>
Tebjan Halm's avatar
Tebjan Halm committed
18
        [TypeConverter(typeof(SvgBoolConverter))]
davescriven's avatar
davescriven committed
19
20
21
        [SvgAttribute("visibility")]
        public virtual bool Visible
        {
C Moore's avatar
C Moore committed
22
            get { return (this.Attributes["visibility"] == null) ? true : (bool)this.Attributes["visibility"]; }
Tebjan Halm's avatar
Tebjan Halm committed
23
            set { this.Attributes["visibility"] = value; }
davescriven's avatar
davescriven committed
24
25
        }

C Moore's avatar
C Moore committed
26
27
28
29
30
31
32
33
34
35
36
        /// <summary>
        /// Gets or sets a value to determine whether the element will be rendered.
        /// Needed to support SVG attribute display="none"
        /// </summary>
        [SvgAttribute("display")]
        public virtual string Display
        {
            get { return this.Attributes["display"] as string; }
            set { this.Attributes["display"] = value; }
        }

C Moore's avatar
C Moore committed
37
38
39
40
41
42
43
44
45
46
47
48
49
        // Displayable - false if attribute display="none", true otherwise
        protected virtual bool Displayable
        {
            get
            {
                string checkForDisplayNone = this.Attributes["display"] as string;
                if ((!string.IsNullOrEmpty(checkForDisplayNone)) && (checkForDisplayNone == "none"))
                    return false;
                else
                    return true;
            }
        }

Eric Domke's avatar
Eric Domke committed
50
51
52
53
54
55
56
57
58
59
        /// <summary>
        /// Gets or sets the fill <see cref="SvgPaintServer"/> of this element.
        /// </summary>
        [SvgAttribute("enable-background")]
        public virtual string EnableBackground
        {
            get { return this.Attributes["enable-background"] as string; }
            set { this.Attributes["enable-background"] = value; }
        }

davescriven's avatar
davescriven committed
60
61
    }
}