ladybird/Applications/QuickShow/QSWidget.h
Andreas Kling eedb4f6b2f 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.)
2019-06-23 16:35:43 +02:00

32 lines
791 B
C++

#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;
};