mirror of
https://github.com/vczh-libraries/Release.git
synced 2026-05-24 08:15:53 +08:00
Update GacUI_Controls\TextEditor demo
This commit is contained in:
@@ -83,7 +83,6 @@
|
||||
<ClCompile Include="Main.cpp" />
|
||||
<ClCompile Include="UI\Source\AboutWindow.cpp" />
|
||||
<ClCompile Include="UI\Source\DemoPartialClasses.cpp" />
|
||||
<ClCompile Include="UI\Source\FindWindow.cpp" />
|
||||
<ClCompile Include="UI\Source\MainWindow.cpp" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
@@ -102,7 +101,6 @@
|
||||
<ClInclude Include="UI\Source\AboutWindow.h" />
|
||||
<ClInclude Include="UI\Source\Demo.h" />
|
||||
<ClInclude Include="UI\Source\DemoPartialClasses.h" />
|
||||
<ClInclude Include="UI\Source\FindWindow.h" />
|
||||
<ClInclude Include="UI\Source\MainWindow.h" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
|
||||
@@ -33,9 +33,6 @@
|
||||
<ClCompile Include="UI\Source\AboutWindow.cpp">
|
||||
<Filter>UI</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="UI\Source\FindWindow.cpp">
|
||||
<Filter>UI</Filter>
|
||||
</ClCompile>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Xml Include="UI\Resource.xml">
|
||||
@@ -67,9 +64,6 @@
|
||||
<ClInclude Include="UI\Source\AboutWindow.h">
|
||||
<Filter>UI</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="UI\Source\FindWindow.h">
|
||||
<Filter>UI</Filter>
|
||||
</ClInclude>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Image Include="UI\Images\EditCopy.png">
|
||||
|
||||
@@ -1,6 +1,106 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Instance ref.CodeBehind="true" ref.Class="demo::FindWindow">
|
||||
<Window ref.Name="self" Text="Find" ClientSize="x:240 y:100" MinimizedBox="false" MaximizedBox="false">
|
||||
<att.BoundsComposition-set PreferredMinSize="x:240 y:100"/>
|
||||
</Window>
|
||||
</Instance>
|
||||
<Folder>
|
||||
<Script name="ViewModelResource">
|
||||
<Workflow-ViewModel>
|
||||
<![CDATA[
|
||||
module viewmodel;
|
||||
|
||||
namespace vm
|
||||
{
|
||||
interface IFindWindowViewModel
|
||||
{
|
||||
func FindNext(toFind : string, caseSensitive : bool, down : bool) : bool;
|
||||
}
|
||||
}
|
||||
]]>
|
||||
</Workflow-ViewModel>
|
||||
</Script>
|
||||
<Instance name="FindWindowResource">
|
||||
<Instance ref.CodeBehind="false" ref.Class="demo::FindWindow" xmlns:x="presentation::controls::GuiSelectableButton::*">
|
||||
<ref.Parameter Name="ViewModel" Class="vm::IFindWindowViewModel"/>
|
||||
<Window ref.Name="self" Text="Find" ClientSize="x:360 y:150" MinimizedBox="false" MaximizedBox="false">
|
||||
<att.BoundsComposition-set PreferredMinSize="x:360 y:150"/>
|
||||
<x:MutexGroupController ref.Name="groupDirection"/>
|
||||
|
||||
<MessageDialog ref.Name="dialogContentNotFound"
|
||||
Input="DisplayOK"
|
||||
Title-eval="self.Text"
|
||||
Text="Content not found."
|
||||
/>
|
||||
|
||||
<Table AlignmentToParent="left:0 top:0 right:0 bottom:0" CellPadding="5">
|
||||
<att.Rows>
|
||||
<CellOption>composeType:MinSize</CellOption>
|
||||
<CellOption>composeType:MinSize</CellOption>
|
||||
<CellOption>composeType:Percentage percentage:1.0</CellOption>
|
||||
<CellOption>composeType:MinSize</CellOption>
|
||||
</att.Rows>
|
||||
<att.Columns>
|
||||
<CellOption>composeType:MinSize</CellOption>
|
||||
<CellOption>composeType:Percentage percentage:1.0</CellOption>
|
||||
<CellOption>composeType:MinSize</CellOption>
|
||||
<CellOption>composeType:MinSize</CellOption>
|
||||
</att.Columns>
|
||||
|
||||
<Cell Site="row:0 column:0">
|
||||
<Label Text="To Find:">
|
||||
<att.BoundsComposition-set AlignmentToParent="left:5 top:5 right:5 bottom:5"/>
|
||||
</Label>
|
||||
</Cell>
|
||||
|
||||
<Cell Site="row:0 column:1 columnSpan:3">
|
||||
<SinglelineTextBox ref.Name="textFind">
|
||||
<att.BoundsComposition-set AlignmentToParent="left:0 top:0 right:0 bottom:0"/>
|
||||
</SinglelineTextBox>
|
||||
</Cell>
|
||||
|
||||
<Cell Site="row:1 column:0 columnSpan:4">
|
||||
<Stack Direction="Horizontal" AlignmentToParent="left:5 top:5 right:5 bottom:5" Padding="20" MinSizeLimitation="LimitToElementAndChildren">
|
||||
<StackItem>
|
||||
<CheckBox ref.Name="checkCase" Text="Case Sensitive"/>
|
||||
</StackItem>
|
||||
<StackItem>
|
||||
<GroupBox Text="Direction">
|
||||
<att.BoundsComposition-set AlignmentToParent="left:0 top:0 right:-1 bottom:0"/>
|
||||
<att.ContainerComposition-set MinSizeLimitation="LimitToElementAndChildren"/>
|
||||
|
||||
<Stack Direction="Horizontal" AlignmentToParent="left:5 top:5 right:5 bottom:5" Padding="20" MinSizeLimitation="LimitToElementAndChildren">
|
||||
<StackItem>
|
||||
<RadioButton ref.Name="radioUp" Text="Up" GroupController-ref="groupDirection"/>
|
||||
</StackItem>
|
||||
<StackItem>
|
||||
<RadioButton ref.Name="radioDown" Text="Down" GroupController-ref="groupDirection" Selected="true"/>
|
||||
</StackItem>
|
||||
</Stack>
|
||||
</GroupBox>
|
||||
</StackItem>
|
||||
</Stack>
|
||||
</Cell>
|
||||
|
||||
<Cell Site="row:3 column:2">
|
||||
<Button Text="Find Next">
|
||||
<att.BoundsComposition-set PreferredMinSize="x:100 y:30"/>
|
||||
<ev.Clicked-eval>
|
||||
<![CDATA[
|
||||
{
|
||||
if (not ViewModel.FindNext(textFind.Text, checkCase.Selected, radioDown.Selected))
|
||||
{
|
||||
dialogContentNotFound.ShowDialog();
|
||||
}
|
||||
}
|
||||
]]>
|
||||
</ev.Clicked-eval>
|
||||
</Button>
|
||||
</Cell>
|
||||
|
||||
<Cell Site="row:3 column:3">
|
||||
<Button Text="Close">
|
||||
<att.BoundsComposition-set PreferredMinSize="x:100 y:30"/>
|
||||
<ev.Clicked-eval>self.Close();</ev.Clicked-eval>
|
||||
</Button>
|
||||
</Cell>
|
||||
</Table>
|
||||
</Window>
|
||||
</Instance>
|
||||
</Instance>
|
||||
</Folder>
|
||||
@@ -14,6 +14,6 @@
|
||||
</Folder>
|
||||
<Folder name="Images" content="Link">Images\Folder.xml</Folder>
|
||||
<Folder name="AboutWindow" content="Link">AboutWindow.xml</Folder>
|
||||
<Instance name="FindWindowResource" content="File">FindWindow.xml</Instance>
|
||||
<Folder name="FindWindow" content="Link">FindWindow.xml</Folder>
|
||||
<Instance name="MainWindowResource" content="File">MainWindow.xml</Instance>
|
||||
</Resource>
|
||||
@@ -13,7 +13,6 @@ DO NOT MODIFY
|
||||
|
||||
#include "DemoPartialClasses.h"
|
||||
#include "AboutWindow.h"
|
||||
#include "FindWindow.h"
|
||||
#include "MainWindow.h"
|
||||
|
||||
#endif
|
||||
|
||||
@@ -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<vm::IFindWindowViewModel> 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<vm::IFindWindowViewModel>), { 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)
|
||||
|
||||
@@ -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<IFindWindowViewModel>
|
||||
{
|
||||
public:
|
||||
virtual bool FindNext(vl::WString toFind, bool caseSensitive, bool down) = 0;
|
||||
};
|
||||
|
||||
}
|
||||
namespace demo
|
||||
{
|
||||
template<typename TImpl>
|
||||
class AboutWindow_ : public vl::presentation::controls::GuiWindow, public vl::presentation::GuiInstancePartialClass<vl::presentation::controls::GuiWindow>, public vl::reflection::Description<TImpl>
|
||||
{
|
||||
@@ -54,26 +70,52 @@ namespace demo
|
||||
{
|
||||
friend struct vl::reflection::description::CustomTypeDescriptorSelector<TImpl>;
|
||||
private:
|
||||
Ptr<vm::IFindWindowViewModel> 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<vm::IFindWindowViewModel> 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<vl::presentation::controls::GuiWindow>(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<vm::IFindWindowViewModel> GetViewModel()
|
||||
{
|
||||
return ViewModel_;
|
||||
}
|
||||
};
|
||||
|
||||
template<typename TImpl>
|
||||
@@ -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_<demo::FindWindow>
|
||||
{
|
||||
friend class demo::FindWindow_<demo::FindWindow>;
|
||||
friend struct vl::reflection::description::CustomTypeDescriptorSelector<demo::FindWindow>;
|
||||
protected:
|
||||
|
||||
// #region CLASS_MEMBER_GUIEVENT_HANDLER (DO NOT PUT OTHER CONTENT IN THIS #region.)
|
||||
// #endregion CLASS_MEMBER_GUIEVENT_HANDLER
|
||||
public:
|
||||
FindWindow(Ptr<vm::IFindWindowViewModel> ViewModel);
|
||||
~FindWindow();
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
@@ -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();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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_<demo::FindWindow>
|
||||
{
|
||||
friend class demo::FindWindow_<demo::FindWindow>;
|
||||
friend struct vl::reflection::description::CustomTypeDescriptorSelector<demo::FindWindow>;
|
||||
protected:
|
||||
|
||||
// #region CLASS_MEMBER_GUIEVENT_HANDLER (DO NOT PUT OTHER CONTENT IN THIS #region.)
|
||||
// #endregion CLASS_MEMBER_GUIEVENT_HANDLER
|
||||
public:
|
||||
FindWindow();
|
||||
~FindWindow();
|
||||
};
|
||||
}
|
||||
|
||||
#endif
|
||||
@@ -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<FindWindow>(MakePtr<FindWindowViewModel>(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;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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> 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();
|
||||
|
||||
Binary file not shown.
Reference in New Issue
Block a user