Upgraded the build system for KDE2.
[kdbg.git] / kdbg / winstack.h
bloba1d6d8bab4feb9d1ee63e433c4bbe18fc4b1ce6d
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 <qlist.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>
18 // forward declarations
19 class KDebugger;
20 class WinStack;
21 class SourceWindow;
22 class DisassembledCode;
23 struct DbgAddr;
25 class FindDialog : public QDialog
27 Q_OBJECT
28 public:
29 FindDialog();
30 ~FindDialog();
32 bool caseSensitive() const { return m_caseCheck.isChecked(); }
33 QString searchText() const { return m_searchText.text(); }
34 virtual void done(int result);
36 QLineEdit m_searchText;
37 QCheckBox m_caseCheck;
38 QPushButton m_buttonForward;
39 QPushButton m_buttonBackward;
40 QPushButton m_buttonClose;
42 signals:
43 void closed();
45 protected:
46 virtual void closeEvent(QCloseEvent* ev);
47 QVBoxLayout m_layout;
48 QHBoxLayout m_buttons;
52 class ValueTip : public QToolTip
54 public:
55 ValueTip(WinStack* parent);
56 virtual void maybeTip(const QPoint& p);
57 void tip(const QRect& r, const QString& s) { QToolTip::tip(r, s); }
61 class WinStack : public QWidget
63 Q_OBJECT
64 public:
65 WinStack(QWidget* parent, const char* name);
66 virtual ~WinStack();
68 /**
69 * The menu set with setWindowMenu will be modified by this widget to
70 * list the available windows. The specified popup menu must be set up
71 * to contain an entry with ID_WINDOW_MORE. The windows will be inserted
72 * before this entry.
74 void setWindowMenu(QPopupMenu* menu);
75 void selectWindow(int index); /* 1-based index, 0 means dialog More... */
76 /**
77 * Slot activate also looks in this directory when the specified file is
78 * a relative path.
80 void setExtraDirectory(const QString& dir) { m_lastOpenDir = dir; }
81 void activateFile(const QString& fileName);
82 bool activeLine(QString& filename, int& lineNo);
83 bool activeLine(QString& filename, int& lineNo, DbgAddr& address);
84 void maybeTip(const QPoint& p);
86 virtual void resizeEvent(QResizeEvent*);
88 signals:
89 void fileChanged();
90 void lineChanged();
91 void toggleBreak(const QString&, int, const DbgAddr&, bool);
92 void enadisBreak(const QString&, int, const DbgAddr&);
93 void clickedRight(const QPoint&);
94 void newFileLoaded();
95 void initiateValuePopup(const QString&);
96 void disassemble(const QString&, int);
97 void setTabWidth(int numChars);
99 public slots:
100 virtual void menuCallback(int item);
101 virtual void slotFindForward();
102 virtual void slotFindBackward();
103 virtual void slotFileWindowRightClick(const QPoint &);
104 virtual void activate(const QString& filename, int lineNo, const DbgAddr& address);
105 void updatePC(const QString& filename, int lineNo, const DbgAddr& address, int frameNo);
106 void reloadAllFiles();
107 void updateLineItems(const KDebugger* deb);
108 void slotSetTabWidth(int numChars);
110 // Right click on file panner when no file is loaded.
111 virtual void slotWidgetRightClick(const QPoint &);
113 // Displays the value tip at m_tipLocation
114 void slotShowValueTip(const QString& tipText);
116 // Shows the disassembled code at the location given by file and lineNo
117 void slotDisassembled(const QString& fileName, int lineNo,
118 const QList<DisassembledCode>& disass);
120 // Updates line items after expanding/collapsing disassembled code
121 void slotExpandCollapse(int lineNo);
123 protected:
124 void initMenu();
125 bool activatePath(QString pathname, int lineNo, const DbgAddr& address);
126 virtual bool activateWindow(SourceWindow* fw, int lineNo, const DbgAddr& address); /* -1 doesnt change line */
127 virtual void changeWindowMenu();
128 virtual void mousePressEvent(QMouseEvent*);
129 void setPC(bool set, const QString& fileName, int lineNo,
130 const DbgAddr& address, int frameNo);
131 QList<SourceWindow> m_fileList;
132 SourceWindow* m_activeWindow;
133 QString m_lastOpenDir; /* where user opened last file */
134 QPopupMenu* m_windowMenu;
135 int m_itemMore;
136 QString m_textMore;
138 // program counter
139 QString m_pcFile;
140 int m_pcLine; /* -1 if no PC */
141 QString m_pcAddress; /* exact address of PC */
142 int m_pcFrame;
144 ValueTip m_valueTip;
145 QRect m_tipLocation; /* where tip should appear */
147 int m_tabWidth; /* number of chars */
149 public:
150 // find dialog
151 FindDialog m_findDlg;
153 // Popup menu
154 QPopupMenu m_menuFloat;
155 QPopupMenu m_menuFileFloat;
158 #endif // WINSTACK_H