moel@345
|
1 |
using System;
|
moel@345
|
2 |
using System.Collections.Generic;
|
moel@345
|
3 |
using System.Text;
|
moel@345
|
4 |
using System.Windows.Forms;
|
moel@345
|
5 |
using System.Security.Permissions;
|
moel@345
|
6 |
using System.Drawing;
|
moel@345
|
7 |
|
moel@345
|
8 |
namespace Aga.Controls.Tree
|
moel@345
|
9 |
{
|
moel@345
|
10 |
internal class ResizeColumnState: ColumnState
|
moel@345
|
11 |
{
|
moel@345
|
12 |
private Point _initLocation;
|
moel@345
|
13 |
private int _initWidth;
|
moel@345
|
14 |
|
moel@345
|
15 |
public ResizeColumnState(TreeViewAdv tree, TreeColumn column, Point p)
|
moel@345
|
16 |
: base(tree, column)
|
moel@345
|
17 |
{
|
moel@345
|
18 |
_initLocation = p;
|
moel@345
|
19 |
_initWidth = column.Width;
|
moel@345
|
20 |
}
|
moel@345
|
21 |
|
moel@345
|
22 |
public override void KeyDown(KeyEventArgs args)
|
moel@345
|
23 |
{
|
moel@345
|
24 |
args.Handled = true;
|
moel@345
|
25 |
if (args.KeyCode == Keys.Escape)
|
moel@345
|
26 |
FinishResize();
|
moel@345
|
27 |
}
|
moel@345
|
28 |
|
moel@345
|
29 |
public override void MouseDown(TreeNodeAdvMouseEventArgs args)
|
moel@345
|
30 |
{
|
moel@345
|
31 |
}
|
moel@345
|
32 |
|
moel@345
|
33 |
public override void MouseUp(TreeNodeAdvMouseEventArgs args)
|
moel@345
|
34 |
{
|
moel@345
|
35 |
FinishResize();
|
moel@345
|
36 |
}
|
moel@345
|
37 |
|
moel@345
|
38 |
private void FinishResize()
|
moel@345
|
39 |
{
|
moel@345
|
40 |
Tree.ChangeInput();
|
moel@345
|
41 |
Tree.FullUpdate();
|
moel@345
|
42 |
Tree.OnColumnWidthChanged(Column);
|
moel@345
|
43 |
}
|
moel@345
|
44 |
|
moel@345
|
45 |
public override bool MouseMove(MouseEventArgs args)
|
moel@345
|
46 |
{
|
moel@345
|
47 |
Column.Width = _initWidth + args.Location.X - _initLocation.X;
|
moel@345
|
48 |
Tree.UpdateView();
|
moel@345
|
49 |
return true;
|
moel@345
|
50 |
}
|
moel@345
|
51 |
|
moel@345
|
52 |
public override void MouseDoubleClick(TreeNodeAdvMouseEventArgs args)
|
moel@345
|
53 |
{
|
moel@345
|
54 |
Tree.AutoSizeColumn(Column);
|
moel@345
|
55 |
}
|
moel@345
|
56 |
}
|
moel@345
|
57 |
}
|