2
/**************************************************************************
4
* Regina - A Normal Surface Theory Calculator *
7
* Copyright (c) 1999-2014, Ben Burton *
8
* For further details contact Ben Burton (bab@debian.org). *
10
* This program is free software; you can redistribute it and/or *
11
* modify it under the terms of the GNU General Public License as *
12
* published by the Free Software Foundation; either version 2 of the *
13
* License, or (at your option) any later version. *
15
* As an exception, when this program is distributed through (i) the *
16
* App Store by Apple Inc.; (ii) the Mac App Store by Apple Inc.; or *
17
* (iii) Google Play by Google Inc., then that store may impose any *
18
* digital rights management, device limits and/or redistribution *
19
* restrictions that are required by its terms of service. *
21
* This program is distributed in the hope that it will be useful, but *
22
* WITHOUT ANY WARRANTY; without even the implied warranty of *
23
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
24
* General Public License for more details. *
26
* You should have received a copy of the GNU General Public *
27
* License along with this program; if not, write to the Free *
28
* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, *
29
* MA 02110-1301, USA. *
31
**************************************************************************/
35
/*! \file nsnappeashapes.h
36
* \brief Provides access to tetrahedron shapes and cusp data for
37
* SnapPea triangulations.
40
#ifndef __NSNAPPEASHAPES_H
41
#define __NSNAPPEASHAPES_H
43
#include "../packettabui.h"
45
#include <QAbstractItemModel>
51
class QTreeWidgetItem;
54
class NSnapPeaTriangulation;
58
* Note: We always allow editing the fillings in the cusp table.
60
class CuspModel : public QAbstractItemModel {
63
* Details of the cusps being displayed.
65
regina::NSnapPeaTriangulation* tri_;
69
* Constructor and destructor.
71
CuspModel(regina::NSnapPeaTriangulation* tri);
74
* Rebuild the model from scratch.
79
* Overrides for describing and editing data in the model.
81
QModelIndex index(int row, int column,
82
const QModelIndex& parent) const;
83
QModelIndex parent(const QModelIndex& index) const;
84
int rowCount(const QModelIndex& parent) const;
85
int columnCount(const QModelIndex& parent) const;
86
QVariant data(const QModelIndex& index, int role) const;
87
QVariant headerData(int section, Qt::Orientation orientation,
89
Qt::ItemFlags flags(const QModelIndex& index) const;
90
bool setData(const QModelIndex& index, const QVariant& value, int role);
94
* A triangulation page for viewing normal surface properties.
96
class NSnapPeaShapesUI : public QObject, public PacketEditorTab {
104
regina::NSnapPeaTriangulation* tri;
107
* Internal components
116
QAction* actRandomise;
118
QAction* actToRegina;
119
QLinkedList<QAction*> triActionList;
120
QLinkedList<QAction*> enableWhenWritable;
121
QLinkedList<QAction*> requiresNonNull;
125
* Constructor and destructor.
127
NSnapPeaShapesUI(regina::NSnapPeaTriangulation* packet,
128
PacketTabbedUI* useParentUI, bool readWrite);
132
* Fill the given toolbar with actions.
134
* This is necessary since the toolbar will not be a part of
135
* this page, but this page (as the editor) keeps track of the
138
void fillToolBar(QToolBar* bar);
141
* PacketEditorTab overrides.
143
regina::NPacket* getPacket();
144
QWidget* getInterface();
145
const QLinkedList<QAction*>& getPacketTypeActions();
148
void setReadWrite(bool readWrite);
161
* Update the states of internal components.
163
void updateNonNullActions();
166
inline CuspModel::CuspModel(regina::NSnapPeaTriangulation* tri) : tri_(tri) {
169
inline QModelIndex CuspModel::parent(const QModelIndex&) const {
170
// All items are top-level.
171
return QModelIndex();