remove deprecated components

This commit is contained in:
Jinhao
2016-01-03 17:50:10 +08:00
parent 0bb7c788d5
commit a2a7d1fc37
21 changed files with 127 additions and 209 deletions

View File

@@ -173,11 +173,8 @@ namespace nana
const int x = r.x + 1;
const int y = r.y + 1;
graph.set_color(bld_bgcolor);
graph.rectangle(rectangle{ x + 1, y + 1, 11, 11 }, true);
graph.set_color(bld_fgcolor);
graph.rectangle(rectangle{ x, y, 13, 13 }, false);
graph.rectangle(rectangle{ x + 1, y + 1, 11, 11 }, true, bld_bgcolor);
graph.rectangle(rectangle{ x, y, 13, 13 }, false, bld_fgcolor);
switch(crook_data.check_state)
{
@@ -252,11 +249,11 @@ namespace nana
int x = r.x + (static_cast<int>(r.width) - 16) / 2;
int y = r.y + (static_cast<int>(r.height) - 16) / 2;
graph.set_color(fgcolor);
graph.palette(false, fgcolor);
graph.line(point{ x + 3, y + 7 }, point{ x + 6, y + 10 });
graph.line(point{ x + 7, y + 9 }, point{ x + 12, y + 4 });
graph.set_color(fgcolor.blend(colors::white, 0.5));
graph.palette(false, fgcolor.blend(colors::white, 0.5));
graph.line(point{ x + 3, y + 8 }, point{ x + 6, y + 11 });
graph.line(point{ x + 7, y + 10 }, point{ x + 12, y + 5 });
graph.line(point{ x + 4, y + 7 }, point{ x + 6, y + 9 });
@@ -515,16 +512,16 @@ namespace nana
::nana::point left_mid{ r.x + 1, r.y + 1 + static_cast<int>(part_px) }, right_mid{ right_top.x, left_mid.y };
::nana::point left_bottom{ r.x + 1, r.bottom() - 2 }, right_bottom{ r.right() - 2, r.bottom() - 2 };
graph.set_color(bgcolor.blend(colors::white, 0.9));
graph.palette(false, bgcolor.blend(colors::white, 0.9));
graph.line(left_top, left_mid);
graph.line(right_top, right_mid);
graph.set_color(bgcolor.blend(colors::white, 0.5));
graph.palette(false, bgcolor.blend(colors::white, 0.5));
graph.line(left_top, right_top);
left_mid.y++;
right_mid.y++;
graph.set_color(bgcolor.blend(colors::black, 0.8));
graph.palette(false, bgcolor.blend(colors::black, 0.8));
graph.line(left_mid, left_bottom);
graph.line(right_mid, right_bottom);
@@ -557,7 +554,7 @@ namespace nana
break;
}
graph.set_color(clr);
graph.palette(false, clr);
const int x = r.x + 4;
const int y = r.y + 4;
@@ -959,13 +956,13 @@ namespace nana
ps[11].x = r.x + gap;
ps[11].y = r.y + gap;
graph.set_color(fgcolor.blend(colors::black, true));
graph.palette(false, fgcolor.blend(colors::black, true));
for (int i = 0; i < 11; ++i)
graph.line(ps[i], ps[i + 1]);
graph.line(ps[11], ps[0]);
graph.set_color(fgcolor);
graph.palette(false, fgcolor);
unsigned thk_minus_2 = thickness_ - 2;
graph.rectangle(rectangle{ ps[10].x + 1, ps[10].y + 1, (gap << 1) + thk_minus_2, thk_minus_2 }, true);
@@ -1010,7 +1007,7 @@ namespace nana
//Implement element_interface
bool facade<element::arrow>::draw(graph_reference graph, const nana::color& bgcolor, const nana::color& fgcolor, const nana::rectangle& r, element_state estate)
{
graph.set_color(fgcolor);
graph.palette(false, fgcolor);
return (*cite_)->draw(graph, bgcolor, fgcolor, r, estate, dir_);
}
//end class facade<element::arrow>

