KDevelop API Documentation

languages/cpp/debugger/variablewidget.h

Go to the documentation of this file.
00001 /*************************************************************************** 00002 begin : Sun Aug 8 1999 00003 copyright : (C) 1999 by John Birch 00004 email : jbb@kdevelop.org 00005 ***************************************************************************/ 00006 00007 /*************************************************************************** 00008 * * 00009 * This program is free software; you can redistribute it and/or modify * 00010 * it under the terms of the GNU General Public License as published by * 00011 * the Free Software Foundation; either version 2 of the License, or * 00012 * (at your option) any later version. * 00013 * * 00014 ***************************************************************************/ 00015 00016 #ifndef _VARIABLEWIDGET_H_ 00017 #define _VARIABLEWIDGET_H_ 00018 00019 #include <klistview.h> 00020 #include <kcombobox.h> 00021 #include <qwidget.h> 00022 #include <qtooltip.h> 00023 00024 class KLineEdit; 00025 00026 namespace GDBDebugger 00027 { 00028 00029 class TrimmableItem; 00030 class VarFrameRoot; 00031 class WatchRoot; 00032 class VarItem; 00033 class VariableTree; 00034 class DbgController; 00035 00036 enum { VarNameCol = 0, ValueCol = 1, VarTypeCol = 2}; 00037 enum DataType { typeUnknown, typeValue, typePointer, typeReference, 00038 typeStruct, typeArray, typeQString, typeWhitespace, 00039 typeName }; 00040 00041 class VariableWidget : public QWidget 00042 { 00043 Q_OBJECT 00044 00045 public: 00046 VariableWidget( QWidget *parent=0, const char *name=0 ); 00047 void clear(); 00048 00049 VariableTree *varTree() const 00050 { return varTree_; } 00051 00052 virtual void setEnabled(bool b); 00053 00054 public slots: 00055 void slotAddWatchVariable(); 00056 void slotAddWatchVariable(const QString &ident); 00057 00058 private: 00059 VariableTree *varTree_; 00060 // KLineEdit *watchVarEntry_; 00061 friend class VariableTree; 00062 00063 KHistoryCombo *watchVarEditor_; 00064 }; 00065 00066 /***************************************************************************/ 00067 /***************************************************************************/ 00068 /***************************************************************************/ 00069 00070 class VariableTree : public KListView, public QToolTip 00071 { 00072 Q_OBJECT 00073 00074 public: 00075 VariableTree( VariableWidget *parent, const char *name=0 ); 00076 virtual ~VariableTree(); 00077 00078 QListViewItem *lastChild() const; 00079 00080 int activeFlag() const { return activeFlag_; } 00081 void setActiveFlag() { activeFlag_++; } 00082 00083 QListViewItem *findRoot(QListViewItem *item) const; 00084 VarFrameRoot *findFrame(int frameNo, int threadNo) const; 00085 WatchRoot *findWatch(); 00086 void setCurrentThread(int currentThread) 00087 { currentThread_ = currentThread; } 00088 00089 // Remove items that are not active 00090 void trim(); 00091 void trimExcessFrames(); 00092 void setLocalViewState(bool localsOn, int frameNo, int threadNo); 00093 00094 // (from QToolTip) Display a tooltip when the cursor is over an item 00095 virtual void maybeTip(const QPoint &); 00096 00097 signals: 00098 void toggleWatchpoint(const QString &varName); 00099 void selectFrame(int frameNo, int threadNo); 00100 void expandItem(TrimmableItem *item); 00101 void expandUserItem(VarItem *item, const QCString &request); 00102 void setLocalViewState(bool localsOn); 00103 00104 // jw 00105 void varItemConstructed(VarItem *item); 00106 00107 public slots: 00108 void slotAddWatchVariable(const QString& watchVar); 00109 00110 private slots: 00111 void slotContextMenu(KListView *, QListViewItem *item); 00112 00113 // jw 00114 void slotDoubleClicked(QListViewItem *item, const QPoint &pos, int c); 00115 00116 private: 00117 int activeFlag_; 00118 int currentThread_; 00119 //DbgController *controller; 00120 00121 friend class VarFrameRoot; 00122 friend class VarItem; 00123 friend class WatchRoot; 00124 }; 00125 00126 /***************************************************************************/ 00127 /***************************************************************************/ 00128 /***************************************************************************/ 00129 00130 class TrimmableItem : public KListViewItem 00131 { 00132 public: 00133 TrimmableItem(VariableTree *parent); 00134 TrimmableItem(TrimmableItem *parent); 00135 00136 virtual ~TrimmableItem(); 00137 00138 virtual void trim(); 00139 virtual QString getName() const { return text(VarNameCol); } 00140 virtual TrimmableItem *findMatch(const QString& match, DataType type) const; 00141 QListViewItem *lastChild() const; 00142 int rootActiveFlag() const; 00143 void setActive() { activeFlag_ = rootActiveFlag(); } 00144 bool isActive() const { return activeFlag_ == rootActiveFlag(); } 00145 QString getValue() const { return text(ValueCol); } 00146 bool isTrimmable() const; 00147 void waitingForData () { waitingForData_ = true; } 00148 00149 virtual void updateValue(char */* buf */); 00150 virtual DataType getDataType() const; 00151 00152 virtual void setCache(const QCString& value); 00153 virtual QCString getCache(); 00154 virtual QString key( int column, bool ascending ) const; 00155 00156 // jw 00157 virtual void handleDoubleClicked(const QPoint &, int ) {} 00158 00159 protected: 00160 00161 void paintCell( QPainter *p, const QColorGroup &cg, 00162 int column, int width, int align ); 00163 00164 private: 00165 int activeFlag_; 00166 bool waitingForData_; 00167 }; 00168 00169 /***************************************************************************/ 00170 /***************************************************************************/ 00171 /***************************************************************************/ 00172 00173 class VarItem : public TrimmableItem 00174 { 00175 public: 00176 VarItem( TrimmableItem *parent, const QString &varName, DataType dataType ); 00177 00178 virtual ~VarItem(); 00179 00180 QString varPath() const; 00181 QString fullName() const; 00182 DataType getDataType() const; 00183 00184 void updateValue(char *data); 00185 00186 // jw 00187 void updateType(char *data); 00188 00189 void setCache(const QCString& value); 00190 QCString getCache(); 00191 00192 void setOpen(bool open); 00193 void setText (int column, const QString& text); 00194 00195 // jw - overriden from TrimmableItem to handle renaming 00196 void handleDoubleClicked(const QPoint &pos, int c); 00197 00198 // Returns the text to be displayed as tooltip (the value) 00199 QString tipText() const; 00200 00201 private: 00202 void checkForRequests(); 00203 void paintCell( QPainter *p, const QColorGroup &cg, 00204 int column, int width, int align ); 00205 00206 private: 00207 QCString cache_; 00208 DataType dataType_; 00209 bool highlight_; 00210 00211 // the non-cast type of the variable 00212 QCString originalValueType_; 00213 }; 00214 00215 /***************************************************************************/ 00216 /***************************************************************************/ 00217 /***************************************************************************/ 00218 00219 class VarFrameRoot : public TrimmableItem 00220 { 00221 public: 00222 VarFrameRoot(VariableTree *parent, int frameNo, int threadNo); 00223 virtual ~VarFrameRoot(); 00224 00225 void setLocals(char *locals); 00226 void setParams(char *params); 00227 void setOpen(bool open); 00228 00229 void setFrameName(const QString &frameName) 00230 { setText(VarNameCol, frameName); setText(ValueCol, ""); } 00231 00232 bool needLocals() const { return needLocals_; } 00233 bool matchDetails(int frameNo, int threadNo); 00234 00235 private: 00236 bool needLocals_; 00237 int frameNo_; 00238 int threadNo_; 00239 QCString params_; 00240 QCString locals_; 00241 }; 00242 00243 /***************************************************************************/ 00244 /***************************************************************************/ 00245 /***************************************************************************/ 00246 00247 class WatchRoot : public TrimmableItem 00248 { 00249 public: 00250 WatchRoot(VariableTree *parent); 00251 virtual ~WatchRoot(); 00252 00253 void requestWatchVars(); 00254 }; 00255 00256 /***************************************************************************/ 00257 /***************************************************************************/ 00258 /***************************************************************************/ 00259 00260 } 00261 00262 #endif
KDE Logo
This file is part of the documentation for KDevelop Version 3.0.4.
Documentation copyright © 1996-2004 the KDE developers.
Generated on Tue Oct 19 08:01:43 2004 by doxygen 1.3.7 written by Dimitri van Heesch, © 1997-2003