home *** CD-ROM | disk | FTP | other *** search
- // Zinc Interface Library - D_OBJECT.CPP
- // COPYRIGHT (C) 1990, 1991. All Rights Reserved.
- // Zinc Software Incorporated. Pleasant Grove, Utah USA
-
- #include "ui_dsn.hpp"
- #include <fcntl.h>
- #include <string.h>
-
- UIW_OBJECT_ITEM::UIW_OBJECT_ITEM(int left, int top, int width,
- char *stringID, USHORT numberID, UI_WINDOW_OBJECT *_object) :
- UIW_POP_UP_ITEM(left, top,
- (stringID && strchr(stringID, '~')) ? width + 1 : width,
- (stringID) ? stringID : "", MNIF_NO_FLAGS, BTF_NO_TOGGLE,
- WOF_NO_FLAGS, UIW_OBJECT_ITEM::ObjectUserFunction, numberID),
- object(_object), popUpItem(NULL), pullDownItem(NULL)
- {
- search.numberID = numberID;
- }
-
- UIW_OBJECT_ITEM::UIW_OBJECT_ITEM(int left, int top, int width,
- char *stringID, USHORT numberID, UIW_POP_UP_ITEM *item) :
- UIW_POP_UP_ITEM(left, top,
- (stringID && strchr(stringID, '~')) ? width + 1 : width,
- (stringID) ? stringID : "", MNIF_NO_FLAGS, BTF_NO_TOGGLE,
- WOF_NO_FLAGS, UIW_OBJECT_ITEM::ObjectUserFunction, numberID),
- object(item), popUpItem(item), pullDownItem(NULL)
- {
- search.numberID = numberID;
- }
-
- UIW_OBJECT_ITEM::UIW_OBJECT_ITEM(int left, int top, int width,
- char *stringID, USHORT numberID, UIW_PULL_DOWN_ITEM *item) :
- UIW_POP_UP_ITEM(left, top,
- (stringID && strchr(stringID, '~')) ? width + 1 : width,
- (stringID) ? stringID : "", MNIF_NO_FLAGS, BTF_NO_TOGGLE,
- WOF_NO_FLAGS, UIW_OBJECT_ITEM::ObjectUserFunction, numberID),
- object(item), popUpItem(NULL), pullDownItem(item)
- {
- search.numberID = numberID;
- }
-
- int UIW_OBJECT_ITEM::Event(const UI_EVENT &event)
- {
- if (event.type == S_DISPLAY_ACTIVE || event.type == S_CURRENT)
- {
- if (string)
- delete string;
- if (popUpItem)
- string = ui_strdup(popUpItem->DataGet(FALSE));
- else if (pullDownItem)
- string = ui_strdup(pullDownItem->DataGet(FALSE));
- else
- string = ui_strdup(object->StringID());
- }
- return(UIW_POP_UP_ITEM::Event(event));
- }
-
- void UIW_OBJECT_ITEM::ObjectUserFunction(void *data, UI_EVENT &event)
- {
- event.type = S_EDIT_OBJECT;
- UIW_OBJECT_ITEM *object = (UIW_OBJECT_ITEM *)data;
- object->object->Editor(event);
- }
-
- void SaveFlags(UIW_MATRIX *matrix, USHORT *flag)
- {
- *flag = 0;
- for (UIW_POP_UP_ITEM *item = (UIW_POP_UP_ITEM *)matrix->First(); item; item = item->Next())
- if (FlagSet(item->woStatus, WOS_SELECTED))
- *flag |= item->value;
- }
-
-