View File

@@ -79,9 +79,8 @@ namespace nana
void refresh(graph_reference& graph) override
{
graph.set_color(static_cast<color_rgb>(0x83EB));
graph.set_text_color(colors::white);
graph.rectangle(true);
graph.palette(true, colors::white);
graph.rectangle(true, static_cast<color_rgb>(0x83EB));
//draw caption
auto text = utf8_cast(API::window_caption(window_handle_));

View File

@@ -280,6 +280,33 @@ namespace API
{
restrict::bedrock.delay_restore(enable ? 0 : 1);
}
void register_menu_window(window wd, bool has_keyboard)
{
internal_scope_guard lock;
if (restrict::wd_manager().available(reinterpret_cast<basic_window*>(wd)))
restrict::bedrock.set_menu(reinterpret_cast<basic_window*>(wd)->root, has_keyboard);
}
void set_menubar(window wd, bool attach)
{
auto iwd = reinterpret_cast<basic_window*>(wd);
internal_scope_guard lock;
if (restrict::wd_manager().available(iwd))
{
auto root_attr = iwd->root_widget->other.attribute.root;
if (attach)
{
if (!root_attr->menubar)
root_attr->menubar = iwd;
}
else
{
if (iwd == root_attr->menubar)
root_attr->menubar = nullptr;
}
}
}
}//end namespace dev
@@ -1141,6 +1168,7 @@ namespace API
return reinterpret_cast<window>(ts_wd);
}
/*
//glass_window deprecated
//@brief: Test a window whether it is a glass attribute.
bool glass_window(window wd)
@@ -1156,6 +1184,7 @@ namespace API
effects_bground_remove(wd);
return true;
}
*/
void take_active(window wd, bool active, window take_if_active_false)
{
@@ -1247,36 +1276,6 @@ namespace API
return nullptr;
}
void register_menu_window(window wd, bool has_keyboard)
{
internal_scope_guard lock;
if(restrict::wd_manager().available(reinterpret_cast<basic_window*>(wd)))
restrict::bedrock.set_menu(reinterpret_cast<basic_window*>(wd)->root, has_keyboard);
}
bool attach_menubar(window menubar)
{
auto iwd = reinterpret_cast<basic_window*>(menubar);
internal_scope_guard lock;
if(restrict::wd_manager().available(iwd) && (nullptr == iwd->root_widget->other.attribute.root->menubar))
{
iwd->root_widget->other.attribute.root->menubar = iwd;
return true;
}
return false;
}
void detach_menubar(window menubar)
{
auto iwd = reinterpret_cast<basic_window*>(menubar);
internal_scope_guard lock;
if (restrict::wd_manager().available(iwd))
{
if (iwd->root_widget->other.attribute.root->menubar == iwd)
iwd->root_widget->other.attribute.root->menubar = nullptr;
}
}
bool is_window_zoomed(window wd, bool ask_for_max)
{
auto const iwd = reinterpret_cast<basic_window*>(wd);

View File

@@ -248,7 +248,7 @@ namespace nana{ namespace drawerbase
++pos.y;
}
graph.set_text_color(attr_.focus_color && attr_.focused ? ::nana::color(colors::blue) : attr_.fgcolor);
graph.palette(true, attr_.focus_color && attr_.focused ? ::nana::color(colors::blue) : attr_.fgcolor);
if (attr_.omitted)
tr.render(pos, txtptr, txtlen, omitted_pixels, true);
@@ -268,23 +268,22 @@ namespace nana{ namespace drawerbase
pos.x += off_w;
pos.y += static_cast<int>(ascent + 2);
graph.set_color(colors::black);
graph.line(pos, point{ pos.x + static_cast<int>(shortkey_size.width) - 1, pos.y });
graph.line(pos, point{ pos.x + static_cast<int>(shortkey_size.width) - 1, pos.y }, colors::black);
}
}
else
{
graph.set_text_color(::nana::color(colors::white));
graph.palette(true, ::nana::color(colors::white));
if(attr_.omitted)
{
tr.render(point{ pos.x + 1, pos.y + 1 }, txtptr, txtlen, omitted_pixels, true);
graph.set_text_color(::nana::color(colors::gray));
graph.palette(true, ::nana::color(colors::gray));
tr.render(pos, txtptr, txtlen, omitted_pixels, true);
}
else
{
graph.bidi_string(point{ pos.x + 1, pos.y + 1 }, txtptr, txtlen);
graph.set_text_color(::nana::color(colors::gray));
graph.palette(true, ::nana::color(colors::gray));
graph.bidi_string(pos, txtptr, txtlen);
}
}
@@ -325,10 +324,10 @@ namespace nana{ namespace drawerbase
::nana::color lt(static_cast<color_rgb>(0x7f7f7f)), rb(static_cast<color_rgb>(0x707070));
graph.frame_rectangle(r, lt, lt, rb, rb);
graph.set_color(colors::button_face);
graph.palette(false, colors::button_face);
draw_corner_point(graph, r);
graph.set_color(static_cast<color_rgb>(0x919191));
graph.palette(false, static_cast<color_rgb>(0x919191));
draw_corner_point(graph, r.pare_off(1));
if (element_state::pressed == attr_.e_state)

View File

@@ -191,12 +191,12 @@ namespace nana
int bottom = y + height - 1;
int right = x + width - 1;
graph.set_color(static_cast<color_rgb>(0x6E8D9F));
graph.palette(false, static_cast<color_rgb>(0x6E8D9F));
graph.line(point{ x, y }, point{right, y});
graph.line(point{ x, y + 1 }, point{ x, bottom });
++x;
++y;
graph.set_color(color(0xa6, 0xc7, 0xd9));
graph.palette(false, color(0xa6, 0xc7, 0xd9));
graph.line(point{ x, y }, point{ right, y });
graph.line(point{ x, y + 1 }, point{ x, bottom });
}

