Factor canBeCaptured() out of Shogi legal() check for east reuse.
[tagua/yd.git] / src / ui.h
blobf1d2c4a54c139d098812111190f33ad425b672e5
1 /*
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.
9 */
11 #ifndef UI_H
12 #define UI_H
14 #include <boost/shared_ptr.hpp>
15 #include <qobject.h>
16 #include "common.h"
17 #include "controllers/entitytoken.h"
18 #include "tagua.h"
19 #include <map>
21 class Controller;
22 class Engine;
23 class ActionCollection;
25 class UI : public QObject {
26 Q_OBJECT
27 typedef std::map<QWidget*, boost::shared_ptr<Controller> > ControllerMap;
28 ControllerMap m_controller;
29 QWidget* m_current_tab;
30 boost::shared_ptr<Controller>& controller();
31 boost::shared_ptr<Controller> controller() const;
32 public:
33 UI();
34 void addController(QWidget* w, const boost::shared_ptr<Controller>&);
35 void setController(const boost::shared_ptr<Controller>&);
36 void removeController(QWidget* w);
37 public Q_SLOTS:
38 void setCurrentTab(QWidget* w);
40 bool undo();
41 bool redo();
42 bool truncate();
43 bool promoteVariation();
44 bool back();
45 bool forward();
46 void gotoFirst();
47 void gotoLast();
48 void setTurn(int);
49 void createCtrlAction();
50 void destroyCtrlAction();
51 ActionCollection* variantActions() const;
53 void pgnCopy();
54 void pgnPaste();
55 void pgnPaste(const QString&);
57 // editing
58 void clearBoard();
59 void setStartingPosition();
60 void copyPosition();
61 void pastePosition();
62 AbstractPosition::Ptr position() const;
64 EntityToken addPlayingEngine(int side, const boost::shared_ptr<Engine>& engine);
65 // EntityToken addAnalysingEngine(const boost::shared_ptr<Engine>& engine);
66 void removeEntity(const EntityToken& token);
68 void end();
69 void detach();
71 QString currentVariant() const;
72 void reloadSettings();
75 #endif