summaryrefslogtreecommitdiff
path: root/ui/symbolsview.h
blob: 8df6b2e7d8cd037e52a9fcc596fa1e61ce526372 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
#pragma once

#include <QtCore/QTimer>
#include "binaryninjaapi.h"
#include "sidebar.h"
#include "filter.h"
#include "symbollist.h"

class ViewFrame;
class SymbolList;

/*!

	\defgroup symbolview SymbolView
 	\ingroup uiapi
*/

/*!

    \ingroup symbolview
*/
class BINARYNINJAUIAPI SymbolsView : public SidebarWidget, public BinaryNinja::BinaryDataNotification
{
	Q_OBJECT

	friend class SymbolList;

	BinaryViewRef m_data;

	SymbolList* m_funcList;
	FilteredView* m_funcFilter;
	QWidget* m_header;

	bool m_updatesPending;
	QTimer* m_updateTimer;

  public:
	SymbolsView(ViewFrame* frame, BinaryViewRef data);
	virtual ~SymbolsView();

	SymbolList* getSymbolList() { return m_funcList; }
	FilteredView* getFunctionFilter() { return m_funcFilter; }

	virtual void OnBinaryDataWritten(BinaryNinja::BinaryView* data, uint64_t offset, size_t len) override;
	virtual void OnBinaryDataInserted(BinaryNinja::BinaryView* data, uint64_t offset, size_t len) override;
	virtual void OnBinaryDataRemoved(BinaryNinja::BinaryView* data, uint64_t offset, uint64_t len) override;

	bool getShowExportedFunctions() const { return m_funcList->getShowExportedFunctions(); }
	bool getShowExportedDataVars() const { return m_funcList->getShowExportedDataVars(); }
	bool getShowLocalFunctions() const { return m_funcList->getShowLocalFunctions(); }
	bool getShowLocalDataVars() const { return m_funcList->getShowLocalDataVars(); }
	bool getShowImports() const { return m_funcList->getShowImports(); }
	bool getShowMangled() const { return m_funcList->getShowMangled(); }

	void toggleExportedFunctions() { m_funcList->toggleExportedFunctions(); }
	void toggleExportedDataVars() { m_funcList->toggleExportedDataVars(); }
	void toggleImports() { m_funcList->toggleImports(); }
	void toggleLocalFunctions() { m_funcList->toggleLocalFunctions(); }
	void toggleLocalDataVars() { m_funcList->toggleLocalDataVars(); }

	virtual QWidget* headerWidget() override { return m_header; }
	virtual void focus() override;

  protected:
	virtual void contextMenuEvent(QContextMenuEvent* event) override;
	virtual void notifyFontChanged() override;

  private Q_SLOTS:
	void updateTimerEvent();
	void showContextMenu();
};

/*!

    \ingroup symbolview
*/
class BINARYNINJAUIAPI SymbolsViewSidebarWidgetType : public SidebarWidgetType
{
  public:
	SymbolsViewSidebarWidgetType();
	virtual SidebarWidget* createWidget(ViewFrame* frame, BinaryViewRef data) override;
};