Example #1
0
		public FullsizeContainer(Widget widget)
			: base()
		{
			if (widget == null) {
				throw new ArgumentException("widget");
			}

			Widget = widget;
		}
Example #2
0
		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);
		}
Example #3
0
 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);
 }
Example #4
0
 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);
 }
Example #5
0
 /// <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 ();
 }
Example #6
0
        /// <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;
        }
Example #7
0
		public int Fill(Widget widget, char ch, int x, int y, int w, int h)
		{
			return Fill(widget, String, ch, x, y, w, h);
		}
Example #8
0
		public int Fill(Widget widget, char ch, int x, int y)
		{
			return Fill(widget, String, ch, x, y, widget.Width - x, widget.Height - y);
		}
Example #9
0
		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);
		}
Example #10
0
		public int Draw(Widget widget)
		{
			return Draw(widget, String);
		}
Example #11
0
		public static int Fill(Widget widget, string str, int x, int y)
		{
			return Fill(widget, str, ' ', x, y);
		}
Example #12
0
		public static int Fill(Widget widget, string str, char ch)
		{
			return Fill(widget, str, ch, 0, 0);
		}
Example #13
0
		public static int Fill(Widget widget, string str)
		{
			return Fill(widget, str, ' ', 0, 0);
		}
Example #14
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;
		}
Example #15
0
		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);
		}
Example #16
0
		public int Fill(Widget widget, char ch)
		{
			return Fill(widget, ch, 0, 0);
		}
Example #17
0
		public int Fill(Widget widget, int x, int y)
		{
			return Fill(widget, ' ', x, y);
		}
Example #18
0
		public static int Fill(Widget widget, string str, int x, int y, int w, int h)
		{
			return Fill(widget, str, ' ', x, y, w, h);
		}
Example #19
0
		public int Fill(Widget widget, int x, int y, int w, int h)
		{
			return Fill(widget, ' ', x, y, w, h);
		}
Example #20
0
		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;
		}
Example #21
0
 /// <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;
 }
Example #22
0
		public int Draw(Widget widget, out int endx, out int endy)
		{
			return Draw(widget, String, out endx, out endy);
		}
Example #23
0
        /// <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;
        }
Example #24
0
		public int Draw(Widget widget, int x, int y)
		{
			return Draw(widget, String, x, y);
		}
Example #25
0
 public override void Add(Widget w)
 {
     base.Add (w);
 }
Example #26
0
		public int Draw(Widget widget, int x, int y, int w, int h)
		{
			return Draw(widget, String, x, y, w, h);
		}
Example #27
0
 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);
     }
 }
Example #28
0
		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);
		}
Example #29
0
 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);
     }
 }
Example #30
0
		public int Fill(Widget widget)
		{
			return Fill(widget, ' ');
		}