Exemplo n.º 1
0
        // ReSharper restore MemberCanBePrivate.Global

        #endregion

        protected override void CreateChildren()
        {
            base.CreateChildren();

            #region Background

            _background = new RectShape
            {
                Id    = "background",
                Color = Color.white,
                Left  = 0, Right = 0, Top = 0, Bottom = 0
            };
            AddChild(_background);

            _backgroundImage = new Image
            {
                //Id = "background_image",
                Left    = 0,
                Right   = 0,
                Top     = 0,
                Bottom  = 0,
                Visible = false,
                //Rotation = 30,
                //AspectRatio = 4,
                ScaleMode = ImageScaleMode.ScaleToFill
            };
            AddChild(_backgroundImage);

            #endregion

            #region Header background

            _headerBackground = new RectShape
            {
                Id = "headerBackground",
                //Color = RgbColor.FromHex(0x000fff).ToColor(),
                BackgroundColor = (Color)GetStyle("headerBackgroundColor"),
                Left            = 0,
                Right           = 0,
                Top             = 0,
                Height          = 80
            };
            AddChild(_headerBackground);

            #endregion

            #region Header group

            HeaderGroup = new Group
            {
                Id     = "headerGroup",
                Layout = new AbsoluteLayout(),
                Left   = 0,
                Right  = 0,
                Top    = 0,
                Height = 80
            };
            AddChild(HeaderGroup);

            #endregion

            #region Title label

            TitleDisplay = new Label
            {
                Id             = "titleLabel",
                Left           = 10,
                VerticalCenter = 0
            };
            //TitleLabel.SetStyle("textColor", UnityEngine.Color.white);
            HeaderGroup.AddChild(TitleDisplay);

            #endregion

            #region Tools

            ToolGroup = new Group
            {
                Id     = "toolGroup",
                Layout = new HorizontalLayout {
                    HorizontalAlign = HorizontalAlign.Right,
                    VerticalAlign   = VerticalAlign.Middle,
                    Gap             = 4
                },
                Right          = 6,
                VerticalCenter = 0,
                MouseEnabled   = true               // not draggable when clicking space between buttons --- false // to be draggable on possible tools label click
            };
            HeaderGroup.AddChild(ToolGroup);

            #endregion

            #region Scroller

            _scroller = new Scroller
            {
                SkinClass = EvaluateSkinClassFromStyle("scrollerSkin"),
                Left      = 0,
                Right     = 0,
                Top       = 80,
                Bottom    = 50
            };
            AddChild(_scroller);

            #endregion

            #region Content group

            ContentGroup = new Group {
                Id = "contentGroup"
            };
            //AddChild(ContentGroup);
            _scroller.Viewport = ContentGroup;

            #endregion

            #region Control bar background

            _controlBarBackground = new RectShape
            {
                Id = "controlBarBackground",
                BackgroundColor = ColorMixer.FromHex(0x000fff).ToColor(),
                Left            = 0,
                Right           = 0,
                Bottom          = 0,
                Height          = 50,
                //Alpha = 0.5f
            };
            AddChild(_controlBarBackground);

            #endregion

            #region Control bar

            ControlBarGroup = new Group
            {
                Id     = "controlBar",
                Layout = new HorizontalLayout
                {
                    HorizontalAlign = HorizontalAlign.Right,
                    VerticalAlign   = VerticalAlign.Middle,
                    Gap             = 4,
                    PaddingLeft     = 10, PaddingRight = 10, PaddingTop = 10, PaddingBottom = 10
                },
                Left         = 0,
                Right        = 0,
                Bottom       = 0,
                Height       = 50,
                MouseEnabled = true                       // not draggable when clicking space between buttons --- false // to be draggable on possible tools label click
            };
            AddChild(ControlBarGroup);

            #endregion

            #region Border

            _border = new RectShape
            {
                Id           = "border",
                Left         = 0,
                Right        = 0,
                Top          = 0,
                Bottom       = 0,
                MouseEnabled = false
            };
            AddChild(_border);

            #endregion
        }
Exemplo n.º 2
0
        protected override void CreateChildren()
        {
            base.CreateChildren();

            #region Popup anchor

            _anchor = new PopUpAnchor
            {
                Id            = "pop_up",
                Left          = 0,
                Right         = 0,
                Top           = 0,
                Bottom        = 0,
                PopupPosition = PopupPosition.Below,
                PopupWidthMatchesAnchorWidth = true
            };
            AddChild(_anchor);

            #endregion

            #region DropDown

            DropDown = new Group
            {
                Id        = "drop_down",
                MaxHeight = 134, MinHeight = 22,
                Width     = 150,
                Height    = 200
            };
            //AddChild(DropDown);
            _anchor.Popup = DropDown;

            #endregion

            #region Background

            _background = new RectShape
            {
                Id     = "background",
                Left   = 0,
                Right  = 0,
                Top    = 0,
                Bottom = 0
            };
            DropDown.AddChild(_background);

            #endregion

            #region Scroller

            _scroller = new Scroller
            {
                Id                   = "scroller",
                SkinClass            = EvaluateSkinClassFromStyle("scrollerSkin"),
                Left                 = 0,
                Right                = 0,
                Top                  = 0,
                Bottom               = 0,
                MinViewportInset     = 1,
                HasFocusableChildren = false,
                Height               = 200
                                       //Visible = IncludeInLayout = false
            };
            _scroller.SetStyle("horizontalScrollPolicy", ScrollPolicy.Off);
            DropDown.AddChild(_scroller);

            #endregion

            #region Data group

            DataGroup = new DataGroup
            {
                Id           = "data_group",
                ItemRenderer = new ItemRendererFactory <DefaultItemRenderer>(),
                Layout       = new VerticalLayout
                {
                    Gap                  = 0,
                    HorizontalAlign      = HorizontalAlign.ContentJustify,
                    RequestedMinRowCount = 5
                }
            };
            _scroller.Viewport = DataGroup;

            #endregion

            #region Border

            _border = new RectShape
            {
                Id              = "border",
                Left            = 0,
                Right           = 0,
                Top             = 0,
                Bottom          = 0,
                MouseEnabled    = false,
                BackgroundColor = Color.gray
            };
            DropDown.AddChild(_border);

            #endregion

            #region OpenButton

            OpenButton = new Button
            {
                Left         = 0,
                Right        = 0,
                Top          = 0,
                Bottom       = 0,
                FocusEnabled = false,
                SkinClass    = typeof(DropDownListButtonSkin)
            };
            AddChild(OpenButton);

            #endregion

            #region Label

            TextInput = new TextField
            {
                VerticalCenter = 0,
                Left           = 0,
                Right          = 25,
                Top            = 0,
                Bottom         = 0,
                Height         = 25 /*,
                                     * Width = 75,*/
                                    //MouseEnabled = false,
                                    //Color = Color.black
            };
            //LabelDisplay.SetStyle("color", GetStyle("textColor"));
            AddChild(TextInput);

            #endregion
        }
