1 /* 2 * Copyright 2007, Haiku. All rights reserved. 3 * Distributed under the terms of the MIT License. 4 * 5 * Authors: 6 * Stephan Aßmus <superstippi@gmx.de> 7 */ 8 #ifndef ICON_H 9 #define ICON_H 10 11 12 #include "ShapeContainer.h" 13 14 #ifdef ICON_O_MATIC 15 # include <List.h> 16 17 # include "Observer.h" 18 # include "Referenceable.h" 19 #else 20 # include <SupportDefs.h> 21 #endif 22 23 class BRect; 24 25 26 namespace BPrivate { 27 namespace Icon { 28 29 class PathContainer; 30 class StyleContainer; 31 32 #ifdef ICON_O_MATIC 33 class IconListener { 34 public: 35 IconListener(); 36 virtual ~IconListener(); 37 38 virtual void AreaInvalidated(const BRect& area) = 0; 39 }; 40 #endif 41 42 #ifdef ICON_O_MATIC 43 class Icon : public ShapeContainerListener, 44 public Observer, 45 public Referenceable { 46 #else 47 class Icon { 48 #endif 49 50 public: 51 Icon(); 52 Icon(const Icon& other); 53 virtual ~Icon(); 54 55 status_t InitCheck() const; 56 57 StyleContainer* Styles() const 58 { return fStyles; } 59 PathContainer* Paths() const 60 { return fPaths; } 61 ShapeContainer* Shapes() const 62 { return fShapes; } 63 64 Icon* Clone() const; 65 void MakeEmpty(); 66 67 private: 68 69 StyleContainer* fStyles; 70 PathContainer* fPaths; 71 ShapeContainer* fShapes; 72 73 #ifdef ICON_O_MATIC 74 public: 75 // ShapeContainerListener interface 76 virtual void ShapeAdded(Shape* shape, int32 index); 77 virtual void ShapeRemoved(Shape* shape); 78 79 // Observer interface 80 virtual void ObjectChanged(const Observable* object); 81 82 // Icon 83 bool AddListener(IconListener* listener); 84 bool RemoveListener(IconListener* listener); 85 86 private: 87 void _NotifyAreaInvalidated( 88 const BRect& area) const; 89 BList fListeners; 90 #endif 91 }; 92 93 } // namespace Icon 94 } // namespace BPrivate 95 96 #endif // ICON_H 97