OLD | NEW |
| (Empty) |
1 // Copyright 2011 Google Inc. | |
2 // | |
3 // Licensed under the Apache License, Version 2.0 (the "License"); | |
4 // you may not use this file except in compliance with the License. | |
5 // You may obtain a copy of the License at | |
6 // | |
7 // http://www.apache.org/licenses/LICENSE-2.0 | |
8 // | |
9 // Unless required by applicable law or agreed to in writing, software | |
10 // distributed under the License is distributed on an "AS IS" BASIS, | |
11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | |
12 // See the License for the specific language governing permissions and | |
13 // limitations under the License. | |
14 // ======================================================================== | |
15 | |
16 #ifndef OMAHA_UI_YES_NO_DIALOG_H_ | |
17 #define OMAHA_UI_YES_NO_DIALOG_H_ | |
18 | |
19 #include "omaha/base/scoped_any.h" | |
20 #include "omaha/base/wtl_atlapp_wrapper.h" | |
21 #include "omaha/client/resource.h" | |
22 | |
23 namespace omaha { | |
24 | |
25 class YesNoDialog | |
26 : public CAxDialogImpl<YesNoDialog>, | |
27 public CMessageFilter { | |
28 typedef CAxDialogImpl<YesNoDialog> Base; | |
29 | |
30 public: | |
31 static const int IDD = IDD_YES_NO; | |
32 | |
33 YesNoDialog(CMessageLoop* message_loop, HWND parent); | |
34 ~YesNoDialog(); | |
35 | |
36 HRESULT Initialize(const CString& yes_no_title, | |
37 const CString& yes_no_text); | |
38 HRESULT Show(); | |
39 | |
40 bool yes_clicked() const { | |
41 return yes_clicked_; | |
42 } | |
43 | |
44 // CMessageFilter interface method. | |
45 BOOL PreTranslateMessage(MSG* msg) { | |
46 return CWindow::IsDialogMessage(msg); | |
47 } | |
48 | |
49 BEGIN_MSG_MAP(YesNoDialog) | |
50 COMMAND_HANDLER(IDOK, BN_CLICKED, OnClickedButton) | |
51 COMMAND_ID_HANDLER(IDCANCEL, OnClickedButton) | |
52 MESSAGE_HANDLER(WM_CLOSE, OnClose) | |
53 MESSAGE_HANDLER(WM_NCDESTROY, OnNCDestroy) | |
54 CHAIN_MSG_MAP(Base) | |
55 END_MSG_MAP() | |
56 | |
57 private: | |
58 // Message and command handlers. | |
59 LRESULT OnClickedButton(WORD notify_code, | |
60 WORD id, | |
61 HWND wnd_ctl, | |
62 BOOL& handled); // NOLINT(runtime/references) | |
63 LRESULT OnClose(UINT msg, | |
64 WPARAM wparam, | |
65 LPARAM lparam, | |
66 BOOL& handled); // NOLINT(runtime/references) | |
67 LRESULT OnNCDestroy(UINT msg, | |
68 WPARAM wparam, | |
69 LPARAM lparam, | |
70 BOOL& handled); // NOLINT(runtime/references) | |
71 | |
72 CMessageLoop* message_loop_; | |
73 HWND parent_; | |
74 bool yes_clicked_; | |
75 | |
76 // Handle to large icon to show when ALT-TAB. | |
77 scoped_hicon hicon_; | |
78 | |
79 DISALLOW_COPY_AND_ASSIGN(YesNoDialog); | |
80 }; | |
81 | |
82 } // namespace omaha | |
83 | |
84 #endif // OMAHA_UI_YES_NO_DIALOG_H_ | |
85 | |
OLD | NEW |