QCodeEdit
2.2
|
00001 /**************************************************************************** 00002 ** 00003 ** Copyright (C) 2006-2009 fullmetalcoder <fullmetalcoder@hotmail.fr> 00004 ** 00005 ** This file is part of the Edyuk project <http://edyuk.org> 00006 ** 00007 ** This file may be used under the terms of the GNU General Public License 00008 ** version 3 as published by the Free Software Foundation and appearing in the 00009 ** file GPL.txt included in the packaging of this file. 00010 ** 00011 ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE 00012 ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. 00013 ** 00014 ****************************************************************************/ 00015 00016 #ifndef _QCODE_EDIT_H_ 00017 #define _QCODE_EDIT_H_ 00018 00019 #include "qce-config.h" 00020 00026 #include <QList> 00027 #include <QPointer> 00028 #include <QGenericArgument> 00029 00030 class QMenu; 00031 class QPanel; 00032 class QEditor; 00033 class QWidget; 00034 class QString; 00035 class QAction; 00036 class QPanelLayout; 00037 class QPanelWatcher; 00038 00039 #define Q_COMMAND QList<QGenericArgument>() 00040 00041 class QCE_EXPORT QCodeEdit 00042 { 00043 friend class QPanelWatcher; 00044 00045 public: 00046 enum Position 00047 { 00048 West, 00049 North, 00050 South, 00051 East 00052 }; 00053 00054 QCodeEdit(QWidget *p = 0); 00055 QCodeEdit(bool actions, QWidget *p = 0); 00056 QCodeEdit(const QString& layout, QWidget *p = 0); 00057 QCodeEdit(const QString& layout, bool actions, QWidget *p = 0); 00058 virtual ~QCodeEdit(); 00059 00060 QEditor* editor() const; 00061 QPanelLayout* panelLayout() const; 00062 00063 QAction* addPanel(QPanel *panel, Position pos, bool _add = false); 00064 QAction* addPanel(const QString& name, Position pos, bool _add = false); 00065 00066 bool hasPanel(const QString& type) const; 00067 QList<QPanel*> panels(const QString& type = QString()) const; 00068 00069 QAction* toggleViewAction(QPanel *p) const; 00070 00071 void sendPanelCommand( const QString& type, 00072 const char *signature, 00073 const QList<QGenericArgument>& args = Q_COMMAND); 00074 00075 static QCodeEdit* manager(QEditor *e); 00076 static QEditor* managed(const QString& f); 00077 00078 //protected: 00079 QCodeEdit(QEditor *e, QPanelLayout *p); 00080 QCodeEdit(QEditor *e, const QString& l); 00081 00082 private: 00083 QPanelWatcher *m_watcher; 00084 QPointer<QEditor> m_editor; 00085 QPointer<QPanelLayout> m_layout; 00086 00087 QMenu *m_panelsMenu; 00088 QList<QAction*> m_actions; 00089 00090 static QList<QCodeEdit*> m_instances; 00091 }; 00092 00093 #endif // _QCODE_EDIT_H_