Update GacUI_Controls\TextEditor demo

This commit is contained in:
vczh
2016-01-10 17:57:34 -08:00
parent a4dcdae669
commit b434764fbe
11 changed files with 219 additions and 8 deletions

View File

@@ -81,6 +81,7 @@
</ItemDefinitionGroup>
<ItemGroup>
<ClCompile Include="Main.cpp" />
<ClCompile Include="UI\Source\AboutWindow.cpp" />
<ClCompile Include="UI\Source\DemoPartialClasses.cpp" />
<ClCompile Include="UI\Source\MainWindow.cpp" />
</ItemGroup>
@@ -94,6 +95,7 @@
<Xml Include="UI\Resource.xml" />
</ItemGroup>
<ItemGroup>
<ClInclude Include="UI\Source\AboutWindow.h" />
<ClInclude Include="UI\Source\Demo.h" />
<ClInclude Include="UI\Source\DemoPartialClasses.h" />
<ClInclude Include="UI\Source\MainWindow.h" />

View File

@@ -30,6 +30,9 @@
<ClCompile Include="UI\Source\MainWindow.cpp">
<Filter>UI</Filter>
</ClCompile>
<ClCompile Include="UI\Source\AboutWindow.cpp">
<Filter>UI</Filter>
</ClCompile>
</ItemGroup>
<ItemGroup>
<Xml Include="UI\Resource.xml">
@@ -49,6 +52,9 @@
<ClInclude Include="UI\Source\MainWindow.h">
<Filter>UI</Filter>
</ClInclude>
<ClInclude Include="UI\Source\AboutWindow.h">
<Filter>UI</Filter>
</ClInclude>
</ItemGroup>
<ItemGroup>
<Image Include="UI\Images\EditCopy.png">

View File

