Fixes #202 This PR fixes code style for the project files. The Problem Different files in the project use different code style. That is not consistent and leads to harder maintenance of the project. Description of the changes: Have investigated and determined the most used code style across the given codebase Have configured IDE and applied code style to all project files. Have crafted clang-formatter config. see https://clang.llvm.org/docs/ClangFormat.html https://clang.llvm.org/docs/ClangFormatStyleOptions.html Some cases were fixed manually How changes were validated: manual/ad-hoc testing, automated testing All tests pass as before because these are only code style changes. Additional Please review, and let me know if I have any mistake in the code style. In case of any mistake, I will change the configuration and re-apply it to the project.
82 lines
2.4 KiB
C++
82 lines
2.4 KiB
C++
// Copyright (c) Microsoft Corporation. All rights reserved.
|
|
// Licensed under the MIT License.
|
|
|
|
#include "pch.h"
|
|
#include "MemoryListItem.xaml.h"
|
|
#include "Controls/CalculatorButton.h"
|
|
|
|
using namespace CalculatorApp;
|
|
using namespace CalculatorApp::Common;
|
|
using namespace CalculatorApp::Controls;
|
|
using namespace CalculatorApp::ViewModel;
|
|
using namespace Platform;
|
|
using namespace Platform::Collections;
|
|
using namespace Windows::ApplicationModel::Resources;
|
|
using namespace Windows::Foundation;
|
|
using namespace Windows::Foundation::Collections;
|
|
using namespace Windows::UI::Popups;
|
|
using namespace Windows::UI::Xaml;
|
|
using namespace Windows::UI::Xaml::Controls;
|
|
using namespace Windows::UI::Xaml::Controls::Primitives;
|
|
using namespace Windows::UI::Xaml::Data;
|
|
using namespace Windows::UI::Xaml::Input;
|
|
using namespace Windows::UI::Xaml::Media;
|
|
using namespace Windows::UI::Xaml::Navigation;
|
|
using namespace Windows::UI::ViewManagement;
|
|
|
|
DEPENDENCY_PROPERTY_INITIALIZATION(MemoryListItem, Model);
|
|
|
|
MemoryListItem::MemoryListItem()
|
|
{
|
|
InitializeComponent();
|
|
}
|
|
|
|
void MemoryListItem::OnPointerEntered(Windows::UI::Xaml::Input::PointerRoutedEventArgs ^ e)
|
|
{
|
|
Control::OnPointerEntered(e);
|
|
|
|
// Only show hover buttons when the user is using mouse or pen.
|
|
if (e->Pointer->PointerDeviceType == Windows::Devices::Input::PointerDeviceType::Mouse
|
|
|| e->Pointer->PointerDeviceType == Windows::Devices::Input::PointerDeviceType::Pen)
|
|
{
|
|
VisualStateManager::GoToState(this, "MemoryButtonsVisible", true);
|
|
}
|
|
}
|
|
|
|
void MemoryListItem::OnPointerExited(Windows::UI::Xaml::Input::PointerRoutedEventArgs ^ e)
|
|
{
|
|
Control::OnPointerExited(e);
|
|
|
|
VisualStateManager::GoToState(this, "MemoryButtonsHidden", true);
|
|
}
|
|
|
|
void MemoryListItem::OnClearButtonClicked(_In_ Object ^ sender, _In_ RoutedEventArgs ^ e)
|
|
{
|
|
Model->Clear();
|
|
}
|
|
|
|
void MemoryListItem::OnMemoryAddButtonClicked(_In_ Object ^ sender, _In_ RoutedEventArgs ^ e)
|
|
{
|
|
Model->MemoryAdd();
|
|
}
|
|
|
|
void MemoryListItem::OnMemorySubtractButtonClicked(_In_ Object ^ sender, _In_ RoutedEventArgs ^ e)
|
|
{
|
|
Model->MemorySubtract();
|
|
}
|
|
|
|
void MemoryListItem::OnClearSwipeInvoked(_In_ SwipeItem ^ sender, SwipeItemInvokedEventArgs ^ e)
|
|
{
|
|
Model->Clear();
|
|
}
|
|
|
|
void MemoryListItem::OnMemoryAddSwipeInvoked(_In_ SwipeItem ^ sender, SwipeItemInvokedEventArgs ^ e)
|
|
{
|
|
Model->MemoryAdd();
|
|
}
|
|
|
|
void MemoryListItem::OnMemorySubtractSwipeInvoked(_In_ SwipeItem ^ sender, SwipeItemInvokedEventArgs ^ e)
|
|
{
|
|
Model->MemorySubtract();
|
|
}
|