mirror of
https://github.com/vczh-libraries/Release.git
synced 2026-05-23 07:45:59 +08:00
Upgrade Tutorial\GacUI_Controls
This commit is contained in:
@@ -278,9 +278,8 @@ void GuiMain()
|
||||
{
|
||||
LoadDemoTypes();
|
||||
{
|
||||
List<WString> errors;
|
||||
FileStream fileStream(L"../UIRes/AddressBook.bin", FileStream::ReadOnly);
|
||||
auto resource = GuiResource::LoadPrecompiledBinary(fileStream, errors);
|
||||
auto resource = GuiResource::LoadPrecompiledBinary(fileStream);
|
||||
GetResourceManager()->SetResource(L"Resource", resource);
|
||||
|
||||
folderImage = resource->GetImageByPath(L"Images/Folder");
|
||||
|
||||
@@ -21,61 +21,32 @@
|
||||
{
|
||||
interface IContact
|
||||
{
|
||||
func GetName() : string;
|
||||
prop Name : string {GetName}
|
||||
|
||||
func GetBigImage() : presentation::GuiImageData^;
|
||||
prop BigImage : presentation::GuiImageData^ {GetBigImage}
|
||||
|
||||
func GetSmallImage() : presentation::GuiImageData^;
|
||||
prop SmallImage : presentation::GuiImageData^ {GetSmallImage}
|
||||
|
||||
func GetBirthday() : DateTime;
|
||||
prop Birthday : DateTime {GetBirthday}
|
||||
|
||||
func GetBirthdayText() : string;
|
||||
prop BirthdayText : string {GetBirthdayText}
|
||||
|
||||
func GetPhone() : string;
|
||||
prop Phone : string {GetPhone}
|
||||
|
||||
func GetAddress() : string;
|
||||
prop Address : string {GetAddress}
|
||||
prop Name : string {const, not observe}
|
||||
prop BigImage : presentation::GuiImageData^ {const, not observe}
|
||||
prop SmallImage : presentation::GuiImageData^ {const, not observe}
|
||||
prop Birthday : DateTime {const, not observe}
|
||||
prop BirthdayText : string {const, not observe}
|
||||
prop Phone : string {const, not observe}
|
||||
prop Address : string {const, not observe}
|
||||
|
||||
func Update(name : string, birthday : DateTime, phone : string, address : string) : void;
|
||||
}
|
||||
|
||||
interface ICategory
|
||||
{
|
||||
func GetParent() : ICategory*;
|
||||
prop Parent : ICategory* {GetParent}
|
||||
|
||||
func GetName() : string;
|
||||
prop Name : string {GetName}
|
||||
|
||||
func GetImage() : presentation::GuiImageData^;
|
||||
prop Image : presentation::GuiImageData^ {GetImage}
|
||||
|
||||
func GetFolders() : ObservableList^;
|
||||
prop Folders : ObservableList^ {GetFolders}
|
||||
|
||||
func GetContacts() : ObservableList^;
|
||||
prop Contacts : ObservableList^ {GetContacts}
|
||||
prop Parent : ICategory* {const, not observe}
|
||||
prop Name : string {const, not observe}
|
||||
prop Image : presentation::GuiImageData^ {const, not observe}
|
||||
prop Folders : ObservableList^ {const, not observe}
|
||||
prop Contacts : ObservableList^ {const, not observe}
|
||||
}
|
||||
|
||||
interface IViewModel
|
||||
{
|
||||
func GetRootCategory() : ICategory^;
|
||||
|
||||
func GetSelectedCategory() : ICategory^;
|
||||
func SetSelectedCategory(value : ICategory^) : void;
|
||||
event SelectedCategoryChanged();
|
||||
prop SelectedCategory : ICategory^ {GetSelectedCategory, SetSelectedCategory : SelectedCategoryChanged}
|
||||
|
||||
func GetSelectedContact() : IContact^;
|
||||
func SetSelectedContact(value : IContact^) : void;
|
||||
event SelectedContactChanged();
|
||||
prop SelectedContact : IContact^ {GetSelectedContact, SetSelectedContact : SelectedContactChanged}
|
||||
prop SelectedCategory : ICategory^ {}
|
||||
prop SelectedContact : IContact^ {}
|
||||
|
||||
func AddCategory(name : string) : void;
|
||||
func RemoveCategory() : void;
|
||||
@@ -329,25 +300,7 @@
|
||||
<Instance ref.CodeBehind="false" ref.Class="demo::NewFolderWindow">
|
||||
<ref.Members>
|
||||
<![CDATA[
|
||||
@cpp:Protected
|
||||
var folderName : string = "";
|
||||
event FolderNameChanged();
|
||||
|
||||
func GetFolderName() : string
|
||||
{
|
||||
return folderName;
|
||||
}
|
||||
|
||||
func SetFolderName(value : string) : void
|
||||
{
|
||||
if (folderName != value)
|
||||
{
|
||||
folderName = value;
|
||||
FolderNameChanged();
|
||||
}
|
||||
}
|
||||
|
||||
prop FolderName : string {GetFolderName, SetFolderName : FolderNameChanged}
|
||||
prop FolderName : string = "" {}
|
||||
|
||||
var Ready : bool = true;
|
||||
]]>
|
||||
@@ -400,25 +353,7 @@
|
||||
<ref.Parameter Name="Contact" Class="demo::IContact"/>
|
||||
<ref.Members>
|
||||
<![CDATA[
|
||||
@cpp:Protected
|
||||
var forEdit : bool = false;
|
||||
event ForEditChanged();
|
||||
|
||||
func GetForEdit() : bool
|
||||
{
|
||||
return forEdit;
|
||||
}
|
||||
|
||||
func SetForEdit(value : bool) : void
|
||||
{
|
||||
if (forEdit != value)
|
||||
{
|
||||
forEdit = value;
|
||||
ForEditChanged();
|
||||
}
|
||||
}
|
||||
|
||||
prop ForEdit : bool {GetForEdit, SetForEdit : ForEditChanged}
|
||||
prop ForEdit : bool = false {}
|
||||
|
||||
var Ready : bool = true;
|
||||
]]>
|
||||
|
||||
@@ -125,13 +125,13 @@ namespace vl
|
||||
{
|
||||
INVOKE_INTERFACE_PROXY_NOPARAMS(RemoveContact);
|
||||
}
|
||||
void SetSelectedCategory(::vl::Ptr<::demo::ICategory> value) override
|
||||
void SetSelectedCategory(::vl::Ptr<::demo::ICategory> __vwsn_value_) override
|
||||
{
|
||||
INVOKE_INTERFACE_PROXY(SetSelectedCategory, value);
|
||||
INVOKE_INTERFACE_PROXY(SetSelectedCategory, <value>);
|
||||
}
|
||||
void SetSelectedContact(::vl::Ptr<::demo::IContact> value) override
|
||||
void SetSelectedContact(::vl::Ptr<::demo::IContact> __vwsn_value_) override
|
||||
{
|
||||
INVOKE_INTERFACE_PROXY(SetSelectedContact, value);
|
||||
INVOKE_INTERFACE_PROXY(SetSelectedContact, <value>);
|
||||
}
|
||||
END_INTERFACE_PROXY(::demo::IViewModel)
|
||||
#endif
|
||||
|
||||
@@ -2612,14 +2612,13 @@ Class (::demo::NewContactWindow)
|
||||
|
||||
bool NewContactWindow::GetForEdit()
|
||||
{
|
||||
return ::vl::__vwsn::This(this)->forEdit;
|
||||
return ::vl::__vwsn::This(this)->__vwsn_prop_ForEdit;
|
||||
}
|
||||
|
||||
void NewContactWindow::SetForEdit(bool value)
|
||||
void NewContactWindow::SetForEdit(bool __vwsn_value_)
|
||||
{
|
||||
if ((::vl::__vwsn::This(this)->forEdit != value))
|
||||
if ((::vl::__vwsn::This(this)->__vwsn_prop_ForEdit != __vwsn_value_))
|
||||
{
|
||||
(::vl::__vwsn::This(this)->forEdit = value);
|
||||
(::vl::__vwsn::This(this)->__vwsn_prop_ForEdit = __vwsn_value_);
|
||||
::vl::__vwsn::EventInvoke(::vl::__vwsn::This(this)->ForEditChanged)();
|
||||
}
|
||||
}
|
||||
@@ -2802,14 +2801,13 @@ Class (::demo::NewFolderWindow)
|
||||
|
||||
::vl::WString NewFolderWindow::GetFolderName()
|
||||
{
|
||||
return ::vl::__vwsn::This(this)->folderName;
|
||||
return ::vl::__vwsn::This(this)->__vwsn_prop_FolderName;
|
||||
}
|
||||
|
||||
void NewFolderWindow::SetFolderName(const ::vl::WString& value)
|
||||
void NewFolderWindow::SetFolderName(const ::vl::WString& __vwsn_value_)
|
||||
{
|
||||
if ((::vl::__vwsn::This(this)->folderName != value))
|
||||
if ((::vl::__vwsn::This(this)->__vwsn_prop_FolderName != __vwsn_value_))
|
||||
{
|
||||
(::vl::__vwsn::This(this)->folderName = value);
|
||||
(::vl::__vwsn::This(this)->__vwsn_prop_FolderName = __vwsn_value_);
|
||||
::vl::__vwsn::EventInvoke(::vl::__vwsn::This(this)->FolderNameChanged)();
|
||||
}
|
||||
}
|
||||
@@ -2907,8 +2905,8 @@ namespace vl
|
||||
CLASS_MEMBER_METHOD(GetSelectedContact, NO_PARAMETER)
|
||||
CLASS_MEMBER_METHOD(RemoveCategory, NO_PARAMETER)
|
||||
CLASS_MEMBER_METHOD(RemoveContact, NO_PARAMETER)
|
||||
CLASS_MEMBER_METHOD(SetSelectedCategory, { L"value" })
|
||||
CLASS_MEMBER_METHOD(SetSelectedContact, { L"value" })
|
||||
CLASS_MEMBER_METHOD(SetSelectedCategory, { L"__vwsn_value_" })
|
||||
CLASS_MEMBER_METHOD(SetSelectedContact, { L"__vwsn_value_" })
|
||||
CLASS_MEMBER_EVENT(SelectedCategoryChanged)
|
||||
CLASS_MEMBER_EVENT(SelectedContactChanged)
|
||||
CLASS_MEMBER_PROPERTY_EVENT(SelectedCategory, GetSelectedCategory, SetSelectedCategory, SelectedCategoryChanged)
|
||||
@@ -2993,13 +2991,13 @@ namespace vl
|
||||
CLASS_MEMBER_CONSTRUCTOR(::demo::NewContactWindow*(::vl::Ptr<::demo::IContact>), { L"__vwsn_ctor_parameter_Contact" })
|
||||
CLASS_MEMBER_METHOD(GetContact, NO_PARAMETER)
|
||||
CLASS_MEMBER_METHOD(GetForEdit, NO_PARAMETER)
|
||||
CLASS_MEMBER_METHOD(SetForEdit, { L"value" })
|
||||
CLASS_MEMBER_METHOD(SetForEdit, { L"__vwsn_value_" })
|
||||
CLASS_MEMBER_EVENT(ForEditChanged)
|
||||
CLASS_MEMBER_FIELD(__vwsn_parameter_Contact)
|
||||
CLASS_MEMBER_FIELD(__vwsn_prop_ForEdit)
|
||||
CLASS_MEMBER_PROPERTY_READONLY(Contact, GetContact)
|
||||
CLASS_MEMBER_PROPERTY_EVENT(ForEdit, GetForEdit, SetForEdit, ForEditChanged)
|
||||
CLASS_MEMBER_FIELD(Ready)
|
||||
CLASS_MEMBER_FIELD(forEdit)
|
||||
END_CLASS_MEMBER(::demo::NewContactWindow)
|
||||
|
||||
BEGIN_CLASS_MEMBER(::demo::NewContactWindowConstructor)
|
||||
@@ -3039,11 +3037,11 @@ namespace vl
|
||||
BEGIN_CLASS_MEMBER(::demo::NewFolderWindow)
|
||||
CLASS_MEMBER_CONSTRUCTOR(::demo::NewFolderWindow*(), NO_PARAMETER)
|
||||
CLASS_MEMBER_METHOD(GetFolderName, NO_PARAMETER)
|
||||
CLASS_MEMBER_METHOD(SetFolderName, { L"value" })
|
||||
CLASS_MEMBER_METHOD(SetFolderName, { L"__vwsn_value_" })
|
||||
CLASS_MEMBER_EVENT(FolderNameChanged)
|
||||
CLASS_MEMBER_FIELD(__vwsn_prop_FolderName)
|
||||
CLASS_MEMBER_PROPERTY_EVENT(FolderName, GetFolderName, SetFolderName, FolderNameChanged)
|
||||
CLASS_MEMBER_FIELD(Ready)
|
||||
CLASS_MEMBER_FIELD(folderName)
|
||||
END_CLASS_MEMBER(::demo::NewFolderWindow)
|
||||
|
||||
BEGIN_CLASS_MEMBER(::demo::NewFolderWindowConstructor)
|
||||
|
||||
@@ -268,12 +268,11 @@ namespace demo
|
||||
#ifndef VCZH_DEBUG_NO_REFLECTION
|
||||
friend struct ::vl::reflection::description::CustomTypeDescriptorSelector<NewContactWindow>;
|
||||
#endif
|
||||
protected:
|
||||
bool forEdit = false;
|
||||
public:
|
||||
::vl::Event<void()> ForEditChanged;
|
||||
bool __vwsn_prop_ForEdit = false;
|
||||
bool GetForEdit();
|
||||
void SetForEdit(bool value);
|
||||
void SetForEdit(bool __vwsn_value_);
|
||||
::vl::Event<void()> ForEditChanged;
|
||||
bool Ready = true;
|
||||
::vl::Ptr<::demo::IContact> __vwsn_parameter_Contact = ::vl::Ptr<::demo::IContact>();
|
||||
::vl::Ptr<::demo::IContact> GetContact();
|
||||
@@ -321,12 +320,11 @@ namespace demo
|
||||
#ifndef VCZH_DEBUG_NO_REFLECTION
|
||||
friend struct ::vl::reflection::description::CustomTypeDescriptorSelector<NewFolderWindow>;
|
||||
#endif
|
||||
protected:
|
||||
::vl::WString folderName = ::vl::WString(L"", false);
|
||||
public:
|
||||
::vl::Event<void()> FolderNameChanged;
|
||||
::vl::WString __vwsn_prop_FolderName = ::vl::WString(L"", false);
|
||||
::vl::WString GetFolderName();
|
||||
void SetFolderName(const ::vl::WString& value);
|
||||
void SetFolderName(const ::vl::WString& __vwsn_value_);
|
||||
::vl::Event<void()> FolderNameChanged;
|
||||
bool Ready = true;
|
||||
NewFolderWindow();
|
||||
~NewFolderWindow();
|
||||
@@ -369,10 +367,10 @@ namespace demo
|
||||
public:
|
||||
virtual ::vl::Ptr<::demo::ICategory> GetRootCategory() = 0;
|
||||
virtual ::vl::Ptr<::demo::ICategory> GetSelectedCategory() = 0;
|
||||
virtual void SetSelectedCategory(::vl::Ptr<::demo::ICategory> value) = 0;
|
||||
virtual void SetSelectedCategory(::vl::Ptr<::demo::ICategory> __vwsn_value_) = 0;
|
||||
::vl::Event<void()> SelectedCategoryChanged;
|
||||
virtual ::vl::Ptr<::demo::IContact> GetSelectedContact() = 0;
|
||||
virtual void SetSelectedContact(::vl::Ptr<::demo::IContact> value) = 0;
|
||||
virtual void SetSelectedContact(::vl::Ptr<::demo::IContact> __vwsn_value_) = 0;
|
||||
::vl::Event<void()> SelectedContactChanged;
|
||||
virtual void AddCategory(const ::vl::WString& name) = 0;
|
||||
virtual void RemoveCategory() = 0;
|
||||
|
||||
@@ -69,9 +69,8 @@ public:
|
||||
void GuiMain()
|
||||
{
|
||||
{
|
||||
List<WString> errors;
|
||||
FileStream fileStream(L"../UIRes/ColorPicker.bin", FileStream::ReadOnly);
|
||||
auto resource = GuiResource::LoadPrecompiledBinary(fileStream, errors);
|
||||
auto resource = GuiResource::LoadPrecompiledBinary(fileStream);
|
||||
GetResourceManager()->SetResource(L"Resource", resource);
|
||||
}
|
||||
demo::MainWindow window(new ViewModel);
|
||||
|
||||
@@ -21,17 +21,13 @@
|
||||
{
|
||||
interface IColorItem
|
||||
{
|
||||
func GetItemName() : string;
|
||||
prop ItemName : string {GetItemName}
|
||||
|
||||
func GetItemColor() : Color;
|
||||
prop ItemColor : Color {GetItemColor}
|
||||
prop ItemName : string {const, not observe}
|
||||
prop ItemColor : Color {const, not observe}
|
||||
}
|
||||
|
||||
interface IViewModel
|
||||
{
|
||||
func GetColorItems() : IColorItem^{};
|
||||
prop ColorItems : IColorItem^{} {GetColorItems}
|
||||
prop ColorItems : IColorItem^{} {const, not observe}
|
||||
}
|
||||
}
|
||||
]]>
|
||||
@@ -81,25 +77,7 @@
|
||||
<ref.Parameter Name="ViewModel" Class="demo::IColorItem"/>
|
||||
<ref.Members>
|
||||
<![CDATA[
|
||||
@cpp:Protected
|
||||
var textColor : Color = cast Color "#000000";
|
||||
event TextColorChanged();
|
||||
|
||||
func GetTextColor() : Color
|
||||
{
|
||||
return textColor;
|
||||
}
|
||||
|
||||
func SetTextColor(value : Color) : void
|
||||
{
|
||||
if (textColor != value)
|
||||
{
|
||||
textColor = value;
|
||||
TextColorChanged();
|
||||
}
|
||||
}
|
||||
|
||||
prop TextColor : Color {GetTextColor, SetTextColor : TextColorChanged}
|
||||
prop TextColor : Color = (cast Color "#000000") {}
|
||||
]]>
|
||||
</ref.Members>
|
||||
<ControlTemplate ref.Name="self" MinSizeLimitation="LimitToElementAndChildren">
|
||||
|
||||
@@ -663,14 +663,13 @@ Class (::demo::ColorBomboItemTemplate)
|
||||
|
||||
::vl::presentation::Color ColorBomboItemTemplate::GetTextColor()
|
||||
{
|
||||
return ::vl::__vwsn::This(this)->textColor;
|
||||
return ::vl::__vwsn::This(this)->__vwsn_prop_TextColor;
|
||||
}
|
||||
|
||||
void ColorBomboItemTemplate::SetTextColor(::vl::presentation::Color value)
|
||||
void ColorBomboItemTemplate::SetTextColor(::vl::presentation::Color __vwsn_value_)
|
||||
{
|
||||
if ((::vl::__vwsn::This(this)->textColor != value))
|
||||
if ((::vl::__vwsn::This(this)->__vwsn_prop_TextColor != __vwsn_value_))
|
||||
{
|
||||
(::vl::__vwsn::This(this)->textColor = value);
|
||||
(::vl::__vwsn::This(this)->__vwsn_prop_TextColor = __vwsn_value_);
|
||||
::vl::__vwsn::EventInvoke(::vl::__vwsn::This(this)->TextColorChanged)();
|
||||
}
|
||||
}
|
||||
@@ -913,12 +912,12 @@ namespace vl
|
||||
CLASS_MEMBER_CONSTRUCTOR(::demo::ColorBomboItemTemplate*(::vl::Ptr<::demo::IColorItem>), { L"__vwsn_ctor_parameter_ViewModel" })
|
||||
CLASS_MEMBER_METHOD(GetTextColor, NO_PARAMETER)
|
||||
CLASS_MEMBER_METHOD(GetViewModel, NO_PARAMETER)
|
||||
CLASS_MEMBER_METHOD(SetTextColor, { L"value" })
|
||||
CLASS_MEMBER_METHOD(SetTextColor, { L"__vwsn_value_" })
|
||||
CLASS_MEMBER_EVENT(TextColorChanged)
|
||||
CLASS_MEMBER_FIELD(__vwsn_parameter_ViewModel)
|
||||
CLASS_MEMBER_FIELD(__vwsn_prop_TextColor)
|
||||
CLASS_MEMBER_PROPERTY_EVENT(TextColor, GetTextColor, SetTextColor, TextColorChanged)
|
||||
CLASS_MEMBER_PROPERTY_READONLY(ViewModel, GetViewModel)
|
||||
CLASS_MEMBER_FIELD(textColor)
|
||||
END_CLASS_MEMBER(::demo::ColorBomboItemTemplate)
|
||||
|
||||
BEGIN_CLASS_MEMBER(::demo::ColorBomboItemTemplateConstructor)
|
||||
|
||||
@@ -92,12 +92,11 @@ namespace demo
|
||||
#ifndef VCZH_DEBUG_NO_REFLECTION
|
||||
friend struct ::vl::reflection::description::CustomTypeDescriptorSelector<ColorBomboItemTemplate>;
|
||||
#endif
|
||||
protected:
|
||||
::vl::presentation::Color textColor = ::vl::__vwsn::Parse<::vl::presentation::Color>(::vl::WString(L"#000000", false));
|
||||
public:
|
||||
::vl::Event<void()> TextColorChanged;
|
||||
::vl::presentation::Color __vwsn_prop_TextColor = ::vl::__vwsn::Parse<::vl::presentation::Color>(::vl::WString(L"#000000", false));
|
||||
::vl::presentation::Color GetTextColor();
|
||||
void SetTextColor(::vl::presentation::Color value);
|
||||
void SetTextColor(::vl::presentation::Color __vwsn_value_);
|
||||
::vl::Event<void()> TextColorChanged;
|
||||
::vl::Ptr<::demo::IColorItem> __vwsn_parameter_ViewModel = ::vl::Ptr<::demo::IColorItem>();
|
||||
::vl::Ptr<::demo::IColorItem> GetViewModel();
|
||||
ColorBomboItemTemplate(::vl::Ptr<::demo::IColorItem> __vwsn_ctor_parameter_ViewModel);
|
||||
|
||||
@@ -13,9 +13,8 @@ int CALLBACK WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLi
|
||||
void GuiMain()
|
||||
{
|
||||
{
|
||||
List<WString> errors;
|
||||
FileStream fileStream(L"../UIRes/ContainersAndButtons.bin", FileStream::ReadOnly);
|
||||
auto resource = GuiResource::LoadPrecompiledBinary(fileStream, errors);
|
||||
auto resource = GuiResource::LoadPrecompiledBinary(fileStream);
|
||||
GetResourceManager()->SetResource(L"Resource", resource);
|
||||
}
|
||||
demo::MainWindow window;
|
||||
|
||||
@@ -15,9 +15,8 @@ int CALLBACK WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLi
|
||||
void GuiMain()
|
||||
{
|
||||
{
|
||||
List<WString> errors;
|
||||
FileStream fileStream(L"../UIRes/TextEditor.bin", FileStream::ReadOnly);
|
||||
auto resource = GuiResource::LoadPrecompiledBinary(fileStream, errors);
|
||||
auto resource = GuiResource::LoadPrecompiledBinary(fileStream);
|
||||
GetResourceManager()->SetResource(L"Resource", resource);
|
||||
}
|
||||
demo::MainWindow window;
|
||||
|
||||
Reference in New Issue
Block a user