xref: /haiku/src/apps/icon-o-matic/generic/selection/Selectable.h (revision 820dca4df6c7bf955c46e8f6521b9408f50b2900)
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 SELECTABLE_H
10 #define SELECTABLE_H
11 
12 #include <SupportDefs.h>
13 
14 class Selection;
15 
16 class Selectable {
17  public:
18 								Selectable();
19 	virtual						~Selectable();
20 
21 	inline	bool				IsSelected() const
22 									{ return fSelected; }
23 
24 	virtual	void				SelectedChanged() = 0;
25 
26 	// this works only if the Selection is known
27 			void				SetSelected(bool selected,
28 											bool exclusive = true);
29 			void				SetSelection(Selection* selection);
30 
31  private:
32 	friend class Selection;
33 			void				_SetSelected(bool selected);
34 
35 			bool				fSelected;
36 			Selection*			fSelection;
37 };
38 
39 #endif // SELECTABLE_H
40