Exemplo n.º 3
0
        private void Form1_MouseDown(object sender, MouseEventArgs e)
        {
            if (ToggleSelection == 1)
            {
                string shapeType = "";
                var    sel       = dialogProcessor.ContainsPoint(e.Location);
                if (sel == null)
                {
                    return;
                }
                if (dialogProcessor.SelectedItems.Contains(sel))
                {
                    dialogProcessor.SelectedItems.Remove(sel);
                    shapeType = sel.GetType().ToString();

                    if (shapeType.Contains("RectShape"))
                    {
                        shapeType = "Last action : Deselected Rectangle";
                    }
                    else
                    {
                        shapeType = "Last action : Deselected Circle";
                    }
                }

                else if (sel.GetType().ToString().Contains("LineShape"))
                {
                    dialogProcessor.SelectedItems.Add((LineShape)sel);
                }

                else
                {
                    dialogProcessor.SelectedItems.Add(sel);
                    shapeType = sel.GetType().ToString();
                    if (shapeType.Contains("RectShape"))
                    {
                        shapeType = "Last action : Selected Rectangle";
                    }
                    else
                    {
                        shapeType = "Last action : Selected Circle";
                    }
                }
                currentStatus.Text           = shapeType;
                dialogProcessor.IsDragging   = true;
                dialogProcessor.LastLocation = e.Location;
                Invalidate();
            }
            if (ToggleSelection == 2)
            {
                RectShape rect = new RectShape(new Rectangle(e.X - 25, e.Y - 50, 50, 100));
                rect.FillColor     = ColorDialog.Color;
                rect.BorderColor   = Color.Black;
                currentStatus.Text = "Last action : Rectangle created";


                dialogProcessor.Shapes.Add(rect);
                Invalidate();
            }

            if (ToggleSelection == 3)
            {
                CircleShape circle = new CircleShape(new Rectangle(e.X - 25, e.Y - 50, 100, 100));

                circle.FillColor   = ColorDialog.Color;
                circle.BorderColor = Color.Black;
                dialogProcessor.Shapes.Add(circle);
                currentStatus.Text = "Last action : Circle created";
                Invalidate();
            }

            if (ToggleSelection == 4)
            {
                LineShape line = new LineShape(new Rectangle(e.X, e.Y, 100, 100), new PointF(e.X, e.Y));

                line.FillColor = ColorDialog.Color;
                if (ColorDialog.Color == Color.White)
                {
                    line.FillColor = Color.Black;
                }
                line.BorderColor = Color.Black;
                dialogProcessor.Shapes.Add(line);
                currentStatus.Text = "Last action : Line created";
                Invalidate();
            }
            if (ToggleSelection == 5)
            {
                dialogProcessor.AddRandomCustomShape();
                Invalidate();
            }

            this.Refresh();
        }
Exemplo n.º 4
0
 public virtual void visit(RectShape aShape)
 {
     _visit(aShape as RectShape);
     _visit(aShape as APolyShape);
     _visit(aShape as IXShape);
 }
Exemplo n.º 5
0
 public virtual void _visit(RectShape aShape)
 {
 }
Exemplo n.º 6
0
// ReSharper restore MemberCanBePrivate.Global

        #endregion

        protected override void CreateChildren()
        {
            //Debug.Log("Button skin creating children");
            base.CreateChildren();

            #region Background

            _background = new RectShape
            {
                Left   = 0,
                Right  = 0,
                Top    = 0,
                Bottom = 0,
                Alpha  = 0.5f
            };
            //_background.SetStyle("backgroundStyle", ButtonStyle.Instance);
            AddChild(_background);

            #endregion

            #region Box

            Group box = new Group
            {
                HorizontalCenter = 0,
                VerticalCenter   = 0
            };
            AddChild(box);

            _boxBg = new RectShape
            {
                Left             = 0, Right = 0, Top = 0, Bottom = 0,
                HorizontalCenter = 0,
                VerticalCenter   = 0,

                /*MinWidth = 300,
                *  MinHeight = 100*/
            };
            //_background.SetStyle("backgroundStyle", ButtonStyle.Instance);
            _background.SetStyle("backgroundColor", Color.blue);
            box.AddChild(_boxBg);

            #endregion

            HGroup hGroup = new HGroup
            {
                Left             = 10, Right = 10, Top = 10, Bottom = 10,
                HorizontalCenter = 0,
                VerticalCenter   = 0,
                VerticalAlign    = VerticalAlign.Middle
            };
            box.AddChild(hGroup);

            #region Icon

            IconDisplay = new Image {
                MouseEnabled = false
            };
            hGroup.AddChild(IconDisplay);

            #endregion

            #region Label

            LabelDisplay = new Label
            {
                Text         = "miki",
                MouseEnabled = false,
                //Width = 100
            };
            hGroup.AddChild(LabelDisplay);

            #endregion
        }
