variablewidget.h
Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018 #ifndef _VARIABLEWIDGET_H_
00019 #define _VARIABLEWIDGET_H_
00020
00021 #include <klistview.h>
00022 #include <qwidget.h>
00023
00024 class KLineEdit;
00025
00026 namespace JAVADebugger
00027 {
00028
00029 enum { VarNameCol = 0, ValueCol = 1 };
00030 enum DataType { typeUnknown, typeValue, typePointer, typeReference,
00031 typeStruct, typeArray, typeQString, typeWhitespace,
00032 typeName };
00033
00034 class FrameRoot;
00035 class WatchRoot;
00036 class VarItem;
00037 class VariableTree;
00038 class DbgController;
00039
00040 class VariableWidget : public QWidget
00041 {
00042 Q_OBJECT
00043
00044 public:
00045 VariableWidget( QWidget *parent=0, const char *name=0 );
00046 void clear();
00047
00048 VariableTree *varTree() const
00049 { return varTree_; }
00050
00051 private slots:
00052 void slotAddWatchVariable();
00053
00054 private:
00055 VariableTree *varTree_;
00056 KLineEdit *watchVarEntry_;
00057 friend class VariableTree;
00058 };
00059
00060
00061
00062
00063
00064 class VariableTree : public KListView
00065 {
00066 Q_OBJECT
00067
00068 public:
00069 VariableTree( VariableWidget *parent, const char *name=0 );
00070 virtual ~VariableTree();
00071
00072 QListViewItem *lastChild() const;
00073
00074 int activeFlag() const { return activeFlag_; }
00075 void setActiveFlag() { activeFlag_++; }
00076
00077 QListViewItem *findRoot(QListViewItem *item) const;
00078 FrameRoot *findFrame(int frameNo) const;
00079 WatchRoot *findWatch();
00080
00081
00082 void trim();
00083 void trimExcessFrames();
00084 void setLocalViewState(bool localsOn, int frameNo);
00085
00086 signals:
00087 void toggleWatchpoint(const QString &varName);
00088 void selectFrame(int frameNo);
00089 void expandItem(VarItem *item);
00090 void expandUserItem(VarItem *item, const QCString &request);
00091 void setLocalViewState(bool localsOn);
00092
00093 public slots:
00094 void slotAddWatchVariable(const QString& watchVar);
00095
00096 private slots:
00097 void slotContextMenu(KListView *, QListViewItem *item);
00098
00099 private:
00100 int activeFlag_;
00101 DbgController *controller;
00102
00103 friend class VarItem;
00104 friend class WatchRoot;
00105 };
00106
00107
00108
00109
00110
00111 class TrimmableItem : public QListViewItem
00112 {
00113 public:
00114 TrimmableItem(VariableTree *parent);
00115 TrimmableItem(TrimmableItem *parent);
00116
00117 virtual ~TrimmableItem();
00118
00119 virtual void trim();
00120 virtual QString getName() const { return QString(text(VarNameCol)); }
00121 virtual TrimmableItem *findMatch(const QString& match, DataType type) const;
00122 QListViewItem *lastChild() const;
00123 int rootActiveFlag() const;
00124 void setActive() { activeFlag_ = rootActiveFlag(); }
00125 bool isActive() const { return activeFlag_ == rootActiveFlag(); }
00126 QString getValue() const { return QString(text(ValueCol)); }
00127 bool isTrimmable() const;
00128 void waitingForData () { waitingForData_ = true; }
00129
00130 virtual void updateValue(char *);
00131 virtual DataType getDataType() const;
00132
00133 virtual void setCache(const QCString& value);
00134 virtual QCString getCache();
00135 virtual QString key( int column, bool ascending ) const;
00136
00137 private:
00138 int activeFlag_;
00139 bool waitingForData_;
00140 };
00141
00142
00143
00144
00145
00146 class VarItem : public TrimmableItem
00147 {
00148 public:
00149 VarItem( TrimmableItem *parent, const QString &varName, DataType dataType );
00150
00151 virtual ~VarItem();
00152
00153 QString varPath() const;
00154 QString fullName() const;
00155 DataType getDataType() const;
00156
00157 void updateValue(char *data);
00158
00159 void setCache(const QCString& value);
00160 QCString getCache();
00161
00162 void setOpen(bool open);
00163 void setText (int column, const QString& text);
00164
00165 private:
00166 void checkForRequests();
00167 void paintCell( QPainter *p, const QColorGroup &cg,
00168 int column, int width, int align );
00169
00170 private:
00171 QCString cache_;
00172 DataType dataType_;
00173 bool highlight_;
00174 };
00175
00176
00177
00178
00179
00180 class FrameRoot : public TrimmableItem
00181 {
00182 public:
00183 FrameRoot(VariableTree *parent, int frameNo);
00184 virtual ~FrameRoot();
00185
00186 void setLocals(char *locals);
00187 void addLocal(QString name, QString type, QString value);
00188 void setParams(const QCString& params);
00189
00190 void setOpen(bool open);
00191
00192 int getFrameNo() const { return frameNo_; }
00193 void setFrameName(const QString &frameName) { setText(VarNameCol, frameName); setText(ValueCol, ""); }
00194
00195 bool needLocals() const { return needLocals_; }
00196
00197 private:
00198 bool needLocals_;
00199 int frameNo_;
00200 QCString params_;
00201 QCString locals_;
00202 };
00203
00204
00205
00206
00207
00208 class WatchRoot : public TrimmableItem
00209 {
00210 public:
00211 WatchRoot(VariableTree *parent);
00212 virtual ~WatchRoot();
00213
00214 void requestWatchVars();
00215 };
00216
00217
00218
00219
00220 }
00221
00222 #endif
This file is part of the documentation for KDevelop Version 3.1.2.