to retrieve a modifiable object from a list item

This commit is contained in:
qPCR4vir
2016-03-18 16:50:44 +01:00
parent 6b6b527007
commit a580237e05
4 changed files with 19 additions and 8 deletions

View File

@@ -1,15 +1,15 @@
/*
/**
* Selector of Platform Specification
* Nana C++ Library(http://www.nanapro.org)
* Copyright(C) 2003-2015 Jinhao(cnjinhao@hotmail.com)
* 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/detail/platform_spec_selector.hpp
* @file nana/detail/platform_spec_selector.hpp
*
* Selects the proper platform_spec header file for the current platform
* @brief Selects the proper platform_spec header file for the current platform
*/
#include <nana/config.hpp>

View File

@@ -536,7 +536,7 @@ namespace nana
struct arg_click : public event_arg
{
::nana::window window_handle; ///< A handle to the event window
const arg_mouse* mouse_args; ///< If it is not null, it refers to the mouse arguments for click event emitted by mouse, nullptr otherwise.
const arg_mouse* mouse_args{}; ///< If it is not null, it refers to the mouse arguments for click event emitted by mouse, nullptr otherwise.
};
/// provides some fundamental events that every widget owns.

View File

@@ -295,7 +295,18 @@ namespace nana
throw std::runtime_error("listbox::item_proxy.value<T>() invalid type of value");
return *p;
}
template<typename T>
T & value()
{
auto * pany = _m_value();
if (nullptr == pany)
throw std::runtime_error("listbox::item_proxy.value<T>() is empty");
T * p = any_cast<T>(_m_value(false));
if (nullptr == p)
throw std::runtime_error("listbox::item_proxy.value<T>() invalid type of value");
return *p;
}
template<typename T>
item_proxy & value(T&& t)
{