internal void fireClickedEvent(ChartObject obj, PointF pt, MouseButtons mb) { RectangleF rc = obj.getBoundingRect(); float dx = pt.X - rc.X; float dy = pt.Y - rc.Y; int row = 0, col = 0; bool cellClicked; switch (obj.getType()) { case ItemType.Box: if (BoxClicked != null) BoxClicked(this, new BoxMouseArgs((Box)obj, mb, dx, dy, pt)); break; case ItemType.ControlHost: if (ControlHostClicked != null) ControlHostClicked(this, new ControlHostMouseArgs((ControlHost)obj, mb, dx, dy, pt)); break; case ItemType.Table: // raise TableCellClicked if a cell has been clicked and // an event handler is registered for the event cellClicked = ((Table)obj).cellFromPt(pt, ref row, ref col); if (cellClicked && TableCellClicked != null) { TableCellClicked(this, new TableMouseArgs( (Table)obj, mb, dx, dy, col, row)); } // otherwise raise TableClicked else { TableMouseArgs args = new TableMouseArgs((Table)obj, mb, dx, dy, pt); if (cellClicked) { args.col = col; args.row = row; } if (TableClicked != null) TableClicked(this, args); } break; case ItemType.Arrow: if (ArrowClicked != null) ArrowClicked(this, new ArrowMouseArgs((Arrow)obj, mb, dx, dy, pt)); break; } }
internal void fireObjModified(ChartObject obj, PointF pt, int mnpHandle) { switch (obj.getType()) { case ItemType.Box: if (BoxModified != null) { Box box = (Box)obj; BoxMouseArgs args = new BoxMouseArgs( box, pt.X, pt.Y, mnpHandle); BoxModified(this, args); } break; case ItemType.ControlHost: if (ControlHostModified != null) { ControlHost host = (ControlHost)obj; ControlHostMouseArgs args = new ControlHostMouseArgs( host, pt.X, pt.Y, mnpHandle); ControlHostModified(this, args); } break; case ItemType.Table: if (TableModified != null) { Table table = (Table)obj; TableMouseArgs args = new TableMouseArgs( table, pt.X, pt.Y, mnpHandle); TableModified(this, args); } break; case ItemType.Arrow: if (ArrowModified != null) { Arrow arrow = (Arrow)obj; ArrowMouseArgs args = new ArrowMouseArgs( arrow, pt.X, pt.Y, mnpHandle); ArrowModified(this, args); } break; } }