summaryrefslogtreecommitdiff
path: root/ui/syncgroup.h
blob: 187a415183363c505d96668f96fab721f7dd61b9 (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
#pragma once

#include "viewframe.h"
#include "clickablelabel.h"

/*!

	\defgroup syncgroup SyncGroup
 	\ingroup uiapi
*/

/*!

    \ingroup syncgroup
*/
class BINARYNINJAUIAPI SyncGroup
{
	std::set<ViewFrame*> m_members;
	ViewFrame* m_lastSyncFrame = nullptr;
	int m_id;

  public:
	SyncGroup(int id);

	void addMember(ViewFrame* frame);
	void removeMember(ViewFrame* frame);
	void replaceMember(ViewFrame* oldFrame, ViewFrame* newFrame);
	bool isEmpty() const;
	int identifier() const { return m_id; }
	bool contains(ViewFrame* frame) const;
	const std::set<ViewFrame*>& members() const { return m_members; }
	ViewFrame* lastSyncFrame() const { return m_lastSyncFrame; }

	void syncLocation(ViewFrame* frame, View* view, const ViewLocation& location);

	static void syncToTarget(View* srcView, ViewFrame* targetFrame, const ViewLocation& location);
};

/*!

    \ingroup syncgroup
*/
class BINARYNINJAUIAPI SyncGroupWidget : public ClickableIcon
{
	Q_OBJECT

	ViewFrame* m_frame;

  public:
	SyncGroupWidget(ViewFrame* frame);

	void updateStatus();
	void setViewFrame(ViewFrame* frame);

  private Q_SLOTS:
	void handleClick();
};