1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586 |
- #pragma once
- #define MSGID_OK 1
- #define MSGID_CANCEL 0
- #include "duilib.h"
- class CMsgWnd : public WindowImplBase
- {
- public:
- static int MessageBox(HWND hParent, LPCTSTR lpstrTitle, LPCTSTR lpstrMsg, LPCTSTR lpstrConfirmBtn, LPCTSTR lpstrCancelBtn)
- {
- CMsgWnd* pWnd = new CMsgWnd();
- pWnd->Create(hParent, _T("msgwnd"), WS_POPUP | WS_CLIPCHILDREN, WS_EX_TOOLWINDOW);
- pWnd->CenterWindow();
- pWnd->SetTitle(lpstrTitle);
- pWnd->SetMsg(lpstrMsg);
- pWnd->SetConfirmBtn(lpstrConfirmBtn);
- pWnd->SetCancelBtn(lpstrCancelBtn);
- return pWnd->ShowModal();
- }
- static int MessageBox(HWND hParent, LPCTSTR lpstrTitle, LPCTSTR lpstrMsg, LPCTSTR lpstrConfirmBtn)
- {
- CMsgWnd* pWnd = new CMsgWnd();
- pWnd->Create(hParent, _T("msgwnd"), WS_POPUP | WS_CLIPCHILDREN, WS_EX_TOOLWINDOW);
- pWnd->CenterWindow();
- pWnd->SetTitle(lpstrTitle);
- pWnd->SetMsg(lpstrMsg);
- pWnd->SetConfirmBtn(L"",true);
- pWnd->SetCancelBtn(lpstrConfirmBtn);
- return pWnd->ShowModal();
- }
- static int MessageBox(HWND hParent, LPCTSTR lpstrTitle, LPCTSTR lpstrMsg, LPCTSTR lpstrConfirmBtn, UINT_PTR Tag)
- {
- CMsgWnd* pWnd = new CMsgWnd();
- pWnd->Create(hParent, _T("msgwnd"), WS_POPUP | WS_CLIPCHILDREN, WS_EX_TOOLWINDOW);
- pWnd->CenterWindow();
- pWnd->SetTitle(lpstrTitle);
- pWnd->SetMsg(lpstrMsg);
- pWnd->SetConfirmBtn(L"",true);
- pWnd->SetCancelBtn(lpstrConfirmBtn, Tag);
- return pWnd->ShowModal();
- }
- static void ShowMessageBox(HWND hParent, LPCTSTR lpstrTitle, LPCTSTR lpstrMsg, LPCTSTR lpstrConfirmBtn, LPCTSTR lpstrCancelBtn)
- {
- CMsgWnd* pWnd = new CMsgWnd();
- pWnd->Create(hParent, _T("msgwnd"), UI_WNDSTYLE_FRAME, 0);
- pWnd->CenterWindow();
- pWnd->SetTitle(lpstrTitle);
- pWnd->SetMsg(lpstrMsg);
- pWnd->SetConfirmBtn(lpstrConfirmBtn);
- pWnd->SetCancelBtn(lpstrCancelBtn);
- pWnd->ShowWindow(true);
- }
- public:
- CMsgWnd(void);
- ~CMsgWnd(void);
- void SetMsg(LPCTSTR lpstrMsg);
- void SetTitle(LPCTSTR lpstrTitle);
- void SetConfirmBtn(LPCTSTR lpstrConfirmBtn, bool isOnlyConfirmBtn = false);
- void SetCancelBtn(LPCTSTR lpstrCancelBtn);
- void SetCancelBtn(LPCTSTR lpstrCancelBtn, UINT_PTR Tag);
- public:
- virtual void OnFinalMessage(HWND);
- virtual CDuiString GetSkinFile();
- virtual LPCTSTR GetWindowClassName(void) const;
- virtual void Notify(TNotifyUI& msg);
- virtual void InitWindow();
- DUI_DECLARE_MESSAGE_MAP()
- virtual void OnClick(TNotifyUI& msg);
- virtual LRESULT OnSysCommand(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled);
- LRESULT HandleCustomMessage(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled);
- private:
- CButtonUI* m_pCloseBtn;
- CButtonUI* m_pMaxBtn;
- CButtonUI* m_pRestoreBtn;
- CButtonUI* m_pMinBtn;
- CButtonUI* m_pMenuBtn;
- };
|