86 lines
2.1 KiB
C++
86 lines
2.1 KiB
C++
![]() |
#include "base_form.h"
|
|||
|
#include "new_monitor_form.h"
|
|||
|
|
|||
|
const std::wstring BasicForm::kClassName = L"Basic";
|
|||
|
#define WM_USER_POS_CHANGED (WM_USER + 2)
|
|||
|
|
|||
|
BasicForm::BasicForm()
|
|||
|
{
|
|||
|
}
|
|||
|
|
|||
|
BasicForm::~BasicForm()
|
|||
|
{
|
|||
|
}
|
|||
|
|
|||
|
std::wstring BasicForm::GetSkinFolder()
|
|||
|
{
|
|||
|
return L"basic";
|
|||
|
}
|
|||
|
|
|||
|
std::wstring BasicForm::GetSkinFile()
|
|||
|
{
|
|||
|
return L"basic.xml";
|
|||
|
}
|
|||
|
|
|||
|
std::wstring BasicForm::GetWindowClassName() const
|
|||
|
{
|
|||
|
return kClassName;
|
|||
|
}
|
|||
|
|
|||
|
|
|||
|
LRESULT BasicForm::HandleMessage(UINT uMsg, WPARAM wParam, LPARAM lParam)
|
|||
|
{
|
|||
|
if (uMsg == WM_USER_POS_CHANGED) {
|
|||
|
NewMonitorForm* window = new NewMonitorForm();
|
|||
|
window->Create(NULL, NewMonitorForm::kClassName.c_str(), WS_OVERLAPPEDWINDOW & ~WS_MAXIMIZEBOX & WS_SIZEBOX, 0);
|
|||
|
window->CenterWindow();
|
|||
|
window->ShowModalFake(this->m_hWnd);
|
|||
|
nim_comp::Toast::ShowToast(L"<EFBFBD>Զ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϣ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>", 1000, this->GetHWND());
|
|||
|
}
|
|||
|
return WindowImplBase::HandleMessage(uMsg, wParam, lParam);
|
|||
|
}
|
|||
|
|
|||
|
void BasicForm::InitWindow()
|
|||
|
{
|
|||
|
/* Show settings menu */
|
|||
|
ui::Button* settings = dynamic_cast<ui::Button*>(FindControl(L"test_customize"));
|
|||
|
if (nullptr != settings) {
|
|||
|
settings->AttachClick([this](ui::EventArgs* args) {
|
|||
|
printf("%d\r\n", ::PostMessage(this->GetHWND(), WM_USER_POS_CHANGED, 0, 0));
|
|||
|
return true;
|
|||
|
});
|
|||
|
}
|
|||
|
ui::TreeView* tree = dynamic_cast<ui::TreeView*>(FindControl(L"tree"));
|
|||
|
if (nullptr != tree) {
|
|||
|
ui::TreeNode* parent_node = nullptr;
|
|||
|
for (auto j = 0; j < 8; j++)
|
|||
|
{
|
|||
|
ui::TreeNode* node = new ui::TreeNode;
|
|||
|
node->SetClass(L"listitem");
|
|||
|
node->SetFixedHeight(20);
|
|||
|
if (parent_node)
|
|||
|
{
|
|||
|
node->SetText(nbase::StringPrintf(L"Child node %d", j));
|
|||
|
node->SetMargin({ 10, 0, 0, 0 });
|
|||
|
parent_node->AddChildNode(node);
|
|||
|
}
|
|||
|
else
|
|||
|
{
|
|||
|
node->SetText(nbase::StringPrintf(L"Parent node", j));
|
|||
|
tree->GetRootNode()->AddChildNode(node);
|
|||
|
parent_node = node;
|
|||
|
parent_node->AttachClick([this](ui::EventArgs* args) {
|
|||
|
printf("%d\r\n", ::PostMessage(this->GetHWND(), WM_USER_POS_CHANGED, 0, 0));
|
|||
|
return true;
|
|||
|
});
|
|||
|
}
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
}
|
|||
|
|
|||
|
LRESULT BasicForm::OnClose(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled)
|
|||
|
{
|
|||
|
PostQuitMessage(0L);
|
|||
|
return __super::OnClose(uMsg, wParam, lParam, bHandled);
|
|||
|
}
|