Breaking changes for expr_color

Removed the typedef-name nana::color_t
This commit is contained in:
cnjinhao
2014-12-18 13:08:44 +08:00
parent 42788db077
commit e64b6ec2b2
43 changed files with 185 additions and 915 deletions

View File

@@ -347,9 +347,6 @@ namespace nana
visible = false;
//colors.foreground = 0x0; //deprecated
//colors.background = nana::color::button_face;
//colors.active = 0x60C8FD;
colors.fgcolor = ::nana::colors::black;
colors.bgcolor = ::nana::colors::button_face;
colors.activated.from_rgb(0x60, 0xc8, 0xfd);

View File

@@ -26,8 +26,6 @@ namespace nana
{
if(fade_rate_ < 0.001)
return;
//nana::color_t color = API::background(wd); //deprecated
graph.blend(graph.size(), API::bgcolor(wd), fade_rate_);
}
private:

View File

@@ -1,3 +1,15 @@
/*
* Elements of GUI Gadgets
* Nana C++ Library(http://www.nanapro.org)
* Copyright(C) 2003-2014 Jinhao(cnjinhao@hotmail.com)
*
* Distributed under the Boost Software License, Version 1.0.
* (See accompanying file LICENSE_1_0.txt or copy at
* http://www.boost.org/LICENSE_1_0.txt)
*
* @file: nana/gui/element.cpp
*/
#include <nana/gui/element.hpp>
#include <nana/gui/detail/bedrock.hpp>
#include <nana/gui/detail/element_store.hpp>
@@ -129,7 +141,6 @@ namespace nana
}
else
{
//const nana::color_t highlighted = 0x5EB6F7; //deprecated
nana::expr_color highlighted(0x5e, 0xb6, 0xf7);
auto bld_bgcolor = bgcolor;
auto bld_fgcolor = fgcolor;
@@ -139,18 +150,13 @@ namespace nana
case element_state::focus_hovered:
bld_bgcolor.blend(highlighted, 0.8);
bld_fgcolor.blend(highlighted, 0.8);
//bgcolor = graph.mix(bgcolor, highlighted, 0.8); //deprecated
//fgcolor = graph.mix(fgcolor, highlighted, 0.8);
break;
case element_state::pressed:
bld_bgcolor.blend(highlighted, 0.4);
bld_fgcolor.blend(highlighted, 0.4);
//bgcolor = graph.mix(bgcolor, highlighted, 0.4); //deprecated
//fgcolor = graph.mix(fgcolor, highlighted, 0.4);
break;
case element_state::disabled:
bld_bgcolor = bld_fgcolor = nana::expr_color(0xb2, 0xb7, 0xbc);
//bgcolor = fgcolor = 0xB2B7BC; //deprecated
break;
default:
//Leave things as they are
@@ -250,15 +256,6 @@ namespace nana
graph.line(point{ x + 7, y + 10 }, point{ x + 12, y + 5 });
graph.line(point{ x + 4, y + 7 }, point{ x + 6, y + 9 });
graph.line(point{ x + 7, y + 8 }, point{ x + 11, y + 4 });
//nana::color_t light = graph.mix(fgcolor, 0xFFFFFF, 0.5); //deprecated
/*
graph.line(point{ x + 3, y + 7 }, point{ x + 6, y + 10 }, fgcolor); //deprecated
graph.line(x + 7, y + 9, x + 12, y + 4, fgcolor);
graph.line(x + 3, y + 8, x + 6, y + 11, light);
graph.line(x + 7, y + 10, x + 12, y + 5, light);
graph.line(x + 4, y + 7, x + 6, y + 9, light);
graph.line(x + 7, y + 8, x + 11, y + 4, light);
*/
}
return true;
}

View File

