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
|
/*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#include <tqpushbutton.h>
#include <tqlayout.h>
#include <kglobal.h>
#include <klocale.h>
#include "betbox.h"
BetBox::BetBox(TQWidget* parent, const char* name)
: TQGroupBox(parent, name)
{
TQVBoxLayout* topLayout = new TQVBoxLayout(this, 1, 1);
TQGridLayout* g = new TQGridLayout(topLayout, 2, 2, 1);
TQHBoxLayout* l = new TQHBoxLayout(topLayout, 1);
bet5Up = new TQPushButton(this);
g->addWidget(bet5Up, 0, 0);
bet10Up = new TQPushButton(this);
g->addWidget(bet10Up, 0, 1);
bet5Down = new TQPushButton(this);
g->addWidget(bet5Down, 1, 0);
bet10Down = new TQPushButton(this);
g->addWidget(bet10Down, 1, 1);
adjustBet = new TQPushButton(this);
l->addWidget(adjustBet, 0);
l->addStretch(1);
foldButton = new TQPushButton(this);
l->addWidget(foldButton, 0);
bet5Up->setText(TQString("+%1").arg(TDEGlobal::locale()->formatMoney(5)));
bet10Up->setText(TQString("+%1").arg(TDEGlobal::locale()->formatMoney(10)));
bet5Down->setText(TQString("-%1").arg(TDEGlobal::locale()->formatMoney(5)));
bet10Down->setText(TQString("-%1").arg(TDEGlobal::locale()->formatMoney(10)));
adjustBet->setText(i18n("Adjust Bet"));
foldButton->setText(i18n("Fold"));
//connects
connect(bet5Up, TQT_SIGNAL(clicked()), TQT_SLOT(bet5UpClicked()));
connect(bet10Up, TQT_SIGNAL(clicked()), TQT_SLOT(bet10UpClicked()));
connect(bet5Down, TQT_SIGNAL(clicked()), TQT_SLOT(bet5DownClicked()));
connect(bet10Down, TQT_SIGNAL(clicked()), TQT_SLOT(bet10DownClicked()));
connect(foldButton, TQT_SIGNAL(clicked()), TQT_SLOT(foldClicked()));
connect(adjustBet, TQT_SIGNAL(clicked()), TQT_SLOT(adjustBetClicked()));
stopRaise();
}
BetBox::~BetBox()
{
delete bet5Up;
delete bet10Up;
delete bet5Down;
delete bet10Down;
delete adjustBet;
delete foldButton;
}
void BetBox::bet5UpClicked()
{
emit betChanged(5);
}
void BetBox::bet10UpClicked()
{
emit betChanged(10);
}
void BetBox::bet5DownClicked()
{
emit betChanged(-5);
}
void BetBox::bet10DownClicked()
{
emit betChanged(-10);
}
void BetBox::adjustBetClicked()
{
emit betAdjusted();
}
void BetBox::foldClicked()
{
emit fold();
}
void BetBox::beginRaise()
{
adjustBet->setEnabled(true);
foldButton->setEnabled(true);
bet5Up->setEnabled(false);
bet10Up->setEnabled(false);
bet5Down->setEnabled(false);
bet10Down->setEnabled(false);
}
void BetBox::stopRaise()
{
adjustBet->setEnabled(false);
foldButton->setEnabled(false);
bet5Up->setEnabled(true);
bet10Up->setEnabled(true);
bet5Down->setEnabled(true);
bet10Down->setEnabled(true);
}
#include "betbox.moc"
|