/*
 * Copyright 1994-1995 TriloBYTE Software Solutions.
 *
 * Author: Amen Zwa, TriloBYTE.
 */



// static char* sccsid = "XmWidget: %W%\t%G%\tAmen Zwa, TriloBYTE.";



// WHelp.h: help window class



#if !defined(WHELP_H)
#define WHELP_H

#include <iostream.h>
#include <fstream.h>
#include "WButton.h"
#include "WIcon.h"
#include "WShl.h"
#include "WEtc.h"



enum {
    ih_section_ubtn,
    ih_close_pbtn,
    ih_section_dtxt,
    ih_numwgt
};



// help section
struct WHelpSection : public ESLink {
    int sct;				// section number
    char* scttxt;			// section text
    long sctsiz;			// number of bytes allocated
    WHelpSection() { sct = 0; scttxt = 0; sctsiz = 0L; }
    ~WHelpSection() { if (sctsiz) delete[] scttxt; }
    int set_text(int ss, istream& is);
    int set_text(int ss, const char* s);
};



class WHelp : public WWindow {
    ESList sctlst;			// help section list
    int crtsct;				// currently selected help section
    WIcon icn;				// window icon
    void init();
    void set_text(int sct);
    friend void cp_popup_help(Widget w, XtPointer usr, XtPointer);
public:
    WHelp(const char* s);
    ~WHelp();
    // access functions
    int add_helpfile(const char** sctnam, const WPopupItem* itm);
    int add_helpbuffer(const char** sctbuf, const WPopupItem* itm);
    void set_section(int sct=-1);
};

#endif	// WHELP_H
