Exemplo n.º 1
0
        public RightRectangleResizer(IDrawableRectangle shape) : base(shape)
        {
            // Set the control to be displayed in the middle of the right side of the rectangle.
            WorldX = shape.Rectangle.X + shape.Rectangle.Width - (DefaultSideLength / 2f);
            WorldY = shape.Rectangle.Y + (shape.Rectangle.Height / 2) - (DefaultSideLength / 2f);

            _cursor = Cursors.SizeWE;
        }
Exemplo n.º 2
0
        public BottomRectangleResizer(IDrawableRectangle shape) : base(shape)
        {
            // Set the control to be displayed in the middle of the bottom line of the rectangle.
            WorldX = shape.Rectangle.X + (shape.Rectangle.Width / 2f) - (DefaultSideLength / 2f);
            WorldY = shape.Rectangle.Y + shape.Rectangle.Height - (DefaultSideLength / 2f);

            _cursor = Cursors.SizeNS;
        }
Exemplo n.º 3
0
        protected InteractiveHeaderedItem PrepareGroup(string title, IDrawableRectangle content)
        {
            #region Prepare Group Container
            DrawableItemsStack headerPlus  = new DrawableItemsStack();
            DrawableItemsStack headerMinus = new DrawableItemsStack();

            headerPlus.OrientationAxis  = Axis.X;
            headerMinus.OrientationAxis = Axis.X;
            #endregion

            #region Create Header
            TextSegment titleSegment = new TextSegment(Graphics, title, GroupTitleFont, true);

            PlusShape plus = new PlusShape();
            plus.Border = 3;
            headerPlus.Add(plus);
            headerPlus.Add(titleSegment);

            MinusShape minus = new MinusShape();
            minus.Border = 3;
            headerMinus.Add(minus);
            headerMinus.Add(titleSegment);

            DrawableItemsStack headerCollapsed = new DrawableItemsStack();
            DrawableItemsStack headerExpanded  = new DrawableItemsStack();

            headerCollapsed.OrientationAxis = Axis.Z;
            headerExpanded.OrientationAxis  = Axis.Z;

            headerCollapsed.Add(new DrawableRectangle(InnerTitlesBackground, null));
            headerCollapsed.Add(headerPlus);

            headerExpanded.Add(new DrawableRectangle(InnerTitlesBackground, null));
            headerExpanded.Add(headerMinus);
            #endregion

            InteractiveHeaderedItem tg = new InteractiveHeaderedItem(headerCollapsed, headerExpanded, content);
            tg.HeaderClicked += delegate { tg.Collapsed = !tg.Collapsed; };
            IMouseInteractable interactive = content as IMouseInteractable;
            if (interactive != null)
            {
                tg.ContentClicked += delegate(object sender, PointF pos) { interactive.HandleMouseClick(pos); }
            }
            ;
            tg.RedrawNeeded += HandleRedraw;

            return(tg);
        }
Exemplo n.º 4
0
        public HeaderedItem(IDrawableRectangle headerCollapsed,
                            IDrawableRectangle headerExpanded,
                            IDrawableRectangle content)
        {
            this.headerCollapsed = headerCollapsed;
            this.headerExpanded  = headerExpanded;
            this.content         = content;

            headerCollapsed.Container = this;
            headerExpanded.Container  = this;
            content.Container         = this;

            headerCollapsed.X = 0;
            headerCollapsed.Y = 0;

            headerExpanded.X = 0;
            headerExpanded.Y = 0;

            content.X = 0;
            content.Y = headerExpanded.GetAbsoluteContentHeight();

            headerExpanded.HeightChanged += delegate { content.Y = headerExpanded.GetAbsoluteContentHeight(); };
        }
Exemplo n.º 5
0
		public HeaderedItem(IDrawableRectangle headerCollapsed,
		                    IDrawableRectangle headerExpanded,
		                    IDrawableRectangle content)
		{
			this.headerCollapsed = headerCollapsed;
			this.headerExpanded = headerExpanded;
			this.content = content;
			
			headerCollapsed.Container = this;
			headerExpanded.Container = this;
			content.Container = this;
			
			headerCollapsed.X = 0;
			headerCollapsed.Y = 0;
			
			headerExpanded.X = 0;
			headerExpanded.Y = 0;
				
			content.X = 0;
			content.Y = headerExpanded.GetAbsoluteContentHeight();
			
			headerExpanded.HeightChanged += delegate { content.Y = headerExpanded.GetAbsoluteContentHeight(); };
		}
