Merge branch 'maint'
[kdbg.git] / kdbg / winstack.h
blob065de3c2ff9fa230c28bc4874516c2707b211a97
1 // $Id$
3 // Copyright by Johannes Sixt
4 // This file is under GPL, the GNU General Public Licence
6 #ifndef WINSTACK_H
7 #define WINSTACK_H
9 #include <qptrlist.h>
10 #include <qdialog.h>
11 #include <qlineedit.h>
12 #include <qlayout.h>
13 #include <qcheckbox.h>
14 #include <qpushbutton.h>
15 #include <qpopupmenu.h>
16 #include <qtooltip.h>
17 #include "valarray.h"
19 // forward declarations
20 class KDebugger;
21 class WinStack;
22 class SourceWindow;
23 class DisassembledCode;
24 struct DbgAddr;
26 class FindDialog : public QDialog
28 Q_OBJECT
29 public:
30 FindDialog();
31 ~FindDialog();
33 bool caseSensitive() const { return m_caseCheck.isChecked(); }
34 QString searchText() const { return m_searchText.text(); }
35 virtual void done(int result);
37 QLineEdit m_searchText;
38 QCheckBox m_caseCheck;
39 QPushButton m_buttonForward;
40 QPushButton m_buttonBackward;
41 QPushButton m_buttonClose;
43 signals:
44 void closed();
46 protected:
47 virtual void closeEvent(QCloseEvent* ev);
48 QVBoxLayout m_layout;
49 QHBoxLayout m_buttons;
53 class ValueTip : public QToolTip
55 public:
56 ValueTip(WinStack* parent);
57 virtual ~ValueTip() {} // Qt3's QToolTip lacks virtual dtor!
58 virtual void maybeTip(const QPoint& p);
59 void tip(const QRect& r, const QString& s) { QToolTip::tip(r, s); }
63 class WinStack : public QWidget
65 Q_OBJECT
66 public:
67 WinStack(QWidget* parent, const char* name);
68 virtual ~WinStack();
70 enum { WindowMore=0x100, WindowMask=0xf };
72 /**
73 * The menu set with setWindowMenu will be modified by this widget to
74 * list the available windows. The specified popup menu must be set up
75 * to contain an entry with ID WindowMore. The windows will be inserted
76 * before this entry.
78 void setWindowMenu(QPopupMenu* menu);
79 /**
80 * Slot activate also looks in this directory when the specified file is
81 * a relative path.
83 void setExtraDirectory(const QString& dir) { m_lastOpenDir = dir; }
84 void activateFile(const QString& fileName);
85 bool activeLine(QString& filename, int& lineNo);
86 bool activeLine(QString& filename, int& lineNo, DbgAddr& address);
87 void maybeTip(const QPoint& p);
88 bool hasWindows() const { return m_fileList.size() > 0; }
89 QString activeFileName() const;
91 virtual QSize sizeHint() const;
92 virtual void resizeEvent(QResizeEvent*);
94 signals:
95 void fileChanged();
96 void lineChanged();
97 void toggleBreak(const QString&, int, const DbgAddr&, bool);
98 void enadisBreak(const QString&, int, const DbgAddr&);
99 void newFileLoaded();
100 void initiateValuePopup(const QString&);
101 void disassemble(const QString&, int);
102 void setTabWidth(int numChars);
103 void moveProgramCounter(const QString&, int, const DbgAddr&);
105 public slots:
106 void selectWindow(int id); /* 1-based index, 0 means dialog More... */
107 virtual void slotFindForward();
108 virtual void slotFindBackward();
109 virtual void activate(const QString& filename, int lineNo, const DbgAddr& address);
110 void updatePC(const QString& filename, int lineNo, const DbgAddr& address, int frameNo);
111 void reloadAllFiles();
112 void updateLineItems(const KDebugger* deb);
113 void slotSetTabWidth(int numChars);
115 void slotFileReload();
116 void slotViewFind();
117 void slotBrkptSet();
118 void slotBrkptSetTemp();
119 void slotBrkptEnable();
120 void slotMoveProgramCounter();
122 // Displays the value tip at m_tipLocation
123 void slotShowValueTip(const QString& tipText);
125 // Shows the disassembled code at the location given by file and lineNo
126 void slotDisassembled(const QString& fileName, int lineNo,
127 const QList<DisassembledCode>& disass);
129 // Updates line items after expanding/collapsing disassembled code
130 void slotExpandCollapse(int lineNo);
132 protected:
133 bool activatePath(QString pathname, int lineNo, const DbgAddr& address);
134 virtual bool activateWindow(SourceWindow* fw, int lineNo, const DbgAddr& address); /* -1 doesnt change line */
135 virtual void changeWindowMenu();
136 virtual void contextMenuEvent(QContextMenuEvent* e);
137 void setPC(bool set, const QString& fileName, int lineNo,
138 const DbgAddr& address, int frameNo);
139 ValArray<SourceWindow*> m_fileList;
140 SourceWindow* m_activeWindow;
141 QString m_lastOpenDir; /* where user opened last file */
142 QPopupMenu* m_windowMenu;
144 // program counter
145 QString m_pcFile;
146 int m_pcLine; /* -1 if no PC */
147 QString m_pcAddress; /* exact address of PC */
148 int m_pcFrame;
150 ValueTip m_valueTip;
151 QRect m_tipLocation; /* where tip should appear */
153 int m_tabWidth; /* number of chars */
155 public:
156 // find dialog
157 FindDialog m_findDlg;
160 #endif // WINSTACK_H