snippet_widget.h
Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009 #ifndef __SNIPPET_WIDGET_H__
00010 #define __SNIPPET_WIDGET_H__
00011
00012 #include <qwidget.h>
00013 #include <qstring.h>
00014 #include <klistview.h>
00015 #include <qtooltip.h>
00016 #include <qrect.h>
00017
00018 #include <ktexteditor/editinterface.h>
00019 #include <ktexteditor/view.h>
00020 #include <snippetconfig.h>
00021
00022 class KDevProject;
00023 class SnippetPart;
00024 class QPushButton;
00025 class KListView;
00026 class QListViewItem;
00027 class QPoint;
00028 class SnippetDlg;
00029 class SnippetItem;
00030 class KTextEdit;
00031 class KConfig;
00032
00033
00040 class SnippetWidget : public KListView, public QToolTip
00041 {
00042 Q_OBJECT
00043
00044 public:
00045
00046 SnippetWidget(SnippetPart *part);
00047 ~SnippetWidget();
00048 QPtrList<SnippetItem> * getList() { return (&_list); }
00049 void writeConfig();
00050 void initConfig();
00051 SnippetConfig * getSnippetConfig() { return (&_SnippetConfig); }
00052
00053
00054 protected:
00055 SnippetPart * m_part;
00056 SnippetDlg * m_dialog;
00057 void maybeTip( const QPoint & );
00058 bool acceptDrag (QDropEvent *event) const;
00059
00060 private:
00061 void insertIntoActiveView(QString text);
00062 QString parseText(QString text, QString del="$");
00063 bool showMultiVarDialog(QMap<QString, QString> * map, QMap<QString, QString> * mapSave,
00064 int & iWidth, int & iBasicHeight, int & iOneHeight);
00065 QString showSingleVarDialog(QString var, QMap<QString, QString> * mapSave, QRect & dlgSize);
00066
00067 QPtrList<SnippetItem> _list;
00068 QMap<QString, QString> _mapSaved;
00069 KConfig * _cfg;
00070 SnippetConfig _SnippetConfig;
00071
00072 public slots:
00073 void slotRemove();
00074 void slotEdit();
00075 void slotAdd();
00076
00077 protected slots:
00078 void showPopupMenu( QListViewItem * item, const QPoint & p, int );
00079 void slotListDblClicked(QListViewItem * item, const QPoint & pos, int c);
00080 void slotDropped(QDropEvent *e, QListViewItem *after);
00081 };
00082
00083
00084 #endif
This file is part of the documentation for KDevelop Version 3.1.2.