2014-01-15 07:40:02 +01:00
|
|
|
/**
|
|
|
|
|
******************************************************************************
|
|
|
|
|
* Xenia : Xbox 360 Emulator Research Project *
|
|
|
|
|
******************************************************************************
|
|
|
|
|
* Copyright 2014 Ben Vanik. All rights reserved. *
|
|
|
|
|
* Released under the BSD license - see LICENSE in the root for more details. *
|
|
|
|
|
******************************************************************************
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
#ifndef XENIA_UI_UI_EVENT_H_
|
|
|
|
|
#define XENIA_UI_UI_EVENT_H_
|
|
|
|
|
|
2014-12-20 07:04:57 +01:00
|
|
|
#include <xenia/common.h>
|
2014-01-15 07:40:02 +01:00
|
|
|
|
|
|
|
|
namespace xe {
|
|
|
|
|
namespace ui {
|
|
|
|
|
|
|
|
|
|
class App;
|
|
|
|
|
class Window;
|
|
|
|
|
|
|
|
|
|
class UIEvent {
|
2014-08-22 08:10:08 +02:00
|
|
|
public:
|
|
|
|
|
UIEvent(Window* window = NULL) : window_(window) {}
|
|
|
|
|
virtual ~UIEvent() = default;
|
2014-01-15 07:40:02 +01:00
|
|
|
|
|
|
|
|
Window* window() const { return window_; }
|
|
|
|
|
|
2014-08-22 08:10:08 +02:00
|
|
|
private:
|
|
|
|
|
Window* window_;
|
2014-01-15 07:40:02 +01:00
|
|
|
};
|
|
|
|
|
|
2014-05-28 22:59:43 +02:00
|
|
|
class KeyEvent : public UIEvent {
|
2014-08-22 08:10:08 +02:00
|
|
|
public:
|
|
|
|
|
KeyEvent(Window* window, int key_code)
|
|
|
|
|
: UIEvent(window), key_code_(key_code) {}
|
|
|
|
|
~KeyEvent() override = default;
|
2014-05-28 22:59:43 +02:00
|
|
|
|
|
|
|
|
int key_code() const { return key_code_; }
|
|
|
|
|
|
2014-08-22 08:10:08 +02:00
|
|
|
private:
|
2014-05-28 22:59:43 +02:00
|
|
|
int key_code_;
|
|
|
|
|
};
|
2014-01-15 07:40:02 +01:00
|
|
|
|
|
|
|
|
class MouseEvent : public UIEvent {
|
2014-08-22 08:10:08 +02:00
|
|
|
public:
|
2014-01-15 07:40:02 +01:00
|
|
|
enum Button {
|
|
|
|
|
MOUSE_BUTTON_NONE = 0,
|
|
|
|
|
MOUSE_BUTTON_LEFT,
|
|
|
|
|
MOUSE_BUTTON_RIGHT,
|
|
|
|
|
MOUSE_BUTTON_MIDDLE,
|
|
|
|
|
MOUSE_BUTTON_X1,
|
|
|
|
|
MOUSE_BUTTON_X2,
|
|
|
|
|
};
|
|
|
|
|
|
2014-08-22 08:10:08 +02:00
|
|
|
public:
|
|
|
|
|
MouseEvent(Window* window, Button button, int32_t x, int32_t y,
|
|
|
|
|
int32_t dx = 0, int32_t dy = 0)
|
|
|
|
|
: UIEvent(window), button_(button), x_(x), y_(y), dx_(dx), dy_(dy) {}
|
|
|
|
|
~MouseEvent() override = default;
|
2014-01-15 07:40:02 +01:00
|
|
|
|
|
|
|
|
Button button() const { return button_; }
|
|
|
|
|
int32_t x() const { return x_; }
|
|
|
|
|
int32_t y() const { return y_; }
|
|
|
|
|
int32_t dx() const { return dx_; }
|
|
|
|
|
int32_t dy() const { return dy_; }
|
|
|
|
|
|
2014-08-22 08:10:08 +02:00
|
|
|
private:
|
|
|
|
|
Button button_;
|
2014-01-15 07:40:02 +01:00
|
|
|
int32_t x_;
|
|
|
|
|
int32_t y_;
|
|
|
|
|
int32_t dx_;
|
|
|
|
|
int32_t dy_;
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
} // namespace ui
|
|
|
|
|
} // namespace xe
|
|
|
|
|
|
|
|
|
|
#endif // XENIA_UI_UI_EVENT_H_
|