@@ -13,6 +13,80 @@
</Folder>
</Folder>
<Folder name="Images" content="Link">Images\Folder.xml</Folder>
<Folder name="AboutWindow">
<Image content="File">..\..\..\GacUI_Layout\RichTextEmbedding\UI\Gaclib.png</Image>
<Doc name="Description">
<Doc>
<Content>
<p align="Center">
<div style="Title">
<b>TextEditor by GacUI</b>
</div>
</p>
<p>
<div style="Body">
<nop>Welcome to the demo!</nop>
</div>
</p>
<p>
<div style="Body">
<b>Author: </b>Zihan Chen (vczh)<br/>
<b>Website: </b><a href="http://www.gaclib.net">http://www.gaclib.net</a><br/>
<b>Github: </b><a href="https://github.com/vczh-libraries/Release">https://github.com/vczh-libraries/Release</a><br/>
</div>
</p>
</Content>
<Styles>
<Style name="Content">
<face>Segoe UI</face>
</Style>
<Style name="Title" parent="Content">
<size>24</size>
<b>true</b>
</Style>
<Style name="Body" parent="Content">
<size>14</size>
</Style>
</Styles>
</Doc>
</Doc>
<Instance name="AboutWindowResource">
<Instance ref.CodeBehind="true" ref.Class="demo::AboutWindow">
<Window ref.Name="self" Text="About TextEditor" ClientSize="x:480 y:320" MaximizedBox="false" MinimizedBox="false" SizeBox="false">
<Table AlignmentToParent="left:0 top:0 right:0 bottom:0" CellPadding="5">
<att.Rows>
<CellOption>composeType:MinSize</CellOption>
<CellOption>composeType:Percentage percentage:1.0</CellOption>
<CellOption>composeType:MinSize</CellOption>
</att.Rows>
<att.Columns>
<CellOption>composeType:Percentage percentage:1.0</CellOption>
<CellOption>composeType:MinSize</CellOption>
<CellOption>composeType:Percentage percentage:1.0</CellOption>
</att.Columns>
<Cell Site="row:0 column:1" PreferredMinSize="x:320 y:128">
<ImageFrameElement Stretch="true" Image-uri="res://AboutWindow/Gaclib.png"/>
</Cell>
<Cell Site="row:1 column:1">
<DocumentLabel ref.Name="documentLabel" Document-uri="res://AboutWindow/Description">
<att.BoundsComposition-set AlignmentToParent="left:0 top:0 right:0 bottom:0"/>
<ev.ActiveHyperlinkExecuted>documentLabel_ActiveHyperlinkExecuted</ev.ActiveHyperlinkExecuted>
</DocumentLabel>
</Cell>
<Cell Site="row:2 column:0 columnSpan:3">
<Button Text="Close" ev.Clicked-eval="self.Close();">
<att.BoundsComposition-set AlignmentToParent="left:-1 top:0 right:0 bottom:0" PreferredMinSize="x:100 y:30"/>
</Button>
</Cell>
</Table>
</Window>
</Instance>
</Instance>
</Folder>
<Folder name="MainWindow">
<Instance name="MainWindowResource">
<Instance ref.CodeBehind="true" ref.Class="demo::MainWindow">
@@ -74,39 +148,39 @@
<ToolstripCommand ref.Name="commandEditFind" Text="Find ..." Image-uri="res://Images/EditFind.png" ShortcutBuilder="Ctrl+F">
<ev.Executed>commandEditFind_Executed</ev.Executed>
</ToolstripCommand>
<ToolstripCommand ref.Name="commandAbout" Text="About TextEditor ...">
<ev.Executed>commandAbout_Executed</ev.Executed>
</ToolstripCommand>
<MessageDialog ref.Name="dialogQueryClose"
Input="DisplayYesNoCancel"
Icon="IconQuestion"
Title-eval="self.Text"
Text="Do you want to save this file?"
/>
<MessageDialog ref.Name="dialogCannotOpen"
Input="DisplayOK"
Icon="IconError"
Title-eval="self.Text"
Text="Cannot open the selected file."
/>
<MessageDialog ref.Name="dialogCannotSave"
Input="DisplayOK"
Icon="IconError"
Title-eval="self.Text"
Text="Cannot save the selected file."
/>
<OpenFileDialog ref.Name="dialogOpen"
Filter="Text Files (*.txt)|*.txt|XML Files (*.xml)|*.xml|All Files (*.*)|*.*"
Title-eval="self.Text"
DefaultExtension="txt"
Options="FileDialogFileMustExist|FileDialogDereferenceLinks"
/>
<SaveFileDialog ref.Name="dialogSave"
Filter="Text Files (*.txt)|*.txt|XML Files (*.xml)|*.xml|All Files (*.*)|*.*"
Title-eval="self.Text"

View File

@@ -0,0 +1,32 @@
/***********************************************************************
Vczh Library++ 3.0
Developer: Zihan Chen(vczh)
GacUI::AboutWindow
This file is generated by: Vczh GacUI Resource Code Generator
***********************************************************************/
#include "Demo.h"
#include <Windows.h>
namespace demo
{
// #region CLASS_MEMBER_GUIEVENT_HANDLER (DO NOT PUT OTHER CONTENT IN THIS #region.)
void AboutWindow::documentLabel_ActiveHyperlinkExecuted(GuiGraphicsComposition* sender, vl::presentation::compositions::GuiEventArgs& arguments)
{
ShellExecute(NULL, L"OPEN", documentLabel->GetActiveHyperlinkReference().Buffer(), NULL, NULL, SW_MAXIMIZE);
}
// #endregion CLASS_MEMBER_GUIEVENT_HANDLER
AboutWindow::AboutWindow()
{
InitializeComponents();
}
AboutWindow::~AboutWindow()
{
ClearSubscriptions();
}
}

View File