@@ -790,85 +790,6 @@ namespace API
restrict::bedrock.pump_event(wd, false);
}
/*
nana::color_t foreground(window wd) //deprecated
{
internal_scope_guard lock;
if(restrict::window_manager.available(reinterpret_cast<restrict::core_window_t*>(wd)))
return reinterpret_cast<restrict::core_window_t*>(wd)->colors.fgcolor.px_color().value;
return 0;
}
color_t foreground(window wd, color_t col) //deprecated
{
auto iwd = reinterpret_cast<restrict::core_window_t*>(wd);
internal_scope_guard lock;
if(restrict::window_manager.available(iwd))
{
color_t prev = iwd->colors.fgcolor.px_color().value;
if(prev != col)
{
iwd->colors.fgcolor = static_cast<colors>(col);
restrict::window_manager.update(iwd, true, false);
}
return prev;
}
return 0;
}
color_t background(window wd) //deprecated
{
internal_scope_guard lock;
if(restrict::window_manager.available(reinterpret_cast<restrict::core_window_t*>(wd)))
return reinterpret_cast<restrict::core_window_t*>(wd)->colors.bgcolor.px_color().value;
return 0;
}
color_t background(window wd, color_t col) //deprecated
{
auto iwd = reinterpret_cast<restrict::core_window_t*>(wd);
internal_scope_guard lock;
if(restrict::window_manager.available(iwd))
{
color_t prev = iwd->colors.bgcolor.px_color().value;
if(prev != col)
{
iwd->colors.bgcolor = static_cast<colors>(col);
restrict::window_manager.update(iwd, true, false);
}
return prev;
}
return 0;
}
color_t active(window wd) //deprecated
{
internal_scope_guard lock;
if(restrict::window_manager.available(reinterpret_cast<restrict::core_window_t*>(wd)))
return reinterpret_cast<restrict::core_window_t*>(wd)->colors.activated.px_color().value;
return 0;
}
color_t active(window wd, color_t clr) //deprecated
{
auto iwd = reinterpret_cast<restrict::core_window_t*>(wd);
internal_scope_guard lock;
if(restrict::window_manager.available(iwd))
{
color_t prev = iwd->colors.activated.px_color().value;
if (prev != clr)
{
iwd->colors.activated = static_cast<colors>(clr);
restrict::window_manager.update(iwd, true, false);
}
return prev;
}
return 0;
}
*/
expr_color fgcolor(window wd)
{
internal_scope_guard lock;

View File

@@ -197,8 +197,6 @@ namespace nana{ namespace drawerbase
icon_sz.width += 5;
}
//int x = (static_cast<int>(gsize.width - 1 - ts.width) >> 1); //deprecated
//int y = (static_cast<int>(gsize.height - 1 - ts.height) >> 1);
nana::point pos{
static_cast<int>(gsize.width - 1 - ts.width) >> 1, static_cast<int>(gsize.height - 1 - ts.height) >> 1
};
@@ -226,15 +224,8 @@ namespace nana{ namespace drawerbase
graph.set_text_color(fgcolor);
/*
if(attr_.omitted)
tr.render(x, y, fgcolor.argb().value, txtptr, txtlen, omitted_pixels, true); //deprecated
else
graph.bidi_string(x, y, fgcolor, txtptr, txtlen);
*/
if (attr_.omitted)
tr.render(pos, txtptr, txtlen, omitted_pixels, true); //deprecated
tr.render(pos, txtptr, txtlen, omitted_pixels, true);
else
graph.bidi_string(pos, txtptr, txtlen);
@@ -244,8 +235,7 @@ namespace nana{ namespace drawerbase
nana::size shortkey_size = graph.text_extent_size(txtptr + shortkey_pos, 1);
pos.x += off_w;
pos.y += static_cast<int>(shortkey_size.height);
//graph.line(x, y, x + shortkey_size.width - 1, y, 0x0); //deprecated
graph.set_color(::nana::expr_color(colors::black));
graph.set_color(colors::black);
graph.line(pos, point{ pos.x + static_cast<int>(shortkey_size.width) - 1, pos.y });
}
}
@@ -308,8 +298,6 @@ namespace nana{ namespace drawerbase
nana::rectangle r(graph.size());
r.pare_off(1);
//nana::color_t color_start = nana::paint::graphics::mix(attr_.bgcolor.argb().value, 0xFFFFFF, 0.2); //deprecated
//nana::color_t color_end = nana::paint::graphics::mix(attr_.bgcolor.argb().value, 0x0, 0.95);
::nana::expr_color from(colors::white);
from.blend(attr_.bgcolor, 0.8);
::nana::expr_color to(colors::black);
@@ -320,7 +308,6 @@ namespace nana{ namespace drawerbase
r.x = r.y = 2;
std::swap(from, to);
}
//graph.shadow_rectangle(r, color_start, color_end, true); //deprecated
graph.gradual_rectangle(r, from, to, true);
}

View File

@@ -79,7 +79,6 @@ namespace nana
if(ue.what == ue.none || (API::window_enabled(wd) == false))
{ //the mouse is out of the widget.
style_.bgcolor.blend(expr_color{ 0xa0, 0xc9, 0xf5 }, 0.9);
//style_.bgcolor = nana::paint::graphics::mix(style_.bgcolor, 0xA0C9F5, 0.9); //deprecated
}
graph.rectangle(r, true, style_.bgcolor);
}
@@ -131,21 +130,16 @@ namespace nana
::nana::expr_color clr{ 0x3C, 0x7F, 0xB1 };
if(has_child)
{
int left = r.x + r.width - 16;
_m_item_bground(graph, left, top, 15, height, state_arrow);
width -= 16;
--left;
//graph.line(left, top, left, r.y + height, 0x3C7FB1);//deprecated
graph.set_color(clr);
graph.line({ left, top }, { left, r.y + static_cast<int>(height) });
int left = r.x + r.width - 17;
_m_item_bground(graph, left + 1, top, 15, height, state_arrow);
graph.line({ left, top }, { left, r.y + static_cast<int>(height) }, clr);
}
_m_item_bground(graph, r.x + 1, top, width, height, state_name);
//graph.rectangle(r, 0x3C7FB1, false); //deprecated
graph.set_color(clr);
graph.rectangle(r, false);
graph.rectangle(r, false, clr);
}
//graph.string(strpos.x, strpos.y, style_.fgcolor, name); //deprecated
graph.string(strpos, name, style_.fgcolor);
if(has_child)
@@ -159,17 +153,11 @@ namespace nana
{
rectangle r{ graph.size() };
graph.set_color({ 0xf0, 0xf0, 0xf0 });
graph.rectangle(r, false);
graph.rectangle(r, false, { 0xf0, 0xf0, 0xf0 });
expr_color lb(0x9d, 0xab, 0xb9);
expr_color tr(0x48, 0x4e, 0x55);
graph.frame_rectangle(r.pare_off(1), lb, tr, tr, lb);
//deprecated
//graph.rectangle(0xF0F0F0, false);
//graph.rectangle_line(nana::rectangle(graph.size()).pare_off(1),
// 0x9DABB9, 0x484E55, 0x484E55, 0x9DABB9);
}
private:
void _m_item_bground(graph_reference graph, int x, int y, unsigned width, unsigned height, mouse_action state)
@@ -177,35 +165,25 @@ namespace nana
const unsigned half = (height - 2) / 2;
int left = x + 1;
int top = y + 1;
//nana::color_t upcol, downcol; // deprecated
nana::expr_color clr_top(0xea, 0xea, 0xea), clr_bottom(0xdc, 0xdc, 0xdc);
switch(state)
{
case mouse_action::over:
clr_top = expr_color(0xdf, 0xf2, 0xfc);
clr_bottom = expr_color(0xa9, 0xda, 0xf5);
//upcol = 0x0DFF2FC; //deprecated
//downcol = 0xA9DAF5;
clr_top.from_rgb(0xdf, 0xf2, 0xfc);
clr_bottom.from_rgb(0xa9, 0xda, 0xf5);
break;
case mouse_action::pressed:
//upcol = 0xA6D7F2; //deprecated
//downcol = 0x92C4F6;
clr_top = expr_color(0xa6, 0xd7, 0xf2);
clr_bottom = expr_color(0x92, 0xc4, 0xf6);
clr_top.from_rgb(0xa6, 0xd7, 0xf2);
clr_bottom.from_rgb(0x92, 0xc4, 0xf6);
++left;
++top;
break;
//case mouse_action::normal: //deprecated
default:
//upcol = 0xEAEAEA; //deprecated
//downcol = 0xDCDCDC;
break;
}
graph.rectangle(rectangle{ left, top, width - 2, half }, true, clr_top);
graph.rectangle(rectangle{ left, top + static_cast<int>(half), width - 2, (height - 2) - half }, true, clr_bottom);
//graph.rectangle(left, top, width - 2, half, upcol, true); //deprecated
//graph.rectangle(left, top + static_cast<int>(half), width - 2, (height - 2) - half, downcol, true);
if(mouse_action::pressed == state)
{
int bottom = y + height - 1;
@@ -219,13 +197,6 @@ namespace nana
graph.set_color(expr_color(0xa6, 0xc7, 0xd9));
graph.line(point{ x, y }, point{ right, y });
graph.line(point{ x, y + 1 }, point{ x, bottom });
//graph.line(x, y, right, y, 0x6E8D9F); //deprecated
//graph.line(x, y + 1, x, bottom, 0x6E8D9F);
//++x;
//++y;
//graph.line(x, y, right, y, 0xA6C7D9);
//graph.line(x, y + 1, x, bottom, 0xA6C7D9);
}
}
@@ -416,7 +387,6 @@ namespace nana
void attach(window wd, nana::paint::graphics* graph)
{
window_ = wd;
//API::background(wd, 0xFFFFFF); //deprecated
API::bgcolor(wd, colors::white);
graph_ = graph;
}

