home *** CD-ROM | disk | FTP | other *** search
/ Piper's Pit BBS/FTP: ibm 0040 - 0049 / ibm0040-0049 / ibm0040.tar / ibm0040 / ZINC_6.ZIP / DOSSRC.ZIP / JUMP.CPP < prev    next >
Encoding:
C/C++ Source or Header  |  1991-06-01  |  1.7 KB  |  64 lines

  1. //    Zinc Interface Library
  2. //    COPYRIGHT (C) 1990.  All Rights Reserved.
  3. //    Zinc Software Incorporated.  Pleasant Grove, Utah  USA
  4.  
  5. #include "ui_win.hpp"
  6. #include <string.h>
  7.  
  8. #ifdef ZIL_LOAD
  9.  
  10. UI_JUMP_LIST UI_JUMP_LIST::_jumpList;
  11.  
  12. UI_JUMP_ELEMENT::UI_JUMP_ELEMENT(char *_name, char *_codeName, int _type,
  13.     UI_WINDOW_OBJECT *(*_newFunction)(const char *name, UI_STORAGE *file, USHORT loadFlags)) :
  14.     type(_type), newFunction(_newFunction)
  15. {
  16.     strcpy(name, _name ? _name : "");
  17.     strcpy(codeName, _codeName ? _codeName : "");
  18. }
  19.  
  20. UI_JUMP_ELEMENT::UI_JUMP_ELEMENT(int _type,
  21.     UI_WINDOW_OBJECT *(*_newFunction)(const char *name, UI_STORAGE *file, USHORT loadFlags)) :
  22.     type(_type), newFunction(_newFunction)
  23. {
  24.     name[0] = codeName[0] = '\0';
  25. }
  26.  
  27. int UI_JUMP_ELEMENT::FindName(void *object, void *matchName)
  28. {
  29.     return (strcmpi(((UI_JUMP_ELEMENT *)object)->name, (char *)matchName));
  30. }
  31.  
  32. int UI_JUMP_ELEMENT::FindType(void *object, void *matchType)
  33. {
  34.     return ((((UI_JUMP_ELEMENT *)object)->type == *(int *)matchType) ? 0 : -1);
  35. }
  36.  
  37. void UI_JUMP_LIST::GetFunction(const char *name,
  38.     UI_WINDOW_OBJECT *(**newFunction)(const char *name, UI_STORAGE *file, USHORT loadFlags))
  39. {
  40.     UI_JUMP_ELEMENT *element = (UI_JUMP_ELEMENT *)UI_LIST::Get(UI_JUMP_ELEMENT::FindName, name);
  41.     if (element)
  42.     {
  43.         *newFunction = element->newFunction;
  44.         element->used = TRUE;
  45.     }
  46.     else
  47.         *newFunction = NULL;
  48. }
  49.  
  50. void UI_JUMP_LIST::GetFunction(int type,
  51.     UI_WINDOW_OBJECT *(**newFunction)(const char *name, UI_STORAGE *file, USHORT loadFlags))
  52. {
  53.     UI_JUMP_ELEMENT *element = (UI_JUMP_ELEMENT *)UI_LIST::Get(UI_JUMP_ELEMENT::FindType, &type);
  54.     if (element)
  55.     {
  56.         *newFunction = element->newFunction;
  57.         element->used = TRUE;
  58.     }
  59.     else
  60.         *newFunction = NULL;
  61. }
  62.  
  63. #endif
  64.