mirror of
https://github.com/RGBCube/serenity
synced 2025-05-31 15:38:10 +00:00
Userland: Make TextWrapping::Wrap opt-in
This was breaking many places which didn't expect text to wrap. Now, the only place where text currently wraps is in GUI::Label.
This commit is contained in:
parent
2dc9ae00af
commit
4c9c85ac01
8 changed files with 21 additions and 21 deletions
|
@ -11,6 +11,7 @@
|
|||
#include <LibGfx/Font.h>
|
||||
#include <LibGfx/Palette.h>
|
||||
#include <LibGfx/TextLayout.h>
|
||||
#include <LibGfx/TextWrapping.h>
|
||||
|
||||
REGISTER_WIDGET(GUI, Label)
|
||||
|
||||
|
@ -95,10 +96,10 @@ void Label::paint_event(PaintEvent& event)
|
|||
|
||||
auto text_rect = this->text_rect();
|
||||
if (is_enabled()) {
|
||||
painter.draw_text(text_rect, text(), m_text_alignment, palette().color(foreground_role()), Gfx::TextElision::Right);
|
||||
painter.draw_text(text_rect, text(), m_text_alignment, palette().color(foreground_role()), Gfx::TextElision::Right, Gfx::TextWrapping::Wrap);
|
||||
} else {
|
||||
painter.draw_text(text_rect.translated(1, 1), text(), font(), text_alignment(), Color::White, Gfx::TextElision::Right);
|
||||
painter.draw_text(text_rect, text(), font(), text_alignment(), Color::from_rgb(0x808080), Gfx::TextElision::Right);
|
||||
painter.draw_text(text_rect.translated(1, 1), text(), font(), text_alignment(), Color::White, Gfx::TextElision::Right, Gfx::TextWrapping::Wrap);
|
||||
painter.draw_text(text_rect, text(), font(), text_alignment(), Color::from_rgb(0x808080), Gfx::TextElision::Right, Gfx::TextWrapping::Wrap);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -113,5 +114,4 @@ int Label::preferred_height() const
|
|||
// a constant instead.
|
||||
return Gfx::TextLayout(&font(), Utf8View { m_text }, text_rect()).bounding_rect(Gfx::TextWrapping::Wrap, 4).height();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue