Exemplo n.º 1
0
        protected virtual void ConnectWrapped()
        {
            WrappedObject.AddNotification("id", NotifyIdHandler);

            if (WrappedObject is Cdn.Annotatable)
            {
                WrappedObject.AddNotification("annotation", NotifyAnnotationHandler);
            }

            WrappedObject.VariableAdded     += HandleVariableAdded;
            WrappedObject.VariableRemoved   += HandleVariableRemoved;
            WrappedObject.Copied            += HandleCopied;
            WrappedObject.TemplateApplied   += HandleTemplateApplied;
            WrappedObject.TemplateUnapplied += HandleTemplateUnapplied;

            if (WrappedObject.SupportsLocation())
            {
                AddLocationNotifification();

                Moved += delegate(object sender, EventArgs e) {
                    int x;
                    int y;

                    WrappedObject.GetLocation(out x, out y);

                    if ((int)Allocation.X != x || (int)Allocation.Y != y)
                    {
                        RemoveLocationNotification();
                        WrappedObject.SetLocation((int)Allocation.X, (int)Allocation.Y);
                        AddLocationNotifification();
                    }
                };
            }
        }
Exemplo n.º 2
0
 private void AddLocationNotifification()
 {
     WrappedObject.AddNotification("x", OnLocationChanged);
     WrappedObject.AddNotification("y", OnLocationChanged);
 }