1 /* 2 * Copyright 2006, 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 9 #ifndef ICON_H 10 #define ICON_H 11 12 #ifdef ICON_O_MATIC 13 #include <List.h> 14 15 # include "Observer.h" 16 # include "Referenceable.h" 17 #else 18 # include <SupportDefs.h> 19 #endif 20 #include "ShapeContainer.h" 21 22 class BRect; 23 class PathContainer; 24 class StyleContainer; 25 26 #ifdef ICON_O_MATIC 27 class IconListener { 28 public: 29 IconListener(); 30 virtual ~IconListener(); 31 32 virtual void AreaInvalidated(const BRect& area) = 0; 33 }; 34 #endif 35 36 #ifdef ICON_O_MATIC 37 class Icon : public ShapeContainerListener, 38 public Observer, 39 public Referenceable { 40 #else 41 class Icon { 42 #endif 43 44 public: 45 Icon(); 46 Icon(const Icon& other); 47 virtual ~Icon(); 48 49 status_t InitCheck() const; 50 51 StyleContainer* Styles() const 52 { return fStyles; } 53 PathContainer* Paths() const 54 { return fPaths; } 55 ShapeContainer* Shapes() const 56 { return fShapes; } 57 58 Icon* Clone() const; 59 void MakeEmpty(); 60 61 private: 62 63 StyleContainer* fStyles; 64 PathContainer* fPaths; 65 ShapeContainer* fShapes; 66 67 #ifdef ICON_O_MATIC 68 public: 69 // ShapeContainerListener interface 70 virtual void ShapeAdded(Shape* shape, int32 index); 71 virtual void ShapeRemoved(Shape* shape); 72 73 // Observer interface 74 virtual void ObjectChanged(const Observable* object); 75 76 // Icon 77 bool AddListener(IconListener* listener); 78 bool RemoveListener(IconListener* listener); 79 80 private: 81 void _NotifyAreaInvalidated( 82 const BRect& area) const; 83 BList fListeners; 84 #endif 85 }; 86 87 #endif // ICON_H 88