new feature "fit_width_to_header caption text" for a new header with width=0
(cherry picked from commit 23efa5088d742a48e7ad07f273e84bcf50c2d979)
This commit is contained in:
parent
a1b97e48b5
commit
74f42f1778
@ -184,7 +184,13 @@ namespace nana
|
|||||||
index(pos),
|
index(pos),
|
||||||
ess_(ess)
|
ess_(ess)
|
||||||
{
|
{
|
||||||
|
if (px == 0)
|
||||||
|
{
|
||||||
|
fit_width_to_header();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void fit_width_to_header();
|
||||||
private:
|
private:
|
||||||
/// The definition is provided after essence
|
/// The definition is provided after essence
|
||||||
void _m_refresh() noexcept;
|
void _m_refresh() noexcept;
|
||||||
@ -2881,6 +2887,23 @@ namespace nana
|
|||||||
return max_px;
|
return max_px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void es_header::column::fit_width_to_header()
|
||||||
|
{
|
||||||
|
std::cout<< "Column: " << to_utf8(caption) ;
|
||||||
|
std::unique_ptr<paint::graphics> graph_helper;
|
||||||
|
auto graph = ess_->graph;
|
||||||
|
if (graph->empty())
|
||||||
|
{
|
||||||
|
//Creates a helper if widget graph is empty(when its size is 0).
|
||||||
|
graph_helper.reset(new paint::graphics{ nana::size{ 5, 5 } });
|
||||||
|
graph_helper->typeface(ess_->graph->typeface());
|
||||||
|
graph = graph_helper.get();
|
||||||
|
}
|
||||||
|
width_px = ess_->scheme_ptr->text_margin * 2; //margin at left/right end.
|
||||||
|
|
||||||
|
width_px += graph->text_extent_size(caption).width;
|
||||||
|
}
|
||||||
|
|
||||||
//es_header::column member functions
|
//es_header::column member functions
|
||||||
void es_header::column::_m_refresh() noexcept
|
void es_header::column::_m_refresh() noexcept
|
||||||
{
|
{
|
||||||
|
Loading…
x
Reference in New Issue
Block a user