xref: /haiku/src/apps/icon-o-matic/gui/TransformerListView.h (revision 3cb015b1ee509d69c643506e8ff573808c86dcfc)
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 BMenu;
16 class CommandStack;
17 class Transformer;
18 class TransformerItem;
19 class Selection;
20 
21 class TransformerListView : public SimpleListView,
22 							public ShapeListener {
23  public:
24 								TransformerListView(BRect frame,
25 											  const char* name,
26 											  BMessage* selectionMessage = NULL,
27 											  BHandler* target = NULL);
28 	virtual						~TransformerListView();
29 
30 	// SimpleListView interface
31 	virtual	void				Draw(BRect updateRect);
32 
33 	virtual	void				SelectionChanged();
34 
35 	virtual	void				MessageReceived(BMessage* message);
36 
37 	virtual	void				MakeDragMessage(BMessage* message) const;
38 
39 	virtual	void				MoveItems(BList& items, int32 toIndex);
40 	virtual	void				CopyItems(BList& items, int32 toIndex);
41 	virtual	void				RemoveItemList(BList& items);
42 
43 	virtual	BListItem*			CloneItem(int32 atIndex) const;
44 
45 	virtual	int32				IndexOfSelectable(Selectable* selectable) const;
46 	virtual	Selectable*			SelectableFor(BListItem* item) const;
47 
48 	// ShapeListener interface
49 	virtual	void				TransformerAdded(Transformer* transformer,
50 												 int32 index);
51 	virtual	void				TransformerRemoved(Transformer* transformer);
52 
53 	virtual	void				StyleChanged(Style* oldStyle, Style* newStyle);
54 
55 	// TransformerListView
56 			void				SetMenu(BMenu* menu);
57 			void				SetShape(Shape* shape);
58 			void				SetCommandStack(CommandStack* stack);
59 
60  private:
61 			bool				_AddTransformer(
62 									Transformer* transformer, int32 index);
63 			bool				_RemoveTransformer(
64 									Transformer* transformer);
65 
66 			TransformerItem*	_ItemForTransformer(
67 									Transformer* transformer) const;
68 
69 			void				_UpdateMenu();
70 
71 			BMessage*			fMessage;
72 
73 			Shape*				fShape;
74 			CommandStack*		fCommandStack;
75 
76 			BMenu*				fMenu;
77 };
78 
79 #endif // TRANSFORMER_LIST_VIEW_H
80