View File

@@ -105,12 +105,12 @@ namespace checkbox
nana::paint::text_renderer tr(graph);
if (API::window_enabled(widget_->handle()) == false)
{
graph.set_text_color(colors::white);
graph.palette(true, colors::white);
tr.render({ 17 + interval, 2 }, title.c_str(), title.length(), pixels);
graph.set_text_color({ 0x80, 0x80, 0x80 });
graph.palette(true, { 0x80, 0x80, 0x80 });
}
else
graph.set_text_color(widget_->fgcolor());
graph.palette(true, widget_->fgcolor());
tr.render({ 16 + interval, 1 }, title.c_str(), title.length(), pixels);
}

View File

@@ -111,8 +111,7 @@ namespace nana
int xpos = static_cast<int>(graph.width() - txt_s.width) / 2;
if(xpos < border_size + 16) xpos = 16 + border_size + 1;
graph.set_text_color(pos_ == where::topbar ? color_.highlight : color_.normal);
graph.string({ xpos, top }, str);
graph.string({ xpos, top }, str, (pos_ == where::topbar ? color_.highlight : color_.normal));
}
}
@@ -167,9 +166,8 @@ namespace nana
if(false == primary)
color = { 0xB0, 0xB0, 0xB0 };
nana::size txt_s = graph.text_extent_size(str_utf8);
graph.set_text_color(color);
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_utf8);
auto txt_s = graph.text_extent_size(str_utf8);
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_utf8, color);
}
void trigger::_m_draw_pos(drawing_basis & dbasis, graph_reference graph, int x, int y, int number, bool primary, bool sel)

View File

