2019-12-31 11:22:23 +08:00
|
|
|
|
// Copyright (c) 2016-2018 Kiwano - Nomango
|
2020-01-21 10:09:55 +08:00
|
|
|
|
//
|
2019-12-31 11:22:23 +08:00
|
|
|
|
// 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:
|
2020-01-21 10:09:55 +08:00
|
|
|
|
//
|
2019-12-31 11:22:23 +08:00
|
|
|
|
// The above copyright notice and this permission notice shall be included in
|
|
|
|
|
|
// all copies or substantial portions of the Software.
|
2020-01-21 10:09:55 +08:00
|
|
|
|
//
|
2019-12-31 11:22:23 +08:00
|
|
|
|
// 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
|
|
|
|
|
|
{
|
2020-01-21 10:09:55 +08:00
|
|
|
|
KGE_DECLARE_SMART_PTR(WindowEvent);
|
|
|
|
|
|
KGE_DECLARE_SMART_PTR(WindowMovedEvent);
|
|
|
|
|
|
KGE_DECLARE_SMART_PTR(WindowResizedEvent);
|
|
|
|
|
|
KGE_DECLARE_SMART_PTR(WindowFocusChangedEvent);
|
|
|
|
|
|
KGE_DECLARE_SMART_PTR(WindowTitleChangedEvent);
|
|
|
|
|
|
KGE_DECLARE_SMART_PTR(WindowClosedEvent);
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
|
* \addtogroup Events
|
|
|
|
|
|
* @{
|
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
/// \~chinese
|
|
|
|
|
|
/// @brief <20><><EFBFBD><EFBFBD><EFBFBD>¼<EFBFBD>
|
|
|
|
|
|
class KGE_API WindowEvent : public Event
|
|
|
|
|
|
{
|
|
|
|
|
|
public:
|
|
|
|
|
|
WindowEvent(const EventType& type);
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
/// \~chinese
|
|
|
|
|
|
/// @brief <20><><EFBFBD><EFBFBD><EFBFBD>ƶ<EFBFBD><C6B6>¼<EFBFBD>
|
|
|
|
|
|
class KGE_API WindowMovedEvent : public WindowEvent
|
|
|
|
|
|
{
|
|
|
|
|
|
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 WindowEvent
|
|
|
|
|
|
{
|
|
|
|
|
|
public:
|
|
|
|
|
|
uint32_t width; ///< <20><><EFBFBD>ڿ<EFBFBD><DABF><EFBFBD>
|
|
|
|
|
|
uint32_t height; ///< <20><><EFBFBD>ڸ߶<DAB8>
|
|
|
|
|
|
|
|
|
|
|
|
WindowResizedEvent();
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
/// \~chinese
|
|
|
|
|
|
/// @brief <20><><EFBFBD>ڽ<EFBFBD><DABD><EFBFBD><EFBFBD>仯<EFBFBD>¼<EFBFBD>
|
|
|
|
|
|
class KGE_API WindowFocusChangedEvent : public WindowEvent
|
|
|
|
|
|
{
|
|
|
|
|
|
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 WindowEvent
|
|
|
|
|
|
{
|
|
|
|
|
|
public:
|
|
|
|
|
|
String title; ///< <20><><EFBFBD><EFBFBD>
|
|
|
|
|
|
|
|
|
|
|
|
WindowTitleChangedEvent();
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
/// \~chinese
|
|
|
|
|
|
/// @brief <20><><EFBFBD>ڹر<DAB9><D8B1>¼<EFBFBD>
|
|
|
|
|
|
class KGE_API WindowClosedEvent : public WindowEvent
|
|
|
|
|
|
{
|
|
|
|
|
|
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);
|
|
|
|
|
|
}
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
} // namespace kiwano
|