2012-09-19 15:15:01 +00:00
|
|
|
//-----------------------------------------------------------------------------
|
|
|
|
|
// Copyright (c) 2012 GarageGames, LLC
|
|
|
|
|
//
|
|
|
|
|
// 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.
|
|
|
|
|
//-----------------------------------------------------------------------------
|
|
|
|
|
|
|
|
|
|
#ifndef _GUIINPUTCTRL_H_
|
|
|
|
|
#define _GUIINPUTCTRL_H_
|
|
|
|
|
|
|
|
|
|
#ifndef _GUIMOUSEEVENTCTRL_H_
|
|
|
|
|
#include "gui/utility/guiMouseEventCtrl.h"
|
|
|
|
|
#endif
|
2023-12-07 01:50:51 +00:00
|
|
|
#include "sim/actionMap.h"
|
2012-09-19 15:15:01 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
/// A control that locks the mouse and reports all keyboard input events
|
|
|
|
|
/// to script. This is useful for implementing custom keyboard handling code.
|
|
|
|
|
class GuiInputCtrl : public GuiMouseEventCtrl
|
|
|
|
|
{
|
2018-07-19 00:35:59 +00:00
|
|
|
protected:
|
|
|
|
|
bool mSendAxisEvents;
|
|
|
|
|
bool mSendBreakEvents;
|
|
|
|
|
bool mSendModifierEvents;
|
2022-02-18 00:04:31 +00:00
|
|
|
bool mIgnoreMouseEvents;
|
2012-09-19 15:15:01 +00:00
|
|
|
|
2023-12-07 01:50:51 +00:00
|
|
|
ActionMap* mActionmap;
|
|
|
|
|
|
2018-07-19 00:35:59 +00:00
|
|
|
public:
|
2012-09-19 15:15:01 +00:00
|
|
|
|
2018-07-19 00:35:59 +00:00
|
|
|
typedef GuiMouseEventCtrl Parent;
|
2012-09-19 15:15:01 +00:00
|
|
|
|
2018-07-19 00:35:59 +00:00
|
|
|
GuiInputCtrl();
|
2012-09-19 15:15:01 +00:00
|
|
|
|
2018-07-19 00:35:59 +00:00
|
|
|
// GuiControl.
|
2024-03-18 18:40:22 +00:00
|
|
|
bool onWake() override;
|
|
|
|
|
void onSleep() override;
|
2018-07-19 00:35:59 +00:00
|
|
|
|
2025-05-25 12:40:10 +00:00
|
|
|
virtual void setActive(bool state);
|
|
|
|
|
|
2024-03-18 18:40:22 +00:00
|
|
|
bool onInputEvent( const InputEventInfo &event ) override;
|
2018-07-19 00:35:59 +00:00
|
|
|
|
|
|
|
|
static void initPersistFields();
|
|
|
|
|
|
|
|
|
|
DECLARE_CONOBJECT(GuiInputCtrl);
|
|
|
|
|
DECLARE_CATEGORY( "Gui Other Script" );
|
|
|
|
|
DECLARE_DESCRIPTION( "A control that locks the mouse and reports all input events to script." );
|
|
|
|
|
|
|
|
|
|
DECLARE_CALLBACK( void, onInputEvent, ( const char* device, const char* action, bool state ));
|
|
|
|
|
DECLARE_CALLBACK(void, onAxisEvent, (const char* device, const char* action, F32 axisValue));
|
2012-09-19 15:15:01 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
#endif // _GUI_INPUTCTRL_H
|