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 #ifndef THECHESS_WIDGETS_MOVES_H_ 00011 #define THECHESS_WIDGETS_MOVES_H_ 00012 00013 // move=-1 --> board=0 (start position) --> move=1 -->board=1 ... 00014 00015 00016 #include <Wt/WContainerWidget> 00017 #include <Wt/WSignal> 00018 #include <Wt/WCompositeWidget> 00019 00020 #include "chess/moves.hpp" 00021 #include "chess/field.hpp" 00022 #include "chess/cached_moves.hpp" 00023 #include "widgets/BoardWidget.hpp" 00024 00025 namespace thechess { 00026 namespace widgets { 00027 00028 class MovesWidgetImpl; 00029 00030 class MovesWidget : public Wt::WCompositeWidget { 00031 public: 00032 MovesWidget(const chess::Moves& moves, bool big=false, 00033 bool active=false, int max_moves=-1, bool append_only=false, 00034 chess::Color bottom=chess::white, Wt::WContainerWidget* parent=0); 00035 00036 const chess::Moves& moves() const; 00037 const chess::Board& board() const; 00038 Wt::Signal<chess::Move>& move(); 00039 int current_move() const; 00040 00041 void add_move(const chess::Move& move); 00042 void bottom_set(chess::Color bottom); 00043 void reset(); 00044 void set_moves(const chess::Moves& moves); 00045 void set_active(bool active); 00046 00047 private: 00048 MovesWidgetImpl* impl_; 00049 }; 00050 00051 } 00052 } 00053 00054 #endif // THECHESS_WIDGETS_MOVES_H_