TheChess
|
00001 /* 00002 * thechess, chess game web application written in C++ and based on Wt 00003 * Copyright (C) 2010 Boris Nagaev 00004 * 00005 * thechess is licensed under the GNU GPL Version 2. 00006 * Other versions of the GPL do not apply. 00007 * See the LICENSE file for terms of use. 00008 */ 00009 00010 // vim: set noet ts=2 sw=2: 00011 /* Board widget 00012 * Signal: move() 00013 */ 00014 00015 #ifndef THECHESS_WIDGETS_BOARDWIDGET_H_ 00016 #define THECHESS_WIDGETS_BOARDWIDGET_H_ 00017 00018 #include <Wt/WCompositeWidget> 00019 #include <Wt/WImage> 00020 00021 #include "chess/board.hpp" 00022 #include "chess/xy.hpp" 00023 #include "chess/move.hpp" 00024 #include "chess/field.hpp" 00025 00026 namespace Wt { 00027 class WContainerWidget; 00028 } 00029 00030 namespace thechess { 00031 namespace widgets { 00032 00033 00034 class BoardWidgetImpl; 00035 00036 00037 class BoardWidget : public Wt::WCompositeWidget { 00038 public: 00039 BoardWidget(bool big=false, bool active=false, chess::Color bottom=chess::white, 00040 const chess::Board& board=chess::Board(), 00041 Wt::WContainerWidget *parent=0); 00042 00043 static std::string image(chess::Field field, bool big=false); 00044 00045 void bottom_set(chess::Color bottom); 00046 void set(const chess::Board& board, chess::Move lastmove, bool active); 00047 00048 void turn(); 00049 Wt::Signal<chess::Move>& move(); 00050 Wt::WContainerWidget* inner(); 00051 00052 private: 00053 BoardWidgetImpl* impl_; 00054 }; 00055 00056 00057 00058 00059 00060 00061 00062 00063 } 00064 } 00065 00066 #endif // THECHESS_WIDGETS_BOARDWIDGET_H_