summaryrefslogtreecommitdiff
path: root/ui/xrefstate.h
blob: 56b468818d509a5e807f678f917fd4d470badf31 (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
#pragma once

#include <QtCore/QModelIndex>
#include "binaryninjaapi.h"
#include "uicontext.h"
#include "viewframe.h"

class SplitPaneContainer;
class SplitPaneWidget;

class BINARYNINJAUIAPI CrossReferenceState
{
	struct Selection
	{
		SelectionInfoForXref selectionInfo;
		std::optional<int> previousDialogSelection;
	};

	std::map<SplitPaneContainer*, std::map<QString, Selection>> m_selections;
	SplitPaneContainer* m_currentContainer = nullptr;
	QString m_currentDataType;

public:
	CrossReferenceState();

	std::optional<SelectionInfoForXref> getCurrentSelection() const;
	std::optional<int> getPreviousDialogSelection() const;

	void updateCrossReferences(ViewFrame* frame, const SelectionInfoForXref& selection);
	void beginNavigationForCrossReference(ViewFrame* frame, const SelectionInfoForXref& selection);

	void setActiveContext(ViewFrame* frame);
	void destroyContext(SplitPaneWidget* splitPane);

	void newPinnedTab();
	void newPinnedPane();
	void modalDialog();
	void focusSidebar();

	void bindActions(UIContext* context);
};