Skip to content

Commit

Permalink
Rename EventHandlers to EventHandler.
Browse files Browse the repository at this point in the history
  • Loading branch information
kovacsv committed May 29, 2020
1 parent 98fa076 commit 55055d4
Show file tree
Hide file tree
Showing 18 changed files with 219 additions and 219 deletions.
14 changes: 7 additions & 7 deletions Sources/EmbeddingTutorial/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@
#include "NUIE_NodeEditor.hpp"
#include "BI_BasicUINode.hpp"

class MyEventHandlers : public NUIE::EventHandlers
class MyEventHandler : public NUIE::EventHandler
{
public:
MyEventHandlers () :
NUIE::EventHandlers ()
MyEventHandler () :
NUIE::EventHandler ()
{

}
Expand Down Expand Up @@ -79,7 +79,7 @@ class MyNodeUIEnvironment : public NUIE::NodeUIEnvironment
stringConverter (NE::GetDefaultStringConverter ()),
skinParams (NUIE::GetDefaultSkinParams ()),
drawingContext (),
eventHandlers (),
eventHandler (),
evaluationEnv (nullptr)
{

Expand Down Expand Up @@ -130,16 +130,16 @@ class MyNodeUIEnvironment : public NUIE::NodeUIEnvironment

}

virtual NUIE::EventHandlers& GetEventHandlers () override
virtual NUIE::EventHandler& GetEventHandler () override
{
return eventHandlers;
return eventHandler;
}

private:
NE::BasicStringConverter stringConverter;
NUIE::BasicSkinParams skinParams;
NUIE::NullDrawingContext drawingContext;
MyEventHandlers eventHandlers;
MyEventHandler eventHandler;
NE::EvaluationEnv evaluationEnv;
};

Expand Down
36 changes: 18 additions & 18 deletions Sources/NodeEngineTest/VisualTestFramework.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -108,15 +108,15 @@ class MyCreateNodeCommand : public NUIE::SingleMenuCommand
NUIE::Point position;
};

TestEventHandlers::TestEventHandlers (NodeEditor* nodeEditor) :
TestEventHandler::TestEventHandler (NodeEditor* nodeEditor) :
nodeEditor (nodeEditor),
commandToSelect (),
paramSettingsHandler (nullptr)
{

}

