Clean project structure.
This commit is contained in:
parent
78a4fa99ff
commit
947bf937fd
496 changed files with 206 additions and 137 deletions
54
src/ui/ui_elements/ui_events/KeyboardEvent.cpp
Normal file
54
src/ui/ui_elements/ui_events/KeyboardEvent.cpp
Normal file
|
@ -0,0 +1,54 @@
|
|||
#include "KeyboardEvent.h"
|
||||
|
||||
KeyboardEvent::KeyboardEvent()
|
||||
: UiEvent(),
|
||||
mAction(),
|
||||
mKeyString()
|
||||
{
|
||||
mType = UiEvent::Type::Keyboard;
|
||||
}
|
||||
|
||||
KeyboardEvent::~KeyboardEvent()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
std::unique_ptr<KeyboardEvent> KeyboardEvent::Create()
|
||||
{
|
||||
return std::make_unique<KeyboardEvent>();
|
||||
}
|
||||
|
||||
void KeyboardEvent::setKeyString(const std::string& key)
|
||||
{
|
||||
mKeyString = key;
|
||||
}
|
||||
|
||||
std::string KeyboardEvent::getKeyString() const
|
||||
{
|
||||
return mKeyString;
|
||||
}
|
||||
|
||||
void KeyboardEvent::setAction(Action action)
|
||||
{
|
||||
mAction = action;
|
||||
}
|
||||
|
||||
KeyboardEvent::Action KeyboardEvent::getAction() const
|
||||
{
|
||||
return mAction;
|
||||
}
|
||||
|
||||
bool KeyboardEvent::isFunctionKey() const
|
||||
{
|
||||
return mFunction != Keyboard::Function::UNSET;
|
||||
}
|
||||
|
||||
Keyboard::Function KeyboardEvent::getFunction() const
|
||||
{
|
||||
return mFunction;
|
||||
}
|
||||
|
||||
void KeyboardEvent::setFunction(Keyboard::Function function)
|
||||
{
|
||||
mFunction = function;
|
||||
}
|
47
src/ui/ui_elements/ui_events/KeyboardEvent.h
Normal file
47
src/ui/ui_elements/ui_events/KeyboardEvent.h
Normal file
|
@ -0,0 +1,47 @@
|
|||
#pragma once
|
||||
|
||||
#include <memory>
|
||||
#include <string>
|
||||
|
||||
#include "UiEvent.h"
|
||||
#include "Keyboard.h"
|
||||
|
||||
class KeyboardEvent : public UiEvent
|
||||
{
|
||||
public:
|
||||
enum class Action
|
||||
{
|
||||
Pressed,
|
||||
Released
|
||||
};
|
||||
|
||||
public:
|
||||
|
||||
KeyboardEvent();
|
||||
|
||||
~KeyboardEvent();
|
||||
|
||||
static std::unique_ptr<KeyboardEvent> Create();
|
||||
|
||||
void setKeyString(const std::string& key);
|
||||
|
||||
std::string getKeyString() const;
|
||||
|
||||
void setAction(Action action);
|
||||
|
||||
Action getAction() const;
|
||||
|
||||
bool isFunctionKey() const;
|
||||
|
||||
Keyboard::Function getFunction() const;
|
||||
|
||||
void setFunction(Keyboard::Function function);
|
||||
|
||||
private:
|
||||
|
||||
Keyboard::Function mFunction{Keyboard::Function::UNSET};
|
||||
Action mAction;
|
||||
std::string mKeyString;
|
||||
|
||||
};
|
||||
using KeyboardEventUPtr = std::unique_ptr<KeyboardEvent>;
|
51
src/ui/ui_elements/ui_events/MouseEvent.cpp
Normal file
51
src/ui/ui_elements/ui_events/MouseEvent.cpp
Normal file
|
@ -0,0 +1,51 @@
|
|||
#include "MouseEvent.h"
|
||||
|
||||
MouseEvent::MouseEvent()
|
||||
: UiEvent(),
|
||||
mClientLocation(0, 0),
|
||||
mScreenLocation(0, 0),
|
||||
mAction()
|
||||
{
|
||||
mType = UiEvent::Type::Mouse;
|
||||
}
|
||||
|
||||
MouseEvent::~MouseEvent()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
std::unique_ptr<MouseEvent> MouseEvent::Create()
|
||||
{
|
||||
return std::make_unique<MouseEvent>();
|
||||
}
|
||||
|
||||
void MouseEvent::setClientLocation(Pixel location)
|
||||
{
|
||||
mClientLocation = location;
|
||||
}
|
||||
|
||||
void MouseEvent::setScreenLocation(Pixel location)
|
||||
{
|
||||
mScreenLocation = location;
|
||||
}
|
||||
|
||||
void MouseEvent::setAction(MouseEvent::Action action)
|
||||
{
|
||||
mAction = action;
|
||||
}
|
||||
|
||||
Pixel MouseEvent::getClientLocation() const
|
||||
{
|
||||
return mClientLocation;
|
||||
}
|
||||
|
||||
Pixel MouseEvent::getScreenLocation() const
|
||||
{
|
||||
return mScreenLocation;
|
||||
}
|
||||
|
||||
MouseEvent::Action MouseEvent::getAction() const
|
||||
{
|
||||
return mAction;
|
||||
}
|
||||
|
42
src/ui/ui_elements/ui_events/MouseEvent.h
Normal file
42
src/ui/ui_elements/ui_events/MouseEvent.h
Normal file
|
@ -0,0 +1,42 @@
|
|||
#pragma once
|
||||
|
||||
#include <memory>
|
||||
|
||||
#include "DiscretePoint.h"
|
||||
#include "UiEvent.h"
|
||||
|
||||
class MouseEvent : public UiEvent
|
||||
{
|
||||
public:
|
||||
enum class Action
|
||||
{
|
||||
Pressed,
|
||||
Released
|
||||
};
|
||||
|
||||
public:
|
||||
|
||||
MouseEvent();
|
||||
|
||||
~MouseEvent();
|
||||
|
||||
static std::unique_ptr<MouseEvent> Create();
|
||||
|
||||
Pixel getClientLocation() const;
|
||||
|
||||
Pixel getScreenLocation() const;
|
||||
|
||||
Action getAction() const;
|
||||
|
||||
void setClientLocation(Pixel location);
|
||||
|
||||
void setScreenLocation(Pixel location);
|
||||
|
||||
void setAction(Action action);
|
||||
|
||||
private:
|
||||
Pixel mClientLocation;
|
||||
Pixel mScreenLocation;
|
||||
Action mAction;
|
||||
};
|
||||
using MouseEventUPtr = std::unique_ptr<MouseEvent>;
|
18
src/ui/ui_elements/ui_events/PaintEvent.cpp
Normal file
18
src/ui/ui_elements/ui_events/PaintEvent.cpp
Normal file
|
@ -0,0 +1,18 @@
|
|||
#include "PaintEvent.h"
|
||||
|
||||
PaintEvent::PaintEvent()
|
||||
: UiEvent()
|
||||
{
|
||||
mType = UiEvent::Type::Paint;
|
||||
}
|
||||
|
||||
PaintEvent::~PaintEvent()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
std::unique_ptr<PaintEvent> PaintEvent::Create()
|
||||
{
|
||||
return std::make_unique<PaintEvent>();
|
||||
}
|
||||
|
16
src/ui/ui_elements/ui_events/PaintEvent.h
Normal file
16
src/ui/ui_elements/ui_events/PaintEvent.h
Normal file
|
@ -0,0 +1,16 @@
|
|||
#pragma once
|
||||
|
||||
#include <memory>
|
||||
|
||||
#include "UiEvent.h"
|
||||
|
||||
class PaintEvent : public UiEvent
|
||||
{
|
||||
public:
|
||||
PaintEvent();
|
||||
|
||||
~PaintEvent();
|
||||
|
||||
static std::unique_ptr<PaintEvent> Create();
|
||||
};
|
||||
using PaintEventUPtr = std::unique_ptr<PaintEvent>;
|
20
src/ui/ui_elements/ui_events/ResizeEvent.cpp
Normal file
20
src/ui/ui_elements/ui_events/ResizeEvent.cpp
Normal file
|
@ -0,0 +1,20 @@
|
|||
#include "ResizeEvent.h"
|
||||
|
||||
ResizeEvent::ResizeEvent(unsigned width, unsigned height)
|
||||
: UiEvent(),
|
||||
mWidth(width),
|
||||
mHeight(height)
|
||||
{
|
||||
mType = UiEvent::Type::Resize;
|
||||
}
|
||||
|
||||
ResizeEvent::~ResizeEvent()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
std::unique_ptr<ResizeEvent> ResizeEvent::Create(unsigned width, unsigned height)
|
||||
{
|
||||
return std::make_unique<ResizeEvent>(width, height);
|
||||
}
|
||||
|
30
src/ui/ui_elements/ui_events/ResizeEvent.h
Normal file
30
src/ui/ui_elements/ui_events/ResizeEvent.h
Normal file
|
@ -0,0 +1,30 @@
|
|||
#pragma once
|
||||
|
||||
#include <memory>
|
||||
|
||||
#include "UiEvent.h"
|
||||
|
||||
class ResizeEvent : public UiEvent
|
||||
{
|
||||
public:
|
||||
ResizeEvent(unsigned width, unsigned height);
|
||||
|
||||
~ResizeEvent();
|
||||
|
||||
static std::unique_ptr<ResizeEvent> Create(unsigned width, unsigned height);
|
||||
|
||||
unsigned getWidth() const
|
||||
{
|
||||
return mWidth;
|
||||
}
|
||||
|
||||
unsigned getHeight() const
|
||||
{
|
||||
return mHeight;
|
||||
}
|
||||
|
||||
private:
|
||||
unsigned mWidth{0};
|
||||
unsigned mHeight{0};
|
||||
};
|
||||
using ResizeEventPtr = std::unique_ptr<ResizeEvent>;
|
23
src/ui/ui_elements/ui_events/UiEvent.cpp
Normal file
23
src/ui/ui_elements/ui_events/UiEvent.cpp
Normal file
|
@ -0,0 +1,23 @@
|
|||
#include "UiEvent.h"
|
||||
|
||||
UiEvent::UiEvent()
|
||||
: mType(Type::Unknown)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
UiEvent::~UiEvent()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
std::unique_ptr<UiEvent> UiEvent::Create()
|
||||
{
|
||||
return std::make_unique<UiEvent>();
|
||||
}
|
||||
|
||||
UiEvent::Type UiEvent::GetType() const
|
||||
{
|
||||
return mType;
|
||||
}
|
||||
|
30
src/ui/ui_elements/ui_events/UiEvent.h
Normal file
30
src/ui/ui_elements/ui_events/UiEvent.h
Normal file
|
@ -0,0 +1,30 @@
|
|||
#pragma once
|
||||
|
||||
#include <memory>
|
||||
|
||||
class UiEvent
|
||||
{
|
||||
public:
|
||||
|
||||
enum class Type{
|
||||
Unknown,
|
||||
Paint,
|
||||
Mouse,
|
||||
Keyboard,
|
||||
Resize
|
||||
};
|
||||
|
||||
protected:
|
||||
UiEvent::Type mType;
|
||||
|
||||
public:
|
||||
|
||||
UiEvent();
|
||||
|
||||
virtual ~UiEvent();
|
||||
|
||||
static std::unique_ptr<UiEvent> Create();
|
||||
|
||||
Type GetType() const;
|
||||
};
|
||||
using UiEventUPtr = std::unique_ptr<UiEvent>;
|
Loading…
Add table
Add a link
Reference in a new issue