Free cookie consent management tool by TermsFeed Policy Generator

source: tags/3.3.7/HeuristicLab.ExtLibs/HeuristicLab.Netron/3.0.2672.12446/Netron.Diagramming.Core-3.0.2672.12446/Diagram elements/Materials/ClickableIconMaterial.cs @ 13398

Last change on this file since 13398 was 4068, checked in by swagner, 14 years ago

Sorted usings and removed unused usings in entire solution (#1094)

File size: 4.1 KB
Line 
1using System;
2using System.Windows.Forms;
3namespace Netron.Diagramming.Core {
4  /// <summary>
5  /// Clickable icon shape material
6  /// </summary>
7  public partial class ClickableIconMaterial : IconMaterial, IMouseListener, IHoverListener {
8    #region Fields
9
10    // ------------------------------------------------------------------
11    /// <summary>
12    /// Implementation of IVersion - the current version of
13    /// ClickableIconMaterial.
14    /// </summary>
15    // ------------------------------------------------------------------
16    protected double clickableIconMaterialVersion = 1.0;
17
18    #endregion
19
20    #region Properties
21
22    // ------------------------------------------------------------------
23    /// <summary>
24    /// Gets the current version.
25    /// </summary>
26    // ------------------------------------------------------------------
27    public override double Version {
28      get {
29        return clickableIconMaterialVersion;
30      }
31    }
32
33    #endregion
34
35    #region Constructor
36    /// <summary>
37    /// Initializes a new instance of the <see cref="T:ClickableIconMaterial"/> class.
38    /// </summary>
39    /// <param name="resourceLocation">The resource location.</param>
40    public ClickableIconMaterial(string resourceLocation)
41      : base(resourceLocation) {
42      Resizable = false;
43    }
44    /// <summary>
45    /// Initializes a new instance of the <see cref="T:ClickableIconMaterial"/> class.
46    /// </summary>
47    public ClickableIconMaterial()
48      : base() {
49      Resizable = false;
50    }
51    #endregion
52
53    #region Methods
54    /// <summary>
55    /// Gets the service object of the specified type.
56    /// </summary>
57    /// <param name="serviceType">An object that specifies the type of service object to get.</param>
58    /// <returns>
59    /// A service object of type serviceType.-or- null if there is no service object of type serviceType.
60    /// </returns>
61    public override object GetService(Type serviceType) {
62      if (serviceType.Equals(typeof(IMouseListener)))
63        return this;
64      else if (serviceType.Equals(typeof(IHoverListener)))
65        return this;
66      else
67        return null;
68    }
69
70    /// <summary>
71    /// Handles the mouse-down event
72    /// </summary>
73    /// <param name="e">The <see cref="T:MouseEventArgs"/> instance containing the event data.</param>
74    public virtual bool MouseDown(MouseEventArgs e) {
75      //if(this.Rectangle.Contains(e.Location))
76      //    this.Shape.ShapeColor = Color.Yellow;           
77      return false;
78    }
79
80    /// <summary>
81    /// Handles the mouse-move event
82    /// </summary>
83    /// <param name="e">The <see cref="T:MouseEventArgs"/> instance containing the event data.</param>
84    public void MouseMove(MouseEventArgs e) {
85      System.Diagnostics.Trace.WriteLine(e.Location.ToString());
86    }
87
88    /// <summary>
89    /// Handles the mouse-up event
90    /// </summary>
91    /// <param name="e">The <see cref="T:MouseEventArgs"/> instance containing the event data.</param>
92    public virtual void MouseUp(MouseEventArgs e) {
93
94    }
95    #endregion
96
97
98
99    #region IHoverListener Members
100    /// <summary>
101    /// Handles the <see cref="OnMouseHover"/> event.
102    /// </summary>
103    /// <param name="e">The <see cref="T:System.Windows.Forms.MouseEventArgs"/> instance containing the event data.</param>
104    public void MouseHover(MouseEventArgs e) {
105
106    }
107    private Cursor previousCursor;
108    /// <summary>
109    /// Handles the OnMouseEnter event.
110    /// </summary>
111    /// <param name="e">The <see cref="T:System.Windows.Forms.MouseEventArgs"/> instance containing the event data.</param>
112    public void MouseEnter(MouseEventArgs e) {
113      previousCursor = Cursor.Current;
114      this.Shape.Model.RaiseOnCursorChange(Cursors.Hand);
115    }
116
117    /// <summary>
118    /// Handles the OnMouseLeave event.
119    /// </summary>
120    /// <param name="e">The <see cref="T:System.Windows.Forms.MouseEventArgs"/> instance containing the event data.</param>
121    public void MouseLeave(MouseEventArgs e) {
122      this.Shape.Model.RaiseOnCursorChange(previousCursor);
123    }
124
125    #endregion
126  }
127}
Note: See TracBrowser for help on using the repository browser.