Win32ApplicationKeyboard fully implemented
ApplicationKeyboard, Win32ApplicationKeyboard & implemented into the CreateDevice function
This commit is contained in:
parent
2c8b52e0fa
commit
8993241408
|
@ -17,10 +17,12 @@ namespace Input
|
||||||
void Activate();
|
void Activate();
|
||||||
void Deactivate();
|
void Deactivate();
|
||||||
|
|
||||||
void SetTargetText( ::std::wstring *field );
|
void BindTextTarget( ::std::wstring *field );
|
||||||
|
void ReleaseTextTarget();
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
::std::wstring *targetText;
|
::std::wstring *textTarget;
|
||||||
|
::std::wstring::size_type writePos;
|
||||||
|
|
||||||
ApplicationKeyboard();
|
ApplicationKeyboard();
|
||||||
~ApplicationKeyboard();
|
~ApplicationKeyboard();
|
||||||
|
|
|
@ -16,10 +16,7 @@ namespace Input
|
||||||
Win32ApplicationKeyboard();
|
Win32ApplicationKeyboard();
|
||||||
~Win32ApplicationKeyboard();
|
~Win32ApplicationKeyboard();
|
||||||
|
|
||||||
LRESULT CALLBACK WindowCallback( HWND h, UINT m, WPARAM w, LPARAM l );
|
void CaptureText( UINT msg, WPARAM param );
|
||||||
|
|
||||||
private:
|
|
||||||
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -8,6 +8,7 @@
|
||||||
#include "..\InputManager.h"
|
#include "..\InputManager.h"
|
||||||
#include "Win32Keyboard.h"
|
#include "Win32Keyboard.h"
|
||||||
#include "Win32Mouse.h"
|
#include "Win32Mouse.h"
|
||||||
|
#include "Win32ApplicationKeyboard.h"
|
||||||
#include <vector>
|
#include <vector>
|
||||||
#include <Windows.h>
|
#include <Windows.h>
|
||||||
#include <map>
|
#include <map>
|
||||||
|
|
|
@ -44,6 +44,11 @@
|
||||||
<ClInclude Include="Include\Win32\Win32Mouse.h" />
|
<ClInclude Include="Include\Win32\Win32Mouse.h" />
|
||||||
<ClInclude Include="L_inputClass.h" />
|
<ClInclude Include="L_inputClass.h" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<ProjectReference Include="..\Utilities\Utilities.vcxproj">
|
||||||
|
<Project>{2ec4dded-8f75-4c86-a10b-e1e8eb29f3ee}</Project>
|
||||||
|
</ProjectReference>
|
||||||
|
</ItemGroup>
|
||||||
<PropertyGroup Label="Globals">
|
<PropertyGroup Label="Globals">
|
||||||
<ProjectGuid>{7E3990D2-3D94-465C-B58D-64A74B3ECF9B}</ProjectGuid>
|
<ProjectGuid>{7E3990D2-3D94-465C-B58D-64A74B3ECF9B}</ProjectGuid>
|
||||||
<RootNamespace>Input</RootNamespace>
|
<RootNamespace>Input</RootNamespace>
|
||||||
|
@ -95,28 +100,32 @@
|
||||||
<OutDir>$(SolutionDir)..\External\Lib\$(ProjectName)\</OutDir>
|
<OutDir>$(SolutionDir)..\External\Lib\$(ProjectName)\</OutDir>
|
||||||
<IntDir>$(SolutionDir)..\Obj\$(ProjectName)\$(PlatformShortName)\$(Configuration)\</IntDir>
|
<IntDir>$(SolutionDir)..\Obj\$(ProjectName)\$(PlatformShortName)\$(Configuration)\</IntDir>
|
||||||
<TargetName>$(ProjectName)_$(PlatformShortName)D</TargetName>
|
<TargetName>$(ProjectName)_$(PlatformShortName)D</TargetName>
|
||||||
|
<IncludePath>$(IncludePath)</IncludePath>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||||
<OutDir>$(SolutionDir)..\External\Lib\$(ProjectName)\</OutDir>
|
<OutDir>$(SolutionDir)..\External\Lib\$(ProjectName)\</OutDir>
|
||||||
<IntDir>$(SolutionDir)..\Obj\$(ProjectName)\$(PlatformShortName)\$(Configuration)\</IntDir>
|
<IntDir>$(SolutionDir)..\Obj\$(ProjectName)\$(PlatformShortName)\$(Configuration)\</IntDir>
|
||||||
<TargetName>$(ProjectName)_$(PlatformShortName)</TargetName>
|
<TargetName>$(ProjectName)_$(PlatformShortName)</TargetName>
|
||||||
|
<IncludePath>$(IncludePath)</IncludePath>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||||
<OutDir>$(SolutionDir)..\External\Lib\$(ProjectName)\</OutDir>
|
<OutDir>$(SolutionDir)..\External\Lib\$(ProjectName)\</OutDir>
|
||||||
<IntDir>$(SolutionDir)..\Obj\$(ProjectName)\$(PlatformShortName)\$(Configuration)\</IntDir>
|
<IntDir>$(SolutionDir)..\Obj\$(ProjectName)\$(PlatformShortName)\$(Configuration)\</IntDir>
|
||||||
<TargetName>$(ProjectName)_$(PlatformShortName)D</TargetName>
|
<TargetName>$(ProjectName)_$(PlatformShortName)D</TargetName>
|
||||||
|
<IncludePath>$(IncludePath)</IncludePath>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||||
<OutDir>$(SolutionDir)..\External\Lib\$(ProjectName)\</OutDir>
|
<OutDir>$(SolutionDir)..\External\Lib\$(ProjectName)\</OutDir>
|
||||||
<IntDir>$(SolutionDir)..\Obj\$(ProjectName)\$(PlatformShortName)\$(Configuration)\</IntDir>
|
<IntDir>$(SolutionDir)..\Obj\$(ProjectName)\$(PlatformShortName)\$(Configuration)\</IntDir>
|
||||||
<TargetName>$(ProjectName)_$(PlatformShortName)</TargetName>
|
<TargetName>$(ProjectName)_$(PlatformShortName)</TargetName>
|
||||||
|
<IncludePath>$(IncludePath)</IncludePath>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||||
<ClCompile>
|
<ClCompile>
|
||||||
<WarningLevel>Level3</WarningLevel>
|
<WarningLevel>Level3</WarningLevel>
|
||||||
<Optimization>Disabled</Optimization>
|
<Optimization>Disabled</Optimization>
|
||||||
<SDLCheck>true</SDLCheck>
|
<SDLCheck>true</SDLCheck>
|
||||||
<AdditionalIncludeDirectories>%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
<AdditionalIncludeDirectories>$(SolutionDir)Misc\Utilities;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
<Link>
|
<Link>
|
||||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||||
|
@ -127,7 +136,7 @@
|
||||||
<WarningLevel>Level3</WarningLevel>
|
<WarningLevel>Level3</WarningLevel>
|
||||||
<Optimization>Disabled</Optimization>
|
<Optimization>Disabled</Optimization>
|
||||||
<SDLCheck>true</SDLCheck>
|
<SDLCheck>true</SDLCheck>
|
||||||
<AdditionalIncludeDirectories>%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
<AdditionalIncludeDirectories>$(SolutionDir)Misc\Utilities;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
<Link>
|
<Link>
|
||||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||||
|
@ -140,7 +149,7 @@
|
||||||
<FunctionLevelLinking>true</FunctionLevelLinking>
|
<FunctionLevelLinking>true</FunctionLevelLinking>
|
||||||
<IntrinsicFunctions>true</IntrinsicFunctions>
|
<IntrinsicFunctions>true</IntrinsicFunctions>
|
||||||
<SDLCheck>true</SDLCheck>
|
<SDLCheck>true</SDLCheck>
|
||||||
<AdditionalIncludeDirectories>%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
<AdditionalIncludeDirectories>$(SolutionDir)Misc\Utilities;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
<Link>
|
<Link>
|
||||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||||
|
@ -155,7 +164,7 @@
|
||||||
<FunctionLevelLinking>true</FunctionLevelLinking>
|
<FunctionLevelLinking>true</FunctionLevelLinking>
|
||||||
<IntrinsicFunctions>true</IntrinsicFunctions>
|
<IntrinsicFunctions>true</IntrinsicFunctions>
|
||||||
<SDLCheck>true</SDLCheck>
|
<SDLCheck>true</SDLCheck>
|
||||||
<AdditionalIncludeDirectories>%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
<AdditionalIncludeDirectories>$(SolutionDir)Misc\Utilities;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
<Link>
|
<Link>
|
||||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||||
|
|
|
@ -5,7 +5,8 @@ using namespace ::Input;
|
||||||
ApplicationKeyboard::ApplicationKeyboard() :
|
ApplicationKeyboard::ApplicationKeyboard() :
|
||||||
InputObject( Enum::SAIType_ApplicationKeyboard )
|
InputObject( Enum::SAIType_ApplicationKeyboard )
|
||||||
{
|
{
|
||||||
this->targetText = nullptr;
|
this->textTarget = nullptr;
|
||||||
|
this->writePos = 0;
|
||||||
this->isEnabled = true;
|
this->isEnabled = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -27,7 +28,17 @@ void ApplicationKeyboard::Deactivate()
|
||||||
this->isEnabled = false;
|
this->isEnabled = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
void ApplicationKeyboard::SetTargetText( ::std::wstring *field )
|
void ApplicationKeyboard::BindTextTarget( ::std::wstring *field )
|
||||||
{
|
{
|
||||||
this->targetText = field;
|
this->textTarget = field;
|
||||||
|
|
||||||
|
if( field )
|
||||||
|
{
|
||||||
|
this->writePos = field->size();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void ApplicationKeyboard::ReleaseTextTarget( )
|
||||||
|
{
|
||||||
|
this->BindTextTarget( nullptr );
|
||||||
}
|
}
|
|
@ -1,20 +1,51 @@
|
||||||
#include "../../Include/Win32/Win32ApplicationKeyboard.h"
|
#include "../../Include/Win32/Win32ApplicationKeyboard.h"
|
||||||
|
#include "Utilities.h"
|
||||||
|
|
||||||
using namespace ::Input;
|
using namespace ::Input;
|
||||||
|
using namespace ::Utility::Value;
|
||||||
|
using ::std::wstring;
|
||||||
|
|
||||||
|
Win32ApplicationKeyboard::Win32ApplicationKeyboard() : ApplicationKeyboard() { /* DO nothing */ }
|
||||||
|
|
||||||
//{
|
Win32ApplicationKeyboard::~Win32ApplicationKeyboard() { /* DO nothing */ }
|
||||||
// class Win32ApplicationKeyboard : public ApplicationKeyboard
|
|
||||||
// {
|
void Win32ApplicationKeyboard::CaptureText( UINT msg, WPARAM param )
|
||||||
// public:
|
{
|
||||||
// Win32ApplicationKeyboard();
|
if( !this->textTarget | !this->isEnabled )
|
||||||
// ~Win32ApplicationKeyboard();
|
return;
|
||||||
//
|
|
||||||
// LRESULT CALLBACK WindowCallback( HWND h, UINT m, WPARAM w, LPARAM l );
|
switch( msg )
|
||||||
//
|
{
|
||||||
// private:
|
case WM_CHAR:
|
||||||
//
|
this->textTarget->insert( this->writePos, 1, (wchar_t)param );
|
||||||
// };
|
++this->writePos;
|
||||||
//}
|
break;
|
||||||
//
|
case WM_KEYDOWN:
|
||||||
//#endif // !INPUT_WIN32_APPLICATION_KEBOARD_H
|
{
|
||||||
|
switch( param )
|
||||||
|
{
|
||||||
|
case VK_BACK:
|
||||||
|
if( this->writePos > 0 )
|
||||||
|
{
|
||||||
|
--this->writePos;
|
||||||
|
this->textTarget->erase( this->writePos, 1 );
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case VK_DELETE:
|
||||||
|
if( this->writePos < this->textTarget->size() )
|
||||||
|
{
|
||||||
|
this->textTarget->erase( this->writePos, 1 );
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case VK_LEFT:
|
||||||
|
this->writePos = Max( this->writePos - 1, (wstring::size_type)0 );
|
||||||
|
break;
|
||||||
|
case VK_RIGHT:
|
||||||
|
this->writePos = Min( this->writePos + 1, this->textTarget->size() );
|
||||||
|
break;
|
||||||
|
default: break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
default: break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
|
@ -775,6 +775,10 @@ InputObject* Win32Input::CreateDevice(const SAIType inputType, Typedefs::WindowH
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case SAIType_ApplicationKeyboard:
|
||||||
|
val = new Win32ApplicationKeyboard();
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
return val;
|
return val;
|
||||||
|
|
Loading…
Reference in New Issue