Skip to content

Commit

Permalink
Update release
Browse files Browse the repository at this point in the history
  • Loading branch information
vczh committed Oct 28, 2017
1 parent a9aa3b6 commit 5c3f37e
Show file tree
Hide file tree
Showing 21 changed files with 18,906 additions and 17,976 deletions.
25,053 changes: 12,670 additions & 12,383 deletions Import/GacUI.cpp

Large diffs are not rendered by default.

544 changes: 308 additions & 236 deletions Import/GacUI.h

Large diffs are not rendered by default.

194 changes: 165 additions & 29 deletions Import/GacUICompiler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8431,6 +8431,10 @@ GuiCompositionInstanceLoader
info->acceptableTypes.Add(TypeInfoRetriver<GuiControl*>::CreateTypeInfo());
info->acceptableTypes.Add(TypeInfoRetriver<GuiGraphicsComposition*>::CreateTypeInfo());
info->acceptableTypes.Add(TypeInfoRetriver<Ptr<IGuiGraphicsElement>>::CreateTypeInfo());
if (propertyInfo.typeInfo.typeInfo->GetTypeDescriptor()->CanConvertTo(description::GetTypeDescriptor<GuiInstanceRootObject>()))
{
info->acceptableTypes.Add(TypeInfoRetriver<GuiComponent*>::CreateTypeInfo());
}
return info;
}
return IGuiInstanceLoader::GetPropertyType(propertyInfo);
Expand All @@ -8449,7 +8453,22 @@ GuiCompositionInstanceLoader
auto td = values[0].typeInfo->GetTypeDescriptor();

