1 /* 2 * Copyright 2006-2007, 2023, Haiku. 3 * Distributed under the terms of the MIT License. 4 * 5 * Authors: 6 * Stephan Aßmus <superstippi@gmx.de> 7 * Zardshard 8 */ 9 #ifndef TRANSFORMER_LIST_VIEW_H 10 #define TRANSFORMER_LIST_VIEW_H 11 12 13 #include "Container.h" 14 #include "ListViews.h" 15 #include "IconBuild.h" 16 17 18 class BMenu; 19 class BMenuItem; 20 class CommandStack; 21 class TransformerItem; 22 class Selection; 23 24 _BEGIN_ICON_NAMESPACE 25 class Shape; 26 class Transformer; 27 _END_ICON_NAMESPACE 28 29 30 class TransformerListView : public SimpleListView, 31 public ContainerListener<Transformer> { 32 public: 33 TransformerListView(BRect frame, 34 const char* name, 35 BMessage* selectionMessage = NULL, 36 BHandler* target = NULL); 37 virtual ~TransformerListView(); 38 39 // SimpleListView interface 40 virtual void Draw(BRect updateRect); 41 42 virtual void SelectionChanged(); 43 44 virtual void MessageReceived(BMessage* message); 45 46 virtual void MakeDragMessage(BMessage* message) const; 47 48 virtual void MoveItems(BList& items, int32 toIndex); 49 virtual void CopyItems(BList& items, int32 toIndex); 50 virtual void RemoveItemList(BList& items); 51 52 virtual BListItem* CloneItem(int32 atIndex) const; 53 54 virtual int32 IndexOfSelectable(Selectable* selectable) const; 55 virtual Selectable* SelectableFor(BListItem* item) const; 56 57 // ContainerListener<Transformer> interface 58 virtual void ItemAdded(Transformer* transformer, int32 index); 59 virtual void ItemRemoved(Transformer* transformer); 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 BMenuItem* fContourMI; 84 BMenuItem* fStrokeMI; 85 }; 86 87 #endif // TRANSFORMER_LIST_VIEW_H 88