forked from perilouswithadollarsign/cstrike15_src
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdialogwithcheckbox.cpp
140 lines (111 loc) · 3.55 KB
/
dialogwithcheckbox.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
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
//========= Copyright © 1996-2005, Valve Corporation, All rights reserved. ============//
//
// Purpose:
//
// $NoKeywords: $
//
//=============================================================================//
// syncfiledialog.cpp : implementation file
//
#include "stdafx.h"
#include "hammer.h"
#include "dialogwithcheckbox.h"
#include "mapdoc.h"
#include "p4lib/ip4.h"
#include "options.h"
// memdbgon must be the last include file in a .cpp file!!!
#include <tier0/memdbgon.h>
IMPLEMENT_DYNAMIC(CDialogWithCheckbox, CDialog)
//-----------------------------------------------------------------------------
// Purpose:
// Input :
// Output :
//-----------------------------------------------------------------------------
CDialogWithCheckbox::CDialogWithCheckbox( const char *pszTitleText, const char *pszDialogText, const char *pszCheckboxText, bool bCheckState, bool bDisabled, CWnd* pParent /*=NULL*/ )
: CDialog(CDialogWithCheckbox::IDD, pParent)
, m_strCheckboxText(_T(""))
, m_strDialogText(_T(""))
{
m_bDefaultCheckState = bCheckState;
m_bCheckMark = false;
m_bClickedOk = false;
m_bCheckMarkDisabled = bDisabled;
m_strTitleText = pszTitleText;
m_strDialogText = pszDialogText;
m_strCheckboxText = pszCheckboxText;
}
//-----------------------------------------------------------------------------
// Purpose:
// Input :
// Output :
//-----------------------------------------------------------------------------
CDialogWithCheckbox::~CDialogWithCheckbox()
{
}
//-----------------------------------------------------------------------------
// Purpose:
// Input :
// Output :
//-----------------------------------------------------------------------------
void CDialogWithCheckbox::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
DDX_Control(pDX, IDC_DIALOG_ICON, m_IconControl);
DDX_Control(pDX, IDC_CHECKMARK_CONTROL, m_CheckmarkControl);
DDX_Text(pDX, IDC_DIALOG_TEXT, m_strDialogText);
DDX_Text(pDX, IDC_CHECKMARK_TEXT, m_strCheckboxText);
}
BEGIN_MESSAGE_MAP(CDialogWithCheckbox, CDialog)
ON_BN_CLICKED(IDOK, &CDialogWithCheckbox::OnBnClickedOk)
ON_BN_CLICKED(IDCANCEL, &CDialogWithCheckbox::OnBnClickedCancel)
END_MESSAGE_MAP()
//-----------------------------------------------------------------------------
// Purpose:
// Input :
// Output :
//-----------------------------------------------------------------------------
void CDialogWithCheckbox::OnBnClickedOk()
{
m_bCheckMark = ( m_CheckmarkControl.GetCheck() ? true : false );
m_bClickedOk = true;
OnOK();
}
//-----------------------------------------------------------------------------
// Purpose:
// Input :
// Output :
//-----------------------------------------------------------------------------
void CDialogWithCheckbox::OnBnClickedCancel()
{
m_bCheckMark = false;
m_bClickedOk = false;
OnCancel();
}
//-----------------------------------------------------------------------------
// Purpose:
// Input :
// Output :
//-----------------------------------------------------------------------------
BOOL CDialogWithCheckbox::OnInitDialog()
{
CDialog::OnInitDialog();
SetWindowText( m_strTitleText );
m_CheckmarkControl.SetCheck( m_bDefaultCheckState );
if ( m_bCheckMarkDisabled )
{
m_CheckmarkControl.EnableWindow( false );
// also disable the caption next to the checkbox
GetDlgItem( IDC_CHECKMARK_TEXT )->EnableWindow( false );
}
HICON Icon = ::LoadIcon( NULL, MAKEINTRESOURCE( IDI_ERROR ) );
m_IconControl.SetIcon( Icon );
return TRUE;
}
bool CDialogWithCheckbox::IsCheckboxChecked()
{
if ( m_bCheckMark )
{
return true;
}
return false;
}