コード例 #1
0
        public static ToolbarDialog CreateToolbar(Point toolbar_pos, Point toolbar_size, Color toolbar_color)
        {
            var t = new ToolbarDialog
            {
                Color = toolbar_color,
                Size  = toolbar_size
            };

            t.Control       = new IHTMLDiv();
            t.Drag          = new DragHelper(t.Control);
            t.Drag.Position = toolbar_pos;

            //t.ControlForm.BackColor = System.Drawing.Color.Green;
            t.ControlForm.MoveTo(t.Drag.Position.X, t.Drag.Position.Y);
            //t.ControlForm.SizeTo(toolbar_size.X + 16, toolbar_size.Y + 32);



            t.Control.style.SetLocation(t.Drag.Position.X, t.Drag.Position.Y, toolbar_size.X, toolbar_size.Y);

            t.Control.SetDialogColor(toolbar_color);
            t.Drag.Enabled   = true;
            t.Drag.DragMove += t.ApplyPosition;

            t.Grow();

            return(t);
        }
コード例 #2
0
        public static ToolbarDialog CreateToolbar(Point toolbar_pos, Point toolbar_size, Color toolbar_color)
        {
            var t = new ToolbarDialog
            {
                Color = toolbar_color,
                Size = toolbar_size
            };

            t.Control = new IHTMLDiv();
            t.Drag = new DragHelper(t.Control);
            t.Drag.Position = toolbar_pos;

            //t.ControlForm.BackColor = System.Drawing.Color.Green;
            t.ControlForm.MoveTo(t.Drag.Position.X, t.Drag.Position.Y);
            //t.ControlForm.SizeTo(toolbar_size.X + 16, toolbar_size.Y + 32);



            t.Control.style.SetLocation(t.Drag.Position.X, t.Drag.Position.Y, toolbar_size.X, toolbar_size.Y);

            t.Control.SetDialogColor(toolbar_color);
            t.Drag.Enabled = true;
            t.Drag.DragMove += t.ApplyPosition;

            t.Grow();

            return t;
        }
コード例 #3
0
        public ToolbarButton(ToolbarDialog t, string img)
        {
            this.Toolbar = t;
            this.Toolbar.Buttons.Add(this);

            var btn = this;

            btn.Control = new IHTMLDiv();
            btn.IsDown = false;
            btn.Counter = 0;

            btn.Control.SetDialogColor(t.Color);

            btn.Control.style.background = "url(" + img + ") no-repeat";
            btn.Control.style.SetLocation(2 + 24 * (this.Toolbar.Buttons.Count - 1), 8, 22, 22);


            t.Grow();

            btn.Control.onclick +=
                ev =>
                {
                    RaiseClicked();
                };

            var onmouseup = default(Action<IEvent>);


            btn.Control.onmousedown +=
                ev =>
                {
                    ev.StopPropagation();

                    btn.IsDown = true;
                    btn.Control.SetDialogColor(t.Color, false);

                    Native.Document.onmouseup += onmouseup;
                };


            onmouseup =
                ev =>
                {
                    if (btn.IsDown)
                    {
                        ev.StopPropagation();

                        btn.IsDown = false;
                        btn.Control.SetDialogColor(t.Color, true);

                        Native.Document.onmouseup -= onmouseup;
                    }
                };

            this.AttachTo(t);

        }
コード例 #4
0
        public ToolbarButton AttachTo(ToolbarDialog e)
        {
            //Control.AttachTo(e.Control);

            __Form ff = e.ControlForm;

            Control.AttachTo(ff.HTMLTargetContainerRef);

            return this;
        }
コード例 #5
0
        public static ToolbarDialog CreateToolbar(Point toolbar_pos, Point toolbar_size, Color toolbar_color)
        {
            var t = new ToolbarDialog
            {
                Color = toolbar_color,
                Size = toolbar_size
            };


            t.Control = new IHTMLDiv();
            t.Drag = new DragHelper(t.Control);
            t.Drag.Position = toolbar_pos;

            t.Control.style.SetLocation(t.Drag.Position.X, t.Drag.Position.Y, toolbar_size.X, toolbar_size.Y);

            t.Control.SetDialogColor(toolbar_color);
            t.Drag.Enabled = true;
            t.Drag.DragMove += t.ApplyPosition;

            return t;
        }
コード例 #6
0
        public ToolbarButton AttachTo(ToolbarDialog e)
        {
            Control.AttachTo(e.Control);

            return this;
        }
コード例 #7
0
        public ToolbarButton(ToolbarDialog t, string img)
        {
            this.Toolbar = t;
            this.Toolbar.Buttons.Add(this);

            var btn = this;

            btn.Control = new IHTMLDiv();
            btn.IsDown = false;
            btn.Counter = 0;

            btn.Control.SetDialogColor(t.Color);

            btn.Control.style.background = "url(" + img + ") no-repeat";
            btn.Control.style.backgroundPosition = "50% 50%";
            btn.Control.style.SetLocation(2 + 24 * (this.Toolbar.Buttons.Count - 1), 8, 22, 22);


            t.Grow();

            var disablemouse = false;

            btn.Control.onclick +=
                ev =>
                {
                    if (disablemouse)
                        return;

                    RaiseClicked();
                };

            var onmouseup = default(Action<IEvent>);


            btn.Control.onmousedown +=
                ev =>
                {
                    if (disablemouse)
                        return;

                    ev.stopPropagation();

                    btn.IsDown = true;
                    btn.Control.SetDialogColor(t.Color, false);
                    ev.CaptureMouse();

                };

            btn.Control.onmouseup +=
            ev =>
            {
                if (disablemouse)
                    return;


                if (btn.IsDown)
                {
                    ev.stopPropagation();

                    btn.IsDown = false;
                    btn.Control.SetDialogColor(t.Color, true);
                }
            };

            btn.Control.ontouchstart +=
                ev =>
                {
                    disablemouse = true;

                    btn.IsDown = true;
                    btn.Control.SetDialogColor(t.Color, false);

                    ev.stopPropagation();
                    ev.preventDefault();

                };

            bool disable_ontouchend = false;


            btn.Control.ontouchend +=
                ev =>
                {

                    if (btn.IsDown)
                    {
                        btn.IsDown = false;

                        ev.stopPropagation();
                        ev.preventDefault();

                        if (disable_ontouchend)
                            return;

                        disable_ontouchend = true;
                        RaiseClicked();

                        new Timer(
                            delegate
                            {
                                // prevent from multiple events
                                disable_ontouchend = false;
                            }
                        ).StartTimeout(100);
                    }
                };


            this.AttachTo(t);

        }