Browse Source

Platform: make ViewportEvent non-copyable, mark internals as const.

pull/308/head
Vladimír Vondruš 7 years ago
parent
commit
d4c1785dc0
  1. 14
      src/Magnum/Platform/AbstractXApplication.h
  2. 16
      src/Magnum/Platform/AndroidApplication.h
  3. 25
      src/Magnum/Platform/GlfwApplication.h
  4. 32
      src/Magnum/Platform/Sdl2Application.h

14
src/Magnum/Platform/AbstractXApplication.h

@ -386,6 +386,18 @@ class AbstractXApplication::Configuration {
*/
class AbstractXApplication::ViewportEvent {
public:
/** @brief Copying is not allowed */
ViewportEvent(const ViewportEvent&) = delete;
/** @brief Moving is not allowed */
ViewportEvent(ViewportEvent&&) = delete;
/** @brief Copying is not allowed */
ViewportEvent& operator=(const ViewportEvent&) = delete;
/** @brief Moving is not allowed */
ViewportEvent& operator=(ViewportEvent&&) = delete;
/**
* @brief Window size
*
@ -407,7 +419,7 @@ class AbstractXApplication::ViewportEvent {
explicit ViewportEvent(const Vector2i& size): _size{size} {}
Vector2i _size;
const Vector2i _size;
};
/**

16
src/Magnum/Platform/AndroidApplication.h

@ -581,6 +581,18 @@ class AndroidApplication::Configuration {
*/
class AndroidApplication::ViewportEvent {
public:
/** @brief Copying is not allowed */
ViewportEvent(const ViewportEvent&) = delete;
/** @brief Moving is not allowed */
ViewportEvent(ViewportEvent&&) = delete;
/** @brief Copying is not allowed */
ViewportEvent& operator=(const ViewportEvent&) = delete;
/** @brief Moving is not allowed */
ViewportEvent& operator=(ViewportEvent&&) = delete;
/**
* @brief Window size
*
@ -609,7 +621,7 @@ class AndroidApplication::ViewportEvent {
explicit ViewportEvent(const Vector2i& windowSize): _windowSize{windowSize} {}
Vector2i _windowSize;
const Vector2i _windowSize;
};
/**
@ -651,7 +663,7 @@ class AndroidApplication::InputEvent {
~InputEvent() = default;
AInputEvent* _event;
AInputEvent* const _event;
#endif
private:

25
src/Magnum/Platform/GlfwApplication.h

@ -1180,6 +1180,18 @@ class GlfwApplication::ExitEvent {
*/
class GlfwApplication::ViewportEvent {
public:
/** @brief Copying is not allowed */
ViewportEvent(const ViewportEvent&) = delete;
/** @brief Moving is not allowed */
ViewportEvent(ViewportEvent&&) = delete;
/** @brief Copying is not allowed */
ViewportEvent& operator=(const ViewportEvent&) = delete;
/** @brief Moving is not allowed */
ViewportEvent& operator=(ViewportEvent&&) = delete;
/**
* @brief Window size
*
@ -1216,8 +1228,9 @@ class GlfwApplication::ViewportEvent {
explicit ViewportEvent(const Vector2i& windowSize, const Vector2i& framebufferSize, const Vector2& dpiScaling): _windowSize{windowSize}, _framebufferSize{framebufferSize}, _dpiScaling{dpiScaling} {}
Vector2i _windowSize, _framebufferSize;
Vector2 _dpiScaling;
const Vector2i _windowSize;
const Vector2i _framebufferSize;
const Vector2 _dpiScaling;
};
/**
@ -1624,9 +1637,9 @@ class GlfwApplication::MouseMoveEvent: public GlfwApplication::InputEvent {
private:
explicit MouseMoveEvent(GLFWwindow* window, const Vector2i& position): _window{window}, _position{position} {}
GLFWwindow* _window;
Containers::Optional<Buttons> _buttons;
GLFWwindow* const _window;
const Vector2i _position;
Containers::Optional<Buttons> _buttons;
Containers::Optional<Modifiers> _modifiers;
};
@ -1659,7 +1672,7 @@ class GlfwApplication::MouseScrollEvent: public GlfwApplication::InputEvent {
private:
explicit MouseScrollEvent(GLFWwindow* window, const Vector2& offset): _window{window}, _offset{offset} {}
GLFWwindow* _window;
GLFWwindow* const _window;
const Vector2 _offset;
Containers::Optional<Vector2i> _position;
Containers::Optional<Modifiers> _modifiers;
@ -1705,7 +1718,7 @@ class GlfwApplication::TextInputEvent {
private:
explicit TextInputEvent(Containers::ArrayView<const char> text): _text{text}, _accepted{false} {}
Containers::ArrayView<const char> _text;
const Containers::ArrayView<const char> _text;
bool _accepted;
};

32
src/Magnum/Platform/Sdl2Application.h

@ -1682,6 +1682,18 @@ class Sdl2Application::ExitEvent {
*/
class Sdl2Application::ViewportEvent {
public:
/** @brief Copying is not allowed */
ViewportEvent(const ViewportEvent&) = delete;
/** @brief Moving is not allowed */
ViewportEvent(ViewportEvent&&) = delete;
/** @brief Copying is not allowed */
ViewportEvent& operator=(const ViewportEvent&) = delete;
/** @brief Moving is not allowed */
ViewportEvent& operator=(ViewportEvent&&) = delete;
/**
* @brief Window size
*
@ -1718,8 +1730,9 @@ class Sdl2Application::ViewportEvent {
explicit ViewportEvent(const Vector2i& windowSize, const Vector2i& framebufferSize, const Vector2& dpiScaling): _windowSize{windowSize}, _framebufferSize{framebufferSize}, _dpiScaling{dpiScaling} {}
Vector2i _windowSize, _framebufferSize;
Vector2 _dpiScaling;
const Vector2i _windowSize;
const Vector2i _framebufferSize;
const Vector2 _dpiScaling;
};
/**
@ -2273,10 +2286,10 @@ class Sdl2Application::MultiGestureEvent {
private:
explicit MultiGestureEvent(const Vector2& center, Float relativeRotation, Float relativeDistance, Int fingerCount): _center{center}, _relativeRotation{relativeRotation}, _relativeDistance{relativeDistance}, _fingerCount{fingerCount}, _accepted{false} {}
Vector2 _center;
Float _relativeRotation,
_relativeDistance;
Int _fingerCount;
const Vector2 _center;
const Float _relativeRotation;
const Float _relativeDistance;
const Int _fingerCount;
bool _accepted;
};
@ -2320,7 +2333,7 @@ class Sdl2Application::TextInputEvent {
private:
explicit TextInputEvent(Containers::ArrayView<const char> text): _text{text}, _accepted{false} {}
Containers::ArrayView<const char> _text;
const Containers::ArrayView<const char> _text;
bool _accepted;
};
@ -2370,8 +2383,9 @@ class Sdl2Application::TextEditingEvent {
private:
explicit TextEditingEvent(Containers::ArrayView<const char> text, Int start, Int length): _text{text}, _start{start}, _length{length}, _accepted{false} {}
Containers::ArrayView<const char> _text;
Int _start, _length;
const Containers::ArrayView<const char> _text;
const Int _start;
const Int _length;
bool _accepted;
};

Loading…
Cancel
Save