add header_width() methods for getting/setting header width.
This commit is contained in:
parent
e84b5ff78a
commit
6ba23bb6c3
@ -474,6 +474,8 @@ By \a clicking on a header the list get \a reordered, first up, and then down al
|
||||
void auto_draw(bool); ///<Set state: Redraw automatically after an operation?
|
||||
|
||||
void append_header(nana::string, unsigned width = 120);///<Appends a new column with a header text and the specified width at the end
|
||||
listbox& header_width(size_type pos, unsigned pixels);
|
||||
unsigned header_width(size_type pos) const;
|
||||
|
||||
cat_proxy append(nana::string); ///<Appends a new category at the end
|
||||
void append(std::initializer_list<nana::string>); ///<Appends categories at the end
|
||||
|
||||
@ -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;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user