Skip to content

Commit

Permalink
Rename in progress
Browse files Browse the repository at this point in the history
  • Loading branch information
harishsk committed Apr 23, 2018
1 parent dcba426 commit 062d802
Show file tree
Hide file tree
Showing 48 changed files with 170 additions and 199 deletions.
4 changes: 2 additions & 2 deletions GazeInputTest/GazeInputTest.csproj
Expand Up @@ -132,9 +132,9 @@
</PackageReference>
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\Microsoft.Toolkit.UWP.Input.Gaze\Microsoft.Toolkit.Uwp.Input.Gaze.vcxproj">
<ProjectReference Include="..\Microsoft.Toolkit.UWP.Input.GazeInteraction\Microsoft.Toolkit.Uwp.Input.GazeInteraction.vcxproj">
<Project>{a5e98964-45b1-442d-a07a-298a3221d81e}</Project>
<Name>Microsoft.Toolkit.Uwp.Input.Gaze</Name>
<Name>Microsoft.Toolkit.Uwp.Input.GazeInteraction</Name>
</ProjectReference>
</ItemGroup>
<PropertyGroup Condition=" '$(VisualStudioVersion)' == '' or '$(VisualStudioVersion)' &lt; '14.0' ">
Expand Down
18 changes: 9 additions & 9 deletions GazeInputTest/MainPage.xaml
Expand Up @@ -5,8 +5,8 @@
xmlns:local="using:GazeInputTest"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:gaze="using:Microsoft.Toolkit.Uwp.Input.Gaze"
gaze:GazeApi.IsGazeEnabled="Enabled"
xmlns:g="using:Microsoft.Toolkit.Uwp.Input.GazeInteraction"
g:GazeInput.IsGazeEnabled="Enabled"
mc:Ignorable="d" Margin="0,40,0,-40">

<Grid Background="{ThemeResource ApplicationPageBackgroundThemeBrush}">
Expand All @@ -21,14 +21,14 @@
</Grid.ColumnDefinitions>
<ToggleButton Grid.Row="0" Grid.Column="0" x:Name="ShowCursor" Checked="ShowCursor_Toggle" Unchecked="ShowCursor_Toggle" HorizontalAlignment="Stretch" VerticalAlignment="Stretch">Show Cursor</ToggleButton>
<Button Grid.Row="0" Grid.Column="1" x:Name="Dwell" Click="Dwell_Click" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" Content="Eyes Here">
<gaze:GazeApi.GazeElement>
<gaze:GazeElement StateChanged="OnStateChanged"/>
</gaze:GazeApi.GazeElement>
<g:GazeInput.GazeElement>
<g:GazeElement StateChanged="OnStateChanged"/>
</g:GazeInput.GazeElement>
</Button>
<Button Grid.Row="1" Grid.Column="1" x:Name="HowButton" Content="0: Idle" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" Click="OnLegacyInvoked" gaze:GazeApi.MaxRepeatCount="4">
<gaze:GazeApi.GazeElement>
<gaze:GazeElement Invoked="OnGazeInvoked"/>
</gaze:GazeApi.GazeElement>
<Button Grid.Row="1" Grid.Column="1" x:Name="HowButton" Content="0: Idle" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" Click="OnLegacyInvoked" g:GazeInput.MaxRepeatCount="4">
<g:GazeInput.GazeElement>
<g:GazeElement Invoked="OnGazeInvoked"/>
</g:GazeInput.GazeElement>
</Button>
</Grid>
</Page>
6 changes: 3 additions & 3 deletions GazeInputTest/MainPage.xaml.cs
Expand Up @@ -10,7 +10,7 @@
// THE CODE OR THE USE OR OTHER DEALINGS IN THE CODE.
// ******************************************************************

using Microsoft.Toolkit.Uwp.Input.Gaze;
using Microsoft.Toolkit.Uwp.Input.GazeInteraction;
using Windows.UI.Xaml;
using Windows.UI.Xaml.Controls;

Expand All @@ -25,7 +25,7 @@ public MainPage()
{
this.InitializeComponent();

ShowCursor.IsChecked = GazeApi.GetIsGazeCursorVisible(this);
ShowCursor.IsChecked = GazeInput.GetIsCursorVisible(this);
}

