private static Gdi::Point GetLocation(ILayoutNode self, int lvEnd, int lvSta) { Gdi::Point ret = new Gdi::Point(); if (lvSta > lvEnd) { ret = GetLocation(self, lvSta, lvEnd); ret.X = -ret.X; ret.Y = -ret.Y; return(ret); } switch (lvSta) { case 0: if (lvEnd == 0) { return(ret); } ret.X -= self.DesiredLeft; ret.Y -= self.DesiredTop; goto case 1; case 1: if (lvEnd == 1) { return(ret); } ret.X += self.BoundingLeft; ret.Y += self.BoundingTop; goto case 2; case 2: return(ret); default: throw new System.InvalidProgramException(); } }
//-------------------------------------------------------------------------- public static void CoordTransf(this ILayoutNode self, ref Gdi::Point pos, RectCoord before, RectCoord after) { Gdi::Point delta = self.GetLocation(before, after); pos.X += delta.X; pos.Y += delta.Y; }
private static int GetTop(ILayoutNode self, int lvEnd, int lvSta) { if (lvSta > lvEnd) { return(-GetTop(self, lvSta, lvEnd)); } int ret = 0; switch (lvSta) { case 0: if (lvEnd == 0) { return(ret); } ret -= self.DesiredTop; goto case 1; case 1: if (lvEnd == 1) { return(ret); } ret += self.BoundingTop; goto case 2; case 2: return(ret); default: throw new System.InvalidProgramException(); } }
public static Gdi::Point CoordTransf(this ILayoutNode self, Gdi::Point pos, RectCoord before, RectCoord after) { Gdi::Point ret = pos; self.CoordTransf(ref ret, before, after); return(ret); }
public static int GetHeight(ILayoutNode self, RectCoord coord) { switch (coord) { case RectCoord.Desired: return(self.DesiredHeight); case RectCoord.Bounding: return(self.BoundingHeight); default: throw new System.NotSupportedException(); } }
public static Gdi::Size GetSize(ILayoutNode self, RectCoord coord) { switch (coord) { case RectCoord.Desired: return(new Gdi::Size(self.DesiredWidth, self.DesiredHeight)); case RectCoord.Bounding: return(new Gdi::Size(self.BoundingWidth, self.BoundingHeight)); default: throw new System.NotSupportedException(); } }
/// <summary> /// 自分が、指定したノードの子孫であるか否かを判定します。 /// </summary> /// <param name="self">判定対象の自ノードを指定します。</param> /// <param name="ancestor">先祖である可能性のあるノードを指定します。</param> /// <returns>自分が、指定したノードの子孫である場合に true を返します。 /// そうでない場合には false を返します。 /// 指定したノードが自分自身である場合には false を返します。 /// </returns> public static bool IsDescendantOf(this ILayoutNode self, ILayoutNode ancestor) { if (self == null || ancestor == null) { return(false); } ILayoutNode p = self; while (p.Parent != null) { p = p.Parent; if (p == ancestor) { return(true); } } return(false); }
public static Gdi::Point GetLocation(ILayoutNode self, RectCoord coord, RectCoord axis) { return(GetLocation(self, getCoordLevel(coord), getCoordLevel(axis))); }
public static int GetBottom(this ILayoutNode self, RectCoord coord, RectCoord axis) { return(self.GetTop(coord, axis) + self.GetHeight(coord)); }
//------------------------------------------------------------------------ // 自動配置 //------------------------------------------------------------------------ public static Gdi::Rectangle GetDesiredRect(this ILayoutNode self) { return(new Gdi::Rectangle(self.DesiredLeft, self.DesiredTop, self.DesiredWidth, self.DesiredHeight)); }
//-------------------------------------------------------------------------- public static Gdi::Rectangle GetRect(this ILayoutNode self, RectCoord coord, RectCoord axis) { return(new Gdi::Rectangle(self.GetLocation(coord, axis), self.GetSize(coord))); }
public static int GetRight(this ILayoutNode self, RectCoord coord, RectCoord axis) { return(self.GetLeft(coord, axis) + self.GetWidth(coord)); }
public static Gdi::Rectangle GetBoundingRect(this ILayoutNode self) { return(new Gdi::Rectangle(self.BoundingLeft, self.BoundingTop, self.BoundingWidth, self.BoundingHeight)); }
public static Gdi::Size GetBoundingSize(this ILayoutNode self) { return(new Gdi::Size(self.BoundingWidth, self.BoundingHeight)); }
public static Gdi::Point GetBoundingLocation(this ILayoutNode self) { return(new Gdi::Point(self.BoundingLeft, self.BoundingTop)); }
/// <summary> /// 自分が、指定したノードの先祖であるか否かを判定します。 /// </summary> /// <param name="self">判定対象の自ノードを指定します。</param> /// <param name="descen">子孫である可能性のあるノードを指定します。</param> /// <returns>自分が、指定したノードの先祖である場合に true を返します。 /// そうでない場合には false を返します。 /// 指定したノードが自分自身である場合には false を返します。 /// </returns> public static bool IsAscendantOf(this ILayoutNode self, ILayoutNode descen) { return(descen.IsDescendantOf(self)); }
public static int GetTop(ILayoutNode self, RectCoord coord, RectCoord axis) { return(GetTop(self, getCoordLevel(coord), getCoordLevel(axis))); }