parts/sourcenav/sourcenav_part.h
Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
#ifndef __KDEVPART_SOURCENAV_H__
00014
#define __KDEVPART_SOURCENAV_H__
00015
00016
#include <qvaluelist.h>
00017
00018
#include <kdevplugin.h>
00019
#include <kurl.h>
00020
00021
namespace KParts {
00022
class Part;
00023 };
00024
00025
class KAction;
00026
class KToolBarPopupAction;
00027
class QPopupMenu;
00028
00029 class Anchor
00030 {
00031
public:
00032 Anchor()
00033 {
00034
_id = -1;
00035
_line =
_col = 0;
00036 }
00037 Anchor(
KURL url, uint line = 0, uint col = 0 )
00038 {
00039
_url = url;
00040
_line = line;
00041
_col = col;
00042
_id =
nextID();
00043 }
00044 KURL url()
const {
return _url; }
00045 uint
line()
const {
return _line; }
00046 uint
col()
const {
return _col; }
00047 int id()
const {
return _id; }
00048 bool isValid()
const {
return _id != -1; }
00049
00050
private:
00051 KURL _url;
00052 uint
_line,
_col;
00053 int _id;
00054
static int nextID();
00055 };
00056
00057 typedef QValueList<Anchor> AnchorList;
00058
00059 class SourceNavPart :
public KDevPlugin
00060 {
00061 Q_OBJECT
00062
00063
public:
00064
00065
SourceNavPart(
QObject *parent,
const char *name,
const QStringList&);
00066
~SourceNavPart();
00067
00068
public slots:
00069
void slotNavForward();
00070
void slotNavBack();
00071
00072
private slots:
00073
void slotPartAdded(
KParts::Part *part );
00074
void slotTextChanged();
00075
void fillBackPopup();
00076
void fillForwardPopup();
00077
void backPopupClicked(
int id );
00078
void forwardPopupClicked(
int id );
00079
00080
private:
00081
Anchor getCurrentPos();
00082
void gotoPos(
const Anchor& ankh );
00083
bool isNearby(
const Anchor& pos1,
const Anchor& pos2 );
00084
void enableActions();
00085
void navigate(
AnchorList& list1,
AnchorList& list2 );
00086
void navigate(
int id,
AnchorList& list1,
AnchorList& list2 );
00087
void fillPopup(
const AnchorList& list,
QPopupMenu* pop );
00088
void cleanupList(
AnchorList& list );
00089
00090 KToolBarPopupAction *
navForward, *
navBack;
00091 AnchorList navList;
00092 AnchorList forwardList;
00093 bool backPopupVisible,
forwardPopupVisible;
00094 };
00095
00096
00097
#endif
00098
This file is part of the documentation for KDevelop Version 3.0.4.