public override void Initialize()
        {
            Canvas.RemoveInputEventListener(Canvas.PanEventHandler);

            // Create a decorator group that is NOT volatile
            DecoratorGroup dg = new DecoratorGroup();

            dg.Brush = Brushes.Magenta;

            // Put some nodes under the group for it to decorate
            PPath p1 = PPath.CreateEllipse(25, 25, 75, 75);

            p1.Brush = Brushes.Red;
            PPath p2 = PPath.CreateRectangle(125, 75, 50, 50);

            p2.Brush = Brushes.Blue;

            // Add everything to the Piccolo hierarchy
            dg.AddChild(p1);
            dg.AddChild(p2);
            Canvas.Layer.AddChild(dg);

            // Create a decorator group that IS volatile
            VolatileDecoratorGroup vdg = new VolatileDecoratorGroup(Canvas.Camera);

            vdg.Brush = Brushes.Cyan;

            // Put some nodes under the group for it to decorate
            PPath p3 = PPath.CreateEllipse(275, 175, 50, 50);

            p3.Brush = Brushes.Blue;
            PPath p4 = PPath.CreateRectangle(175, 175, 75, 75);

            p4.Brush = Brushes.Green;

            // Add everything to the Piccolo hierarchy
            vdg.AddChild(p3);
            vdg.AddChild(p4);
            Canvas.Layer.AddChild(vdg);

            // Create a selection handler so we can see that the decorator actually works
            PNodeList selectableParents = new PNodeList();

            selectableParents.Add(dg);
            selectableParents.Add(vdg);

            PSelectionEventHandler ps = new PSelectionEventHandler(Canvas.Layer, selectableParents);

            Canvas.AddInputEventListener(ps);
        }
Example #2
0
		public override void Initialize() {
			Canvas.RemoveInputEventListener(Canvas.PanEventHandler);

			// Create a decorator group that is NOT volatile		
			DecoratorGroup dg = new DecoratorGroup();
			dg.Brush = Brushes.Magenta;
		
			// Put some nodes under the group for it to decorate
			PPath p1 = PPath.CreateEllipse(25,25,75,75);
			p1.Brush = Brushes.Red;
			PPath p2 = PPath.CreateRectangle(125,75,50,50); 
			p2.Brush = Brushes.Blue;

			// Add everything to the Piccolo hierarchy
			dg.AddChild(p1);
			dg.AddChild(p2);
			Canvas.Layer.AddChild(dg);				

			// Create a decorator group that IS volatile
			VolatileDecoratorGroup vdg = new VolatileDecoratorGroup(Canvas.Camera);
			vdg.Brush = Brushes.Cyan;
		
			// Put some nodes under the group for it to decorate
			PPath p3 = PPath.CreateEllipse(275,175,50,50);
			p3.Brush = Brushes.Blue;
			PPath p4 = PPath.CreateRectangle(175,175,75,75); 
			p4.Brush = Brushes.Green;
		
			// Add everything to the Piccolo hierarchy
			vdg.AddChild(p3);
			vdg.AddChild(p4);
			Canvas.Layer.AddChild(vdg);						

			// Create a selection handler so we can see that the decorator actually works
			PNodeList selectableParents = new PNodeList();
			selectableParents.Add(dg);
			selectableParents.Add(vdg);

			PSelectionEventHandler ps = new PSelectionEventHandler(Canvas.Layer,selectableParents);
			Canvas.AddInputEventListener(ps);
		}