refactor layout.h into single file per Node* classes
This commit is contained in:
51
engine/node_popup_menu.cpp
Normal file
51
engine/node_popup_menu.cpp
Normal file
@@ -0,0 +1,51 @@
|
||||
#include "pch.h"
|
||||
#include "log.h"
|
||||
#include "node_popup_menu.h"
|
||||
|
||||
Node* NodePopupMenu::clone_instantiate() const
|
||||
{
|
||||
return new NodePopupMenu();
|
||||
}
|
||||
|
||||
void NodePopupMenu::init()
|
||||
{
|
||||
m_flood_events = true;
|
||||
SetPosition(0, 0);
|
||||
SetWidth(100);
|
||||
SetHeight(400);
|
||||
SetPositioning(YGPositionTypeAbsolute);
|
||||
m_mouse_ignore = false;
|
||||
}
|
||||
|
||||
kEventResult NodePopupMenu::handle_event(Event* e)
|
||||
{
|
||||
switch (e->m_type)
|
||||
{
|
||||
case kEventType::MouseDownL:
|
||||
break;
|
||||
case kEventType::MouseUpL:
|
||||
if (!m_mouse_inside)
|
||||
{
|
||||
mouse_release();
|
||||
}
|
||||
else
|
||||
{
|
||||
for (int i = 0; i < m_children.size(); i++)
|
||||
{
|
||||
if (m_children[i]->m_mouse_inside)
|
||||
{
|
||||
if (on_select)
|
||||
on_select(this, i);
|
||||
break;
|
||||
}
|
||||
}
|
||||
mouse_release();
|
||||
}
|
||||
destroy();
|
||||
break;
|
||||
default:
|
||||
return kEventResult::Available;
|
||||
break;
|
||||
}
|
||||
return kEventResult::Consumed;
|
||||
}
|
||||
Reference in New Issue
Block a user