Ptr<WfExpression> expr;
if (td->CanConvertTo(description::GetTypeDescriptor<IGuiGraphicsElement>()))
if (td->CanConvertTo(description::GetTypeDescriptor<GuiComponent>()))
{
auto refControl = MakePtr<WfReferenceExpression>();
refControl->name.value = variableName.ToString();

auto refAddComponent = MakePtr<WfMemberExpression>();
refAddComponent->parent = refControl;
refAddComponent->name.value = L"AddComponent";

auto call = MakePtr<WfCallExpression>();
call->function = refAddComponent;
call->arguments.Add(value);

expr = call;
}
else if (td->CanConvertTo(description::GetTypeDescriptor<IGuiGraphicsElement>()))
{
auto refComposition = MakePtr<WfReferenceExpression>();
refComposition->name.value = variableName.ToString();
Expand Down Expand Up @@ -9937,18 +9956,24 @@ namespace vl
{

/***********************************************************************
GuiTemplateInstanceLoader
GuiCommonDatePickerLookLoader
***********************************************************************/

class GuiTemplateInstanceLoader : public Object, public IGuiInstanceLoader
class GuiCommonDatePickerLookLoader : public Object, public IGuiInstanceLoader
{
protected:
GlobalStringKey typeName;
GlobalStringKey _BackgroundColor;
GlobalStringKey _PrimaryTextColor;
GlobalStringKey _SecondaryTextColor;

public:
GuiTemplateInstanceLoader()
GuiCommonDatePickerLookLoader()
{
typeName = GlobalStringKey::Get(description::TypeInfo<GuiTemplate>::content.typeName);
typeName = GlobalStringKey::Get(description::TypeInfo<GuiCommonDatePickerLook>::content.typeName);
_BackgroundColor = GlobalStringKey::Get(L"BackgroundColor");
_PrimaryTextColor = GlobalStringKey::Get(L"PrimaryTextColor");
_SecondaryTextColor = GlobalStringKey::Get(L"SecondaryTextColor");
}

GlobalStringKey GetTypeName()override
Expand All @@ -9958,35 +9983,145 @@ GuiTemplateInstanceLoader

void GetRequiredPropertyNames(const TypeInfo& typeInfo, collections::List<GlobalStringKey>& propertyNames)override
{
List<ITypeDescriptor*> tds;
tds.Add(typeInfo.typeInfo->GetTypeDescriptor());
if (CanCreate(typeInfo))
{
propertyNames.Add(_BackgroundColor);
propertyNames.Add(_PrimaryTextColor);
propertyNames.Add(_SecondaryTextColor);
}
}

void GetPropertyNames(const TypeInfo& typeInfo, collections::List<GlobalStringKey>& propertyNames)override
{
GetRequiredPropertyNames(typeInfo, propertyNames);
}

for (vint i = 0; i < tds.Count(); i++)
Ptr<GuiInstancePropertyInfo> GetPropertyType(const PropertyInfo& propertyInfo)override
{
if (propertyInfo.propertyName == _BackgroundColor || propertyInfo.propertyName == _PrimaryTextColor || propertyInfo.propertyName == _SecondaryTextColor)
{
auto td = tds[i];
if (td != description::GetTypeDescriptor<GuiWindowTemplate>())
auto info = GuiInstancePropertyInfo::Assign(TypeInfoRetriver<Color>::CreateTypeInfo());
info->usage = GuiInstancePropertyInfo::ConstructorArgument;
return info;
}
return IGuiInstanceLoader::GetPropertyType(propertyInfo);
}

bool CanCreate(const TypeInfo& typeInfo)
{
return typeInfo.typeName == typeName;
}

Ptr<workflow::WfStatement> CreateInstance(GuiResourcePrecompileContext& precompileContext, types::ResolvingResult& resolvingResult, const TypeInfo& typeInfo, GlobalStringKey variableName, ArgumentMap& arguments, GuiResourceTextPos tagPosition, GuiResourceError::List& errors)
{
if (CanCreate(typeInfo))
{
vint indexBackgroundColor = arguments.Keys().IndexOf(_BackgroundColor);
vint indexPrimaryTextColor = arguments.Keys().IndexOf(_PrimaryTextColor);
vint indexSecondaryTextColor = arguments.Keys().IndexOf(_SecondaryTextColor);
if (indexBackgroundColor != -1 && indexPrimaryTextColor != -1 && indexSecondaryTextColor != -1)
{
vint propCount = td->GetPropertyCount();
for (vint i = 0; i < propCount; i++)
{
auto prop = td->GetProperty(i);
if (prop->IsWritable() && INVLOC.EndsWith(prop->GetName(), L"Template", Locale::None))
{
propertyNames.Add(GlobalStringKey::Get(prop->GetName()));
}
}
auto type = TypeInfoRetriver<GuiCommonDatePickerLook*>::CreateTypeInfo();
auto createExpr = MakePtr<WfNewClassExpression>();
createExpr->type = GetTypeFromTypeInfo(type.Obj());
createExpr->arguments.Add(arguments.GetByIndex(indexBackgroundColor)[0].expression);
createExpr->arguments.Add(arguments.GetByIndex(indexPrimaryTextColor)[0].expression);
createExpr->arguments.Add(arguments.GetByIndex(indexSecondaryTextColor)[0].expression);

vint baseCount = td->GetBaseTypeDescriptorCount();
for (vint i = 0; i < baseCount; i++)
{
auto baseTd = td->GetBaseTypeDescriptor(i);
if (!tds.Contains(baseTd))
{
tds.Add(baseTd);
}
}
auto refVariable = MakePtr<WfReferenceExpression>();
refVariable->name.value = variableName.ToString();

auto assignExpr = MakePtr<WfBinaryExpression>();
assignExpr->op = WfBinaryOperator::Assign;
assignExpr->first = refVariable;
assignExpr->second = createExpr;

auto assignStat = MakePtr<WfExpressionStatement>();
assignStat->expression = assignExpr;
return assignStat;
}
}
return nullptr;
}
};

/***********************************************************************
GuiCommonScrollViewLookLoader
***********************************************************************/

class GuiCommonScrollViewLookLoader : public Object, public IGuiInstanceLoader
{
protected:
GlobalStringKey typeName;
GlobalStringKey _DefaultScrollSize;

public:
GuiCommonScrollViewLookLoader()
{
typeName = GlobalStringKey::Get(description::TypeInfo<GuiCommonScrollViewLook>::content.typeName);
_DefaultScrollSize = GlobalStringKey::Get(L"DefaultScrollSize");
}

GlobalStringKey GetTypeName()override
{
return typeName;
}

void GetRequiredPropertyNames(const TypeInfo& typeInfo, collections::List<GlobalStringKey>& propertyNames)override
{
if (CanCreate(typeInfo))
{
propertyNames.Add(_DefaultScrollSize);
}
}

void GetPropertyNames(const TypeInfo& typeInfo, collections::List<GlobalStringKey>& propertyNames)override
{
GetRequiredPropertyNames(typeInfo, propertyNames);
}

Ptr<GuiInstancePropertyInfo> GetPropertyType(const PropertyInfo& propertyInfo)override
{
if (propertyInfo.propertyName == _DefaultScrollSize)
{
auto info = GuiInstancePropertyInfo::Assign(TypeInfoRetriver<vint>::CreateTypeInfo());
info->usage = GuiInstancePropertyInfo::ConstructorArgument;
return info;
}
return IGuiInstanceLoader::GetPropertyType(propertyInfo);
}

bool CanCreate(const TypeInfo& typeInfo)
{
return typeInfo.typeName == typeName;
}

Ptr<workflow::WfStatement> CreateInstance(GuiResourcePrecompileContext& precompileContext, types::ResolvingResult& resolvingResult, const TypeInfo& typeInfo, GlobalStringKey variableName, ArgumentMap& arguments, GuiResourceTextPos tagPosition, GuiResourceError::List& errors)
{
if (CanCreate(typeInfo))
{
vint indexDefaultScrollSize = arguments.Keys().IndexOf(_DefaultScrollSize);
if (indexDefaultScrollSize != -1)
{
auto type = TypeInfoRetriver<GuiCommonScrollViewLook*>::CreateTypeInfo();
auto createExpr = MakePtr<WfNewClassExpression>();
createExpr->type = GetTypeFromTypeInfo(type.Obj());
createExpr->arguments.Add(arguments.GetByIndex(indexDefaultScrollSize)[0].expression);

auto refVariable = MakePtr<WfReferenceExpression>();
refVariable->name.value = variableName.ToString();

auto assignExpr = MakePtr<WfBinaryExpression>();
assignExpr->op = WfBinaryOperator::Assign;
assignExpr->first = refVariable;
assignExpr->second = createExpr;

auto assignStat = MakePtr<WfExpressionStatement>();
assignStat->expression = assignExpr;
return assignStat;
}
}
return nullptr;
}
};

Expand All @@ -9996,7 +10131,8 @@ Initialization

void LoadTemplates(IGuiInstanceLoaderManager* manager)
{
manager->SetLoader(new GuiTemplateInstanceLoader);
manager->SetLoader(new GuiCommonDatePickerLookLoader);
manager->SetLoader(new GuiCommonScrollViewLookLoader);
}
}
}
Expand Down
75 changes: 44 additions & 31 deletions Import/GacUIReflection.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -897,6 +897,7 @@ Type Declaration
CLASS_MEMBER_PROPERTY_FAST(Visible)
CLASS_MEMBER_PROPERTY_FAST(MinSizeLimitation)
CLASS_MEMBER_PROPERTY_READONLY_FAST(GlobalBounds)
CLASS_MEMBER_PROPERTY_FAST(TransparentToMouse)
CLASS_MEMBER_PROPERTY_READONLY_FAST(AssociatedControl)
CLASS_MEMBER_PROPERTY_FAST(AssociatedCursor)
CLASS_MEMBER_PROPERTY_FAST(AssociatedHitTestResult)
Expand All @@ -919,7 +920,7 @@ Type Declaration
CLASS_MEMBER_METHOD(RemoveChild, {L"child"})
CLASS_MEMBER_METHOD(MoveChild, {L"child" _ L"newIndex"})
CLASS_MEMBER_METHOD(Render, {L"size"})
CLASS_MEMBER_METHOD(FindComposition, {L"location"})
CLASS_MEMBER_METHOD(FindComposition, {L"location" _ L"forMouseEvent"})
CLASS_MEMBER_METHOD(ForceCalculateSizeImmediately, NO_PARAMETER)
CLASS_MEMBER_METHOD(IsSizeAffectParent, NO_PARAMETER)
END_CLASS_MEMBER(GuiGraphicsComposition)
Expand Down Expand Up @@ -1695,6 +1696,7 @@ Type Declaration
CLASS_MEMBER_METHOD(DetachListControl, NO_PARAMETER)
CLASS_MEMBER_METHOD(GetVisibleStyle, {L"itemIndex"})
CLASS_MEMBER_METHOD(GetVisibleIndex, {L"style"})
CLASS_MEMBER_METHOD(ReloadVisibleStyles, NO_PARAMETER)
CLASS_MEMBER_METHOD(OnViewChanged, {L"bounds"})
CLASS_MEMBER_METHOD(FindItem, {L"itemIndex" _ L"key"})
CLASS_MEMBER_METHOD(EnsureItemVisible, {L"itemIndex"})
Expand Down Expand Up @@ -3132,11 +3134,6 @@ Type Declaration
CLASS_MEMBER_METHOD(NotifyDateSelected, NO_PARAMETER)
END_INTERFACE_MEMBER(IDatePickerCommandExecutor)

