GacUI_Controls\TriplePhaseImageButton

This commit is contained in:
Zihan Chen
2018-07-06 16:50:23 -07:00
parent 88de63217d
commit d432787a87
13 changed files with 2731 additions and 0 deletions
Binary file not shown.

After

Width:  |  Height:  |  Size: 1.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

@@ -0,0 +1,173 @@
<Resource>
<Folder name="GacGenConfig">
<Folder name="Cpp">
<Text name="SourceFolder">Source</Text>
<Text name="Resource">..\..\UIRes\TriplePhaseImageButton.bin</Text>
<Text name="NormalInclude">GacUI.h</Text>
<Text name="Name">Demo</Text>
</Folder>
</Folder>
<Folder name="Images">
<Image name="Checked" content="File">Checked.png</Image>
<Image name="Partial" content="File">Partial.png</Image>
</Folder>
<Script>
<Workflow>
<![CDATA[
module triplephasebutton;
using system::*;
using presentation::*;
enum TripleState
{
Normal = 0,
Checked = 1,
Partial = 2,
}
]]>
</Workflow>
</Script>
<InstanceStyle name="Styles">
<Styles>
<Style ref.Path="//*.buttonBackground">
<att.Color-bind>
<![CDATA[
cast Color let state = self.State in (
not self.VisuallyEnabled ? "#252526" :
state == ButtonState::Active ? "#54545C" :
state == ButtonState::Pressed ? "#007ACC" :
"#3F3F46"
)
]]>
</att.Color-bind>
</Style>
<Style ref.Path="//*.buttonBorder">
<att.Color-bind>
<![CDATA[
cast Color let state = self.State in (
not self.VisuallyEnabled ? "#434346" :
state == ButtonState::Active ? "#6A6A75" :
state == ButtonState::Pressed ? "#1C97EA" :
"#54545C"
)
]]>
</att.Color-bind>
</Style>
<Style ref.Path="//*.buttonText">
<att.Color-bind>
<![CDATA[
cast Color let state = self.State in (
not self.VisuallyEnabled ? "#6D6D6D" :
state == ButtonState::Active ? "#F1F1F1" :
state == ButtonState::Pressed ? "#FFFFFF" :
"#F1F1F1"
)
]]>
</att.Color-bind>
</Style>
</Styles>
</InstanceStyle>
<Instance name="TriplePhaseImageButtonTemplateResource">
<Instance ref.CodeBehind="false" ref.Class="demo::TriplePhaseImageButtonTemplate" ref.Styles="res://Styles">
<ButtonTemplate ref.Name="self" MinSizeLimitation="LimitToElementAndChildren">
<SolidBackground ref.Style="buttonBackground"/>
<Table AlignmentToParent="left:0 top:0 right:0 bottom:0" BorderVisible="true" MinSizeLimitation="LimitToElementAndChildren">
<SolidBorder ref.Style="buttonBorder"/>
<att.Rows>
<_>composeType:Percentage percentage:0.5</_>
<_>composeType:Absolute absolute:32</_>
<_>composeType:Percentage percentage:0.5</_>
</att.Rows>
<att.Columns>
<_>composeType:Absolute absolute:4</_>
<_>composeType:Absolute absolute:32</_>
<_>composeType:Absolute absolute:4</_>
<_>composeType:Percentage percentage:1.0</_>
<_>composeType:Absolute absolute:4</_>
</att.Columns>
<Cell Site="row:1 column:1">
<ImageFrame Stretch="true" Enabled-bind="self.VisuallyEnabled">
<att.Image-bind>
<![CDATA[
(
let control = cast (TriplePhaseButton*) self.Context in (
control.State == TripleState::Checked ? control.CheckedImage.Image:
control.State == TripleState::Partial ? control.PartialImage.Image:
null
)
) ?? null
]]>
</att.Image-bind>
</ImageFrame>
</Cell>
<Cell Site="row:1 column:3">
<SolidLabel ref.Style="buttonText" Text-bind="self.Text" Font-bind="self.Font" VerticalAlignment="Center"/>
</Cell>
</Table>
</ButtonTemplate>
</Instance>
</Instance>
<Instance name="TriplePhaseButtonTemplate">
<Instance ref.CodeBehind="false" ref.Class="demo::TriplePhaseButton">
<ref.Members>
<![CDATA[
prop State: TripleState = TripleState::Checked {}
prop CheckedImage: GuiImageData^ = null {}
prop PartialImage: GuiImageData^ = null {}
]]>
</ref.Members>
<CustomControl ref.Name="self">
<Button Text-bind="self.Text" Font-bind="self.Font" Context-eval="self">
<att.ControlTemplate>demo::TriplePhaseImageButtonTemplate</att.ControlTemplate>
<att.BoundsComposition-set AlignmentToParent="left:0 top:0 right:0 bottom:0"/>
<ev.Clicked-eval>
<![CDATA[
{
switch (self.State)
{
case TripleState::Normal: { self.State = TripleState::Checked; }
case TripleState::Checked: { self.State = TripleState::Partial; }
case TripleState::Partial: { self.State = TripleState::Normal; }
}
}
]]>
</ev.Clicked-eval>
</Button>
</CustomControl>
</Instance>
</Instance>
<Instance name="MainWindowInstance">
<Instance ref.CodeBehind="false" ref.Class="demo::MainWindow" xmlns:demo="demo::*">
<Window Text="TriplePhaseImageButton" ClientSize="x:640 y:480">
<Stack AlignmentToParent="left:10 top:10 right:-1 bottom:-1" Padding="10" Direction="Vertical" MinSizeLimitation="LimitToElementAndChildren">
<StackItem>
<demo:TriplePhaseButton ref.Name="button" CheckedImage-uri="res://Images/Checked" PartialImage-uri="res://Images/Partial">
<att.BoundsComposition-set AlignmentToParent="left:0 top:0 right:0 bottom:0" PreferredMinSize="x:120 y:40"/>
<att.Text-bind>
<![CDATA[
button.State == TripleState::Checked ? "Checked":
button.State == TripleState::Partial ? "Partial":
"Normal"
]]>
</att.Text-bind>
</demo:TriplePhaseButton>
</StackItem>
<StackItem>
<Button Text-bind="button.Enabled ? 'Disable' : 'Enable'" ev.Clicked-eval="button.Enabled = not button.Enabled;">
<att.BoundsComposition-set AlignmentToParent="left:0 top:0 right:0 bottom:0" PreferredMinSize="x:120 y:40"/>
</Button>
</StackItem>
</Stack>
</Window>
</Instance>
</Instance>
</Resource>
@@ -0,0 +1,15 @@
/***********************************************************************
!!!!!! DO NOT MODIFY !!!!!!
GacGen.exe Resource.xml
This file is generated by Workflow compiler
https://github.com/vczh-libraries
***********************************************************************/
#ifndef VCZH_WORKFLOW_COMPILER_GENERATED_DEMO
#define VCZH_WORKFLOW_COMPILER_GENERATED_DEMO
#include "DemoPartialClasses.h"
#endif
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
@@ -0,0 +1,160 @@
/***********************************************************************
!!!!!! DO NOT MODIFY !!!!!!
GacGen.exe Resource.xml
This file is generated by Workflow compiler
https://github.com/vczh-libraries
***********************************************************************/
#include "DemoReflection.h"
#if defined( _MSC_VER)
#pragma warning(push)
#pragma warning(disable:4250)
#elif defined(__GNUC__)
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wparentheses-equality"
#elif defined(__clang__)
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wparentheses-equality"
#endif
/***********************************************************************
Reflection
***********************************************************************/
namespace vl
{
namespace reflection
{
namespace description
{
#ifndef VCZH_DEBUG_NO_REFLECTION
IMPL_CPP_TYPE_INFO(TripleState)
IMPL_CPP_TYPE_INFO(demo::MainWindow)
IMPL_CPP_TYPE_INFO(demo::MainWindowConstructor)
IMPL_CPP_TYPE_INFO(demo::TriplePhaseButton)
IMPL_CPP_TYPE_INFO(demo::TriplePhaseButtonConstructor)
IMPL_CPP_TYPE_INFO(demo::TriplePhaseImageButtonTemplate)
IMPL_CPP_TYPE_INFO(demo::TriplePhaseImageButtonTemplateConstructor)
#define _ ,
BEGIN_ENUM_ITEM(::TripleState)
ENUM_CLASS_ITEM(Checked)
ENUM_CLASS_ITEM(Normal)
ENUM_CLASS_ITEM(Partial)
END_ENUM_ITEM(::TripleState)
BEGIN_CLASS_MEMBER(::demo::MainWindow)
CLASS_MEMBER_BASE(::vl::presentation::controls::GuiWindow)
CLASS_MEMBER_BASE(::demo::MainWindowConstructor)
CLASS_MEMBER_CONSTRUCTOR(::demo::MainWindow*(), NO_PARAMETER)
END_CLASS_MEMBER(::demo::MainWindow)
BEGIN_CLASS_MEMBER(::demo::MainWindowConstructor)
CLASS_MEMBER_BASE(::vl::reflection::DescriptableObject)
CLASS_MEMBER_CONSTRUCTOR(::vl::Ptr<::demo::MainWindowConstructor>(), NO_PARAMETER)
CLASS_MEMBER_METHOD(__vwsn_demo_MainWindow_Initialize, { L"__vwsn_this_" })
CLASS_MEMBER_FIELD(__vwsn_precompile_0)
CLASS_MEMBER_FIELD(__vwsn_precompile_1)
CLASS_MEMBER_FIELD(__vwsn_precompile_2)
CLASS_MEMBER_FIELD(__vwsn_precompile_3)
CLASS_MEMBER_FIELD(__vwsn_precompile_4)
CLASS_MEMBER_FIELD(__vwsn_precompile_5)
CLASS_MEMBER_FIELD(__vwsn_precompile_6)
CLASS_MEMBER_FIELD(button)
END_CLASS_MEMBER(::demo::MainWindowConstructor)
BEGIN_CLASS_MEMBER(::demo::TriplePhaseButton)
CLASS_MEMBER_BASE(::vl::presentation::controls::GuiCustomControl)
CLASS_MEMBER_BASE(::demo::TriplePhaseButtonConstructor)
CLASS_MEMBER_CONSTRUCTOR(::demo::TriplePhaseButton*(), NO_PARAMETER)
CLASS_MEMBER_METHOD(GetCheckedImage, NO_PARAMETER)
CLASS_MEMBER_METHOD(GetPartialImage, NO_PARAMETER)
CLASS_MEMBER_METHOD(GetState, NO_PARAMETER)
CLASS_MEMBER_METHOD(SetCheckedImage, { L"__vwsn_value_" })
CLASS_MEMBER_METHOD(SetPartialImage, { L"__vwsn_value_" })
CLASS_MEMBER_METHOD(SetState, { L"__vwsn_value_" })
CLASS_MEMBER_EVENT(CheckedImageChanged)
CLASS_MEMBER_EVENT(PartialImageChanged)
CLASS_MEMBER_EVENT(StateChanged)
CLASS_MEMBER_FIELD(__vwsn_prop_CheckedImage)
CLASS_MEMBER_FIELD(__vwsn_prop_PartialImage)
CLASS_MEMBER_FIELD(__vwsn_prop_State)
CLASS_MEMBER_PROPERTY_EVENT(CheckedImage, GetCheckedImage, SetCheckedImage, CheckedImageChanged)
CLASS_MEMBER_PROPERTY_EVENT(PartialImage, GetPartialImage, SetPartialImage, PartialImageChanged)
CLASS_MEMBER_PROPERTY_EVENT(State, GetState, SetState, StateChanged)
END_CLASS_MEMBER(::demo::TriplePhaseButton)
BEGIN_CLASS_MEMBER(::demo::TriplePhaseButtonConstructor)
CLASS_MEMBER_BASE(::vl::reflection::DescriptableObject)
CLASS_MEMBER_CONSTRUCTOR(::vl::Ptr<::demo::TriplePhaseButtonConstructor>(), NO_PARAMETER)
CLASS_MEMBER_METHOD(__vwsn_demo_TriplePhaseButton_Initialize, { L"__vwsn_this_" })
CLASS_MEMBER_FIELD(__vwsn_precompile_0)
CLASS_MEMBER_FIELD(__vwsn_precompile_1)
CLASS_MEMBER_FIELD(self)
END_CLASS_MEMBER(::demo::TriplePhaseButtonConstructor)
BEGIN_CLASS_MEMBER(::demo::TriplePhaseImageButtonTemplate)
CLASS_MEMBER_BASE(::vl::presentation::templates::GuiButtonTemplate)
CLASS_MEMBER_BASE(::demo::TriplePhaseImageButtonTemplateConstructor)
CLASS_MEMBER_CONSTRUCTOR(::demo::TriplePhaseImageButtonTemplate*(), NO_PARAMETER)
END_CLASS_MEMBER(::demo::TriplePhaseImageButtonTemplate)
BEGIN_CLASS_MEMBER(::demo::TriplePhaseImageButtonTemplateConstructor)
CLASS_MEMBER_BASE(::vl::reflection::DescriptableObject)
CLASS_MEMBER_CONSTRUCTOR(::vl::Ptr<::demo::TriplePhaseImageButtonTemplateConstructor>(), NO_PARAMETER)
CLASS_MEMBER_METHOD(__vwsn_demo_TriplePhaseImageButtonTemplate_Initialize, { L"__vwsn_this_" })
CLASS_MEMBER_FIELD(__vwsn_precompile_0)
CLASS_MEMBER_FIELD(__vwsn_precompile_1)
CLASS_MEMBER_FIELD(__vwsn_precompile_2)
CLASS_MEMBER_FIELD(__vwsn_precompile_3)
CLASS_MEMBER_FIELD(__vwsn_precompile_4)
CLASS_MEMBER_FIELD(__vwsn_precompile_5)
CLASS_MEMBER_FIELD(__vwsn_precompile_6)
CLASS_MEMBER_FIELD(self)
END_CLASS_MEMBER(::demo::TriplePhaseImageButtonTemplateConstructor)
#undef _
class DemoTypeLoader : public Object, public ITypeLoader
{
public:
void Load(ITypeManager* manager)
{
ADD_TYPE_INFO(::TripleState)
ADD_TYPE_INFO(::demo::MainWindow)
ADD_TYPE_INFO(::demo::MainWindowConstructor)
ADD_TYPE_INFO(::demo::TriplePhaseButton)
ADD_TYPE_INFO(::demo::TriplePhaseButtonConstructor)
ADD_TYPE_INFO(::demo::TriplePhaseImageButtonTemplate)
ADD_TYPE_INFO(::demo::TriplePhaseImageButtonTemplateConstructor)
}
void Unload(ITypeManager* manager)
{
}
};
#endif
bool LoadDemoTypes()
{
#ifndef VCZH_DEBUG_NO_REFLECTION
if (auto manager = GetGlobalTypeManager())
{
return manager->AddTypeLoader(MakePtr<DemoTypeLoader>());
}
#endif
return false;
}
}
}
}
#if defined( _MSC_VER)
#pragma warning(pop)
#elif defined(__GNUC__)
#pragma GCC diagnostic pop
#elif defined(__clang__)
#pragma clang diagnostic pop
#endif
@@ -0,0 +1,59 @@
/***********************************************************************
!!!!!! DO NOT MODIFY !!!!!!
GacGen.exe Resource.xml
This file is generated by Workflow compiler
https://github.com/vczh-libraries
***********************************************************************/
#ifndef VCZH_WORKFLOW_COMPILER_GENERATED_DEMOREFLECTION
#define VCZH_WORKFLOW_COMPILER_GENERATED_DEMOREFLECTION
#include "Demo.h"
#if defined( _MSC_VER)
#pragma warning(push)
#pragma warning(disable:4250)
#elif defined(__GNUC__)
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wparentheses-equality"
#elif defined(__clang__)
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wparentheses-equality"
#endif
/***********************************************************************
Reflection
***********************************************************************/
namespace vl
{
namespace reflection
{
namespace description
{
#ifndef VCZH_DEBUG_NO_REFLECTION
DECL_TYPE_INFO(::TripleState)
DECL_TYPE_INFO(::demo::MainWindow)
DECL_TYPE_INFO(::demo::MainWindowConstructor)
DECL_TYPE_INFO(::demo::TriplePhaseButton)
DECL_TYPE_INFO(::demo::TriplePhaseButtonConstructor)
DECL_TYPE_INFO(::demo::TriplePhaseImageButtonTemplate)
DECL_TYPE_INFO(::demo::TriplePhaseImageButtonTemplateConstructor)
#endif
extern bool LoadDemoTypes();
}
}
}
#if defined( _MSC_VER)
#pragma warning(pop)
#elif defined(__GNUC__)
#pragma GCC diagnostic pop
#elif defined(__clang__)
#pragma clang diagnostic pop
#endif
#endif