mirror of
https://github.com/SerenityOS/serenity
synced 2024-09-06 17:06:31 +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:
parent
a92f7aea7a
commit
299824de73
|
@ -33,7 +33,7 @@
|
|||
#include <LibDesktop/Launcher.h>
|
||||
#include <LibGUI/BoxLayout.h>
|
||||
#include <LibGUI/Button.h>
|
||||
#include <LibGUI/Image.h>
|
||||
#include <LibGUI/ImageWidget.h>
|
||||
#include <LibGUI/Label.h>
|
||||
#include <LibGUI/MessageBox.h>
|
||||
#include <LibGUI/ProgressBar.h>
|
||||
|
@ -74,7 +74,7 @@ DownloadWidget::DownloadWidget(const URL& url)
|
|||
animation_container.set_preferred_size(0, 32);
|
||||
auto& animation_layout = animation_container.set_layout<GUI::HorizontalBoxLayout>();
|
||||
|
||||
auto& browser_image = animation_container.add<GUI::Image>();
|
||||
auto& browser_image = animation_container.add<GUI::ImageWidget>();
|
||||
browser_image.load_from_file("/res/download-animation.gif");
|
||||
animation_layout.add_spacer();
|
||||
|
||||
|
|
|
@ -69,7 +69,7 @@ PropertiesDialog::PropertiesDialog(GUI::FileSystemModel& model, String path, boo
|
|||
file_container.layout()->set_spacing(20);
|
||||
file_container.set_preferred_size(0, 34);
|
||||
|
||||
m_icon = file_container.add<GUI::Image>();
|
||||
m_icon = file_container.add<GUI::ImageWidget>();
|
||||
m_icon->set_size_policy(GUI::SizePolicy::Fixed, GUI::SizePolicy::Fixed);
|
||||
m_icon->set_preferred_size(32, 32);
|
||||
|
||||
|
|
|
@ -30,7 +30,7 @@
|
|||
#include <LibGUI/Button.h>
|
||||
#include <LibGUI/Dialog.h>
|
||||
#include <LibGUI/FileSystemModel.h>
|
||||
#include <LibGUI/Image.h>
|
||||
#include <LibGUI/ImageWidget.h>
|
||||
#include <LibGUI/Label.h>
|
||||
#include <LibGUI/TextBox.h>
|
||||
|
||||
|
@ -87,7 +87,7 @@ private:
|
|||
GUI::FileSystemModel& m_model;
|
||||
RefPtr<GUI::Button> m_apply_button;
|
||||
RefPtr<GUI::TextBox> m_name_box;
|
||||
RefPtr<GUI::Image> m_icon;
|
||||
RefPtr<GUI::ImageWidget> m_icon;
|
||||
String m_name;
|
||||
String m_path;
|
||||
mode_t m_mode;
|
||||
|
|
|
@ -36,7 +36,7 @@
|
|||
#include <LibGUI/BoxLayout.h>
|
||||
#include <LibGUI/Button.h>
|
||||
#include <LibGUI/Desktop.h>
|
||||
#include <LibGUI/Image.h>
|
||||
#include <LibGUI/ImageWidget.h>
|
||||
#include <LibGUI/Label.h>
|
||||
#include <LibGUI/MessageBox.h>
|
||||
#include <LibGUI/StackWidget.h>
|
||||
|
@ -214,7 +214,7 @@ int main(int argc, char** argv)
|
|||
title_box.set_size_policy(GUI::SizePolicy::Fill, GUI::SizePolicy::Fixed);
|
||||
|
||||
if (!page.icon.is_empty()) {
|
||||
auto& icon = title_box.add<GUI::Image>();
|
||||
auto& icon = title_box.add<GUI::ImageWidget>();
|
||||
icon.set_preferred_size(16, 16);
|
||||
icon.set_size_policy(GUI::SizePolicy::Fixed, GUI::SizePolicy::Fixed);
|
||||
icon.load_from_file(page.icon);
|
||||
|
|
|
@ -39,7 +39,7 @@
|
|||
#include <LibGUI/FontDatabase.h>
|
||||
#include <LibGUI/GroupBox.h>
|
||||
#include <LibGUI/Icon.h>
|
||||
#include <LibGUI/Image.h>
|
||||
#include <LibGUI/ImageWidget.h>
|
||||
#include <LibGUI/InputBox.h>
|
||||
#include <LibGUI/Label.h>
|
||||
#include <LibGUI/ListView.h>
|
||||
|
@ -495,11 +495,11 @@ int main(int argc, char** argv)
|
|||
tab_image.layout()->set_margins({ 8, 8, 8, 8 });
|
||||
tab_image.layout()->set_spacing(8);
|
||||
|
||||
auto& banner_image = tab_image.add<GUI::Image>();
|
||||
auto& banner_image = tab_image.add<GUI::ImageWidget>();
|
||||
banner_image.set_frame_thickness(2);
|
||||
banner_image.load_from_file("/res/brand-banner.png");
|
||||
|
||||
auto& gif_animation_image = tab_image.add<GUI::Image>();
|
||||
auto& gif_animation_image = tab_image.add<GUI::ImageWidget>();
|
||||
gif_animation_image.load_from_file("/res/download-animation.gif");
|
||||
|
||||
auto& tab_cursors = tab_widget.add_tab<GUI::Widget>("Cursors");
|
||||
|
|
|
@ -31,7 +31,7 @@
|
|||
#include <LibGUI/Application.h>
|
||||
#include <LibGUI/BoxLayout.h>
|
||||
#include <LibGUI/Button.h>
|
||||
#include <LibGUI/Image.h>
|
||||
#include <LibGUI/ImageWidget.h>
|
||||
#include <LibGUI/Label.h>
|
||||
#include <LibGUI/Menu.h>
|
||||
#include <LibGUI/MenuBar.h>
|
||||
|
@ -67,7 +67,7 @@ int main(int argc, char** argv)
|
|||
container.set_preferred_size(0, 36);
|
||||
container.set_layout<GUI::HorizontalBoxLayout>();
|
||||
|
||||
auto& flag_image = container.add<GUI::Image>();
|
||||
auto& flag_image = container.add<GUI::ImageWidget>();
|
||||
flag_image.load_from_file("/res/icons/minesweeper/flag.png");
|
||||
|
||||
auto& flag_label = container.add<GUI::Label>();
|
||||
|
@ -76,7 +76,7 @@ int main(int argc, char** argv)
|
|||
face_button.set_size_policy(GUI::SizePolicy::Fixed, GUI::SizePolicy::Fill);
|
||||
face_button.set_preferred_size(36, 0);
|
||||
|
||||
auto& time_image = container.add<GUI::Image>();
|
||||
auto& time_image = container.add<GUI::ImageWidget>();
|
||||
time_image.load_from_file("/res/icons/minesweeper/timer.png");
|
||||
|
||||
auto& time_label = container.add<GUI::Label>();
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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 };
|
||||
|
|
|
@ -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);
|
||||
|
|
@ -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;
|
|
@ -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();
|
||||
|
|
|
@ -26,7 +26,7 @@
|
|||
|
||||
#include "ClipboardHistoryModel.h"
|
||||
#include <LibGUI/Application.h>
|
||||
#include <LibGUI/Image.h>
|
||||
#include <LibGUI/ImageWidget.h>
|
||||
#include <LibGUI/TableView.h>
|
||||
#include <LibGUI/Window.h>
|
||||
#include <stdio.h>
|
||||
|
@ -76,7 +76,7 @@ int main(int argc, char* argv[])
|
|||
auto applet_window = GUI::Window::construct();
|
||||
applet_window->set_title("ClipboardHistory");
|
||||
applet_window->set_window_type(GUI::WindowType::MenuApplet);
|
||||
auto& icon = applet_window->set_main_widget<GUI::Image>();
|
||||
auto& icon = applet_window->set_main_widget<GUI::ImageWidget>();
|
||||
icon.load_from_file("/res/icons/clipboard.png");
|
||||
icon.set_fill_with_background_color(true);
|
||||
icon.on_click = [& main_window = *main_window] {
|
||||
|
|
|
@ -30,7 +30,7 @@
|
|||
#include <LibGUI/Button.h>
|
||||
#include <LibGUI/Desktop.h>
|
||||
#include <LibGUI/Label.h>
|
||||
#include <LibGUI/Image.h>
|
||||
#include <LibGUI/ImageWidget.h>
|
||||
#include <LibGUI/Widget.h>
|
||||
#include <LibGfx/Bitmap.h>
|
||||
#include <LibGfx/Font.h>
|
||||
|
@ -91,7 +91,7 @@ NotificationWindow::NotificationWindow(const String& text, const String& title,
|
|||
widget.layout()->set_spacing(6);
|
||||
|
||||
if (icon.is_valid()) {
|
||||
auto& image = widget.add<GUI::Image>();
|
||||
auto& image = widget.add<GUI::ImageWidget>();
|
||||
image.set_bitmap(icon.bitmap());
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue