Use the standard icon for the Find dialog toolbar button.
[kdbg.git] / kdbg / winstack.h
blob6808f03f44b307908796ca76d4c3280075fa2fe7
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 enum { WindowMore=0x100, WindowMask=0xf };
70 /**
71 * The menu set with setWindowMenu will be modified by this widget to
72 * list the available windows. The specified popup menu must be set up
73 * to contain an entry with ID WindowMore. The windows will be inserted
74 * before this entry.
76 void setWindowMenu(QPopupMenu* menu);
77 /**
78 * Slot activate also looks in this directory when the specified file is
79 * a relative path.
81 void setExtraDirectory(const QString& dir) { m_lastOpenDir = dir; }
82 void activateFile(const QString& fileName);
83 bool activeLine(QString& filename, int& lineNo);
84 bool activeLine(QString& filename, int& lineNo, DbgAddr& address);
85 void maybeTip(const QPoint& p);
86 bool hasWindows() const { return !m_fileList.isEmpty(); }
88 virtual void resizeEvent(QResizeEvent*);
90 signals:
91 void fileChanged();
92 void lineChanged();
93 void toggleBreak(const QString&, int, const DbgAddr&, bool);
94 void enadisBreak(const QString&, int, const DbgAddr&);
95 void clickedRight(const QPoint&);
96 void filesRightClick(const QPoint&);
97 void newFileLoaded();
98 void initiateValuePopup(const QString&);
99 void disassemble(const QString&, int);
100 void setTabWidth(int numChars);
102 public slots:
103 void selectWindow(int id); /* 1-based index, 0 means dialog More... */
104 virtual void slotFindForward();
105 virtual void slotFindBackward();
106 virtual void activate(const QString& filename, int lineNo, const DbgAddr& address);
107 void updatePC(const QString& filename, int lineNo, const DbgAddr& address, int frameNo);
108 void reloadAllFiles();
109 void updateLineItems(const KDebugger* deb);
110 void slotSetTabWidth(int numChars);
112 void slotFileReload();
113 void slotViewFind();
114 void slotBrkptSet();
115 void slotBrkptSetTemp();
116 void slotBrkptEnable();
118 // Displays the value tip at m_tipLocation
119 void slotShowValueTip(const QString& tipText);
121 // Shows the disassembled code at the location given by file and lineNo
122 void slotDisassembled(const QString& fileName, int lineNo,
123 const QList<DisassembledCode>& disass);
125 // Updates line items after expanding/collapsing disassembled code
126 void slotExpandCollapse(int lineNo);
128 protected:
129 bool activatePath(QString pathname, int lineNo, const DbgAddr& address);
130 virtual bool activateWindow(SourceWindow* fw, int lineNo, const DbgAddr& address); /* -1 doesnt change line */
131 virtual void changeWindowMenu();
132 virtual void mousePressEvent(QMouseEvent*);
133 void setPC(bool set, const QString& fileName, int lineNo,
134 const DbgAddr& address, int frameNo);
135 QList<SourceWindow> m_fileList;
136 SourceWindow* m_activeWindow;
137 QString m_lastOpenDir; /* where user opened last file */
138 QPopupMenu* m_windowMenu;
139 int m_itemMore;
140 QString m_textMore;
142 // program counter
143 QString m_pcFile;
144 int m_pcLine; /* -1 if no PC */
145 QString m_pcAddress; /* exact address of PC */
146 int m_pcFrame;
148 ValueTip m_valueTip;
149 QRect m_tipLocation; /* where tip should appear */
151 int m_tabWidth; /* number of chars */
153 public:
154 // find dialog
155 FindDialog m_findDlg;
158 #endif // WINSTACK_H