xref: /haiku/src/apps/icon-o-matic/gui/TransformerListView.h (revision 1d9d47fc72028bb71b5f232a877231e59cfe2438)
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 TRANSFORMER_LIST_VIEW_H
10 #define TRANSFORMER_LIST_VIEW_H
11 
12 #include "ListViews.h"
13 #include "Shape.h"
14 
15 class CommandStack;
16 class Transformer;
17 class TransformerItem;
18 class Selection;
19 
20 class TransformerListView : public SimpleListView,
21 							public ShapeListener {
22  public:
23 								TransformerListView(BRect frame,
24 											  const char* name,
25 											  BMessage* selectionMessage = NULL,
26 											  BHandler* target = NULL);
27 	virtual						~TransformerListView();
28 
29 	// SimpleListView interface
30 	virtual	void				SelectionChanged();
31 
32 	virtual	void				MakeDragMessage(BMessage* message) const;
33 
34 	virtual	void				MoveItems(BList& items, int32 toIndex);
35 	virtual	void				CopyItems(BList& items, int32 toIndex);
36 	virtual	void				RemoveItemList(BList& items);
37 
38 	virtual	BListItem*			CloneItem(int32 atIndex) const;
39 
40 	// ShapeListener interface
41 	virtual	void				TransformerAdded(Transformer* transformer,
42 												 int32 index);
43 	virtual	void				TransformerRemoved(Transformer* transformer);
44 
45 	virtual	void				StyleChanged(Style* oldStyle, Style* newStyle);
46 
47 	// TransformerListView
48 			void				SetShape(Shape* shape);
49 			void				SetSelection(Selection* selection);
50 			void				SetCommandStack(CommandStack* stack);
51 
52  private:
53 			bool				_AddTransformer(
54 									Transformer* transformer, int32 index);
55 			bool				_RemoveTransformer(
56 									Transformer* transformer);
57 
58 			TransformerItem*	_ItemForTransformer(
59 									Transformer* transformer) const;
60 
61 			BMessage*			fMessage;
62 
63 			Shape*				fShape;
64 			Selection*			fSelection;
65 			CommandStack*		fCommandStack;
66 };
67 
68 #endif // TRANSFORMER_LIST_VIEW_H
69