124 lines
2.7 KiB
C++
124 lines
2.7 KiB
C++
// Copyright (c) 2016-2018 Easy2D - Nomango
|
||
//
|
||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||
// of this software and associated documentation files (the "Software"), to deal
|
||
// in the Software without restriction, including without limitation the rights
|
||
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||
// copies of the Software, and to permit persons to whom the Software is
|
||
// furnished to do so, subject to the following conditions:
|
||
//
|
||
// The above copyright notice and this permission notice shall be included in
|
||
// all copies or substantial portions of the Software.
|
||
//
|
||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||
// THE SOFTWARE.
|
||
|
||
#pragma once
|
||
#include "e2dutil.h"
|
||
|
||
namespace easy2d
|
||
{
|
||
|
||
|
||
// 梓囚<E6A293>連
|
||
class KeyEvent
|
||
{
|
||
public:
|
||
// 梓囚<E6A293>連窃侏
|
||
enum class Type : int
|
||
{
|
||
Down = 0x0100, // 梓和
|
||
Up // 箕軟
|
||
};
|
||
|
||
public:
|
||
explicit KeyEvent(
|
||
UINT message,
|
||
WPARAM w_param,
|
||
LPARAM l_param
|
||
);
|
||
|
||
// 資函並周窃侏
|
||
KeyEvent::Type GetType() const;
|
||
|
||
// 資函梓囚囚峙
|
||
KeyCode GetCode() const;
|
||
|
||
// 資函梓囚肝方
|
||
int GetCount() const;
|
||
|
||
protected:
|
||
UINT message_;
|
||
WPARAM w_param_;
|
||
LPARAM l_param_;
|
||
};
|
||
|
||
|
||
// 報炎<E5A0B1>連
|
||
class MouseEvent
|
||
{
|
||
public:
|
||
// 報炎<E5A0B1>連窃侏
|
||
enum class Type : int
|
||
{
|
||
MoveBy = 0x0200, // 報炎卞強
|
||
LeftDown, // 報炎恣囚梓和
|
||
LeftUp, // 報炎恣囚箕軟
|
||
LeftDoubleClick, // 報炎恣囚褒似
|
||
RightDown, // 報炎嘔囚梓和
|
||
RightUp, // 報炎嘔囚箕軟
|
||
RightDoubleClick, // 報炎嘔囚褒似
|
||
MiddleDown, // 報炎嶄囚梓和
|
||
MiddleUp, // 報炎嶄囚箕軟
|
||
MiddleDoubleClick, // 報炎嶄囚褒似
|
||
Wheel // 錆強獄態
|
||
};
|
||
|
||
public:
|
||
explicit MouseEvent(
|
||
UINT message,
|
||
WPARAM w_param,
|
||
LPARAM l_param
|
||
);
|
||
|
||
// 資函報炎罪恫炎
|
||
float GetX() const;
|
||
|
||
// 資函報炎忿恫炎
|
||
float GetY() const;
|
||
|
||
// 資函報炎恫炎
|
||
Point GetPosition() const;
|
||
|
||
// 資函並周窃侏
|
||
MouseEvent::Type GetType() const;
|
||
|
||
float GetWheelDelta() const;
|
||
|
||
// 報炎恣囚頁倦梓和
|
||
bool IsLButtonDown() const;
|
||
|
||
// 報炎嘔囚頁倦梓和
|
||
bool IsRButtonDown() const;
|
||
|
||
// 報炎嶄囚頁倦梓和
|
||
bool IsMButtonDown() const;
|
||
|
||
// Shift 囚頁倦梓和
|
||
bool IsShiftDown() const;
|
||
|
||
// Ctrl 囚頁倦梓和
|
||
bool IsCtrlDown() const;
|
||
|
||
protected:
|
||
UINT message_;
|
||
WPARAM w_param_;
|
||
LPARAM l_param_;
|
||
};
|
||
|
||
} |