BTRFS: Implement BTree::Path and change _Find.
[haiku.git] / src / apps / icon-o-matic / gui / StyleListView.h
blob9945b8d965cde48ce943d9cb4149c3797046f0f7
1 /*
2 * Copyright 2006-2007, 2011, Stephan Aßmus <superstippi@gmx.de>.
3 * Distributed under the terms of the MIT License.
4 */
5 #ifndef STYLE_LIST_VIEW_H
6 #define STYLE_LIST_VIEW_H
9 #include "ListViews.h"
10 #include "StyleContainer.h"
13 class BMenu;
14 class BMenuItem;
15 class CommandStack;
16 class CurrentColor;
17 class Selection;
18 class ShapeStyleListener;
19 class StyleListItem;
21 _BEGIN_ICON_NAMESPACE
22 class Shape;
23 class ShapeContainer;
24 class ShapeListener;
25 class Style;
26 _END_ICON_NAMESPACE
28 _USING_ICON_NAMESPACE
31 class StyleListView : public SimpleListView, public StyleContainerListener {
32 public:
33 StyleListView(BRect frame, const char* name,
34 BMessage* selectionMessage = NULL,
35 BHandler* target = NULL);
36 virtual ~StyleListView();
38 // SimpleListView interface
39 virtual void MessageReceived(BMessage* message);
41 virtual void SelectionChanged();
43 virtual void MouseDown(BPoint where);
45 virtual void MakeDragMessage(BMessage* message) const;
47 virtual bool AcceptDragMessage(
48 const BMessage* message) const;
49 virtual void SetDropTargetRect(const BMessage* message,
50 BPoint where);
51 virtual bool HandleDropMessage(const BMessage* message,
52 int32 dropIndex);
54 virtual void MoveItems(BList& items, int32 toIndex);
55 virtual void CopyItems(BList& items, int32 toIndex);
56 virtual void RemoveItemList(BList& items);
58 virtual BListItem* CloneItem(int32 atIndex) const;
60 virtual int32 IndexOfSelectable(Selectable* selectable) const;
61 virtual Selectable* SelectableFor(BListItem* item) const;
63 // StyleContainerListener interface
64 virtual void StyleAdded(Style* style, int32 index);
65 virtual void StyleRemoved(Style* style);
67 // StyleListView
68 void SetMenu(BMenu* menu);
69 void SetStyleContainer(StyleContainer* container);
70 void SetShapeContainer(ShapeContainer* container);
71 void SetCommandStack(CommandStack* stack);
72 void SetCurrentColor(CurrentColor* color);
74 void SetCurrentShape(Shape* shape);
75 Shape* CurrentShape() const
76 { return fCurrentShape; }
78 private:
79 bool _AddStyle(Style* style, int32 index);
80 bool _RemoveStyle(Style* style);
82 StyleListItem* _ItemForStyle(Style* style) const;
84 friend class ShapeStyleListener;
85 void _UpdateMarks();
86 void _SetStyleMarked(Style* style, bool marked);
87 void _UpdateMenu();
89 BMessage* fMessage;
91 StyleContainer* fStyleContainer;
92 ShapeContainer* fShapeContainer;
93 CommandStack* fCommandStack;
94 CurrentColor* fCurrentColor;
96 Shape* fCurrentShape;
97 // the style item will be marked that
98 // is referenced by this shape
100 ShapeStyleListener* fShapeListener;
102 BMenu* fMenu;
103 BMenuItem* fAddMI;
104 BMenuItem* fDuplicateMI;
105 BMenuItem* fResetTransformationMI;
106 BMenuItem* fRemoveMI;
110 #endif // STYLE_LIST_VIEW_H