@@ -0,0 +1,31 @@
/***********************************************************************
Vczh Library++ 3.0
Developer: Zihan Chen(vczh)
GacUI::AboutWindow
This file is generated by: Vczh GacUI Resource Code Generator
***********************************************************************/
#ifndef VCZH_GACUI_RESOURCE_CODE_GENERATOR_Demo_AboutWindow
#define VCZH_GACUI_RESOURCE_CODE_GENERATOR_Demo_AboutWindow
#include "DemoPartialClasses.h"
namespace demo
{
class AboutWindow : public demo::AboutWindow_<demo::AboutWindow>
{
friend class demo::AboutWindow_<demo::AboutWindow>;
friend struct vl::reflection::description::CustomTypeDescriptorSelector<demo::AboutWindow>;
protected:
// #region CLASS_MEMBER_GUIEVENT_HANDLER (DO NOT PUT OTHER CONTENT IN THIS #region.)
void documentLabel_ActiveHyperlinkExecuted(GuiGraphicsComposition* sender, vl::presentation::compositions::GuiEventArgs& arguments);
// #endregion CLASS_MEMBER_GUIEVENT_HANDLER
public:
AboutWindow();
~AboutWindow();
};
}
#endif

View File

@@ -12,6 +12,7 @@ DO NOT MODIFY
#define VCZH_GACUI_RESOURCE_CODE_GENERATOR_Demo
#include "DemoPartialClasses.h"
#include "AboutWindow.h"
#include "MainWindow.h"
#endif

View File

@@ -17,8 +17,16 @@ namespace vl
namespace description
{
#define _ ,
IMPL_CPP_TYPE_INFO(demo::AboutWindow)
IMPL_CPP_TYPE_INFO(demo::MainWindow)
BEGIN_CLASS_MEMBER(demo::AboutWindow)
CLASS_MEMBER_BASE(vl::presentation::controls::GuiWindow)
CLASS_MEMBER_CONSTRUCTOR(demo::AboutWindow*(), NO_PARAMETER)
CLASS_MEMBER_GUIEVENT_HANDLER(documentLabel_ActiveHyperlinkExecuted, vl::presentation::compositions::GuiEventArgs)
END_CLASS_MEMBER(demo::AboutWindow)
BEGIN_CLASS_MEMBER(demo::MainWindow)
CLASS_MEMBER_BASE(vl::presentation::controls::GuiWindow)
CLASS_MEMBER_CONSTRUCTOR(demo::MainWindow*(), NO_PARAMETER)
@@ -50,6 +58,7 @@ namespace vl
public:
void Load(ITypeManager* manager)
{
ADD_TYPE_INFO(demo::AboutWindow)
ADD_TYPE_INFO(demo::MainWindow)
}

View File

@@ -15,8 +15,39 @@ DO NOT MODIFY
namespace demo
{
class AboutWindow;
class MainWindow;
template<typename TImpl>
class AboutWindow_ : 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:
protected:
vl::presentation::controls::GuiDocumentLabel* documentLabel;
vl::presentation::controls::GuiWindow* self;
void InitializeComponents()
{
if (InitializeFromResource())
{
GUI_INSTANCE_REFERENCE(documentLabel);
GUI_INSTANCE_REFERENCE(self);
}
else
{
}
}
public:
AboutWindow_()
:vl::presentation::GuiInstancePartialClass<vl::presentation::controls::GuiWindow>(L"demo::AboutWindow")
,vl::presentation::controls::GuiWindow(vl::presentation::theme::GetCurrentTheme()->CreateWindowStyle())
,documentLabel(0)
,self(0)
{
}
};
template<typename TImpl>
class MainWindow_ : public vl::presentation::controls::GuiWindow, public vl::presentation::GuiInstancePartialClass<vl::presentation::controls::GuiWindow>, public vl::reflection::Description<TImpl>
{
@@ -120,6 +151,7 @@ namespace vl
{
namespace description
{
DECL_TYPE_INFO(demo::AboutWindow)
DECL_TYPE_INFO(demo::MainWindow)
}

View File

@@ -88,6 +88,9 @@ namespace demo
void MainWindow::commandAbout_Executed(GuiGraphicsComposition* sender, vl::presentation::compositions::GuiEventArgs& arguments)
{
auto window = new AboutWindow;
window->MoveToScreenCenter();
window->ShowModalAndDelete(this, [](){});
}
void MainWindow::commandEditCopy_Executed(GuiGraphicsComposition* sender, vl::presentation::compositions::GuiEventArgs& arguments)