diff --git a/Tutorial/GacUI_Controls/TextEditor/TextEditor.vcxproj b/Tutorial/GacUI_Controls/TextEditor/TextEditor.vcxproj index 3cfb5049..9b6f2310 100644 --- a/Tutorial/GacUI_Controls/TextEditor/TextEditor.vcxproj +++ b/Tutorial/GacUI_Controls/TextEditor/TextEditor.vcxproj @@ -83,7 +83,6 @@ - @@ -102,7 +101,6 @@ - diff --git a/Tutorial/GacUI_Controls/TextEditor/TextEditor.vcxproj.filters b/Tutorial/GacUI_Controls/TextEditor/TextEditor.vcxproj.filters index e7303402..1c55ae26 100644 --- a/Tutorial/GacUI_Controls/TextEditor/TextEditor.vcxproj.filters +++ b/Tutorial/GacUI_Controls/TextEditor/TextEditor.vcxproj.filters @@ -33,9 +33,6 @@ UI - - UI - @@ -67,9 +64,6 @@ UI - - UI - diff --git a/Tutorial/GacUI_Controls/TextEditor/UI/FindWindow.xml b/Tutorial/GacUI_Controls/TextEditor/UI/FindWindow.xml index b5017033..b54edce7 100644 --- a/Tutorial/GacUI_Controls/TextEditor/UI/FindWindow.xml +++ b/Tutorial/GacUI_Controls/TextEditor/UI/FindWindow.xml @@ -1,6 +1,106 @@ - - - - - \ No newline at end of file + + + + + + + + + + + + + + composeType:MinSize + composeType:MinSize + composeType:Percentage percentage:1.0 + composeType:MinSize + + + composeType:MinSize + composeType:Percentage percentage:1.0 + composeType:MinSize + composeType:MinSize + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+
+
+
+
\ No newline at end of file diff --git a/Tutorial/GacUI_Controls/TextEditor/UI/Resource.xml b/Tutorial/GacUI_Controls/TextEditor/UI/Resource.xml index 57ca700a..77de88bd 100644 --- a/Tutorial/GacUI_Controls/TextEditor/UI/Resource.xml +++ b/Tutorial/GacUI_Controls/TextEditor/UI/Resource.xml @@ -14,6 +14,6 @@ Images\Folder.xml AboutWindow.xml - FindWindow.xml + FindWindow.xml MainWindow.xml \ No newline at end of file diff --git a/Tutorial/GacUI_Controls/TextEditor/UI/Source/Demo.h b/Tutorial/GacUI_Controls/TextEditor/UI/Source/Demo.h index 014ea2c2..d04c57f0 100644 --- a/Tutorial/GacUI_Controls/TextEditor/UI/Source/Demo.h +++ b/Tutorial/GacUI_Controls/TextEditor/UI/Source/Demo.h @@ -13,7 +13,6 @@ DO NOT MODIFY #include "DemoPartialClasses.h" #include "AboutWindow.h" -#include "FindWindow.h" #include "MainWindow.h" #endif diff --git a/Tutorial/GacUI_Controls/TextEditor/UI/Source/DemoPartialClasses.cpp b/Tutorial/GacUI_Controls/TextEditor/UI/Source/DemoPartialClasses.cpp index 6cc9f982..24225541 100644 --- a/Tutorial/GacUI_Controls/TextEditor/UI/Source/DemoPartialClasses.cpp +++ b/Tutorial/GacUI_Controls/TextEditor/UI/Source/DemoPartialClasses.cpp @@ -10,6 +10,24 @@ DO NOT MODIFY #include "Demo.h" +namespace demo +{ + // #region CLASS_MEMBER_GUIEVENT_HANDLER (DO NOT PUT OTHER CONTENT IN THIS #region.) + + // #endregion CLASS_MEMBER_GUIEVENT_HANDLER + + FindWindow::FindWindow(Ptr ViewModel) + { + InitializeComponents(ViewModel); + } + + FindWindow::~FindWindow() + { + ClearSubscriptions(); + } +} + + namespace vl { namespace reflection @@ -17,10 +35,16 @@ namespace vl namespace description { #define _ , + IMPL_CPP_TYPE_INFO(vm::IFindWindowViewModel) IMPL_CPP_TYPE_INFO(demo::AboutWindow) IMPL_CPP_TYPE_INFO(demo::FindWindow) IMPL_CPP_TYPE_INFO(demo::MainWindow) + BEGIN_CLASS_MEMBER(vm::IFindWindowViewModel) + CLASS_MEMBER_BASE(vl::reflection::IDescriptable) + CLASS_MEMBER_METHOD(FindNext, { L"toFind" _ L"caseSensitive" _ L"down" }); + END_CLASS_MEMBER(vm::IFindWindowViewModel) + BEGIN_CLASS_MEMBER(demo::AboutWindow) CLASS_MEMBER_BASE(vl::presentation::controls::GuiWindow) CLASS_MEMBER_CONSTRUCTOR(demo::AboutWindow*(), NO_PARAMETER) @@ -30,7 +54,9 @@ namespace vl BEGIN_CLASS_MEMBER(demo::FindWindow) CLASS_MEMBER_BASE(vl::presentation::controls::GuiWindow) - CLASS_MEMBER_CONSTRUCTOR(demo::FindWindow*(), NO_PARAMETER) + CLASS_MEMBER_CONSTRUCTOR(demo::FindWindow*(Ptr), { L"ViewModel" }) + + CLASS_MEMBER_PROPERTY_READONLY_FAST(ViewModel) END_CLASS_MEMBER(demo::FindWindow) BEGIN_CLASS_MEMBER(demo::MainWindow) @@ -64,6 +90,7 @@ namespace vl public: void Load(ITypeManager* manager) { + ADD_TYPE_INFO(vm::IFindWindowViewModel) ADD_TYPE_INFO(demo::AboutWindow) ADD_TYPE_INFO(demo::FindWindow) ADD_TYPE_INFO(demo::MainWindow) diff --git a/Tutorial/GacUI_Controls/TextEditor/UI/Source/DemoPartialClasses.h b/Tutorial/GacUI_Controls/TextEditor/UI/Source/DemoPartialClasses.h index c11b9563..4c73e2b4 100644 --- a/Tutorial/GacUI_Controls/TextEditor/UI/Source/DemoPartialClasses.h +++ b/Tutorial/GacUI_Controls/TextEditor/UI/Source/DemoPartialClasses.h @@ -13,12 +13,28 @@ DO NOT MODIFY #include "GacUIReflection.h" +namespace vm +{ + class IFindWindowViewModel; +} namespace demo { class AboutWindow; class FindWindow; class MainWindow; +} +namespace vm +{ + class IFindWindowViewModel : public virtual vl::reflection::IDescriptable, public vl::reflection::Description + { + public: + virtual bool FindNext(vl::WString toFind, bool caseSensitive, bool down) = 0; + }; + +} +namespace demo +{ template class AboutWindow_ : public vl::presentation::controls::GuiWindow, public vl::presentation::GuiInstancePartialClass, public vl::reflection::Description { @@ -54,26 +70,52 @@ namespace demo { friend struct vl::reflection::description::CustomTypeDescriptorSelector; private: + Ptr ViewModel_; protected: + vl::presentation::controls::GuiSelectableButton* checkCase; + vl::presentation::controls::GuiMessageDialog* dialogContentNotFound; + vl::presentation::controls::GuiSelectableButton::MutexGroupController* groupDirection; + vl::presentation::controls::GuiSelectableButton* radioDown; + vl::presentation::controls::GuiSelectableButton* radioUp; vl::presentation::controls::GuiWindow* self; + vl::presentation::controls::GuiSinglelineTextBox* textFind; - void InitializeComponents() + void InitializeComponents(Ptr ViewModel) { + ViewModel_ = ViewModel; if (InitializeFromResource()) { + GUI_INSTANCE_REFERENCE(checkCase); + GUI_INSTANCE_REFERENCE(dialogContentNotFound); + GUI_INSTANCE_REFERENCE(groupDirection); + GUI_INSTANCE_REFERENCE(radioDown); + GUI_INSTANCE_REFERENCE(radioUp); GUI_INSTANCE_REFERENCE(self); + GUI_INSTANCE_REFERENCE(textFind); } else { + ViewModel_ = 0; } } public: FindWindow_() :vl::presentation::GuiInstancePartialClass(L"demo::FindWindow") ,vl::presentation::controls::GuiWindow(vl::presentation::theme::GetCurrentTheme()->CreateWindowStyle()) + ,checkCase(0) + ,dialogContentNotFound(0) + ,groupDirection(0) + ,radioDown(0) + ,radioUp(0) ,self(0) + ,textFind(0) { } + + Ptr GetViewModel() + { + return ViewModel_; + } }; template @@ -179,6 +221,7 @@ namespace vl { namespace description { + DECL_TYPE_INFO(vm::IFindWindowViewModel) DECL_TYPE_INFO(demo::AboutWindow) DECL_TYPE_INFO(demo::FindWindow) DECL_TYPE_INFO(demo::MainWindow) @@ -186,5 +229,22 @@ namespace vl } } } +namespace demo +{ + class FindWindow : public demo::FindWindow_ + { + friend class demo::FindWindow_; + friend struct vl::reflection::description::CustomTypeDescriptorSelector; + protected: + + // #region CLASS_MEMBER_GUIEVENT_HANDLER (DO NOT PUT OTHER CONTENT IN THIS #region.) + // #endregion CLASS_MEMBER_GUIEVENT_HANDLER + public: + FindWindow(Ptr ViewModel); + ~FindWindow(); + }; +} + + #endif diff --git a/Tutorial/GacUI_Controls/TextEditor/UI/Source/FindWindow.cpp b/Tutorial/GacUI_Controls/TextEditor/UI/Source/FindWindow.cpp deleted file mode 100644 index 78793a4a..00000000 --- a/Tutorial/GacUI_Controls/TextEditor/UI/Source/FindWindow.cpp +++ /dev/null @@ -1,27 +0,0 @@ -/*********************************************************************** -Vczh Library++ 3.0 -Developer: Zihan Chen(vczh) -GacUI::FindWindow - -This file is generated by: Vczh GacUI Resource Code Generator -***********************************************************************/ - -#include "Demo.h" - -namespace demo -{ - // #region CLASS_MEMBER_GUIEVENT_HANDLER (DO NOT PUT OTHER CONTENT IN THIS #region.) - - // #endregion CLASS_MEMBER_GUIEVENT_HANDLER - - FindWindow::FindWindow() - { - InitializeComponents(); - } - - FindWindow::~FindWindow() - { - ClearSubscriptions(); - } -} - diff --git a/Tutorial/GacUI_Controls/TextEditor/UI/Source/FindWindow.h b/Tutorial/GacUI_Controls/TextEditor/UI/Source/FindWindow.h deleted file mode 100644 index c9413f53..00000000 --- a/Tutorial/GacUI_Controls/TextEditor/UI/Source/FindWindow.h +++ /dev/null @@ -1,30 +0,0 @@ -/*********************************************************************** -Vczh Library++ 3.0 -Developer: Zihan Chen(vczh) -GacUI::FindWindow - -This file is generated by: Vczh GacUI Resource Code Generator -***********************************************************************/ - -#ifndef VCZH_GACUI_RESOURCE_CODE_GENERATOR_Demo_FindWindow -#define VCZH_GACUI_RESOURCE_CODE_GENERATOR_Demo_FindWindow - -#include "DemoPartialClasses.h" - -namespace demo -{ - class FindWindow : public demo::FindWindow_ - { - friend class demo::FindWindow_; - friend struct vl::reflection::description::CustomTypeDescriptorSelector; - protected: - - // #region CLASS_MEMBER_GUIEVENT_HANDLER (DO NOT PUT OTHER CONTENT IN THIS #region.) - // #endregion CLASS_MEMBER_GUIEVENT_HANDLER - public: - FindWindow(); - ~FindWindow(); - }; -} - -#endif diff --git a/Tutorial/GacUI_Controls/TextEditor/UI/Source/MainWindow.cpp b/Tutorial/GacUI_Controls/TextEditor/UI/Source/MainWindow.cpp index 8400f43d..b7c2bd5a 100644 --- a/Tutorial/GacUI_Controls/TextEditor/UI/Source/MainWindow.cpp +++ b/Tutorial/GacUI_Controls/TextEditor/UI/Source/MainWindow.cpp @@ -110,6 +110,7 @@ namespace demo void MainWindow::commandEditFind_Executed(GuiGraphicsComposition* sender, vl::presentation::compositions::GuiEventArgs& arguments) { + findWindow->Show(); } void MainWindow::commandEditPaste_Executed(GuiGraphicsComposition* sender, vl::presentation::compositions::GuiEventArgs& arguments) @@ -311,10 +312,23 @@ namespace demo MainWindow::MainWindow() { InitializeComponents(); + findWindow = MakePtr(MakePtr(textBox)); + findWindow->MoveToScreenCenter(); + findWindow->GetNativeWindow()->SetParent(GetNativeWindow()); } MainWindow::~MainWindow() { ClearSubscriptions(); } + + MainWindow::FindWindowViewModel::FindWindowViewModel(GuiMultilineTextBox* _textBox) + :textBox(_textBox) + { + } + + bool MainWindow::FindWindowViewModel::FindNext(vl::WString toFind, bool caseSensitive, bool down) + { + return false; + } } diff --git a/Tutorial/GacUI_Controls/TextEditor/UI/Source/MainWindow.h b/Tutorial/GacUI_Controls/TextEditor/UI/Source/MainWindow.h index e3d84c83..1e9f259f 100644 --- a/Tutorial/GacUI_Controls/TextEditor/UI/Source/MainWindow.h +++ b/Tutorial/GacUI_Controls/TextEditor/UI/Source/MainWindow.h @@ -39,16 +39,29 @@ namespace demo void commandFileSave_Executed(GuiGraphicsComposition* sender, vl::presentation::compositions::GuiEventArgs& arguments); void window_Closing(GuiGraphicsComposition* sender, vl::presentation::compositions::GuiRequestEventArgs& arguments); // #endregion CLASS_MEMBER_GUIEVENT_HANDLER + private: + + class FindWindowViewModel : public Object, public virtual vm::IFindWindowViewModel + { + private: + GuiMultilineTextBox* textBox; + + public: + FindWindowViewModel(GuiMultilineTextBox* _textBox); + + bool FindNext(vl::WString toFind, bool caseSensitive, bool down)override; + }; private: - WString fileName; - bool isXml = false; + WString fileName; + bool isXml = false; + Ptr findWindow; - bool CanCloseFile(); - bool OpenFile(vint filterIndex); - bool SaveFile(bool saveAs); - void SetupTextConfig(); - void SetupXmlConfig(); + bool CanCloseFile(); + bool OpenFile(vint filterIndex); + bool SaveFile(bool saveAs); + void SetupTextConfig(); + void SetupXmlConfig(); public: MainWindow(); ~MainWindow(); diff --git a/Tutorial/GacUI_Controls/UIRes/TextEditor.bin b/Tutorial/GacUI_Controls/UIRes/TextEditor.bin index 127ae1e0..fcab67f6 100644 Binary files a/Tutorial/GacUI_Controls/UIRes/TextEditor.bin and b/Tutorial/GacUI_Controls/UIRes/TextEditor.bin differ