home *** CD-ROM | disk | FTP | other *** search
/ Power GUI Programming with VisualAge C++ / powergui.iso / trialva / ibmcppw / include / iglist.hpp < prev    next >
Encoding:
C/C++ Source or Header  |  1996-02-22  |  5.1 KB  |  187 lines

  1. #ifndef _IGLIST_
  2. #define _IGLIST_
  3. /*******************************************************************************
  4. * FILE NAME: iglist.hpp                                                        *
  5. *                                                                              *
  6. * DESCRIPTION:                                                                 *
  7. *   Declaration of the classes:                                                *
  8. *     IGList                                                                   *
  9. *                                                                              *
  10. * COPYRIGHT:                                                                   *
  11. *   IBM Open Class Library                                                     *
  12. *   (C) Copyright International Business Machines Corporation 1992, 1996       *
  13. *   Licensed Material - Program-Property of IBM - All Rights Reserved.         *
  14. *   US Government Users Restricted Rights - Use, duplication, or disclosure    *
  15. *   restricted by GSA ADP Schedule Contract with IBM Corp.                     *
  16. *                                                                              *
  17. *******************************************************************************/
  18.  
  19. #include <igraphic.hpp>
  20.  
  21.  
  22. class IGraphicContext;
  23. class ITransformMatrix;
  24. class IGListSeq;
  25.  
  26. #pragma pack(4)
  27.  
  28. class IGList : public IGraphic {
  29. typedef IGraphic
  30.   Inherited;
  31.  
  32. public:
  33. /*------------------------------- Constructors -------------------------------*/
  34.   IGList ( );
  35.  
  36.   IGList ( IGraphic&     graphic  );
  37.  
  38.   IGList ( const IGList& list     );
  39.  
  40. virtual
  41.   ~IGList ( );
  42.  
  43. /*-------------------------------- Drawing -----------------------------------*/
  44. virtual IGList
  45.   &drawOn      ( IGraphicContext& graphicContext );
  46.  
  47. /*------------------------------ Hit Testing ---------------------------------*/
  48. virtual IGraphic
  49.  *topGraphicUnderPoint    ( const IPoint&    point,
  50.                             IGraphicContext& graphicContext ),
  51.  
  52.  *bottomGraphicUnderPoint ( const IPoint&    point,
  53.                             IGraphicContext& graphicContext );
  54.  
  55.  
  56. class Cursor : public IVBase {
  57. typedef IVBase
  58.   Inherited;
  59.  
  60. public:
  61. /*------------------------------- Constructors -------------------------------*/
  62.   Cursor ( const IGList&    list             );
  63.  
  64.   Cursor ( const IGList&    list,
  65.            unsigned long    objectIdentifier );
  66.  
  67.   Cursor ( const IGList&    list,
  68.            IGraphicContext& graphicContext,
  69.            const IPoint&    hitPoint         );
  70.  
  71. virtual
  72.  ~Cursor ( );
  73.  
  74. /*------------------------------ Cursor Positioning --------------------------*/
  75. virtual IBase::Boolean
  76.   setToFirst    ( ),
  77.  
  78.   setToNext     ( ),
  79.  
  80.   setToPrevious ( ),
  81.  
  82.   setToLast     ( ),
  83.  
  84.   isValid       ( ) const;
  85.  
  86. virtual void
  87.   invalidate    ( );
  88.  
  89. private:
  90. /*--------------------------------- Private ----------------------------------*/
  91. const IGList
  92.  *fCursorList;
  93. void
  94.  *fCursor;
  95. enum CursorType {
  96.   regular,
  97.   id,
  98.   hit
  99.   };
  100. CursorType
  101.   fCursorType;
  102. unsigned long
  103.   fId;
  104. IGraphicContext
  105.  *fGc;
  106. ITransformMatrix
  107.  *fCtm,
  108.  *fBtm;
  109. friend class IGList;
  110. Cursor::Cursor();
  111. Cursor& operator=(Cursor&);
  112. };
  113.  
  114.  
  115. /*------------------------- Adding Graphics Objects --------------------------*/
  116. virtual IGList
  117.   &addAsFirst      ( IGraphic&     graphic ),
  118.  
  119.   &addAsLast       ( IGraphic&     graphic ),
  120.  
  121.   &addAsNext       ( const Cursor& cursor,
  122.                      IGraphic&     graphic ),
  123.  
  124.   &addAsPrevious   ( const Cursor& cursor,
  125.                      IGraphic&     graphic ),
  126.  
  127.   &addAtPosition   ( unsigned long position,
  128.                      IGraphic&     graphic ),
  129.  
  130.   &replaceAt       ( const Cursor& cursor,
  131.                      IGraphic&     graphic );
  132.  
  133.  
  134. /*------------------------ Removing Graphic Objects --------------------------*/
  135. virtual IGList
  136.   &removeFirst     ( ),
  137.  
  138.   &removeLast      ( ),
  139.  
  140.   &removeAtPosition( unsigned long position   ),
  141.  
  142.   &removeAt        ( const Cursor& cursor     ),
  143.  
  144.   &removeAll       ( ),
  145.  
  146.   &removeAllWithId ( unsigned long identifier );
  147.  
  148.  
  149. /*---------------------------- Querying the List -----------------------------*/
  150. virtual unsigned long
  151.   numberOfGraphics   ( ) const;
  152.  
  153. virtual IBase::Boolean
  154.   isEmpty            ( ) const,
  155.   isIGList           ( const Cursor& cursor   ) const;
  156.  
  157. virtual IGraphic
  158.   *firstGraphic      ( ) const,
  159.  
  160.   *lastGraphic       ( ) const;
  161.  
  162. virtual IGraphic
  163.   &graphicAt         ( const Cursor& cursor   ) const,
  164.  
  165.   &graphicAtPosition ( unsigned long position ) const;
  166.  
  167. virtual IRectangle
  168.   boundingRectAt     ( const Cursor& cursor   ) const;
  169.  
  170. /*-------------------------- Reordering the List -----------------------------*/
  171. virtual IGList&
  172.   sort( long (*comparisonFunction)(IGraphic* const& graphic1,
  173.                                    IGraphic* const& graphic2));
  174.  
  175.  
  176. private:
  177. /*--------------------------------- Private ----------------------------------*/
  178. friend class IGList::Cursor;
  179. IGList& operator= ( const IGList& );
  180. IGListSeq
  181.  *fList;
  182. }; // IGList
  183.  
  184. #pragma pack()
  185.  
  186. #endif // _IGLIST_
  187.