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 * Selector of Platform Specification
* Nana C++ Library(http://www.nanapro.org) * 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. * Distributed under the Boost Software License, Version 1.0.
* (See accompanying file LICENSE_1_0.txt or copy at * (See accompanying file LICENSE_1_0.txt or copy at
* http://www.boost.org/LICENSE_1_0.txt) * 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> #include <nana/config.hpp>

View File

@@ -536,7 +536,7 @@ namespace nana
struct arg_click : public event_arg struct arg_click : public event_arg
{ {
::nana::window window_handle; ///< A handle to the event window ::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. /// 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"); throw std::runtime_error("listbox::item_proxy.value<T>() invalid type of value");
return *p; 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> template<typename T>
item_proxy & value(T&& t) item_proxy & value(T&& t)
{ {

View File

@@ -1,7 +1,7 @@
/* /**
* Platform Specification Implementation * Platform Specification Implementation
* Nana C++ Library(http://www.nanapro.org) * 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. * Distributed under the Boost Software License, Version 1.0.
* (See accompanying file LICENSE_1_0.txt or copy at * (See accompanying file LICENSE_1_0.txt or copy at
@@ -9,7 +9,7 @@
* *
* @file: nana/detail/platform_spec.cpp * @file: nana/detail/platform_spec.cpp
* *
* This file provides basis class and data structrue that required by nana * @brief basis classes and data structrues required by nana
*/ */
#include <nana/detail/platform_spec_selector.hpp> #include <nana/detail/platform_spec_selector.hpp>