20.12 Scrolllists Interface

ORIGIN 'guienv';
LIB_DEF 'guienvscrolllists' '../lib';

BODY 'private/scrolllistsbody';
(*
 * COPYRIGHT
 *       Copyright (C) Mjolner Informatics, 1991-96
 *       All rights reserved.
 *)
-- windowLib: attributes --
scrollList: windowItem
  (# <<SLOT scrollListLib: attributes>>;
     numberOfItems: integerValue
       (* returns the number of items in THIS(scrollList). The items
        * in the scrollList are indexed from 1 to size. That is, size
        * is the index to the last item
        *)
       (# do ... #);
     insert: 
       (* the specified number of items (numOfItems) are inserted
        * before the specified item (beforeItem). The items in the
        * scrollList are indexed from 1 to value returned by "numOfItems"
        *)
       (# beforeItem, numOfItems: @integer;
       enter (beforeItem, numOfItems)
       do ...
       #);
     prepend: 
       (* the specified number of items (numOfItems) are inserted at
        * the beginning of THIS(scrollList). The items in the
        * scrollList are indexed from 1 to value returned by "numOfItems"
        *)
       (# numOfItems: @integer;
       enter numOfItems
       do ...
       #);
     append: 
       (* the specified number of items (numOfItems) are inserted at
        * the end of THIS(scrollList). The items in the scrollList are
        * indexed from 1 to value returned by "numOfItems"
        *)
       (# numOfItems: @integer;
       enter numOfItems
       do ...
       #);
     delete: 
       (* the specified range of items are deleted from
        * THIS(scrollList).  FirstItem is the index of the first item
        * to be deleted.  The items in the scrollList are indexed from
        * 1 to value returned by "numOfItems"
        *)
       (# firstItem, numOfItems: @integer;
       enter (firstItem, numOfItems)
       do ...
       #);
     deleteFirst: 
       (* the specified range of items are deleted from the beginning
        * of THIS(scrollList). The items in the scrollList are indexed
        * from 1 to value returned by "numOfItems"
        *)
       (# numOfItems: @integer;
       enter numOfItems
       do ...
       #);
     deleteLast: 
       (* the specified range of items are deleted from the end
        * of THIS(scrollList). The items in the scrollList are indexed
        * from 1 to value returned by "numberOfItems"
        *)
       (# numOfItems: @integer;
       enter numOfItems
       do ...
       #);
     itemHeight: 
       (* the height in pixels of a Item in THIS(scrollList) is the
        * same for all items.  Evaluate the enter-part to set the
        * height.  Evaluate the exit-part to get the height
        *)
       (# h: @integer;
       enter (# enter h do ... #)
       exit (#  do ... exit h #)
       #);
     multipleSelection:<
       (* if multipleSelection is TRUE the user is allowed to select
        * multiple elements in the list at a time.  
        *)
       booleanValue;
     getItemRectangle: 
       (* returns the rectangle occupied by the item specified by the
        * item index "theItem". The rectangle is in terms of the
        * coordinate system of the father of THIS(scrollList)
        *)
       (# theItem: @integer;
          theRectangle: @rectangle;
       enter theItem
       do ...
       exit theRectangle
       #);
     selection: @
       (# clear: 
            (* deselects all items in THIS(scrollList) *)
            (# do ... #);
          scrollIntoView: 
            (* scrolls THIS(scrollList) so the selected item are
             * visible
             *)
            (# do ... #);
          first: integerValue
            (* returns the index to the first selected item in
             * THIS(scrollList). There might be items between the
             * first and the last selected item that are not selected
             *)
            (# do ... #);
          last: integerValue
            (* returns the index to the last selected item in
             * THIS(scrollList). There might be items between the
             * first and the last selected item that are not selected
             *)
            (# do ... #);
          select: 
            (* selects the item specified by the item index
             * "theItem".  if extend is TRUE the item is added to the
             * selection, otherwise the selection is first emptied
             *)
            (# theItem: @integer;
               extend: @boolean;
            enter (theItem,extend)
            do ...
            #);
          deselect: 
            (* deselects the item specified by the item index
             * "theItem".  If the item wasn't selected nothing happens
             *)
            (# theItem: @integer;
            enter theItem
            do ...
            #);
          has: booleanValue
            (* returns whether the item specified by the item index
             * "theItem".  is selected
             *)
            (# theItem: @integer
            enter theItem
            do ...
            #);
       #) (* selection *);
     scanSelection: 
       (# current: @integer;
       do ...
       #);
     scan: 
       (# current: @integer;
       do ...
       #);
     open::< (# create::< (# do ... #);
       do ... 
       #);
     close::< (# do ... #);
     eventhandler::<
       (# select: event
            (* Called, when the user selects an item in 
             * this(scrollList). `Item' is the index of
             * the item in this(scrollList) and `doubleClick'
             * is true it the item was selected by a double
             * click.
             *)
            (# item: @integer;
               doubleClick: @boolean;
            enter (item, doubleClick)
            do INNER;
            #);
          onSelect:< select;
          onFrameChanged::<
            (# do ... #);
          onRefresh::<
            (# do ... #);
          onMouseDown::<
            (# do ... #);
          onActivate::<
            (# do ... #);
          onDeactivate::<
            (# do ... #);
          onVisibleChanged::<
            (# ... #);
       #);
     private: @...;
  #) (* scrollList *);
textScrollList: scrollList
  (# <<SLOT textScrollListLib: attributes>>;
     setText: 
       (* the item specified by the item index "theItem" is set to
        * the text "theText"
        *)
       (# theText: ^text;
          theItem: @integer;
       enter (theItem,theText[])
       do ...
       #);
     getText: 
       (* the text in the item specified by the item index "theItem"
        * is returned
        *)
       (# theText: ^text;
          theItem: @integer;
       enter theItem
       do ...
       exit theText[]
       #);
     style: 
       (* the style used to display the item texts in
        * THIS(textScrollList).  Evaluate the enter-part to set the
        * style.  Evaluate the exit-part to get the style
        *)
       (# setTextStyle: 
            (# theStyle: ^textStyle;
            enter theStyle[]
            do ...
            #);
          getTextStyle: 
            (# theStyle: ^textStyle;
            do ...
            exit theStyle[]
            #);
       enter setTextStyle
       exit getTextStyle
       #);
     open::< 
       (# create::< (# do ... #);
       do ... 
       #);
     close::< (# do ...; #);
  #)


20.12 Scrolllists Interface
© 1994-2002 Mjølner Informatics
[Modified: Saturday January 6th 2001 at 17:30]