Loading...
Searching...
No Matches
ScriptWidget.h
Go to the documentation of this file.
1/*
2 Copyright (C) 2008 National Institute For Space Research (INPE) - Brazil.
3
4 This file is part of the TerraLib - a Framework for building GIS enabled
5 applications.
6
7 TerraLib is free software: you can redistribute it and/or modify
8 it under the terms of the GNU Lesser General Public License as published by
9 the Free Software Foundation, either version 3 of the License,
10 or (at your option) any later version.
11
12 TerraLib is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 GNU Lesser General Public License for more details.
16
17 You should have received a copy of the GNU Lesser General Public License
18 along with TerraLib. See COPYING. If not, write to
19 TerraLib Team at <terralib-team@terralib.org>.
20 */
21
22/*!
23 \file terralib/qt/widgets/ceditor/ScriptWidget.h
24
25 \brief A widget that can be used to edit a script.
26*/
27
28#ifndef __TERRALIB_QTWIDGETS_CEDITOR_SCRIPTWIDGET_H__
29#define __TERRALIB_QTWIDGETS_CEDITOR_SCRIPTWIDGET_H__
30
31// TerraLib
32#include "../../../vm/core/VirtualMachine.h"
33#include "../Config.h"
34
35// QScintilla
36#include <Qsci/qsciscintilla.h>
37
38// Qt
39#include <QTextEdit>
40#include <QWidget>
41
42// Forward declaration
43class QString;
44
45namespace te
46{
47 namespace qt
48 {
49 namespace widgets
50 {
51 /*!
52 \class ScriptWidget
53
54 \brief A widget that can be used to edit a script.
55 */
56 class TEQTWIDGETSEXPORT ScriptWidget : public QsciScintilla
57 {
58 Q_OBJECT
59
60 public:
61 /*!
62 \brief ScriptWidget
63
64 \param parent
65 */
66 ScriptWidget(QWidget* parent = 0);
67
68 /*! \brief Destructor. */
70
71 /*!
72 \brief Returns the file name of the script.
73
74 \return File name.
75 */
76 QString getFileName() const
77 {
78 return m_fileName;
79 }
80
81 /*!
82 \brief getScriptType
83
84 \return Returns the type of the script based on its extension.
85 */
86 QString getScriptType() const;
87
88 /*!
89 \brief getScriptName
90
91 \return Return the script name.
92 */
93 QString getScriptName() const;
94
95 /*!
96 \brief Open the script file and presents it on the text edit.
97
98 \param fileName File name.
99 */
100 void open(const QString& fileName);
101
102 /*!
103 \brief Saves the content of the script into a file.
104
105 \param fileName Name of the file.
106 */
107 void save(const QString& fileName);
108
109 /*!
110 \brief Sets the highlight mode for the script.
111
112 \param mode Name of the mode.
113
114 \note Currently supported modes are: py, lua, sql.
115 */
116 void setHighlightMode(const QString& mode);
117
118 /*!
119 \brief Sets the status of the widget. True if the text was modified,
120 false otherwise.
121
122 \param dirty Status to be set.
123 */
124 void setDirty(bool dirty);
125
126
127 public slots:
128
129 /*!
130 \brief Insert the text \a text at the current position
131 and move foward the cursor position
132
133 */
134 virtual void insert(const QString &text);
135
136 private:
137 QString m_fileName; //!< File name.
138 bool m_dirty; //!< Text was changed status.
139 };
140
141 } // end namespace widgets
142 } // end namespace qt
143} // end namespace te
144
145#endif // __TERRALIB_QTWIDGETS_CEDITOR_SCRIPTWIDGET_H__
A widget that can be used to edit a script.
Definition: ScriptWidget.h:57
ScriptWidget(QWidget *parent=0)
ScriptWidget.
void save(const QString &fileName)
Saves the content of the script into a file.
QString getScriptType() const
getScriptType
QString m_fileName
File name.
Definition: ScriptWidget.h:137
QString getScriptName() const
getScriptName
bool m_dirty
Text was changed status.
Definition: ScriptWidget.h:138
virtual void insert(const QString &text)
Insert the text text at the current position and move foward the cursor position.
QString getFileName() const
Returns the file name of the script.
Definition: ScriptWidget.h:76
void open(const QString &fileName)
Open the script file and presents it on the text edit.
void setHighlightMode(const QString &mode)
Sets the highlight mode for the script.
void setDirty(bool dirty)
Sets the status of the widget. True if the text was modified, false otherwise.
TerraLib.
#define slots
#define TEQTWIDGETSEXPORT
You can use this macro in order to export/import classes and functions from this module.
Definition: Config.h:63