Fix the project code style, as it is not consistent. (#236)
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.
This commit is contained in:
committed by
Daniel Belcher
parent
c77f1de84c
commit
2826d37056
@@ -50,13 +50,11 @@ DEPENDENCY_PROPERTY_INITIALIZATION(CalculationResult, DisplayStringExpression);
|
||||
StringReference CalculationResult::s_FocusedState(L"Focused");
|
||||
StringReference CalculationResult::s_UnfocusedState(L"Unfocused");
|
||||
|
||||
CalculationResult::CalculationResult():
|
||||
m_isScalingText(false),
|
||||
m_haveCalculatedMax(false)
|
||||
CalculationResult::CalculationResult() : m_isScalingText(false), m_haveCalculatedMax(false)
|
||||
{
|
||||
}
|
||||
|
||||
Platform::String^ CalculationResult::GetRawDisplayValue()
|
||||
Platform::String ^ CalculationResult::GetRawDisplayValue()
|
||||
{
|
||||
std::wstring rawValue;
|
||||
|
||||
@@ -72,18 +70,19 @@ void CalculationResult::OnApplyTemplate()
|
||||
{
|
||||
m_textContainer->LayoutUpdated -= m_textContainerLayoutChangedToken;
|
||||
}
|
||||
m_textContainer = dynamic_cast<ScrollViewer^>(GetTemplateChild("TextContainer"));
|
||||
m_textContainer = dynamic_cast<ScrollViewer ^>(GetTemplateChild("TextContainer"));
|
||||
if (m_textContainer)
|
||||
{
|
||||
m_textContainer->SizeChanged += ref new SizeChangedEventHandler(this, &CalculationResult::TextContainerSizeChanged);
|
||||
// We want to know when the size of the container changes so
|
||||
// we can rescale the textbox
|
||||
m_textContainerLayoutChangedToken = m_textContainer->LayoutUpdated += ref new EventHandler<Object^>(this, &CalculationResult::OnTextContainerLayoutUpdated);
|
||||
m_textContainerLayoutChangedToken = m_textContainer->LayoutUpdated +=
|
||||
ref new EventHandler<Object ^>(this, &CalculationResult::OnTextContainerLayoutUpdated);
|
||||
|
||||
m_textContainer->ChangeView(m_textContainer->ExtentWidth - m_textContainer->ViewportWidth,nullptr,nullptr);
|
||||
m_scrollLeft = dynamic_cast<HyperlinkButton^>(GetTemplateChild("ScrollLeft"));
|
||||
m_scrollRight = dynamic_cast<HyperlinkButton^>(GetTemplateChild("ScrollRight"));
|
||||
auto borderContainer = dynamic_cast<UIElement^>(GetTemplateChild("Border"));
|
||||
m_textContainer->ChangeView(m_textContainer->ExtentWidth - m_textContainer->ViewportWidth, nullptr, nullptr);
|
||||
m_scrollLeft = dynamic_cast<HyperlinkButton ^>(GetTemplateChild("ScrollLeft"));
|
||||
m_scrollRight = dynamic_cast<HyperlinkButton ^>(GetTemplateChild("ScrollRight"));
|
||||
auto borderContainer = dynamic_cast<UIElement ^>(GetTemplateChild("Border"));
|
||||
if (m_scrollLeft && m_scrollRight)
|
||||
{
|
||||
m_scrollLeft->Click += ref new RoutedEventHandler(this, &CalculationResult::OnScrollClick);
|
||||
@@ -91,7 +90,7 @@ void CalculationResult::OnApplyTemplate()
|
||||
borderContainer->PointerEntered += ref new PointerEventHandler(this, &CalculationResult::OnPointerEntered);
|
||||
borderContainer->PointerExited += ref new PointerEventHandler(this, &CalculationResult::OnPointerExited);
|
||||
}
|
||||
m_textBlock = dynamic_cast<TextBlock^>(m_textContainer->FindName("NormalOutput"));
|
||||
m_textBlock = dynamic_cast<TextBlock ^>(m_textContainer->FindName("NormalOutput"));
|
||||
if (m_textBlock)
|
||||
{
|
||||
m_textBlock->Visibility = ::Visibility::Visible;
|
||||
@@ -101,7 +100,7 @@ void CalculationResult::OnApplyTemplate()
|
||||
VisualStateManager::GoToState(this, s_UnfocusedState, false);
|
||||
}
|
||||
|
||||
void CalculationResult::OnPointerPressed(PointerRoutedEventArgs^ e)
|
||||
void CalculationResult::OnPointerPressed(PointerRoutedEventArgs ^ e)
|
||||
{
|
||||
if (m_scrollLeft && m_scrollRight && e->Pointer->PointerDeviceType == PointerDeviceType::Touch)
|
||||
{
|
||||
@@ -109,7 +108,7 @@ void CalculationResult::OnPointerPressed(PointerRoutedEventArgs^ e)
|
||||
}
|
||||
}
|
||||
|
||||
void CalculationResult::OnTextContainerLayoutUpdated(Object^ /*sender*/, Object^ /*e*/)
|
||||
void CalculationResult::OnTextContainerLayoutUpdated(Object ^ /*sender*/, Object ^ /*e*/)
|
||||
{
|
||||
if (m_isScalingText)
|
||||
{
|
||||
@@ -117,7 +116,7 @@ void CalculationResult::OnTextContainerLayoutUpdated(Object^ /*sender*/, Object^
|
||||
}
|
||||
}
|
||||
|
||||
void CalculationResult::TextContainerSizeChanged(Object^ /*sender*/, SizeChangedEventArgs^ /*e*/)
|
||||
void CalculationResult::TextContainerSizeChanged(Object ^ /*sender*/, SizeChangedEventArgs ^ /*e*/)
|
||||
{
|
||||
UpdateTextState();
|
||||
}
|
||||
@@ -127,7 +126,7 @@ void CalculationResult::OnIsActivePropertyChanged(bool /*oldValue*/, bool /*newV
|
||||
UpdateVisualState();
|
||||
}
|
||||
|
||||
void CalculationResult::OnAccentColorPropertyChanged(Brush^ /*oldValue*/, Brush^ /*newValue*/)
|
||||
void CalculationResult::OnAccentColorPropertyChanged(Brush ^ /*oldValue*/, Brush ^ /*newValue*/)
|
||||
{
|
||||
// Force the "Active" transition to happen again
|
||||
if (IsActive)
|
||||
@@ -137,7 +136,7 @@ void CalculationResult::OnAccentColorPropertyChanged(Brush^ /*oldValue*/, Brush^
|
||||
}
|
||||
}
|
||||
|
||||
void CalculationResult::OnDisplayValuePropertyChanged(String^ /*oldValue*/, String^ /*newValue*/)
|
||||
void CalculationResult::OnDisplayValuePropertyChanged(String ^ /*oldValue*/, String ^ /*newValue*/)
|
||||
{
|
||||
UpdateTextState();
|
||||
}
|
||||
@@ -198,8 +197,8 @@ void CalculationResult::UpdateTextState()
|
||||
}
|
||||
|
||||
auto containerSize = m_textContainer->ActualWidth;
|
||||
String^ oldText = m_textBlock->Text;
|
||||
String^ newText = Utils::LRO + DisplayValue + Utils::PDF;
|
||||
String ^ oldText = m_textBlock->Text;
|
||||
String ^ newText = Utils::LRO + DisplayValue + Utils::PDF;
|
||||
|
||||
// Initiate the scaling operation
|
||||
// UpdateLayout will keep calling us until we make it through the below 2 if-statements
|
||||
@@ -241,11 +240,11 @@ void CalculationResult::UpdateTextState()
|
||||
m_isScalingText = false;
|
||||
if (IsOperatorCommand)
|
||||
{
|
||||
m_textContainer->ChangeView(0.0,nullptr,nullptr);
|
||||
m_textContainer->ChangeView(0.0, nullptr, nullptr);
|
||||
}
|
||||
else
|
||||
{
|
||||
m_textContainer->ChangeView(m_textContainer->ExtentWidth - m_textContainer->ViewportWidth,nullptr,nullptr);
|
||||
m_textContainer->ChangeView(m_textContainer->ExtentWidth - m_textContainer->ViewportWidth, nullptr, nullptr);
|
||||
}
|
||||
|
||||
if (m_scrollLeft && m_scrollRight)
|
||||
@@ -292,7 +291,7 @@ void CalculationResult::ScrollRight()
|
||||
}
|
||||
}
|
||||
|
||||
void CalculationResult::OnKeyDown(KeyRoutedEventArgs^ e)
|
||||
void CalculationResult::OnKeyDown(KeyRoutedEventArgs ^ e)
|
||||
{
|
||||
if (m_scrollLeft != nullptr && m_scrollRight != nullptr)
|
||||
{
|
||||
@@ -308,9 +307,9 @@ void CalculationResult::OnKeyDown(KeyRoutedEventArgs^ e)
|
||||
}
|
||||
}
|
||||
|
||||
void CalculationResult::OnScrollClick(Object^ sender, RoutedEventArgs^ /*e*/)
|
||||
void CalculationResult::OnScrollClick(Object ^ sender, RoutedEventArgs ^ /*e*/)
|
||||
{
|
||||
auto clicked = dynamic_cast<HyperlinkButton^>(sender);
|
||||
auto clicked = dynamic_cast<HyperlinkButton ^>(sender);
|
||||
if (clicked == m_scrollLeft)
|
||||
{
|
||||
this->ScrollLeft();
|
||||
@@ -321,7 +320,7 @@ void CalculationResult::OnScrollClick(Object^ sender, RoutedEventArgs^ /*e*/)
|
||||
}
|
||||
}
|
||||
|
||||
void CalculationResult::OnPointerEntered(Platform::Object^ sender, PointerRoutedEventArgs^ e)
|
||||
void CalculationResult::OnPointerEntered(Platform::Object ^ sender, PointerRoutedEventArgs ^ e)
|
||||
{
|
||||
if (e->Pointer->PointerDeviceType == PointerDeviceType::Mouse && m_textBlock->ActualWidth >= m_textContainer->ActualWidth)
|
||||
{
|
||||
@@ -358,7 +357,7 @@ void CalculationResult::UpdateScrollButtons()
|
||||
}
|
||||
}
|
||||
|
||||
void CalculationResult::OnPointerExited(Platform::Object^ sender, PointerRoutedEventArgs^ e)
|
||||
void CalculationResult::OnPointerExited(Platform::Object ^ sender, PointerRoutedEventArgs ^ e)
|
||||
{
|
||||
if (e->Pointer->PointerDeviceType == PointerDeviceType::Mouse)
|
||||
{
|
||||
@@ -366,7 +365,7 @@ void CalculationResult::OnPointerExited(Platform::Object^ sender, PointerRoutedE
|
||||
}
|
||||
}
|
||||
|
||||
void CalculationResult::ModifyFontAndMargin(TextBlock^ textBox, double fontChange)
|
||||
void CalculationResult::ModifyFontAndMargin(TextBlock ^ textBox, double fontChange)
|
||||
{
|
||||
double cur = textBox->FontSize;
|
||||
double newFontSize = 0.0;
|
||||
@@ -387,18 +386,18 @@ void CalculationResult::UpdateAllState()
|
||||
UpdateTextState();
|
||||
}
|
||||
|
||||
void CalculationResult::OnTapped(TappedRoutedEventArgs^ e)
|
||||
void CalculationResult::OnTapped(TappedRoutedEventArgs ^ e)
|
||||
{
|
||||
this->Focus(::FocusState::Programmatic);
|
||||
RaiseSelectedEvent();
|
||||
}
|
||||
|
||||
void CalculationResult::OnRightTapped(RightTappedRoutedEventArgs^ e)
|
||||
void CalculationResult::OnRightTapped(RightTappedRoutedEventArgs ^ e)
|
||||
{
|
||||
this->Focus(::FocusState::Programmatic);
|
||||
}
|
||||
|
||||
void CalculationResult::OnGotFocus(RoutedEventArgs^ e)
|
||||
void CalculationResult::OnGotFocus(RoutedEventArgs ^ e)
|
||||
{
|
||||
if (this->FocusState == ::FocusState::Keyboard)
|
||||
{
|
||||
@@ -406,12 +405,12 @@ void CalculationResult::OnGotFocus(RoutedEventArgs^ e)
|
||||
}
|
||||
}
|
||||
|
||||
void CalculationResult::OnLostFocus(RoutedEventArgs^ e)
|
||||
void CalculationResult::OnLostFocus(RoutedEventArgs ^ e)
|
||||
{
|
||||
VisualStateManager::GoToState(this, s_UnfocusedState, true);
|
||||
}
|
||||
|
||||
AutomationPeer^ CalculationResult::OnCreateAutomationPeer()
|
||||
AutomationPeer ^ CalculationResult::OnCreateAutomationPeer()
|
||||
{
|
||||
return ref new CalculationResultAutomationPeer(this);
|
||||
}
|
||||
|
@@ -9,9 +9,11 @@ namespace CalculatorApp
|
||||
{
|
||||
namespace Controls
|
||||
{
|
||||
public delegate void SelectedEventHandler(Platform::Object^ sender);
|
||||
public
|
||||
delegate void SelectedEventHandler(Platform::Object ^ sender);
|
||||
|
||||
public ref class CalculationResult sealed: public Windows::UI::Xaml::Controls::Control
|
||||
public
|
||||
ref class CalculationResult sealed : public Windows::UI::Xaml::Controls::Control
|
||||
{
|
||||
public:
|
||||
CalculationResult();
|
||||
@@ -24,45 +26,44 @@ namespace CalculatorApp
|
||||
DEPENDENCY_PROPERTY(Windows::UI::Xaml::Thickness, DisplayMargin);
|
||||
DEPENDENCY_PROPERTY(int, MaxExpressionHistoryCharacters);
|
||||
DEPENDENCY_PROPERTY_WITH_CALLBACK(bool, IsActive);
|
||||
DEPENDENCY_PROPERTY_WITH_CALLBACK(Windows::UI::Xaml::Media::Brush^, AccentColor);
|
||||
DEPENDENCY_PROPERTY_WITH_CALLBACK(Platform::String^, DisplayValue);
|
||||
DEPENDENCY_PROPERTY(Platform::String^, DisplayStringExpression);
|
||||
DEPENDENCY_PROPERTY_WITH_CALLBACK(Windows::UI::Xaml::Media::Brush ^, AccentColor);
|
||||
DEPENDENCY_PROPERTY_WITH_CALLBACK(Platform::String ^, DisplayValue);
|
||||
DEPENDENCY_PROPERTY(Platform::String ^, DisplayStringExpression);
|
||||
DEPENDENCY_PROPERTY_WITH_CALLBACK(bool, IsInError);
|
||||
DEPENDENCY_PROPERTY_WITH_DEFAULT(bool, IsOperatorCommand, false);
|
||||
|
||||
event SelectedEventHandler^ Selected;
|
||||
event SelectedEventHandler ^ Selected;
|
||||
void ProgrammaticSelect();
|
||||
|
||||
internal:
|
||||
void UpdateTextState();
|
||||
Platform::String^ GetRawDisplayValue();
|
||||
internal : void UpdateTextState();
|
||||
Platform::String ^ GetRawDisplayValue();
|
||||
|
||||
protected:
|
||||
virtual void OnKeyDown(Windows::UI::Xaml::Input::KeyRoutedEventArgs^ e) override;
|
||||
virtual void OnKeyDown(Windows::UI::Xaml::Input::KeyRoutedEventArgs ^ e) override;
|
||||
virtual void OnApplyTemplate() override;
|
||||
virtual void OnTapped(Windows::UI::Xaml::Input::TappedRoutedEventArgs^ e) override;
|
||||
virtual void OnPointerPressed(Windows::UI::Xaml::Input::PointerRoutedEventArgs^ e) override;
|
||||
virtual void OnRightTapped(Windows::UI::Xaml::Input::RightTappedRoutedEventArgs^ e) override;
|
||||
virtual void OnGotFocus(Windows::UI::Xaml::RoutedEventArgs^ e) override;
|
||||
virtual void OnLostFocus(Windows::UI::Xaml::RoutedEventArgs^ e) override;
|
||||
virtual void OnTapped(Windows::UI::Xaml::Input::TappedRoutedEventArgs ^ e) override;
|
||||
virtual void OnPointerPressed(Windows::UI::Xaml::Input::PointerRoutedEventArgs ^ e) override;
|
||||
virtual void OnRightTapped(Windows::UI::Xaml::Input::RightTappedRoutedEventArgs ^ e) override;
|
||||
virtual void OnGotFocus(Windows::UI::Xaml::RoutedEventArgs ^ e) override;
|
||||
virtual void OnLostFocus(Windows::UI::Xaml::RoutedEventArgs ^ e) override;
|
||||
|
||||
virtual Windows::UI::Xaml::Automation::Peers::AutomationPeer^ OnCreateAutomationPeer() override;
|
||||
virtual Windows::UI::Xaml::Automation::Peers::AutomationPeer ^ OnCreateAutomationPeer() override;
|
||||
|
||||
private:
|
||||
void OnIsActivePropertyChanged(bool oldValue, bool newValue);
|
||||
void OnAccentColorPropertyChanged(Windows::UI::Xaml::Media::Brush^ oldValue, Windows::UI::Xaml::Media::Brush^ newValue);
|
||||
void OnDisplayValuePropertyChanged(Platform::String^ oldValue, Platform::String^ newValue);
|
||||
void OnAccentColorPropertyChanged(Windows::UI::Xaml::Media::Brush ^ oldValue, Windows::UI::Xaml::Media::Brush ^ newValue);
|
||||
void OnDisplayValuePropertyChanged(Platform::String ^ oldValue, Platform::String ^ newValue);
|
||||
void OnIsInErrorPropertyChanged(bool oldValue, bool newValue);
|
||||
void OnMinFontSizePropertyChanged(double oldValue, double newValue);
|
||||
void OnMaxFontSizePropertyChanged(double oldValue, double newValue);
|
||||
void TextContainerSizeChanged(Object^ sender, Windows::UI::Xaml::SizeChangedEventArgs^ e);
|
||||
void OnTextContainerLayoutUpdated(Object^ sender, Object^ e);
|
||||
void TextContainerSizeChanged(Object ^ sender, Windows::UI::Xaml::SizeChangedEventArgs ^ e);
|
||||
void OnTextContainerLayoutUpdated(Object ^ sender, Object ^ e);
|
||||
void UpdateVisualState();
|
||||
void UpdateAllState();
|
||||
void OnScrollClick(Platform::Object^ sender, Windows::UI::Xaml::RoutedEventArgs^ e);
|
||||
void OnPointerEntered(Platform::Object^ sender, Windows::UI::Xaml::Input::PointerRoutedEventArgs^ e);
|
||||
void OnPointerExited(Platform::Object^ sender, Windows::UI::Xaml::Input::PointerRoutedEventArgs^ e);
|
||||
void ModifyFontAndMargin(Windows::UI::Xaml::Controls::TextBlock^ textBlock, double fontChange);
|
||||
void OnScrollClick(Platform::Object ^ sender, Windows::UI::Xaml::RoutedEventArgs ^ e);
|
||||
void OnPointerEntered(Platform::Object ^ sender, Windows::UI::Xaml::Input::PointerRoutedEventArgs ^ e);
|
||||
void OnPointerExited(Platform::Object ^ sender, Windows::UI::Xaml::Input::PointerRoutedEventArgs ^ e);
|
||||
void ModifyFontAndMargin(Windows::UI::Xaml::Controls::TextBlock ^ textBlock, double fontChange);
|
||||
void ShowHideScrollButtons(Windows::UI::Xaml::Visibility vLeft, Windows::UI::Xaml::Visibility vRight);
|
||||
void UpdateScrollButtons();
|
||||
void ScrollLeft();
|
||||
@@ -73,10 +74,10 @@ namespace CalculatorApp
|
||||
static Platform::StringReference s_FocusedState;
|
||||
static Platform::StringReference s_UnfocusedState;
|
||||
|
||||
Windows::UI::Xaml::Controls::ScrollViewer^ m_textContainer;
|
||||
Windows::UI::Xaml::Controls::TextBlock^ m_textBlock;
|
||||
Windows::UI::Xaml::Controls::HyperlinkButton^ m_scrollLeft;
|
||||
Windows::UI::Xaml::Controls::HyperlinkButton^ m_scrollRight;
|
||||
Windows::UI::Xaml::Controls::ScrollViewer ^ m_textContainer;
|
||||
Windows::UI::Xaml::Controls::TextBlock ^ m_textBlock;
|
||||
Windows::UI::Xaml::Controls::HyperlinkButton ^ m_scrollLeft;
|
||||
Windows::UI::Xaml::Controls::HyperlinkButton ^ m_scrollRight;
|
||||
double scrollRatio = 0.7;
|
||||
bool m_isScalingText;
|
||||
bool m_haveCalculatedMax;
|
||||
|
@@ -9,16 +9,16 @@ using namespace Windows::UI::Xaml::Automation::Peers;
|
||||
|
||||
namespace CalculatorApp::Controls
|
||||
{
|
||||
CalculationResultAutomationPeer::CalculationResultAutomationPeer(FrameworkElement^ owner) :
|
||||
FrameworkElementAutomationPeer(owner)
|
||||
{ }
|
||||
CalculationResultAutomationPeer::CalculationResultAutomationPeer(FrameworkElement ^ owner) : FrameworkElementAutomationPeer(owner)
|
||||
{
|
||||
}
|
||||
|
||||
AutomationControlType CalculationResultAutomationPeer::GetAutomationControlTypeCore()
|
||||
{
|
||||
return AutomationControlType::Text;
|
||||
}
|
||||
|
||||
Platform::Object^ CalculationResultAutomationPeer::GetPatternCore(PatternInterface pattern)
|
||||
Platform::Object ^ CalculationResultAutomationPeer::GetPatternCore(PatternInterface pattern)
|
||||
{
|
||||
if (pattern == PatternInterface::Invoke)
|
||||
{
|
||||
@@ -30,7 +30,7 @@ namespace CalculatorApp::Controls
|
||||
|
||||
void CalculationResultAutomationPeer::Invoke()
|
||||
{
|
||||
auto owner = static_cast<CalculationResult^>(this->Owner);
|
||||
auto owner = static_cast<CalculationResult ^>(this->Owner);
|
||||
owner->ProgrammaticSelect();
|
||||
}
|
||||
}
|
||||
|
@@ -9,14 +9,15 @@ namespace CalculatorApp
|
||||
{
|
||||
namespace Controls
|
||||
{
|
||||
public ref class CalculationResultAutomationPeer sealed : Windows::UI::Xaml::Automation::Peers::FrameworkElementAutomationPeer,
|
||||
Windows::UI::Xaml::Automation::Provider::IInvokeProvider
|
||||
public
|
||||
ref class CalculationResultAutomationPeer sealed : Windows::UI::Xaml::Automation::Peers::FrameworkElementAutomationPeer,
|
||||
Windows::UI::Xaml::Automation::Provider::IInvokeProvider
|
||||
{
|
||||
public:
|
||||
CalculationResultAutomationPeer(Windows::UI::Xaml::FrameworkElement^ owner);
|
||||
CalculationResultAutomationPeer(Windows::UI::Xaml::FrameworkElement ^ owner);
|
||||
|
||||
virtual Windows::UI::Xaml::Automation::Peers::AutomationControlType GetAutomationControlTypeCore() override;
|
||||
virtual Platform::Object^ GetPatternCore(Windows::UI::Xaml::Automation::Peers::PatternInterface pattern) override;
|
||||
virtual Platform::Object ^ GetPatternCore(Windows::UI::Xaml::Automation::Peers::PatternInterface pattern) override;
|
||||
virtual void Invoke();
|
||||
};
|
||||
}
|
||||
|
@@ -26,12 +26,12 @@ CalculatorButton::CalculatorButton()
|
||||
{
|
||||
// Set the default bindings for this button, these can be overwritten by Xaml if needed
|
||||
// These are a replacement for binding in styles
|
||||
Binding^ commandBinding = ref new Binding();
|
||||
Binding ^ commandBinding = ref new Binding();
|
||||
commandBinding->Path = ref new PropertyPath("ButtonPressed");
|
||||
this->SetBinding(Button::CommandProperty, commandBinding);
|
||||
}
|
||||
|
||||
void CalculatorButton::OnKeyDown(KeyRoutedEventArgs^ e)
|
||||
void CalculatorButton::OnKeyDown(KeyRoutedEventArgs ^ e)
|
||||
{
|
||||
// Ignore the Enter key
|
||||
if (e->Key == VirtualKey::Enter)
|
||||
@@ -42,7 +42,7 @@ void CalculatorButton::OnKeyDown(KeyRoutedEventArgs^ e)
|
||||
Button::OnKeyDown(e);
|
||||
}
|
||||
|
||||
void CalculatorButton::OnKeyUp(KeyRoutedEventArgs^ e)
|
||||
void CalculatorButton::OnKeyUp(KeyRoutedEventArgs ^ e)
|
||||
{
|
||||
// Ignore the Enter key
|
||||
if (e->Key == VirtualKey::Enter)
|
||||
@@ -53,16 +53,12 @@ void CalculatorButton::OnKeyUp(KeyRoutedEventArgs^ e)
|
||||
Button::OnKeyUp(e);
|
||||
}
|
||||
|
||||
void CalculatorButton::OnButtonIdPropertyChanged(
|
||||
NumbersAndOperatorsEnum /*oldValue*/,
|
||||
NumbersAndOperatorsEnum newValue)
|
||||
void CalculatorButton::OnButtonIdPropertyChanged(NumbersAndOperatorsEnum /*oldValue*/, NumbersAndOperatorsEnum newValue)
|
||||
{
|
||||
this->CommandParameter = ref new CalculatorButtonPressedEventArgs(AuditoryFeedback, newValue);
|
||||
}
|
||||
|
||||
void CalculatorButton::OnAuditoryFeedbackPropertyChanged(
|
||||
String^ /*oldValue*/,
|
||||
String^ newValue)
|
||||
void CalculatorButton::OnAuditoryFeedbackPropertyChanged(String ^ /*oldValue*/, String ^ newValue)
|
||||
{
|
||||
this->CommandParameter = ref new CalculatorButtonPressedEventArgs(newValue, ButtonId);
|
||||
}
|
||||
|
@@ -10,29 +10,27 @@ namespace CalculatorApp
|
||||
{
|
||||
namespace Controls
|
||||
{
|
||||
public ref class CalculatorButton sealed: Windows::UI::Xaml::Controls::Button
|
||||
public
|
||||
ref class CalculatorButton sealed : Windows::UI::Xaml::Controls::Button
|
||||
{
|
||||
public:
|
||||
|
||||
CalculatorButton();
|
||||
DEPENDENCY_PROPERTY_OWNER(CalculatorButton);
|
||||
|
||||
DEPENDENCY_PROPERTY_WITH_CALLBACK(NumbersAndOperatorsEnum, ButtonId);
|
||||
DEPENDENCY_PROPERTY_WITH_CALLBACK(Platform::String^, AuditoryFeedback);
|
||||
DEPENDENCY_PROPERTY(Windows::UI::Xaml::Media::Brush^, HoverBackground);
|
||||
DEPENDENCY_PROPERTY(Windows::UI::Xaml::Media::Brush^, HoverForeground);
|
||||
DEPENDENCY_PROPERTY(Windows::UI::Xaml::Media::Brush^, PressBackground);
|
||||
DEPENDENCY_PROPERTY(Windows::UI::Xaml::Media::Brush^, PressForeground);
|
||||
DEPENDENCY_PROPERTY_WITH_CALLBACK(Platform::String ^, AuditoryFeedback);
|
||||
DEPENDENCY_PROPERTY(Windows::UI::Xaml::Media::Brush ^, HoverBackground);
|
||||
DEPENDENCY_PROPERTY(Windows::UI::Xaml::Media::Brush ^, HoverForeground);
|
||||
DEPENDENCY_PROPERTY(Windows::UI::Xaml::Media::Brush ^, PressBackground);
|
||||
DEPENDENCY_PROPERTY(Windows::UI::Xaml::Media::Brush ^, PressForeground);
|
||||
|
||||
protected:
|
||||
|
||||
virtual void OnKeyDown(Windows::UI::Xaml::Input::KeyRoutedEventArgs^ e) override;
|
||||
virtual void OnKeyUp(Windows::UI::Xaml::Input::KeyRoutedEventArgs^ e) override;
|
||||
virtual void OnKeyDown(Windows::UI::Xaml::Input::KeyRoutedEventArgs ^ e) override;
|
||||
virtual void OnKeyUp(Windows::UI::Xaml::Input::KeyRoutedEventArgs ^ e) override;
|
||||
|
||||
private:
|
||||
|
||||
void OnButtonIdPropertyChanged(NumbersAndOperatorsEnum oldValue, NumbersAndOperatorsEnum newValue);
|
||||
void OnAuditoryFeedbackPropertyChanged(Platform::String^ oldValue, Platform::String^ newValue);
|
||||
void OnAuditoryFeedbackPropertyChanged(Platform::String ^ oldValue, Platform::String ^ newValue);
|
||||
};
|
||||
}
|
||||
}
|
||||
|
@@ -19,8 +19,7 @@ DEPENDENCY_PROPERTY_INITIALIZATION(FlipButtons, HoverForeground);
|
||||
DEPENDENCY_PROPERTY_INITIALIZATION(FlipButtons, PressBackground);
|
||||
DEPENDENCY_PROPERTY_INITIALIZATION(FlipButtons, PressForeground);
|
||||
|
||||
|
||||
void FlipButtons::OnKeyDown(KeyRoutedEventArgs^ e)
|
||||
void FlipButtons::OnKeyDown(KeyRoutedEventArgs ^ e)
|
||||
{
|
||||
// Ignore the Enter key
|
||||
if (e->Key == VirtualKey::Enter)
|
||||
@@ -31,7 +30,7 @@ void FlipButtons::OnKeyDown(KeyRoutedEventArgs^ e)
|
||||
ToggleButton::OnKeyDown(e);
|
||||
}
|
||||
|
||||
void FlipButtons::OnKeyUp(KeyRoutedEventArgs^ e)
|
||||
void FlipButtons::OnKeyUp(KeyRoutedEventArgs ^ e)
|
||||
{
|
||||
// Ignore the Enter key
|
||||
if (e->Key == VirtualKey::Enter)
|
||||
@@ -42,10 +41,7 @@ void FlipButtons::OnKeyUp(KeyRoutedEventArgs^ e)
|
||||
ToggleButton::OnKeyUp(e);
|
||||
}
|
||||
|
||||
void FlipButtons::OnButtonIdPropertyChanged(
|
||||
NumbersAndOperatorsEnum /*oldValue*/,
|
||||
NumbersAndOperatorsEnum newValue)
|
||||
void FlipButtons::OnButtonIdPropertyChanged(NumbersAndOperatorsEnum /*oldValue*/, NumbersAndOperatorsEnum newValue)
|
||||
{
|
||||
this->CommandParameter = newValue;
|
||||
}
|
||||
|
||||
|
@@ -10,27 +10,24 @@ namespace CalculatorApp
|
||||
{
|
||||
namespace Controls
|
||||
{
|
||||
public ref class FlipButtons sealed: Windows::UI::Xaml::Controls::Primitives::ToggleButton
|
||||
public
|
||||
ref class FlipButtons sealed : Windows::UI::Xaml::Controls::Primitives::ToggleButton
|
||||
{
|
||||
public:
|
||||
DEPENDENCY_PROPERTY_OWNER(FlipButtons);
|
||||
|
||||
DEPENDENCY_PROPERTY_WITH_CALLBACK(NumbersAndOperatorsEnum, ButtonId);
|
||||
DEPENDENCY_PROPERTY(Windows::UI::Xaml::Media::Brush^, HoverBackground);
|
||||
DEPENDENCY_PROPERTY(Windows::UI::Xaml::Media::Brush^, HoverForeground);
|
||||
DEPENDENCY_PROPERTY(Windows::UI::Xaml::Media::Brush^, PressBackground);
|
||||
DEPENDENCY_PROPERTY(Windows::UI::Xaml::Media::Brush^, PressForeground);
|
||||
DEPENDENCY_PROPERTY(Windows::UI::Xaml::Media::Brush ^, HoverBackground);
|
||||
DEPENDENCY_PROPERTY(Windows::UI::Xaml::Media::Brush ^, HoverForeground);
|
||||
DEPENDENCY_PROPERTY(Windows::UI::Xaml::Media::Brush ^, PressBackground);
|
||||
DEPENDENCY_PROPERTY(Windows::UI::Xaml::Media::Brush ^, PressForeground);
|
||||
|
||||
protected:
|
||||
|
||||
virtual void OnKeyDown(Windows::UI::Xaml::Input::KeyRoutedEventArgs^ e) override;
|
||||
virtual void OnKeyUp(Windows::UI::Xaml::Input::KeyRoutedEventArgs^ e) override;
|
||||
virtual void OnKeyDown(Windows::UI::Xaml::Input::KeyRoutedEventArgs ^ e) override;
|
||||
virtual void OnKeyUp(Windows::UI::Xaml::Input::KeyRoutedEventArgs ^ e) override;
|
||||
|
||||
private:
|
||||
|
||||
void OnButtonIdPropertyChanged(
|
||||
NumbersAndOperatorsEnum oldValue,
|
||||
NumbersAndOperatorsEnum newValue);
|
||||
void OnButtonIdPropertyChanged(NumbersAndOperatorsEnum oldValue, NumbersAndOperatorsEnum newValue);
|
||||
};
|
||||
}
|
||||
}
|
||||
|
@@ -55,16 +55,15 @@ Size HorizontalNoOverflowStackPanel::ArrangeOverride(Size finalSize)
|
||||
float itemWidth = item->DesiredSize.Width;
|
||||
if (widthAvailable > 0 && itemWidth <= widthAvailable)
|
||||
{
|
||||
//stack the items horizontally (left to right)
|
||||
// stack the items horizontally (left to right)
|
||||
item->Arrange(Rect(posX, 0, itemWidth, finalSize.Height));
|
||||
posX += item->RenderSize.Width;
|
||||
}
|
||||
else
|
||||
{
|
||||
//Not display the item
|
||||
// Not display the item
|
||||
item->Arrange(Rect(0, 0, 0, 0));
|
||||
}
|
||||
}
|
||||
return finalSize;
|
||||
}
|
||||
|
||||
|
@@ -13,12 +13,15 @@ namespace CalculatorApp
|
||||
{
|
||||
namespace Controls
|
||||
{
|
||||
public ref class HorizontalNoOverflowStackPanel : public Windows::UI::Xaml::Controls::Panel
|
||||
public
|
||||
ref class HorizontalNoOverflowStackPanel : public Windows::UI::Xaml::Controls::Panel
|
||||
{
|
||||
DEPENDENCY_PROPERTY_OWNER(HorizontalNoOverflowStackPanel);
|
||||
//Prioritize the last item over all other items (except the first one)
|
||||
internal:
|
||||
HorizontalNoOverflowStackPanel() {}
|
||||
// Prioritize the last item over all other items (except the first one)
|
||||
internal : HorizontalNoOverflowStackPanel()
|
||||
{
|
||||
}
|
||||
|
||||
protected:
|
||||
virtual Windows::Foundation::Size MeasureOverride(Windows::Foundation::Size availableSize) override;
|
||||
virtual Windows::Foundation::Size ArrangeOverride(Windows::Foundation::Size finalSize) override;
|
||||
|
@@ -35,22 +35,23 @@ void OverflowTextBlock::OnApplyTemplate()
|
||||
auto uiElement = GetTemplateChild("ExpressionContainer");
|
||||
if (uiElement != nullptr)
|
||||
{
|
||||
m_expressionContainer = safe_cast<ScrollViewer^>(uiElement);
|
||||
m_expressionContainer = safe_cast<ScrollViewer ^>(uiElement);
|
||||
m_expressionContainer->ChangeView(m_expressionContainer->ExtentWidth - m_expressionContainer->ViewportWidth, nullptr, nullptr);
|
||||
m_containerViewChangedToken = m_expressionContainer->ViewChanged += ref new EventHandler<ScrollViewerViewChangedEventArgs ^>(this, &OverflowTextBlock::OnViewChanged);
|
||||
m_containerViewChangedToken = m_expressionContainer->ViewChanged +=
|
||||
ref new EventHandler<ScrollViewerViewChangedEventArgs ^>(this, &OverflowTextBlock::OnViewChanged);
|
||||
}
|
||||
|
||||
uiElement = GetTemplateChild("ScrollLeft");
|
||||
if (uiElement != nullptr)
|
||||
{
|
||||
m_scrollLeft = safe_cast<Button^>(uiElement);
|
||||
m_scrollLeft = safe_cast<Button ^>(uiElement);
|
||||
m_scrollLeftClickEventToken = m_scrollLeft->Click += ref new RoutedEventHandler(this, &OverflowTextBlock::OnScrollClick);
|
||||
}
|
||||
|
||||
uiElement = GetTemplateChild("ScrollRight");
|
||||
if (uiElement != nullptr)
|
||||
{
|
||||
m_scrollRight = safe_cast<Button^>(uiElement);
|
||||
m_scrollRight = safe_cast<Button ^>(uiElement);
|
||||
m_scrollRightClickEventToken = m_scrollRight->Click += ref new RoutedEventHandler(this, &OverflowTextBlock::OnScrollClick);
|
||||
}
|
||||
|
||||
@@ -60,13 +61,13 @@ void OverflowTextBlock::OnApplyTemplate()
|
||||
uiElement = GetTemplateChild("TokenList");
|
||||
if (uiElement != nullptr)
|
||||
{
|
||||
m_itemsControl = safe_cast<ItemsControl^>(uiElement);
|
||||
m_itemsControl = safe_cast<ItemsControl ^>(uiElement);
|
||||
}
|
||||
|
||||
UpdateAllState();
|
||||
}
|
||||
|
||||
AutomationPeer^ OverflowTextBlock::OnCreateAutomationPeer()
|
||||
AutomationPeer ^ OverflowTextBlock::OnCreateAutomationPeer()
|
||||
{
|
||||
return ref new OverflowTextBlockAutomationPeer(this);
|
||||
}
|
||||
@@ -82,8 +83,7 @@ void OverflowTextBlock::OnTokensUpdatedPropertyChanged(bool /*oldValue*/, bool n
|
||||
if (m_isAccessibilityViewControl != newIsAccessibilityViewControl)
|
||||
{
|
||||
m_isAccessibilityViewControl = newIsAccessibilityViewControl;
|
||||
AutomationProperties::SetAccessibilityView(this,
|
||||
newIsAccessibilityViewControl ? AccessibilityView::Control : AccessibilityView::Raw);
|
||||
AutomationProperties::SetAccessibilityView(this, newIsAccessibilityViewControl ? AccessibilityView::Control : AccessibilityView::Raw);
|
||||
}
|
||||
UpdateScrollButtons();
|
||||
}
|
||||
@@ -129,9 +129,9 @@ void OverflowTextBlock::ScrollRight()
|
||||
}
|
||||
}
|
||||
|
||||
void OverflowTextBlock::OnScrollClick(_In_ Object^ sender, _In_ RoutedEventArgs^)
|
||||
void OverflowTextBlock::OnScrollClick(_In_ Object ^ sender, _In_ RoutedEventArgs ^)
|
||||
{
|
||||
auto clicked = safe_cast<Button^>(sender);
|
||||
auto clicked = safe_cast<Button ^>(sender);
|
||||
if (clicked == m_scrollLeft)
|
||||
{
|
||||
ScrollLeft();
|
||||
@@ -155,7 +155,8 @@ void OverflowTextBlock::UpdateScrollButtons()
|
||||
ShowHideScrollButtons(::Visibility::Collapsed, ::Visibility::Collapsed);
|
||||
}
|
||||
// We have more number on both side. Show both arrows
|
||||
else if ((m_expressionContainer->HorizontalOffset > 0) && (m_expressionContainer->HorizontalOffset < (m_expressionContainer->ExtentWidth - m_expressionContainer->ViewportWidth)))
|
||||
else if ((m_expressionContainer->HorizontalOffset > 0)
|
||||
&& (m_expressionContainer->HorizontalOffset < (m_expressionContainer->ExtentWidth - m_expressionContainer->ViewportWidth)))
|
||||
{
|
||||
ShowHideScrollButtons(::Visibility::Visible, ::Visibility::Visible);
|
||||
}
|
||||
@@ -214,7 +215,7 @@ void OverflowTextBlock::UnregisterEventHandlers()
|
||||
}
|
||||
}
|
||||
|
||||
void OverflowTextBlock::OnViewChanged(_In_opt_ Object^ /*sender*/, _In_opt_ ScrollViewerViewChangedEventArgs^ /*args*/)
|
||||
void OverflowTextBlock::OnViewChanged(_In_opt_ Object ^ /*sender*/, _In_opt_ ScrollViewerViewChangedEventArgs ^ /*args*/)
|
||||
{
|
||||
UpdateScrollButtons();
|
||||
}
|
||||
|
@@ -9,7 +9,8 @@ namespace CalculatorApp
|
||||
{
|
||||
namespace Controls
|
||||
{
|
||||
public ref class OverflowTextBlock sealed : public Windows::UI::Xaml::Controls::Control
|
||||
public
|
||||
ref class OverflowTextBlock sealed : public Windows::UI::Xaml::Controls::Control
|
||||
{
|
||||
public:
|
||||
OverflowTextBlock()
|
||||
@@ -20,21 +21,21 @@ namespace CalculatorApp
|
||||
|
||||
DEPENDENCY_PROPERTY_WITH_CALLBACK(bool, TokensUpdated);
|
||||
DEPENDENCY_PROPERTY(bool, IsActive);
|
||||
DEPENDENCY_PROPERTY(Windows::UI::Xaml::Style^, TextStyle);
|
||||
DEPENDENCY_PROPERTY(Windows::UI::Xaml::Style ^, TextStyle);
|
||||
void UpdateScrollButtons();
|
||||
void UnregisterEventHandlers();
|
||||
|
||||
protected:
|
||||
virtual void OnApplyTemplate() override;
|
||||
virtual Windows::UI::Xaml::Automation::Peers::AutomationPeer^ OnCreateAutomationPeer() override;
|
||||
virtual Windows::UI::Xaml::Automation::Peers::AutomationPeer ^ OnCreateAutomationPeer() override;
|
||||
|
||||
private:
|
||||
void OnScrollClick(_In_ Platform::Object^ sender, _In_ Windows::UI::Xaml::RoutedEventArgs^ e);
|
||||
void OnPointerEntered(_In_ Platform::Object^ sender, _In_ Windows::UI::Xaml::Input::PointerRoutedEventArgs^ e);
|
||||
void OnPointerExited(_In_ Platform::Object^ sender, _In_ Windows::UI::Xaml::Input::PointerRoutedEventArgs^ e);
|
||||
void OnScrollClick(_In_ Platform::Object ^ sender, _In_ Windows::UI::Xaml::RoutedEventArgs ^ e);
|
||||
void OnPointerEntered(_In_ Platform::Object ^ sender, _In_ Windows::UI::Xaml::Input::PointerRoutedEventArgs ^ e);
|
||||
void OnPointerExited(_In_ Platform::Object ^ sender, _In_ Windows::UI::Xaml::Input::PointerRoutedEventArgs ^ e);
|
||||
void ShowHideScrollButtons(Windows::UI::Xaml::Visibility vLeft, Windows::UI::Xaml::Visibility vRight);
|
||||
void OnTokensUpdatedPropertyChanged(bool oldValue, bool newValue);
|
||||
void OnViewChanged(_In_opt_ Platform::Object ^sender, _In_opt_ Windows::UI::Xaml::Controls::ScrollViewerViewChangedEventArgs ^args);
|
||||
void OnViewChanged(_In_opt_ Platform::Object ^ sender, _In_opt_ Windows::UI::Xaml::Controls::ScrollViewerViewChangedEventArgs ^ args);
|
||||
|
||||
void UpdateVisualState();
|
||||
void UpdateExpressionState();
|
||||
@@ -46,10 +47,10 @@ namespace CalculatorApp
|
||||
bool m_scrollingLeft;
|
||||
bool m_scrollingRight;
|
||||
bool m_isAccessibilityViewControl;
|
||||
Windows::UI::Xaml::Controls::ItemsControl^ m_itemsControl;
|
||||
Windows::UI::Xaml::Controls::ScrollViewer^ m_expressionContainer;
|
||||
Windows::UI::Xaml::Controls::Button^ m_scrollLeft;
|
||||
Windows::UI::Xaml::Controls::Button^ m_scrollRight;
|
||||
Windows::UI::Xaml::Controls::ItemsControl ^ m_itemsControl;
|
||||
Windows::UI::Xaml::Controls::ScrollViewer ^ m_expressionContainer;
|
||||
Windows::UI::Xaml::Controls::Button ^ m_scrollLeft;
|
||||
Windows::UI::Xaml::Controls::Button ^ m_scrollRight;
|
||||
|
||||
Windows::Foundation::EventRegistrationToken m_scrollLeftClickEventToken;
|
||||
Windows::Foundation::EventRegistrationToken m_scrollRightClickEventToken;
|
||||
|
@@ -10,16 +10,16 @@ using namespace Windows::Foundation::Collections;
|
||||
|
||||
namespace CalculatorApp::Controls
|
||||
{
|
||||
OverflowTextBlockAutomationPeer::OverflowTextBlockAutomationPeer(OverflowTextBlock^ owner) :
|
||||
FrameworkElementAutomationPeer(owner)
|
||||
{ }
|
||||
OverflowTextBlockAutomationPeer::OverflowTextBlockAutomationPeer(OverflowTextBlock ^ owner) : FrameworkElementAutomationPeer(owner)
|
||||
{
|
||||
}
|
||||
|
||||
AutomationControlType OverflowTextBlockAutomationPeer::GetAutomationControlTypeCore()
|
||||
{
|
||||
return AutomationControlType::Text;
|
||||
}
|
||||
|
||||
IVector<AutomationPeer^>^ OverflowTextBlockAutomationPeer::GetChildrenCore()
|
||||
IVector<AutomationPeer ^> ^ OverflowTextBlockAutomationPeer::GetChildrenCore()
|
||||
{
|
||||
return nullptr;
|
||||
}
|
||||
|
@@ -9,13 +9,14 @@ namespace CalculatorApp
|
||||
{
|
||||
namespace Controls
|
||||
{
|
||||
public ref class OverflowTextBlockAutomationPeer sealed : Windows::UI::Xaml::Automation::Peers::FrameworkElementAutomationPeer
|
||||
public
|
||||
ref class OverflowTextBlockAutomationPeer sealed : Windows::UI::Xaml::Automation::Peers::FrameworkElementAutomationPeer
|
||||
{
|
||||
public:
|
||||
OverflowTextBlockAutomationPeer(OverflowTextBlock^ owner);
|
||||
OverflowTextBlockAutomationPeer(OverflowTextBlock ^ owner);
|
||||
|
||||
virtual Windows::UI::Xaml::Automation::Peers::AutomationControlType GetAutomationControlTypeCore() override;
|
||||
virtual Windows::Foundation::Collections::IVector<Windows::UI::Xaml::Automation::Peers::AutomationPeer^>^ GetChildrenCore() override;
|
||||
virtual Windows::Foundation::Collections::IVector<Windows::UI::Xaml::Automation::Peers::AutomationPeer ^> ^ GetChildrenCore() override;
|
||||
};
|
||||
}
|
||||
}
|
||||
|
@@ -16,10 +16,10 @@ using namespace Windows::UI::Xaml;
|
||||
using namespace Windows::UI::Xaml::Input;
|
||||
using namespace Windows::UI::Xaml::Data;
|
||||
|
||||
String^ RadixButton::GetRawDisplayValue()
|
||||
String ^ RadixButton::GetRawDisplayValue()
|
||||
{
|
||||
wstring rawValue;
|
||||
String^ radixContent = Content->ToString();
|
||||
String ^ radixContent = Content->ToString();
|
||||
LocalizationSettings::GetInstance().RemoveGroupSeparators(radixContent->Data(), radixContent->Length(), &rawValue);
|
||||
return ref new String(rawValue.c_str());
|
||||
}
|
||||
|
@@ -7,12 +7,12 @@ namespace CalculatorApp
|
||||
{
|
||||
namespace Controls
|
||||
{
|
||||
public ref class RadixButton sealed : public Windows::UI::Xaml::Controls::RadioButton
|
||||
public
|
||||
ref class RadixButton sealed : public Windows::UI::Xaml::Controls::RadioButton
|
||||
{
|
||||
public:
|
||||
RadixButton() {};
|
||||
internal:
|
||||
Platform::String^ GetRawDisplayValue();
|
||||
RadixButton(){};
|
||||
internal : Platform::String ^ GetRawDisplayValue();
|
||||
};
|
||||
}
|
||||
}
|
||||
|
@@ -18,23 +18,23 @@ using namespace Platform;
|
||||
using namespace Windows::Foundation::Collections;
|
||||
using namespace std;
|
||||
|
||||
DependencyObject^ SupplementaryItemsControl::GetContainerForItemOverride()
|
||||
DependencyObject ^ SupplementaryItemsControl::GetContainerForItemOverride()
|
||||
{
|
||||
return ref new SupplementaryContentPresenter();
|
||||
}
|
||||
|
||||
void SupplementaryItemsControl::PrepareContainerForItemOverride(DependencyObject^ element, Object^ item)
|
||||
void SupplementaryItemsControl::PrepareContainerForItemOverride(DependencyObject ^ element, Object ^ item)
|
||||
{
|
||||
ItemsControl::PrepareContainerForItemOverride(element, item);
|
||||
|
||||
auto supplementaryResult = dynamic_cast<SupplementaryResult^>(item);
|
||||
auto supplementaryResult = dynamic_cast<SupplementaryResult ^>(item);
|
||||
if (supplementaryResult)
|
||||
{
|
||||
AutomationProperties::SetName(element, supplementaryResult->GetLocalizedAutomationName());
|
||||
}
|
||||
}
|
||||
|
||||
AutomationPeer^ SupplementaryContentPresenter::OnCreateAutomationPeer()
|
||||
{
|
||||
return ref new SupplementaryContentPresenterAP(this);
|
||||
}
|
||||
AutomationPeer ^ SupplementaryContentPresenter::OnCreateAutomationPeer()
|
||||
{
|
||||
return ref new SupplementaryContentPresenterAP(this);
|
||||
}
|
||||
|
@@ -3,45 +3,52 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
namespace CalculatorApp { namespace Controls {
|
||||
|
||||
public ref class SupplementaryItemsControl sealed: public Windows::UI::Xaml::Controls::ItemsControl
|
||||
namespace CalculatorApp
|
||||
{
|
||||
namespace Controls
|
||||
{
|
||||
public:
|
||||
SupplementaryItemsControl()
|
||||
{ }
|
||||
|
||||
protected:
|
||||
virtual Windows::UI::Xaml::DependencyObject^ GetContainerForItemOverride() override;
|
||||
virtual void PrepareContainerForItemOverride(Windows::UI::Xaml::DependencyObject^ element, Platform::Object^ item) override;
|
||||
};
|
||||
|
||||
public ref class SupplementaryContentPresenter sealed: public Windows::UI::Xaml::Controls::ContentPresenter
|
||||
{
|
||||
public:
|
||||
SupplementaryContentPresenter()
|
||||
{ }
|
||||
|
||||
protected:
|
||||
virtual Windows::UI::Xaml::Automation::Peers::AutomationPeer^ OnCreateAutomationPeer() override;
|
||||
};
|
||||
|
||||
ref class SupplementaryContentPresenterAP sealed: public Windows::UI::Xaml::Automation::Peers::FrameworkElementAutomationPeer
|
||||
{
|
||||
protected:
|
||||
virtual Windows::UI::Xaml::Automation::Peers::AutomationControlType GetAutomationControlTypeCore() override
|
||||
public
|
||||
ref class SupplementaryItemsControl sealed : public Windows::UI::Xaml::Controls::ItemsControl
|
||||
{
|
||||
return Windows::UI::Xaml::Automation::Peers::AutomationControlType::Text;
|
||||
}
|
||||
public:
|
||||
SupplementaryItemsControl()
|
||||
{
|
||||
}
|
||||
|
||||
virtual Windows::Foundation::Collections::IVector<Windows::UI::Xaml::Automation::Peers::AutomationPeer^>^ GetChildrenCore() override
|
||||
protected:
|
||||
virtual Windows::UI::Xaml::DependencyObject ^ GetContainerForItemOverride() override;
|
||||
virtual void PrepareContainerForItemOverride(Windows::UI::Xaml::DependencyObject ^ element, Platform::Object ^ item) override;
|
||||
};
|
||||
|
||||
public
|
||||
ref class SupplementaryContentPresenter sealed : public Windows::UI::Xaml::Controls::ContentPresenter
|
||||
{
|
||||
return nullptr;
|
||||
}
|
||||
public:
|
||||
SupplementaryContentPresenter()
|
||||
{
|
||||
}
|
||||
|
||||
internal:
|
||||
SupplementaryContentPresenterAP(SupplementaryContentPresenter^ owner):
|
||||
Windows::UI::Xaml::Automation::Peers::FrameworkElementAutomationPeer(owner)
|
||||
{ }
|
||||
};
|
||||
}}
|
||||
protected:
|
||||
virtual Windows::UI::Xaml::Automation::Peers::AutomationPeer ^ OnCreateAutomationPeer() override;
|
||||
};
|
||||
|
||||
ref class SupplementaryContentPresenterAP sealed : public Windows::UI::Xaml::Automation::Peers::FrameworkElementAutomationPeer
|
||||
{
|
||||
protected:
|
||||
virtual Windows::UI::Xaml::Automation::Peers::AutomationControlType GetAutomationControlTypeCore() override
|
||||
{
|
||||
return Windows::UI::Xaml::Automation::Peers::AutomationControlType::Text;
|
||||
}
|
||||
|
||||
virtual Windows::Foundation::Collections::IVector<Windows::UI::Xaml::Automation::Peers::AutomationPeer ^> ^ GetChildrenCore() override
|
||||
{
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
internal : SupplementaryContentPresenterAP(SupplementaryContentPresenter ^ owner)
|
||||
: Windows::UI::Xaml::Automation::Peers::FrameworkElementAutomationPeer(owner)
|
||||
{
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user