1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-27 13:07:46 +00:00

LibGUI: Rename GUI::Image => GUI::ImageWidget

"Image" was a bit too vague, "ImageWidget" is obviously a widget of
some sort.
This commit is contained in:
Andreas Kling 2020-07-22 15:29:51 +02:00
parent a92f7aea7a
commit 299824de73
15 changed files with 41 additions and 41 deletions

View file

@ -30,7 +30,7 @@
#include <LibGUI/BoxLayout.h>
#include <LibGUI/Button.h>
#include <LibGUI/Label.h>
#include <LibGUI/Image.h>
#include <LibGUI/ImageWidget.h>
#include <LibGUI/Widget.h>
#include <LibGfx/Font.h>
@ -53,7 +53,7 @@ AboutDialog::AboutDialog(const StringView& name, const Gfx::Bitmap* icon, Window
widget.set_layout<VerticalBoxLayout>();
widget.layout()->set_spacing(0);
auto& banner_image = widget.add<GUI::Image>();
auto& banner_image = widget.add<GUI::ImageWidget>();
banner_image.load_from_file("/res/brand-banner.png");
auto& content_container = widget.add<Widget>();
@ -72,7 +72,7 @@ AboutDialog::AboutDialog(const StringView& name, const Gfx::Bitmap* icon, Window
icon_wrapper.set_preferred_size(32, 48);
icon_wrapper.set_layout<VerticalBoxLayout>();
auto& icon_image = icon_wrapper.add<Image>();
auto& icon_image = icon_wrapper.add<ImageWidget>();
icon_image.set_bitmap(m_icon);
}

View file

@ -29,11 +29,11 @@ set(SOURCES
FontDatabase.cpp
Frame.cpp
GroupBox.cpp
Icon.cpp
IconView.cpp
Image.cpp
INILexer.cpp
INISyntaxHighlighter.cpp
Icon.cpp
IconView.cpp
ImageWidget.cpp
InputBox.cpp
JsonArrayModel.cpp
JSSyntaxHighlighter.cpp

View file

@ -266,7 +266,7 @@ FilePicker::FilePicker(Window* parent_window, Mode mode, Options options, const
m_preview_container->set_layout<VerticalBoxLayout>();
m_preview_container->layout()->set_margins({ 8, 8, 8, 8 });
m_preview_image = m_preview_container->add<Image>();
m_preview_image = m_preview_container->add<ImageWidget>();
m_preview_image->set_should_stretch(true);
m_preview_image->set_auto_resize(false);
m_preview_image->set_preferred_size(160, 160);

View file

@ -30,7 +30,7 @@
#include <AK/Optional.h>
#include <LibCore/StandardPaths.h>
#include <LibGUI/Dialog.h>
#include <LibGUI/Image.h>
#include <LibGUI/ImageWidget.h>
#include <LibGUI/Model.h>
namespace GUI {
@ -93,7 +93,7 @@ private:
RefPtr<TextBox> m_filename_textbox;
RefPtr<TextBox> m_location_textbox;
RefPtr<Frame> m_preview_container;
RefPtr<Image> m_preview_image;
RefPtr<ImageWidget> m_preview_image;
RefPtr<Label> m_preview_name_label;
RefPtr<Label> m_preview_geometry_label;
Mode m_mode { Mode::Open };

View file

@ -24,15 +24,15 @@
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include "Image.h"
#include <AK/MappedFile.h>
#include <LibGUI/Image.h>
#include <LibGUI/Painter.h>
#include <LibGfx/Bitmap.h>
#include <LibGfx/ImageDecoder.h>
namespace GUI {
Image::Image(const StringView&)
ImageWidget::ImageWidget(const StringView&)
: m_timer(Core::Timer::construct())
{
@ -43,11 +43,11 @@ Image::Image(const StringView&)
set_auto_resize(true);
}
Image::~Image()
ImageWidget::~ImageWidget()
{
}
void Image::set_bitmap(const Gfx::Bitmap* bitmap)
void ImageWidget::set_bitmap(const Gfx::Bitmap* bitmap)
{
if (m_bitmap == bitmap)
return;
@ -59,7 +59,7 @@ void Image::set_bitmap(const Gfx::Bitmap* bitmap)
update();
}
void Image::set_auto_resize(bool value)
void ImageWidget::set_auto_resize(bool value)
{
m_auto_resize = value;
@ -67,7 +67,7 @@ void Image::set_auto_resize(bool value)
set_preferred_size(m_bitmap->width(), m_bitmap->height());
}
void Image::animate()
void ImageWidget::animate()
{
m_current_frame_index = (m_current_frame_index + 1) % m_image_decoder->frame_count();
@ -86,7 +86,7 @@ void Image::animate()
}
}
void Image::load_from_file(const StringView& path)
void ImageWidget::load_from_file(const StringView& path)
{
MappedFile mapped_file(path);
if (!mapped_file.is_valid())
@ -108,13 +108,13 @@ void Image::load_from_file(const StringView& path)
}
}
void Image::mousedown_event(GUI::MouseEvent&)
void ImageWidget::mousedown_event(GUI::MouseEvent&)
{
if (on_click)
on_click();
}
void Image::paint_event(PaintEvent& event)
void ImageWidget::paint_event(PaintEvent& event)
{
Frame::paint_event(event);

View file

@ -31,10 +31,10 @@
namespace GUI {
class Image : public Frame {
C_OBJECT(Image)
class ImageWidget : public Frame {
C_OBJECT(ImageWidget)
public:
virtual ~Image() override;
virtual ~ImageWidget() override;
void set_bitmap(const Gfx::Bitmap*);
Gfx::Bitmap* bitmap() { return m_bitmap.ptr(); }
@ -51,7 +51,7 @@ public:
Function<void()> on_click;
protected:
explicit Image(const StringView& text = {});
explicit ImageWidget(const StringView& text = {});
virtual void mousedown_event(GUI::MouseEvent&) override;
virtual void paint_event(PaintEvent&) override;

View file

@ -27,7 +27,7 @@
#include <LibGUI/BoxLayout.h>
#include <LibGUI/Button.h>
#include <LibGUI/Label.h>
#include <LibGUI/Image.h>
#include <LibGUI/ImageWidget.h>
#include <LibGUI/MessageBox.h>
#include <LibGfx/Font.h>
#include <stdio.h>
@ -116,7 +116,7 @@ void MessageBox::build()
message_container.layout()->set_spacing(8);
if (m_type != Type::None) {
auto& icon_image = message_container.add<Image>();
auto& icon_image = message_container.add<ImageWidget>();
icon_image.set_bitmap(icon());
if (icon())
icon_width = icon()->width();