Exemplo n.º 7
0
        protected override void CreateChildren()
        {
            base.CreateChildren();

            #region Background image

            _backgroundImage = new Image
            {
                Left       = 0,
                Right      = 0,
                Top        = 0,
                Bottom     = 0,
                AlphaBlend = true
            };
            AddChild(_backgroundImage);

            #endregion

            #region Border

            _border = new RectShape
            {
                Id           = "overlay",
                Left         = 0,
                Right        = 0,
                Top          = 0,
                Bottom       = 0,
                MouseEnabled = false
            };
            AddChild(_border);

            #endregion

            #region Header background

            _headerBackgroundImage = new Image
            {
                Left       = 1,
                Right      = 1,
                Top        = 1,
                Height     = 50,
                AlphaBlend = true
            };
            AddChild(_headerBackgroundImage);

            #endregion

            #region Header group

            HeaderGroup = new Group
            {
                Id           = "headerGroup",
                Layout       = new AbsoluteLayout(),
                Left         = 1,
                Right        = 1,
                Top          = 1,
                Height       = 50,
                MouseEnabled = true
            };
            AddChild(HeaderGroup);

            #endregion

            #region Icon + label group

            _labelGroup = new HGroup
            {
                Left                   = 10,
                VerticalCenter         = 0,
                Gap                    = 6,
                VerticalAlign          = VerticalAlign.Middle,
                ClipAndEnableScrolling = true
            };
            HeaderGroup.AddChild(_labelGroup);

            #endregion

            #region Icon display

            HeaderIconDisplay = new Image();
            _labelGroup.AddChild(HeaderIconDisplay);

            #endregion

            #region Label display

            TitleDisplay = new Label();
            _labelGroup.AddChild(TitleDisplay);

            #endregion

            #region Move area

            MoveArea = new Group
            {
                Id           = "move_area",
                Layout       = new AbsoluteLayout(),
                Left         = 0,
                Right        = 0,
                Top          = 0,
                Bottom       = 0,
                MouseEnabled = true
            };
            HeaderGroup.AddChild(MoveArea);

            #endregion

            #region Tools

            ToolGroup = new Group
            {
                Id     = "toolGroup",
                Layout = new HorizontalLayout
                {
                    HorizontalAlign = HorizontalAlign.Right,
                    VerticalAlign   = VerticalAlign.Middle,
                    Gap             = 4
                },
                Right          = 6,
                VerticalCenter = 0,
                MouseEnabled   = true               // not draggable when clicking space between buttons --- false // to be draggable on possible tools label click
            };
            HeaderGroup.AddChild(ToolGroup);

            #endregion

            #region Content background

            _contentGroupBackgroundImage = new Image
            {
                Left       = 6,
                Right      = 6,
                Top        = 50,
                Bottom     = 50,
                AlphaBlend = true
            };
            AddChild(_contentGroupBackgroundImage);

            #endregion

            #region Content group

            ContentGroup = new VGroup
            {
                Id              = "contentGroup",
                Gap             = 10,
                PaddingLeft     = 10, PaddingRight = 10, PaddingTop = 10, PaddingBottom = 10,
                HorizontalAlign = HorizontalAlign.Center,
                /* No scroller and viewport with this skin, so using constrains for positioning */
                Left = 12, Right = 12, Top = 56, Bottom = 56
            };
            AddChild(ContentGroup);

            #endregion

            #region Icon

            IconDisplay = new Image();
            ContentGroup.AddChild(IconDisplay);

            #endregion

            #region Message display

            MessageDisplay = new Label
            {
                Multiline = true,
                MaxWidth  = 800,
                MaxHeight = 600,
                Color     = Color.black,
            };
            MessageDisplay.SetStyle("labelStyle", GetStyle("labelStyle"));
            MessageDisplay.SetStyle("font", GetStyle("labelFont"));
            ContentGroup.AddChild(MessageDisplay);

            #endregion

            /*#region Control bar background
             *
             * _controlBarBackgroundImage = new Image
             *                          {
             *                              Left = 1,
             *                              Right = 1,
             *                              Bottom = 1,
             *                              Height = 50,
             *                              AlphaBlend = true
             *                          };
             * AddChild(_controlBarBackgroundImage);
             *
             #endregion*/

            #region Control bar

            ControlBarGroup = new Group
            {
                Id = "controlBar",
                //ClipAndEnableScrolling = true, // this introduces a child positioning bug
                Layout = new HorizontalLayout
                {
                    HorizontalAlign = HorizontalAlign.Right,
                    VerticalAlign   = VerticalAlign.Bottom,
                    Gap             = 4,
                    PaddingLeft     = 6,
                    PaddingRight    = 6,
                    PaddingTop      = 6,
                    PaddingBottom   = 6
                },
                ClipAndEnableScrolling = true,
                Left         = 1,
                Right        = 1,
                Bottom       = 1,
                Height       = 50,
                MouseEnabled = true                       // not draggable when clicking space between buttons --- false // to be draggable on possible tools label click
            };
            AddChild(ControlBarGroup);

            #endregion
        }
