/* Public include file for users of the Select "class" */

#include <exec/types.h>
#include <exec/nodes.h>
#include <exec/lists.h>
#include <intuition/intuition.h>

/* return values from HandleSelIDCMP(Select *). Positive values indicate selection */
#define SEL_PRIVATE -1  /* Nothing important for us (resize, scroll etc) */
#define SEL_CANCEL -2 
#define SEL_SELECT -3   /* Singleclick or keypress */
#define SEL_OK -4       /* Doubleclick or ENTER press */
#define SEL_HELP -5


/* Needed libraries (automatically opened by SAS C) */
extern struct IntuitionBase *IntuitionBase;
extern struct GfxBase            *GfxBase;
extern struct Library       *GadToolsBase;
extern struct Library            *UtilityBase; /* Strnicmp() */

/* Needed global variables. Please set these first */
extern struct Screen        *Scr;
extern APTR                  VisualInfo;

/* The SelectWindow "class" */

#define COMPLETEBUFSIZ 10
typedef struct {
        struct Window        *SelWnd;
        UWORD                 SelZoom[4];
        struct Gadget        *SelGList;
        struct IntuiMessage   SelMsg;
        struct Gadget        *ListView;
        UWORD                 SelLeft;
        UWORD                 SelTop;
        UWORD                 SelWidth;
        UWORD                 SelHeight;
        UBYTE                *SelCompleteBuf;
        struct MinList        SelList;
        struct Node           *NodeArray;            /* For fixed-size allocations */
        int                   FirstFree;             /* For fixed-size allocations */
        int SelIndex;
        int SelTotal;
        char SelWdt[COMPLETEBUFSIZ+50];
        ULONG StartSecs, StartMicros;
} Select;


/* Functions you may call */

extern Select *NewSelect(void);
extern void DeleteSelect(Select *);
extern int OpenSelect(Select *, struct Window *parentwin, char *wintitle, char *screentitle);
extern int HandleSelectIDCMP(Select *);
extern void CloseSelect(Select *);

extern void DisableSelect(Select *s, BOOL flag);
extern void CurrentIndex(Select *s, int index);
extern char *SelectedString(Select *);
void UpdateString(Select *s, int index, char *newstring);
extern char *AddStringFirst(Select *, char *);
extern char *AddStringLast(Select *, char *);
extern char *AddString(Select *, char *, int);
extern char *RemoveFirstString(Select *);
extern char *RemoveLastString(Select *);
extern char *RemoveString(Select *, int);
extern void RemoveAllStrings(Select *);

extern BOOL FixSelectSize(Select *s, int n);            /* For speed when handling long lists */
