コード例 #1
0
        /// <summary>
        /// Removes a widget from the container.
        /// </summary>
        /// <param name="widget">
        /// The <see cref="ExpressionItemWidget"/> that will be removed
        /// </param>
        public void RemoveItem(ExpressionItemWidget widget)
        {
            expItemsBox.Remove(widget);


            if (expItemsBox.Children.Length == 0)
            {
                expItemsScroller.HeightRequest = 85;
            }
            else
            {
                int maxRequest = -1;

                foreach (ExpressionItemWidget childWidget in expItemsBox.Children)
                {
                    if (maxRequest < childWidget.HeightRequest)
                    {
                        maxRequest = childWidget.HeightRequest;
                    }

                    childWidget.CheckPosition();
                }


                expItemsScroller.HeightRequest = maxRequest + 20;
            }
        }
コード例 #2
0
        /// <summary>
        /// Moves the widget towards the beginning of the expression.
        /// </summary>
        /// <param name="widget">
        /// A <see cref="ExpressionItemWidget"/>
        /// </param>
        public void MoveItemBackwards(ExpressionItemWidget widget)
        {
            int position = (expItemsBox[widget] as Gtk.Box.BoxChild).Position;

            expItemsBox.ReorderChild(widget, position - 1);
            widget.CheckPosition();

            (expItemsBox.Children[position] as ExpressionItemWidget).CheckPosition();
        }
コード例 #3
0
        /// <summary>
        /// Removes an item from the container.
        /// </summary>
        /// <param name="widget">
        /// A <see cref="ExpressionItemWidget"/>
        /// </param>
        public void RemoveItem(ExpressionItemWidget widget)
        {
            itemOpRelatedItemsBox.Remove(widget);

            foreach (RelatedItemWidget relWidget in itemOpRelatedItemsBox.Children)
            {
                relWidget.CheckPosition();
            }
        }
コード例 #4
0
        /// <summary>
        /// Moves an item towards the end of the container.
        /// </summary>
        /// <param name="widget">
        /// A <see cref="ExpressionItemWidget"/>
        /// </param>
        public void MoveItemFordwards(ExpressionItemWidget widget)
        {
            int position = this[widget].Position;

            itemOpRelatedItemsBox.ReorderChild(widget, position + 1);
            widget.CheckPosition();

            ((RelatedItemWidget)itemOpRelatedItemsBox.Children[position]).CheckPosition();
        }
コード例 #5
0
        /// <summary>
        /// Remove an item from this container.
        /// </summary>
        /// <param name="widget">
        /// A <see cref="ExpressionItemWidget"/>
        /// </param>
        public void RemoveItem(ExpressionItemWidget widget)
        {
            expGroupItemsBox.Remove(widget);

            foreach (ExpressionItemWidget childWidget in expGroupItemsBox)
            {
                childWidget.CheckPosition();
            }

            CheckHeight();
        }
コード例 #6
0
        /// <summary>
        /// <see cref="RelatedItemWidget"/>'s constructor.
        /// </summary>
        public RelatedItemWidget(ExpressionItemWidget itemWidget,
                                 IExpressionItemContainer container)
            : base(container)
        {
            Glade.XML gladeXml = new XML("mathtextrecognizer.glade",
                                         "relatedItemWidgetBase");

            gladeXml.Autoconnect(this);

            this.itemWidget = itemWidget;

            this.Add(relatedItemWidgetBase);

            this.relatedItemPlaceholder.Add(itemWidget);

            this.ShowAll();
        }
コード例 #7
0
		/// <summary>
		/// <see cref="RelatedItemWidget"/>'s constructor.
		/// </summary>
		public RelatedItemWidget(ExpressionItemWidget itemWidget, 
		                         IExpressionItemContainer container)
			:base(container)
		{
			Glade.XML gladeXml = new XML("mathtextrecognizer.glade",
			                             "relatedItemWidgetBase");
			
			gladeXml.Autoconnect(this);
			
			this.itemWidget = itemWidget;
			
			this.Add(relatedItemWidgetBase);
			
			this.relatedItemPlaceholder.Add(itemWidget);		
			
			this.ShowAll();
		}
