forked from excitom/vp-spades
-
Notifications
You must be signed in to change notification settings - Fork 0
/
HintDlg.cpp
137 lines (114 loc) · 2.65 KB
/
HintDlg.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
// HintDlg.cpp : implementation file
//
// Show Hint dialog box to a player.
//
#include "stdafx.h"
#include "vct.h"
#include "VctApp.h"
#include "HintDlg.h"
#include "ConfirmDlg.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
// global static variable
extern CVctApplet theApplet;
/////////////////////////////////////////////////////////////////////////////
// HintDlg dialog
HintDlg::HintDlg(CWnd* pParent /*=NULL*/)
: CDialog(HintDlg::IDD, pParent)
{
//{{AFX_DATA_INIT(HintDlg)
//}}AFX_DATA_INIT
m_NilBid = FALSE;
m_HintValue = 0;
m_HintSelected = FALSE;
m_bChanged = FALSE;
m_ConfDlg = NULL;
}
void
HintDlg::PostNcDestroy() {
if (m_ConfDlg) {
m_ConfDlg->EndDialog(IDABORT);
m_ConfDlg = NULL;
}
CDialog::PostNcDestroy();
delete this;
theApplet.clrHintDlg();
}
void HintDlg::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
//{{AFX_DATA_MAP(HintDlg)
DDX_Control(pDX, IDC_SLIDER1, m_SliderHint);
//}}AFX_DATA_MAP
}
BEGIN_MESSAGE_MAP(HintDlg, CDialog)
//{{AFX_MSG_MAP(HintDlg)
ON_WM_CANCELMODE()
ON_BN_CLICKED(IDHINT, OnHint)
ON_BN_CLICKED(IDNIL, OnNil)
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// HintDlg message handlers
BEGIN_EVENTSINK_MAP(HintDlg, CDialog)
//{{AFX_EVENTSINK_MAP(HintDlg)
ON_EVENT(HintDlg, IDC_SLIDER1, 2 /* Change */, OnChangeSliderHint, VTS_NONE)
//}}AFX_EVENTSINK_MAP
END_EVENTSINK_MAP()
void HintDlg::OnChangeSliderHint()
{
m_bChanged = TRUE;
}
void HintDlg::OnNil()
{
CString p;
p.LoadString(IDS_NIL_CONFIRM);
CConfirmDlg dlg;
m_ConfDlg = &dlg;
dlg.init(p);
int ret = dlg.DoModal();
m_ConfDlg = NULL;
if (ret != IDOK) {
return;
}
m_HintValue = 0;
m_NilBid = TRUE;
m_HintSelected = TRUE;
ShowWindow(SW_HIDE);
}
void HintDlg::OnHint()
{
m_HintValue = m_SliderHint.GetPos();
// If the slider wasn't moved, confirm that the player really meant to hint
if (!m_bChanged) {
CString p1, p2, msg;
p1.LoadString(IDS_HINT_CONFIRM);
p2.LoadString(IDS_CONFIRM);
msg.Format("%s %d\n%s", p1, m_HintValue, p2);
CConfirmDlg dlg;
m_ConfDlg = &dlg;
dlg.init(msg);
int ret = dlg.DoModal();
m_ConfDlg = NULL;
if (ret != IDOK) {
return;
}
}
m_HintSelected = TRUE;
ShowWindow(SW_HIDE);
}
BOOL HintDlg::OnInitDialog()
{
CDialog::OnInitDialog();
SetWindowPos(&this->wndTop,210,100,0,0, SWP_SHOWWINDOW | SWP_NOSIZE);
return TRUE; // return TRUE unless you set the focus to a control
// EXCEPTION: OCX Property Pages should return FALSE
}
void HintDlg::OnCancelMode()
{
CDialog::OnCancelMode();
// TODO: Add your message handler code here
}