|
|
|
|
@@ -79,15 +79,6 @@ namespace nana
|
|
|
|
|
}
|
|
|
|
|
//end struct cell
|
|
|
|
|
|
|
|
|
|
//A workaround, MinGW does not yet provide std::to_wstring
|
|
|
|
|
template<typename Int>
|
|
|
|
|
std::wstring to_wstring(Int n)
|
|
|
|
|
{
|
|
|
|
|
std::wstringstream ss;
|
|
|
|
|
ss << n;
|
|
|
|
|
return ss.str();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//definition of iresolver/oresolver
|
|
|
|
|
oresolver& oresolver::operator<<(bool n)
|
|
|
|
|
{
|
|
|
|
|
@@ -96,77 +87,66 @@ namespace nana
|
|
|
|
|
}
|
|
|
|
|
oresolver& oresolver::operator<<(short n)
|
|
|
|
|
{
|
|
|
|
|
//A workaround, MinGW does not yet provide std::to_wstring
|
|
|
|
|
cells_.emplace_back(to_wstring(n));
|
|
|
|
|
cells_.emplace_back(::nana::to_wstring(n));
|
|
|
|
|
return *this;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
oresolver& oresolver::operator<<(unsigned short n)
|
|
|
|
|
{
|
|
|
|
|
//A workaround, MinGW does not yet provide std::to_wstring
|
|
|
|
|
cells_.emplace_back(to_wstring(n));
|
|
|
|
|
cells_.emplace_back(::nana::to_wstring(n));
|
|
|
|
|
return *this;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
oresolver& oresolver::operator<<(int n)
|
|
|
|
|
{
|
|
|
|
|
//A workaround, MinGW does not yet provide std::to_wstring
|
|
|
|
|
cells_.emplace_back(to_wstring(n));
|
|
|
|
|
cells_.emplace_back(::nana::to_wstring(n));
|
|
|
|
|
return *this;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
oresolver& oresolver::operator<<(unsigned int n)
|
|
|
|
|
{
|
|
|
|
|
//A workaround, MinGW does not yet provide std::to_wstring
|
|
|
|
|
cells_.emplace_back(to_wstring(n));
|
|
|
|
|
cells_.emplace_back(::nana::to_wstring(n));
|
|
|
|
|
return *this;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
oresolver& oresolver::operator<<(long n)
|
|
|
|
|
{
|
|
|
|
|
//A workaround, MinGW does not yet provide std::to_wstring
|
|
|
|
|
cells_.emplace_back(to_wstring(n));
|
|
|
|
|
cells_.emplace_back(::nana::to_wstring(n));
|
|
|
|
|
return *this;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
oresolver& oresolver::operator<<(unsigned long n)
|
|
|
|
|
{
|
|
|
|
|
//A workaround, MinGW does not yet provide std::to_wstring
|
|
|
|
|
cells_.emplace_back(to_wstring(n));
|
|
|
|
|
cells_.emplace_back(::nana::to_wstring(n));
|
|
|
|
|
return *this;
|
|
|
|
|
}
|
|
|
|
|
oresolver& oresolver::operator<<(long long n)
|
|
|
|
|
{
|
|
|
|
|
//A workaround, MinGW does not yet provide std::to_wstring
|
|
|
|
|
cells_.emplace_back(to_wstring(n));
|
|
|
|
|
cells_.emplace_back(::nana::to_wstring(n));
|
|
|
|
|
return *this;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
oresolver& oresolver::operator<<(unsigned long long n)
|
|
|
|
|
{
|
|
|
|
|
//A workaround, MinGW does not yet provide std::to_wstring
|
|
|
|
|
cells_.emplace_back(to_wstring(n));
|
|
|
|
|
cells_.emplace_back(::nana::to_wstring(n));
|
|
|
|
|
return *this;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
oresolver& oresolver::operator<<(float f)
|
|
|
|
|
{
|
|
|
|
|
//A workaround, MinGW does not yet provide std::to_wstring
|
|
|
|
|
cells_.emplace_back(to_wstring(f));
|
|
|
|
|
cells_.emplace_back(::nana::to_wstring(f));
|
|
|
|
|
return *this;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
oresolver& oresolver::operator<<(double f)
|
|
|
|
|
{
|
|
|
|
|
//A workaround, MinGW does not yet provide std::to_wstring
|
|
|
|
|
cells_.emplace_back(to_wstring(f));
|
|
|
|
|
cells_.emplace_back(::nana::to_wstring(f));
|
|
|
|
|
return *this;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
oresolver& oresolver::operator<<(long double f)
|
|
|
|
|
{
|
|
|
|
|
//A workaround, MinGW does not yet provide std::to_wstring
|
|
|
|
|
cells_.emplace_back(to_wstring(f));
|
|
|
|
|
cells_.emplace_back(::nana::to_wstring(f));
|
|
|
|
|
return *this;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@@ -2373,7 +2353,7 @@ namespace nana
|
|
|
|
|
if(x < essence_->scroll.offset_x)
|
|
|
|
|
x = essence_->scroll.offset_x;
|
|
|
|
|
else if(x > essence_->scroll.offset_x + static_cast<int>(rect.width))
|
|
|
|
|
x = essence_->scroll.offset_x + rect.width;
|
|
|
|
|
x = essence_->scroll.offset_x + static_cast<int>(rect.width);
|
|
|
|
|
|
|
|
|
|
size_type i = essence_->header.item_by_x(x);
|
|
|
|
|
if(i == npos)
|
|
|
|
|
@@ -2537,6 +2517,8 @@ namespace nana
|
|
|
|
|
auto idx = essence_->scroll.offset_y;
|
|
|
|
|
|
|
|
|
|
auto state = item_state::normal;
|
|
|
|
|
|
|
|
|
|
const bool sort_enabled = (essence_->lister.sort_index() != npos);
|
|
|
|
|
//Here draws a root categ or a first drawing is not a categ.
|
|
|
|
|
if(idx.cat == 0 || !idx.is_category())
|
|
|
|
|
{
|
|
|
|
|
@@ -2546,30 +2528,16 @@ namespace nana
|
|
|
|
|
idx.item = 0;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//Test whether the sort is enabled.
|
|
|
|
|
if(essence_->lister.sort_index() != npos)
|
|
|
|
|
std::size_t size = i_categ->items.size();
|
|
|
|
|
for(std::size_t offs = essence_->scroll.offset_y.item; offs < size; ++offs, ++idx.item)
|
|
|
|
|
{
|
|
|
|
|
std::size_t size = i_categ->items.size();
|
|
|
|
|
for(std::size_t offs = essence_->scroll.offset_y.item; offs < size; ++offs, ++idx.item)
|
|
|
|
|
{
|
|
|
|
|
if(n-- == 0) break;
|
|
|
|
|
state = (tracker == idx ? item_state::highlighted : item_state::normal);
|
|
|
|
|
if(n-- == 0) break;
|
|
|
|
|
state = (tracker == idx ? item_state::highlighted : item_state::normal);
|
|
|
|
|
|
|
|
|
|
_m_draw_item(i_categ->items[lister.absolute(index_pair(idx.cat, offs))], x, y, txtoff, header_w, rect, subitems, bgcolor,fgcolor, state);
|
|
|
|
|
y += essence_->item_size;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
for(auto i = i_categ->items.cbegin() + essence_->scroll.offset_y.item; i != i_categ->items.cend(); ++i, ++idx.item)
|
|
|
|
|
{
|
|
|
|
|
if(n-- == 0) break;
|
|
|
|
|
state = (tracker == idx ? item_state::highlighted : item_state::normal);
|
|
|
|
|
|
|
|
|
|
_m_draw_item(*i, x, y, txtoff, header_w, rect, subitems, bgcolor, fgcolor, state);
|
|
|
|
|
y += essence_->item_size;
|
|
|
|
|
}
|
|
|
|
|
_m_draw_item(i_categ->items[sort_enabled ? lister.absolute(index_pair(idx.cat, offs)) : offs], x, y, txtoff, header_w, rect, subitems, bgcolor,fgcolor, state);
|
|
|
|
|
y += essence_->item_size;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
++i_categ;
|
|
|
|
|
++idx.cat;
|
|
|
|
|
}
|
|
|
|
|
@@ -2584,35 +2552,18 @@ namespace nana
|
|
|
|
|
_m_draw_categ(*i_categ, rect.x - essence_->scroll.offset_x, y, txtoff, header_w, rect, bgcolor, state);
|
|
|
|
|
y += essence_->item_size;
|
|
|
|
|
|
|
|
|
|
if(false == i_categ->expand) continue;
|
|
|
|
|
if(false == i_categ->expand)
|
|
|
|
|
continue;
|
|
|
|
|
|
|
|
|
|
//Test whether the sort is enabled.
|
|
|
|
|
if(essence_->lister.sort_index() != npos)
|
|
|
|
|
auto size = i_categ->items.size();
|
|
|
|
|
for(decltype(size) pos = 0; pos < size; ++pos)
|
|
|
|
|
{
|
|
|
|
|
auto size = i_categ->items.size();
|
|
|
|
|
for(decltype(size) pos = 0; pos < size; ++pos)
|
|
|
|
|
{
|
|
|
|
|
if(n-- == 0) break;
|
|
|
|
|
state = (idx == tracker ? item_state::highlighted : item_state::normal);
|
|
|
|
|
if(n-- == 0) break;
|
|
|
|
|
state = (idx == tracker ? item_state::highlighted : item_state::normal);
|
|
|
|
|
|
|
|
|
|
_m_draw_item(i_categ->items[lister.absolute(index_pair(idx.cat, pos))], x, y, txtoff, header_w, rect, subitems, bgcolor, fgcolor, state);
|
|
|
|
|
y += essence_->item_size;
|
|
|
|
|
++idx.item;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
for(auto & m : i_categ->items)
|
|
|
|
|
{
|
|
|
|
|
if(n-- == 0) break;
|
|
|
|
|
|
|
|
|
|
state = (idx == tracker ? item_state::highlighted : item_state::normal);
|
|
|
|
|
|
|
|
|
|
_m_draw_item(m, x, y, txtoff, header_w, rect, subitems, bgcolor, fgcolor, state);
|
|
|
|
|
y += essence_->item_size;
|
|
|
|
|
|
|
|
|
|
++idx.item;
|
|
|
|
|
}
|
|
|
|
|
_m_draw_item(i_categ->items[sort_enabled ? lister.absolute(index_pair(idx.cat, pos)) : pos], x, y, txtoff, header_w, rect, subitems, bgcolor, fgcolor, state);
|
|
|
|
|
y += essence_->item_size;
|
|
|
|
|
++idx.item;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@@ -2627,25 +2578,24 @@ namespace nana
|
|
|
|
|
{
|
|
|
|
|
bool sel = categ.selected();
|
|
|
|
|
if(sel && (categ.expand == false))
|
|
|
|
|
bgcolor = nana::color(0xD5, 0xEF, 0xFC);
|
|
|
|
|
bgcolor = static_cast<color_rgb>(0xD5EFFC);
|
|
|
|
|
|
|
|
|
|
if (state == item_state::highlighted)
|
|
|
|
|
bgcolor = bgcolor.blend(::nana::color(0x99, 0xde, 0xfd), 0.8);
|
|
|
|
|
bgcolor = bgcolor.blend(static_cast<color_rgb>(0x99defd), 0.8);
|
|
|
|
|
|
|
|
|
|
auto graph = essence_->graph;
|
|
|
|
|
graph->set_color(bgcolor);
|
|
|
|
|
graph->rectangle(rectangle{ x, y, width, essence_->item_size }, true);
|
|
|
|
|
graph->rectangle(rectangle{ x, y, width, essence_->item_size }, true, bgcolor);
|
|
|
|
|
|
|
|
|
|
color txt_color{ static_cast<color_rgb>(0x3399) };
|
|
|
|
|
|
|
|
|
|
facade<element::arrow> arrow("double");
|
|
|
|
|
arrow.direction(categ.expand ? ::nana::direction::north : ::nana::direction::south);
|
|
|
|
|
::nana::rectangle arrow_r{ x + 5, y + static_cast<int>(essence_->item_size - 16) / 2, 16, 16 };
|
|
|
|
|
arrow.draw(*graph, {}, static_cast<color_rgb>(0x3399), arrow_r, element_state::normal);
|
|
|
|
|
arrow.draw(*graph, {}, txt_color, arrow_r, element_state::normal);
|
|
|
|
|
|
|
|
|
|
graph->string({ x + 20, y + txtoff }, categ.text, {0, 0x33, 0x99});
|
|
|
|
|
graph->string({ x + 20, y + txtoff }, categ.text, txt_color);
|
|
|
|
|
|
|
|
|
|
std::stringstream ss;
|
|
|
|
|
ss<<'('<<static_cast<unsigned>(categ.items.size())<<')';
|
|
|
|
|
nana::string str = nana::charset(ss.str());
|
|
|
|
|
::nana::string str = L'(' + ::nana::to_wstring(categ.items.size()) + L')';
|
|
|
|
|
|
|
|
|
|
unsigned str_w = graph->text_extent_size(str).width;
|
|
|
|
|
|
|
|
|
|
@@ -2655,7 +2605,7 @@ namespace nana
|
|
|
|
|
if (x + 35 + text_s.width + str_w < x + width)
|
|
|
|
|
{
|
|
|
|
|
::nana::point pos{ x + 30 + static_cast<int>(text_s.width + str_w), y + static_cast<int>(essence_->item_size) / 2 };
|
|
|
|
|
graph->line(pos, { x + static_cast<int>(width)-5, pos.y }, { 0x0, 0x33, 0x99 });
|
|
|
|
|
graph->line(pos, { x + static_cast<int>(width)-5, pos.y }, txt_color);
|
|
|
|
|
}
|
|
|
|
|
//Draw selecting inner rectangle
|
|
|
|
|
if(sel && categ.expand == false)
|
|
|
|
|
@@ -2845,7 +2795,7 @@ namespace nana
|
|
|
|
|
auto & graph = *essence_->graph;
|
|
|
|
|
auto size = graph.size();
|
|
|
|
|
//Draw Border
|
|
|
|
|
graph.rectangle(false, {0x9c, 0xb6, 0xc5});
|
|
|
|
|
graph.rectangle(false, static_cast<color_rgb>(0x9cb6c5));
|
|
|
|
|
graph.line({ 1, 1 }, {1, static_cast<int>(size.height) - 2}, colors::white);
|
|
|
|
|
graph.line({ static_cast<int>(size.width) - 2, 1 }, { static_cast<int>(size.width) - 2, static_cast<int>(size.height) - 2 });
|
|
|
|
|
|
|
|
|
|
|