Rev 1404 |
Blame |
Compare with Previous |
Last modification |
View Log
| RSS feed
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace ShapeEditor
.interaction
{
public abstract
class InteractionMode
{
public const int NO_MODE
= -1;
public const int SELECT = 0;
public const int RECTANGLE
= 1;
public const int ELLIPSE
= 2;
public const int POLYGON
= 3;
protected MainForm mParent
= null;
private int mMode
= NO_MODE
;
public int Mode
{ get
{ return mMode
; } }
public InteractionMode
(MainForm parent
)
: this(parent, NO_MODE
)
{
}
public InteractionMode
(MainForm parent,
int mode
)
{
mParent
= parent
;
mMode
= mode
;
}
// public abstract void MouseDown(MouseEventArgs e);
public abstract
void MouseMove
(MouseEventArgs e,
bool isMouseDown
= false);
public abstract
void MouseUp
(MouseEventArgs e
);
public abstract
void Render
();
public static InteractionMode CreateMode
(MainForm parent,
int mode
)
{
switch(mode
)
{
case SELECT:
return new SelectMode
(parent
);
case RECTANGLE
:
return new RectangleMode
(parent
);
case ELLIPSE
:
return new EllipseMode
(parent
);
case POLYGON
:
return new PolygonMode
(parent
);
}
return null;
}
}
}