xref: /haiku/src/apps/icon-o-matic/gui/TransformerListView.h (revision 16d5c24e533eb14b7b8a99ee9f3ec9ba66335b1e)
1 /*
2  * Copyright 2006-2007, Haiku.
3  * Distributed under the terms of the MIT License.
4  *
5  * Authors:
6  *		Stephan Aßmus <superstippi@gmx.de>
7  */
8 #ifndef TRANSFORMER_LIST_VIEW_H
9 #define TRANSFORMER_LIST_VIEW_H
10 
11 
12 #include "ListViews.h"
13 #include "Shape.h"
14 
15 
16 class BMenu;
17 class CommandStack;
18 class TransformerItem;
19 class Selection;
20 
21 namespace BPrivate {
22 namespace Icon {
23 	class Transformer;
24 }
25 }
26 
27 class TransformerListView : public SimpleListView,
28 							public ShapeListener {
29  public:
30 								TransformerListView(BRect frame,
31 											  const char* name,
32 											  BMessage* selectionMessage = NULL,
33 											  BHandler* target = NULL);
34 	virtual						~TransformerListView();
35 
36 	// SimpleListView interface
37 	virtual	void				Draw(BRect updateRect);
38 
39 	virtual	void				SelectionChanged();
40 
41 	virtual	void				MessageReceived(BMessage* message);
42 
43 	virtual	void				MakeDragMessage(BMessage* message) const;
44 
45 	virtual	void				MoveItems(BList& items, int32 toIndex);
46 	virtual	void				CopyItems(BList& items, int32 toIndex);
47 	virtual	void				RemoveItemList(BList& items);
48 
49 	virtual	BListItem*			CloneItem(int32 atIndex) const;
50 
51 	virtual	int32				IndexOfSelectable(Selectable* selectable) const;
52 	virtual	Selectable*			SelectableFor(BListItem* item) const;
53 
54 	// ShapeListener interface
55 	virtual	void				TransformerAdded(Transformer* transformer,
56 												 int32 index);
57 	virtual	void				TransformerRemoved(Transformer* transformer);
58 
59 	virtual	void				StyleChanged(Style* oldStyle, Style* newStyle);
60 
61 	// TransformerListView
62 			void				SetMenu(BMenu* menu);
63 			void				SetShape(Shape* shape);
64 			void				SetCommandStack(CommandStack* stack);
65 
66  private:
67 			bool				_AddTransformer(
68 									Transformer* transformer, int32 index);
69 			bool				_RemoveTransformer(
70 									Transformer* transformer);
71 
72 			TransformerItem*	_ItemForTransformer(
73 									Transformer* transformer) const;
74 
75 			void				_UpdateMenu();
76 
77 			BMessage*			fMessage;
78 
79 			Shape*				fShape;
80 			CommandStack*		fCommandStack;
81 
82 			BMenu*				fMenu;
83 };
84 
85 #endif // TRANSFORMER_LIST_VIEW_H
86