#pragma once #include #include #include namespace cadabra { /// \ingroup frontend /// /// An image viewing widget. class ImageView : public Gtk::EventBox { public: ImageView(double scale); virtual ~ImageView(); void set_image_from_base64(const std::string& b64); void set_image_from_svg(const std::string& svg); virtual bool on_motion_notify_event(GdkEventMotion *event) override; virtual bool on_button_press_event(GdkEventButton *event) override; virtual bool on_button_release_event(GdkEventButton *event) override; private: Gtk::VBox vbox; Gtk::Image image; Glib::RefPtr pixbuf; bool sizing; double prev_x, prev_y; int height_at_press, width_at_press; double scale; }; };