small changes

This commit is contained in:
Jinhao 2018-10-01 11:47:33 +08:00
parent d925be809b
commit f09e9bcf43
2 changed files with 29 additions and 9 deletions

View File

@ -135,7 +135,7 @@ namespace nana
//node_type * selected() const; //deprecated
//void selected(node_type*);
node_image_tag& icon(const ::std::string&) const;
node_image_tag& icon(const ::std::string&);
void icon_erase(const ::std::string&);
void node_icon(node_type*, const ::std::string& id);
unsigned node_width(const node_type*) const;
@ -176,11 +176,11 @@ namespace nana
/// Append a child with a specified value (user object.).
template<typename T>
item_proxy append(const ::std::string& key, ::std::string name, const T&t)
item_proxy append(const ::std::string& key, ::std::string name, T&& t)
{
item_proxy ip = append(key, std::move(name));
if(false == ip.empty())
ip.value(t);
ip.value(std::forward<T>(t));
return ip;
}
@ -296,17 +296,19 @@ namespace nana
return *p;
}
/*
template<typename T>
item_proxy & value(const T& t)
item_proxy & value(const T& t) //deprecated
{
_m_value() = t;
return *this;
}
*/
template<typename T>
item_proxy & value(T&& t)
{
_m_value() = std::move(t);
_m_value() = std::forward<T>(t);
return *this;
}
@ -408,6 +410,23 @@ namespace nana
/// @param enable bool whether to enable.
void auto_draw(bool enable);
/// Prevents drawing during execution.
template<typename Function>
void avoid_drawing(Function fn)
{
this->auto_draw(false);
try
{
fn();
}
catch (...)
{
this->auto_draw(true);
throw;
}
this->auto_draw(true);
}
/// \brief Enable the checkboxs for each item of the widget.
/// @param enable bool indicates whether to show or hide the checkboxs.
treebox & checkable(bool enable);
@ -424,8 +443,9 @@ namespace nana
/// These states are 'normal', 'hovered' and 'expanded'.
/// If 'hovered' or 'expanded' are not set, it uses 'normal' state image for these 2 states.
/// See also in [documentation](http://nanapro.org/en-us/help/widgets/treebox.htm)
node_image_type& icon(const ::std::string& id ///< the name of an icon scheme. If the name is not existing, it creates a new scheme for the name.
) const;
/// @param id The name of an icon scheme. If the name is not existing, it creates a new scheme for the name.
/// @return The reference of node image scheme correspending with the specified id.
node_image_type& icon(const ::std::string& id);
void icon_erase(const ::std::string& id);

View File

@ -1877,7 +1877,7 @@ namespace nana
}
*/
node_image_tag& trigger::icon(const std::string& id) const
node_image_tag& trigger::icon(const std::string& id)
{
auto i = impl_->shape.image_table.find(id);
if(i != impl_->shape.image_table.end())
@ -2304,7 +2304,7 @@ namespace nana
impl->draw(true);
}
treebox::node_image_type& treebox::icon(const std::string& id) const
treebox::node_image_type& treebox::icon(const std::string& id)
{
return get_drawer_trigger().icon(id);
}