コード例 #1
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();
 }
コード例 #2
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();
		}
コード例 #3
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();
		}
コード例 #4
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();
        }