View File

@@ -600,7 +600,6 @@ namespace nana
void trigger::attached(widget_reference wdg, graph_reference graph)
{
wdg.bgcolor(colors::white);
//wdg.background(0xFFFFFF); //deprecated
drawer_->attached(wdg, graph);
API::effects_edge_nimbus(wdg, effects::edge_nimbus::active);

View File

@@ -1,6 +1,7 @@
/*
* A date chooser Implementation
* Copyright(C) 2003-2013 Jinhao(cnjinhao@hotmail.com)
* Nana C++ Library(http://www.nanapro.org)
* Copyright(C) 2003-2014 Jinhao(cnjinhao@hotmail.com)
*
* Distributed under the Boost Software License, Version 1.0.
* (See accompanying file LICENSE_1_0.txt or copy at
@@ -63,15 +64,6 @@ namespace nana
if(0 <= index && index < 12)
this->monthstr_[index] = str;
}
/*
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)
{
@@ -99,13 +91,8 @@ namespace nana
void trigger::_m_draw(graph_reference graph)
{
//_m_init_color(); //deprecated
const unsigned width = graph.width() - 2;
//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);

View File

@@ -37,22 +37,12 @@ namespace nana
::nana::expr_color clr{ 0xaf, 0xc7, 0xe3 };
graph.rectangle(r, false, clr);
//graph.set_pixel(r.x, r.y, 0xFFFFFF); //deprecated
//graph.set_pixel(r.x + r.width - 1, r.y, 0xFFFFFF);
//graph.set_pixel(r.x, r.y + r.height - 1, 0xFFFFFF);
//graph.set_pixel(r.x + r.width - 1, r.y + r.height - 1, 0xFFFFFF);
graph.set_color(colors::white);
graph.set_pixel(r.x, r.y);
graph.set_pixel(r.x + r.width - 1, r.y);
graph.set_pixel(r.x, r.y + r.height - 1);
graph.set_pixel(r.x + r.width - 1, r.y + r.height - 1);
//graph.set_pixel(r.x + 1, r.y + 1, 0xAFC7E3); //deprecated
//graph.set_pixel(r.x + r.width - 2, r.y + 1, 0xAFC7E3);
//graph.set_pixel(r.x + 1, r.y + r.height - 2, 0xAFC7E3);
//graph.set_pixel(r.x + r.width - 2, r.y + r.height - 2, 0xAFC7E3);
graph.set_color(clr);
graph.set_pixel(r.x + 1, r.y + 1);
graph.set_pixel(r.x + r.width - 2, r.y + 1);

View File

@@ -27,13 +27,6 @@ namespace nana
{
graph.rectangle(true, API::bgcolor(*wd_));
}
/*
void trigger::resized(graph_reference graph, const arg_resized&) //deprecated
{
graph.rectangle(API::background(*wd_), true);
API::lazy_refresh();
}
*/
}//end namespace form
}//end namespace drawerbase

