Free cookie consent management tool by TermsFeed Policy Generator

source: trunk/sources/HeuristicLab.ExtLibs/HeuristicLab.Netron/3.0.2672.12446/Netron.Diagramming.Core-3.0.2672.12446/Tools/GroupTool.cs @ 12012

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

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

File size: 2.2 KB
Line 
1using System.Windows.Forms;
2
3namespace Netron.Diagramming.Core {
4  /// <summary>
5  /// Group tool
6  /// </summary>
7  class GroupTool : AbstractTool, IMouseListener {
8
9    #region Fields
10
11    #endregion
12
13    #region Constructor
14    /// <summary>
15    /// Initializes a new instance of the <see cref="T:GroupTool"/> class.
16    /// </summary>
17    /// <param name="name">The name of the tool.</param>
18    public GroupTool(string name)
19      : base(name) {
20    }
21    #endregion
22
23    #region Methods
24
25    /// <summary>
26    /// Called when the tool is activated.
27    /// </summary>
28    protected override void OnActivateTool() {
29      bool valid = true;
30      //make sure we have the correct stuff on the table
31      if (this.Controller.Model.Selection.SelectedItems == null || this.Controller.Model.Selection.SelectedItems.Count == 0) {
32        MessageBox.Show("Nothing is selected, you need to select at least two items to create a group.", "Nothing selected.", MessageBoxButtons.OK, MessageBoxIcon.Hand);
33        valid = false;
34      } else if (this.Controller.Model.Selection.SelectedItems.Count <= 1) {
35        MessageBox.Show("You need at least two items to create a group.", "Multiple items.", MessageBoxButtons.OK, MessageBoxIcon.Hand);
36        valid = false;
37      }
38      if (valid) {
39        Bundle bundle = new Bundle(this.Controller.Model.Selection.SelectedItems);
40
41        GroupCommand cmd = new GroupCommand(this.Controller, bundle);
42
43        this.Controller.UndoManager.AddUndoCommand(cmd);
44
45        cmd.Redo();
46      }
47      DeactivateTool();
48      return;
49    }
50
51    /// <summary>
52    /// Handles the mouse down event
53    /// </summary>
54    /// <param name="e">The <see cref="T:System.Windows.Forms.MouseEventArgs"/> instance containing the event data.</param>
55    public bool MouseDown(MouseEventArgs e) {
56      return false;
57    }
58
59    /// <summary>
60    /// Handles the mouse move event
61    /// </summary>
62    /// <param name="e">The <see cref="T:System.Windows.Forms.MouseEventArgs"/> instance containing the event data.</param>
63    public void MouseMove(MouseEventArgs e) {
64
65    }
66    public void MouseUp(MouseEventArgs e) {
67
68    }
69    #endregion
70
71
72  }
73
74}
Note: See TracBrowser for help on using the repository browser.