MenuCommandPtr TestEventHandlers::OnContextMenu (const Point& position, const MenuCommandStructure& commands)
MenuCommandPtr TestEventHandler::OnContextMenu (const Point& position, const MenuCommandStructure& commands)
{
NUIE::MenuCommandStructure actualCommands = commands;
NUIE::GroupMenuCommandPtr createCommandGroup (new NUIE::GroupMenuCommand (L"Add Node"));
Expand All @@ -131,32 +131,32 @@ MenuCommandPtr TestEventHandlers::OnContextMenu (const Point& position, const Me
return SelectCommandByName (actualCommands);
}

MenuCommandPtr TestEventHandlers::OnContextMenu (const Point&, const UINodePtr&, const MenuCommandStructure& commands)
MenuCommandPtr TestEventHandler::OnContextMenu (const Point&, const UINodePtr&, const MenuCommandStructure& commands)
{
return SelectCommandByName (commands);
}

MenuCommandPtr TestEventHandlers::OnContextMenu (const Point&, const UIOutputSlotConstPtr&, const MenuCommandStructure& commands)
MenuCommandPtr TestEventHandler::OnContextMenu (const Point&, const UIOutputSlotConstPtr&, const MenuCommandStructure& commands)
{
return SelectCommandByName (commands);
}

MenuCommandPtr TestEventHandlers::OnContextMenu (const Point&, const UIInputSlotConstPtr&, const MenuCommandStructure& commands)
MenuCommandPtr TestEventHandler::OnContextMenu (const Point&, const UIInputSlotConstPtr&, const MenuCommandStructure& commands)
{
return SelectCommandByName (commands);
}

MenuCommandPtr TestEventHandlers::OnContextMenu (const Point&, const UINodeGroupPtr&, const MenuCommandStructure& commands)
MenuCommandPtr TestEventHandler::OnContextMenu (const Point&, const UINodeGroupPtr&, const MenuCommandStructure& commands)
{
return SelectCommandByName (commands);
}

void TestEventHandlers::OnDoubleClick (const Point&)
void TestEventHandler::OnDoubleClick (const Point&)
{

}

bool TestEventHandlers::OnParameterSettings (ParameterInterfacePtr paramInterface, const UINodePtr&)
bool TestEventHandler::OnParameterSettings (ParameterInterfacePtr paramInterface, const UINodePtr&)
{
if (DBGERROR (paramSettingsHandler == nullptr)) {
return false;
Expand All @@ -166,7 +166,7 @@ bool TestEventHandlers::OnParameterSettings (ParameterInterfacePtr paramInterfac
return result;
}

bool TestEventHandlers::OnParameterSettings (ParameterInterfacePtr paramInterface, const UINodeGroupPtr&)
bool TestEventHandler::OnParameterSettings (ParameterInterfacePtr paramInterface, const UINodeGroupPtr&)
{
if (DBGERROR (paramSettingsHandler == nullptr)) {
return false;
Expand All @@ -176,19 +176,19 @@ bool TestEventHandlers::OnParameterSettings (ParameterInterfacePtr paramInterfac
return result;
}

void TestEventHandlers::SetNextCommandName (const std::wstring& nextCommandName)
void TestEventHandler::SetNextCommandName (const std::wstring& nextCommandName)
{
DBGASSERT (commandToSelect.empty ());
commandToSelect = nextCommandName;
}

void TestEventHandlers::SetNextCommandParameterSettings (const ParameterSettingsHandler& handler)
void TestEventHandler::SetNextCommandParameterSettings (const ParameterSettingsHandler& handler)
{
SetNextCommandName (L"Node Settings");
paramSettingsHandler = handler;
}

MenuCommandPtr TestEventHandlers::SelectCommandByName (const MenuCommandStructure& commands)
MenuCommandPtr TestEventHandler::SelectCommandByName (const MenuCommandStructure& commands)
{
DBGASSERT (!commandToSelect.empty ());
MenuCommandPtr selectedCommand = nullptr;
Expand All @@ -202,7 +202,7 @@ MenuCommandPtr TestEventHandlers::SelectCommandByName (const MenuCommandStructur
return selectedCommand;
}

MenuCommandPtr TestEventHandlers::SelectCommandByName (const MenuCommandPtr& command)
MenuCommandPtr TestEventHandler::SelectCommandByName (const MenuCommandPtr& command)
{
if (command->HasChildCommands ()) {
MenuCommandPtr foundCommand = nullptr;
Expand All @@ -226,7 +226,7 @@ TestNodeUIEnvironment::TestNodeUIEnvironment (NodeEditor& nodeEditor, const Basi
stringConverter (GetDefaultStringConverter ()),
skinParams (skinParams),
drawingContext (800, 600),
eventHandlers (&nodeEditor),
eventHandler (&nodeEditor),
evaluationEnv (nullptr),
windowScale (1.0)
{
Expand Down Expand Up @@ -278,19 +278,19 @@ void TestNodeUIEnvironment::OnRedrawRequested ()
nodeEditor.Draw ();
}

EventHandlers& TestNodeUIEnvironment::GetEventHandlers ()
EventHandler& TestNodeUIEnvironment::GetEventHandler ()
{
return eventHandlers;
return eventHandler;
}

void TestNodeUIEnvironment::SetNextCommandName (const std::wstring& nextCommandName)
{
eventHandlers.SetNextCommandName (nextCommandName);
eventHandler.SetNextCommandName (nextCommandName);
}

void TestNodeUIEnvironment::SetNextCommandParameterSettings (const ParameterSettingsHandler& handler)
{
eventHandlers.SetNextCommandParameterSettings (handler);
eventHandler.SetNextCommandParameterSettings (handler);
}

const SvgDrawingContext& TestNodeUIEnvironment::GetSvgDrawingContext () const
Expand Down
10 changes: 5 additions & 5 deletions Sources/NodeEngineTest/VisualTestFramework.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

#include "NE_StringConverter.hpp"
#include "NE_EvaluationEnv.hpp"
#include "NUIE_EventHandlers.hpp"
#include "NUIE_EventHandler.hpp"
#include "NUIE_NodeEditor.hpp"
#include "NUIE_SvgDrawingContext.hpp"

Expand All @@ -12,10 +12,10 @@ using namespace NUIE;

using ParameterSettingsHandler = std::function<bool (ParameterInterfacePtr)>;

class TestEventHandlers : public EventHandlers
class TestEventHandler : public EventHandler
{
public:
TestEventHandlers (NodeEditor* nodeEditor);
TestEventHandler (NodeEditor* nodeEditor);

virtual MenuCommandPtr OnContextMenu (const Point&, const MenuCommandStructure&) override;
virtual MenuCommandPtr OnContextMenu (const Point&, const UINodePtr&, const MenuCommandStructure&) override;
Expand Down Expand Up @@ -52,7 +52,7 @@ class TestNodeUIEnvironment : public NodeUIEnvironment
virtual void OnEvaluationEnd () override;
virtual void OnValuesRecalculated () override;
virtual void OnRedrawRequested () override;
virtual EventHandlers& GetEventHandlers () override;
virtual EventHandler& GetEventHandler () override;

void SetNextCommandName (const std::wstring& nextCommandName);
void SetNextCommandParameterSettings (const ParameterSettingsHandler& handler);
Expand All @@ -65,7 +65,7 @@ class TestNodeUIEnvironment : public NodeUIEnvironment
BasicStringConverter stringConverter;
BasicSkinParams skinParams;
SvgDrawingContext drawingContext;
TestEventHandlers eventHandlers;
TestEventHandler eventHandler;
EvaluationEnv evaluationEnv;
double windowScale;
};
Expand Down
64 changes: 64 additions & 0 deletions Sources/NodeUIEngine/NUIE_EventHandler.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
#include "NUIE_EventHandler.hpp"

namespace NUIE
{

EventHandler::EventHandler ()
{

}

EventHandler::~EventHandler ()
{

}

NullEventHandler::NullEventHandler ()
{
}

NullEventHandler::~NullEventHandler ()
{
}

NUIE::MenuCommandPtr NullEventHandler::OnContextMenu (const Point&, const MenuCommandStructure&)
{
return nullptr;
}

NUIE::MenuCommandPtr NullEventHandler::OnContextMenu (const Point&, const UINodePtr&, const MenuCommandStructure&)
{
return nullptr;
}

NUIE::MenuCommandPtr NullEventHandler::OnContextMenu (const Point&, const UIOutputSlotConstPtr&, const MenuCommandStructure&)
{
return nullptr;
}

NUIE::MenuCommandPtr NullEventHandler::OnContextMenu (const Point&, const UIInputSlotConstPtr&, const MenuCommandStructure&)
{
return NUIE::MenuCommandPtr ();
}

NUIE::MenuCommandPtr NullEventHandler::OnContextMenu (const Point&, const UINodeGroupPtr&, const MenuCommandStructure&)
{
return nullptr;
}

void NullEventHandler::OnDoubleClick (const Point&)
{

}

bool NullEventHandler::OnParameterSettings (ParameterInterfacePtr, const UINodePtr&)
{
return false;
}

bool NullEventHandler::OnParameterSettings (ParameterInterfacePtr, const UINodeGroupPtr&)
{
return false;
}

}
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#ifndef NUIE_EVENTHANDLERS_HPP
#define NUIE_EVENTHANDLERS_HPP
#ifndef NUIE_EVENTHANDLER_HPP
#define NUIE_EVENTHANDLER_HPP

#include "NUIE_UINode.hpp"
#include "NUIE_UINodeGroup.hpp"
Expand All @@ -12,11 +12,11 @@ namespace NUIE

class NodeUIManager;

class EventHandlers
class EventHandler
{
public:
EventHandlers ();
virtual ~EventHandlers ();
EventHandler ();
virtual ~EventHandler ();

virtual NUIE::MenuCommandPtr OnContextMenu (const Point& position, const MenuCommandStructure& commands) = 0;
virtual NUIE::MenuCommandPtr OnContextMenu (const Point& position, const UINodePtr& uiNode, const MenuCommandStructure& commands) = 0;
Expand All @@ -28,14 +28,14 @@ class EventHandlers
virtual bool OnParameterSettings (ParameterInterfacePtr paramAccessor, const UINodeGroupPtr& uiGroup) = 0;
};

using EventHandlersPtr = std::shared_ptr<EventHandlers>;
using EventHandlersConstPtr = std::shared_ptr<const EventHandlers>;
using EventHandlerPtr = std::shared_ptr<EventHandler>;
using EventHandlerConstPtr = std::shared_ptr<const EventHandler>;

class NullEventHandlers : public EventHandlers
class NullEventHandler : public EventHandler
{
public:
NullEventHandlers ();
virtual ~NullEventHandlers ();
NullEventHandler ();
virtual ~NullEventHandler ();

virtual NUIE::MenuCommandPtr OnContextMenu (const Point& position, const MenuCommandStructure& commands) override;
virtual NUIE::MenuCommandPtr OnContextMenu (const Point& position, const UINodePtr& uiNode, const MenuCommandStructure& commands) override;
Expand Down
64 changes: 0 additions & 64 deletions Sources/NodeUIEngine/NUIE_EventHandlers.cpp

This file was deleted.

Loading

0 comments on commit 55055d4

Please sign in to comment.