Magic_Game/src/kiwano/core/event/WindowEvent.h

109 lines
2.5 KiB
C
Raw Normal View History

2019-12-31 11:22:23 +08:00
// Copyright (c) 2016-2018 Kiwano - 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 <kiwano/core/event/Event.h>
namespace kiwano
{
/**
* \addtogroup Events
* @{
*/
/// \~chinese
/// @brief <20><><EFBFBD><EFBFBD><EFBFBD>¼<EFBFBD>
class KGE_API WindowEvent
: public Event
{
};
/// \~chinese
/// @brief <20><><EFBFBD><EFBFBD><EFBFBD>ƶ<EFBFBD><C6B6>¼<EFBFBD>
class KGE_API WindowMovedEvent
: public Event
{
public:
int x; ///< <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ͻ<EFBFBD> x <20><><EFBFBD><EFBFBD>
int y; ///< <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ͻ<EFBFBD> y <20><><EFBFBD><EFBFBD>
WindowMovedEvent();
};
/// \~chinese
/// @brief <20><><EFBFBD>ڴ<EFBFBD>С<EFBFBD><EFBFBD>¼<EFBFBD>
class KGE_API WindowResizedEvent
: public Event
{
public:
int width; ///< <20><><EFBFBD>ڿ<EFBFBD><DABF><EFBFBD>
int height; ///< <20><><EFBFBD>ڸ߶<DAB8>
WindowResizedEvent();
};
/// \~chinese
/// @brief <20><><EFBFBD>ڽ<EFBFBD><DABD><EFBFBD><EFBFBD><EFBFBD>¼<EFBFBD>
class KGE_API WindowFocusChangedEvent
: public Event
{
public:
bool focus; ///< <20>Ƿ<EFBFBD><C7B7><EFBFBD>ȡ<EFBFBD><C8A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
WindowFocusChangedEvent();
};
/// \~chinese
/// @brief <20><><EFBFBD>ڱ<EFBFBD><DAB1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>¼<EFBFBD>
class KGE_API WindowTitleChangedEvent
: public Event
{
public:
String title; ///< <20><><EFBFBD><EFBFBD>
WindowTitleChangedEvent();
};
/// \~chinese
/// @brief <20><><EFBFBD>ڹر<DAB9><D8B1>¼<EFBFBD>
class KGE_API WindowClosedEvent
: public Event
{
public:
WindowClosedEvent();
};
/** @} */
template <>
struct IsEventType<WindowEvent>
{
inline bool operator()(const Event& evt) const
{
return evt.GetType() == KGE_EVENT(WindowMovedEvent)
|| evt.GetType() == KGE_EVENT(WindowResizedEvent)
|| evt.GetType() == KGE_EVENT(WindowFocusChangedEvent)
|| evt.GetType() == KGE_EVENT(WindowTitleChangedEvent)
|| evt.GetType() == KGE_EVENT(WindowClosedEvent);
}
};
}