add header_width() methods for getting/setting header width.

This commit is contained in:
Jinhao
2015-04-12 23:28:48 +08:00
parent e84b5ff78a
commit 6ba23bb6c3
2 changed files with 28 additions and 3 deletions

View File

@@ -366,18 +366,28 @@ namespace nana
cont_.emplace_back(std::move(text), pixels, static_cast<size_type>(cont_.size()));
}
void item_width(size_type index, unsigned width)
void item_width(size_type pos, unsigned width)
{
if (index >= cont_.size())
if (pos >= cont_.size())
return;
for(auto & m : cont_)
{
if(m.index == index)
if(m.index == pos)
m.pixels = width;
}
}
unsigned item_width(size_type pos) const
{
for (auto & m : cont_)
{
if (m.index == pos)
return m.pixels;
}
return 0;
}
unsigned pixels() const
{
unsigned pixels = 0;
@@ -3602,6 +3612,19 @@ namespace nana
ess.update();
}
listbox& listbox::header_width(size_type pos, unsigned pixels)
{
auto & ess = _m_ess();
ess.header.item_width(pos, pixels);
ess.update();
return *this;
}
unsigned listbox::header_width(size_type pos) const
{
return _m_ess().header.item_width(pos);
}
listbox::cat_proxy listbox::append(nana::string s)
{
internal_scope_guard lock;