/// <summary>
		/// Calculates container size
		/// </summary>
		/// <param name="aWidth">
		/// Requested width <see cref="System.Double"/>
		/// </param>
		/// <param name="aHeight">
		/// Requested height <see cref="System.Double"/>
		/// </param>
		public static void HBoxGetSize (DrawingCellBox aBox, out double aWidth, out double aHeight)
		{
			aWidth = 0;
			aHeight = 0;
			if (aBox.VisibleCount == 0)
				return;
			double w,h,cw = w = h = 0;
			foreach (IDrawingCell dc in aBox.Cells) {
				if (dc.IsVisible == false)
					continue;
				dc.GetCellSize (out w, out h);
				if (cw < w)
					cw = w;
				aWidth += w;
				if (aHeight < h)
					aHeight = h;
			}
			if (aBox.VisibleCount > 1)
				if (aBox.Homogeneous == true)
					aWidth += ((aBox.VisibleCount*cw) + ((aBox.VisibleCount-1) * aBox.Spacing));
				else
					aWidth += ((aBox.VisibleCount-1) * aBox.Spacing);
//			aWidth = aWidth + (aBox.Padding * 2);
//			aHeight = aHeight + (aBox.Padding * 2);
		}
Ejemplo n.º 2
0
 public CellDrawingArea(DrawingCellBox aBox)
 {
     if (aBox == null)
     {
         box = CreateBox();
     }
     else
     {
         box = aBox;
     }
     InitArea();
 }
Ejemplo n.º 3
0
 /// <summary>
 /// Calculates container size
 /// </summary>
 /// <param name="aWidth">
 /// Requested width <see cref="System.Double"/>
 /// </param>
 /// <param name="aHeight">
 /// Requested height <see cref="System.Double"/>
 /// </param>
 public static void BinGetSize(DrawingCellBox aBox, out double aWidth, out double aHeight)
 {
     aWidth  = 0;
     aHeight = 0;
     if ((aBox.Count == 0) || (aBox.Cells[0].Visible == false))
     {
         return;
     }
     aBox.Cells[0].GetCellSize(out aWidth, out aHeight);
     aWidth  += (aBox.Padding * 2);
     aHeight += (aBox.Padding * 2);
 }
Ejemplo n.º 4
0
 /// <summary>
 /// Calculates cell areas
 /// </summary>
 /// <param name="aRect">
 /// Bounding rectangle <see cref="CellRectangle"/>
 /// </param>
 public static void BinCalculateCellAreas(DrawingCellBox aBox, CellRectangle aRect)
 {
     if (aBox.Count == 0)
     {
         return;
     }
     if (aBox.Cells[0].Visible == false)
     {
         aBox.Cells[0].Area.Set(0, 0, 0, 0);
         return;
     }
     aBox.Cells[0].Area.CopyFrom(aRect);
     aBox.Cells[0].Area.Shrink(aBox.Padding);
     aBox.RecalcChildren();
 }
