This commit is contained in:
Zihan Chen
2016-12-13 04:39:59 -08:00
parent c09f06dc77
commit ec3e57a338
16 changed files with 172 additions and 266 deletions
@@ -1,3 +1,4 @@
#define GAC_HEADER_USE_NAMESPACE
#include "UI/Source/Demo.h"
#include <Windows.h>
@@ -13,8 +13,9 @@ 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)
void AboutWindow::documentLabel_ActiveHyperlinkExecuted(::vl::presentation::compositions::GuiGraphicsComposition* sender, ::vl::presentation::compositions::GuiEventArgs& arguments)
{
ShellExecute(NULL, L"OPEN", documentLabel->GetActiveHyperlinkReference().Buffer(), NULL, NULL, SW_MAXIMIZE);
}
void AboutWindow::OnCreate()
@@ -25,11 +26,6 @@ namespace demo
{
}
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()
@@ -20,7 +20,7 @@ namespace demo
protected:
// #region CLASS_MEMBER_GUIEVENT_HANDLER (DO NOT PUT OTHER CONTENT IN THIS #region.)
void documentLabel_ActiveHyperlinkExecuted(GuiGraphicsComposition* sender, ::vl::presentation::compositions::GuiEventArgs& arguments);
void documentLabel_ActiveHyperlinkExecuted(::vl::presentation::compositions::GuiGraphicsComposition* sender, ::vl::presentation::compositions::GuiEventArgs& arguments);
void OnCreate();
void OnDestroy();
// #endregion CLASS_MEMBER_GUIEVENT_HANDLER
@@ -24,7 +24,7 @@ namespace demo
// #endregion CLASS_MEMBER_GUIEVENT_HANDLER
FindWindow::FindWindow(Ptr<vm::IFindWindowViewModel> ViewModel)
FindWindow::FindWindow(vl::Ptr<vm::IFindWindowViewModel> ViewModel)
{
InitializeComponents(ViewModel);
OnCreate();
@@ -64,7 +64,7 @@ namespace vl
BEGIN_CLASS_MEMBER(demo::FindWindow)
CLASS_MEMBER_BASE(::vl::presentation::controls::GuiWindow)
CLASS_MEMBER_CONSTRUCTOR(demo::FindWindow*(Ptr<vm::IFindWindowViewModel>), { L"ViewModel" })
CLASS_MEMBER_CONSTRUCTOR(demo::FindWindow*(vl::Ptr<vm::IFindWindowViewModel>), { L"ViewModel" })
CLASS_MEMBER_PROPERTY_READONLY_FAST(ViewModel)
END_CLASS_MEMBER(demo::FindWindow)
@@ -70,7 +70,7 @@ namespace demo
{
friend struct vl::reflection::description::CustomTypeDescriptorSelector<TImpl>;
private:
Ptr<vm::IFindWindowViewModel> ViewModel_;
vl::Ptr<vm::IFindWindowViewModel> ViewModel_;
protected:
::vl::presentation::controls::GuiSelectableButton* checkCase;
::vl::presentation::controls::GuiMessageDialog* dialogContentNotFound;
@@ -80,7 +80,7 @@ namespace demo
::vl::presentation::controls::GuiWindow* self;
::vl::presentation::controls::GuiSinglelineTextBox* textFind;
void InitializeComponents(Ptr<vm::IFindWindowViewModel> ViewModel)
void InitializeComponents(vl::Ptr<vm::IFindWindowViewModel> ViewModel)
{
ViewModel_ = ViewModel;
if (InitializeFromResource())
@@ -112,7 +112,7 @@ namespace demo
{
}
Ptr<vm::IFindWindowViewModel> GetViewModel()
vl::Ptr<vm::IFindWindowViewModel> GetViewModel()
{
return ViewModel_;
}
@@ -242,7 +242,7 @@ namespace demo
void OnDestroy();
// #endregion CLASS_MEMBER_GUIEVENT_HANDLER
public:
FindWindow(Ptr<vm::IFindWindowViewModel> ViewModel);
FindWindow(vl::Ptr<vm::IFindWindowViewModel> ViewModel);
~FindWindow();
};
}
@@ -6,6 +6,7 @@ GacUI::MainWindow
This file is generated by: Vczh GacUI Resource Code Generator
***********************************************************************/
#define GAC_HEADER_USE_NAMESPACE
#include "Demo.h"
using namespace vl::stream;
@@ -86,76 +87,106 @@ namespace demo
{
// #region CLASS_MEMBER_GUIEVENT_HANDLER (DO NOT PUT OTHER CONTENT IN THIS #region.)
void MainWindow::commandAbout_Executed(GuiGraphicsComposition* sender, ::vl::presentation::compositions::GuiEventArgs& arguments)
void MainWindow::commandAbout_Executed(::vl::presentation::compositions::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)
void MainWindow::commandEditCopy_Executed(::vl::presentation::compositions::GuiGraphicsComposition* sender, vl::presentation::compositions::GuiEventArgs& arguments)
{
textBox->Copy();
}
void MainWindow::commandEditCut_Executed(GuiGraphicsComposition* sender, ::vl::presentation::compositions::GuiEventArgs& arguments)
void MainWindow::commandEditCut_Executed(::vl::presentation::compositions::GuiGraphicsComposition* sender, vl::presentation::compositions::GuiEventArgs& arguments)
{
textBox->Cut();
}
void MainWindow::commandEditDelete_Executed(GuiGraphicsComposition* sender, ::vl::presentation::compositions::GuiEventArgs& arguments)
void MainWindow::commandEditDelete_Executed(::vl::presentation::compositions::GuiGraphicsComposition* sender, vl::presentation::compositions::GuiEventArgs& arguments)
{
textBox->SetSelectionText(L"");
}
void MainWindow::commandEditFind_Executed(GuiGraphicsComposition* sender, ::vl::presentation::compositions::GuiEventArgs& arguments)
void MainWindow::commandEditFind_Executed(::vl::presentation::compositions::GuiGraphicsComposition* sender, vl::presentation::compositions::GuiEventArgs& arguments)
{
findWindow->Show();
}
void MainWindow::commandEditPaste_Executed(GuiGraphicsComposition* sender, ::vl::presentation::compositions::GuiEventArgs& arguments)
void MainWindow::commandEditPaste_Executed(::vl::presentation::compositions::GuiGraphicsComposition* sender, vl::presentation::compositions::GuiEventArgs& arguments)
{
textBox->Paste();
}
void MainWindow::commandEditRedo_Executed(GuiGraphicsComposition* sender, ::vl::presentation::compositions::GuiEventArgs& arguments)
void MainWindow::commandEditRedo_Executed(::vl::presentation::compositions::GuiGraphicsComposition* sender, vl::presentation::compositions::GuiEventArgs& arguments)
{
textBox->Redo();
}
void MainWindow::commandEditSelect_Executed(GuiGraphicsComposition* sender, ::vl::presentation::compositions::GuiEventArgs& arguments)
void MainWindow::commandEditSelect_Executed(::vl::presentation::compositions::GuiGraphicsComposition* sender, vl::presentation::compositions::GuiEventArgs& arguments)
{
textBox->SelectAll();
}
void MainWindow::commandEditUndo_Executed(GuiGraphicsComposition* sender, ::vl::presentation::compositions::GuiEventArgs& arguments)
void MainWindow::commandEditUndo_Executed(::vl::presentation::compositions::GuiGraphicsComposition* sender, vl::presentation::compositions::GuiEventArgs& arguments)
{
textBox->Undo();
}
void MainWindow::commandFileExit_Executed(GuiGraphicsComposition* sender, ::vl::presentation::compositions::GuiEventArgs& arguments)
void MainWindow::commandFileExit_Executed(::vl::presentation::compositions::GuiGraphicsComposition* sender, vl::presentation::compositions::GuiEventArgs& arguments)
{
Close();
}
void MainWindow::commandFileNewText_Executed(GuiGraphicsComposition* sender, ::vl::presentation::compositions::GuiEventArgs& arguments)
void MainWindow::commandFileNewText_Executed(::vl::presentation::compositions::GuiGraphicsComposition* sender, vl::presentation::compositions::GuiEventArgs& arguments)
{
if (CanCloseFile())
{
textBox->SetText(L"");
textBox->ClearUndoRedo();
SetupTextConfig();
}
}
void MainWindow::commandFileNewXml_Executed(GuiGraphicsComposition* sender, ::vl::presentation::compositions::GuiEventArgs& arguments)
void MainWindow::commandFileNewXml_Executed(::vl::presentation::compositions::GuiGraphicsComposition* sender, vl::presentation::compositions::GuiEventArgs& arguments)
{
if (CanCloseFile())
{
textBox->SetText(L"");
textBox->ClearUndoRedo();
SetupXmlConfig();
}
}
void MainWindow::commandFileOpenText_Executed(GuiGraphicsComposition* sender, ::vl::presentation::compositions::GuiEventArgs& arguments)
void MainWindow::commandFileOpenText_Executed(::vl::presentation::compositions::GuiGraphicsComposition* sender, vl::presentation::compositions::GuiEventArgs& arguments)
{
OpenFile(0);
}
void MainWindow::commandFileOpenXml_Executed(GuiGraphicsComposition* sender, ::vl::presentation::compositions::GuiEventArgs& arguments)
void MainWindow::commandFileOpenXml_Executed(::vl::presentation::compositions::GuiGraphicsComposition* sender, vl::presentation::compositions::GuiEventArgs& arguments)
{
OpenFile(1);
}
void MainWindow::commandFileOpen_Executed(GuiGraphicsComposition* sender, ::vl::presentation::compositions::GuiEventArgs& arguments)
void MainWindow::commandFileOpen_Executed(::vl::presentation::compositions::GuiGraphicsComposition* sender, vl::presentation::compositions::GuiEventArgs& arguments)
{
OpenFile(dialogOpen->GetFilterIndex());
}
void MainWindow::commandFileSaveAs_Executed(GuiGraphicsComposition* sender, ::vl::presentation::compositions::GuiEventArgs& arguments)
void MainWindow::commandFileSaveAs_Executed(::vl::presentation::compositions::GuiGraphicsComposition* sender, vl::presentation::compositions::GuiEventArgs& arguments)
{
SaveFile(true);
}
void MainWindow::commandFileSave_Executed(GuiGraphicsComposition* sender, ::vl::presentation::compositions::GuiEventArgs& arguments)
void MainWindow::commandFileSave_Executed(::vl::presentation::compositions::GuiGraphicsComposition* sender, vl::presentation::compositions::GuiEventArgs& arguments)
{
SaveFile(false);
}
void MainWindow::window_Closing(GuiGraphicsComposition* sender, ::vl::presentation::compositions::GuiRequestEventArgs& arguments)
void MainWindow::window_Closing(::vl::presentation::compositions::GuiGraphicsComposition* sender, vl::presentation::compositions::GuiRequestEventArgs& arguments)
{
arguments.cancel = !CanCloseFile();
}
void MainWindow::OnCreate()
@@ -169,108 +200,6 @@ 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)
{
textBox->Copy();
}
void MainWindow::commandEditCut_Executed(GuiGraphicsComposition* sender, vl::presentation::compositions::GuiEventArgs& arguments)
{
textBox->Cut();
}
void MainWindow::commandEditDelete_Executed(GuiGraphicsComposition* sender, vl::presentation::compositions::GuiEventArgs& arguments)
{
textBox->SetSelectionText(L"");
}
void MainWindow::commandEditFind_Executed(GuiGraphicsComposition* sender, vl::presentation::compositions::GuiEventArgs& arguments)
{
findWindow->Show();
}
void MainWindow::commandEditPaste_Executed(GuiGraphicsComposition* sender, vl::presentation::compositions::GuiEventArgs& arguments)
{
textBox->Paste();
}
void MainWindow::commandEditRedo_Executed(GuiGraphicsComposition* sender, vl::presentation::compositions::GuiEventArgs& arguments)
{
textBox->Redo();
}
void MainWindow::commandEditSelect_Executed(GuiGraphicsComposition* sender, vl::presentation::compositions::GuiEventArgs& arguments)
{
textBox->SelectAll();
}
void MainWindow::commandEditUndo_Executed(GuiGraphicsComposition* sender, vl::presentation::compositions::GuiEventArgs& arguments)
{
textBox->Undo();
}
void MainWindow::commandFileExit_Executed(GuiGraphicsComposition* sender, vl::presentation::compositions::GuiEventArgs& arguments)
{
Close();
}
void MainWindow::commandFileNewText_Executed(GuiGraphicsComposition* sender, vl::presentation::compositions::GuiEventArgs& arguments)
{
if (CanCloseFile())
{
textBox->SetText(L"");
textBox->ClearUndoRedo();
SetupTextConfig();
}
}
void MainWindow::commandFileNewXml_Executed(GuiGraphicsComposition* sender, vl::presentation::compositions::GuiEventArgs& arguments)
{
if (CanCloseFile())
{
textBox->SetText(L"");
textBox->ClearUndoRedo();
SetupXmlConfig();
}
}
void MainWindow::commandFileOpenText_Executed(GuiGraphicsComposition* sender, vl::presentation::compositions::GuiEventArgs& arguments)
{
OpenFile(0);
}
void MainWindow::commandFileOpenXml_Executed(GuiGraphicsComposition* sender, vl::presentation::compositions::GuiEventArgs& arguments)
{
OpenFile(1);
}
void MainWindow::commandFileOpen_Executed(GuiGraphicsComposition* sender, vl::presentation::compositions::GuiEventArgs& arguments)
{
OpenFile(dialogOpen->GetFilterIndex());
}
void MainWindow::commandFileSaveAs_Executed(GuiGraphicsComposition* sender, vl::presentation::compositions::GuiEventArgs& arguments)
{
SaveFile(true);
}
void MainWindow::commandFileSave_Executed(GuiGraphicsComposition* sender, vl::presentation::compositions::GuiEventArgs& arguments)
{
SaveFile(false);
}
void MainWindow::window_Closing(GuiGraphicsComposition* sender, vl::presentation::compositions::GuiRequestEventArgs& arguments)
{
arguments.cancel = !CanCloseFile();
}
// #endregion CLASS_MEMBER_GUIEVENT_HANDLER
bool MainWindow::CanCloseFile()
@@ -20,24 +20,24 @@ namespace demo
protected:
// #region CLASS_MEMBER_GUIEVENT_HANDLER (DO NOT PUT OTHER CONTENT IN THIS #region.)
void commandAbout_Executed(GuiGraphicsComposition* sender, ::vl::presentation::compositions::GuiEventArgs& arguments);
void commandEditCopy_Executed(GuiGraphicsComposition* sender, ::vl::presentation::compositions::GuiEventArgs& arguments);
void commandEditCut_Executed(GuiGraphicsComposition* sender, ::vl::presentation::compositions::GuiEventArgs& arguments);
void commandEditDelete_Executed(GuiGraphicsComposition* sender, ::vl::presentation::compositions::GuiEventArgs& arguments);
void commandEditFind_Executed(GuiGraphicsComposition* sender, ::vl::presentation::compositions::GuiEventArgs& arguments);
void commandEditPaste_Executed(GuiGraphicsComposition* sender, ::vl::presentation::compositions::GuiEventArgs& arguments);
void commandEditRedo_Executed(GuiGraphicsComposition* sender, ::vl::presentation::compositions::GuiEventArgs& arguments);
void commandEditSelect_Executed(GuiGraphicsComposition* sender, ::vl::presentation::compositions::GuiEventArgs& arguments);
void commandEditUndo_Executed(GuiGraphicsComposition* sender, ::vl::presentation::compositions::GuiEventArgs& arguments);
void commandFileExit_Executed(GuiGraphicsComposition* sender, ::vl::presentation::compositions::GuiEventArgs& arguments);
void commandFileNewText_Executed(GuiGraphicsComposition* sender, ::vl::presentation::compositions::GuiEventArgs& arguments);
void commandFileNewXml_Executed(GuiGraphicsComposition* sender, ::vl::presentation::compositions::GuiEventArgs& arguments);
void commandFileOpenText_Executed(GuiGraphicsComposition* sender, ::vl::presentation::compositions::GuiEventArgs& arguments);
void commandFileOpenXml_Executed(GuiGraphicsComposition* sender, ::vl::presentation::compositions::GuiEventArgs& arguments);
void commandFileOpen_Executed(GuiGraphicsComposition* sender, ::vl::presentation::compositions::GuiEventArgs& arguments);
void commandFileSaveAs_Executed(GuiGraphicsComposition* sender, ::vl::presentation::compositions::GuiEventArgs& arguments);
void commandFileSave_Executed(GuiGraphicsComposition* sender, ::vl::presentation::compositions::GuiEventArgs& arguments);
void window_Closing(GuiGraphicsComposition* sender, ::vl::presentation::compositions::GuiRequestEventArgs& arguments);
void commandAbout_Executed(::vl::presentation::compositions::GuiGraphicsComposition* sender, ::vl::presentation::compositions::GuiEventArgs& arguments);
void commandEditCopy_Executed(::vl::presentation::compositions::GuiGraphicsComposition* sender, ::vl::presentation::compositions::GuiEventArgs& arguments);
void commandEditCut_Executed(::vl::presentation::compositions::GuiGraphicsComposition* sender, ::vl::presentation::compositions::GuiEventArgs& arguments);
void commandEditDelete_Executed(::vl::presentation::compositions::GuiGraphicsComposition* sender, ::vl::presentation::compositions::GuiEventArgs& arguments);
void commandEditFind_Executed(::vl::presentation::compositions::GuiGraphicsComposition* sender, ::vl::presentation::compositions::GuiEventArgs& arguments);
void commandEditPaste_Executed(::vl::presentation::compositions::GuiGraphicsComposition* sender, ::vl::presentation::compositions::GuiEventArgs& arguments);
void commandEditRedo_Executed(::vl::presentation::compositions::GuiGraphicsComposition* sender, ::vl::presentation::compositions::GuiEventArgs& arguments);
void commandEditSelect_Executed(::vl::presentation::compositions::GuiGraphicsComposition* sender, ::vl::presentation::compositions::GuiEventArgs& arguments);
void commandEditUndo_Executed(::vl::presentation::compositions::GuiGraphicsComposition* sender, ::vl::presentation::compositions::GuiEventArgs& arguments);
void commandFileExit_Executed(::vl::presentation::compositions::GuiGraphicsComposition* sender, ::vl::presentation::compositions::GuiEventArgs& arguments);
void commandFileNewText_Executed(::vl::presentation::compositions::GuiGraphicsComposition* sender, ::vl::presentation::compositions::GuiEventArgs& arguments);
void commandFileNewXml_Executed(::vl::presentation::compositions::GuiGraphicsComposition* sender, ::vl::presentation::compositions::GuiEventArgs& arguments);
void commandFileOpenText_Executed(::vl::presentation::compositions::GuiGraphicsComposition* sender, ::vl::presentation::compositions::GuiEventArgs& arguments);
void commandFileOpenXml_Executed(::vl::presentation::compositions::GuiGraphicsComposition* sender, ::vl::presentation::compositions::GuiEventArgs& arguments);
void commandFileOpen_Executed(::vl::presentation::compositions::GuiGraphicsComposition* sender, ::vl::presentation::compositions::GuiEventArgs& arguments);
void commandFileSaveAs_Executed(::vl::presentation::compositions::GuiGraphicsComposition* sender, ::vl::presentation::compositions::GuiEventArgs& arguments);
void commandFileSave_Executed(::vl::presentation::compositions::GuiGraphicsComposition* sender, ::vl::presentation::compositions::GuiEventArgs& arguments);
void window_Closing(::vl::presentation::compositions::GuiGraphicsComposition* sender, ::vl::presentation::compositions::GuiRequestEventArgs& arguments);
void OnCreate();
void OnDestroy();
// #endregion CLASS_MEMBER_GUIEVENT_HANDLER
@@ -46,21 +46,21 @@ namespace demo
class FindWindowViewModel : public Object, public virtual vm::IFindWindowViewModel
{
private:
GuiMultilineTextBox* textBox;
vl::presentation::controls::GuiMultilineTextBox* textBox;
public:
FindWindowViewModel(GuiMultilineTextBox* _textBox);
FindWindowViewModel(vl::presentation::controls::GuiMultilineTextBox* _textBox);
bool FindNext(vl::WString toFind, bool caseSensitive, bool down)override;
};
private:
WString fileName;
vl::WString fileName;
bool isXml = false;
Ptr<FindWindow> findWindow;
vl::Ptr<FindWindow> findWindow;
bool CanCloseFile();
bool OpenFile(vint filterIndex);
bool OpenFile(vl::vint filterIndex);
bool SaveFile(bool saveAs);
void SetupTextConfig();
void SetupXmlConfig();