Exemplo n.º 8
0
        // ReSharper restore MemberCanBePrivate.Global

        #endregion

        protected override void CreateChildren()
        {
            base.CreateChildren();

            #region Background

            _background = new RectShape
            {
                Id     = "background",
                Left   = 0,
                Right  = 0,
                Top    = 0,
                Bottom = 0
            };
            AddChild(_background);

            #endregion

            #region Border

            _border = new RectShape
            {
                Id           = "border",
                Left         = 0,
                Right        = 0,
                Top          = 0,
                Bottom       = 0,
                MouseEnabled = false
            };
            AddChild(_border);

            #endregion

            #region Scroller

            _scroller = new Scroller
            {
                Id                   = "scroller",
                SkinClass            = EvaluateSkinClassFromStyle("scrollerSkin"),
                Left                 = 0,
                Right                = 0,
                Top                  = 0,
                Bottom               = 0,
                MinViewportInset     = 1,
                HasFocusableChildren = false
            };
            AddChild(_scroller);

            #endregion

            #region Data group

            DataGroup = new DataGroup
            {
                Id           = "data_group",
                ItemRenderer = new ItemRendererFactory <DefaultItemRenderer>(),
                Layout       = new VerticalLayout
                {
                    Gap = 0, HorizontalAlign = HorizontalAlign.ContentJustify, RequestedMinRowCount = 5
                }
            };
            //AddChild(DataGroup);
            _scroller.Viewport = DataGroup;

            #endregion
        }
