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

@@ -105,38 +105,42 @@ namespace nana
nana::size sz = graph.size();
sz.width -= 30;
sz.height -= 2;
graph.rectangle(color::gray_border, false);
graph.rectangle(1, 1, 28, sz.height, 0xF6F6F6, true);
graph.rectangle(29, 1, sz.width, sz.height, 0xFFFFFF, true);
graph.rectangle(false, colors::gray_border);
graph.rectangle({ 1, 1, 28, sz.height }, true, { 0xf6, 0xf6, 0xf6 });
graph.rectangle({ 29, 1, sz.width, sz.height }, true, colors::white);
}
void item(graph_reference graph, const nana::rectangle& r, const attr& at)
{
if(at.item_state == state::active)
{
graph.rectangle(r, 0xA8D8EB, false);
graph.rectangle(r, false, {0xa8, 0xd8, 0xeb});
nana::point points[4] = {
nana::point(r.x, r.y),
nana::point(r.x + r.width - 1, r.y),
nana::point(r.x, r.y + r.height - 1),
nana::point(r.x + r.width - 1, r.y + r.height - 1)
};
graph.set_color({0xc0, 0xdd, 0xfc});
for(int i = 0; i < 4; ++i)
graph.set_pixel(points[i].x, points[i].y, 0xC0DDFC);
graph.set_pixel(points[i].x, points[i].y);
if(at.enabled)
graph.shadow_rectangle(nana::rectangle(r).pare_off(1), 0xE8F0F4, 0xDBECF4, true);
graph.gradual_rectangle(nana::rectangle(r).pare_off(1), { 0xE8, 0xF0, 0xF4 }, { 0xDB,0xEC,0xF4 }, true);
}
if(at.checked && (checks::none != at.check_style))
{
graph.rectangle(r, 0xCDD3E6, false);
graph.rectangle(nana::rectangle(r).pare_off(1), 0xE6EFF4, true);
graph.rectangle(r, false, { 0xCD, 0xD3, 0xE6 });
::nana::expr_color clr(0xE6, 0xEF, 0xF4);
graph.rectangle(nana::rectangle(r).pare_off(1), true, clr);
nana::rectangle crook_r = r;
crook_r.width = 16;
crook_.radio(at.check_style == checks::option);
crook_.draw(graph, ::nana::expr_color(0xE6, 0xEF, 0xF4), colors::black, crook_r, element_state::normal);
crook_.draw(graph, clr, colors::black, crook_r, element_state::normal);
}
}
@@ -147,24 +151,20 @@ namespace nana
void item_text(graph_reference graph, const nana::point& pos, const nana::string& text, unsigned text_pixels, const attr& at)
{
graph.set_color(at.enabled ? colors::black : colors::gray_border);
nana::paint::text_renderer tr(graph);
tr.render(pos.x, pos.y, (at.enabled ? 0x0 : nana::color::gray_border), text.c_str(), text.length(), text_pixels, true);
tr.render(pos, text.c_str(), text.length(), text_pixels, true);
}
void sub_arrow(graph_reference graph, const nana::point& pos, unsigned pixels, const attr&)
{
nana::paint::gadget::arrow_16_pixels(graph, pos.x, pos.y + static_cast<int>(pixels - 16) / 2, 0x0, 0, nana::paint::gadget::directions::to_east);
nana::paint::gadget::arrow_16_pixels(graph, pos.x, pos.y + static_cast<int>(pixels - 16) / 2, colors::black, 0, nana::paint::gadget::directions::to_east);
}
private:
facade<element::crook> crook_;
};
//class renderer_interface
renderer_interface::~renderer_interface()
{}
//end class renderer_interface
class menu_builder
: noncopyable
{
@@ -537,7 +537,7 @@ namespace nana
renderer->item(*graph_, item_r, attr);
//Draw text, the text is transformed from orignal for hotkey character
nana::string::value_type hotkey;
nana::char_t hotkey;
nana::string::size_type hotkey_pos;
nana::string text = API::transform_shortkey_text(m.text, hotkey, &hotkey_pos);
@@ -555,7 +555,9 @@ namespace nana
nana::size hotkey_size = graph_->text_extent_size(text.c_str() + hotkey_pos, 1);
int x = item_r.x + 40 + off_w;
int y = item_r.y + text_top_off + hotkey_size.height;
graph_->line(x, y, x + hotkey_size.width - 1, y, 0x0);
graph_->set_color(colors::black);
graph_->line({ x, y }, { x + static_cast<int>(hotkey_size.width) - 1, y });
}
}
@@ -566,7 +568,8 @@ namespace nana
}
else
{
graph_->line(item_r.x + 40, item_r.y, graph_->width() - 1, item_r.y, nana::color::gray_border);
graph_->set_color(colors::gray_border);
graph_->line({ item_r.x + 40, item_r.y }, { static_cast<int>(graph_->width()) - 1, item_r.y });
item_r.y += 2;
}