~ubuntu-branches/ubuntu/vivid/regina-normal/vivid-proposed

« back to all changes in this revision

Viewing changes to kdeui/src/part/packettypes/nscriptvaritems.h

  • Committer: Package Import Robot
  • Author(s): Ben Burton
  • Date: 2011-09-10 07:17:25 UTC
  • mfrom: (1.2.4 upstream)
  • Revision ID: package-import@ubuntu.com-20110910071725-97n90tywdq60w2cr
Tags: 4.90-1
* New upstream release!
* The user interface has been ported from KDE3 to KDE4 (closes: #556318).
  Re-enabled the GUI as a result.
* The build system has been ported from autotools to cmake.
* The new upstream release builds fine on amd64 (closes: #624882).
* Moved the users' handbook into regina-normal-doc.
* Upgraded several suggests/recommends.  Upgraded regina-normal-mpi to
  depend on mpi-default-bin, and regina-normal to depend on both graphviz
  and regina-normal-doc (which the GUI expends to be present).  Upgraded
  regina-normal to recommend gap.
* Bumped standards-version to 3.9.2.0 (no changes required).

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
 
2
 
/**************************************************************************
3
 
 *                                                                        *
4
 
 *  Regina - A Normal Surface Theory Calculator                           *
5
 
 *  KDE User Interface                                                    *
6
 
 *                                                                        *
7
 
 *  Copyright (c) 1999-2009, Ben Burton                                   *
8
 
 *  For further details contact Ben Burton (bab@debian.org).              *
9
 
 *                                                                        *
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.                       *
14
 
 *                                                                        *
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.                              *
19
 
 *                                                                        *
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.                                                   *
24
 
 *                                                                        *
25
 
 **************************************************************************/
26
 
 
27
 
/* end stub */
28
 
 
29
 
/*! \file nscriptvaritems.h
30
 
 *  \brief Provides various table items for script variables.
31
 
 */
32
 
 
33
 
#ifndef __NSCRIPTVARITEMS_H
34
 
#define __NSCRIPTVARITEMS_H
35
 
 
36
 
#include "packet/npacketlistener.h"
37
 
 
38
 
#include <qtable.h>
39
 
 
40
 
namespace regina {
41
 
    class NPacket;
42
 
}
43
 
 
44
 
/**
45
 
 * A table item for script variable names.
46
 
 */
47
 
class ScriptVarNameItem : public QTableItem {
48
 
    private:
49
 
        bool error;
50
 
            /**< Are we currently displaying an error message? */
51
 
 
52
 
    public:
53
 
        /**
54
 
         * Constructor.
55
 
         */
56
 
        ScriptVarNameItem(QTable* table, const QString& name);
57
 
 
58
 
        /**
59
 
         * QTableItem overrides.
60
 
         */
61
 
        virtual QWidget* createEditor() const;
62
 
        virtual void setContentFromEditor(QWidget* editor);
63
 
 
64
 
    private:
65
 
        /**
66
 
         * Display the given error to the user if no error is already
67
 
         * being displayed.
68
 
         */
69
 
        void showError(const QString& message);
70
 
 
71
 
        /**
72
 
         * Is the given variable name already being used elsewhere in the
73
 
         * table?
74
 
         */
75
 
        bool nameUsedElsewhere(const QString& name);
76
 
};
77
 
 
78
 
/**
79
 
 * A table item for script variable values.
80
 
 */
81
 
class ScriptVarValueItem : public QTableItem, public regina::NPacketListener {
82
 
    private:
83
 
        /**
84
 
         * The selected packet, if any.
85
 
         */
86
 
        regina::NPacket* packet;
87
 
 
88
 
        /**
89
 
         * The packet tree matriarch.
90
 
         */
91
 
        regina::NPacket* matriarch;
92
 
 
93
 
    public:
94
 
        /**
95
 
         * Constructor.
96
 
         */
97
 
        ScriptVarValueItem(QTable* table, regina::NPacket* treeMatriarch,
98
 
            regina::NPacket* selectedPacket);
99
 
        ScriptVarValueItem(QTable* table, regina::NPacket* treeMatriarch,
100
 
            const QString& packetLabel);
101
 
 
102
 
        /**
103
 
         * Access the currently selected packet.
104
 
         */
105
 
        regina::NPacket* getPacket();
106
 
        void setPacket(regina::NPacket* newPacket);
107
 
 
108
 
        /**
109
 
         * QTableItem overrides.
110
 
         */
111
 
        virtual QWidget* createEditor() const;
112
 
        virtual void setContentFromEditor(QWidget* editor);
113
 
 
114
 
        /**
115
 
         * NPacketListener overrides.
116
 
         */
117
 
        virtual void packetWasRenamed(regina::NPacket* p);
118
 
        virtual void packetToBeDestroyed(regina::NPacket* p);
119
 
 
120
 
    private:
121
 
        /**
122
 
         * Update the text and pixmap according to the currently
123
 
         * selected packet.
124
 
         */
125
 
        void updateData();
126
 
};
127
 
 
128
 
inline regina::NPacket* ScriptVarValueItem::getPacket() {
129
 
    return packet;
130
 
}
131
 
 
132
 
inline void ScriptVarValueItem::setPacket(regina::NPacket* newPacket) {
133
 
    packet = newPacket;
134
 
}
135
 
 
136
 
#endif