Warning, file /graphics/glaxnimate/src/core/model/animation_container.hpp was not indexed or was modified since last indexation (in which case cross-reference links may be missing, inaccurate or erroneous).

0001 /*
0002  * SPDX-FileCopyrightText: 2019-2023 Mattia Basaglia <dev@dragon.best>
0003  *
0004  * SPDX-License-Identifier: GPL-3.0-or-later
0005  */
0006 
0007 #pragma once
0008 
0009 #include "model/object.hpp"
0010 #include "model/property/property.hpp"
0011 
0012 namespace glaxnimate::model {
0013 
0014 
0015 /**
0016  * \brief Helper class for document nodes that enclose an animation
0017  */
0018 class AnimationContainer: public Object
0019 {
0020     GLAXNIMATE_OBJECT(AnimationContainer)
0021     GLAXNIMATE_PROPERTY(float, first_frame,  0, &AnimationContainer::on_first_frame_changed, &AnimationContainer::validate_first_frame, PropertyTraits::Visual)
0022     GLAXNIMATE_PROPERTY(float, last_frame, -1, &AnimationContainer::on_last_frame_changed,  &AnimationContainer::validate_last_frame,  PropertyTraits::Visual)
0023     Q_PROPERTY(bool time_visible READ time_visible)
0024     Q_PROPERTY(float duration READ duration)
0025 
0026 public:
0027     using Object::Object;
0028 
0029     /**
0030      * \brief Whether time() is within first/last frame
0031      */
0032     bool time_visible() const;
0033 
0034     bool time_visible(FrameTime t) const;
0035 
0036     void set_time(FrameTime t) override;
0037 
0038     float duration() const;
0039 
0040     QString type_name_human() const override;
0041 
0042     void stretch_time(qreal multiplier) override;
0043 
0044 Q_SIGNALS:
0045     void first_frame_changed(float);
0046     void last_frame_changed(float);
0047     void time_visible_changed(bool visible);
0048 
0049 private Q_SLOTS:
0050     void on_first_frame_changed(float);
0051     void on_last_frame_changed(float);
0052 
0053 private:
0054     bool validate_first_frame(int f) const;
0055     bool validate_last_frame(int f) const;
0056 };
0057 
0058 } // namespace glaxnimate::model