Breaking changes for expr_color

expr_color is a temporary class name for new color type experiment.
This commit is contained in:
cnjinhao
2014-12-17 11:20:47 +08:00
parent 74c09eb9b3
commit 42788db077
58 changed files with 1135 additions and 824 deletions

View File

@@ -35,6 +35,11 @@ namespace nana
chdate_.year = chmonth_.year = d.read().year;
chdate_.month = chmonth_.month = d.read().month;
chdate_.day = d.read().day;
color_.selected = { 0x2F, 0x36, 0x99 };
color_.highlight = { 0x4D, 0x56, 0xC8 };
color_.normal = colors::black;
color_.bgcolor = { 0x88, 0xC4, 0xFF };
}
bool trigger::chose() const
@@ -58,14 +63,15 @@ namespace nana
if(0 <= index && index < 12)
this->monthstr_[index] = str;
}
void trigger::_m_init_color()
/*
void trigger::_m_init_color() //deprecated
{
color_.selected = 0x2F3699;
color_.highlight = 0x4D56C8;
color_.normal = 0x0;
color_.bkcolor = 0x88C4FF;
}
*/
trigger::where trigger::_m_pos_where(graph_reference graph, int x, int y)
{
@@ -93,12 +99,15 @@ namespace nana
void trigger::_m_draw(graph_reference graph)
{
_m_init_color();
//_m_init_color(); //deprecated
const unsigned width = graph.width() - 2;
graph.rectangle(0xB0B0B0, false);
graph.rectangle(1, 1, width, topbar_height, 0xFFFFFF, true);
//graph.rectangle(0xB0B0B0, false); //deprecated
//graph.rectangle(1, 1, width, topbar_height, 0xFFFFFF, true);
graph.rectangle(false, {0xb0, 0xb0, 0xb0});
graph.rectangle({ 1, 1, width, static_cast<unsigned>(topbar_height) }, true, colors::white);
_m_draw_topbar(graph);
@@ -107,7 +116,7 @@ namespace nana
nana::point refpos(1, static_cast<int>(topbar_height) + 1);
nana::paint::graphics gbuf(width, graph.height() - 2 - topbar_height);
gbuf.rectangle(0xF0F0F0, true);
gbuf.rectangle(true, {0xf0, 0xf0, 0xf0});
switch(page_)
{
@@ -128,7 +137,7 @@ namespace nana
{
int ypos = (topbar_height - 16) / 2 + 1;
const nana::color_t color = color_.normal;
const auto color = color_.normal;
nana::paint::gadget::arrow_16_pixels(graph, border_size, ypos, (pos_ == where::left_button ? color_.highlight : color), 1, nana::paint::gadget::directions::to_west);
nana::paint::gadget::arrow_16_pixels(graph, graph.width() - (border_size + 16 + 1), ypos, (pos_ == where::right_button ? color_.highlight : color), 1, nana::paint::gadget::directions::to_east);
@@ -147,12 +156,12 @@ namespace nana
nana::size txt_s = graph.text_extent_size(str);
ypos = (topbar_height - txt_s.height) / 2 + 1;
ypos = (topbar_height - static_cast<int>(txt_s.height)) / 2 + 1;
int xpos = (graph.width() - txt_s.width) / 2;
int xpos = static_cast<int>(graph.width() - txt_s.width) / 2;
if(xpos < border_size + 16) xpos = 16 + border_size + 1;
graph.string(xpos, ypos, (pos_ == where::topbar ? color_.highlight : color), str);
graph.string({ xpos, ypos }, str, (pos_ == where::topbar ? color_.highlight : color));
}
}
@@ -181,9 +190,8 @@ namespace nana
nana::rectangle r(static_cast<int>(x * dbasis.row_s), static_cast<int>(y * dbasis.line_s),
static_cast<int>(dbasis.row_s), static_cast<int>(dbasis.line_s));
nana::color_t color{ color_.normal };
nana::point tpos{ trace_pos_ - dbasis.refpos };
auto color = color_.normal;
auto tpos = trace_pos_ - dbasis.refpos;
if((pos_ == where::textarea)
&& (r.x <= tpos.x)
@@ -194,22 +202,22 @@ namespace nana
if((page_ != page::date) || y)
{
color = color_.highlight;
graph.rectangle(r, color_.bkcolor, true);
graph.rectangle(r, true, color_.bgcolor);
}
}
if(sel)
{
color = color_.highlight;
graph.rectangle(r, color_.bkcolor, true);
graph.rectangle(r, color_.selected, false);
graph.rectangle(r, true, color_.bgcolor);
graph.rectangle(r, false, color_.selected);
}
if(primary == false)
color = 0xB0B0B0;
if(false == primary)
color = { 0xB0, 0xB0, 0xB0 };
nana::size txt_s = graph.text_extent_size(str);
graph.string(r.x + static_cast<int>(r.width - txt_s.width) / 2, r.y + static_cast<int>(r.height - txt_s.height) / 2, color, str);
graph.string({ r.x + static_cast<int>(r.width - txt_s.width) / 2, r.y + static_cast<int>(r.height - txt_s.height) / 2 }, str, color);
}
void trigger::_m_draw_pos(drawing_basis & dbasis, graph_reference graph, int x, int y, int number, bool primary, bool sel)
@@ -417,7 +425,7 @@ namespace nana
r.x = static_cast<int>(newbuf.width() - r.width) / 2;
r.y = static_cast<int>(newbuf.height() - r.height) / 2;
dzbuf.rectangle(0xFFFFFF, true);
dzbuf.rectangle(true, colors::white);
dirtybuf.stretch(dzbuf, r);
r.width = static_cast<int>(newbuf.width() + delta * (count - i));
@@ -451,7 +459,7 @@ namespace nana
r.height = static_cast<int>(newbuf.height() - delta_h * (count - i));
r.x = static_cast<int>(newbuf.width() - r.width) / 2;
r.y = static_cast<int>(newbuf.height() - r.height) / 2;
nzbuf.rectangle(0xFFFFFF, true);
nzbuf.rectangle(true, colors::white);
newbuf.stretch(nzbuf, r);
nzbuf.blend(nzbuf.size(), dzbuf, nana::point(), fade * (count - i));