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 @ 4068

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

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

File size: 2.2 KB
RevLine 
[2768]1using System.Windows.Forms;
2
[4068]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
[2768]14    /// <summary>
[4068]15    /// Initializes a new instance of the <see cref="T:GroupTool"/> class.
[2768]16    /// </summary>
[4068]17    /// <param name="name">The name of the tool.</param>
18    public GroupTool(string name)
19      : base(name) {
20    }
21    #endregion
[2768]22
[4068]23    #region Methods
[2768]24
[4068]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);
[2768]40
[4068]41        GroupCommand cmd = new GroupCommand(this.Controller, bundle);
[2768]42
[4068]43        this.Controller.UndoManager.AddUndoCommand(cmd);
[2768]44
[4068]45        cmd.Redo();
46      }
47      DeactivateTool();
48      return;
49    }
[2768]50
[4068]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    }
[2768]58
[4068]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) {
[2768]64
[4068]65    }
66    public void MouseUp(MouseEventArgs e) {
[2768]67
[4068]68    }
69    #endregion
[2768]70
71
[4068]72  }
[2768]73
74}
Note: See TracBrowser for help on using the repository browser.