Ejemplo n.º 5
0
        /// <summary>
        /// Calculates container size
        /// </summary>
        /// <param name="aWidth">
        /// Requested width <see cref="System.Double"/>
        /// </param>
        /// <param name="aHeight">
        /// Requested height <see cref="System.Double"/>
        /// </param>
        public static void HBoxGetSize(DrawingCellBox aBox, out double aWidth, out double aHeight)
        {
            aWidth  = 0;
            aHeight = 0;
            if (aBox.VisibleCount == 0)
            {
                return;
            }
            double w, h, cw = w = h = 0;

            foreach (IDrawingCell dc in aBox.Cells)
            {
                if (dc.IsVisible == false)
                {
                    continue;
                }
                dc.GetCellSize(out w, out h);
                if (cw < w)
                {
                    cw = w;
                }
                aWidth += w;
                if (aHeight < h)
                {
                    aHeight = h;
                }
            }
            if (aBox.VisibleCount > 1)
            {
                if (aBox.Homogeneous == true)
                {
                    aWidth += ((aBox.VisibleCount * cw) + ((aBox.VisibleCount - 1) * aBox.Spacing));
                }
                else
                {
                    aWidth += ((aBox.VisibleCount - 1) * aBox.Spacing);
                }
            }
//			aWidth = aWidth + (aBox.Padding * 2);
//			aHeight = aHeight + (aBox.Padding * 2);
        }
		/// <summary>
		/// Calculates cell areas
		/// </summary>
		/// <param name="aRect">
		/// Bounding rectangle <see cref="Cairo.Rectangle"/>
		/// </param>
		public static void HBoxCalculateCellAreas (DrawingCellBox aBox, CellRectangle aRect)
		{
			CellRectangle rect = aRect.Copy();
			rect.Shrink (aBox.Padding);
			double start = rect.X;
			double end = System.Convert.ToInt32 (rect.Width+rect.X);
			double w,h = 0;
			double cellTop = rect.Y;
			double cellHeight = System.Convert.ToInt32 (rect.Height);

			if (aBox.Homogeneous == true) {
				double cw, ch = cw = 0;
				for (int i=0; i<aBox.Count; i++) {
					if (aBox.Cells[i].IsVisible == false) {
						aBox.Cells[i].Area.Set (0, 0, 0, 0);
						continue;
					}
					aBox.Cells[i].GetCellSize (out w, out h);
					if (w > cw)
						cw = w;
					if (h > ch)
						ch = h;
				}
				int j = 0;
				for (int i=0; i<aBox.Count; i++)
					if (aBox.Cells[i].IsVisible == true) {
						aBox.Cells[i].Area.Set (j*cw, cellTop, cw, cellHeight);
						j++;
					}
				return;			
			}
			
			IDrawingCell expandedCell = null;
			for (int i=0; i<aBox.Count; i++) {
				if (aBox.Cells[i].IsVisible == false) {
					aBox.Cells[i].Area.Set (0, 0, 0, 0);
					continue;
				}
				if (aBox.Cells[i].Expanded == true) {
					expandedCell = aBox.Cells[i];
					break;
				}
				aBox.Cells[i].GetCellSize (out w, out h);
				aBox.Cells[i].Area.Set (start, cellTop, w, cellHeight);
				start += w + aBox.Spacing;
			}
			if (expandedCell != null) {
				for (int i=aBox.Count-1; i>-1; i--) {
					if (aBox.Cells[i].IsVisible == false) {
						aBox.Cells[i].Area.Set (0, 0, 0, 0);
						continue;
					}
					if (aBox.Cells[i].Expanded == true)
						break;
					aBox.Cells[i].GetCellSize (out w, out h);
					aBox.Cells[i].Area.Set (end-w, cellTop, w, cellHeight);
					end -= w + aBox.Spacing;
				}
				if (expandedCell.IsVisible == true)
					expandedCell.Area.Set (start, cellTop, end-start, cellHeight);
				else
					expandedCell.Area.Set (0, 0, 0, 0);
			}
			aBox.RecalcChildren();
		}
		/// <summary>
		/// Calculates cell areas
		/// </summary>
		/// <param name="aRect">
		/// Bounding rectangle <see cref="CellRectangle"/>
		/// </param>
		public static void BinCalculateCellAreas (DrawingCellBox aBox, CellRectangle aRect)
		{
			if (aBox.Count == 0)
				return;
			if (aBox.Cells[0].Visible == false) {
				aBox.Cells[0].Area.Set (0, 0, 0, 0);
				return;
			}
			aBox.Cells[0].Area.CopyFrom (aRect);
			aBox.Cells[0].Area.Shrink (aBox.Padding);
			aBox.RecalcChildren();
		}
		/// <summary>
		/// Calculates container size
		/// </summary>
		/// <param name="aWidth">
		/// Requested width <see cref="System.Double"/>
		/// </param>
		/// <param name="aHeight">
		/// Requested height <see cref="System.Double"/>
		/// </param>
		public static void BinGetSize (DrawingCellBox aBox, out double aWidth, out double aHeight)
		{
			aWidth = 0;
			aHeight = 0;
			if ((aBox.Count == 0) || (aBox.Cells[0].Visible == false))
				return;
			aBox.Cells[0].GetCellSize (out aWidth, out aHeight);
			aWidth += (aBox.Padding * 2);
			aHeight += (aBox.Padding * 2);
		}
		/// <summary>
		/// Calculates container size
		/// </summary>
		/// <param name="aWidth">
		/// Requested width <see cref="System.Double"/>
		/// </param>
		/// <param name="aHeight">
		/// Requested height <see cref="System.Double"/>
		/// </param>
		public static void VBoxGetSize (DrawingCellBox aBox, out double aWidth, out double aHeight)
		{
			aWidth = 0;
			aHeight = 0;
			if (aBox.VisibleCount == 0)
				return;
			double w,h,ch = w = h = 0;
			foreach (IDrawingCell dc in aBox.Cells) {
				if (dc.IsVisible == false)
					continue;
				if (ch < h)
					ch = h;
				dc.GetCellSize (out w, out h);
				aHeight += h;
				if (aWidth < w)
					aWidth = w;
			}
			if (aBox.VisibleCount > 1)
				if (aBox.Homogeneous == true)
					aHeight += (aBox.VisibleCount*ch) + ((aBox.VisibleCount-1) * aBox.Spacing);
				else
					aHeight += (aBox.VisibleCount-1) * aBox.Spacing;
//			aWidth = aWidth + (Padding * 2);
//			aHeight = aHeight + (Padding * 2);
		}
		public CellDrawingArea (DrawingCellBox aBox)
		{
			if (aBox == null)
				box = CreateBox();
			else
				box = aBox;
			InitArea();
		}
