2 Copyright (c) 2006 Paolo Capriotti <p.capriotti@sns.it>
3 (c) 2006 Maurizio Monge <maurizio.monge@kdemail.net>
5 This program is free software; you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published by
7 the Free Software Foundation; either version 2 of the License, or
8 (at your option) any later version.
14 #include <boost/array.hpp>
17 #include "canvas/canvas.h"
19 #include "clickablecanvas.h"
21 class Clock
: public QObject
, public ClickableCanvas
{
24 * Structure containing information for a player.
26 class Info
: public Canvas::Group
{
31 Canvas::Rectangle
* m_background
;
32 Canvas::Rectangle
* m_frame
[4];
33 Canvas::Text
* m_caption
;
34 Canvas::Text
* m_time_label
;
35 Canvas::Text
* m_player_name
;
39 void computeTime() const;
43 : m_player(QString(), 0)
45 , m_rect(0, 0, 0, 0) { }
47 void setup(const Player
& player
, const QRect
& p
,
48 const QString
& caption
, Canvas::Abstract
* canvas
);
55 QString
playerString(const Player
& player
) const;
56 void setPlayer(const Player
& player
);
58 void resize(const QRect
& rect
);
60 QRect
eventRect() const;
62 /** changed settings handler */
63 virtual void settingsChanged();
71 Clock(Canvas::Abstract
* parent
);
73 void setTime(int index
, int value
);
74 void start(int index
);
76 void activate(int index
);
78 void setPlayers(const Player
& white
, const Player
& black
);
80 bool running() const { return m_running
!= -1; }
81 void resize(QSize size
);
84 virtual void onMousePress(const QPoint
& pos
, int button
);
85 virtual void onMouseRelease(const QPoint
& /*pos*/, int /*button*/) { }
86 virtual void onMouseMove(const QPoint
& /*pos*/, int /*button*/) { }
88 /** changed settings handler */
89 virtual void settingsChanged();
93 void labelClicked(int);