OSDN Git Service

Fix issue #1367: Tab behaviour on comparisons of files vs folders
[winmerge-jp/winmerge-jp.git] / Src / TrDialogs.h
1 #pragma once\r
2 \r
3 #include "DDXHelper.h"\r
4 \r
5 #undef GetDlgItemText\r
6 #undef SetDlgItemText\r
7 \r
8 class StaticDlgUtils\r
9 {\r
10 protected:\r
11         static void WildcardRemoveDuplicatePatterns(String& patterns);\r
12 };\r
13 \r
14 template<class T>\r
15 class DlgUtils : public StaticDlgUtils\r
16 {\r
17         T *dlg() { return static_cast<T *>(this); }\r
18 \r
19 public:\r
20         void EnableDlgItem(unsigned id, bool enabled)\r
21         {\r
22                 dlg()->GetDlgItem(id)->EnableWindow(enabled);\r
23         }\r
24 \r
25         void SetDlgItemFocus(unsigned id)\r
26         {\r
27                 dlg()->GetDlgItem(id)->SetFocus();\r
28         }\r
29 \r
30         unsigned GetDlgItemText(unsigned id, String& text)\r
31         {\r
32                 CString cstrText = text.c_str();\r
33                 unsigned uResult = dlg()->GetDlgItemTextW(id, cstrText);\r
34                 text = cstrText;\r
35                 return uResult;\r
36         }\r
37 \r
38         void SetDlgItemText(unsigned id, const String& text)\r
39         {\r
40                 return dlg()->SetDlgItemTextW(id, text.c_str());\r
41         }\r
42 };\r
43 \r
44 class CTrDialog : public CDialog, public DlgUtils<CTrDialog>\r
45 {\r
46         DECLARE_DYNAMIC(CTrDialog)\r
47 public:\r
48         using CDialog::CDialog;\r
49 \r
50         virtual BOOL OnInitDialog();\r
51 };\r
52 \r
53 class CTrPropertyPage : public CPropertyPage, public DlgUtils<CTrPropertyPage>\r
54 {\r
55         DECLARE_DYNAMIC(CTrPropertyPage)\r
56 public:\r
57         using CPropertyPage::CPropertyPage;\r
58 \r
59         virtual BOOL OnInitDialog();\r
60 };\r
61 \r
62 class CTrDialogBar : public CDialogBar, public DlgUtils<CTrDialogBar>\r
63 {\r
64         DECLARE_DYNAMIC(CTrDialogBar)\r
65 public:\r
66         virtual BOOL Create(CWnd* pParentWnd, LPCTSTR lpszTemplateName,\r
67                 UINT nStyle, UINT nID);\r
68         virtual BOOL Create(CWnd* pParentWnd, UINT nIDTemplate,\r
69                 UINT nStyle, UINT nID);\r
70 };\r