mirror of
https://github.com/RGBCube/serenity
synced 2025-07-26 11:07:35 +00:00
Userspace: Use Core::Object::add() when building interfaces
This commit is contained in:
parent
7ec758773c
commit
3d20da9ee4
87 changed files with 403 additions and 438 deletions
|
@ -52,7 +52,7 @@ RefPtr<LayoutNode> HTMLInputElement::create_layout_node(const StyleProperties*)
|
|||
|
||||
RefPtr<GUI::Widget> widget;
|
||||
if (type() == "submit") {
|
||||
auto button = GUI::Button::construct(value(), &html_view);
|
||||
auto button = html_view.add<GUI::Button>(value());
|
||||
int text_width = Gfx::Font::default_font().width(value());
|
||||
button->set_relative_rect(0, 0, text_width + 20, 20);
|
||||
button->on_click = [this](auto&) {
|
||||
|
|
|
@ -46,9 +46,8 @@
|
|||
#include <LibHTML/ResourceLoader.h>
|
||||
#include <stdio.h>
|
||||
|
||||
HtmlView::HtmlView(GUI::Widget* parent)
|
||||
: GUI::ScrollableWidget(parent)
|
||||
, m_main_frame(::Frame::create(*this))
|
||||
HtmlView::HtmlView()
|
||||
: m_main_frame(::Frame::create(*this))
|
||||
{
|
||||
main_frame().on_set_needs_display = [this](auto& content_rect) {
|
||||
if (content_rect.is_empty()) {
|
||||
|
|
|
@ -62,7 +62,7 @@ public:
|
|||
virtual bool accepts_focus() const override { return true; }
|
||||
|
||||
protected:
|
||||
HtmlView(GUI::Widget* parent = nullptr);
|
||||
HtmlView();
|
||||
|
||||
virtual void resize_event(GUI::ResizeEvent&) override;
|
||||
virtual void paint_event(GUI::PaintEvent&) override;
|
||||
|
|
|
@ -89,14 +89,14 @@ TerminalWidget::TerminalWidget(int ptm_fd, bool automatic_size_policy, RefPtr<Co
|
|||
, m_config(move(config))
|
||||
{
|
||||
set_pty_master_fd(ptm_fd);
|
||||
m_cursor_blink_timer = Core::Timer::construct();
|
||||
m_visual_beep_timer = Core::Timer::construct();
|
||||
m_cursor_blink_timer = add<Core::Timer>();
|
||||
m_visual_beep_timer = add<Core::Timer>();
|
||||
|
||||
set_frame_shape(Gfx::FrameShape::Container);
|
||||
set_frame_shadow(Gfx::FrameShadow::Sunken);
|
||||
set_frame_thickness(2);
|
||||
|
||||
m_scrollbar = GUI::ScrollBar::construct(Orientation::Vertical, this);
|
||||
m_scrollbar = add<GUI::ScrollBar>(Orientation::Vertical);
|
||||
m_scrollbar->set_relative_rect(0, 0, 16, 0);
|
||||
m_scrollbar->on_change = [this](int) {
|
||||
force_repaint();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue