2 Copyright (c) 2006 Paolo Capriotti <p.capriotti@gmail.com>
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 <KGameCanvas>
15 #include "animationmanager.h"
16 #include "positioninfo.h"
17 #include "chessboard.h"
19 #include "components.h"
26 namespace MoveList
{ class Table
; }
28 class ChessTable
: public KGameCanvasWidget
{
30 KGameCanvasPixmap
* m_wallpaper
;
31 QPixmap m_background_pixmap
;
35 PiecePool
* m_pools
[2];
36 MoveList::Table
* m_movelist
;
39 ClickableCanvas
* m_current
;
40 ClickableCanvas
* m_mousegrab
;
43 ClickableCanvas
* eventItemAt(QPoint pos
);
45 void layout(bool force_reload
= false);
46 void renderWallpaper();
48 AnimationManager m_anim_manager
;
49 Components m_components
;
52 explicit ChessTable(Variant
* variant
, QWidget
* parent
= 0);
55 inline ChessBoard
* board() const { return m_board
; }
56 inline PiecePool
* pool(int index
) const { return m_pools
[index
]; }
57 inline MoveList::Table
* moveListTable() const { return m_movelist
; }
58 inline Clock
* clock(int index
) const { return m_clocks
[index
]; }
59 inline InfoDisplay
* info() const { return m_info
; }
66 void setEntity(const boost::shared_ptr
<UserEntity
>& entity
);
68 void displayMessage(const QString
&);
70 virtual void resizeEvent(QResizeEvent
*);
71 virtual void mouseReleaseEvent(QMouseEvent
*);
72 virtual void mousePressEvent(QMouseEvent
*);
73 virtual void mouseMoveEvent(QMouseEvent
*);
74 virtual void enterEvent (QEvent
* event
);
75 virtual void leaveEvent (QEvent
* event
);
77 void settingsChanged(); //called by GraphicalInfo, for better theme change
78 AnimationManager
* animationManager();
79 const AnimationManager
* animationManager() const;
80 Components
* components();
81 void setVariant(Variant
* variant
);
83 void updateTurn(int color
);
84 void changeClock(int color
);
85 void updateTime(int white
, int black
);
86 void setPlayers(const Player
&, const Player
&);
90 void message(const QString
&);
91 void error(ErrorCode
);
94 #endif // CHESSTABLE_H