KDbg 2.5.6.
[kdbg.git] / kdbg / winstack.h
blob134b2b919ab4b5ee5d6a06a8ed9121d774aed2be
1 /*
2 * Copyright Johannes Sixt
3 * This file is licensed under the GNU General Public License Version 2.
4 * See the file COPYING in the toplevel directory of the source directory.
5 */
7 #ifndef WINSTACK_H
8 #define WINSTACK_H
10 #include <QDialog>
11 #include <QLineEdit>
12 #include <QCheckBox>
13 #include <QPushButton>
14 #include <QHBoxLayout>
15 #include <QVBoxLayout>
16 #include <ktabwidget.h>
17 #include <list>
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 WinStack : public KTabWidget
55 Q_OBJECT
56 public:
57 WinStack(QWidget* parent);
58 virtual ~WinStack();
60 /**
61 * Slot activate also looks in this directory when the specified file is
62 * a relative path.
64 void setExtraDirectory(const QString& dir) { m_lastOpenDir = dir; }
65 void activateFile(const QString& fileName);
66 bool activeLine(QString& filename, int& lineNo);
67 bool activeLine(QString& filename, int& lineNo, DbgAddr& address);
68 bool hasWindows() const { return count() > 0; }
69 QString activeFileName() const;
70 SourceWindow* activeWindow() const;
71 SourceWindow* windowAt(int i) const;
73 virtual QSize sizeHint() const;
75 signals:
76 void toggleBreak(const QString&, int, const DbgAddr&, bool);
77 void enadisBreak(const QString&, int, const DbgAddr&);
78 void newFileLoaded();
79 void initiateValuePopup(const QString&);
80 void disassemble(const QString&, int);
81 void setTabWidth(int numChars);
82 void moveProgramCounter(const QString&, int, const DbgAddr&);
84 public slots:
85 virtual void slotFindForward();
86 virtual void slotFindBackward();
87 virtual void activate(const QString& filename, int lineNo, const DbgAddr& address);
88 void updatePC(const QString& filename, int lineNo, const DbgAddr& address, int frameNo);
89 void reloadAllFiles();
90 void updateLineItems(const KDebugger* deb);
91 void slotSetTabWidth(int numChars);
93 void slotFileReload();
94 void slotViewFind();
95 void slotBrkptSet();
96 void slotBrkptSetTemp();
97 void slotBrkptEnable();
98 void slotMoveProgramCounter();
99 void slotClose();
101 // Displays the value tip at m_tipLocation
102 void slotShowValueTip(const QString& tipText);
104 // Shows the disassembled code at the location given by file and lineNo
105 void slotDisassembled(const QString& fileName, int lineNo,
106 const std::list<DisassembledCode>& disass);
108 // Updates line items after expanding/collapsing disassembled code
109 void slotExpandCollapse(int lineNo);
111 protected:
112 bool activatePath(QString pathname, int lineNo, const DbgAddr& address);
113 virtual bool activateWindow(SourceWindow* fw, int lineNo, const DbgAddr& address); /* -1 doesnt change line */
114 virtual void contextMenuEvent(QContextMenuEvent* e);
115 virtual bool event(QEvent* event);
116 void setPC(bool set, const QString& fileName, int lineNo,
117 const DbgAddr& address, int frameNo);
118 SourceWindow* findByFileName(const QString& fileName) const;
119 QString m_lastOpenDir; /* where user opened last file */
121 // program counter
122 QString m_pcFile;
123 int m_pcLine; /* -1 if no PC */
124 QString m_pcAddress; /* exact address of PC */
125 int m_pcFrame;
127 QPoint m_tipLocation; /* where tip should appear */
128 QRect m_tipRegion; /* where tip should remain */
130 int m_tabWidth; /* number of chars */
132 public:
133 // find dialog
134 FindDialog m_findDlg;
137 #endif // WINSTACK_H