Exemplo n.º 9
0
        // ReSharper disable MemberCanBePrivate.Global

        #endregion

        protected override void CreateChildren()
        {
            base.CreateChildren();

            #region Popup anchor

            _anchor = new PopUpAnchor
            {
                Id            = "pop_up",
                Left          = 0,
                Right         = 0,
                Top           = 0,
                Bottom        = 0,
                PopupPosition = PopupPosition.Below,
                //PopupWidthMatchesAnchorWidth = true
            };
            AddChild(_anchor);

            #endregion

            #region DropDown

            DropDown = new Group
            {
                Id        = "drop_down",
                MaxHeight = 134, MinHeight = 22,
                Width     = 300,
                Height    = 350
            };
            _anchor.Popup = DropDown;

            #endregion

            #region Background

            _background = new RectShape
            {
                Id     = "background",
                Left   = 0,
                Right  = 0,
                Top    = 0,
                Bottom = 0
            };
            DropDown.AddChild(_background);

            #endregion

            #region Border

            _border = new RectShape
            {
                Id           = "border",
                Left         = 0,
                Right        = 0,
                Top          = 0,
                Bottom       = 0,
                MouseEnabled = false
            };
            DropDown.AddChild(_border);

            #endregion

            #region Scroller

            _scroller = new Scroller
            {
                Id                   = "scroller",
                SkinClass            = EvaluateSkinClassFromStyle("scrollerSkin"),
                Left                 = 0,
                Right                = 0,
                Top                  = 0,
                Bottom               = 0,
                MinViewportInset     = 1,
                HasFocusableChildren = false,
                //Width = 300
            };
            _scroller.SetStyle("horizontalScrollPolicy", ScrollPolicy.Off);
            DropDown.AddChild(_scroller);

            #endregion

            #region Data group

            DataGroup = new DataGroup
            {
                Id           = "data_group",
                ItemRenderer = new ItemRendererFactory <DefaultItemRenderer>(),
                Layout       = new TileLayout {
                    HorizontalGap = 0, VerticalGap = 0, RequestedRowCount = 4, RequestedColumnCount = 5
                }
            };
            _scroller.Viewport = DataGroup;

            #endregion

            #region OpenButton

            OpenButton = new Button
            {
                Left         = 0,
                Right        = 0,
                Top          = 0,
                Bottom       = 0,
                FocusEnabled = false,
                SkinClass    = typeof(DropDownListButtonSkin)
            };
            AddChild(OpenButton);

            #endregion

            #region Label

            LabelDisplay = new Label
            {
                VerticalCenter = 0,
                Left           = 7,
                Right          = 32,
                Top            = 2,
                Bottom         = 2,
                Width          = 75,
                MouseEnabled   = false,
                Color          = Color.black
            };
            AddChild(LabelDisplay);

            #endregion
        }
Exemplo n.º 10
0
        protected override void CreateChildren()
        {
            base.CreateChildren();

            _rect = new RectShape();
            //{
            //    Left = 0, Right = 0, Top = 0, Bottom = 0
            //};
            AddChild(_rect);

            _hgroup = new HGroup {
                VerticalAlign = VerticalAlign.Middle, PaddingLeft = 10, PaddingRight = 10, PaddingTop = 10, PaddingBottom = 10
            };
            AddChild(_hgroup);

            if (null == LabelDisplay)
            {
                LabelDisplay = new Label
                {
                    PercentWidth = 100,
                    MinWidth     = 100 // ?
                };
                _hgroup.AddChild(LabelDisplay);
                if (_text != string.Empty)
                {
                    LabelDisplay.Text = _text;
                }
            }

            _hgroup.AddChild(new Spacer {
                PercentWidth = 100
            });

            if (null == _buttonShow)
            {
                _buttonShow = new Button {
                    Text         = "Show",
                    FocusEnabled = false,
                    SkinClass    = typeof(ImageButtonSkin),
                    Icon         = ImageLoader.Instance.Load("Icons/accept"),
                    Styles       = ButtonStyles
                };
                _buttonShow.ButtonDown += delegate
                {
                    DispatchEvent(new Event("showImage", true)); // bubbling!
                };
                _hgroup.AddChild(_buttonShow);
            }

            if (null == _buttonRemove)
            {
                _buttonRemove = new Button
                {
                    Text         = "Remove",
                    FocusEnabled = false,
                    SkinClass    = typeof(ImageButtonSkin),
                    Icon         = ImageLoader.Instance.Load("Icons/cancel"),
                    Styles       = ButtonStyles
                };
                _buttonRemove.ButtonDown += delegate
                {
                    var parentList = Owner as List;
                    if (null != parentList)
                    {
                        //Debug.Log("Removing at " + parentList.DataProvider.GetItemIndex(Data));
                        parentList.DataProvider.RemoveItemAt(parentList.DataProvider.GetItemIndex(Data));
                    }
                    else
                    {
                        Debug.LogError("Owner of item renderer is not a list");
                    }
                };
                _hgroup.AddChild(_buttonRemove);
            }
        }