home *** CD-ROM | disk | FTP | other *** search
/ IRIX 6.3 Development Libraries / SGI IRIX 6.3 Development Libraries.iso / dist6.3 / ViewKit_dev.idb / usr / include / Vk / VkCallbackList.h.z / VkCallbackList.h
Encoding:
C/C++ Source or Header  |  1996-09-20  |  2.8 KB  |  79 lines

  1. ////////////////////////////////////////////////////////////////////////////////
  2. ///////   Copyright 1992, Silicon Graphics, Inc.  All Rights Reserved.   ///////
  3. //                                                                            //
  4. // This is UNPUBLISHED PROPRIETARY SOURCE CODE of Silicon Graphics, Inc.;     //
  5. // the contents of this file may not be disclosed to third parties, copied    //
  6. // or duplicated in any form, in whole or in part, without the prior written  //
  7. // permission of Silicon Graphics, Inc.                                       //
  8. //                                                                            //
  9. // RESTRICTED RIGHTS LEGEND:                                                  //
  10. // Use,duplication or disclosure by the Government is subject to restrictions //
  11. // as set forth in subdivision (c)(1)(ii) of the Rights in Technical Data     //
  12. // and Computer Software clause at DFARS 252.227-7013, and/or in similar or   //
  13. // successor clauses in the FAR, DOD or NASA FAR Supplement. Unpublished -    //
  14. // rights reserved under the Copyright Laws of the United States.             //
  15. //                                                                            //
  16. ////////////////////////////////////////////////////////////////////////////////
  17. #ifndef VkCALLBACKLIST_H
  18. #define VkCALLBACKLIST_H
  19.  
  20. #include <Vk/VkCallbackObject.h>
  21.  
  22. class VkCallbackItem {
  23.  
  24.   friend class VkCallbackList;
  25.   friend class VkCallbackObject;
  26.  
  27.   public:
  28.  
  29.     VkCallbackItem(VkCallbackObject *obj, const char *const name, VkCallbackMethod, void * clientData);
  30.     VkCallbackItem(const char *const name, VkCallbackFunction, void *clientData);
  31.     ~VkCallbackItem();
  32.  
  33.     void invoke(VkCallbackObject *, const char * const, void *);
  34.  
  35.   private:
  36.  
  37.     VkCallbackObject   *_obj;
  38.     char               *_name;
  39.     VkCallbackFunction  _func;    
  40.     VkCallbackMethod    _method;
  41.     void               *_clientData;
  42. };
  43.  
  44. class VkCallbackList {
  45.  
  46.  friend class VkCallbackObject;
  47.  
  48.   public:
  49.  
  50.   void add(VkCallbackItem *);
  51.   void add(VkCallbackList *);
  52.   void add(const char *const name,  VkCallbackObject *obj, VkCallbackMethod, void *clientData);
  53.   void add(const char *const name, VkCallbackFunction, void *clientData);
  54.  
  55.   void invoke(VkCallbackObject *, const char *const, void *);
  56.   int hasCallbacks(const char *);
  57.  
  58.   int size() { return (_numCallbacks);}
  59.  
  60.   VkCallbackItem *operator[] (int index) const { return (_callbacks[index]); }
  61.  
  62.   void remove(VkCallbackItem *);
  63.   void remove(const char *const name, VkCallbackObject *obj, VkCallbackMethod, void *clientData);
  64.   void remove(VkCallbackObject *obj);
  65.   void remove (const char *const name, VkCallbackFunction, void *clientData);
  66.  
  67.   VkCallbackList();
  68.   ~VkCallbackList();
  69.  
  70.   private:
  71.  
  72.     VkCallbackItem    **_callbacks;
  73.     int            _numCallbacks;
  74.     inline void        doDelete (int i);
  75. };
  76.  
  77.  
  78. #endif
  79.