BEGIN_INTERFACE_MEMBER_NOPROXY(IScrollViewCommandExecutor)
CLASS_MEMBER_BASE(IDescriptable)
CLASS_MEMBER_METHOD(CalculateView, NO_PARAMETER)
END_INTERFACE_MEMBER(IScrollViewCommandExecutor)

BEGIN_CLASS_MEMBER(GuiComponent)
END_CLASS_MEMBER(GuiComponent)

Expand Down Expand Up @@ -3167,7 +3164,6 @@ Type Declaration
CLASS_MEMBER_BASE(BASE)\
CLASS_MEMBER_CONSTRUCTOR(NAME*(), NO_PARAMETER)\
NAME ## _PROPERTIES(GUI_TEMPLATE_PROPERTY_REFLECTION)\
CLASS_MEMBER_METHOD(Initialize, NO_PARAMETER)\
END_CLASS_MEMBER(NAME)\

GUI_CONTROL_TEMPLATE(GuiControlTemplate, GuiTemplate)
Expand All @@ -3184,35 +3180,13 @@ Type Declaration
GUI_CONTROL_TEMPLATE(GuiListViewColumnHeaderTemplate, GuiToolstripButtonTemplate)
GUI_CONTROL_TEMPLATE(GuiComboBoxTemplate, GuiToolstripButtonTemplate)
GUI_CONTROL_TEMPLATE(GuiScrollTemplate, GuiControlTemplate)

