home *** CD-ROM | disk | FTP | other *** search
- // Zinc Interface Library - MAP.CPP
- // COPYRIGHT (C) 1990, 1991. All Rights Reserved.
- // Zinc Software Incorporated. Pleasant Grove, Utah USA
-
- #include "ui_map.hpp"
-
- int EXPORT MapEvent(UI_EVENT_MAP *mapTable, const UI_EVENT &event, int currentID,
- int id1, int id2, int id3, int id4, int id5)
- {
- int level = 4;
- int eventType = event.type;
- int logicalValue = eventType;
- USHORT eventRawCode = event.rawCode;
- int id[4] = { id2, id3, id4, id5 };
- if (currentID == id1)
- currentID = 0;
- else if (currentID == id2)
- currentID = 1;
- else if (currentID == id3)
- currentID = 2;
- else if (currentID == id4)
- currentID = 3;
- else
- currentID = 4;
-
- // Try to find a matching event.
- for (UI_EVENT_MAP *map = mapTable; map->windowID != ID_END; map++)
- if (map->rawCode == eventRawCode && map->eventType == eventType)
- {
- if (map->windowID == id1 && currentID == 0)
- return(map->logicalValue);
- int i = (currentID == 0) ? 0 : currentID - 1;
- for ( ; i < 4; i++)
- if (map->windowID == id[i] && level > i)
- {
- level = i;
- logicalValue = map->logicalValue;
- break;
- }
- }
-
- // Return the logical match value.
- return (logicalValue);
- }
-