Ejemplo n.º 11
0
        /// <summary>
        /// Calculates cell areas
        /// </summary>
        /// <param name="aRect">
        /// Bounding rectangle <see cref="Cairo.Rectangle"/>
        /// </param>
        public static void HBoxCalculateCellAreas(DrawingCellBox aBox, CellRectangle aRect)
        {
            CellRectangle rect = aRect.Copy();

            rect.Shrink(aBox.Padding);
            double start = rect.X;
            double end = System.Convert.ToInt32(rect.Width + rect.X);
            double w, h = 0;
            double cellTop    = rect.Y;
            double cellHeight = System.Convert.ToInt32(rect.Height);

            if (aBox.Homogeneous == true)
            {
                double cw, ch = cw = 0;
                for (int i = 0; i < aBox.Count; i++)
                {
                    if (aBox.Cells[i].IsVisible == false)
                    {
                        aBox.Cells[i].Area.Set(0, 0, 0, 0);
                        continue;
                    }
                    aBox.Cells[i].GetCellSize(out w, out h);
                    if (w > cw)
                    {
                        cw = w;
                    }
                    if (h > ch)
                    {
                        ch = h;
                    }
                }
                int j = 0;
                for (int i = 0; i < aBox.Count; i++)
                {
                    if (aBox.Cells[i].IsVisible == true)
                    {
                        aBox.Cells[i].Area.Set(j * cw, cellTop, cw, cellHeight);
                        j++;
                    }
                }
                return;
            }

            IDrawingCell expandedCell = null;

            for (int i = 0; i < aBox.Count; i++)
            {
                if (aBox.Cells[i].IsVisible == false)
                {
                    aBox.Cells[i].Area.Set(0, 0, 0, 0);
                    continue;
                }
                if (aBox.Cells[i].Expanded == true)
                {
                    expandedCell = aBox.Cells[i];
                    break;
                }
                aBox.Cells[i].GetCellSize(out w, out h);
                aBox.Cells[i].Area.Set(start, cellTop, w, cellHeight);
                start += w + aBox.Spacing;
            }
            if (expandedCell != null)
            {
                for (int i = aBox.Count - 1; i > -1; i--)
                {
                    if (aBox.Cells[i].IsVisible == false)
                    {
                        aBox.Cells[i].Area.Set(0, 0, 0, 0);
                        continue;
                    }
                    if (aBox.Cells[i].Expanded == true)
                    {
                        break;
                    }
                    aBox.Cells[i].GetCellSize(out w, out h);
                    aBox.Cells[i].Area.Set(end - w, cellTop, w, cellHeight);
                    end -= w + aBox.Spacing;
                }
                if (expandedCell.IsVisible == true)
                {
                    expandedCell.Area.Set(start, cellTop, end - start, cellHeight);
                }
                else
                {
                    expandedCell.Area.Set(0, 0, 0, 0);
                }
            }
            aBox.RecalcChildren();
        }