Last change
on this file since 12277 was
4068,
checked in by swagner, 14 years ago
|
Sorted usings and removed unused usings in entire solution (#1094)
|
File size:
1.7 KB
|
Line | |
---|
1 | using System;
|
---|
2 | using System.Drawing;
|
---|
3 | using System.Windows.Forms;
|
---|
4 | using Netron.Diagramming.Core;
|
---|
5 |
|
---|
6 | namespace HeuristicLab.Netron {
|
---|
7 | public class ExpandableIconMaterial : IconMaterial, IMouseListener {
|
---|
8 | private Bitmap collapsedBitmap;
|
---|
9 | private Bitmap expandedBitmap;
|
---|
10 |
|
---|
11 | public ExpandableIconMaterial(Bitmap collapsedBitmap, Bitmap expandedBitmap)
|
---|
12 | : base() {
|
---|
13 | this.collapsedBitmap = collapsedBitmap;
|
---|
14 | this.expandedBitmap = expandedBitmap;
|
---|
15 |
|
---|
16 | this.Gliding = false;
|
---|
17 | this.Collapsed = true;
|
---|
18 | }
|
---|
19 |
|
---|
20 | public event EventHandler OnCollapse;
|
---|
21 | public event EventHandler OnExpand;
|
---|
22 |
|
---|
23 | private bool collapsed;
|
---|
24 | public bool Collapsed {
|
---|
25 | get { return this.collapsed; }
|
---|
26 | set {
|
---|
27 | if (value != this.collapsed) {
|
---|
28 | if (value) {
|
---|
29 | this.Icon = this.collapsedBitmap;
|
---|
30 | } else
|
---|
31 | this.Icon = this.expandedBitmap;
|
---|
32 | collapsed = value;
|
---|
33 | RaiseOnExpand();
|
---|
34 | }
|
---|
35 | }
|
---|
36 | }
|
---|
37 |
|
---|
38 | private void RaiseOnExpand() {
|
---|
39 | if (OnExpand != null)
|
---|
40 | OnExpand(this, EventArgs.Empty);
|
---|
41 | }
|
---|
42 | private void RaiseOnCollapse() {
|
---|
43 | if (OnCollapse != null)
|
---|
44 | OnCollapse(this, EventArgs.Empty);
|
---|
45 | }
|
---|
46 |
|
---|
47 |
|
---|
48 | #region IMouseListener Members
|
---|
49 | public override object GetService(Type serviceType) {
|
---|
50 | if (serviceType.Equals(typeof(IMouseListener)))
|
---|
51 | return this;
|
---|
52 | return null;
|
---|
53 | }
|
---|
54 |
|
---|
55 | public bool MouseDown(MouseEventArgs e) {
|
---|
56 | if (e.Clicks == 1) {
|
---|
57 | Collapsed = !Collapsed;
|
---|
58 | return true;
|
---|
59 | }
|
---|
60 | return false;
|
---|
61 | }
|
---|
62 |
|
---|
63 | public void MouseMove(System.Windows.Forms.MouseEventArgs e) {
|
---|
64 | }
|
---|
65 |
|
---|
66 | public void MouseUp(System.Windows.Forms.MouseEventArgs e) {
|
---|
67 | }
|
---|
68 | #endregion
|
---|
69 | }
|
---|
70 | }
|
---|
Note: See
TracBrowser
for help on using the repository browser.