vfs: check userland buffers before reading them.
[haiku.git] / src / libs / icon / shape / ShapeContainer.h
blobfabdf252a757ca4183563b3b1e9047fa64326e9f
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_CONTAINER_H
9 #define SHAPE_CONTAINER_H
12 #include <List.h>
14 #include "IconBuild.h"
17 _BEGIN_ICON_NAMESPACE
20 class Shape;
22 #ifdef ICON_O_MATIC
23 class ShapeContainerListener {
24 public:
25 ShapeContainerListener();
26 virtual ~ShapeContainerListener();
28 virtual void ShapeAdded(Shape* shape, int32 index) = 0;
29 virtual void ShapeRemoved(Shape* shape) = 0;
31 #endif // ICON_O_MATIC
33 class ShapeContainer {
34 public:
35 ShapeContainer();
36 virtual ~ShapeContainer();
38 bool AddShape(Shape* shape);
39 bool AddShape(Shape* shape, int32 index);
40 bool RemoveShape(Shape* shape);
41 Shape* RemoveShape(int32 index);
43 void MakeEmpty();
45 int32 CountShapes() const;
46 bool HasShape(Shape* shape) const;
47 int32 IndexOf(Shape* shape) const;
49 Shape* ShapeAt(int32 index) const;
50 Shape* ShapeAtFast(int32 index) const;
52 private:
53 void _MakeEmpty();
55 BList fShapes;
57 #ifdef ICON_O_MATIC
58 public:
59 bool AddListener(ShapeContainerListener* listener);
60 bool RemoveListener(
61 ShapeContainerListener* listener);
63 private:
64 void _NotifyShapeAdded(Shape* shape,
65 int32 index) const;
66 void _NotifyShapeRemoved(Shape* shape) const;
68 BList fListeners;
69 #endif // ICON_O_MATIC
73 _END_ICON_NAMESPACE
76 #endif // SHAPE_CONTAINER_H