-
Notifications
You must be signed in to change notification settings - Fork 5
/
RpcFileDlg.cpp
109 lines (81 loc) · 2.42 KB
/
RpcFileDlg.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
#include "StdAfx.h"
#include "RpcFileDlg.h"
#include "Resource.h"
#include "RpcUtilities.h"
CRpcFileDlg::CRpcFileDlg(BOOL bOpenFileDialog, LPCTSTR lpszDefExt, LPCTSTR lpszFileName,
DWORD dwFlags, LPCTSTR lpszFilter, CWnd* pParentWnd)
: CLBPPreviewingFileDialog(bOpenFileDialog, lpszDefExt, lpszFileName, dwFlags, lpszFilter, pParentWnd)
{
}
CRpcFileDlg::~CRpcFileDlg(void)
{
}
BOOL CRpcFileDlg::OnInitDialog()
{
CLBPPreviewingFileDialog::OnInitDialog();
PreviewCheck().SetWindowText(_RhLocalizeString( L"Preview", 32810)); // RR #83932.
return TRUE;
}
DWORD CRpcFileDlg::ResourceID(DWORD dwWhich) const
{
switch (dwWhich)
{
case 1: return IDC_CHECK_PREVIEW;
case 2: return IDC_STATIC_PREVIEW;
case 3: return IDC_PROGRESS1;
}
return IDD_FILE_DIALOG;
}
HINSTANCE CRpcFileDlg::ResourceInstance(void) const
{
return AfxGetInstanceHandle();
}
BEGIN_MESSAGE_MAP(CRpcAdvancedFileDialog, CRpcFileDlg)
ON_WM_SIZE()
ON_BN_CLICKED(IDCC1, OnAdvancedButtonClicked)
END_MESSAGE_MAP()
CRpcAdvancedFileDialog::CRpcAdvancedFileDialog(CWnd* pParent)
:
m_bAdvanced(false),
CRpcFileDlg(true, L"*.rpc", NULL, OFN_HIDEREADONLY | OFN_OVERWRITEPROMPT, L"RPC files (*.rpc)|*.rpc|All files (*.*)|*.*||", pParent)
{
}
BOOL CRpcAdvancedFileDialog::OnInitDialog()
{
__super::OnInitDialog();
const CRect rectNil(0, 0, 0, 0);
AFX_MANAGE_STATE(AfxGetStaticModuleState());
const DWORD dwStyle = WS_VISIBLE | WS_CHILD | WS_TABSTOP;
m_button_advanced.Create(_RhLocalizeString( L"Ad&vanced...", 32811), dwStyle, rectNil, this, IDCC1);
m_button_advanced.SetFont(GetFont());
const HICON hIcon = (HICON)::LoadImage(AfxGetInstanceHandle(), MAKEINTRESOURCE(IDI_ACM), IMAGE_ICON, 32, 32, LR_SHARED);
m_button_advanced.SetIcon(hIcon);
SetAdvancedButtonPosition();
return TRUE;
}
void CRpcAdvancedFileDialog::OnAdvancedButtonClicked()
{
m_bAdvanced = true;
::EndDialog(GetParent()->GetSafeHwnd(), IDCANCEL);
}
void CRpcAdvancedFileDialog::OnSize(UINT nType, int cx, int cy)
{
__super::OnSize(nType, cx, cy);
SetAdvancedButtonPosition();
}
void CRpcAdvancedFileDialog::SetAdvancedButtonPosition(void)
{
CWnd* pWnd = GetDlgItem(ResourceID(1));
if (NULL == pWnd)
return;
CRect rectW;
pWnd->GetWindowRect(rectW);
ScreenToClient(rectW);
CRect rect;
GetClientRect(rect);
rect.top = rectW.bottom + 20;
rect.bottom = rect.top + 60;
rect.left = rectW.left;
rect.right = rectW.right;
m_button_advanced.MoveWindow(rect);
}