added slider, mouse capture in Node, desaturated icons

This commit is contained in:
2017-03-16 02:02:43 +00:00
parent c34d1a1f44
commit 011aeb8948
5 changed files with 123 additions and 27 deletions

View File

@@ -12,6 +12,9 @@ std::map<std::string, glm::vec4> NodeIcon::m_icons;
kEventResult Node::on_event(Event* e)
{
if (current_mouse_capture)
return current_mouse_capture->on_event(e);
kEventResult ret = kEventResult::Available;
for (auto it = m_children.rbegin(); it != m_children.rend(); ++it)
{
@@ -42,7 +45,7 @@ kEventResult Node::on_event(Event* e)
case kEventType::MouseDownR:
case kEventType::MouseUpL:
case kEventType::MouseUpR:
if (inside && handle_event(e) == kEventResult::Consumed)
if ((inside || m_mouse_captured) && handle_event(e) == kEventResult::Consumed)
return kEventResult::Consumed;
break;
case kEventType::MouseMove:
@@ -53,7 +56,7 @@ kEventResult Node::on_event(Event* e)
handle_event(&e2);
}
m_mouse_inside = inside;
if (inside)
if (inside || m_mouse_captured)
ret = handle_event(e);
if (inside_old == true && inside == false)
{
@@ -399,6 +402,13 @@ void Node::load_internal(const tinyxml2::XMLElement* x_node)
n->load_internal(x_child);
break;
}
case kWidget::SliderCursor:
{
auto n = new NodeSliderCursor();
add_child(n);
n->load_internal(x_child);
break;
}
case kWidget::PopupMenu:
{
auto n = new NodePopupMenu();