diff options
Diffstat (limited to 'Userland/Libraries/LibWeb/Painting/RadioButtonPaintable.cpp')
-rw-r--r-- | Userland/Libraries/LibWeb/Painting/RadioButtonPaintable.cpp | 40 |
1 files changed, 40 insertions, 0 deletions
diff --git a/Userland/Libraries/LibWeb/Painting/RadioButtonPaintable.cpp b/Userland/Libraries/LibWeb/Painting/RadioButtonPaintable.cpp new file mode 100644 index 0000000000..47b5d4a09f --- /dev/null +++ b/Userland/Libraries/LibWeb/Painting/RadioButtonPaintable.cpp @@ -0,0 +1,40 @@ +/* + * Copyright (c) 2018-2022, Andreas Kling <kling@serenityos.org> + * + * SPDX-License-Identifier: BSD-2-Clause + */ + +#include <LibGfx/StylePainter.h> +#include <LibWeb/HTML/HTMLImageElement.h> +#include <LibWeb/Layout/RadioButton.h> +#include <LibWeb/Painting/RadioButtonPaintable.h> + +namespace Web::Painting { + +NonnullOwnPtr<RadioButtonPaintable> RadioButtonPaintable::create(Layout::RadioButton const& layout_box) +{ + return adopt_own(*new RadioButtonPaintable(layout_box)); +} + +RadioButtonPaintable::RadioButtonPaintable(Layout::RadioButton const& layout_box) + : Paintable(layout_box) +{ +} + +Layout::RadioButton const& RadioButtonPaintable::layout_box() const +{ + return static_cast<Layout::RadioButton const&>(m_layout_box); +} + +void RadioButtonPaintable::paint(PaintContext& context, PaintPhase phase) const +{ + if (!is_visible()) + return; + + Paintable::paint(context, phase); + + if (phase == PaintPhase::Foreground) + Gfx::StylePainter::paint_radio_button(context.painter(), enclosing_int_rect(absolute_rect()), context.palette(), layout_box().dom_node().checked(), layout_box().being_pressed()); +} + +} |