home *** CD-ROM | disk | FTP | other *** search
- // Zinc Interface Library - LISTBLK.CPP
- // COPYRIGHT (C) 1990, 1991. All Rights Reserved.
- // Zinc Software Incorporated. Pleasant Grove, Utah USA
-
- #include "ui_gen.hpp"
-
- UI_LIST_BLOCK::~UI_LIST_BLOCK()
- {
- // Establish null lists so it doesn't free up an unknown block.
- first = last = 0;
- freeList.first = freeList.last = 0;
- }
-
- UI_ELEMENT *UI_LIST_BLOCK::Add(UI_ELEMENT *element)
- {
- UI_ELEMENT *newElement = freeList.first;
-
- // Add a new list element to the use list at specified location.
- if (newElement)
- {
- freeList.Subtract(newElement);
- UI_LIST::Add(element, newElement);
- }
-
- // Return a pointer to the new element.
- return (newElement);
- }
-
- UI_ELEMENT *UI_LIST_BLOCK::Add()
- {
- UI_ELEMENT *newElement = freeList.first;
-
- // Add a new list element to the use list according to compareFunction.
- if (newElement)
- {
- freeList.Subtract(newElement);
- UI_LIST::Add(newElement);
- }
-
- // Return a pointer to the new element.
- return (newElement);
- }
-
- UI_ELEMENT *UI_LIST_BLOCK::Subtract(UI_ELEMENT *element)
- {
- UI_ELEMENT *nextElement = element->Next();
-
- // Delete the element from the use list.
- UI_LIST::Subtract(element);
- freeList.Add(0, element);
-
- // Return the next element.
- return (nextElement);
- }
-