BEGIN_CLASS_MEMBER(GuiScrollViewTemplate)
CLASS_MEMBER_BASE(GuiControlTemplate)
CLASS_MEMBER_CONSTRUCTOR(GuiScrollViewTemplate*(), NO_PARAMETER)

GuiScrollViewTemplate_PROPERTIES(GUI_TEMPLATE_PROPERTY_REFLECTION)

CLASS_MEMBER_METHOD(AdjustView, {L"fullSize"})
CLASS_MEMBER_PROPERTY_READONLY_FAST(HorizontalScroll)
CLASS_MEMBER_PROPERTY_READONLY_FAST(VerticalScroll)
CLASS_MEMBER_PROPERTY_FAST(HorizontalAlwaysVisible)
CLASS_MEMBER_PROPERTY_FAST(VerticalAlwaysVisible)
END_CLASS_MEMBER(GuiScrollViewTemplate)

GUI_CONTROL_TEMPLATE(GuiScrollViewTemplate, GuiControlTemplate)
GUI_CONTROL_TEMPLATE(GuiListControlTemplate, GuiScrollViewTemplate)
GUI_CONTROL_TEMPLATE(GuiTextListTemplate, GuiListControlTemplate)
GUI_CONTROL_TEMPLATE(GuiListViewTemplate, GuiListControlTemplate)
GUI_CONTROL_TEMPLATE(GuiTreeViewTemplate, GuiListControlTemplate)
GUI_CONTROL_TEMPLATE(GuiTabTemplate, GuiControlTemplate)

BEGIN_CLASS_MEMBER(GuiDatePickerTemplate)
CLASS_MEMBER_BASE(GuiControlTemplate)
CLASS_MEMBER_CONSTRUCTOR(GuiDatePickerTemplate*(), NO_PARAMETER)