private void OnStateChanged(object sender, GazePointerEventArgs ea)
Expand All @@ -42,7 +42,7 @@ private void ShowCursor_Toggle(object sender, RoutedEventArgs e)
{
if (ShowCursor.IsChecked.HasValue)
{
GazeApi.SetIsGazeCursorVisible(this, ShowCursor.IsChecked.Value);
GazeInput.SetIsCursorVisible(this, ShowCursor.IsChecked.Value);
}
}

Expand Down
93 changes: 0 additions & 93 deletions Microsoft.Toolkit.Uwp.Input.Gaze/GazeApi.cpp

This file was deleted.

This file was deleted.

93 changes: 93 additions & 0 deletions Microsoft.Toolkit.Uwp.Input.GazeInteraction/GazeInput.cpp
@@ -0,0 +1,93 @@
//Copyright (c) Microsoft. All rights reserved. Licensed under the MIT license.
//See LICENSE in the project root for license information.

#include "pch.h"
#include "GazeInput.h"
#include "GazePointer.h"
#include "GazePointerProxy.h"
#include "GazeElement.h"

using namespace std;
using namespace Platform;
using namespace Windows::Foundation;
using namespace Windows::Foundation::Collections;
using namespace Windows::Graphics::Display;
using namespace Windows::UI;
using namespace Windows::UI::ViewManagement;
using namespace Windows::UI::Xaml::Automation::Peers;
using namespace Windows::UI::Xaml::Hosting;

BEGIN_NAMESPACE_GAZE_INPUT

TimeSpan GazeInput::UnsetTimeSpan = { -1 };

static void OnIsGazeEnabledChanged(DependencyObject^ ob, DependencyPropertyChangedEventArgs^ args)
{
auto element = safe_cast<FrameworkElement^>(ob);
auto isGazeEnabled = safe_cast<GazeEnablement>(args->NewValue);
GazePointerProxy::SetGazeEnabled(element, isGazeEnabled);
}

static void OnIsCursorVisibleChanged(DependencyObject^ ob, DependencyPropertyChangedEventArgs^ args)
{
GazePointer::Instance->IsCursorVisible = safe_cast<bool>(args->NewValue);
}

static void OnCursorRadiusChanged(DependencyObject^ ob, DependencyPropertyChangedEventArgs^ args)
{
GazePointer::Instance->CursorRadius = safe_cast<int>(args->NewValue);
}

static DependencyProperty^ s_isGazeEnabledProperty = DependencyProperty::RegisterAttached("IsGazeEnabled", GazeEnablement::typeid, GazeInput::typeid,
ref new PropertyMetadata(GazeEnablement::Inherited, ref new PropertyChangedCallback(&OnIsGazeEnabledChanged)));
static DependencyProperty^ s_isCursorVisibleProperty = DependencyProperty::RegisterAttached("IsCursorVisible", bool::typeid, GazeInput::typeid,
ref new PropertyMetadata(true, ref new PropertyChangedCallback(&OnIsCursorVisibleChanged)));
static DependencyProperty^ s_cursorRadiusProperty = DependencyProperty::RegisterAttached("CursorRadius", int::typeid, GazeInput::typeid,
ref new PropertyMetadata(6, ref new PropertyChangedCallback(&OnCursorRadiusChanged)));
static DependencyProperty^ s_gazeElementProperty = DependencyProperty::RegisterAttached("GazeElement", GazeElement::typeid, GazeInput::typeid, ref new PropertyMetadata(nullptr));
static DependencyProperty^ s_fixationProperty = DependencyProperty::RegisterAttached("Fixation", TimeSpan::typeid, GazeInput::typeid, ref new PropertyMetadata(GazeInput::UnsetTimeSpan));
static DependencyProperty^ s_dwellProperty = DependencyProperty::RegisterAttached("Dwell", TimeSpan::typeid, GazeInput::typeid, ref new PropertyMetadata(GazeInput::UnsetTimeSpan));
static DependencyProperty^ s_dwellRepeatProperty = DependencyProperty::RegisterAttached("DwellRepeat", TimeSpan::typeid, GazeInput::typeid, ref new PropertyMetadata(GazeInput::UnsetTimeSpan));
static DependencyProperty^ s_enterProperty = DependencyProperty::RegisterAttached("Enter", TimeSpan::typeid, GazeInput::typeid, ref new PropertyMetadata(GazeInput::UnsetTimeSpan));
static DependencyProperty^ s_exitProperty = DependencyProperty::RegisterAttached("Exit", TimeSpan::typeid, GazeInput::typeid, ref new PropertyMetadata(GazeInput::UnsetTimeSpan));
static DependencyProperty^ s_maxRepeatCountProperty = DependencyProperty::RegisterAttached("MaxRepeatCount", int::typeid, GazeInput::typeid, ref new PropertyMetadata(safe_cast<Object^>(0)));

