1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131
|
/*!
@file
@author Albert Semenov
@date 02/2010
@module
*/
#pragma once
#include <MyGUI.h>
#include "Generate/MyGUI_Managed_Widget.h"
namespace MyGUI
{
namespace Managed
{
public ref class InputManager
{
private:
InputManager() { }
public:
static property InputManager ^ Instance
{
InputManager ^ get( )
{
if (mInputManager == nullptr)
{
mInputManager = MyGUI::InputManager::getInstancePtr();
if (mInputManager == nullptr)
{
throw gcnew System::NullReferenceException();
}
}
return m_instance;
}
}
public:
property bool KeyFocus
{
bool get()
{
return mInputManager->getKeyFocusWidget() != nullptr;
}
}
public:
property bool MouseFocus
{
bool get()
{
return mInputManager->getMouseFocusWidget() != nullptr;
}
}
public:
property Widget ^ KeyFocusWidget
{
Widget ^ get()
{
return Convert< MyGUI::Widget* >::To(mInputManager->getKeyFocusWidget());
}
void set(Widget ^ _widget)
{
mInputManager->setKeyFocusWidget( Convert< MyGUI::Widget* >::From(_widget) );
}
}
public:
property Widget ^ MouseFocusWidget
{
Widget ^ get()
{
return Convert< MyGUI::Widget* >::To(mInputManager->getMouseFocusWidget());
}
}
public:
void ResetKeyFocus()
{
mInputManager->setKeyFocusWidget(nullptr);
}
public:
void AddWidgetModal(Widget ^ _widget)
{
mInputManager->addWidgetModal( Convert< MyGUI::Widget* >::From(_widget) );
}
public:
void RemoveWidgetModal(Widget ^ _widget)
{
mInputManager->removeWidgetModal( Convert< MyGUI::Widget* >::From(_widget) );
}
public:
bool InjectMouseMove(int _absx, int _absy, int _absz)
{
return mInputManager->injectMouseMove( _absx, _absy, _absz);
}
public:
bool InjectMousePress(int _absx, int _absy, MouseButton _id)
{
return mInputManager->injectMousePress( _absx, _absy, Convert< MyGUI::MouseButton >::From(_id) );
}
public:
bool InjectMouseRelease(int _absx, int _absy, MouseButton _id)
{
return mInputManager->injectMouseRelease( _absx, _absy, Convert< MyGUI::MouseButton >::From(_id) );
}
public:
bool InjectKeyPress(KeyCode _key, System::UInt32 _char)
{
return mInputManager->injectKeyPress( Convert< MyGUI::KeyCode >::From(_key), Convert<unsigned int>::From(_char) );
}
public:
bool InjectKeyRelease(KeyCode _key)
{
return mInputManager->injectKeyRelease( Convert< MyGUI::KeyCode >::From(_key) );
}
private:
static InputManager ^ m_instance = gcnew InputManager();
static MyGUI::InputManager* mInputManager = nullptr;
};
}
}
|