52 lines
1.0 KiB
C++
52 lines
1.0 KiB
C++
#include "GUINodePort.h"
|
|
#include <gui/GUIOverlay.h>
|
|
|
|
GUINodePort::GUINodePort()
|
|
:input_mode(false)
|
|
{
|
|
allowDrop = true;
|
|
allowDrag = true;
|
|
can_drag = false;
|
|
}
|
|
GUINodePort::~GUINodePort()
|
|
{
|
|
}
|
|
void GUINodePort::FinishDrag()
|
|
{
|
|
}
|
|
bool GUINodePort::DragEnter(DragInfo* info)
|
|
{
|
|
if(this->input_mode == true && info->Name == STR("Shader_Output"))
|
|
return true;
|
|
if(this->input_mode == false && info->Name == STR("Shader_Input"))
|
|
return true;
|
|
return false;
|
|
}
|
|
void GUINodePort::AcceptDrop(DragInfo* info)
|
|
{
|
|
Event_Link.Invoke(this, reinterpret_cast<GUINodePort*>(info->data));
|
|
}
|
|
void GUINodePort::OnMouseMove(int abs_x, int abs_y, int rel_x, int rel_y)
|
|
{
|
|
if(can_drag)
|
|
{
|
|
can_drag = false;
|
|
if(input_mode)
|
|
info.Name = STR("Shader_Input");
|
|
else
|
|
info.Name = STR("Shader_Output");
|
|
|
|
info.data = this;
|
|
FindOverlay()->BeginDrag(this, &info);
|
|
}
|
|
else
|
|
{
|
|
GUIPlane::OnMouseMove(abs_x, abs_y, rel_x, rel_y);
|
|
}
|
|
}
|
|
|
|
void GUINodePort::OnMousePress(int x, int y, int key)
|
|
{
|
|
can_drag = true;
|
|
GUIPlane::OnMousePress(x, y, key);
|
|
} |