00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
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 QList<QPanel*> panels(const QString& type = QString()) const;
00067
00068 QAction* toggleViewAction(QPanel *p) const;
00069
00070 void sendPanelCommand( const QString& type,
00071 const char *signature,
00072 const QList<QGenericArgument>& args = Q_COMMAND);
00073
00074 static QCodeEdit* manager(QEditor *e);
00075 static QEditor* managed(const QString& f);
00076
00077 protected:
00078 QCodeEdit(QEditor *e, QPanelLayout *p);
00079 QCodeEdit(QEditor *e, const QString& l);
00080
00081 private:
00082 QPanelWatcher *m_watcher;
00083 QPointer<QEditor> m_editor;
00084 QPointer<QPanelLayout> m_layout;
00085
00086 QMenu *m_panelsMenu;
00087 QList<QAction*> m_actions;
00088
00089 static QList<QCodeEdit*> m_instances;
00090 };
00091
00092 #endif // _QCODE_EDIT_H_