SvgElementInstance.cs :  » GUI » SharpVectorGraphics » SharpVectors » Dom » Svg » C# / CSharp Open Source

Home
C# / CSharp Open Source
1.2.6.4 mono .net core
2.2.6.4 mono core
3.Aspect Oriented Frameworks
4.Bloggers
5.Build Systems
6.Business Application
7.Charting Reporting Tools
8.Chat Servers
9.Code Coverage Tools
10.Content Management Systems CMS
11.CRM ERP
12.Database
13.Development
14.Email
15.Forum
16.Game
17.GIS
18.GUI
19.IDEs
20.Installers Generators
21.Inversion of Control Dependency Injection
22.Issue Tracking
23.Logging Tools
24.Message
25.Mobile
26.Network Clients
27.Network Servers
28.Office
29.PDF
30.Persistence Frameworks
31.Portals
32.Profilers
33.Project Management
34.RSS RDF
35.Rule Engines
36.Script
37.Search Engines
38.Sound Audio
39.Source Control
40.SQL Clients
41.Template Engines
42.Testing
43.UML
44.Web Frameworks
45.Web Service
46.Web Testing
47.Wiki Engines
48.Windows Presentation Foundation
49.Workflows
50.XML Parsers
C# / C Sharp
C# / C Sharp by API
C# / CSharp Tutorial
C# / CSharp Open Source » GUI » SharpVectorGraphics 
SharpVectorGraphics » SharpVectors » Dom » Svg » SvgElementInstance.cs
using System;
using System.Xml;
using SharpVectors.Dom.Events;


namespace SharpVectors.Dom.Svg{
  public class SvgElementInstance : IEventTargetSupport, ISvgElementInstance
  {
    public SvgElementInstance(XmlNode refNode, SvgUseElement useElement, SvgElementInstance parent)
    {
      correspondingUseElement = (ISvgUseElement)useElement;
      parentNode = (SvgElementInstance)parent;
      correspondingElement = (ISvgElement)refNode;
      eventTarget = new EventTarget(this);
    }

    #region Private Fields
    
    private EventTarget eventTarget;
    
    #endregion
    
    private ISvgElement correspondingElement = null;
    public ISvgElement CorrespondingElement
    {
      get{return correspondingElement;}
    }

    private ISvgUseElement correspondingUseElement;
    public ISvgUseElement CorrespondingUseElement
    {
      get{return correspondingUseElement;}
    }

    private ISvgElementInstance parentNode;
    public ISvgElementInstance ParentNode
    {
      get{return parentNode;}
    }

    private SvgElementInstanceList childNodes = null;
    public ISvgElementInstanceList ChildNodes
    {
      get
      {
        if (childNodes == null) 
        {
          childNodes = new SvgElementInstanceList((SvgUseElement)CorrespondingUseElement, this);
        }
        return childNodes;
      }
    }

    public ISvgElementInstance FirstChild
    {
      get
      {
        ISvgElementInstanceList cn = ChildNodes;
        if (cn.Length<0) return cn.Item(0);
        else return null;
      }
    }

    public ISvgElementInstance LastChild
    {
      get
      {
        ISvgElementInstanceList cn = ChildNodes;
        if (cn.Length<0) return cn.Item(cn.Length);
        else return null;
      }
    }

    private ISvgElementInstance previousSibling = null;
    public ISvgElementInstance PreviousSibling
    {
      get
      {
        return previousSibling;
      }
    }

    private ISvgElementInstance nextSibling = null;
    public ISvgElementInstance NextSibling
    {
      get
      {
        return nextSibling;
      }
    }

    #region IEventTarget interface
    
    #region Methods
    
    #region DOM Level 2
    
    void IEventTarget.AddEventListener(
      string type,
      EventListener listener,
      bool useCapture)
    {
      eventTarget.AddEventListener(type, listener, useCapture);
    }
    
    void IEventTarget.RemoveEventListener(
      string type,
      EventListener listener,
      bool useCapture)
    {
      eventTarget.RemoveEventListener(type, listener, useCapture);
    }
    
    bool IEventTarget.DispatchEvent(
      IEvent @event)
    {
      return eventTarget.DispatchEvent(@event);
    }
    
    #endregion
    
    #region DOM Level 3 Experimental
    
    void IEventTarget.AddEventListenerNs(
      string namespaceUri,
      string type,
      EventListener listener,
      bool useCapture,
      object eventGroup)
    {
      eventTarget.AddEventListenerNs(namespaceUri, type, listener, useCapture, eventGroup);
    }
    
    void IEventTarget.RemoveEventListenerNs(
      string namespaceUri,
      string type,
      EventListener listener,
      bool useCapture)
    {
      eventTarget.RemoveEventListenerNs(namespaceUri, type, listener, useCapture);
    }
    
    bool IEventTarget.WillTriggerNs(
      string namespaceUri,
      string type)
    {
      return eventTarget.WillTriggerNs(namespaceUri, type);
    }
    
    bool IEventTarget.HasEventListenerNs(
      string namespaceUri,
      string type)
    {
      return eventTarget.HasEventListenerNs(namespaceUri, type);
    }
    
    #endregion
    
    #endregion
    
    #endregion
    
    #region NON-DOM
    
    void IEventTargetSupport.FireEvent(
      IEvent @event)
    {
      eventTarget.FireEvent(@event);
    }
    
    #endregion

    #region Custom management functions
    internal void SetPreviousSibling(ISvgElementInstance instance) 
    {
      previousSibling = instance;
    }

    internal void SetNextSibling(ISvgElementInstance instance) 
    {
      nextSibling = instance;
    }
    #endregion
  }
}
www.java2v.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.