refine code
fix bug that listbox may throw std::runtime when the modal is enabled fix bug that textbox attachs a wrong event angent
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
/*
|
||||
* The Store for the Storage Of Elements
|
||||
* Nana C++ Library(http://www.nanapro.org)
|
||||
* Copyright(C) 2003-2014 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
|
||||
@@ -11,35 +11,53 @@
|
||||
*/
|
||||
#include <nana/gui/detail/element_store.hpp>
|
||||
|
||||
#include <map>
|
||||
|
||||
namespace nana
|
||||
{
|
||||
namespace detail
|
||||
{
|
||||
//class element_store
|
||||
element_store::data::data()
|
||||
: fast_ptr(nullptr)
|
||||
|
||||
struct element_store::data
|
||||
{
|
||||
cloneable_element entity;
|
||||
::nana::element::element_interface * fast_ptr{ nullptr };
|
||||
};
|
||||
|
||||
struct element_store::implementation
|
||||
{
|
||||
std::map<std::string, data> table;
|
||||
};
|
||||
|
||||
element_store::element_store()
|
||||
: impl_(new implementation)
|
||||
{}
|
||||
|
||||
//Empty destructor for instance of impl
|
||||
element_store::~element_store()
|
||||
{}
|
||||
|
||||
nana::element::element_interface * const * element_store::bground(const std::string& name)
|
||||
{
|
||||
element_interface * const * addr = &(bground_.table[name].fast_ptr);
|
||||
element_interface * const * addr = &(impl_->table[name].fast_ptr);
|
||||
return addr;
|
||||
}
|
||||
|
||||
void element_store::bground(const std::string& name, const pat::cloneable<element_interface>& rhs)
|
||||
{
|
||||
auto & store = bground_.table[name];
|
||||
auto & store = impl_->table[name];
|
||||
|
||||
store.object = rhs;
|
||||
store.fast_ptr = store.object.get();
|
||||
store.entity = rhs;
|
||||
store.fast_ptr = store.entity.get();
|
||||
}
|
||||
|
||||
void element_store::bground(const std::string& name, pat::cloneable<element_interface>&& rv)
|
||||
{
|
||||
auto & store = bground_.table[name];
|
||||
auto & store = impl_->table[name];
|
||||
|
||||
store.object = std::move(rv);
|
||||
store.fast_ptr = store.object.get();
|
||||
store.entity = std::move(rv);
|
||||
store.fast_ptr = store.entity.get();
|
||||
}
|
||||
}//end namespace detail
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user