1/* 2 * Copyright 2006-2007, Haiku. 3 * Distributed under the terms of the MIT License. 4 * 5 * Authors: 6 * Stephan Aßmus <superstippi@gmx.de> 7 */ 8#ifndef PATH_CONTAINER_H 9#define PATH_CONTAINER_H 10 11 12#include <List.h> 13 14#include "IconBuild.h" 15 16 17_BEGIN_ICON_NAMESPACE 18 19 20class VectorPath; 21 22#ifdef ICON_O_MATIC 23class PathContainerListener { 24 public: 25 PathContainerListener(); 26 virtual ~PathContainerListener(); 27 28 virtual void PathAdded(VectorPath* path, int32 index) = 0; 29 virtual void PathRemoved(VectorPath* path) = 0; 30}; 31#endif // ICON_O_MATIC 32 33class PathContainer { 34 public: 35 PathContainer(bool ownsPaths); 36 virtual ~PathContainer(); 37 38 bool AddPath(VectorPath* path); 39 bool AddPath(VectorPath* path, int32 index); 40 bool RemovePath(VectorPath* path); 41 VectorPath* RemovePath(int32 index); 42 43 void MakeEmpty(); 44 45 int32 CountPaths() const; 46 bool HasPath(VectorPath* path) const; 47 int32 IndexOf(VectorPath* path) const; 48 49 VectorPath* PathAt(int32 index) const; 50 VectorPath* PathAtFast(int32 index) const; 51 52 private: 53 void _MakeEmpty(); 54 55 BList fPaths; 56 bool fOwnsPaths; 57 58#ifdef ICON_O_MATIC 59 public: 60 bool AddListener(PathContainerListener* listener); 61 bool RemoveListener(PathContainerListener* listener); 62 63 private: 64 void _NotifyPathAdded(VectorPath* path, 65 int32 index) const; 66 void _NotifyPathRemoved(VectorPath* path) const; 67 68 BList fListeners; 69#endif // ICON_O_MATIC 70}; 71 72 73_END_ICON_NAMESPACE 74 75 76#endif // PATH_CONTAINER_H 77