xref: /haiku/src/apps/icon-o-matic/generic/selection/Selection.h (revision 1214ef1b2100f2b3299fc9d8d6142e46f70a4c3f)
1 /*
2  * Copyright 2006, Haiku.
3  * Distributed under the terms of the MIT License.
4  *
5  * Authors:
6  *		Stephan Aßmus <superstippi@gmx.de>
7  */
8 
9 #ifndef SELECTION_H
10 #define SELECTION_H
11 
12 #include <List.h>
13 
14 #include "Observable.h"
15 
16 class Selectable;
17 
18 class Selection : public Observable {
19  public:
20 								Selection();
21 	virtual						~Selection();
22 
23 	// modify selection
24 			bool				Select(Selectable* object,
25 									   bool extend = false);
26 			void				Deselect(Selectable* object);
27 			void				DeselectAll();
28 
29 	// query selection
30 			Selectable*			SelectableAt(int32 index) const;
31 			Selectable*			SelectableAtFast(int32 index) const;
32 			int32				CountSelected() const;
33 
34  private:
35 			void				_DeselectAllExcept(Selectable* object);
36 
37 			BList				fSelected;
38 };
39 
40 #endif	// SELECTION_H
41