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