Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include "Controls/AttributeControl.h"
- #include <NsCore/ReflectionImplement.h>
- #include <NsGui/ResourceKeyType.h>
- #include <NsGui/UIElementData.h>
- #include <NsGui/FrameworkPropertyMetadata.h>
- using namespace Noesis;
- using namespace Frontier::UI::Controls;
- const DependencyProperty* AttributeControl::ValueProperty;
- float AttributeControl::GetValue() const
- {
- return Noesis::ContentControl::GetValue<float>(ValueProperty);
- }
- void AttributeControl::SetValue(float value)
- {
- Noesis::ContentControl::SetValue<float>(ValueProperty, value);
- }
- const DependencyProperty* AttributeControl::MaximumProperty;
- float AttributeControl::GetMaximum() const
- {
- return Noesis::ContentControl::GetValue<float>(MaximumProperty);
- }
- void AttributeControl::SetMaximum(float maximum)
- {
- Noesis::ContentControl::SetValue<float>(MaximumProperty, maximum);
- }
- const DependencyProperty* AttributeControl::LabelProperty;
- const char* AttributeControl::GetLabel() const
- {
- return Noesis::ContentControl::GetValue<const char*>(LabelProperty);
- }
- void AttributeControl::SetLabel(const char* label)
- {
- Noesis::ContentControl::SetValue<const char*>(LabelProperty, label);
- }
- const DependencyProperty* AttributeControl::IconProperty;
- const Noesis::ImageSource* AttributeControl::GetIcon() const
- {
- return Noesis::ContentControl::GetValue<ImageSource*>(IconProperty);
- }
- void AttributeControl::SetIcon(Noesis::ImageSource* imageSource)
- {
- Noesis::ContentControl::SetValue<ImageSource*>(IconProperty, imageSource);
- }
- NS_IMPLEMENT_REFLECTION(AttributeControl)
- {
- NsMeta<TypeId>("Frontier.UI.Controls.AttributeControl");
- const auto Type = TypeOf<SelfClass>();
- const auto DefaultStyleKey = ResourceKeyType::Create(Type);
- auto Data = NsMeta<UIElementData>(Type);
- Data->RegisterProperty<float>(ValueProperty, "Value", FrameworkPropertyMetadata::Create(100.0, FrameworkOptions_None));
- Data->RegisterProperty<float>(MaximumProperty, "Maximum", FrameworkPropertyMetadata::Create(100.0, FrameworkOptions_None));
- Data->RegisterProperty<const char*>(LabelProperty, "Label", FrameworkPropertyMetadata::Create(FrameworkOptions_None));
- Data->RegisterProperty<ImageSource>(IconProperty, "Icon", FrameworkPropertyMetadata::Create(nullptr, FrameworkOptions_None));
- Data->OverrideMetadata<Ptr<ResourceKeyType>>(FrameworkElement::DefaultStyleKeyProperty, "DefaultStyleKey", FrameworkPropertyMetadata::Create(DefaultStyleKey, FrameworkOptions_None));
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement