2 * Copyright 2006-2007, 2011, Stephan Aßmus <superstippi@gmx.de>.
3 * Distributed under the terms of the MIT License.
5 #ifndef STYLE_LIST_VIEW_H
6 #define STYLE_LIST_VIEW_H
10 #include "StyleContainer.h"
18 class ShapeStyleListener
;
31 class StyleListView
: public SimpleListView
, public StyleContainerListener
{
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
,
51 virtual bool HandleDropMessage(const BMessage
* message
,
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
);
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
; }
79 bool _AddStyle(Style
* style
, int32 index
);
80 bool _RemoveStyle(Style
* style
);
82 StyleListItem
* _ItemForStyle(Style
* style
) const;
84 friend class ShapeStyleListener
;
86 void _SetStyleMarked(Style
* style
, bool marked
);
91 StyleContainer
* fStyleContainer
;
92 ShapeContainer
* fShapeContainer
;
93 CommandStack
* fCommandStack
;
94 CurrentColor
* fCurrentColor
;
97 // the style item will be marked that
98 // is referenced by this shape
100 ShapeStyleListener
* fShapeListener
;
104 BMenuItem
* fDuplicateMI
;
105 BMenuItem
* fResetTransformationMI
;
106 BMenuItem
* fRemoveMI
;
110 #endif // STYLE_LIST_VIEW_H