Beispiel #1
0
        public IslandEditor()
        {
            // Insert initialization code here.
            this.ButtonPressEvent += delegate(object o, Gtk.ButtonPressEventArgs args) {
                if (m_app == null)
                {
                    return;
                }
                if (m_app.Islands == null)
                {
                    return;
                }
                if (args.Event.Button == 1)
                {
                    m_linkIslandsHelper = new LinkIslandsHelper();
                    m_linkIslandsHelper.Step1_SetIslands(m_app.Islands);
                    m_linkIslandsHelper.Step2_SetStart((int)args.Event.X, (int)args.Event.Y);
                    this.QueueDraw();
                }
            };
            this.ButtonReleaseEvent += delegate(object o, Gtk.ButtonReleaseEventArgs args) {
                if (m_app == null)
                {
                    return;
                }
                if (m_app.Islands == null)
                {
                    return;
                }
                if (args.Event.Button == 1)
                {
                    m_linkIslandsHelper.Step3_SetEnd((int)args.Event.X, (int)args.Event.Y);
                    m_linkIslandsHelper.Step4_Join();
                    m_linkIslandsHelper = new LinkIslandsHelper();

                    // Tell the owner that the islands are updated.
                    if (this.IslandsUpdated != null)
                    {
                        this.IslandsUpdated(this, new EventArgs());
                    }

                    this.QueueDraw();
                }
            };
            this.MotionNotifyEvent += delegate(object o, Gtk.MotionNotifyEventArgs args) {
                var state = (ModifierType)args.Event.State;
                if ((state & ModifierType.Button1Mask) != 0)
                {
                    m_linkIslandsHelper.Step3_SetEnd((int)args.Event.X, (int)args.Event.Y);
                    this.QueueDraw();
                }
            };

            this.Events = EventMask.ButtonPressMask | EventMask.ButtonReleaseMask | EventMask.PointerMotionMask;
        }
        public IslandEditor()
        {
            // Insert initialization code here.
            this.ButtonPressEvent += delegate(object o, Gtk.ButtonPressEventArgs args) {
                if (m_app == null) return;
                if (m_app.Islands == null) return;
                if (args.Event.Button == 1) {
                    m_linkIslandsHelper = new LinkIslandsHelper();
                    m_linkIslandsHelper.Step1_SetIslands(m_app.Islands);
                    m_linkIslandsHelper.Step2_SetStart((int)args.Event.X, (int)args.Event.Y);
                    this.QueueDraw();
                }
            };
            this.ButtonReleaseEvent += delegate(object o, Gtk.ButtonReleaseEventArgs args) {
                if (m_app == null) return;
                if (m_app.Islands == null) return;
                if (args.Event.Button == 1) {
                    m_linkIslandsHelper.Step3_SetEnd((int)args.Event.X, (int)args.Event.Y);
                    m_linkIslandsHelper.Step4_Join();
                    m_linkIslandsHelper = new LinkIslandsHelper();

                    // Tell the owner that the islands are updated.
                    if (this.IslandsUpdated != null) this.IslandsUpdated(this, new EventArgs());

                    this.QueueDraw();
                }
            };
            this.MotionNotifyEvent += delegate(object o, Gtk.MotionNotifyEventArgs args) {
                var state = (ModifierType)args.Event.State;
                if ((state & ModifierType.Button1Mask) != 0) {
                    m_linkIslandsHelper.Step3_SetEnd((int)args.Event.X, (int)args.Event.Y);
                    this.QueueDraw();
                }
            };

            this.Events = EventMask.ButtonPressMask | EventMask.ButtonReleaseMask | EventMask.PointerMotionMask;
        }