Merge branch 'hotfix-1.4' into develop

This commit is contained in:
Jinhao 2016-08-11 02:27:45 +08:00
commit eed3ffd5b6
4 changed files with 87 additions and 48 deletions

View File

@ -178,6 +178,16 @@ namespace nana
struct implementation; struct implementation;
std::unique_ptr<implementation> impl_; std::unique_ptr<implementation> impl_;
}; };
class draw
{
public:
draw(graphics& graph);
void corner(const rectangle& r, unsigned pixels);
private:
graphics& graph_;
};
}//end namespace paint }//end namespace paint
} //end namespace nana } //end namespace nana
#endif #endif

View File

@ -114,19 +114,15 @@ namespace nana
void item(graph_reference graph, const nana::rectangle& r, const attr& at) void item(graph_reference graph, const nana::rectangle& r, const attr& at)
{ {
if (!at.enabled)
return;
if(at.item_state == state::active) if(at.item_state == state::active)
{ {
graph.rectangle(r, false, static_cast<color_rgb>(0xa8d8eb)); graph.rectangle(r, false, static_cast<color_rgb>(0xa8d8eb));
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.palette(false, static_cast<color_rgb>(0xc0ddfc)); graph.palette(false, static_cast<color_rgb>(0xc0ddfc));
for(int i = 0; i < 4; ++i) paint::draw(graph).corner(r, 1);
graph.set_pixel(points[i].x, points[i].y);
if(at.enabled) if(at.enabled)
graph.gradual_rectangle(nana::rectangle(r).pare_off(1), static_cast<color_rgb>(0xE8F0F4), static_cast<color_rgb>(0xDBECF4), true); graph.gradual_rectangle(nana::rectangle(r).pare_off(1), static_cast<color_rgb>(0xE8F0F4), static_cast<color_rgb>(0xDBECF4), true);
@ -480,7 +476,7 @@ namespace nana
--pos; --pos;
} }
if(! menu_->items.at(pos).flags.splitter) if(! menu_->items.at(pos).flags.splitter && menu_->items.at(pos).flags.enabled)
break; break;
} }
@ -786,8 +782,7 @@ namespace nana
{ {
if (event_code::mouse_down == arg.evt_code) if (event_code::mouse_down == arg.evt_code)
_m_open_sub(0); //Try to open submenu immediately _m_open_sub(0); //Try to open submenu immediately
else if (event_code::mouse_up == arg.evt_code) else if ((event_code::mouse_up == arg.evt_code) && (mouse::left_button == arg.button))
if (arg.button == ::nana::mouse::left_button)
pick(); pick();
}; };
@ -886,11 +881,9 @@ namespace nana
return; return;
menu_item_type & item = menu->items.at(active); menu_item_type & item = menu->items.at(active);
if (item.flags.splitter == false && item.sub_menu == nullptr)
{ if ((!item.flags.enabled) || item.flags.splitter || item.sub_menu)
//There is a situation that menu will not call functor if the item style is check_option return;
//and it is checked before clicking.
bool call_functor = true;
if (checks::highlight == item.style) if (checks::highlight == item.style)
{ {
@ -923,13 +916,12 @@ namespace nana
//may create a window, which make a killing focus for menu window, if so the close_all //may create a window, which make a killing focus for menu window, if so the close_all
//operation preformences after item.functor.operator()(ip), that would be deleting this object twice! //operation preformences after item.functor.operator()(ip), that would be deleting this object twice!
if (call_functor && item.flags.enabled && item.functor) if (item.functor)
{ {
item_type::item_proxy ip(active, item); item_type::item_proxy ip(active, item);
item.functor.operator()(ip); item.functor.operator()(ip);
} }
} }
}
private: private:
//_m_destroy just destroys the children windows. //_m_destroy just destroys the children windows.
//The all window including parent windows want to be closed by calling the _m_close_all() instead of close() //The all window including parent windows want to be closed by calling the _m_close_all() instead of close()

View File

@ -2453,6 +2453,8 @@ namespace nana{ namespace widgets
} }
else else
{ {
undo_ptr->set_removed(this->_m_make_select_string());
undo_ptr->set_selected_text(); undo_ptr->set_selected_text();
points_.caret = _m_erase_select(); points_.caret = _m_erase_select();
undo_ptr->set_caret_pos(); undo_ptr->set_caret_pos();

View File

@ -1267,5 +1267,40 @@ namespace paint
} }
//end class graphics //end class graphics
//class draw
draw::draw(graphics& graph)
: graph_(graph)
{}
void draw::corner(const rectangle& r, unsigned pixels)
{
if (1 == pixels)
{
graph_.set_pixel(r.x, r.y);
graph_.set_pixel(r.right() - 1, r.y);
graph_.set_pixel(r.x, r.bottom() - 1);
graph_.set_pixel(r.right() - 1, r.bottom() - 1);
return;
}
else if (1 < pixels)
{
graph_.line(r.position(), point(r.x + pixels, r.y));
graph_.line(r.position(), point(r.x, r.y + pixels));
int right = r.right() - 1;
graph_.line(point(right, r.y), point(right - pixels, r.y));
graph_.line(point(right, r.y), point(right, r.y - pixels));
int bottom = r.bottom() - 1;
graph_.line(point(r.x, bottom), point(r.x + pixels, bottom));
graph_.line(point(r.x, bottom), point(r.x, bottom - pixels));
graph_.line(point(right, bottom), point(right - pixels, bottom));
graph_.line(point(right, bottom), point(right, bottom - pixels));
}
}
//end class draw
}//end namespace paint }//end namespace paint
}//end namespace nana }//end namespace nana