00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018 #ifndef __BOOKMARK_H__
00019 #define __BOOKMARK_H__
00020
00021 #include <qptrlist.h>
00022 #include <qmap.h>
00023 #include <qpopupmenu.h>
00024
00025 class CUTE;
00026 class CUTEView;
00027 class ScintillaBookmark;
00028
00030 class Bookmark
00031 {
00032 public:
00033 virtual int line() = 0;
00034 virtual QString file() = 0;
00035 virtual QString name() = 0;
00036 protected:
00037 QString __name;
00038 };
00039
00041 class ProjectBookmark : public Bookmark
00042 {
00043 public:
00044 ProjectBookmark( QString name, QString file, int line ) : __line(line)
00045 { __name = name; __file = file; }
00046 int line() { return __line; }
00047 QString file() { return __file; }
00048 virtual QString name() { return __name; }
00049 ScintillaBookmark *toScintillaBookmark();
00050 private:
00051 int __line;
00052 QString __file;
00053 };
00054
00056 class ScintillaBookmark : public Bookmark
00057 {
00058 public:
00059 ScintillaBookmark( QString name, CUTEView *view, int i, bool isHandle=false );
00060 int line();
00061 QString file();
00062 QString name();
00063 ProjectBookmark* toProjectBookmark();
00064 private:
00065 CUTEView *__view;
00066 int handle;
00067 };
00068
00070 class BookmarkManager : public QObject
00071 {
00072 Q_OBJECT
00073 public:
00074 BookmarkManager();
00076 void createMenu();
00078 QPtrList<Bookmark> bookmarks();
00080 void addBookmark( ProjectBookmark *bm );
00082 void removeBookmark( Bookmark *bm );
00084 Bookmark *menuBookmark( int id );
00086 void updateMenu();
00088 QPopupMenu *bookmarksMenu;
00090 void setBookmarks(CUTEView*);
00091 public slots:
00093 void viewClosed(CUTEView *);
00094 private:
00096 QMap <int, Bookmark*> idBookmarkMap;
00098 QPtrList<ProjectBookmark> projectBookmarks;
00100 CUTE *cute;
00101 };
00102
00103 extern BookmarkManager bookmarkManager;
00104
00105 #endif