コード例 #8
0
        /// <summary>
        /// Adds an item to the container.
        /// </summary>
        /// <param name="widget">
        /// A <see cref="ExpressionItemWidget"/>
        /// </param>
        public void AddItem(ExpressionItemWidget widget)
        {
            RelatedItemWidget relatedItemWidget =
                new RelatedItemWidget(widget, this);

            widget.SetRelatedMode();

            this.itemOpRelatedItemsBox.Add(relatedItemWidget);

            foreach (RelatedItemWidget relWidget in itemOpRelatedItemsBox.Children)
            {
                relWidget.CheckPosition();
            }


            itemOpRelatedItemsScroller.Vadjustment.Value =
                itemOpRelatedItemsScroller.Vadjustment.Upper;
        }
コード例 #9
0
        /// <summary>
        /// Adds an item widget to the group.
        /// </summary>
        /// <param name="widget">
        /// A <see cref="ExpressionItemWidget"/>
        /// </param>
        public void AddItem(ExpressionItemWidget widget)
        {
            expGroupItemsBox.Add(widget);

            foreach (ExpressionItemWidget childWidget in  expGroupItemsBox)
            {
                childWidget.CheckPosition();
            }

            CheckHeight();

            expGroupItemsScroller.Hadjustment.Value =
                expGroupItemsScroller.Hadjustment.Upper;

            // We need to listen to changes in the childrens' height to
            // adjust the container's own.
            widget.HeightRequestChanged +=
                new EventHandler(OnChildWidgetHeightRequestChanged);
        }
コード例 #10
0
        /// <summary>
        /// Adds an item to the items container.
        /// </summary>
        /// <param name="widget">
        /// A <see cref="ExpressionItemWidget"/>
        /// </param>
        public void AddItem(ExpressionItemWidget widget)
        {
            expItemsBox.Add(widget);

            foreach (ExpressionItemWidget w in expItemsBox.Children)
            {
                w.CheckPosition();
            }


            widget.HeightRequestChanged +=
                new EventHandler(OnChildWidgetHeightRequestChanged);

            // We expand the scroller is it's necessary to show the whole widget.
            if (widget.HeightRequest + 20 > expItemsScroller.HeightRequest)
            {
                expItemsScroller.HeightRequest = widget.HeightRequest + 20;
            }

            expItemsScroller.Hadjustment.Value =
                expItemsScroller.Hadjustment.Upper;
        }
コード例 #11
0
        /// <summary>
        /// Creates a widget based on the type of the item pased.
        /// </summary>
        /// <param name="item">
        /// The <see cref="ExpressionItem"/> that will be contained in the
        /// widget.
        /// </param>
        /// <param name="container">
        /// The container holding the new widget.
        /// </param>
        /// <returns>
        /// The widget holding the given item.
        /// </returns>
        public static ExpressionItemWidget CreateWidget(ExpressionItem item,
                                                        IExpressionItemContainer container)
        {
            ExpressionItemWidget widget = null;

            if (item.GetType() == typeof(ExpressionGroupItem))
            {
                widget = new ExpressionGroupWidget(container);
            }
            else if (item.GetType() == typeof(ExpressionTokenItem))
            {
                widget = new ExpressionTokenWidget(container);
            }

            if (item.GetType() == typeof(ExpressionRuleCallItem))
            {
                widget = new ExpressionRuleCallWidget(container);
            }

            widget.ExpressionItem = item;

            return(widget);
        }
コード例 #12
0
		/// <summary>
		/// Moves the widget towards the start of the item group.
		/// </summary>
		/// <param name="widget">
		/// A <see cref="ExpressionItemWidget"/>
		/// </param>
		public void MoveItemBackwards(ExpressionItemWidget widget)
		{
			int position = (expGroupItemsBox[widget] as Gtk.Box.BoxChild).Position;
			expGroupItemsBox.ReorderChild(widget, position-1);
			widget.CheckPosition();
			
			(expGroupItemsBox.Children[position] as ExpressionItemWidget).CheckPosition();
		}
コード例 #13
0
		/// <summary>
		/// Adds an item widget to the group.
		/// </summary>
		/// <param name="widget">
		/// A <see cref="ExpressionItemWidget"/>
		/// </param>
		public void AddItem (ExpressionItemWidget widget)
		{
			expGroupItemsBox.Add(widget);
			
			foreach (ExpressionItemWidget childWidget in  expGroupItemsBox) 
			{
				childWidget.CheckPosition();
			}
		
			CheckHeight();
			
			expGroupItemsScroller.Hadjustment.Value =
				expGroupItemsScroller.Hadjustment.Upper;		
			
			// We need to listen to changes in the childrens' height to
			// adjust the container's own.
			widget.HeightRequestChanged += 
				new EventHandler(OnChildWidgetHeightRequestChanged);
		}
