mirror of
https://github.com/RGBCube/serenity
synced 2025-07-10 03:47:34 +00:00
LibCore: Make Core::Object::add<ChildType> return a ChildType&
Since the returned object is now owned by the callee object, we can simply vend a ChildType&. This allows us to use "." instead of "->" at the call site, which is quite nice. :^)
This commit is contained in:
parent
fb09b6a8ce
commit
028c011760
46 changed files with 1035 additions and 1039 deletions
|
@ -38,19 +38,19 @@ EditorWrapper::EditorWrapper()
|
|||
{
|
||||
set_layout<GUI::VerticalBoxLayout>();
|
||||
|
||||
auto label_wrapper = add<GUI::Widget>();
|
||||
label_wrapper->set_size_policy(GUI::SizePolicy::Fill, GUI::SizePolicy::Fixed);
|
||||
label_wrapper->set_preferred_size(0, 14);
|
||||
label_wrapper->set_fill_with_background_color(true);
|
||||
label_wrapper->set_layout<GUI::HorizontalBoxLayout>();
|
||||
label_wrapper->layout()->set_margins({ 2, 0, 2, 0 });
|
||||
auto& label_wrapper = add<GUI::Widget>();
|
||||
label_wrapper.set_size_policy(GUI::SizePolicy::Fill, GUI::SizePolicy::Fixed);
|
||||
label_wrapper.set_preferred_size(0, 14);
|
||||
label_wrapper.set_fill_with_background_color(true);
|
||||
label_wrapper.set_layout<GUI::HorizontalBoxLayout>();
|
||||
label_wrapper.layout()->set_margins({ 2, 0, 2, 0 });
|
||||
|
||||
m_filename_label = label_wrapper->add<GUI::Label>("(Untitled)");
|
||||
m_filename_label = label_wrapper.add<GUI::Label>("(Untitled)");
|
||||
m_filename_label->set_text_alignment(Gfx::TextAlignment::CenterLeft);
|
||||
m_filename_label->set_size_policy(GUI::SizePolicy::Fill, GUI::SizePolicy::Fixed);
|
||||
m_filename_label->set_preferred_size(0, 14);
|
||||
|
||||
m_cursor_label = label_wrapper->add<GUI::Label>("(Cursor)");
|
||||
m_cursor_label = label_wrapper.add<GUI::Label>("(Cursor)");
|
||||
m_cursor_label->set_text_alignment(Gfx::TextAlignment::CenterRight);
|
||||
m_cursor_label->set_size_policy(GUI::SizePolicy::Fill, GUI::SizePolicy::Fixed);
|
||||
m_cursor_label->set_preferred_size(0, 14);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue