Merge branch 'hotfix-1.5.6' into develop
This commit is contained in:
commit
2cf374705f
@ -68,6 +68,10 @@ namespace nana{
|
|||||||
group& div(const char* div_str) noexcept;
|
group& div(const char* div_str) noexcept;
|
||||||
field_reference operator[](const char* field);
|
field_reference operator[](const char* field);
|
||||||
|
|
||||||
|
void field_display(const char* field_name, bool display); ///<Displays/Discards an existing field.
|
||||||
|
bool field_display(const char* field_name) const; ///<Determines whether the specified field is displayed.
|
||||||
|
void erase(window handle); ///< Erases a window from field.
|
||||||
|
|
||||||
template<typename Widget, typename ...Args>
|
template<typename Widget, typename ...Args>
|
||||||
Widget* create_child(const char* field, Args && ... args)
|
Widget* create_child(const char* field, Args && ... args)
|
||||||
{
|
{
|
||||||
|
|||||||
@ -1429,6 +1429,8 @@ the nana::detail::basic_window member pointer scheme
|
|||||||
size_type append_header(std::string text_utf8, unsigned width = 120);
|
size_type append_header(std::string text_utf8, unsigned width = 120);
|
||||||
size_type append_header(std::wstring text, unsigned width = 120);
|
size_type append_header(std::wstring text, unsigned width = 120);
|
||||||
|
|
||||||
|
void clear_headers(); ///< Removes all the columns.
|
||||||
|
|
||||||
cat_proxy append(std::string category); ///< Appends a new category to the end
|
cat_proxy append(std::string category); ///< Appends a new category to the end
|
||||||
cat_proxy append(std::wstring category); ///< Appends a new category to the end
|
cat_proxy append(std::wstring category); ///< Appends a new category to the end
|
||||||
void append(std::initializer_list<std::string> categories); ///< Appends categories to the end
|
void append(std::initializer_list<std::string> categories); ///< Appends categories to the end
|
||||||
|
|||||||
@ -95,6 +95,7 @@ namespace nana
|
|||||||
menu& push_back(const std::string&); ///< Appends a new (empty) menu.
|
menu& push_back(const std::string&); ///< Appends a new (empty) menu.
|
||||||
menu& at(size_t index) const; ///< Gets the menu specified by index.
|
menu& at(size_t index) const; ///< Gets the menu specified by index.
|
||||||
std::size_t length() const; ///< Number of menus.
|
std::size_t length() const; ///< Number of menus.
|
||||||
|
void clear(); ///< Removes all the menus.
|
||||||
|
|
||||||
/// Deselects the menu
|
/// Deselects the menu
|
||||||
/**
|
/**
|
||||||
|
|||||||
@ -1,7 +1,7 @@
|
|||||||
/**
|
/**
|
||||||
* A Toolbar Implementation
|
* A Toolbar Implementation
|
||||||
* Nana C++ Library(http://www.nanapro.org)
|
* Nana C++ Library(http://www.nanapro.org)
|
||||||
* Copyright(C) 2003-2016 Jinhao(cnjinhao@hotmail.com)
|
* Copyright(C) 2003-2018 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
|
||||||
@ -98,6 +98,8 @@ namespace nana
|
|||||||
void separate(); ///< Adds a separator.
|
void separate(); ///< Adds a separator.
|
||||||
drawerbase::toolbar::item_proxy append(const ::std::string& text, const nana::paint::image& img); ///< Adds a control button.
|
drawerbase::toolbar::item_proxy append(const ::std::string& text, const nana::paint::image& img); ///< Adds a control button.
|
||||||
drawerbase::toolbar::item_proxy append(const ::std::string& text); ///< Adds a control button.
|
drawerbase::toolbar::item_proxy append(const ::std::string& text); ///< Adds a control button.
|
||||||
|
void clear(); ///< Removes all control buttons and separators.
|
||||||
|
|
||||||
bool enable(size_type index) const;
|
bool enable(size_type index) const;
|
||||||
void enable(size_type index, bool enable_state);
|
void enable(size_type index, bool enable_state);
|
||||||
void scale(unsigned s); ///< Sets the scale of control button.
|
void scale(unsigned s); ///< Sets the scale of control button.
|
||||||
|
|||||||
@ -3271,6 +3271,22 @@ namespace nana
|
|||||||
|
|
||||||
modified_ptr->div_owner = div_owner;
|
modified_ptr->div_owner = div_owner;
|
||||||
modified_ptr->div_next = div_next;
|
modified_ptr->div_next = div_next;
|
||||||
|
|
||||||
|
if (div_owner)
|
||||||
|
{
|
||||||
|
implement::division * pv_div = nullptr;
|
||||||
|
//Updates the div_next of the div at front of modified one.
|
||||||
|
for (auto & div : div_owner->children)
|
||||||
|
{
|
||||||
|
if (div.get() == modified_ptr)
|
||||||
|
{
|
||||||
|
if (pv_div)
|
||||||
|
pv_div->div_next = modified_ptr;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
pv_div = div.get();
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
catch (...)
|
catch (...)
|
||||||
{
|
{
|
||||||
|
|||||||
@ -194,6 +194,21 @@ namespace nana{
|
|||||||
return impl_->place_content.field(field);
|
return impl_->place_content.field(field);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void group::field_display(const char* field_name, bool display)
|
||||||
|
{
|
||||||
|
impl_->place_content.field_display(field_name, display);
|
||||||
|
}
|
||||||
|
|
||||||
|
bool group::field_display(const char* field_name) const
|
||||||
|
{
|
||||||
|
return impl_->place_content.field_display(field_name);
|
||||||
|
}
|
||||||
|
|
||||||
|
void group::erase(window handle)
|
||||||
|
{
|
||||||
|
impl_->place_content.erase(handle);
|
||||||
|
}
|
||||||
|
|
||||||
void group::_m_add_child(const char* field, widget* wdg)
|
void group::_m_add_child(const char* field, widget* wdg)
|
||||||
{
|
{
|
||||||
impl_->place_content[field] << wdg->handle();
|
impl_->place_content[field] << wdg->handle();
|
||||||
|
|||||||
@ -316,6 +316,11 @@ namespace nana
|
|||||||
return cont_.back().index;
|
return cont_.back().index;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void clear()
|
||||||
|
{
|
||||||
|
cont_.clear();
|
||||||
|
}
|
||||||
|
|
||||||
unsigned width_px() const noexcept ///< the visible width of the whole header
|
unsigned width_px() const noexcept ///< the visible width of the whole header
|
||||||
{
|
{
|
||||||
unsigned pixels = 0;
|
unsigned pixels = 0;
|
||||||
@ -1538,9 +1543,37 @@ namespace nana
|
|||||||
return n;
|
return n;
|
||||||
}
|
}
|
||||||
|
|
||||||
template<typename Pred>
|
/// Finds a good item or category if an item specified by pos is invaild
|
||||||
std::vector<std::pair<index_pair, bool>> select_display_range_if(const index_pair& fr_abs, index_pair to_dpl, bool deselect_others, Pred pred)
|
index_pair find_next_good(index_pair pos, bool ignore_category) const noexcept
|
||||||
{
|
{
|
||||||
|
//Return the pos if it is good
|
||||||
|
if (this->good(pos))
|
||||||
|
return pos;
|
||||||
|
|
||||||
|
while(pos.cat < this->categories_.size())
|
||||||
|
{
|
||||||
|
if ((pos.npos == pos.item) && !ignore_category)
|
||||||
|
return pos;
|
||||||
|
|
||||||
|
auto cat_item_size = this->get(pos.cat)->items.size();
|
||||||
|
|
||||||
|
if (pos.item < cat_item_size)
|
||||||
|
return pos;
|
||||||
|
|
||||||
|
if ((pos.npos == pos.item) && (cat_item_size > 0) && ignore_category)
|
||||||
|
return index_pair{ pos.cat, 0 };
|
||||||
|
|
||||||
|
++pos.cat;
|
||||||
|
pos.item = pos.npos;
|
||||||
|
}
|
||||||
|
return index_pair{};
|
||||||
|
}
|
||||||
|
|
||||||
|
template<typename Pred>
|
||||||
|
std::vector<std::pair<index_pair, bool>> select_display_range_if(index_pair fr_abs, index_pair to_dpl, bool deselect_others, Pred pred)
|
||||||
|
{
|
||||||
|
fr_abs = find_next_good(fr_abs, true);
|
||||||
|
|
||||||
if (to_dpl.empty())
|
if (to_dpl.empty())
|
||||||
{
|
{
|
||||||
if (fr_abs.empty())
|
if (fr_abs.empty())
|
||||||
@ -1549,6 +1582,7 @@ namespace nana
|
|||||||
to_dpl = this->last();
|
to_dpl = this->last();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
auto fr_dpl = (fr_abs.is_category() ? fr_abs : this->index_cast(fr_abs, false)); //Converts an absolute position to display position
|
auto fr_dpl = (fr_abs.is_category() ? fr_abs : this->index_cast(fr_abs, false)); //Converts an absolute position to display position
|
||||||
if (fr_dpl > to_dpl)
|
if (fr_dpl > to_dpl)
|
||||||
std::swap(fr_dpl, to_dpl);
|
std::swap(fr_dpl, to_dpl);
|
||||||
@ -5467,6 +5501,15 @@ namespace nana
|
|||||||
return pos;
|
return pos;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void listbox::clear_headers()
|
||||||
|
{
|
||||||
|
internal_scope_guard lock;
|
||||||
|
auto & ess = _m_ess();
|
||||||
|
ess.lister.erase();
|
||||||
|
ess.header.clear();
|
||||||
|
ess.update();
|
||||||
|
}
|
||||||
|
|
||||||
listbox::cat_proxy listbox::append(std::string s)
|
listbox::cat_proxy listbox::append(std::string s)
|
||||||
{
|
{
|
||||||
internal_scope_guard lock;
|
internal_scope_guard lock;
|
||||||
|
|||||||
@ -626,6 +626,13 @@ namespace nana
|
|||||||
return get_drawer_trigger().ess().items.size();
|
return get_drawer_trigger().ess().items.size();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void menubar::clear()
|
||||||
|
{
|
||||||
|
internal_scope_guard lock;
|
||||||
|
get_drawer_trigger().ess().items.clear();
|
||||||
|
API::refresh_window(handle());
|
||||||
|
}
|
||||||
|
|
||||||
bool menubar::cancel()
|
bool menubar::cancel()
|
||||||
{
|
{
|
||||||
return get_drawer_trigger().ess().cancel();
|
return get_drawer_trigger().ess().cancel();
|
||||||
|
|||||||
@ -1,7 +1,7 @@
|
|||||||
/*
|
/*
|
||||||
* A Toolbar Implementation
|
* A Toolbar Implementation
|
||||||
* Nana C++ Library(http://www.nanapro.org)
|
* Nana C++ Library(http://www.nanapro.org)
|
||||||
* Copyright(C) 2003-2017 Jinhao(cnjinhao@hotmail.com)
|
* Copyright(C) 2003-2018 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
|
||||||
@ -55,8 +55,7 @@ namespace nana
|
|||||||
|
|
||||||
~item_container()
|
~item_container()
|
||||||
{
|
{
|
||||||
for(auto ptr : cont_)
|
clear();
|
||||||
delete ptr;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void insert(size_type pos, std::string text, const nana::paint::image& img, item_type::kind type)
|
void insert(size_type pos, std::string text, const nana::paint::image& img, item_type::kind type)
|
||||||
@ -118,6 +117,15 @@ namespace nana
|
|||||||
{
|
{
|
||||||
return cont_.at(pos);
|
return cont_.at(pos);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void clear()
|
||||||
|
{
|
||||||
|
for(auto ptr : cont_)
|
||||||
|
delete ptr;
|
||||||
|
|
||||||
|
cont_.clear();
|
||||||
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
container_type cont_;
|
container_type cont_;
|
||||||
size_t right_{ npos };
|
size_t right_{ npos };
|
||||||
@ -467,6 +475,12 @@ namespace nana
|
|||||||
return {*this, get_drawer_trigger().items().size() - 1u};
|
return {*this, get_drawer_trigger().items().size() - 1u};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void toolbar::clear()
|
||||||
|
{
|
||||||
|
get_drawer_trigger().items().clear();
|
||||||
|
API::refresh_window(this->handle());
|
||||||
|
}
|
||||||
|
|
||||||
bool toolbar::enable(size_type pos) const
|
bool toolbar::enable(size_type pos) const
|
||||||
{
|
{
|
||||||
auto & items = get_drawer_trigger().items();
|
auto & items = get_drawer_trigger().items();
|
||||||
|
|||||||
@ -1,7 +1,7 @@
|
|||||||
/*
|
/*
|
||||||
* A Treebox Implementation
|
* A Treebox Implementation
|
||||||
* Nana C++ Library(http://www.nanapro.org)
|
* Nana C++ Library(http://www.nanapro.org)
|
||||||
* Copyright(C) 2003-2017 Jinhao(cnjinhao@hotmail.com)
|
* Copyright(C) 2003-2018 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
|
||||||
@ -958,10 +958,14 @@ namespace nana
|
|||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
std::size_t item_proxy::size() const
|
std::size_t item_proxy::size() const
|
||||||
{
|
{
|
||||||
std::size_t n = 0;
|
std::size_t n = 0;
|
||||||
for(auto child = node_->child; child; child = child->child)
|
|
||||||
|
//Fixed by ErrorFlynn
|
||||||
|
//this method incorrectly returned the number of levels beneath the nodes using child = child->child
|
||||||
|
for(auto child = node_->child; child; child = child->next)
|
||||||
++n;
|
++n;
|
||||||
|
|
||||||
return n;
|
return n;
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user