From 57303d302c941612b344b9391b6f093839ab180e Mon Sep 17 00:00:00 2001 From: Jinhao Date: Wed, 6 Jan 2016 04:25:48 +0800 Subject: [PATCH] add move-constructor and move-assignment for class dragger --- include/nana/gui/dragger.hpp | 20 +++++++++++++++++++- source/gui/dragger.cpp | 29 +++++++++++++++++++++++++++++ 2 files changed, 48 insertions(+), 1 deletion(-) diff --git a/include/nana/gui/dragger.hpp b/include/nana/gui/dragger.hpp index 9846b672..e34094ef 100644 --- a/include/nana/gui/dragger.hpp +++ b/include/nana/gui/dragger.hpp @@ -1,6 +1,20 @@ +/* +* A Dragger Implementation +* Nana C++ Library(http://www.nanapro.org) +* Copyright(C) 2003-2016 Jinhao(cnjinhao@hotmail.com) +* +* Distributed under the Boost Software License, Version 1.0. +* (See accompanying file LICENSE_1_0.txt or copy at +* http://www.boost.org/LICENSE_1_0.txt) +* +* @file: nana/gui/dragger.hpp +*/ + #ifndef NANA_GUI_DRAGGER_HPP #define NANA_GUI_DRAGGER_HPP -#include "programming_interface.hpp" +#include "basis.hpp" +#include "../basic_types.hpp" +#include "../traits.hpp" namespace nana { @@ -18,6 +32,10 @@ namespace nana public: dragger(); ~dragger(); + + dragger(dragger&&); + dragger& operator=(dragger&&); + void target(window); void target(window, const rectangle& restrict_area, nana::arrange); void remove_target(window); diff --git a/source/gui/dragger.cpp b/source/gui/dragger.cpp index 8b865891..43a56ba2 100644 --- a/source/gui/dragger.cpp +++ b/source/gui/dragger.cpp @@ -1,5 +1,17 @@ +/* +* A Dragger Implementation +* Nana C++ Library(http://www.nanapro.org) +* Copyright(C) 2003-2016 Jinhao(cnjinhao@hotmail.com) +* +* Distributed under the Boost Software License, Version 1.0. +* (See accompanying file LICENSE_1_0.txt or copy at +* http://www.boost.org/LICENSE_1_0.txt) +* +* @file: nana/gui/dragger.cpp +*/ #include +#include namespace nana { @@ -180,6 +192,23 @@ namespace nana delete impl_; } + dragger::dragger(dragger&& other) + : impl_(other.impl_) + { + other.impl_ = nullptr; + } + + dragger& dragger::operator=(dragger&& other) + { + if (this != &other) + { + delete impl_; + impl_ = other.impl_; + other.impl_ = nullptr; + } + return *this; + } + void dragger::target(window wd) { impl_->drag_target(wd, rectangle(), nana::arrange::horizontal_vertical);