mirror of
https://github.com/SerenityOS/serenity
synced 2024-07-23 19:15:55 +00:00
Put the font test into its own Window.
This commit is contained in:
parent
6f6f9bd84d
commit
6637dec958
|
@ -12,8 +12,8 @@ Painter::Painter(Widget& widget)
|
||||||
{
|
{
|
||||||
if (auto* window = widget.window()) {
|
if (auto* window = widget.window()) {
|
||||||
printf("window :: %s\n", window->title().characters());
|
printf("window :: %s\n", window->title().characters());
|
||||||
m_translation.setX(window->x());
|
m_translation = window->position();
|
||||||
m_translation.setY(window->y());
|
m_translation.moveBy(widget.position());
|
||||||
} else {
|
} else {
|
||||||
m_translation.setX(widget.x());
|
m_translation.setX(widget.x());
|
||||||
m_translation.setY(widget.y());
|
m_translation.setY(widget.y());
|
||||||
|
|
|
@ -24,6 +24,8 @@ public:
|
||||||
virtual void onMouseUp(MouseEvent&);
|
virtual void onMouseUp(MouseEvent&);
|
||||||
|
|
||||||
Rect rect() const { return m_rect; }
|
Rect rect() const { return m_rect; }
|
||||||
|
Point position() const { return m_rect.location(); }
|
||||||
|
|
||||||
int x() const { return rect().x(); }
|
int x() const { return rect().x(); }
|
||||||
int y() const { return rect().y(); }
|
int y() const { return rect().y(); }
|
||||||
int width() const { return rect().width(); }
|
int width() const { return rect().width(); }
|
||||||
|
|
|
@ -18,20 +18,28 @@ int main(int c, char** v)
|
||||||
RootWidget w;
|
RootWidget w;
|
||||||
WindowManager::the().setRootWidget(&w);
|
WindowManager::the().setRootWidget(&w);
|
||||||
|
|
||||||
auto* l1 = new Label(&w);
|
auto* fontTestWindow = new Window;
|
||||||
l1->setRect(Rect(100, 100, 300, 20));
|
fontTestWindow->setTitle("Font test");
|
||||||
|
fontTestWindow->setRect({100, 100, 300, 80 });
|
||||||
|
|
||||||
|
auto* fontTestWindowWidget = new Widget;
|
||||||
|
fontTestWindow->setMainWidget(fontTestWindowWidget);
|
||||||
|
fontTestWindowWidget->setRect({0, 0, 300, 80 });
|
||||||
|
|
||||||
|
auto* l1 = new Label(fontTestWindowWidget);
|
||||||
|
l1->setRect(Rect(0, 0, 300, 20));
|
||||||
l1->setText("0123456789");
|
l1->setText("0123456789");
|
||||||
|
|
||||||
auto* l2 = new Label(&w);
|
auto* l2 = new Label(fontTestWindowWidget);
|
||||||
l2->setRect(Rect(100, 120, 300, 20));
|
l2->setRect(Rect(0, 20, 300, 20));
|
||||||
l2->setText("ABCDEFGHIJKLMNOPQRSTUVWXYZ");
|
l2->setText("ABCDEFGHIJKLMNOPQRSTUVWXYZ");
|
||||||
|
|
||||||
auto* l3 = new Label(&w);
|
auto* l3 = new Label(fontTestWindowWidget);
|
||||||
l3->setRect(Rect(100, 140, 300, 20));
|
l3->setRect(Rect(0, 40, 300, 20));
|
||||||
l3->setText("abcdefghijklmnopqrstuvwxyz");
|
l3->setText("abcdefghijklmnopqrstuvwxyz");
|
||||||
|
|
||||||
auto* l4 = new Label(&w);
|
auto* l4 = new Label(fontTestWindowWidget);
|
||||||
l4->setRect(Rect(100, 160, 300, 20));
|
l4->setRect(Rect(0, 60, 300, 20));
|
||||||
l4->setText("!\"#$%&'()*+,-./:;<=>?@[\\]^_{|}~");
|
l4->setText("!\"#$%&'()*+,-./:;<=>?@[\\]^_{|}~");
|
||||||
|
|
||||||
auto* b = new Button(&w);
|
auto* b = new Button(&w);
|
||||||
|
|
Loading…
Reference in a new issue