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

#include <QtCore/QString>
#include <QtWidgets/QWidget>
#include <vector>
#include "binaryninjaapi.h"
#include "uicontext.h"

class ViewFrame;

/*!

	\defgroup viewtype ViewType
 	\ingroup uiapi
*/

/*!

	\ingroup viewtype
*/
class BINARYNINJAUIAPI ViewType
{
	QString m_name, m_longName;

  public:
	ViewType(const QString& name, const QString& longName);
	virtual ~ViewType();

	const QString& getName() { return m_name; }
	const QString& getLongName() { return m_longName; }
	virtual int getPriority(BinaryViewRef data, const QString& filename) = 0;
	virtual QWidget* create(BinaryViewRef data, ViewFrame* viewFrame) = 0;

	virtual QString getDisplayName(BinaryViewTypeRef type);
	virtual QString getDisplayLongName(BinaryViewTypeRef type);

	static ViewType* getTypeByName(const QString& name);
	static const std::vector<ViewType*>& getTypes();

	static void registerViewType(ViewType* type);
};

/*!

	\ingroup viewtype
*/
class BINARYNINJAUIAPI ViewTypeContainer
{
  public:
	std::vector<ViewType*> m_types;

	static ViewTypeContainer& GetViewTypeContainer();
};