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 #ifndef _VARIABLEWIDGET_H_
00017 #define _VARIABLEWIDGET_H_
00018
00019 #include "gdbcontroller.h"
00020
00021 #include <klistview.h>
00022 #include <kcombobox.h>
00023 #include <qwidget.h>
00024 #include <qtooltip.h>
00025
00026 class KLineEdit;
00027
00028 namespace GDBDebugger
00029 {
00030
00031 class TrimmableItem;
00032 class VarFrameRoot;
00033 class WatchRoot;
00034 class VarItem;
00035 class VariableTree;
00036 class DbgController;
00037
00038 enum { VarNameCol = 0, ValueCol = 1, VarTypeCol = 2};
00039 enum DataType { typeUnknown, typeValue, typePointer, typeReference,
00040 typeStruct, typeArray, typeQString, typeWhitespace,
00041 typeName };
00042
00043 class VariableWidget : public QWidget
00044 {
00045 Q_OBJECT
00046
00047 public:
00048 VariableWidget( QWidget *parent=0, const char *name=0 );
00049 void clear();
00050
00051 VariableTree *varTree() const
00052 { return varTree_; }
00053
00054 virtual void setEnabled(bool b);
00055
00056 protected:
00057 virtual void focusInEvent(QFocusEvent *e);
00058
00059 public slots:
00060 void slotAddWatchVariable();
00061 void slotAddWatchVariable(const QString &ident);
00062
00063 private:
00064 VariableTree *varTree_;
00065
00066 friend class VariableTree;
00067
00068 KHistoryCombo *watchVarEditor_;
00069 };
00070
00071
00072
00073
00074
00075 class VariableTree : public KListView, public QToolTip
00076 {
00077 Q_OBJECT
00078
00079 friend class TrimmableItem;
00080
00081 public:
00082 VariableTree( VariableWidget *parent, const char *name=0 );
00083 virtual ~VariableTree();
00084
00085 QListViewItem *lastChild() const;
00086
00087 int activeFlag() const { return activeFlag_; }
00088 void setActiveFlag() { activeFlag_++; }
00089 void setRadix(int r) { iOutRadix=r; }
00090
00091 QListViewItem *findRoot(QListViewItem *item) const;
00092 VarFrameRoot *findFrame(int frameNo, int threadNo) const;
00093 WatchRoot *findWatch();
00094 void setCurrentThread(int currentThread)
00095 { currentThread_ = currentThread; }
00096
00097
00098 void trim();
00099 void trimExcessFrames();
00100 void setLocalViewState(bool localsOn, int frameNo, int threadNo);
00101
00102
00103 virtual void maybeTip(const QPoint &);
00104
00105 signals:
00106 void toggleWatchpoint(const QString &varName);
00107 void selectFrame(int frameNo, int threadNo);
00108 void expandItem(TrimmableItem *item);
00109 void expandUserItem(VarItem *item, const QCString &request);
00110 void setLocalViewState(bool localsOn);
00111
00112
00113 void varItemConstructed(VarItem *item);
00114
00115
00116 void toggleRadix(QListViewItem *item);
00117 public slots:
00118 void slotAddWatchVariable(const QString& watchVar);
00119
00120
00121 void slotToggleRadix(QListViewItem *item);
00122
00123 private slots:
00124 void slotContextMenu(KListView *, QListViewItem *item);
00125
00126
00127 void slotDoubleClicked(QListViewItem *item, const QPoint &pos, int c);
00128
00129 private:
00130 int activeFlag_;
00131 int currentThread_;
00132 int iOutRadix;
00133
00134
00135 friend class VarFrameRoot;
00136 friend class VarItem;
00137 friend class WatchRoot;
00138 };
00139
00140
00141
00142
00143
00144 class TrimmableItem : public KListViewItem
00145 {
00146 public:
00147 TrimmableItem(VariableTree *parent);
00148 TrimmableItem(TrimmableItem *parent);
00149
00150 virtual ~TrimmableItem();
00151
00152 virtual void trim();
00153 virtual QString getName() const { return text(VarNameCol); }
00154 virtual TrimmableItem *findMatch(const QString& match, DataType type) const;
00155 QListViewItem *lastChild() const;
00156 int rootActiveFlag() const;
00157 void setActive() { activeFlag_ = rootActiveFlag(); }
00158 bool isActive() const { return activeFlag_ == rootActiveFlag(); }
00159 QString getValue() const { return text(ValueCol); }
00160 bool isTrimmable() const;
00161 void waitingForData () { waitingForData_ = true; }
00162
00163 virtual void updateValue(char *);
00164 virtual DataType getDataType() const;
00165
00166 virtual void setCache(const QCString& value);
00167 virtual QCString getCache();
00168 virtual QString key( int column, bool ascending ) const;
00169
00170
00171 virtual void handleDoubleClicked(const QPoint &, int ) {}
00172
00173 protected:
00174
00175 void paintCell( QPainter *p, const QColorGroup &cg,
00176 int column, int width, int align );
00177
00178 private:
00179 int activeFlag_;
00180 bool waitingForData_;
00181 };
00182
00183
00184
00185
00186
00187 class VarItem : public TrimmableItem
00188 {
00189 public:
00190 VarItem( TrimmableItem *parent, const QString &varName, DataType dataType );
00191
00192 virtual ~VarItem();
00193
00194 QString varPath() const;
00195 QString fullName() const;
00196 DataType getDataType() const;
00197
00198 void updateValue(char *data);
00199
00200
00201 void updateType(char *data);
00202
00203 void setCache(const QCString& value);
00204 QCString getCache();
00205
00206 void setOpen(bool open);
00207 void setText (int column, const QString& text);
00208
00209
00210 void handleDoubleClicked(const QPoint &pos, int c);
00211
00212
00213 QString tipText() const;
00214
00215 private:
00216 void checkForRequests();
00217 void paintCell( QPainter *p, const QColorGroup &cg,
00218 int column, int width, int align );
00219
00220 private:
00221 QCString cache_;
00222 DataType dataType_;
00223 bool highlight_;
00224
00225
00226 QCString originalValueType_;
00227 };
00228
00229
00230
00231
00232
00233 class VarFrameRoot : public TrimmableItem
00234 {
00235 public:
00236 VarFrameRoot(VariableTree *parent, int frameNo, int threadNo);
00237 virtual ~VarFrameRoot();
00238
00239 void setLocals(char *locals);
00240 void setParams(char *params);
00241 void setOpen(bool open);
00242
00243 void setFrameName(const QString &frameName)
00244 { setText(VarNameCol, frameName); setText(ValueCol, ""); }
00245
00246 bool needLocals() const { return needLocals_; }
00247 bool matchDetails(int frameNo, int threadNo);
00248
00249 private:
00250 bool needLocals_;
00251 int frameNo_;
00252 int threadNo_;
00253 QCString params_;
00254 QCString locals_;
00255 };
00256
00257
00258
00259
00260
00261 class WatchRoot : public TrimmableItem
00262 {
00263 public:
00264 WatchRoot(VariableTree *parent);
00265 virtual ~WatchRoot();
00266
00267 void requestWatchVars();
00268 };
00269
00270
00271
00272
00273
00274 }
00275
00276 #endif
This file is part of the documentation for KDevelop Version 3.1.2.