forked from erak/glmixer
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathSelectionManager.h
61 lines (45 loc) · 1.33 KB
/
SelectionManager.h
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
/*
* SelectionManager.h
*
* Created on: Feb 10, 2013
* Author: bh
*/
#ifndef SELECTIONMANAGER_H_
#define SELECTIONMANAGER_H_
#include <QObject>
#include "SourceSet.h"
class SelectionManager: public QObject {
Q_OBJECT
public:
static SelectionManager *getInstance();
/**
* Selection management
*/
void select(Source *s);
void deselect(Source *s);
void select(SourceList l);
void deselect(SourceList l);
bool isInSelection(Source *s) const;
void setSelection(SourceList l);
bool hasSelection() { return !_selectedSources.empty(); }
SourceList::iterator selectionBegin() { return _selectedSources.begin(); }
SourceList::iterator selectionEnd() { return _selectedSources.end(); }
int selectionCount() { return _selectedSources.size(); }
SourceList copySelection() { return SourceList (_selectedSources); }
Source *selectionSource() { return _selectionSource; }
public slots:
void clearSelection();
void selectAll();
void invertSelection();
void selectCurrentSource();
void updateSelectionSource();
signals:
void selectionChanged(bool notempty);
private:
SelectionManager();
virtual ~SelectionManager();
static SelectionManager *_instance;
Source *_selectionSource;
SourceList _selectedSources;
};
#endif /* SELECTIONMANAGER_H_ */