Enigma  3.2.0
A Simple, Reliable and Efficient Encryption Tool
ApplicationEvent.hpp
Go to the documentation of this file.
1 #pragma once
2 #ifndef ENIGMA_APPLICATION_EVENT_H
3 #define ENIGMA_APPLICATION_EVENT_H
4 
5 #include <Core/Core.hpp>
6 #include <Core/Types.hpp>
7 #include <Utility/FileUtils.hpp> // fs::path
8 #include <sstream>
9 
10 #include "Event.hpp"
11 
13 
15 class WindowResizeEvent : public Event {
16  public:
17  WindowResizeEvent(const std::int32_t width, const std::int32_t height)
18  : m_width(width),
19  m_height(height) {}
20 
21  std::int32_t GetWidth() const noexcept { return m_width; }
22  std::int32_t GetHeight() const noexcept { return m_height; }
23 
24  std::string ToString() const override {
25  std::ostringstream ss;
26  ss << "WindowResizeEvent: " << m_width << ", " << m_height;
27  return ss.str();
28  }
29 
32 
33 
34  private:
35  std::int32_t m_width, m_height;
36 };
37 
39 class FrameBufferResizeEvent : public Event {
40  public:
41  FrameBufferResizeEvent(const std::int32_t width, const std::int32_t height)
42  : m_width(width),
43  m_height(height) {}
44 
45  std::int32_t GetWidth() const noexcept { return m_width; }
46  std::int32_t GetHeight() const noexcept { return m_height; }
47 
48  std::string ToString() const override {
49  std::ostringstream ss;
50  ss << "FrameBufferResizeEvent: " << m_width << ", " << m_height;
51  return ss.str();
52  }
53 
56 
57 
58  private:
59  std::int32_t m_width, m_height;
60 };
61 
63 class WindowMoveEvent : public Event {
64  public:
65  WindowMoveEvent(const std::int32_t x, const std::int32_t y)
66  : m_xPos(x),
67  m_yPos(y) {}
68 
69  std::int32_t GetTopLeftX() const noexcept { return m_xPos; }
70  std::int32_t GetTopLeftY() const noexcept { return m_yPos; }
71 
72  std::string ToString() const override {
73  std::ostringstream ss;
74  ss << "WindowMoveEvent: (" << m_xPos << ", " << m_yPos << ")";
75  return ss.str();
76  }
77 
80 
81  private:
82  std::int32_t m_xPos, m_yPos;
83 };
84 
86 class WindowMaximizedEvent : public Event {
87  public:
88  explicit WindowMaximizedEvent(const bool maximized)
89  : m_isMaximized(maximized) {}
90 
91  bool IsMaximized() const noexcept { return m_isMaximized; }
92 
93  std::string ToString() const override {
94  if (m_isMaximized)
95  return std::string("WindowMaximizeEvent: maximized");
96  return std::string("WindowMaximizeEvent: unmaximized");
97  }
98 
101 
102  private:
103  bool m_isMaximized;
104 };
105 
107 class WindowFocusLostEvent : public Event {
108  public:
112 };
113 
115 class WindowFocusEvent : public Event {
116  public:
120 };
121 
123 class WindowCloseEvent : public Event {
124  public:
126 
129 };
130 
132 class WindowFileDropEvent : public Event {
133  public:
134  explicit WindowFileDropEvent(const std::vector<fs::path>& filenames)
135  : m_filenames(filenames) {}
136 
137  const std::vector<fs::path>& GetFilenames() const noexcept { return m_filenames; }
138 
141 
142  private:
143  std::vector<fs::path> m_filenames;
144 };
145 
147 class AppUpdateEvent : public Event {
148  public:
150 
153 };
154 
156 class AppRenderEvent : public Event {
157  public:
159 
162 };
163 
165 class AppTickEvent : public Event {
166  public:
168 
171 };
172 
173 
175 
176 #endif // !ENIGMA_APPLICATION_EVENT_H
@ WINDOW_LOST_FOCUS
@ FRAME_BUFFER_RESIZE
@ WINDOW_FILE_DROP
@ WINDOW_MAXIMIZED
#define NS_ENIGMA_BEGIN
Enable/Disable Assertions.
Definition: Macros.hpp:13
#define NS_ENIGMA_END
Definition: Macros.hpp:14
EVENT_CLASS_TYPE(EventType::APP_RENDER)
EVENT_CLASS_CATEGORY(EventCategory::APPLICATION)
EVENT_CLASS_TYPE(EventType::APP_TICK)
EVENT_CLASS_CATEGORY(EventCategory::APPLICATION)
EVENT_CLASS_CATEGORY(EventCategory::APPLICATION)
EVENT_CLASS_TYPE(EventType::APP_UPDATE)
Definition: Event.hpp:66
std::int32_t GetWidth() const noexcept
std::int32_t GetHeight() const noexcept
std::string ToString() const override
FrameBufferResizeEvent(const std::int32_t width, const std::int32_t height)
EVENT_CLASS_CATEGORY(EventCategory::APPLICATION)
EVENT_CLASS_TYPE(EventType::FRAME_BUFFER_RESIZE)
EVENT_CLASS_TYPE(EventType::WINDOW_CLOSE)
EVENT_CLASS_CATEGORY(EventCategory::APPLICATION)
WindowFileDropEvent(const std::vector< fs::path > &filenames)
EVENT_CLASS_TYPE(EventType::WINDOW_FILE_DROP)
const std::vector< fs::path > & GetFilenames() const noexcept
EVENT_CLASS_CATEGORY(EventCategory::APPLICATION)
EVENT_CLASS_CATEGORY(EventCategory::APPLICATION)
EVENT_CLASS_TYPE(EventType::WINDOW_FOCUS)
EVENT_CLASS_CATEGORY(EventCategory::APPLICATION)
EVENT_CLASS_TYPE(EventType::WINDOW_LOST_FOCUS)
EVENT_CLASS_CATEGORY(EventCategory::APPLICATION)
bool IsMaximized() const noexcept
std::string ToString() const override
WindowMaximizedEvent(const bool maximized)
EVENT_CLASS_TYPE(EventType::WINDOW_MAXIMIZED)
std::string ToString() const override
std::int32_t GetTopLeftX() const noexcept
std::int32_t GetTopLeftY() const noexcept
EVENT_CLASS_CATEGORY(EventCategory::APPLICATION)
WindowMoveEvent(const std::int32_t x, const std::int32_t y)
EVENT_CLASS_TYPE(EventType::WINDOW_MOVED)
WindowResizeEvent(const std::int32_t width, const std::int32_t height)
EVENT_CLASS_TYPE(EventType::WINDOW_RESIZE)
EVENT_CLASS_CATEGORY(EventCategory::APPLICATION)
std::int32_t GetHeight() const noexcept
std::int32_t GetWidth() const noexcept
std::string ToString() const override