Click here to Skip to main content
15,895,709 members
Articles / Desktop Programming / WPF

SharpVectors - SVG# Reloaded: An Introduction

Rate me:
Please Sign up or sign in to vote.
4.98/5 (33 votes)
17 Nov 2010BSD10 min read 205.9K   21.7K   101  
A C# library for converting SVG to WPF and viewing SVG files in WPF Applications
using System;

using SharpVectors.Dom.Views;

namespace SharpVectors.Dom.Events
{
	/// <summary>
	/// Summary description for KeyboardEvent.
	/// </summary>
	public class KeyboardEvent : UiEvent, IKeyboardEvent
	{
		#region Private Fields
		
		private string keyIdentifier;
		private KeyLocationCode keyLocation;
		private bool ctrlKey;
		private bool shiftKey;
		private bool altKey;
		private bool metaKey;
		private bool altGraphKey;
		
		#endregion
		
		#region Constructors
		
		public KeyboardEvent()
		{
		}
		
		public KeyboardEvent(
			string eventType,
			bool bubbles,
			bool cancelable,
			IAbstractView view,
			string keyIdentifier,
			KeyLocationCode keyLocation,
			bool ctrlKey,
			bool shiftKey,
			bool altKey,
			bool metaKey,
			bool altGraphKey)
		{
			InitKeyboardEvent(
				eventType, bubbles, cancelable, view,
				keyIdentifier, keyLocation,
				ctrlKey, shiftKey, altKey, metaKey, altGraphKey);
		}
		
		public KeyboardEvent(
			string namespaceUri,
			string eventType,
			bool bubbles,
			bool cancelable,
			IAbstractView view,
			string keyIdentifier,
			KeyLocationCode keyLocation,
			bool ctrlKey,
			bool shiftKey,
			bool altKey,
			bool metaKey,
			bool altGraphKey)
		{
			InitKeyboardEventNs(
				namespaceUri, eventType, bubbles, cancelable, view,
				keyIdentifier, keyLocation,
				ctrlKey, shiftKey, altKey, metaKey, altGraphKey);
		}
		
		#endregion
		
		#region IKeyboardEvent interface
		
		#region Public Properties
		
		public string KeyIdentifier
		{
			get
			{
				return keyIdentifier;
			}
		}
		
		public KeyLocationCode KeyLocation
		{
			get
			{
				return keyLocation;
			}
		}
		
		public bool CtrlKey
		{
			get
			{
				return ctrlKey;
			}
		}
		
		public bool ShiftKey
		{
			get
			{
				return shiftKey;
			}
		}
		
		public bool AltKey
		{
			get
			{
				return altKey;
			}
		}
		
		public bool MetaKey
		{
			get
			{
				return metaKey;
			}
		}
		
		public bool AltGraphKey
		{
			get
			{
				return altGraphKey;
			}
		}
		
		#endregion
		
		#region Public Methods
		
		public void InitKeyboardEvent(
			string eventType,
			bool bubbles,
			bool cancelable,
			IAbstractView view,
			string keyIdentifier,
			KeyLocationCode keyLocation,
			bool ctrlKey,
			bool shiftKey,
			bool altKey,
			bool metaKey,
			bool altGraphKey)
		{
			InitUiEvent(eventType, bubbles, cancelable, view, 0);
			
			this.keyIdentifier = keyIdentifier;
			this.keyLocation = keyLocation;
			this.ctrlKey = ctrlKey;
			this.shiftKey = shiftKey;
			this.altKey = altKey;
			this.metaKey = metaKey;
			this.altGraphKey = altGraphKey;
		}
		
		public void InitKeyboardEventNs(
			string namespaceUri,
			string eventType,
			bool bubbles,
			bool cancelable,
			IAbstractView view,
			string keyIdentifier,
			KeyLocationCode keyLocation,
			bool ctrlKey,
			bool shiftKey,
			bool altKey,
			bool metaKey,
			bool altGraphKey)
		{
			InitUiEventNs(namespaceUri, eventType, bubbles, cancelable, view, 0);
			
			this.keyIdentifier = keyIdentifier;
			this.keyLocation = keyLocation;
			this.ctrlKey = ctrlKey;
			this.shiftKey = shiftKey;
			this.altKey = altKey;
			this.metaKey = metaKey;
			this.altGraphKey = altGraphKey;
		}
		
		#endregion
		
		#endregion
	}
}

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

This article, along with any associated source code and files, is licensed under The BSD License


Written By
Engineer
Japan Japan
Systems Engineer

Comments and Discussions