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 / D_OBJECT.CPP < prev    next >
Encoding:
C/C++ Source or Header  |  1991-06-01  |  2.3 KB  |  73 lines

  1. //    Zinc Interface Library - D_OBJECT.CPP
  2. //    COPYRIGHT (C) 1990, 1991.  All Rights Reserved.
  3. //    Zinc Software Incorporated.  Pleasant Grove, Utah  USA
  4.  
  5. #include "ui_dsn.hpp"
  6. #include <fcntl.h>
  7. #include <string.h>
  8.  
  9. UIW_OBJECT_ITEM::UIW_OBJECT_ITEM(int left, int top, int width,
  10.     char *stringID, USHORT numberID, UI_WINDOW_OBJECT *_object) :
  11.     UIW_POP_UP_ITEM(left, top,
  12.     (stringID && strchr(stringID, '~')) ? width + 1 : width,
  13.     (stringID) ? stringID : "", MNIF_NO_FLAGS, BTF_NO_TOGGLE,
  14.     WOF_NO_FLAGS, UIW_OBJECT_ITEM::ObjectUserFunction, numberID),
  15.     object(_object), popUpItem(NULL), pullDownItem(NULL)
  16. {
  17.     search.numberID = numberID;
  18. }
  19.  
  20. UIW_OBJECT_ITEM::UIW_OBJECT_ITEM(int left, int top, int width,
  21.     char *stringID, USHORT numberID, UIW_POP_UP_ITEM *item) :
  22.     UIW_POP_UP_ITEM(left, top,
  23.     (stringID && strchr(stringID, '~')) ? width + 1 : width,
  24.     (stringID) ? stringID : "", MNIF_NO_FLAGS, BTF_NO_TOGGLE,
  25.     WOF_NO_FLAGS, UIW_OBJECT_ITEM::ObjectUserFunction, numberID),
  26.     object(item), popUpItem(item), pullDownItem(NULL)
  27. {
  28.     search.numberID = numberID;
  29. }
  30.  
  31. UIW_OBJECT_ITEM::UIW_OBJECT_ITEM(int left, int top, int width,
  32.     char *stringID, USHORT numberID, UIW_PULL_DOWN_ITEM *item) :
  33.     UIW_POP_UP_ITEM(left, top,
  34.     (stringID && strchr(stringID, '~')) ? width + 1 : width,
  35.     (stringID) ? stringID : "", MNIF_NO_FLAGS, BTF_NO_TOGGLE,
  36.     WOF_NO_FLAGS, UIW_OBJECT_ITEM::ObjectUserFunction, numberID),
  37.     object(item), popUpItem(NULL), pullDownItem(item)
  38. {
  39.     search.numberID = numberID;
  40. }
  41.  
  42. int UIW_OBJECT_ITEM::Event(const UI_EVENT &event)
  43. {
  44.     if (event.type == S_DISPLAY_ACTIVE || event.type == S_CURRENT)
  45.     {
  46.         if (string)
  47.             delete string;
  48.         if (popUpItem)
  49.             string = ui_strdup(popUpItem->DataGet(FALSE));
  50.         else if (pullDownItem)
  51.             string = ui_strdup(pullDownItem->DataGet(FALSE));
  52.         else
  53.             string = ui_strdup(object->StringID());
  54.     }
  55.     return(UIW_POP_UP_ITEM::Event(event));
  56. }
  57.  
  58. void UIW_OBJECT_ITEM::ObjectUserFunction(void *data, UI_EVENT &event)
  59. {
  60.     event.type = S_EDIT_OBJECT;
  61.     UIW_OBJECT_ITEM *object = (UIW_OBJECT_ITEM *)data;
  62.     object->object->Editor(event);
  63. }
  64.  
  65. void SaveFlags(UIW_MATRIX *matrix, USHORT *flag)
  66. {
  67.     *flag = 0;
  68.     for (UIW_POP_UP_ITEM *item = (UIW_POP_UP_ITEM *)matrix->First(); item; item = item->Next())
  69.         if (FlagSet(item->woStatus, WOS_SELECTED))
  70.             *flag |= item->value;
  71. }
  72.  
  73.