Frame

Undocumented in source.

Constructors

this
this(StandardOutput output)
Undocumented in source.

Destructor

~this
~this()
Undocumented in source.

Members

Functions

print
void print()
Undocumented in source. Be warned that the author may not have intended to support it.
size
Size size()
Undocumented in source. Be warned that the author may not have intended to support it.
size
void size(Size size)
Undocumented in source. Be warned that the author may not have intended to support it.
size
void size(size_t width, size_t height)
Undocumented in source. Be warned that the author may not have intended to support it.
title
void title(string title)
Undocumented in source. Be warned that the author may not have intended to support it.
write
void write(X tx, Y ty, Args args)
Undocumented in source. Be warned that the author may not have intended to support it.
write
void write(Coordinate origin, Args args)
Undocumented in source. Be warned that the author may not have intended to support it.

Examples

basic

import scone.core.dummy : DummyOutput;

auto output = new DummyOutput();
output.size = Size(5, 3);

auto frame = new Frame(output);
assert(frame.size == Size(5, 3));

frame.size(5, 4);
assert(frame.size == Size(5, 4));

frame.title("test");
// todo: assert(frame.title == "test");

destroy(frame);

special control characters

import scone.core.dummy : DummyOutput;
import scone.output.text_style : TextStyle;

auto output = new DummyOutput();
output.size = Size(5, 3);
auto frame = new Frame(output);

frame.write(0, 0, "1");
assert(frame.buffer.get(Coordinate(0, 0)) == Cell('1'));

frame.print();
frame.write(0, 0, "\n2");
assert(frame.buffer.get(Coordinate(0, 1)) == Cell('2'));

frame.print();
frame.write(0, 0, "11\r3");
assert(frame.buffer.get(Coordinate(0, 0)) == Cell('3'));
assert(frame.buffer.get(Coordinate(1, 0)) == Cell('1'));

frame.print();
frame.buffer.commit();
frame.write(4, 2, "11\n1");
assert(frame.buffer.diffs == [Coordinate(4, 2)]);

tab special character. should be changed in the future?

import scone.core.dummy : DummyOutput;
import scone.output.text_style : TextStyle;

auto output = new DummyOutput();
output.size = Size(5, 3);
auto frame = new Frame(output);

frame.print();
frame.write(2, 0, TextStyle(Color.green), "X");
frame.write(0, 0, TextStyle(Color.red), "0\t4");
assert(frame.buffer.get(Coordinate(0, 0)) == Cell('0', TextStyle(Color.red, Color.initial)));
assert(frame.buffer.get(Coordinate(1, 0)) == Cell(' ', TextStyle(Color.initial, Color.initial)));
assert(frame.buffer.get(Coordinate(2, 0)) == Cell('X', TextStyle(Color.green, Color.initial)));
assert(frame.buffer.get(Coordinate(3, 0)) == Cell(' ', TextStyle(Color.initial, Color.initial)));
assert(frame.buffer.get(Coordinate(4, 0)) == Cell('4', TextStyle(Color.red, Color.initial)));

frame.print();
frame.write(0, 1, TextStyle().fg(Color.red), TextStyle().bg(Color.green), "X");
assert(frame.buffer.get(Coordinate(0, 1)) == Cell('X', TextStyle(Color.red, Color.green)));

cells use its own style, independen of previous text style

import scone.core.dummy : DummyOutput;
import scone.output.text_style : TextStyle, StyledText;

auto output = new DummyOutput();
output.size = Size(5, 3);
auto frame = new Frame(output);

frame.print();
frame.write(0, 0, TextStyle(Color.blue, Color.yellow), Cell('1',
        TextStyle(Color.red, Color.green)), '2');
assert(frame.buffer.get(Coordinate(0, 0)) == Cell('1', TextStyle(Color.red, Color.green)));
assert(frame.buffer.get(Coordinate(1, 0)) == Cell('2', TextStyle(Color.blue, Color.yellow)));

frame.print();
frame.write(0, 0, TextStyle(Color.green, Color.black), "a", StyledText("bc", TextStyle(Color.red, Color
        .black)), "d");
assert(frame.buffer.get(Coordinate(0, 0)) == Cell('a', TextStyle(Color.green, Color.black)));
assert(frame.buffer.get(Coordinate(1, 0)) == Cell('b', TextStyle(Color.red, Color.black)));
assert(frame.buffer.get(Coordinate(2, 0)) == Cell('c', TextStyle(Color.red, Color.black)));
assert(frame.buffer.get(Coordinate(3, 0)) == Cell('d', TextStyle(Color.green, Color.black)));

Meta