DependencyProperty^ GazeInput::IsGazeEnabledProperty::get() { return s_isGazeEnabledProperty; }
DependencyProperty^ GazeInput::IsCursorVisibleProperty::get() { return s_isCursorVisibleProperty; }
DependencyProperty^ GazeInput::CursorRadiusProperty::get() { return s_cursorRadiusProperty; }
DependencyProperty^ GazeInput::GazeElementProperty::get() { return s_gazeElementProperty; }
DependencyProperty^ GazeInput::FixationProperty::get() { return s_fixationProperty; }
DependencyProperty^ GazeInput::DwellProperty::get() { return s_dwellProperty; }
DependencyProperty^ GazeInput::DwellRepeatProperty::get() { return s_dwellRepeatProperty; }
DependencyProperty^ GazeInput::EnterProperty::get() { return s_enterProperty; }
DependencyProperty^ GazeInput::ExitProperty::get() { return s_exitProperty; }
DependencyProperty^ GazeInput::MaxRepeatCountProperty::get() { return s_maxRepeatCountProperty; }

GazeEnablement GazeInput::GetIsGazeEnabled(UIElement^ element) { return safe_cast<GazeEnablement>(element->GetValue(s_isGazeEnabledProperty)); }
bool GazeInput::GetIsCursorVisible(UIElement^ element) { return safe_cast<bool>(element->GetValue(s_isCursorVisibleProperty)); }
int GazeInput::GetCursorRadius(UIElement^ element) { return safe_cast<int>(element->GetValue(s_cursorRadiusProperty)); }
GazeElement^ GazeInput::GetGazeElement(UIElement^ element) { return safe_cast<GazeElement^>(element->GetValue(s_gazeElementProperty)); }
TimeSpan GazeInput::GetFixation(UIElement^ element) { return safe_cast<TimeSpan>(element->GetValue(s_fixationProperty)); }
TimeSpan GazeInput::GetDwell(UIElement^ element) { return safe_cast<TimeSpan>(element->GetValue(s_dwellProperty)); }
TimeSpan GazeInput::GetDwellRepeat(UIElement^ element) { return safe_cast<TimeSpan>(element->GetValue(s_dwellRepeatProperty)); }
TimeSpan GazeInput::GetEnter(UIElement^ element) { return safe_cast<TimeSpan>(element->GetValue(s_enterProperty)); }
TimeSpan GazeInput::GetExit(UIElement^ element) { return safe_cast<TimeSpan>(element->GetValue(s_exitProperty)); }
int GazeInput::GetMaxRepeatCount(UIElement^ element) { return safe_cast<int>(element->GetValue(s_maxRepeatCountProperty)); }

void GazeInput::SetIsGazeEnabled(UIElement^ element, GazeEnablement value) { element->SetValue(s_isGazeEnabledProperty, value); }
void GazeInput::SetIsCursorVisible(UIElement^ element, bool value) { element->SetValue(s_isCursorVisibleProperty, value); }
void GazeInput::SetCursorRadius(UIElement^ element, int value) { element->SetValue(s_cursorRadiusProperty, value); }
void GazeInput::SetGazeElement(UIElement^ element, GazeElement^ value) { element->SetValue(s_gazeElementProperty, value); }
void GazeInput::SetFixation(UIElement^ element, TimeSpan span) { element->SetValue(s_fixationProperty, span); }
void GazeInput::SetDwell(UIElement^ element, TimeSpan span) { element->SetValue(s_dwellProperty, span); }
void GazeInput::SetDwellRepeat(UIElement^ element, TimeSpan span) { element->SetValue(s_dwellRepeatProperty, span); }
void GazeInput::SetEnter(UIElement^ element, TimeSpan span) { element->SetValue(s_enterProperty, span); }
void GazeInput::SetExit(UIElement^ element, TimeSpan span) { element->SetValue(s_exitProperty, span); }
void GazeInput::SetMaxRepeatCount(UIElement^ element, int value) { element->SetValue(s_maxRepeatCountProperty, value); }

GazePointer^ GazeInput::GetGazePointer(Page^ page)
{
return GazePointer::Instance;
}

END_NAMESPACE_GAZE_INPUT

0 comments on commit 062d802

Please sign in to comment.