View File

@@ -577,8 +577,6 @@ namespace nana
typedef std::vector<cell> container;
container cells;
//color_t bgcolor{0xFF000000}; //deprecated
//color_t fgcolor{0xFF000000};
nana::expr_color bgcolor;
nana::expr_color fgcolor;
paint::image img;
@@ -2345,8 +2343,6 @@ namespace nana
size_type n = essence_->number_of_lister_items(true);
if(0 == n)return;
widget * wdptr = essence_->lister.wd_ptr();
//nana::color_t bgcolor = wdptr->background();
//nana::color_t txtcolor = wdptr->foreground(); //deprecated
auto bgcolor = wdptr->bgcolor();
auto fgcolor = wdptr->fgcolor();
@@ -2515,7 +2511,7 @@ namespace nana
auto graph = essence_->graph;
if (essence_t::state_t::highlighted == state)
bgcolor.blend(::nana::expr_color(0x99, 0xde, 0xfd), 0.8);// = graph->mix(bgcolor, 0x99DEFD, 0.8); //deprecated
bgcolor.blend(::nana::expr_color(0x99, 0xde, 0xfd), 0.8);
unsigned show_w = width - essence_->scroll.offset_x;
if(show_w >= r.width) show_w = r.width;
@@ -2579,7 +2575,7 @@ namespace nana
{
auto cell_bgcolor = m_cell.custom_format->bgcolor;
if (essence_t::state_t::highlighted == state)
cell_bgcolor.blend(::nana::expr_color(0x99, 0xde, 0xfd), 0.8); //= graph->mix(cell_bgcolor, 0x99DEFD, 0.8); //deprecated
cell_bgcolor.blend(::nana::expr_color(0x99, 0xde, 0xfd), 0.8);
graph->set_color(cell_bgcolor);
graph->rectangle(rectangle{ item_xpos, y, header.pixels, essence_->item_size }, true);
}

