mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-05-03 09:48:47 +00:00
GWidget: Add set_preferred_size(width, height) overload.
It was annoying to always write set_preferred_size({ width, height }). :^)
This commit is contained in:
parent
5b440a72f9
commit
aa2224a2f0
Notes:
sideshowbarker
2024-07-19 13:07:09 +09:00
Author: https://github.com/awesomekling
Commit: aa2224a2f0
26 changed files with 61 additions and 60 deletions
|
@ -36,15 +36,15 @@ void GInputBox::build()
|
|||
|
||||
auto* label = new GLabel(m_prompt, widget);
|
||||
label->set_size_policy(SizePolicy::Fixed, SizePolicy::Fixed);
|
||||
label->set_preferred_size({ text_width, 16 });
|
||||
label->set_preferred_size(text_width, 16);
|
||||
|
||||
m_text_editor = new GTextEditor(GTextEditor::SingleLine, widget);
|
||||
m_text_editor->set_size_policy(SizePolicy::Fill, SizePolicy::Fixed);
|
||||
m_text_editor->set_preferred_size({ 0, 19 });
|
||||
m_text_editor->set_preferred_size(0, 19);
|
||||
|
||||
auto* button_container_outer = new GWidget(widget);
|
||||
button_container_outer->set_size_policy(SizePolicy::Fill, SizePolicy::Fixed);
|
||||
button_container_outer->set_preferred_size({ 0, 20 });
|
||||
button_container_outer->set_preferred_size(0, 20);
|
||||
button_container_outer->set_layout(make<GBoxLayout>(Orientation::Vertical));
|
||||
|
||||
auto* button_container_inner = new GWidget(button_container_outer);
|
||||
|
@ -53,7 +53,7 @@ void GInputBox::build()
|
|||
|
||||
m_cancel_button = new GButton(button_container_inner);
|
||||
m_cancel_button->set_size_policy(SizePolicy::Fill, SizePolicy::Fixed);
|
||||
m_cancel_button->set_preferred_size({ 0, 20 });
|
||||
m_cancel_button->set_preferred_size(0, 20);
|
||||
m_cancel_button->set_text("Cancel");
|
||||
m_cancel_button->on_click = [this](auto&) {
|
||||
dbgprintf("GInputBox: Cancel button clicked\n");
|
||||
|
@ -62,7 +62,7 @@ void GInputBox::build()
|
|||
|
||||
m_ok_button = new GButton(button_container_inner);
|
||||
m_ok_button->set_size_policy(SizePolicy::Fill, SizePolicy::Fixed);
|
||||
m_ok_button->set_preferred_size({ 0, 20 });
|
||||
m_ok_button->set_preferred_size(0, 20);
|
||||
m_ok_button->set_text("OK");
|
||||
m_ok_button->on_click = [this](auto&) {
|
||||
dbgprintf("GInputBox: OK button clicked\n");
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue