00001 /* 00002 /-------------------------------------------------------------------- 00003 | 00004 | $Id: grarray.h,v 1.4 2002/03/31 13:36:42 uzadow Exp $ 00005 | Array of CGrItems 00006 | 00007 | Contains an array of graphic items sorted by z-order. 00008 | 00009 | Copyright (c) 1996-2002 Ulrich von Zadow 00010 | 00011 \-------------------------------------------------------------------- 00012 */ 00013 00014 #ifndef INCL_GRARRAY 00015 #define INCL_GRARRAY 00016 00017 #include "gritem.h" 00018 00019 class CGrItemArray : public CObArray 00020 { 00021 00022 DECLARE_DYNAMIC (CGrItemArray); 00023 // Construction 00024 public: 00025 CGrItemArray 00026 (); 00027 00028 virtual ~CGrItemArray 00029 (); 00030 // Deletes the array & all elements in it. 00031 00032 CGrItem * GetItem 00033 ( int i 00034 ); 00035 // Returns item at the i'th position in the array. 00036 00037 void Empty 00038 (); 00039 // Destroys all elements in the array. 00040 00041 virtual int AddItem 00042 ( CGrItem * pItem, 00043 int Pos = -1 00044 ); 00045 // Type-safe version of CObArray::Add. If the parameter Pos is 00046 // omitted, the element is inserted in z-Order, otherwise at 00047 // position Pos. (Specifying Pos can lead to an unsorted array 00048 // and should only be used when you're inserting in sorted order 00049 // anyway.) 00050 00051 void Draw 00052 ( PLBmp * pCanvas, 00053 CRect * pRect 00054 ); 00055 // Draws all the elements on the canvas by invoking their Draw()- 00056 // methods. 00057 00058 void GetRect 00059 ( CRect * pRect 00060 ); 00061 // Returns smallest rectangle containing all the elements. 00062 00063 private: 00064 int sortedInsert 00065 ( CGrItem * pItem 00066 ); 00067 }; 00068 00069 #endif 00070 00071 /* 00072 /-------------------------------------------------------------------- 00073 | 00074 | $Log: grarray.h,v $ 00075 | Revision 1.4 2002/03/31 13:36:42 uzadow 00076 | Updated copyright. 00077 | 00078 | Revision 1.3 2001/09/16 19:03:23 uzadow 00079 | Added global name prefix PL, changed most filenames. 00080 | 00081 | 00082 -------------------------------------------------------------------- 00083 */