26 #ifndef TGUI_PICTURE_HPP
27 #define TGUI_PICTURE_HPP
30 #include <TGUI/Widgets/ClickableWidget.hpp>
31 #include <TGUI/Renderers/PictureRenderer.hpp>
44 typedef std::shared_ptr<Picture>
Ptr;
45 typedef std::shared_ptr<const Picture>
ConstPtr;
164 void leftMouseReleased(
Vector2f pos)
override;
174 void draw(sf::RenderTarget& target, sf::RenderStates states)
const override;
195 SignalVector2f onDoubleClick = {
"DoubleClicked"};
213 std::unique_ptr<DataIO::Node>
save(SavingRenderersMap& renderers)
const override;
219 void load(
const std::unique_ptr<DataIO::Node>& node,
const LoadingRenderersMap& renderers)
override;
225 bool update(sf::Time elapsedTime)
override;
233 return std::make_shared<Picture>(*
this);
242 bool m_ignoringMouseEvents =
false;
245 bool m_possibleDoubleClick =
false;
253 #endif // TGUI_PICTURE_HPP
void rendererChanged(const std::string &property) override
Function called when one of the properties of the renderer is changed.
Signal to which the user can subscribe to get callbacks from.
Definition: Signal.hpp:224
bool mouseOnWidget(Vector2f pos) const override
Returns whether the mouse position (which is relative to the parent widget) lies on top of the widget...
Widget::Ptr clone() const override
Makes a copy of the widget if you don't know its exact type.
Definition: Picture.hpp:231
bool canGainFocus() const override
Returns whether the widget can gain focus.
PictureRenderer * getSharedRenderer()
Returns the renderer, which gives access to functions that determine how the widget is displayed.
Namespace that contains all TGUI functions and classes.
Definition: AbsoluteOrRelativeValue.hpp:37
bool isIgnoringMouseEvents() const
Returns whether the widget is ignoring mouse events and letting them pass to the widgets behind it.
std::shared_ptr< const Picture > ConstPtr
Shared constant widget pointer.
Definition: Picture.hpp:45
Class to store the position or size of a widget.
Definition: Layout.hpp:260
Signal & getSignal(std::string signalName) override
Retrieves a signal based on its name.
void setSize(const Layout2d &size) override
Changes the size of the picture.
static Picture::Ptr create(const Texture &texture={}, bool transparentTexture=false)
Creates a new picture widget.
Definition: Sprite.hpp:46
std::shared_ptr< Picture > Ptr
Shared widget pointer.
Definition: Picture.hpp:44
static Picture::Ptr copy(Picture::ConstPtr picture)
Makes a copy of another picture.
Definition: Texture.hpp:42
PictureRenderer * getRenderer()
Returns the renderer, which gives access to functions that determine how the widget is displayed.
void draw(sf::RenderTarget &target, sf::RenderStates states) const override
Draw the widget to a render target.
void load(const std::unique_ptr< DataIO::Node > &node, const LoadingRenderersMap &renderers) override
Loads the widget from a tree of nodes.
Definition: Vector2f.hpp:39
Picture()
Default constructor.
Picture(const Texture &texture, bool transparentTexture=false)
Constructor to create the picture from a texture.
Definition: PictureRenderer.hpp:37
std::unique_ptr< DataIO::Node > save(SavingRenderersMap &renderers) const override
Saves the widget as a tree node in order to save it to a file.
Picture widget.
Definition: Picture.hpp:41
void ignoreMouseEvents(bool ignore=true)
Sets whether the widget should completely ignore mouse events and let them pass to the widgets behind...