コード例 #14
0
		/// <summary>
		/// Remove an item from this container.
		/// </summary>
		/// <param name="widget">
		/// A <see cref="ExpressionItemWidget"/>
		/// </param>
		public void RemoveItem (ExpressionItemWidget widget)
		{
			expGroupItemsBox.Remove(widget);
			
			foreach (ExpressionItemWidget childWidget in expGroupItemsBox) 
			{
				childWidget.CheckPosition();
			}
			
			CheckHeight();
			
		}
コード例 #15
0
		/// <summary>
		/// Moves an item towards the end of the container.
		/// </summary>
		/// <param name="widget">
		/// A <see cref="ExpressionItemWidget"/>
		/// </param>
		public void MoveItemFordwards (ExpressionItemWidget widget)
		{
			int position = this[widget].Position;
			itemOpRelatedItemsBox.ReorderChild(widget, position+1);
			widget.CheckPosition();
			
			((RelatedItemWidget)itemOpRelatedItemsBox.Children[position]).CheckPosition();
			
		}
コード例 #16
0
		/// <summary>
		/// Adds an item to the container.
		/// </summary>
		/// <param name="widget">
		/// A <see cref="ExpressionItemWidget"/>
		/// </param>
		private RelatedItemWidget AddItemAux (ExpressionItemWidget widget)
		{
			RelatedItemWidget relatedItemWidget = 
				new RelatedItemWidget(widget, this);
			
			widget.SetRelatedMode();
						
			this.itemOpRelatedItemsBox.Add(relatedItemWidget);
			
			foreach (RelatedItemWidget relWidget in itemOpRelatedItemsBox.Children) 
			{
				relWidget.CheckPosition();
			}
						
			itemOpRelatedItemsScroller.Vadjustment.Value = 
				itemOpRelatedItemsScroller.Vadjustment.Upper;
			
			return relatedItemWidget;
		}
コード例 #17
0
		/// <summary>
		/// Adds an item to the items container.
		/// </summary>
		/// <param name="widget">
		/// A <see cref="ExpressionItemWidget"/>
		/// </param>
		public void AddItem (ExpressionItemWidget widget)
		{
			expItemsBox.Add(widget);
			
			foreach (ExpressionItemWidget w in expItemsBox.Children) 
			{
				w.CheckPosition();
			}
			
			
			widget.HeightRequestChanged +=
				new EventHandler(OnChildWidgetHeightRequestChanged);
			
			// We expand the scroller is it's necessary to show the whole widget.
			if(widget.HeightRequest + 20 > expItemsScroller.HeightRequest)
				expItemsScroller.HeightRequest = widget.HeightRequest + 20;
			
			expItemsScroller.Hadjustment.Value =
				expItemsScroller.Hadjustment.Upper;
		}
コード例 #18
0
		/// <summary>
		/// Removes a widget from the container.
		/// </summary>
		/// <param name="widget">
		/// The <see cref="ExpressionItemWidget"/> that will be removed
		/// </param>
		public void RemoveItem(ExpressionItemWidget widget)
		{
			expItemsBox.Remove(widget);
				
			
			if(expItemsBox.Children.Length ==0)
			{
				expItemsScroller.HeightRequest = 85;
			}
			else
			{
				int maxRequest = -1;
				
				foreach (ExpressionItemWidget childWidget in expItemsBox.Children) 
				{
					if (maxRequest < childWidget.HeightRequest)
						maxRequest = childWidget.HeightRequest;
					
					childWidget.CheckPosition();
				}
			
				
				expItemsScroller.HeightRequest = maxRequest + 20;
			}
		}
コード例 #19
0
		/// <summary>
		/// Removes an item from the container.
		/// </summary>
		/// <param name="widget">
		/// A <see cref="ExpressionItemWidget"/>
		/// </param>
		public void RemoveItem (ExpressionItemWidget widget)
		{
			itemOpRelatedItemsBox.Remove(widget);
			
			foreach (RelatedItemWidget relWidget in itemOpRelatedItemsBox.Children) 
			{
				relWidget.CheckPosition();
			}
			
		}