Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include "init_splash_ui.h"
- ECLInitSplashUI::ECLInitSplashUI()
- {
- m_InitLoadWindow = NULL;
- }
- ECLInitSplashUI::~ECLInitSplashUI()
- {
- m_InitLoadWindow = NULL;
- }
- void ECLInitSplashUI::SetEvent(CSDKDemoAppEvent* pAppEvent)
- {
- m_pAppEvent = pAppEvent;
- }
- void ECLInitSplashUI::InitWindow()
- {
- m_InitLoadWindow = static_cast<CControlUI*>(m_PaintManager.FindControl(_T("window")));
- RECT rc = { 0 };
- if (!::GetClientRect(m_hWnd, &rc)) return;
- rc.right = rc.left + 1380;
- rc.bottom = rc.top + 750;
- if (!::AdjustWindowRectEx(&rc, GetWindowStyle(m_hWnd), (!(GetWindowStyle(m_hWnd) & WS_CHILD) && (::GetMenu(m_hWnd) != NULL)), GetWindowExStyle(m_hWnd))) return;
- int ScreenX = GetSystemMetrics(SM_CXSCREEN);
- int ScreenY = GetSystemMetrics(SM_CYSCREEN);
- ::SetWindowPos(m_hWnd, NULL, (ScreenX - (rc.right - rc.left)) / 2,
- (ScreenY - (rc.bottom - rc.top)) / 2, rc.right - rc.left, rc.bottom - rc.top, SWP_NOZORDER | SWP_SHOWWINDOW);
- m_InitLoadWindow->SetVisible(true);
- }
- void ECLInitSplashUI::Notify(TNotifyUI& msg)
- {
- }
- LRESULT ECLInitSplashUI::HandleMessage(UINT uMsg, WPARAM wParam, LPARAM lParam)
- {
- LRESULT lRes = 0;
- BOOL bHandled = TRUE;
- if (uMsg == WM_CREATE)
- {
- m_PaintManager.Init(m_hWnd);
- CDialogBuilder builder;
- STRINGorID xml(GetSkinRes());
- CControlUI* pRoot = builder.Create(xml, _T("xml"), 0, &m_PaintManager);
- ASSERT(pRoot && "Failed to parse XML");
- m_PaintManager.AttachDialog(pRoot);
- m_PaintManager.AddNotifier(this);
- InitWindow();
- return lRes;
- }
- else if (uMsg == WM_CLOSE)
- {
- OnClose(uMsg, wParam, lParam, bHandled);
- }
- else if (uMsg == WM_DESTROY)
- {
- OnDestroy(uMsg, wParam, lParam, bHandled);
- }
- if (m_PaintManager.MessageHandler(uMsg, wParam, lParam, lRes))
- {
- return lRes;
- }
- return __super::HandleMessage(uMsg, wParam, lParam);
- }
- LRESULT ECLInitSplashUI::OnClose(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& /*bHandled*/)
- {
- if (m_pAppEvent)
- {
- m_pAppEvent->onQuitApp();
- }
- return 0;
- }
- LRESULT ECLInitSplashUI::OnDestroy(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& /*bHandled*/)
- {
- // TODO Cleanup SDK
- return 0;
- }
- void ECLInitSplashUI::ShowErrorMessage(const wchar_t* error_message)
- {
- if (error_message)
- ::MessageBox(NULL, error_message, L"error", MB_OK);
- }
- CSDKDemoAppEvent* ECLInitSplashUI::GetAppEvent()
- {
- return m_pAppEvent;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement