valuelistwidget.h 2.43 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23
/***************************************************************************
 *   Copyright 2007      Johannes Bergmeier <johannes.bergmeier@gmx.net>   *
 *                                                                         *
 *   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.         *
 ***************************************************************************/

#ifndef _KSUDOKUVALUELISTWIDGET_H_
#define _KSUDOKUVALUELISTWIDGET_H_

#include <QGraphicsItem>
24
#include <QGraphicsView>
25 26 27 28 29 30 31
#include <QList>

#include "symbols.h"


namespace ksudoku {

32 33
class SymbolItem;
class SelectionItem;
34 35
	
class ValueListWidget : public QGraphicsView {
36 37
	Q_OBJECT
	friend class SymbolItem;
38 39 40 41
public:
	ValueListWidget(QWidget* parent = 0);
	~ValueListWidget();
	
42 43 44
// 	SymbolTable* currentTable() const;
// 	void setCurrentTable(SymbolTable* table, int maxValue);
	void setMaxValue(int maxValue);
45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63
	
	void resizeEvent(QResizeEvent*);
	
public slots:
	void selectValue(int value);
	
signals:
	/**
	 * This signal gets emitted when the ValueListWidget itself changed the
	 * selected value. A call of selectValue(int) will not cause an emit.
	 */
	void valueSelected(int value);
	
protected:
	inline QGraphicsScene* scene() { return m_scene; }
	void selectValueItem(int value);
	void wheelEvent (QWheelEvent* e);
	
private:
64
// 	SymbolTable* m_table;
65
	QGraphicsScene* m_scene;
66 67
	QList<SymbolItem*> m_symbols;
	SelectionItem *m_selectionItem;
68 69 70 71 72 73 74
	int m_selectedValue;
	int m_maxValue;
};

}

#endif