public FullsizeContainer(Widget widget) : base() { if (widget == null) { throw new ArgumentException("widget"); } Widget = widget; }
public static int Draw(Widget widget, string str, int x, int y, out int endx, out int endy) { return Draw(widget, str, x, y, widget.Width - x, widget.Height - y, out endx, out endy); }
public static void DrawV(Widget widget, int x, int y, int height, ColorPair color) { Curses.attron(color.Attribute); DrawV(widget, x, y, height); Curses.attron(ColorPair.From(-1, -1).Attribute); }
public static void DrawH(Widget widget, int x, int y, int width, ColorPair color) { Curses.attron(color.Attribute); DrawH(widget, x, y, width); Curses.attron(ColorPair.From(-1, -1).Attribute); }
/// <summary> /// Focuses the specified widget in this container. /// </summary> /// <remarks> /// Focuses the specified widge, taking the focus /// away from any previously focused widgets. This /// method only works if the widget specified /// supports being focused. /// </remarks> public void SetFocus(Widget w) { if (!w.CanFocus) return; if (focused == w) return; if (focused != null) focused.HasFocus = false; focused = w; focused.HasFocus = true; Container wc = w as Container; if (wc != null) wc.EnsureFocus (); focused.PositionCursor (); }
/// <summary> /// Focuses the previous widget. /// </summary> /// <remarks> /// </remarks> public bool FocusPrev() { if (focused == null){ FocusLast (); return true; } int focused_idx = -1; for (int i = widgets.Count; i > 0; ){ i--; Widget w = (Widget)widgets [i]; if (w.HasFocus){ Container c = w as Container; if (c != null){ if (c.FocusPrev ()) return true; } focused_idx = i; continue; } if (w.CanFocus && focused_idx != -1){ focused.HasFocus = false; Container c = w as Container; if (c != null && c.CanFocus){ c.FocusLast (); } SetFocus (w); return true; } } if (focused != null){ focused.HasFocus = false; focused = null; } return false; }
public int Fill(Widget widget, char ch, int x, int y, int w, int h) { return Fill(widget, String, ch, x, y, w, h); }
public int Fill(Widget widget, char ch, int x, int y) { return Fill(widget, String, ch, x, y, widget.Width - x, widget.Height - y); }
public static int Fill(Widget widget, string str, char ch, int x, int y) { return Fill(widget, str, ch, x, y, widget.Width - x, widget.Height - y); }
public int Draw(Widget widget) { return Draw(widget, String); }
public static int Fill(Widget widget, string str, int x, int y) { return Fill(widget, str, ' ', x, y); }
public static int Fill(Widget widget, string str, char ch) { return Fill(widget, str, ch, 0, 0); }
public static int Fill(Widget widget, string str) { return Fill(widget, str, ' ', 0, 0); }
public static int Draw(Widget widget, string str, int x, int y, int w, int h, out int endx, out int endy) { int xi = 0, yi = 0; int length = Each(str, delegate (char ch) { widget.Set(xi + x, yi + y, ch); xi++; if (xi >= w) { xi = 0; yi++; if (yi >= h) { return false; } } return true; }); endx = xi + x; endy = yi + y; return length; }
public static int Draw(Widget widget, string str, int x, int y, int w, int h) { int endx, endy; return Draw(widget, str, x, y, w, h, out endx, out endy); }
public int Fill(Widget widget, char ch) { return Fill(widget, ch, 0, 0); }
public int Fill(Widget widget, int x, int y) { return Fill(widget, ' ', x, y); }
public static int Fill(Widget widget, string str, int x, int y, int w, int h) { return Fill(widget, str, ' ', x, y, w, h); }
public int Fill(Widget widget, int x, int y, int w, int h) { return Fill(widget, ' ', x, y, w, h); }
public static int Fill(Widget widget, string str, char ch, int x, int y, int w, int h) { int endx, endy; int length = Draw(widget, str, x, y, w, h, out endx, out endy); widget.Fill(ch, x, y, w, h, endx, endy); return length; }
/// <summary> /// Adds a widget to this container. /// </summary> /// <remarks> /// </remarks> public virtual void Add(Widget w) { widgets.Add (w); w.Container = this; if (w.CanFocus) this.CanFocus = true; }
public int Draw(Widget widget, out int endx, out int endy) { return Draw(widget, String, out endx, out endy); }
/// <summary> /// Removes a widget from this container. /// </summary> /// <remarks> /// </remarks> public virtual void Remove(Widget w) { if (w == null) return; widgets.Remove (w); w.Container = null; if (widgets.Count < 1) this.CanFocus = false; }
public int Draw(Widget widget, int x, int y) { return Draw(widget, String, x, y); }
public override void Add(Widget w) { base.Add (w); }
public int Draw(Widget widget, int x, int y, int w, int h) { return Draw(widget, String, x, y, w, h); }
public static void DrawH(Widget widget, int x, int y, int width) { for (int i = 0; i < width; i++) { widget.Set(x + i, y, ACS.HLINE); } }
public int Draw(Widget widget, int x, int y, int w, int h, out int endx, out int endy) { return Draw(widget, String, x, y, w, h, out endx, out endy); }
public static void DrawV(Widget widget, int x, int y, int height) { for (int i = 0; i < height; i++) { widget.Set(x, y + i, ACS.VLINE); } }
public int Fill(Widget widget) { return Fill(widget, ' '); }