Exemplo n.º 1
0
 private void PaintDraggedItem(MNPageContext context, PVDragContext mouseContext)
 {
     if (mouseContext.draggedItem != null)
     {
         SMTokenItem ti = mouseContext.draggedItem;
         if (ti.Text != null && ti.Text.Length > 0)
         {
             if (ti.ContentSize.Width == 0)
             {
                 SizeF sf = context.g.MeasureString(ti.Text, context.DragItemFont);
                 ti.ContentSize = new Size(Convert.ToInt32(sf.Width), Convert.ToInt32(sf.Height));
             }
             Rectangle rc = new Rectangle(mouseContext.lastPoint.X - ti.ContentSize.Width / 2,
                                          mouseContext.lastPoint.Y - ti.ContentSize.Height / 2,
                                          ti.ContentSize.Width + 2, ti.ContentSize.Height + 2);
             //context.g.FillRectangle(Brushes.LightPink, rc);
             context.g.DrawString(ti.Text, context.DragItemFont, Brushes.Red, rc);
         }
         else if (ti.Image != null)
         {
             if (ti.ContentSize.Width == 0)
             {
                 Size   sf = ti.Image.Size;
                 double d  = 64.0 / (Math.Max(sf.Width, sf.Height) + 1);
                 ti.ContentSize = new Size(Convert.ToInt32(d * sf.Width), Convert.ToInt32(d * sf.Height));
             }
             Rectangle rc = new Rectangle(mouseContext.lastPoint.X - ti.ContentSize.Width / 2,
                                          mouseContext.lastPoint.Y - ti.ContentSize.Height / 2,
                                          ti.ContentSize.Width + 2, ti.ContentSize.Height + 2);
             context.g.DrawImage(ti.Image, rc);
         }
     }
 }
Exemplo n.º 2
0
 public void OnDragHotTrackEnded(SMTokenItem item, PVDragContext context)
 {
     if (Document != null)
     {
         scheduledScripts.Clear();
         ExtractControlConnections(context.trackedControl, scheduledScripts, "OnDragHotTrackEnded");
         ExecuteScheduledObjects(context.trackedControl);
     }
 }
Exemplo n.º 3
0
 public void OnDragMove(SMControl control, SMTokenItem token, PVDragContext context)
 {
     if (Document != null)
     {
         scheduledScripts.Clear();
         ExtractControlConnections(control, scheduledScripts, "OnDragMove");
         ExecuteScheduledObjects(control);
     }
 }
Exemplo n.º 4
0
 public void OnTapEnd(SMControl control, PVDragContext context)
 {
     if (Document != null)
     {
         scheduledScripts.Clear();
         ExtractControlConnections(control, scheduledScripts, "OnTapEnd");
         ExecuteScheduledObjects(control);
     }
 }
Exemplo n.º 5
0
 public bool OnDropWillFinish(SMControl control, PVDragContext context)
 {
     if (Document != null)
     {
         scheduledScripts.Clear();
         ExtractControlConnections(control, scheduledScripts, "OnDropWillFinish");
         ExecuteScheduledObjects(control);
     }
     return(true);
 }
Exemplo n.º 6
0
 public void OnClick(SMControl control, PVDragContext context)
 {
     if (Document != null)
     {
         scheduledScripts.Clear();
         if (control.ScriptOnClick.Length > 0)
         {
             scheduledScripts.Add(control.ScriptOnClick);
         }
         ExecuteScheduledObjects(control);
     }
 }
Exemplo n.º 7
0
        // control events
        public void OnDragFinished(SMControl control, SMTokenItem token, PVDragContext context)
        {
            // find all connections of type "partOfGroup" where target is control
            // and notify parent group that this event has occured

            // find all activities in graph that are target conected to this control as source and have
            // name of connection as this event
            // and execute them and then execute their successors
            if (Document != null)
            {
                scheduledScripts.Clear();
                ExtractControlConnections(control, scheduledScripts, "OnDragFinished");
                ExecuteScheduledObjects(control);
            }
        }