home *** CD-ROM | disk | FTP | other *** search
/ The World of Computer Software / World_Of_Computer_Software-02-385-Vol-1of3.iso / i / iv26_w_3.zip / EXAMPLES / IDRAW / LISTSELE.H < prev    next >
C/C++ Source or Header  |  1980-01-05  |  3KB  |  91 lines

  1. /*
  2.  * Copyright (c) 1987, 1988, 1989 Stanford University
  3.  *
  4.  * Permission to use, copy, modify, distribute, and sell this software and its
  5.  * documentation for any purpose is hereby granted without fee, provided
  6.  * that the above copyright notice appear in all copies and that both that
  7.  * copyright notice and this permission notice appear in supporting
  8.  * documentation, and that the name of Stanford not be used in advertising or
  9.  * publicity pertaining to distribution of the software without specific,
  10.  * written prior permission.  Stanford makes no representations about
  11.  * the suitability of this software for any purpose.  It is provided "as is"
  12.  * without express or implied warranty.
  13.  *
  14.  * STANFORD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
  15.  * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS.
  16.  * IN NO EVENT SHALL STANFORD BE LIABLE FOR ANY SPECIAL, INDIRECT OR
  17.  * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
  18.  * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
  19.  * OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
  20.  * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
  21.  */
  22.  
  23. // $Header: listselectn.h,v 1.9 89/10/09 14:48:56 linton Exp $
  24. // declares classes SelectionNode and SelectionList.
  25.  
  26. #ifndef listselectn_h
  27. #define listselectn_h
  28.  
  29. #include "list.h"
  30.  
  31. // Declare imported types.
  32.  
  33. class Selection;
  34.  
  35. // A SelectionNode stores a pointer to a Selection.
  36.  
  37. class SelectionNode : public BaseNode {
  38. public:
  39.  
  40.     SelectionNode (Selection* s) { selection = s; }
  41.     boolean SameValueAs (void* p) { return selection == p; }
  42.     Selection* GetSelection () { return selection; }
  43.  
  44. protected:
  45.  
  46.     Selection* selection;    // points to a Selection
  47.  
  48. };
  49.  
  50. // A SelectionList manages a list of SelectionNodes.
  51.  
  52. class SelectionList : public BaseList {
  53. public:
  54.  
  55.     SelectionNode* First();
  56.     SelectionNode* Last();
  57.     SelectionNode* Prev();
  58.     SelectionNode* Next();
  59.     SelectionNode* GetCur();
  60.     SelectionNode* Index(int);
  61.  
  62. };
  63.  
  64. // Cast these functions to return SelectionNodes instead of BaseNodes.
  65.  
  66. inline SelectionNode* SelectionList::First () {
  67.     return (SelectionNode*) BaseList::First();
  68. }
  69.  
  70. inline SelectionNode* SelectionList::Last () {
  71.     return (SelectionNode*) BaseList::Last();
  72. }
  73.  
  74. inline SelectionNode* SelectionList::Prev () {
  75.     return (SelectionNode*) BaseList::Prev();
  76. }
  77.  
  78. inline SelectionNode* SelectionList::Next () {
  79.     return (SelectionNode*) BaseList::Next();
  80. }
  81.  
  82. inline SelectionNode* SelectionList::GetCur () {
  83.     return (SelectionNode*) BaseList::GetCur();
  84. }
  85.  
  86. inline SelectionNode* SelectionList::Index (int index) {
  87.     return (SelectionNode*) BaseList::Index(index);
  88. }
  89.  
  90. #endif
  91.