summaryrefslogtreecommitdiff
path: root/quacker/brb.cpp
blob: 3a564f820cb20657f76071072e5e1969cb296e55 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
/*
 *  Quackle -- Crossword game artificial intelligence and analysis tool
 *  Copyright (C) 2005-2006 Jason Katz-Brown and John O'Laughlin.
 *
 *  This program is free software; you can redistribute it and/or modify
 *  it under the terms of the GNU General Public License as published by
 *  the Free Software Foundation; either version 2 of the License, or
 *  (at your option) any later version.
 *
 *  This program is distributed in the hope that it will be useful,
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *  GNU General Public License for more details.
 *
 *  You should have received a copy of the GNU General Public License
 *  along with this program; if not, write to the Free Software
 *  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  
 *  02110-1301  USA
 */

#include <QtGui>

#include <game.h>

#include "bagdisplay.h"
#include "brb.h"
#include "boarddisplay.h"
#include "geometry.h"
#include "rackdisplay.h"
#include "widgetfactory.h"

BRB::BRB(WidgetFactory *widgetFactory, QWidget *parent)
	: View(parent)
{
	QHBoxLayout *topHorizontalLayout = new QHBoxLayout;
	Geometry::setupFramedLayout(topHorizontalLayout);
	setLayout(topHorizontalLayout);

	QVBoxLayout *leftVerticalLayout = new QVBoxLayout;
	Geometry::setupInnerLayout(leftVerticalLayout);
	topHorizontalLayout->addLayout(leftVerticalLayout);
	QVBoxLayout *rightVerticalLayout = new QVBoxLayout;
	Geometry::setupInnerLayout(rightVerticalLayout);
	topHorizontalLayout->addLayout(rightVerticalLayout);

	m_boardDisplay = widgetFactory->createBoardDisplay();
	leftVerticalLayout->addWidget(m_boardDisplay);

	m_rackDisplay = widgetFactory->createRackDisplay();
	leftVerticalLayout->addWidget(m_rackDisplay);

	topHorizontalLayout->setStretchFactor(leftVerticalLayout, 10);

	m_bagDisplay = widgetFactory->createBagDisplay();
	rightVerticalLayout->addWidget(m_bagDisplay);

	m_subviews.push_back(m_boardDisplay);
	m_subviews.push_back(m_rackDisplay);
	m_subviews.push_back(m_bagDisplay);
	connectSubviewSignals();
}

BRB::~BRB()
{
}

View * BRB::getBoardView() const
{
	return m_boardDisplay;
}

void BRB::grabFocus()
{
	m_rackDisplay->grabFocus();
}

void BRB::positionChanged(const Quackle::GamePosition &position)
{
	View::positionChanged(position);
}