2
/**************************************************************************
4
* Regina - A Normal Surface Theory Calculator *
7
* Copyright (c) 1999-2009, 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
* This program is distributed in the hope that it will be useful, but *
16
* WITHOUT ANY WARRANTY; without even the implied warranty of *
17
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
18
* General Public License for more details. *
20
* You should have received a copy of the GNU General Public *
21
* License along with this program; if not, write to the Free *
22
* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, *
23
* MA 02110-1301, USA. *
25
**************************************************************************/
29
/*! \file nscriptvaritems.h
30
* \brief Provides various table items for script variables.
33
#ifndef __NSCRIPTVARITEMS_H
34
#define __NSCRIPTVARITEMS_H
36
#include "packet/npacketlistener.h"
45
* A table item for script variable names.
47
class ScriptVarNameItem : public QTableItem {
50
/**< Are we currently displaying an error message? */
56
ScriptVarNameItem(QTable* table, const QString& name);
59
* QTableItem overrides.
61
virtual QWidget* createEditor() const;
62
virtual void setContentFromEditor(QWidget* editor);
66
* Display the given error to the user if no error is already
69
void showError(const QString& message);
72
* Is the given variable name already being used elsewhere in the
75
bool nameUsedElsewhere(const QString& name);
79
* A table item for script variable values.
81
class ScriptVarValueItem : public QTableItem, public regina::NPacketListener {
84
* The selected packet, if any.
86
regina::NPacket* packet;
89
* The packet tree matriarch.
91
regina::NPacket* matriarch;
97
ScriptVarValueItem(QTable* table, regina::NPacket* treeMatriarch,
98
regina::NPacket* selectedPacket);
99
ScriptVarValueItem(QTable* table, regina::NPacket* treeMatriarch,
100
const QString& packetLabel);
103
* Access the currently selected packet.
105
regina::NPacket* getPacket();
106
void setPacket(regina::NPacket* newPacket);
109
* QTableItem overrides.
111
virtual QWidget* createEditor() const;
112
virtual void setContentFromEditor(QWidget* editor);
115
* NPacketListener overrides.
117
virtual void packetWasRenamed(regina::NPacket* p);
118
virtual void packetToBeDestroyed(regina::NPacket* p);
122
* Update the text and pixmap according to the currently
128
inline regina::NPacket* ScriptVarValueItem::getPacket() {
132
inline void ScriptVarValueItem::setPacket(regina::NPacket* newPacket) {