add move-constructor and move-assignment for class dragger

This commit is contained in:
Jinhao 2016-01-06 04:25:48 +08:00
parent 70ecce5962
commit 57303d302c
2 changed files with 48 additions and 1 deletions

View File

@ -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);

View File

@ -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 <nana/gui/dragger.hpp>
#include <nana/gui/programming_interface.hpp>
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);