Exemplo n.º 6
0
 public RectangleSaver(IDrawableRectangle drawableRectangle)
 {
     _drawableRectangle = drawableRectangle;
 }
Exemplo n.º 7
0
 public InteractiveHeaderedItem(IDrawableRectangle headerCollapsed,
                                IDrawableRectangle headerExpanded,
                                IDrawableRectangle content)
     : base(headerCollapsed, headerExpanded, content)
 {
 }
		public InteractiveHeaderedItem(IDrawableRectangle headerCollapsed,
		                                IDrawableRectangle headerExpanded,
		                                IDrawableRectangle content)
			: base (headerCollapsed, headerExpanded, content) {}
Exemplo n.º 9
0
 public EllipseSaver(IDrawableRectangle drawableRectangle) : base(drawableRectangle)
 {
 }
Exemplo n.º 10
0
 public RectangleResizer(IDrawableRectangle shape) : base()
 {
     _shape = shape;
 }
Exemplo n.º 11
0
        // создание заголовка раскрывающихся полей, и кнопки +/- для раскрытия Reply/Option
        protected InteractiveHeaderedItem PrepareMessagesHeader(ContentBody content, IDrawableRectangle item, bool reply)
        {
            #region Prepare Container
            DrawableItemsStack headerPlus  = new DrawableItemsStack();
            DrawableItemsStack headerMinus = new DrawableItemsStack();

            headerPlus.OrientationAxis  = Axis.X;
            headerMinus.OrientationAxis = Axis.X;
            #endregion

            #region Create Header

            TextSegment titleSegment = new TextSegment(Graphics, (reply) ? @"""" + content.msgText + @""""
                                                                             : (nodeLowDetails) ? "\u25CF " + content.msgText : content.msgText,
                                                       content.index, MessagesFont, true, reply);                       // GroupTitleFont

            if (!nodeLowDetails)
            {
                PlusShape plus = new PlusShape();
                plus.Border     = 4;
                plus.ScaleShape = false;
                plus.Width      = plus.ShapeWidth;
                plus.Height     = plus.ShapeHeight;
                headerPlus.Add(plus);

                MinusShape minus = new MinusShape();
                minus.Border     = 4;
                minus.ScaleShape = false;
                minus.Width      = minus.ShapeWidth;
                minus.Height     = minus.ShapeHeight;
                headerMinus.Add(minus);
            }
            headerPlus.Add(titleSegment);
            headerMinus.Add(titleSegment);

            //пиктограмма
            //if (!reply) {
            //    DrawableItemsStack<VectorShape> image = new DrawableItemsStack<VectorShape>();
            //    image.OrientationAxis = Axis.X;
            //    image.KeepAspectRatio = true;
            //    image.Border = -3.0f;
            //    image.Add(new OptionsCircleShape());

            //    headerPlus.Add(image);
            //    headerMinus.Add(image);
            //}

            DrawableItemsStack headerCollapsed = new DrawableItemsStack();
            DrawableItemsStack headerExpanded  = new DrawableItemsStack();

            headerCollapsed.OrientationAxis = Axis.Z;
            headerExpanded.OrientationAxis  = Axis.Z;

            headerCollapsed.Add(new DrawableRectangle((reply) ? ReplyTitlesBackground : OptionTitlesBackground, null, 5, 5, 5, 5));
            headerCollapsed.Add(headerPlus);

            headerExpanded.Add(new DrawableRectangle((reply) ? ReplyTitlesBackground : OptionTitlesBackground, null, 5, 5, 0, 0));
            headerExpanded.Add(headerMinus);

            #endregion

            InteractiveHeaderedItem tg = new InteractiveHeaderedItem(headerCollapsed, headerExpanded, item);

            tg.Collapsed = true;

            // событие, клик мышкой по элементу строки кода
            tg.HeaderClicked += delegate(object sender, PointF e)
            {
                if (Math.Abs(tg.AbsoluteX - e.X) < 20 && Math.Abs(tg.AbsoluteY - e.Y) < 20)
                {
                    tg.Collapsed = !tg.Collapsed;
                }
                else
                {
                    ContentClick(this, titleSegment);
                }
            };

            // старый вариант
            //IMouseInteractable interactive = content as IMouseInteractable;
            //if (interactive != null) {
            //    tg.ContentClicked += delegate { tgContentClicked(interactive, tg); };
            //    //оригинальное событие
            //    //tg.ContentClicked += delegate (object sender, PointF pos) {
            //    //    interactive.HandleMouseClick(pos);
            //    //};
            //}

            tg.RedrawNeeded += HandleRedraw;

            return(tg);
        }