1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 17:17:44 +00:00

QuickShow: Allow panning and zooming the image instead of stretching it.

This needs more work and polish, but it's a step in a more pleasant and
useful direction.

Also turn QuickShow into a fully-fledged "application". (By that, I really
just mean giving it its own Applications/ subdirectory.)
This commit is contained in:
Andreas Kling 2019-06-23 16:35:43 +02:00
parent cf0d05d54a
commit eedb4f6b2f
7 changed files with 157 additions and 13 deletions

View file

@ -0,0 +1,32 @@
#pragma once
#include <LibGUI/GFrame.h>
class GLabel;
class QSLabel;
class QSWidget final : public GFrame {
public:
QSWidget(GWidget* parent);
virtual ~QSWidget() override;
void set_bitmap(NonnullRefPtr<GraphicsBitmap>);
Function<void(int)> on_scale_change;
private:
virtual void paint_event(GPaintEvent&) override;
virtual void resize_event(GResizeEvent&) override;
virtual void mousedown_event(GMouseEvent&) override;
virtual void mouseup_event(GMouseEvent&) override;
virtual void mousemove_event(GMouseEvent&) override;
virtual void mousewheel_event(GMouseEvent&) override;
void relayout();
RefPtr<GraphicsBitmap> m_bitmap;
Rect m_bitmap_rect;
int m_scale { 100 };
Point m_pan_origin;
Point m_pan_bitmap_origin;
};