itom 2.0.0
D:/git-itom/sources/itom/Qitom/widgets/abstractPyScintillaWidget.h
00001 /* ********************************************************************
00002     itom software
00003     URL: http://www.uni-stuttgart.de/ito
00004     Copyright (C) 2013, Institut für Technische Optik (ITO),
00005     Universität Stuttgart, Germany
00006 
00007     This file is part of itom.
00008   
00009     itom is free software; you can redistribute it and/or modify it
00010     under the terms of the GNU Library General Public Licence as published by
00011     the Free Software Foundation; either version 2 of the Licence, or (at
00012     your option) any later version.
00013 
00014     itom is distributed in the hope that it will be useful, but
00015     WITHOUT ANY WARRANTY; without even the implied warranty of
00016     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Library
00017     General Public Licence for more details.
00018 
00019     You should have received a copy of the GNU Library General Public License
00020     along with itom. If not, see <http://www.gnu.org/licenses/>.
00021 *********************************************************************** */
00022 
00023 #ifndef ABSTRACTPYSCINTILLAWIDGET
00024 #define ABSTRACTPYSCINTILLAWIDGET
00025 
00026 #include "../common/sharedStructures.h"
00027 
00028 // Under Windows, define QSCINTILLA_MAKE_DLL to create a Scintilla DLL, or
00029 // define QSCINTILLA_DLL to link against a Scintilla DLL, or define neither
00030 // to either build or link against a static Scintilla library.
00032 #define QSCINTILLA_DLL  //http://www.riverbankcomputing.com/pipermail/qscintilla/2007-March/000034.html
00033 
00034 #include <Qsci/qsciscintilla.h>
00035 #include <Qsci/qscilexerpython.h>
00036 #include <Qsci/qsciapis.h>
00037 #include <qevent.h>
00038 #include "../organizer/qsciApiManager.h"
00039 #include <qstringlist.h>
00040 #include <qrect.h>
00041 
00042 namespace ito {
00043 
00044 class AbstractPyScintillaWidget : public QsciScintilla
00045 {
00046     Q_OBJECT //-> see: #define QSCINTILLA_DLL  //http://www.riverbankcomputing.com/pipermail/qscintilla/2007-March/000034.html in sharedStructures.h
00047 
00048 public:
00049     AbstractPyScintillaWidget(QWidget* parent = NULL);
00050     ~AbstractPyScintillaWidget();
00051 
00052     QString getWordAtPosition(const int &line, const int &index);
00053 
00054 protected:
00055 
00056     enum tUserSelectionState { selNo, selRange };
00057 
00058     void init();
00059     //bool event ( QEvent * event );
00060 
00061     virtual void loadSettings(); //overwrite this method if you want to load further settings
00062 
00063 //    void mouseReleaseEvent(QMouseEvent * event);
00064 //    void keyReleaseEvent(QKeyEvent * event);
00065     void checkUserSelectionState();
00066 
00067     tUserSelectionState m_userSelectionState;
00068 
00069 private:
00070     QsciLexerPython* qSciLex;
00071     QsciApiManager *m_pApiManager;
00072 
00073     QStringList m_installedApiFiles;
00074     bool m_textIndicatorActive;
00075     int m_textIndicatorNr; //number of indicator which marks all appearances of the currently selected text
00076     
00077 
00078 
00079 public slots:
00080     void selectionChanged();
00081     void reloadSettings() { loadSettings(); };
00082 
00083 signals:
00084     void userSelectionChanged(int lineFrom, int indexFrom, int lineTo, int indexTo);
00085 
00086 };
00087 
00088 } //end namespace ito
00089 
00090 #endif
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Friends