View File

@@ -209,7 +209,6 @@ namespace nana
graph.rectangle(r, false, clr);
graph.set_color(clr.blend(colors::white, 0.5));
//unsigned color_x = graph.mix(color, 0xFFFFFF, 0.5); //deprecated
r.pare_off(2);

View File

@@ -1662,7 +1662,6 @@ namespace nana{ namespace widgets
auto fgcolor = API::fgcolor(window_);
if (!API::window_enabled(window_))
fgcolor.blend(bgcolor, 0.5);
//fgcolor = nana::paint::graphics::mix(bgcolor, fgcolor, 0.5); //deprecated
//Draw background
if(attributes_.enable_background)
@@ -2544,7 +2543,6 @@ namespace nana{ namespace widgets
{
if (selected)
{
//color = 0xFFFFFF; //deprecated
graph_.set_text_color(colors::white);
graph_.rectangle({ x, top, str_w, line_h_pixels }, true);
}

View File

@@ -23,11 +23,6 @@ namespace nana
//draw border
::nana::expr_color lt(0x83, 0x90, 0x97), rb(0x9d,0xae,0xc2);
graph.frame_rectangle(bi.r, lt, lt, rb, rb);
//const nana::color_t dark = 0x83909F; //deprecated
//const nana::color_t gray = 0x9DAEC2;
//graph.rectangle_line(bi.r,
// dark, dark, gray, gray); //deprecated
}
virtual void adorn(window, graph_reference graph, const adorn_t& ad)
@@ -38,15 +33,11 @@ namespace nana
::nana::expr_color clr_from(0x84, 0xc5, 0xff), clr_trans(0x0f, 0x41, 0xcd), clr_to(0x6e, 0x96, 0xff);
if(ad.horizontal)
{
//graph.shadow_rectangle(ad.bound.x, ad.fixedpos, len, upperblock, 0x84C5FF, 0x0F41CD, true); //deprecated
//graph.shadow_rectangle(ad.bound.x, ad.fixedpos + upperblock, len, ad.block - upperblock, 0x0F41CD, 0x6E96FF, true);
graph.gradual_rectangle({ ad.bound.x, ad.fixedpos, len, upperblock }, clr_from, clr_trans, true);
graph.gradual_rectangle({ ad.bound.x, ad.fixedpos + static_cast<int>(upperblock), len, ad.block - upperblock }, clr_trans, clr_to, true);
}
else
{
//graph.shadow_rectangle(ad.fixedpos, ad.bound.x, upperblock, len, 0x84C5FF, 0x0F41CD, false); //deprecatd
//graph.shadow_rectangle(ad.fixedpos + upperblock, ad.bound.x, ad.block - upperblock, len, 0x0F41CD, 0x6E96FF, false);
graph.gradual_rectangle({ ad.fixedpos, ad.bound.x, upperblock, len }, clr_from, clr_trans, false); //deprecatd
graph.gradual_rectangle({ ad.fixedpos + static_cast<int>(upperblock), ad.bound.x, ad.block - upperblock, len }, clr_trans, clr_to, false);
}

View File

@@ -66,7 +66,6 @@ namespace nana
{
bgcolor = m.bgcolor;
blcolor = expr_color{ colors::black }.blend(m.bgcolor, 0.5);
//dark_bgcolor = nana::paint::graphics::mix(m.bgcolor, 0, 0.9); //deprecated
dark_bgcolor = expr_color{ colors::black }.blend(m.bgcolor, 0.1);
}
@@ -89,7 +88,6 @@ namespace nana
if (sta == item_renderer::highlight)
beg.blend(colors::white, 0.5);
//graph.shadow_rectangle(r.x + 2, r.y + 2, r.width - 4, r.height - 2, beg, end, true); //deprecated
graph.gradual_rectangle(round_r.pare_off(2), beg, end, true);
}

View File

@@ -1356,14 +1356,12 @@ namespace nana
}
private:
trigger::implement * impl_;
//nana::color_t bgcolor_; //deprecated
//nana::color_t fgcolor_;
nana::expr_color bgcolor_;
nana::expr_color fgcolor_;
nana::point pos_;
::nana::expr_color bgcolor_;
::nana::expr_color fgcolor_;
::nana::point pos_;
const node_type * iterated_node_;
item_attribute_t node_attr_;
nana::rectangle node_r_;
::nana::rectangle node_r_;
};
}

View File

@@ -141,28 +141,6 @@ namespace nana
_m_move(r);
}
/*
void widget::foreground(nana::color_t value) //deprecated
{
_m_fgcolor(expr_color(static_cast<colors>(value)));
}
nana::color_t widget::foreground() const
{
return _m_fgcolor().argb().value;
}
void widget::background(nana::color_t value)
{
_m_bgcolor(expr_color(static_cast<colors>(value)));
}
nana::color_t widget::background() const
{
return _m_bgcolor().argb().value;
}
*/
void widget::fgcolor(const nana::expr_color& col)
{
_m_fgcolor(col);