HaikuDepot: notify work status from main window
[haiku.git] / src / apps / icon-o-matic / gui / ShapeListView.h
blob9e92069b15d2bf24044fc86591f41b77feb81b76
1 /*
2 * Copyright 2006-2007, Haiku.
3 * Distributed under the terms of the MIT License.
5 * Authors:
6 * Stephan Aßmus <superstippi@gmx.de>
7 */
8 #ifndef SHAPE_LIST_VIEW_H
9 #define SHAPE_LIST_VIEW_H
12 #include "ListViews.h"
13 #include "ShapeContainer.h"
16 class BMenu;
17 class BMenuItem;
18 class CommandStack;
19 class ShapeListItem;
20 class StyleContainer;
21 class PathContainer;
22 class Selection;
24 _BEGIN_ICON_NAMESPACE
25 class Shape;
26 _END_ICON_NAMESPACE
28 _USING_ICON_NAMESPACE
31 enum {
32 MSG_ADD_SHAPE = 'adsh',
35 class ShapeListView : public SimpleListView,
36 public ShapeContainerListener {
37 public:
38 ShapeListView(BRect frame,
39 const char* name,
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,
53 BPoint where);
54 virtual bool HandleDropMessage(const BMessage* message,
55 int32 dropIndex);
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);
70 // ShapeListView
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);
77 private:
78 bool _AddShape(Shape* shape, int32 index);
79 bool _RemoveShape(Shape* shape);
81 ShapeListItem* _ItemForShape(Shape* shape) const;
82 void _UpdateMenu();
84 void _GetSelectedShapes(BList& shapes) const;
86 BMessage* fMessage;
88 ShapeContainer* fShapeContainer;
89 StyleContainer* fStyleContainer;
90 PathContainer* fPathContainer;
91 CommandStack* fCommandStack;
93 BMenu* fMenu;
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