Source Code (Use browser search to find items of interest.)
Class Index
ksirtet'PlayerCheckBox (./kdegames/ksirtet/lib/miscui.h:51)
class PlayerCheckBox : public MultiCheckBox
{
public:
enum Type { Human, AI, Empty };
PlayerCheckBox(Type type, bool canBeEmpty, bool acceptAI,
QWidget *parent = 0, const char *name = 0);
Type type() const { return (Type)value(); };
protected:
void drawIn(const QRect &r);
bool modifie();
private:
bool canBeEmpty, acceptAI;
};
ksirtet'PlayerCheckBox::PlayerCheckBox() (./kdegames/ksirtet/lib/miscui.cpp:90)
PlayerCheckBox::PlayerCheckBox(Type type, bool _canBeEmpty, bool _acceptAI,
QWidget *parent, const char *name)
: MultiCheckBox( ((type==Empty && !_canBeEmpty) || (type==AI && !_acceptAI) ? Human : type),
parent, name),
canBeEmpty(_canBeEmpty), acceptAI(_acceptAI)
{}
ksirtet'PlayerCheckBox::drawIn() (./kdegames/ksirtet/lib/miscui.cpp:97)
void PlayerCheckBox::drawIn(const QRect &r)
{
QPainter p(this);
int ew = 2, eh = 2;
int x = r.size().width()/5;
int y = r.size().height()/5;
QRect leye(r.topLeft() + QPoint(2*x, 2*y) - QPoint(ew/2, eh/2), QSize(ew, eh));
QRect reye(r.topRight() + QPoint(-2*x, 2*y) - QPoint(ew/2, eh/2), QSize(ew, eh));
switch (type()) {
case Human :
p.setPen( QPen(blue, 3) );
p.drawEllipse(r);
p.drawEllipse(leye);
p.drawEllipse(reye);
break;
case AI :
p.setPen( QPen(blue, 3) );
p.drawRect(r);
p.drawEllipse(leye);
p.drawEllipse(reye);
break;
case Empty :
p.setPen( QPen(red, 3) );
p.drawLine(r.topLeft(), r.bottomRight());
p.drawLine(r.bottomLeft(), r.topRight());
break;
}
}
ksirtet'PlayerCheckBox::modifie() (./kdegames/ksirtet/lib/miscui.cpp:128)
bool PlayerCheckBox::modifie()
{
switch (type()) {
case Human :
if (acceptAI) setValue(AI);
else if (canBeEmpty) setValue(Empty);
else return FALSE;
return TRUE;
case AI :
setValue( (canBeEmpty ? Empty : Human) );
return TRUE;
case Empty :
setValue( Human );
return TRUE;
}
return FALSE;
}