GuiDatePickerTemplate_PROPERTIES(GUI_TEMPLATE_PROPERTY_REFLECTION)
CLASS_MEMBER_PROPERTY_GUIEVENT_FAST(DateLocale)
CLASS_MEMBER_PROPERTY_GUIEVENT_FAST(Date)
END_CLASS_MEMBER(GuiDatePickerTemplate)

GUI_CONTROL_TEMPLATE(GuiDatePickerTemplate, GuiControlTemplate)
GUI_CONTROL_TEMPLATE(GuiDateComboBoxTemplate, GuiComboBoxTemplate)
GUI_CONTROL_TEMPLATE(GuiListItemTemplate, GuiTemplate)
GUI_CONTROL_TEMPLATE(GuiTextListItemTemplate, GuiListItemTemplate)
Expand All @@ -3221,6 +3195,45 @@ Type Declaration
GUI_CONTROL_TEMPLATE(GuiGridVisualizerTemplate, GuiGridCellTemplate)
GUI_CONTROL_TEMPLATE(GuiGridEditorTemplate, GuiGridCellTemplate)

BEGIN_CLASS_MEMBER(GuiCommonDatePickerLook)
CLASS_MEMBER_BASE(GuiTemplate)
CLASS_MEMBER_CONSTRUCTOR(GuiCommonDatePickerLook*(Color, Color, Color), { L"backgroundColor" _ L"primaryTextColor" _ L"secondaryTextColor" })

CLASS_MEMBER_PROPERTY_FAST(Commands)
CLASS_MEMBER_PROPERTY_FAST(DateButtonTemplate)
CLASS_MEMBER_PROPERTY_FAST(DateTextListTemplate)
CLASS_MEMBER_PROPERTY_FAST(DateComboBoxTemplate)
CLASS_MEMBER_PROPERTY_FAST(DateLocale)
CLASS_MEMBER_PROPERTY_GUIEVENT_FAST(Date)
CLASS_MEMBER_PROPERTY_FAST(Font)
END_CLASS_MEMBER(GuiCommonDatePickerLook)

BEGIN_CLASS_MEMBER(GuiCommonScrollViewLook)
CLASS_MEMBER_BASE(GuiTemplate)
CLASS_MEMBER_CONSTRUCTOR(GuiCommonScrollViewLook*(vint), { L"defaultScrollSize" })

CLASS_MEMBER_PROPERTY_FAST(HScrollTemplate)
CLASS_MEMBER_PROPERTY_FAST(VScrollTemplate)
CLASS_MEMBER_PROPERTY_READONLY_FAST(HScroll)
CLASS_MEMBER_PROPERTY_READONLY_FAST(VScroll)
CLASS_MEMBER_PROPERTY_READONLY_FAST(ContainerComposition)
END_CLASS_MEMBER(GuiCommonScrollViewLook)

BEGIN_CLASS_MEMBER(GuiCommonScrollBehavior)
CLASS_MEMBER_BASE(GuiComponent)
CLASS_MEMBER_CONSTRUCTOR(GuiCommonScrollBehavior*(), NO_PARAMETER)

CLASS_MEMBER_METHOD(AttachScrollTemplate, { L"value" })
CLASS_MEMBER_METHOD(AttachDecreaseButton, { L"button" })
CLASS_MEMBER_METHOD(AttachIncreaseButton, { L"button" })
CLASS_MEMBER_METHOD(AttachHorizontalPartialView, { L"partialView" })
CLASS_MEMBER_METHOD(AttachVerticalPartialView, { L"partialView" })
CLASS_MEMBER_METHOD(AttachHorizontalTrackerHandle, { L"handle" })
CLASS_MEMBER_METHOD(AttachVerticalTrackerHandle, { L"handle" })
CLASS_MEMBER_METHOD(GetHorizontalTrackerHandlerPosition, { L"handle" _ L"totalSize" _ L"pageSize" _ L"position" })
CLASS_MEMBER_METHOD(GetVerticalTrackerHandlerPosition, { L"handle" _ L"totalSize" _ L"pageSize" _ L"position" })
END_CLASS_MEMBER(GuiCommonScrollBehavior)

#undef GUI_CONTROL_TEMPLATE
#undef GUI_TEMPLATE_PROPERTY_REFLECTION
#undef _
Expand Down
Loading

0 comments on commit 5c3f37e

Please sign in to comment.