summaryrefslogtreecommitdiff
path: root/plugins/warp/ui/plugin.h
blob: 4ad43864fb140e2beb612d013215ee1e3ac3b581 (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
#pragma once

#include "matched.h"
#include "matches.h"
#include "sidebar.h"
#include "sidebarwidget.h"
#include "containers.h"

class WarpSidebarWidget : public SidebarWidget
{
	Q_OBJECT
	BinaryNinja::Ref<BinaryNinja::Logger> m_logger;
	BinaryViewRef m_data;
	ViewFrame* m_currentFrame;
	QWidget* m_headerWidget;

	BinaryNinja::Ref<BinaryNinja::AnalysisCompletionEvent> m_analysisEvent;
	QAction* m_matcherAction;
	bool isMatcherRunning = false;

	std::shared_ptr<WarpFetcher> m_fetcher;
	WarpFetcher::CallbackId m_callbackId;

	WarpCurrentFunctionWidget* m_currentFunctionWidget;
	WarpMatchedWidget* m_matchedWidget;
	WarpContainersPane* m_containerWidget;

public:
	explicit WarpSidebarWidget(BinaryViewRef data);

	~WarpSidebarWidget() override;

	QWidget* headerWidget() override { return m_headerWidget; }

	void Update();

	void setMatcherActionIcon(bool running);

	void notifyViewChanged(ViewFrame*) override;

	void notifyViewLocationChanged(View*, const ViewLocation&) override;

	void focus() override;
};

class WarpSidebarWidgetType : public SidebarWidgetType
{
public:
	WarpSidebarWidgetType();

	SidebarWidgetLocation defaultLocation() const override { return RightContent; }
	SidebarContextSensitivity contextSensitivity() const override { return PerViewTypeSidebarContext; }

	WarpSidebarWidget* createWidget(ViewFrame* viewFrame, BinaryViewRef data) override
	{
		return new WarpSidebarWidget(data);
	}
};