diff --git a/include/nana/gui/animation.hpp b/include/nana/gui/animation.hpp index 9f0df563..e8338399 100644 --- a/include/nana/gui/animation.hpp +++ b/include/nana/gui/animation.hpp @@ -1,7 +1,7 @@ /* * An Animation Implementation * Nana C++ Library(http://www.nanapro.org) - * Copyright(C) 2003-2015 Jinhao(cnjinhao@hotmail.com) + * Copyright(C) 2003-2018 Jinhao(cnjinhao@hotmail.com) * * Distributed under the Boost Software License, Version 1.0. * (See accompanying file LICENSE_1_0.txt or copy at @@ -49,24 +49,18 @@ namespace nana struct impl; class performance_manager; + + /// Non-copyable + animation(const animation&) = delete; + animation& operator=(const animation&) = delete; public: animation(std::size_t fps = 23); ~animation(); - void push_back(frameset frms); - /* - void branch(const std::string& name, const frameset& frms) - { - impl_->branches[name].frames = frms; - } + animation(animation&&); + animation& operator=(animation&&); - void branch(const std::string& name, const frameset& frms, std::function condition) - { - auto & br = impl_->branches[name]; - br.frames = frms; - br.condition = condition; - } - */ + void push_back(frameset frms); void looped(bool enable); ///< Enables or disables the animation repeating playback. diff --git a/source/gui/animation.cpp b/source/gui/animation.cpp index c737d334..16e54729 100644 --- a/source/gui/animation.cpp +++ b/source/gui/animation.cpp @@ -1,7 +1,7 @@ /* * An Animation Implementation * Nana C++ Library(http://www.nanapro.org) - * Copyright(C) 2003-2015 Jinhao(cnjinhao@hotmail.com) + * Copyright(C) 2003-2018 Jinhao(cnjinhao@hotmail.com) * * Distributed under the Boost Software License, Version 1.0. * (See accompanying file LICENSE_1_0.txt or copy at @@ -571,6 +571,25 @@ namespace nana delete impl_; } + animation::animation(animation&& rhs) + : impl_(rhs.impl_) + { + rhs.impl_ = new impl(23); + } + + animation& animation::operator=(animation&& rhs) + { + if (this != &rhs) + { + auto imp = new impl{ 23 }; + + delete impl_; + impl_ = rhs.impl_; + rhs.impl_ = imp; + } + return *this; + } + void animation::push_back(frameset frms) { impl_->framesets.emplace_back(std::move(frms));