Demo: GacUI_Colors/ColorPicker

This commit is contained in:
vczh
2016-07-13 17:16:59 -07:00
parent a8dcea0325
commit 4b7f350f95
12 changed files with 779 additions and 0 deletions
+3
View File
@@ -33,6 +33,9 @@ popd
pushd TextEditor\UI
call Codegen.bat
popd
pushd GacUI_Controls\UI
call Codegen.bat
popd
popd
pushd GacUI_ControlTemplate
pushd BlackSkin\UI
@@ -0,0 +1,101 @@
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="12.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup Label="ProjectConfigurations">
<ProjectConfiguration Include="Debug|Win32">
<Configuration>Debug</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|Win32">
<Configuration>Release</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
</ItemGroup>
<PropertyGroup Label="Globals">
<ProjectGuid>{FBBBA8BF-96A4-4096-8204-A92571100F0E}</ProjectGuid>
<Keyword>Win32Proj</Keyword>
<RootNamespace>ColorPicker</RootNamespace>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries>
<PlatformToolset>v120</PlatformToolset>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<PlatformToolset>v120</PlatformToolset>
<WholeProgramOptimization>true</WholeProgramOptimization>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
<ImportGroup Label="ExtensionSettings">
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<PropertyGroup Label="UserMacros" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<LinkIncremental>true</LinkIncremental>
<IncludePath>$(ProjectDir)..\..\..\Import;$(IncludePath)</IncludePath>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<LinkIncremental>false</LinkIncremental>
<IncludePath>$(ProjectDir)..\..\..\Import;$(IncludePath)</IncludePath>
</PropertyGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<ClCompile>
<PrecompiledHeader>
</PrecompiledHeader>
<WarningLevel>Level3</WarningLevel>
<Optimization>Disabled</Optimization>
<PreprocessorDefinitions>WIN32;_DEBUG;_WINDOWS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<SDLCheck>true</SDLCheck>
</ClCompile>
<Link>
<SubSystem>Windows</SubSystem>
<GenerateDebugInformation>true</GenerateDebugInformation>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<ClCompile>
<WarningLevel>Level3</WarningLevel>
<PrecompiledHeader>
</PrecompiledHeader>
<Optimization>MaxSpeed</Optimization>
<FunctionLevelLinking>true</FunctionLevelLinking>
<IntrinsicFunctions>true</IntrinsicFunctions>
<PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<SDLCheck>true</SDLCheck>
</ClCompile>
<Link>
<SubSystem>Windows</SubSystem>
<GenerateDebugInformation>true</GenerateDebugInformation>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<OptimizeReferences>true</OptimizeReferences>
</Link>
</ItemDefinitionGroup>
<ItemGroup>
<ProjectReference Include="..\..\Lib\GacUI\GacUI.vcxproj">
<Project>{8018d622-66ba-4e65-9d03-bdac37ea9a54}</Project>
</ProjectReference>
</ItemGroup>
<ItemGroup>
<ClCompile Include="Main.cpp" />
<ClCompile Include="UI\Source\DemoPartialClasses.cpp" />
</ItemGroup>
<ItemGroup>
<Xml Include="UI\Resource.xml" />
</ItemGroup>
<ItemGroup>
<ClInclude Include="UI\Source\Demo.h" />
<ClInclude Include="UI\Source\DemoPartialClasses.h" />
</ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
</ImportGroup>
</Project>
@@ -0,0 +1,41 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup>
<Filter Include="Source Files">
<UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier>
<Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions>
</Filter>
<Filter Include="Header Files">
<UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier>
<Extensions>h;hh;hpp;hxx;hm;inl;inc;xsd</Extensions>
</Filter>
<Filter Include="Resource Files">
<UniqueIdentifier>{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}</UniqueIdentifier>
<Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms</Extensions>
</Filter>
<Filter Include="UI">
<UniqueIdentifier>{98527163-41d8-4089-9c7e-0ab115d0210b}</UniqueIdentifier>
</Filter>
</ItemGroup>
<ItemGroup>
<ClCompile Include="Main.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="UI\Source\DemoPartialClasses.cpp">
<Filter>UI</Filter>
</ClCompile>
</ItemGroup>
<ItemGroup>
<Xml Include="UI\Resource.xml">
<Filter>Resource Files</Filter>
</Xml>
</ItemGroup>
<ItemGroup>
<ClInclude Include="UI\Source\DemoPartialClasses.h">
<Filter>UI</Filter>
</ClInclude>
<ClInclude Include="UI\Source\Demo.h">
<Filter>UI</Filter>
</ClInclude>
</ItemGroup>
</Project>
@@ -0,0 +1,79 @@
#include "UI/Source/Demo.h"
#include <Windows.h>
using namespace vl::collections;
using namespace vl::stream;
int CALLBACK WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int CmdShow)
{
return SetupWindowsDirect2DRenderer();
}
class ColorItem : public Object, public demo::IColorItem
{
protected:
WString name;
Color color;
public:
ColorItem(WString _name, WString _color)
:name(_name)
, color(Color::Parse(_color))
{
}
WString GetItemName()override
{
return name;
}
Color GetItemColor()override
{
return color;
}
};
class ViewModel : public Object, public demo::IViewModel
{
protected:
List<Ptr<demo::IColorItem>> items;
public:
ViewModel()
{
items.Add(new ColorItem(L"Black", L"#000000"));
items.Add(new ColorItem(L"Maroon", L"#800000"));
items.Add(new ColorItem(L"Green", L"#008000"));
items.Add(new ColorItem(L"Olive", L"#808000"));
items.Add(new ColorItem(L"Navy", L"#000080"));
items.Add(new ColorItem(L"Purble", L"#800080"));
items.Add(new ColorItem(L"Teal", L"#008080"));
items.Add(new ColorItem(L"Silver", L"#C0C0C0"));
items.Add(new ColorItem(L"Gray", L"#808080"));
items.Add(new ColorItem(L"Red", L"#FF0000"));
items.Add(new ColorItem(L"Lime", L"#00FF00"));
items.Add(new ColorItem(L"Yellow", L"#FFFF00"));
items.Add(new ColorItem(L"Blue", L"#0000FF"));
items.Add(new ColorItem(L"Fuchsia", L"#FF00FF"));
items.Add(new ColorItem(L"Aqua", L"#00FFFF"));
items.Add(new ColorItem(L"White", L"#FFFFFF"));
}
LazyList<Ptr<demo::IColorItem>> GetColorItems()override
{
return items;
}
};
void GuiMain()
{
{
List<WString> errors;
FileStream fileStream(L"../UIRes/ColorPicker.bin", FileStream::ReadOnly);
auto resource = GuiResource::LoadPrecompiledBinary(fileStream, errors);
GetResourceManager()->SetResource(L"Resource", resource);
}
demo::MainWindow window(new ViewModel);
window.MoveToScreenCenter();
GetApplication()->Run(&window);
}
@@ -0,0 +1 @@
..\..\..\..\Tools\GacGen.exe Resource.xml
@@ -0,0 +1,120 @@
<?xml version="1.0" encoding="utf-8"?>
<Resource>
<Folder name="GacGenConfig">
<Folder name="Cpp">
<Text name="Output">Source</Text>
<Text name="Include">GacUIReflection.h</Text>
<Text name="Name">Demo</Text>
<Text name="Prefix"></Text>
</Folder>
<Folder name="Res">
<Text name="Output">..\..\UIRes</Text>
<Text name="PrecompiledBinary">ColorPicker.bin</Text>
</Folder>
</Folder>
<Script>
<Workflow-ViewModel>
<![CDATA[
module viewmodel;
using presentation::*;
namespace demo
{
interface IColorItem
{
func GetItemName() : string;
prop ItemName : string {GetItemName}
func GetItemColor() : Color;
prop ItemColor : Color {GetItemColor}
}
interface IViewModel
{
func GetColorItems() : IColorItem^{};
prop ColorItems : IColorItem^{} {GetColorItems}
}
}
]]>
</Workflow-ViewModel>
</Script>
<Folder name="MainWindow">
<Instance name="MainWindowResource">
<Instance ref.CodeBehind="false" ref.Class="demo::MainWindow">
<ref.Parameter Name="ViewModel" Class="demo::IViewModel"/>
<Window Text="ContainersAndButtons" ClientSize="x:480 y:320">
<att.BoundsComposition-set PreferredMinSize="x:480 y:320"/>
<Table CellPadding="10" AlignmentToParent="left:0 top:0 right:0 bottom:0">
<att.Rows>
<CellOption>composeType:MinSize</CellOption>
<CellOption>composeType:MinSize</CellOption>
<CellOption>composeType:Percentage percentage:1.0</CellOption>
</att.Rows>
<att.Columns>
<CellOption>composeType:MinSize</CellOption>
<CellOption>composeType:Percentage percentage:1.0</CellOption>
</att.Columns>
<Cell Site="row:0 column:0">
<Label Text="ComboBox and BindableTextList using ItemTemplate:"/>
</Cell>
<Cell Site="row:1 column:0">
<ComboBox SelectedIndex="0">
<att.ItemTemplate>demo::ColorBomboItemTemplate</att.ItemTemplate>
<att.BoundsComposition-set AlignmentToParent="left:0 top:0 right:0 bottom:0"/>
<att.ListControl>
<BindableTextList HorizontalAlwaysVisible="false" VerticalAlwaysVisible="false">
<att.TextProperty>name</att.TextProperty>
<att.ItemSource-eval>ViewModel.ColorItems</att.ItemSource-eval>
<att.ItemTemplate>demo::ColorListItemTemplate</att.ItemTemplate>
</BindableTextList>
</att.ListControl>
</ComboBox>
</Cell>
</Table>
</Window>
</Instance>
</Instance>
<Instance name="ColorBomboItemTemplateResource">
<Instance ref.CodeBehind="false" ref.Class="demo::ColorBomboItemTemplate">
<ref.Parameter Name="ViewModel" Class="demo::IColorItem"/>
<ref.Property Name="TextColor" Type="Color"/>
<ControlTemplate ref.Name="self" MinSizeLimitation="LimitToElementAndChildren">
<Table AlignmentToParent="left:0 top:0 right:0 bottom:0" MinSizeLimitation="LimitToElementAndChildren">
<att.Rows>
<CellOption>composeType:Percentage percentage:1.0</CellOption>
<CellOption>composeType:Absolute absolute:16</CellOption>
<CellOption>composeType:Percentage percentage:1.0</CellOption>
</att.Rows>
<att.Columns>
<CellOption>composeType:Absolute absolute:16</CellOption>
<CellOption>composeType:Absolute absolute:3</CellOption>
<CellOption>composeType:Percentage percentage:1.0</CellOption>
</att.Columns>
<Cell Site="row:1 column:0">
<SolidBackground Color-eval="ViewModel.ItemColor"/>
</Cell>
<Cell Site="row:0 column:2 rowSpan:3">
<SolidLabel Text-eval="ViewModel.ItemName" Font-bind="self.Font" Color-bind="self.TextColor" Ellipse="true" VerticalAlignment="Center"/>
</Cell>
</Table>
</ControlTemplate>
</Instance>
</Instance>
<Instance name="ColorListItemTemplateResource">
<Instance ref.CodeBehind="false" ref.Class="demo::ColorListItemTemplate" xmlns:x="demo::*">
<ref.Parameter Name="ViewModel" Class="demo::IColorItem"/>
<TextListItemTemplate ref.Name="self" MinSizeLimitation="LimitToElementAndChildren">
<x:ColorBomboItemTemplate ViewModel-eval="ViewModel" Font-bind="self.Font" TextColor-bind="self.TextColor" AlignmentToParent="left:6 top:6 right:6 bottom:6"/>
</TextListItemTemplate>
</Instance>
</Instance>
</Folder>
</Resource>
@@ -0,0 +1,16 @@
/***********************************************************************
Vczh Library++ 3.0
Developer: Zihan Chen(vczh)
GacUI::Demo
This file is generated by: Vczh GacUI Resource Code Generator
************************************************************************
DO NOT MODIFY
***********************************************************************/
#ifndef VCZH_GACUI_RESOURCE_CODE_GENERATOR_Demo
#define VCZH_GACUI_RESOURCE_CODE_GENERATOR_Demo
#include "DemoPartialClasses.h"
#endif
@@ -0,0 +1,186 @@
/***********************************************************************
Vczh Library++ 3.0
Developer: Zihan Chen(vczh)
GacUI::Partial Classes
This file is generated by: Vczh GacUI Resource Code Generator
************************************************************************
DO NOT MODIFY
***********************************************************************/
#include "Demo.h"
namespace demo
{
// #region CLASS_MEMBER_GUIEVENT_HANDLER (DO NOT PUT OTHER CONTENT IN THIS #region.)
void ColorBomboItemTemplate::OnCreate()
{
}
void ColorBomboItemTemplate::OnDestroy()
{
}
// #endregion CLASS_MEMBER_GUIEVENT_HANDLER
ColorBomboItemTemplate::ColorBomboItemTemplate(Ptr<demo::IColorItem> ViewModel)
{
InitializeComponents(ViewModel);
OnCreate();
}
ColorBomboItemTemplate::~ColorBomboItemTemplate()
{
OnDestroy();
ClearSubscriptions();
}
}
namespace demo
{
// #region CLASS_MEMBER_GUIEVENT_HANDLER (DO NOT PUT OTHER CONTENT IN THIS #region.)
void ColorListItemTemplate::OnCreate()
{
}
void ColorListItemTemplate::OnDestroy()
{
}
// #endregion CLASS_MEMBER_GUIEVENT_HANDLER
ColorListItemTemplate::ColorListItemTemplate(Ptr<demo::IColorItem> ViewModel)
{
InitializeComponents(ViewModel);
OnCreate();
}
ColorListItemTemplate::~ColorListItemTemplate()
{
OnDestroy();
ClearSubscriptions();
}
}
namespace demo
{
// #region CLASS_MEMBER_GUIEVENT_HANDLER (DO NOT PUT OTHER CONTENT IN THIS #region.)
void MainWindow::OnCreate()
{
}
void MainWindow::OnDestroy()
{
}
// #endregion CLASS_MEMBER_GUIEVENT_HANDLER
MainWindow::MainWindow(Ptr<demo::IViewModel> ViewModel)
{
InitializeComponents(ViewModel);
OnCreate();
}
MainWindow::~MainWindow()
{
OnDestroy();
ClearSubscriptions();
}
}
namespace vl
{
namespace reflection
{
namespace description
{
#define _ ,
IMPL_CPP_TYPE_INFO(demo::IColorItem)
IMPL_CPP_TYPE_INFO(demo::IViewModel)
IMPL_CPP_TYPE_INFO(demo::ColorBomboItemTemplate)
IMPL_CPP_TYPE_INFO(demo::ColorListItemTemplate)
IMPL_CPP_TYPE_INFO(demo::MainWindow)
BEGIN_CLASS_MEMBER(demo::IColorItem)
CLASS_MEMBER_BASE(vl::reflection::IDescriptable)
CLASS_MEMBER_METHOD(GetItemName, NO_PARAMETER);
CLASS_MEMBER_METHOD(GetItemColor, NO_PARAMETER);
CLASS_MEMBER_PROPERTY_READONLY(ItemName, GetItemName)
CLASS_MEMBER_PROPERTY_READONLY(ItemColor, GetItemColor)
END_CLASS_MEMBER(demo::IColorItem)
BEGIN_CLASS_MEMBER(demo::IViewModel)
CLASS_MEMBER_BASE(vl::reflection::IDescriptable)
CLASS_MEMBER_METHOD(GetColorItems, NO_PARAMETER);
CLASS_MEMBER_PROPERTY_READONLY(ColorItems, GetColorItems)
END_CLASS_MEMBER(demo::IViewModel)
BEGIN_CLASS_MEMBER(demo::ColorBomboItemTemplate)
CLASS_MEMBER_BASE(vl::presentation::templates::GuiControlTemplate)
CLASS_MEMBER_CONSTRUCTOR(demo::ColorBomboItemTemplate*(Ptr<demo::IColorItem>), { L"ViewModel" })
CLASS_MEMBER_PROPERTY_READONLY_FAST(ViewModel)
CLASS_MEMBER_EVENT(TextColorChanged)
CLASS_MEMBER_PROPERTY_EVENT_FAST(TextColor, TextColorChanged)
END_CLASS_MEMBER(demo::ColorBomboItemTemplate)
BEGIN_CLASS_MEMBER(demo::ColorListItemTemplate)
CLASS_MEMBER_BASE(vl::presentation::templates::GuiTextListItemTemplate)
CLASS_MEMBER_CONSTRUCTOR(demo::ColorListItemTemplate*(Ptr<demo::IColorItem>), { L"ViewModel" })
CLASS_MEMBER_PROPERTY_READONLY_FAST(ViewModel)
END_CLASS_MEMBER(demo::ColorListItemTemplate)
BEGIN_CLASS_MEMBER(demo::MainWindow)
CLASS_MEMBER_BASE(vl::presentation::controls::GuiWindow)
CLASS_MEMBER_CONSTRUCTOR(demo::MainWindow*(Ptr<demo::IViewModel>), { L"ViewModel" })
CLASS_MEMBER_PROPERTY_READONLY_FAST(ViewModel)
END_CLASS_MEMBER(demo::MainWindow)
#undef _
class DemoResourceLoader : public Object, public ITypeLoader
{
public:
void Load(ITypeManager* manager)
{
ADD_TYPE_INFO(demo::IColorItem)
ADD_TYPE_INFO(demo::IViewModel)
ADD_TYPE_INFO(demo::ColorBomboItemTemplate)
ADD_TYPE_INFO(demo::ColorListItemTemplate)
ADD_TYPE_INFO(demo::MainWindow)
}
void Unload(ITypeManager* manager)
{
}
};
class DemoResourcePlugin : public Object, public vl::presentation::controls::IGuiPlugin
{
public:
void Load()override
{
GetGlobalTypeManager()->AddTypeLoader(new DemoResourceLoader);
}
void AfterLoad()override
{
}
void Unload()override
{
}
};
GUI_REGISTER_PLUGIN(DemoResourcePlugin)
}
}
}
@@ -0,0 +1,226 @@
/***********************************************************************
Vczh Library++ 3.0
Developer: Zihan Chen(vczh)
GacUI::Partial Classes
This file is generated by: Vczh GacUI Resource Code Generator
************************************************************************
DO NOT MODIFY
***********************************************************************/
#ifndef VCZH_GACUI_RESOURCE_CODE_GENERATOR_Demo_PARTIAL_CLASSES
#define VCZH_GACUI_RESOURCE_CODE_GENERATOR_Demo_PARTIAL_CLASSES
#include "GacUIReflection.h"
namespace demo
{
class IColorItem;
class IViewModel;
class ColorBomboItemTemplate;
class ColorListItemTemplate;
class MainWindow;
class IColorItem : public virtual vl::reflection::IDescriptable, public vl::reflection::Description<IColorItem>
{
public:
virtual vl::WString GetItemName() = 0;
virtual vl::presentation::Color GetItemColor() = 0;
};
class IViewModel : public virtual vl::reflection::IDescriptable, public vl::reflection::Description<IViewModel>
{
public:
virtual vl::collections::LazyList<vl::Ptr<demo::IColorItem>> GetColorItems() = 0;
};
template<typename TImpl>
class ColorBomboItemTemplate_ : public vl::presentation::templates::GuiControlTemplate, public vl::presentation::GuiInstancePartialClass<vl::presentation::templates::GuiControlTemplate>, public vl::reflection::Description<TImpl>
{
friend struct vl::reflection::description::CustomTypeDescriptorSelector<TImpl>;
private:
Ptr<demo::IColorItem> ViewModel_;
vl::presentation::Color TextColor_;
protected:
vl::presentation::templates::GuiControlTemplate* self;
void InitializeComponents(Ptr<demo::IColorItem> ViewModel)
{
ViewModel_ = ViewModel;
if (InitializeFromResource())
{
GUI_INSTANCE_REFERENCE(self);
}
else
{
ViewModel_ = 0;
}
}
public:
ColorBomboItemTemplate_()
:vl::presentation::GuiInstancePartialClass<vl::presentation::templates::GuiControlTemplate>(L"demo::ColorBomboItemTemplate")
,self(0)
{
this->TextColor_ = vl::reflection::description::UnboxValue<vl::presentation::Color>(vl::reflection::description::Value::From(L"", reflection::description::GetTypeDescriptor<vl::presentation::Color>()));
}
Ptr<demo::IColorItem> GetViewModel()
{
return ViewModel_;
}
vl::Event<void()> TextColorChanged;
vl::presentation::Color GetTextColor()
{
return TextColor_;
}
void SetTextColor(vl::presentation::Color value)
{
TextColor_ = value;
TextColorChanged();
}
};
template<typename TImpl>
class ColorListItemTemplate_ : public vl::presentation::templates::GuiTextListItemTemplate, public vl::presentation::GuiInstancePartialClass<vl::presentation::templates::GuiTextListItemTemplate>, public vl::reflection::Description<TImpl>
{
friend struct vl::reflection::description::CustomTypeDescriptorSelector<TImpl>;
private:
Ptr<demo::IColorItem> ViewModel_;
protected:
vl::presentation::templates::GuiTextListItemTemplate* self;
void InitializeComponents(Ptr<demo::IColorItem> ViewModel)
{
ViewModel_ = ViewModel;
if (InitializeFromResource())
{
GUI_INSTANCE_REFERENCE(self);
}
else
{
ViewModel_ = 0;
}
}
public:
ColorListItemTemplate_()
:vl::presentation::GuiInstancePartialClass<vl::presentation::templates::GuiTextListItemTemplate>(L"demo::ColorListItemTemplate")
,self(0)
{
}
Ptr<demo::IColorItem> GetViewModel()
{
return ViewModel_;
}
};
template<typename TImpl>
class MainWindow_ : public vl::presentation::controls::GuiWindow, public vl::presentation::GuiInstancePartialClass<vl::presentation::controls::GuiWindow>, public vl::reflection::Description<TImpl>
{
friend struct vl::reflection::description::CustomTypeDescriptorSelector<TImpl>;
private:
Ptr<demo::IViewModel> ViewModel_;
protected:
void InitializeComponents(Ptr<demo::IViewModel> ViewModel)
{
ViewModel_ = ViewModel;
if (InitializeFromResource())
{
}
else
{
ViewModel_ = 0;
}
}
public:
MainWindow_()
:vl::presentation::GuiInstancePartialClass<vl::presentation::controls::GuiWindow>(L"demo::MainWindow")
,vl::presentation::controls::GuiWindow(vl::presentation::theme::GetCurrentTheme()->CreateWindowStyle())
{
}
Ptr<demo::IViewModel> GetViewModel()
{
return ViewModel_;
}
};
}
namespace vl
{
namespace reflection
{
namespace description
{
DECL_TYPE_INFO(demo::IColorItem)
DECL_TYPE_INFO(demo::IViewModel)
DECL_TYPE_INFO(demo::ColorBomboItemTemplate)
DECL_TYPE_INFO(demo::ColorListItemTemplate)
DECL_TYPE_INFO(demo::MainWindow)
}
}
}
namespace demo
{
class ColorBomboItemTemplate : public demo::ColorBomboItemTemplate_<demo::ColorBomboItemTemplate>
{
friend class demo::ColorBomboItemTemplate_<demo::ColorBomboItemTemplate>;
friend struct vl::reflection::description::CustomTypeDescriptorSelector<demo::ColorBomboItemTemplate>;
protected:
// #region CLASS_MEMBER_GUIEVENT_HANDLER (DO NOT PUT OTHER CONTENT IN THIS #region.)
void OnCreate();
void OnDestroy();
// #endregion CLASS_MEMBER_GUIEVENT_HANDLER
public:
ColorBomboItemTemplate(Ptr<demo::IColorItem> ViewModel);
~ColorBomboItemTemplate();
};
}
namespace demo
{
class ColorListItemTemplate : public demo::ColorListItemTemplate_<demo::ColorListItemTemplate>
{
friend class demo::ColorListItemTemplate_<demo::ColorListItemTemplate>;
friend struct vl::reflection::description::CustomTypeDescriptorSelector<demo::ColorListItemTemplate>;
protected:
// #region CLASS_MEMBER_GUIEVENT_HANDLER (DO NOT PUT OTHER CONTENT IN THIS #region.)
void OnCreate();
void OnDestroy();
// #endregion CLASS_MEMBER_GUIEVENT_HANDLER
public:
ColorListItemTemplate(Ptr<demo::IColorItem> ViewModel);
~ColorListItemTemplate();
};
}
namespace demo
{
class MainWindow : public demo::MainWindow_<demo::MainWindow>
{
friend class demo::MainWindow_<demo::MainWindow>;
friend struct vl::reflection::description::CustomTypeDescriptorSelector<demo::MainWindow>;
protected:
// #region CLASS_MEMBER_GUIEVENT_HANDLER (DO NOT PUT OTHER CONTENT IN THIS #region.)
void OnCreate();
void OnDestroy();
// #endregion CLASS_MEMBER_GUIEVENT_HANDLER
public:
MainWindow(Ptr<demo::IViewModel> ViewModel);
~MainWindow();
};
}
#endif
@@ -13,6 +13,8 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "GacUILite", "..\Lib\GacUILi
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "TextEditor", "TextEditor\TextEditor.vcxproj", "{66069A5E-F697-42E2-8D9E-7D6E82019838}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "ColorPicker", "ColorPicker\ColorPicker.vcxproj", "{FBBBA8BF-96A4-4096-8204-A92571100F0E}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Win32 = Debug|Win32
@@ -35,6 +37,10 @@ Global
{66069A5E-F697-42E2-8D9E-7D6E82019838}.Debug|Win32.Build.0 = Debug|Win32
{66069A5E-F697-42E2-8D9E-7D6E82019838}.Release|Win32.ActiveCfg = Release|Win32
{66069A5E-F697-42E2-8D9E-7D6E82019838}.Release|Win32.Build.0 = Release|Win32
{FBBBA8BF-96A4-4096-8204-A92571100F0E}.Debug|Win32.ActiveCfg = Debug|Win32
{FBBBA8BF-96A4-4096-8204-A92571100F0E}.Debug|Win32.Build.0 = Debug|Win32
{FBBBA8BF-96A4-4096-8204-A92571100F0E}.Release|Win32.ActiveCfg = Release|Win32
{FBBBA8BF-96A4-4096-8204-A92571100F0E}.Release|Win32.Build.0 = Release|Win32
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
Binary file not shown.