SvgElement.cs 37.9 KB
Newer Older
1001
        	var handler = MouseScroll;
joreg's avatar
joreg committed
1002
1003
            if (handler != null)
            {
1004
                handler(sender, e);
joreg's avatar
joreg committed
1005
1006
            }
        }
1007
        
Tebjan Halm's avatar
Tebjan Halm committed
1008
1009
        #endregion graphical EVENTS
    }
1010
    
Tebjan Halm's avatar
Tebjan Halm committed
1011
1012
1013
1014
1015
1016
    public class SVGArg : EventArgs
    {
    	public string SessionID;
    }
    	
    
1017
1018
1019
    /// <summary>
    /// Describes the Attribute which was set
    /// </summary>
Tebjan Halm's avatar
Tebjan Halm committed
1020
    public class AttributeEventArgs : SVGArg
1021
1022
1023
1024
    {
    	public string Attribute;
    	public object Value;
    }
tebjan's avatar
tebjan committed
1025
    
tebjan's avatar
tebjan committed
1026
1027
1028
1029
1030
1031
1032
1033
    /// <summary>
    /// Content of this whas was set
    /// </summary>
    public class ContentEventArgs : SVGArg
    {
    	public string Content;
    }
    
tebjan's avatar
tebjan committed
1034
1035
1036
1037
1038
1039
    /// <summary>
    /// Describes the Attribute which was set
    /// </summary>
    public class ChildAddedEventArgs : SVGArg
    {
    	public SvgElement NewChild;
1040
    	public SvgElement BeforeSibling;
tebjan's avatar
tebjan committed
1041
    }
Tebjan Halm's avatar
Tebjan Halm committed
1042

Eric Domke's avatar
Eric Domke committed
1043
#if Net4
1044
1045
1046
    //deriving class registers event actions and calls the actions if the event occurs
    public interface ISvgEventCaller
    {
1047
        void RegisterAction(string rpcID, Action action);
1048
1049
1050
1051
        void RegisterAction<T1>(string rpcID, Action<T1> action);
        void RegisterAction<T1, T2>(string rpcID, Action<T1, T2> action);
        void RegisterAction<T1, T2, T3>(string rpcID, Action<T1, T2, T3> action);
        void RegisterAction<T1, T2, T3, T4>(string rpcID, Action<T1, T2, T3, T4> action);
Tebjan Halm's avatar
Tebjan Halm committed
1052
        void RegisterAction<T1, T2, T3, T4, T5>(string rpcID, Action<T1, T2, T3, T4, T5> action);
1053
1054
1055
        void RegisterAction<T1, T2, T3, T4, T5, T6>(string rpcID, Action<T1, T2, T3, T4, T5, T6> action);
        void RegisterAction<T1, T2, T3, T4, T5, T6, T7>(string rpcID, Action<T1, T2, T3, T4, T5, T6, T7> action);
        void RegisterAction<T1, T2, T3, T4, T5, T6, T7, T8>(string rpcID, Action<T1, T2, T3, T4, T5, T6, T7, T8> action);
1056
        void UnregisterAction(string rpcID);
1057
    }
Eric Domke's avatar
Eric Domke committed
1058
#endif
1059

Tebjan Halm's avatar
Tebjan Halm committed
1060
1061
1062
    /// <summary>
    /// Represents the state of the mouse at the moment the event occured.
    /// </summary>
Tebjan Halm's avatar
Tebjan Halm committed
1063
    public class MouseArg : SVGArg
Tebjan Halm's avatar
Tebjan Halm committed
1064
1065
1066
1067
1068
    {
        public float x;
        public float y;

        /// <summary>
1069
        /// 1 = left, 2 = middle, 3 = right
Tebjan Halm's avatar
Tebjan Halm committed
1070
        /// </summary>
1071
        public int Button;
1072
        
1073
1074
1075
        /// <summary>
        /// Amount of mouse clicks, e.g. 2 for double click
        /// </summary>
1076
        public int ClickCount = -1;
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
        
        /// <summary>
        /// Alt modifier key pressed
        /// </summary>
        public bool AltKey;
        
        /// <summary>
        /// Shift modifier key pressed
        /// </summary>
        public bool ShiftKey;
        
        /// <summary>
        /// Control modifier key pressed
        /// </summary>
        public bool CtrlKey;
1092
    }
joreg's avatar
joreg committed
1093
1094
1095
1096
    
    /// <summary>
    /// Represents a string argument
    /// </summary>
Tebjan Halm's avatar
Tebjan Halm committed
1097
    public class StringArg : SVGArg
joreg's avatar
joreg committed
1098
1099
1100
    {
        public string s;
    }
1101
1102
1103
1104
    
    public class MouseScrollArg : SVGArg
    {
    	public int Scroll;
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
    	
    	/// <summary>
        /// Alt modifier key pressed
        /// </summary>
        public bool AltKey;
        
        /// <summary>
        /// Shift modifier key pressed
        /// </summary>
        public bool ShiftKey;
        
        /// <summary>
        /// Control modifier key pressed
        /// </summary>
        public bool CtrlKey;
1120
    }
1121

1122
1123
1124
1125
1126
    public interface ISvgNode
    {
        string Content { get; }
    }

davescriven's avatar
davescriven committed
1127
1128
    internal interface ISvgElement
    {
1129
1130
		SvgElement Parent {get;}
		SvgElementCollection Children { get; }
1131
        IList<ISvgNode> Nodes { get; }
1132

Eric Domke's avatar
Eric Domke committed
1133
        void Render(ISvgRenderer renderer);
davescriven's avatar
davescriven committed
1134
1135
    }
}