Пример #1
0
 public void Clear()
 {
     Lines.Clear();
     WrappedLineCount = 0;
     Form.Modify(WidgetName, "replace_inner", "{list}");
     ScrollToStart();
 }
Пример #2
0
        void Resize()
        {
            var width = Width;

            if (!AutoLineWrap || width <= 0)
            {
                // nothing to do
                return;
            }

            // re-wrap all lines and re-apply offset
            WrappedLineCount = 0;
            var offset = Offset;
            var items  = new StringBuilder("{list", Lines.Count + 2);

            foreach (var line in Lines)
            {
                foreach (var wrappedLine in WrapLine(line, width))
                {
                    WrappedLineCount++;
                    items.AppendFormat("{{listitem text:{0}}}",
                                       StflApi.stfl_quote(wrappedLine));
                }
            }
            items.Append("}");
            Form.Modify(WidgetName, "replace_inner", items.ToString());
            Offset = offset;
        }
Пример #3
0
 public void AppendWrappedLine(string line)
 {
     WrappedLineCount++;
     Form.Modify(
         WidgetName,
         "append",
         String.Format("{{listitem text:{0}}}",
                       StflApi.stfl_quote(line))
         );
 }
Пример #4
0
        void Resize()
        {
            var width = Width;

            if (!AutoLineWrap || width <= 0)
            {
                // nothing to do
                return;
            }

            var estimatedLines = Math.Max(WrappedLineCount, Lines.Count);
            // see items.AppendFormat() below
            var lineStyleOverhead = 18;
            var listStyleOverhead = 6;
            var estimatedLength   = listStyleOverhead +
                                    (estimatedLines * (width + lineStyleOverhead));

            estimatedLength = (int)(estimatedLength * 1.2);

            // re-wrap all lines and re-apply offset
            WrappedLineCount = 0;
            var offset = Offset;
            var items  = new StringBuilder("{list", estimatedLength);

            foreach (var line in Lines)
            {
                foreach (var wrappedLine in WrapLine(line, width))
                {
                    WrappedLineCount++;
                    items.AppendFormat("{{listitem text:{0}}}",
                                       StflApi.stfl_quote(wrappedLine));
                }
            }
            items.Append("}");
            Form.Modify(WidgetName, "replace_inner", items.ToString());
            Offset = offset;
        }