Merge branch 'hotfix-1.3' into develop

This commit is contained in:
Jinhao
2016-07-19 23:50:11 +08:00
7 changed files with 144 additions and 90 deletions

View File

@@ -355,14 +355,12 @@ namespace nana
msgbox::msgbox(const std::string& title)
: wd_(nullptr), title_(title), button_(ok), icon_(icon_none)
{
// throw_not_utf8(title_);
review_utf8(title_);
}
msgbox::msgbox(window wd, const std::string& title, button_t b)
: wd_(wd), title_(title), button_(b), icon_(icon_none)
{
// throw_not_utf8(title_);
review_utf8(title_);
}
@@ -380,19 +378,35 @@ namespace nana
msgbox & msgbox::operator<<(const std::wstring& str)
{
sstream_ << to_osmbstr(to_utf8(str));
sstream_ << to_utf8(str);
return *this;
}
msgbox & msgbox::operator<<(const wchar_t* str)
{
sstream_ << to_osmbstr(to_utf8(str));
sstream_ << to_utf8(str);
return *this;
}
/// Writes a UTF-8 string to the buffer.
msgbox & msgbox::operator<<(const std::string& u8str)
{
review_utf8(u8str);
sstream_ << u8str;
return *this;
}
/// Writes a UTF-8 string to the buffer.
msgbox & msgbox::operator<<(const char* u8str)
{
return operator<<(std::string{ u8str });
}
msgbox & msgbox::operator<<(const nana::charset& cs)
{
std::string str = cs;
std::string str = cs.to_bytes(nana::unicode::utf8);
sstream_ << str;
return *this;
}
@@ -454,7 +468,7 @@ namespace nana
return pick_yes;
#elif defined(NANA_X11)
msgbox_window box(wd_, title_, button_, icon_);
box.prompt(nana::charset(sstream_.str()));
box.prompt(sstream_.str());
return box.pick();
#endif
return pick_yes;

View File

@@ -585,9 +585,17 @@ namespace nana
{
if(pos < list_.size() && (pos != basis_.active))
{
API::show_window(iterator_at(pos)->relative, true);
if(basis_.active < list_.size())
API::show_window(iterator_at(basis_.active)->relative, false);
auto & tab_act = *iterator_at(pos);
API::show_window(tab_act.relative, true);
if (basis_.active < list_.size())
{
auto & tab_deact = *iterator_at(basis_.active);
//Don't hide the relative window if it is equal to active relative window.
//The tabbar allows a window to be attached to multiple tabs(pass false to DropOther of attach method)
if (tab_deact.relative != tab_act.relative)
API::show_window(tab_deact.relative, false);
}
basis_.active = pos;
track();
@@ -603,13 +611,27 @@ namespace nana
return basis_.active;
}
void attach(std::size_t pos, window wd)
window attach(std::size_t pos, window wd, bool drop_other)
{
if (pos >= list_.size())
throw std::out_of_range("tabbar: invalid position");
iterator_at(pos)->relative = wd;
auto & tab = *iterator_at(pos);
auto old = tab.relative;
if (drop_other)
{
//Drop the relative windows which are equal to wd.
for (auto & t : list_)
{
if (wd == t.relative)
t.relative = nullptr;
}
}
tab.relative = wd;
API::show_window(wd, basis_.active == pos);
return old;
}
bool tab_color(std::size_t pos, bool is_bgcolor, const ::nana::color& clr)
@@ -1181,9 +1203,9 @@ namespace nana
return layouter_->toolbox_object().close_fly(fly);
}
void trigger::attach(std::size_t pos, window wd)
window trigger::attach(std::size_t pos, window wd, bool drop_other)
{
layouter_->attach(pos, wd);
return layouter_->attach(pos, wd, drop_other);
}
void trigger::erase(std::size_t pos)