2 * Copyright 2006-2007, Haiku.
3 * Distributed under the terms of the MIT License.
6 * Stephan Aßmus <superstippi@gmx.de>
8 #ifndef SHAPE_LIST_VIEW_H
9 #define SHAPE_LIST_VIEW_H
12 #include "ListViews.h"
13 #include "ShapeContainer.h"
32 MSG_ADD_SHAPE
= 'adsh',
35 class ShapeListView
: public SimpleListView
,
36 public ShapeContainerListener
{
38 ShapeListView(BRect frame
,
40 BMessage
* selectionMessage
= NULL
,
41 BHandler
* target
= NULL
);
42 virtual ~ShapeListView();
44 // SimpleListView interface
45 virtual void SelectionChanged();
47 virtual void MessageReceived(BMessage
* message
);
49 virtual void MakeDragMessage(BMessage
* message
) const;
51 virtual bool AcceptDragMessage(const BMessage
* message
) const;
52 virtual void SetDropTargetRect(const BMessage
* message
,
54 virtual bool HandleDropMessage(const BMessage
* message
,
57 virtual void MoveItems(BList
& items
, int32 toIndex
);
58 virtual void CopyItems(BList
& items
, int32 toIndex
);
59 virtual void RemoveItemList(BList
& items
);
61 virtual BListItem
* CloneItem(int32 atIndex
) const;
63 virtual int32
IndexOfSelectable(Selectable
* selectable
) const;
64 virtual Selectable
* SelectableFor(BListItem
* item
) const;
66 // ShapeContainerListener interface
67 virtual void ShapeAdded(Shape
* shape
, int32 index
);
68 virtual void ShapeRemoved(Shape
* shape
);
71 void SetMenu(BMenu
* menu
);
72 void SetShapeContainer(ShapeContainer
* container
);
73 void SetStyleContainer(StyleContainer
* container
);
74 void SetPathContainer(PathContainer
* container
);
75 void SetCommandStack(CommandStack
* stack
);
78 bool _AddShape(Shape
* shape
, int32 index
);
79 bool _RemoveShape(Shape
* shape
);
81 ShapeListItem
* _ItemForShape(Shape
* shape
) const;
84 void _GetSelectedShapes(BList
& shapes
) const;
88 ShapeContainer
* fShapeContainer
;
89 StyleContainer
* fStyleContainer
;
90 PathContainer
* fPathContainer
;
91 CommandStack
* fCommandStack
;
94 BMenuItem
* fAddEmptyMI
;
95 BMenuItem
* fAddWidthPathMI
;
96 BMenuItem
* fAddWidthStyleMI
;
97 BMenuItem
* fAddWidthPathAndStyleMI
;
98 BMenuItem
* fDuplicateMI
;
99 BMenuItem
* fResetTransformationMI
;
100 BMenuItem
* fFreezeTransformationMI
;
101 BMenuItem
* fRemoveMI
;
104 #endif // SHAPE_LIST_VIEW_H