| 8 | namespace winrt::TranslucentTB::Xaml::Controls::implementation |
| 9 | { |
| 10 | struct ConstrainedBox : ConstrainedBoxT<ConstrainedBox> |
| 11 | { |
| 12 | private: |
| 13 | // make DECL_DEPENDENCY_PROPERTY_WITH_METADATA below work |
| 14 | static void OnDependencyPropertyChanged(const IInspectable &sender, const wux::DependencyPropertyChangedEventArgs &args); |
| 15 | |
| 16 | public: |
| 17 | ConstrainedBox() = default; |
| 18 | |
| 19 | wf::Size MeasureOverride(wf::Size availableSize); |
| 20 | wf::Size ArrangeOverride(wf::Size finalSize); |
| 21 | |
| 22 | DECL_DEPENDENCY_PROPERTY_WITH_METADATA(int32_t, MultipleX, |
| 23 | wux::PropertyMetadata(box_value(1), OnDependencyPropertyChanged)); |
| 24 | |
| 25 | DECL_DEPENDENCY_PROPERTY_WITH_METADATA(int32_t, MultipleY, |
| 26 | wux::PropertyMetadata(box_value(1), OnDependencyPropertyChanged)); |
| 27 | |
| 28 | private: |
| 29 | static bool IsPositiveRealNumber(double value) noexcept; |
| 30 | static void ApplyMultiple(int32_t multiple, float &value) noexcept; |
| 31 | void CalculateConstrainedSize(wf::Size &availableSize); |
| 32 | |
| 33 | // Value used to determine when we re-calculate in the arrange step or re-use a previous calculation. Within roughly a pixel seems like a good value? |
| 34 | static constexpr double CALCULATION_TOLERANCE = 1.5; |
| 35 | |
| 36 | wf::Size m_OriginalSize = { }; |
| 37 | wf::Size m_LastMeasuredSize = { }; |
| 38 | }; |
| 39 | } |
| 40 | |
| 41 | FACTORY(winrt::TranslucentTB::Xaml::Controls, ConstrainedBox); |
nothing calls this directly
no outgoing calls
no test coverage detected