Beispiel #1
0
 public void Activate(BasicView view1)
 {
     view = view1;
     view.invalidate = Invalidate;
     view.resetCursor = ResetCursor;
     view.setCursor = SetCursor;
 }
        public override void OnMouseIsDown(BasicMouseEventArgs e)
        {
            int indX1 = GetSeparatorInd(xpos, e.X);
            int indY1 = GetSeparatorInd(ypos, e.Y);

            if (indX1 >= 0)
            {
                indY1 = -1;
            }
            if (indX1 >= 0 || indY1 >= 0)
            {
                dragging  = true;
                dragX     = indX1 >= 0;
                dragIndex = indX1 >= 0 ? indX1 : indY1;
                return;
            }
            int       indX;
            int       indY;
            BasicView v = GetComponentAt(e.X, e.Y, out indX, out indY);

            if (v != null)
            {
                v.OnMouseIsDown(new BasicMouseEventArgs(e, xpos[indX], ypos[indY], widths[indX], heights[indY]));
                mouseDownX = indX;
                mouseDownY = indY;
            }
        }
        public override void OnMouseMoved(BasicMouseEventArgs e)
        {
            if (xpos == null || ypos == null)
            {
                return;
            }
            int indX = GetSeparatorInd(xpos, e.X);
            int indY = GetSeparatorInd(ypos, e.Y);

            if (indX >= 0)
            {
                indY = -1;
            }
            if (indX >= 0 || indY >= 0)
            {
                Cursor            = indX >= 0 ? Cursors2.VSplit : Cursors2.HSplit;
                currentComponentX = -1;
                currentComponentY = -1;
            }
            else
            {
                ResetCursor();
                currentComponentX = GetCurrentComponentInd(xpos, e.X);
                currentComponentY = GetCurrentComponentInd(ypos, e.Y);
                Tuple <int, int> key = new Tuple <int, int>(currentComponentY, currentComponentX);
                if (components.ContainsKey(key))
                {
                    BasicView v = components[key];
                    try{
                        v.OnMouseMoved(new BasicMouseEventArgs(e, xpos[currentComponentX], ypos[currentComponentY],
                                                               widths[currentComponentX], heights[currentComponentY]));
                    } catch (Exception) {}
                }
            }
        }
        public override void OnMouseWheel(BasicMouseEventArgs e)
        {
            int       indX;
            int       indY;
            BasicView v = GetComponentAt(e.X, e.Y, out indX, out indY);

            v?.OnMouseWheel(new BasicMouseEventArgs(e, xpos[indX], ypos[indY], widths[indX], heights[indY]));
        }
        public override void OnMouseLeave(EventArgs e)
        {
            Tuple <int, int> key = new Tuple <int, int>(currentComponentY, currentComponentX);

            if (components.ContainsKey(key))
            {
                BasicView v = components[key];
                v.OnMouseLeave(e);
            }
        }
        public override void OnMouseIsUp(BasicMouseEventArgs e)
        {
            if (dragging)
            {
                dragging = false;
                return;
            }
            BasicView v = GetComponentAt(mouseDownX, mouseDownY);

            v?.OnMouseIsUp(new BasicMouseEventArgs(e, xpos[mouseDownX], ypos[mouseDownY], widths[mouseDownX], heights[mouseDownY]));
        }
        public override void OnMouseDragged(BasicMouseEventArgs e)
        {
            if (dragging)
            {
            }
            BasicView v = GetComponentAt(mouseDownX, mouseDownY);

            v?.OnMouseDragged(new BasicMouseEventArgs(e, xpos[mouseDownX], ypos[mouseDownY], widths[mouseDownX],
                                                      heights[mouseDownY]));
            //TODO: splitter
        }
 public override void OnResize(EventArgs e, int width, int height)
 {
     widths  = null;
     heights = null;
     xpos    = null;
     ypos    = null;
     InitSizes(width, height);
     for (int row = 0; row < RowCount; row++)
     {
         for (int col = 0; col < ColumnCount; col++)
         {
             Tuple <int, int> key = new Tuple <int, int>(row, col);
             if (components.ContainsKey(key))
             {
                 BasicView v = components[key];
                 v.OnResize(e, widths[col], heights[row]);
             }
         }
     }
 }
 public override void OnPaintBackground(IGraphics g, int width, int height)
 {
     if (widths == null)
     {
         InitSizes(width, height);
     }
     for (int row = 0; row < RowCount; row++)
     {
         for (int col = 0; col < ColumnCount; col++)
         {
             Tuple <int, int> key = new Tuple <int, int>(row, col);
             if (components.ContainsKey(key))
             {
                 BasicView v = components[key];
                 g.TranslateTransform(xpos[col], ypos[row]);
                 v.OnPaintBackground(g, widths[col], heights[row]);
                 g.ResetTransform();
             }
         }
     }
 }
Beispiel #10
0
 public static BasicControl CreateControl(BasicView view)
 {
     BasicControl c = new BasicControl();
     c.Activate(view);
     return c;
 }
 public void Add(BasicView bv, int column, int row)
 {
     bv.Activate(this);
     components.Add(new Tuple <int, int>(row, column), bv);
 }
 public void Add(BasicView bv, int column, int row)
 {
     bv.Activate(this);
     components.Add(new Tuple<int, int>(row, column), bv);
 }
Beispiel #13
0
 public void Activate(BasicView view)
 {
     invalidate = view.Invalidate;
     resetCursor = view.ResetCursor;
     setCursor = c => view.Cursor = c;
 }
Beispiel #14
0
 public void Activate(BasicView view)
 {
     invalidate  = view.Invalidate;
     resetCursor = view.ResetCursor;
     setCursor   = c => view.Cursor = c;
 }