Example #1
0
 public CanvasTextBox(
     CanvasControl host,
     string text,
     Font font,
     Color fontColor,
     float height,
     float width,
     float paddingH    = 1f,
     float paddingV    = 1f,
     float textAdjustV = 0f
     ) : base(host)
 {
     Text        = text;
     Font        = font;
     PaddingH    = paddingH;
     PaddingV    = paddingV;
     TextAdjustV = textAdjustV;
     FontColor   = fontColor;
     Size        = new SizeF(width + 2 * paddingH, height + 2 * paddingV);
 }
Example #2
0
        public TagLabel(
            CanvasControl host,
            string text,
            Font font,
            float height,
            float maxTextWidth,
            float paddingH    = 2f,
            float paddingV    = 1f,
            float textAdjustV = 0f
            ) : base(host)
        {
            Text        = text;
            Font        = font;
            PaddingH    = paddingH;
            PaddingV    = paddingV;
            TextAdjustV = textAdjustV;

            var textSize = TextRenderer.MeasureText(text, font);

            TextWidth = Math.Min(maxTextWidth, textSize.Width);
            var totalWidth = height / 2 + TextWidth + 2 * paddingH + Inset / 2;

            Size = new SizeF(totalWidth, height + 2 * paddingV);
        }
Example #3
0
        public static FlowLayoutCanvasControlHost LabelHost(TH_Task task, CanvasControl host)
        {
            var labels = new List <CanvasControl>();

            //nulls are used as each label's initial, as this is later added during the Host object construction

            if (task.Owner != "")
            {
                labels.Add(PersonLabel(task.Owner, null));
            }

            labels.Add(StatusLabel(task.Status, null));

            if (task.HasDate)
            {
                labels.Add(DatePart(task.Date, task.IsLate, null));
            }

            if (task.Link != "")
            {
                labels.Add(FolderButton(task.Link, null));
            }

            foreach (var tag in task.Tags)
            {
                labels.Add(Tag(tag, null));
            }

            return(new FlowLayoutCanvasControlHost(
                       host.TopLevelAttributes,
                       labels,
                       InnerWidth,
                       LabelsPadH,
                       LabelsPadV,
                       new Separator(null, SeparatorThk, LabelHeight, Color.LightGray)));
        }
 public void AddControl(CanvasControl control)
 {
     AddControl(control, default);
     Layout();
 }
Example #5
0
 public Separator(CanvasControl host, float thickness, float height, Color color) : base(host)
 {
     Thk    = thickness;
     Height = height;
     Color  = color;
 }
Example #6
0
 protected CanvasButton(CanvasControl host, Action onClick) : base(host)
 {
     OnClick       = onClick;
     OnDoubleClick = onClick;
 }
Example #7
0
 public static CanvasTextBox TaskName(string taskName, CanvasControl host) =>
 new CanvasTextBox(host, taskName, TitleFont, Color.Black, TitleHeight, InnerWidth);
Example #8
0
 public static IconButton FolderButton(string link, CanvasControl host) =>
 new IconButton(host, Resources.IconFolder, LinkOpening.GetLinkOpener(link), LabelHeight);
Example #9
0
 public static CardLabel PersonLabel(string personName, CanvasControl host) =>
 new CardLabel(host, Resources.IconOwner, personName, LabelFont, Color.Black, LabelHeight, LabelMaxTextWidth);
Example #10
0
 public static CardLabel StatusLabel(TaskStatus status, CanvasControl host) =>
 new CardLabel(host, status.GetIcon(), status.AsString(), LabelFont, status.GetColor(), LabelHeight, LabelMaxTextWidth);
Example #11
0
 public static TagLabel Tag(string text, CanvasControl host) =>
 new TagLabel(host, text, LabelFont, LabelHeight, LabelMaxTextWidth);
Example #12
0
        public StatusBar(TaskStatus statusIn, TaskStatus taskStatus, float width, float height, float barHeight, CanvasControl host) : base(host)
        {
            var statusOut = (TaskStatus)Math.Min((int)statusIn, (int)taskStatus);

            ColorIn   = TaskStatusColors.GetColor(statusIn);
            ColorOut  = TaskStatusColors.GetColor(statusOut);
            Size      = new SizeF(width, height);
            BarHeight = barHeight;
        }