@@ -39,7 +39,7 @@ namespace nana
auto right = r.right() - 1;
auto bottom = r.bottom() - 1;
graph.set_color(colors::white);
graph.palette(false, colors::white);
graph.set_pixel(r.x, r.y);
graph.set_pixel(right, r.y);
graph.set_pixel(r.x, bottom);
@@ -47,7 +47,7 @@ namespace nana
--right;
--bottom;
graph.set_color(clr);
graph.palette(false, clr);
graph.set_pixel(r.x + 1, r.y + 1);
graph.set_pixel(right, r.y + 1);
graph.set_pixel(r.x + 1, bottom);
@@ -103,8 +103,8 @@ namespace nana
}
x += (image_pixels_ + 2);
}
graph.set_text_color(colors::black);
graph.string({ x, r.y + 2 }, item->text());
graph.string({ x, r.y + 2 }, item->text(), colors::black);
}
unsigned item_pixels(graph_reference graph) const

View File

@@ -2855,7 +2855,7 @@ namespace nana
auto fgcolor = wdptr->fgcolor();
unsigned header_w = essence_->header.pixels();
essence_->graph->set_color(bgcolor);
essence_->graph->palette(false, bgcolor);
if(header_w - essence_->scroll.offset_x < rect.width)
essence_->graph->rectangle(rectangle{ point(rect.x + static_cast<int>(header_w)-essence_->scroll.offset_x, rect.y),
size(static_cast<int>(rect.width) + essence_->scroll.offset_x - static_cast<int>(header_w), rect.height) },
@@ -3154,31 +3154,28 @@ namespace nana
if (item_state::highlighted == state)
it_bgcolor = it_bgcolor.blend(static_cast<color_rgb>(0x99defd), 0.8);
graph->set_color(it_bgcolor);
graph->rectangle(rectangle{ item_xpos, y, header.pixels, essence_->item_size }, true);
graph->rectangle(rectangle{ item_xpos, y, header.pixels, essence_->item_size }, true, it_bgcolor);
cell_txtcolor = m_cell.custom_format->fgcolor;
}
if (draw_column)
{
graph->set_text_color(cell_txtcolor);
graph->string(point{ item_xpos + content_pos, y + txtoff }, m_cell.text); // draw full text of the cell index (column)
graph->string(point{ item_xpos + content_pos, y + txtoff }, m_cell.text, cell_txtcolor); // draw full text of the cell index (column)
if (static_cast<int>(ts.width) > static_cast<int>(header.pixels) - (content_pos + item_xpos)) // it was an excess
{
//The text is painted over the next subitem // here beging the ...
int xpos = item_xpos + static_cast<int>(header.pixels) - static_cast<int>(essence_->suspension_width);
graph->set_color(it_bgcolor); // litter rect with the item bg end ...
graph->rectangle(rectangle{ xpos, y + 2, essence_->suspension_width, essence_->item_size - 4 }, true);
// litter rect with the item bg end ...
graph->rectangle(rectangle{ xpos, y + 2, essence_->suspension_width, essence_->item_size - 4 }, true, it_bgcolor);
graph->string(point{ xpos, y + 2 }, L"...");
//Erase the part that over the next subitem only if the right of column is less than right of listbox
if (item_xpos + content_pos < content_r.right() - static_cast<int>(header.pixels))
{
graph->set_color(bgcolor); // we need to erase the excess, because some cell may not draw text over
graph->palette(false, bgcolor); // we need to erase the excess, because some cell may not draw text over
graph->rectangle(rectangle{ item_xpos + static_cast<int>(header.pixels), y + 2,
ts.width + static_cast<unsigned>(content_pos)-header.pixels, essence_->item_size - 4 }, true);
}
@@ -3193,10 +3190,9 @@ namespace nana
item_xpos += static_cast<int>(header.pixels);
if (display_order + 1 >= seqs.size() && static_cast<int>(extreme_text) > item_xpos)
{
graph->set_color(item.bgcolor);
graph->rectangle(rectangle{item_xpos , y + 2, extreme_text - item_xpos, essence_->item_size - 4}, true);
}
{
graph->rectangle(rectangle{item_xpos , y + 2, extreme_text - item_xpos, essence_->item_size - 4}, true, item.bgcolor);
}
}
//Draw selecting inner rectangle

View File

@@ -121,7 +121,7 @@ namespace nana
nana::point(r.x + r.width - 1, r.y + r.height - 1)
};
graph.set_color(static_cast<color_rgb>(0xc0ddfc));
graph.palette(false, static_cast<color_rgb>(0xc0ddfc));
for(int i = 0; i < 4; ++i)
graph.set_pixel(points[i].x, points[i].y);
@@ -150,7 +150,7 @@ namespace nana
void item_text(graph_reference graph, const nana::point& pos, const std::string& text, unsigned text_pixels, const attr& at)
{
graph.set_text_color(at.enabled ? colors::black : colors::gray_border);
graph.palette(true, at.enabled ? colors::black : colors::gray_border);
nana::paint::text_renderer tr(graph);
auto wstr = to_wstring(text);
@@ -372,8 +372,7 @@ namespace nana
{
if (m.flags.splitter)
{
graph_->set_color(colors::gray_border);
graph_->line({ item_r.x + 40, item_r.y }, { static_cast<int>(graph.width()) - 1, item_r.y });
graph_->line({ item_r.x + 40, item_r.y }, { static_cast<int>(graph.width()) - 1, item_r.y }, colors::gray_border);
item_r.y += 2;
++pos;
continue;
@@ -403,8 +402,7 @@ namespace nana
int x = item_r.x + 40 + off_w;
int y = item_r.y + text_top_off + hotkey_size.height;
graph_->set_color(colors::black);
graph_->line({ x, y }, { x + static_cast<int>(hotkey_size.width) - 1, y });
graph_->line({ x, y }, { x + static_cast<int>(hotkey_size.width) - 1, y }, colors::black);
}
}
@@ -751,7 +749,7 @@ namespace nana
if(submenu_.parent == nullptr)
{
state_.owner_menubar = owner_menubar;
API::register_menu_window(this->handle(), !owner_menubar);
API::dev::register_menu_window(this->handle(), !owner_menubar);
}
auto & events = this->events();

View File

@@ -114,7 +114,7 @@ namespace nana
int right = pos.x + static_cast<int>(size.width) - 1;
int bottom = pos.y + static_cast<int>(size.height) - 1;
graph_.set_color(corner);
graph_.palette(false, corner);
graph_.set_pixel(pos.x, pos.y);
graph_.set_pixel(right, pos.y);
graph_.set_pixel(pos.x, bottom);
@@ -608,7 +608,8 @@ namespace nana
{
widget_object<category::widget_tag, drawerbase::menubar::trigger>
::create(wd, rectangle(nana::size(API::window_size(wd).width, 28)));
API::attach_menubar(handle());
API::dev::set_menubar(handle(), true);
evt_resized_ = API::events(wd).resized([this](const ::nana::arg_resized& arg)
{
auto sz = this->size();

View File

@@ -199,7 +199,7 @@ namespace nana
graph.rectangle(r, false, clr);
clr = clr.blend(colors::white, 0.5);
graph.set_color(clr);
graph.palette(false, clr);
r.pare_off(2);
if(vertical_)

View File

@@ -2971,7 +2971,7 @@ namespace nana{ namespace widgets
void text_editor::_m_draw_parse_string(const keyword_parser& parser, bool rtl, ::nana::point pos, const ::nana::color& fgcolor, const wchar_t* str, std::size_t len) const
{
graph_.set_text_color(fgcolor);
graph_.palette(true, fgcolor);
graph_.string(pos, str, len);
if (parser.entities().empty())
return;
@@ -3010,8 +3010,8 @@ namespace nana{ namespace widgets
auto ent_end = (ent.end < str_end ? ent.end : str_end);
auto ent_pixels = std::accumulate(glyphs + (ent_begin - str), glyphs + (ent_end - str), unsigned{});
canvas.set_color(ent.scheme->bgcolor.invisible() ? _m_bgcolor() : ent.scheme->bgcolor);
canvas.set_text_color(ent.scheme->fgcolor.invisible() ? fgcolor : ent.scheme->fgcolor);
canvas.palette(false, ent.scheme->bgcolor.invisible() ? _m_bgcolor() : ent.scheme->bgcolor);
canvas.palette(true, ent.scheme->fgcolor.invisible() ? fgcolor : ent.scheme->fgcolor);
canvas.rectangle(true);
@@ -3058,9 +3058,8 @@ namespace nana{ namespace widgets
//The line of text is in the range of selection
nana::upoint a, b;
graph_.set_text_color(clr);
graph_.set_color(scheme_->selection.get_color());
graph_.palette(true, clr);
graph_.palette(false, scheme_->selection.get_color());
//The text is not selected or the whole line text is selected
if (!focused || (!_m_get_sort_select_points(a, b)) || (select_.a.y != str_pos.y && select_.b.y != str_pos.y))
@@ -3075,7 +3074,7 @@ namespace nana{ namespace widgets
{
if (selected && focused)
{
graph_.set_text_color(scheme_->selection_text.get_color());
graph_.palette(true, scheme_->selection_text.get_color());
graph_.rectangle(::nana::rectangle{ text_pos, { str_w, line_h_pixels } }, true);
graph_.string(text_pos, ent.begin, len);
}
@@ -3099,7 +3098,7 @@ namespace nana{ namespace widgets
int sel_xpos = static_cast<int>(str_px - (glyph_front + glyph_selected));
graph_.set_text_color(scheme_->selection_text.get_color());
graph.palette(true, scheme_->selection_text.get_color());
graph.string({-sel_xpos, 0}, str, len);
graph_.bitblt(nana::rectangle(strpos.x + sel_xpos, strpos.y, glyph_selected, line_h_pixels), graph);
};
@@ -3123,7 +3122,7 @@ namespace nana{ namespace widgets
if (a.x <= pos && str_end <= b.x)
{
graph_.rectangle(::nana::rectangle{ text_pos, { str_w, line_h_pixels } }, true);
graph_.set_text_color(scheme_->selection_text.get_color());
graph_.palette(true, scheme_->selection_text.get_color());
graph_.string(text_pos, ent.begin, len);
}
else
@@ -3139,7 +3138,7 @@ namespace nana{ namespace widgets
auto head_w = std::accumulate(pxbuf, pxbuf + (a.x - pos), unsigned());
auto sel_w = std::accumulate(pxbuf + (a.x - pos), pxbuf + (endpos - pos), unsigned());
graph_.set_text_color(clr);
graph_.palette(true, clr);
if (is_right_text(ent))
{ //RTL
rtl_string(text_pos, ent.begin, len, str_w, head_w, sel_w);
@@ -3153,7 +3152,7 @@ namespace nana{ namespace widgets
//Draw selected part
graph_.rectangle(::nana::rectangle{ part_pos, { sel_w, line_h_pixels } }, true);
graph_.set_text_color(scheme_->selection_text.get_color());
graph_.palette(true, scheme_->selection_text.get_color());
graph_.string(part_pos, ent.begin + (a.x - pos), endpos - a.x);
if (static_cast<size_t>(endpos) < str_end)
@@ -3171,14 +3170,14 @@ namespace nana{ namespace widgets
if (is_right_text(ent))
{ //RTL
graph_.set_text_color(clr);
graph_.palette(true, clr);
rtl_string(text_pos, ent.begin, len, str_w, 0, sel_w);
}
else
{ //LTR
//Draw selected part
graph_.rectangle(::nana::rectangle{ text_pos, { sel_w, line_h_pixels } }, true);
graph_.set_text_color(scheme_->selection_text.get_color());
graph_.palette(true, scheme_->selection_text.get_color());
graph_.string(text_pos, ent.begin, endpos - pos);
_m_draw_parse_string(parser, false, text_pos + ::nana::point(static_cast<int>(sel_w), 0), clr, ent.begin + (endpos - pos), str_end - endpos);
@@ -3196,7 +3195,7 @@ namespace nana{ namespace widgets
unsigned str_w = graph_.text_extent_size(ent.begin, len).width;
if ((text_pos.x + static_cast<int>(str_w) > text_area_.area.x) && (text_pos.x < text_right))
{
graph_.set_text_color(clr);
graph_.palette(true, clr);
std::size_t pos = ent.begin - strbeg + str_pos.x;
if ((pos + len <= a.x) || (a.x < pos)) //Not selected or selected all
{
@@ -3204,7 +3203,7 @@ namespace nana{ namespace widgets
{
//Draw selected all
graph_.rectangle(::nana::rectangle{ text_pos, { str_w, line_h_pixels } }, true, static_cast<color_rgb>(0x3399FF));
graph_.set_text_color(scheme_->selection_text.get_color());
graph_.palette(true, scheme_->selection_text.get_color());
graph_.string(text_pos, ent.begin, len);
}
else
@@ -3225,7 +3224,7 @@ namespace nana{ namespace widgets
//Draw selected part
graph_.rectangle(::nana::rectangle{ part_pos, {str_w - head_w, line_h_pixels } }, true);
graph_.set_text_color(scheme_->selection_text.get_color());
graph_.palette(true, scheme_->selection_text.get_color());
graph_.string(part_pos, ent.begin + a.x - pos, len - (a.x - pos));
}
}
@@ -3249,12 +3248,12 @@ namespace nana{ namespace widgets
if ((text_pos.x + static_cast<int>(str_w) > text_area_.area.x) && (text_pos.x < text_right))
{
std::size_t pos = ent.begin - strbeg + str_pos.x;
graph_.set_text_color(clr);
graph_.palette(true, clr);
if (pos + len <= b.x)
{
//Draw selected part
graph_.rectangle(::nana::rectangle{ text_pos, { str_w, line_h_pixels } }, true);
graph_.set_text_color(scheme_->selection_text.get_color());
graph_.palette(true, scheme_->selection_text.get_color());
graph_.string(text_pos, ent.begin, len);
}
else if (pos <= b.x && b.x < pos + len)
@@ -3268,7 +3267,7 @@ namespace nana{ namespace widgets
{
//draw selected part
graph_.rectangle(::nana::rectangle{ text_pos, { sel_w, line_h_pixels } }, true);
graph_.set_text_color(scheme_->selection_text.get_color());
graph_.palette(true, scheme_->selection_text.get_color());
graph_.string(text_pos, ent.begin, b.x - pos);
_m_draw_parse_string(parser, false, text_pos + ::nana::point(static_cast<int>(sel_w), 0), clr, ent.begin + b.x - pos, len - (b.x - pos));

View File

@@ -50,8 +50,7 @@ namespace nana
virtual void adorn_textbox(window, graph_reference graph, const std::string& str, const nana::rectangle & r)
{
graph.rectangle(r, false, colors::white);
graph.set_text_color(colors::white);
graph.string({ r.x + 2, r.y + 1 }, str);
graph.string({ r.x + 2, r.y + 1 }, str, colors::white);
}
virtual void slider(window, graph_reference graph, const slider_t& s)

View File

@@ -1004,7 +1004,7 @@ namespace nana
if(item.text.size())
{
nana::size ts = basis_.graph->text_extent_size(item.text);
basis_.graph->set_text_color(m.fgcolor.invisible() ? fgcolor : m.fgcolor);
basis_.graph->palette(true, m.fgcolor.invisible() ? fgcolor : m.fgcolor);
nana::paint::text_renderer tr(*basis_.graph);
std::wstring wtext = to_wstring(item.text);
@@ -1030,7 +1030,7 @@ namespace nana
}
}
basis_.graph->set_color(static_cast<color_rgb>(0x808080));
basis_.graph->palette(false, static_cast<color_rgb>(0x808080));
int right = static_cast<int>(basis_.graph->width());
int end = active_m.r.x + static_cast<int>(active_m.r.width);
@@ -1453,8 +1453,8 @@ namespace nana
rectangle r{ m.pos_ends.first, 0, static_cast<unsigned>(m.pos_ends.second - m.pos_ends.first), graph.height() };
if (indexes.active_pos == pos)
{
graph.set_color(colors::white);
graph.set_text_color(colors::black);
graph.palette(false, colors::white);
graph.palette(true, colors::black);
}
else
{
@@ -1463,8 +1463,8 @@ namespace nana
if (pos == indexes.hovered_pos)
bgcolor = bgcolor.blend(colors::white, 0.5);
graph.set_color(bgcolor);
graph.set_text_color(colors::white);
graph.palette(false, bgcolor);
graph.palette(true, colors::white);
}
graph.rectangle(r, true);

View File

@@ -138,9 +138,9 @@ namespace nana
if (imgsize.width > scale) imgsize.width = scale;
if (imgsize.height > scale) imgsize.height = scale;
nana::point pos(x, y);
pos.x += static_cast<int>(scale + extra_size - imgsize.width) / 2;
pos.y += static_cast<int>(height - imgsize.height) / 2;
nana::point pos(
x + static_cast<int>(scale + extra_size - imgsize.width) / 2,
y + static_cast<int>(height - imgsize.height) / 2);
item.image.paste(::nana::rectangle{ imgsize }, graph, pos);
if(item.enable == false)
@@ -213,7 +213,7 @@ namespace nana
int x = 2, y = 2;
auto bgcolor = API::bgcolor(widget_->handle());
graph.set_text_color(bgcolor);
graph.palette(true, bgcolor);
graph.gradual_rectangle(rectangle{ graph.size() }, bgcolor.blend(colors::white, 0.9), bgcolor.blend(colors::black, 0.95), true);
item_renderer ir(graph, impl_->textout, impl_->scale, bgcolor);

View File

@@ -873,18 +873,6 @@ namespace paint
}
}
void graphics::set_color(const ::nana::color& col)
{
if (handle_)
handle_->set_color(col);
}
void graphics::set_text_color(const ::nana::color& col)
{
if (handle_)
handle_->set_text_color(col);
}
::nana::color graphics::palette(bool for_text) const
{
if (handle_)
@@ -967,7 +955,7 @@ namespace paint
void graphics::string(const point& pos, const std::string& text_utf8, const color& clr)
{
set_text_color(clr);
palette(true, clr);
string(pos, text_utf8);
}
@@ -1025,7 +1013,7 @@ namespace paint
void graphics::string(const point& pos, const ::std::wstring& text, const color& clr)
{
set_text_color(clr);
palette(true, clr);
string(pos, text.data(), text.size());
}
@@ -1050,7 +1038,7 @@ namespace paint
void graphics::line(const point& pos_a, const point& pos_b, const color& clr)
{
set_color(clr);
palette(false, clr);
line(pos_a, pos_b);
}
@@ -1085,7 +1073,7 @@ namespace paint
void graphics::rectangle(bool solid, const ::nana::color& clr)
{
set_color(clr);
palette(false, clr);
rectangle(::nana::rectangle{ size() }, solid);
}
@@ -1111,7 +1099,7 @@ namespace paint
void graphics::rectangle(const ::nana::rectangle& r, bool solid, const color& clr)
{
set_color(clr);
palette(false, clr);
rectangle(r, solid);
}

View File

@@ -158,7 +158,7 @@ namespace nana
dum_graph.bitblt(r, graph, pos);
dum_graph.set_text_color(graph.palette(true));
dum_graph.palette(true, graph.palette(true));
dum_graph.string({}, i.begin, len);
r.x = pos.x;