//
// Copyright (c) 1997 Jean-Marc Zucconi
// All rights reserved.
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions
// are met:
// 1. Redistributions of source code must retain the above copyright
//    notice, this list of conditions and the following disclaimer
//    in this position and unchanged.
// 2. Redistributions in binary form must reproduce the above copyright
//    notice, this list of conditions and the following disclaimer in the
//    documentation and/or other materials provided with the distribution.
// 3. The name of the author may not be used to endorse or promote products
//    derived from this software withough specific prior written permission
//
// THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
// IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
// OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
// IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
// NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
// THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
//
//  $Id: c++tk.h,v 1.24 2003/12/25 13:37:27 jmz Exp $
//
#ifndef __CXXTK_H__
#define __CXXTK_H__

#include <stdlib.h> // for free()
#include <string.h>

extern int TkError;

typedef struct {int x, y, width, height;} Bbox;
typedef struct {float a, b;} Fraction;
typedef struct {int x, y, width, height, baseline;} Area;

class CXXTkIndex {
public:
    CXXTkIndex(){active="ac",anchor="an";end="en";insert="in";
    mark="ma"; sel_first="s.f";sel_last="s.l";tag_first="t.f"; tag_last="t.l";}
    ~CXXTkIndex(){}
    char *active;
    char *anchor;
    char *end;
    char *insert;
    char *mark;
    char *sel_first;
    char *sel_last;
    char *tag_first;
    char *tag_last;
    char *n(int);
    char *x(int);
    char *xy(int,int);
    char *lc(int,int);
    char *pathname(char *s){return s;}
};
static CXXTkIndex Index;

class Button {
private:
    char *pname;
public:
    const char *pathname() {return pname;}
    Button () {}
    ~Button () {}
    char *cget (char *);
    char *configure (char *, char * = 0); 
    void command (void (*fcn)(int, char **), char * = 0); 
    void flash();
    void invoke ();
    void textvariable (char *);
    friend Button TkButton(char *, char * = 0);
};

class Entry {
private:
    char *pname;
public:
    const char *pathname() {return pname;}
    Entry () {}
    ~Entry () {}
    Bbox bbox (char *);
    Bbox bbox (int i) {return bbox (Index.n(i));}
    char *cget (char *);
    char *configure (char *, char * = 0); 
    void delet (char *, char * = 0);
    void delet (int i, char * s= 0) {delet (Index.n(i), s);}
    char *get ();
    int icursor (char *);
    int icursor (int i) {return icursor (Index.n(i));}
    int index (char *);
    void insert (char*, char *);
    void insert (int i, char *s) {insert (Index.n(i), s);}
    void scan (char *, int);
    int selection(char *, char * = 0, char * = 0);
    void textvariable (char *);
    Fraction xview () {return xview ((char *)0);}
    Fraction xview (int i) {return xview (Index.n(i));}
    Fraction xview (char *, char * = 0, char * = 0);
    Fraction xview (char *, float);
    Fraction xview (char *s, int i, char *p) {return xview (s, Index.n(i), p);}
    void xscrollcommand (void (*fcn)(int, char **), char * = 0); 
    friend Entry TkEntry (char *, char * = 0, char * = 0);
};

class Frame {
private:
    char *pname;
public:
    const char *pathname() {return pname;}
    Frame () {}
    ~Frame () {}
    char *cget (char *);
    char *configure (char *); 
    friend Frame TkFrame (char *, char * = 0);
};    

class Toplevel {
private:
    char *pname;
public:
    const char *pathname() {return pname;}
    Toplevel () {}
    ~Toplevel () {}
    char *cget (char *);
    char *configure (char *); 
    friend Toplevel TkToplevel (char *, char * = 0);
};    

class Label {
private:
    char *pname;
public:
    const char *pathname() {return pname;}
    Label () {}
    ~Label () {}
    char *cget (char *);
    char *configure (char *, char * = 0, char * = 0, char * = 0); 
    void textvariable (char *);
    friend Label TkLabel (char *, char * = 0, char * = 0, char * = 0);
};    
    
class Checkbutton {
private:
    char *pname;
public:
    const char *pathname() {return pname;}
    Checkbutton () {}
    ~Checkbutton () {}
    char *cget (char *);
    char *configure (char *, char * = 0, char * = 0); 
    void command (void (*fcn)(int, char **), char * = 0); 
    void variable (int *);
    void textvariable (char *);
    void deselect ();
    void flash ();
    void invoke ();
    void select ();
    void toggle ();
    friend Checkbutton TkCheckbutton (char *, char * = 0);
};    
class Radiobutton {
private:
    char *pname;
public:
    const char *pathname() {return pname;}
    Radiobutton () {}
    ~Radiobutton () {}
    char *cget (char *);
    char *configure (char *); 
    void command (void (*fcn)(int, char **), char * = 0); 
    void deselect ();
    void flash ();
    void invoke ();
    void textvariable (char *);
    void select ();
    void variable (int *);
    friend Radiobutton TkRadiobutton (char *, char * = 0, char * = 0, char * = 0, char * = 0);
};    
    
class Message {
private:
    char *pname;
public:
    const char *pathname() {return pname;}
    Message () {}
    ~Message () {}
    char *cget (char *);
    char *configure (char *); 
    friend Message TkMessage (char *, char * = 0);
};    

class Scrollbar {
private:
    char *pname;
public:
    const char *pathname() {return pname;}
    Scrollbar () {}
    ~Scrollbar () {}
    void command (void (*fcn)(int, char **), char * = 0); 
    char *activate ();
    char *cget (char *);
    char *configure (char *); 
    float delta (int, int = 0);
    float fraction (int, int);
    char *get ();
    char *identify (int, int);
    void set (float, float );
    friend Scrollbar TkScrollbar (char *, char * = 0);
};

class Listbox {
private:
    char *pname;
public:
    const char *pathname() {return pname;}
    Listbox () {}
    ~Listbox () {}
    void activate (char *);
    void activate (int i) {activate (Index.n(i));}
    Bbox bbox (char *);
    Bbox bbox (int i) {return bbox (Index.n(i));}
    char *cget (char *);
    char *configure (char *); 
    void xscrollcommand (void (*fcn)(int, char **), char * = 0); 
    void yscrollcommand (void (*fcn)(int, char **), char * = 0); 
    char *curselection ();
    void delet (char *, char * = 0);
    void delet (int i) {delet (Index.n(i));}
    void delet (int i, int j) {char s[10]; strcpy (s, Index.n(i)); delet (s, Index.n(j));}
    void delet (char *s, int i) {delet (s, Index.n(i));}
    void delet (int i, char *s) {delet (Index.n(i), s);}
    char *get (char *);
    char *get (int i) {return get (Index.n(i));}
    int index (char *);
    void insert (char*, char *, char * = 0);
    void insert (int i, char *s, char *p = 0) {insert (Index.n(i), s, p);}
    int nearest (int);
    void scan (char *, int, int);
    void see (char *);
    void see (int i) {see (Index.n(i));}
    int selection(char *, char * = 0, char * = 0);
    int selection(char *s, int i) {return selection (s, Index.n(i));}
    int selection(char *p, int i, int j) {char s[10]; strcpy (s, Index.n(i));return selection (p, s, Index.n(j));}
    int selection(char *p, int i, char *q) {return selection (p, Index.n(i), q);}
    int selection(char *p, char *q, int i) {return selection (p, q, Index.n(i));}
    int size ();
    Fraction xview () {return xview ((char *) 0);}
    Fraction xview (char *, char * = 0, char * = 0);
    Fraction xview (int i) {return xview (Index.n(i));}
    Fraction xview (char *, float);
    Fraction xview (char *s, int i, char *p){return  xview (s, Index.n(i), p);}
    Fraction yview () {return yview ((char *) 0);}
    Fraction yview (char *, char * = 0, char * = 0);
    Fraction yview (char *s, int i, char *p){return  yview (s, Index.n(i), p);}
    Fraction yview (char *, float);
    Fraction yview (int i) {return yview (Index.n(i));}
    friend Listbox TkListbox (char *, char * = 0);
};
class Image {
private:
    char *pname;
public:
    const char *pathname() {return pname;}
    Image () {}
    ~Image () {}
    char *configure (char *); 
    friend Image TkImage (char *, char * = 0, char * = 0);
};

class Text {
private:
    char *pname;
public:
    const char *pathname() {return pname;}
    Text () {}
    ~Text () {}
    Bbox bbox (char *);
    char *cget (char *);
    int compare (char *, char *, char *);
    char *configure (char *, char * = 0); 
    void debug (int);
    void delet (char *, char * = 0);
    Area dlineinfo (char *);
    char * dump (char *, char * = 0, char * = 0);
    char *get (char *, char * = 0);
    char *image (char *, char * = 0, char * = 0);
    char *index (char *);
    void insert (char*, char *, char * = 0);
    void mark (char*, char * = 0, char * = 0);
    void scan (char *, int, int);
    char *search (char *, char *, char * = 0, char * = 0);
    void see (char *);
    void tag (char *, char * = 0, char * = 0, char * = 0, char * = 0);
    void tag (char *, char *, char *, void (*fcn)(int, char **), char * = 0);
    void window (char *, char * = 0, char * = 0, char * = 0);
    Fraction xview () {return xview ((char *) 0);}
    Fraction xview (char *, char * = 0, char * = 0);
    Fraction xview (int i) {return xview (Index.n(i));}
    Fraction xview (char *, float);
    Fraction xview (char *s, int i, char *p){return  xview (s, Index.n(i), p);}
    Fraction yview () {return yview ((char *) 0);}
    Fraction yview (char *, char * = 0, char * = 0);
    Fraction yview (char *s, int i, char *p){return  yview (s, Index.n(i), p);}
    Fraction yview (char *, float);
    Fraction yview (int i) {return yview (Index.n(i));}
    void xscrollcommand (void (*fcn)(int, char **), char * = 0); 
    void yscrollcommand (void (*fcn)(int, char **), char * = 0); 
    friend Text TkText (char *, char * = 0, char * = 0);
};
class Canvas {
private:
    char *pname;
public:
    const char *pathname() {return pname;}
    Canvas () {}
    ~Canvas () {}
    void addtag (char *, char * = 0);
    void addtag (char *, int, int, char * = 0, char * = 0);
    void addtag (char *, int, int, int, int);
    Bbox bbox (char *, char * = 0, char * = 0);
    Bbox bbox (int i, char *p = 0, char *q = 0) {return bbox (Index.n(i), p, q);}
    void bind (int i) {bind (Index.n(i));}
    void bind (char *);
    void bind (char *, char *, void (*fcn)(int, char **), char * = 0);
    void bind (int i, char *s, void (*fcn)(int, char **), char *p = 0) { bind (Index.n(i), s,  fcn, p);}
    int canvasx (int);
    int canvasx (int, int);
    int canvasy (int);
    int canvasy (int, int);
    char *cget (char *);
    char *configure (char *, char * = 0); 
    char *coords (char *, char * = 0);
    char *coords (int i, char *p = 0) {return coords (Index.n(i), p);}
    int create (char *, char *);
    void dchars (char *, char *, char * = 0);
    void delet (char *, char * = 0);
    void delet (int i) {delet (Index.n(i));}
    void dchars (char *p, int i, char *s = 0){dchars (p, Index.n(i), s);}
    char *find (char *, char * = 0, char * = 0, char * = 0);
    void focus (char * = 0);
    void focus (int i) {focus (Index.n(i));}
    char *gettags (char *);
    char *gettags (int i) {return gettags (Index.n(i));}
    void icursor (char *, char *);
    void icursor (int i, char *p) {icursor(Index.n(i), p);}
    void icursor (char *p, int i) {icursor(p, Index.n(i));}
    void icursor (int i, int j) {char s[10]; strcpy (s, Index.n(i));icursor (s, Index.n(j));}
    int index (char *, char *);
    int index (int i, char *p) {index(Index.n(i), p);}
    int index (char *p, int i) {index(p, Index.n(i));}
    int index (int i, int j) {char s[10]; strcpy (s, Index.n(i));return index (s, Index.n(j));}
    void insert (char*, char *, char *);
    char *itemcget (char *, char *);
    char *itemcget (int i, char *s) {return itemcget(Index.n(i), s);}
    char *itemconfigure (char *, char * = 0, char * = 0, char * = 0, char * = 0);
    char *itemconfigure (int i, char *a = 0, char *b = 0, char *c = 0, char *d = 0) {itemconfigure(Index.n(i),a,b,c,d);}
    void lower (char *, char * = 0);
    void lower (int i, char *s = 0){lower (Index.n(i), s);}
    void move (char *, char *);
    void move (int i, char *s) {move(Index.n(i), s);}
    void move (char *, int, int);
    void move (int i, int j, int k) {move(Index.n(i), j, k);}
    char *postscript (char *, char * = 0, char * = 0);
    void raise (char *, char * = 0);
    void raise (int i, char *s = 0){raise (Index.n(i), s);}
    void scale (char *, char *, char *, char *, char *);
    void scale (int i,char *a, char *b, char *c, char *d){scale (Index.n(i), a, b, c, d);}
    void mark (char*, char * = 0, char * = 0);
    void scan (char *, int, int);
    void select (char *, char * = 0, char * = 0);
    char *type (char *);
    char *type (int i) {return type (Index.n(i));}
    void window (char *, char * = 0, char * = 0, char * = 0);
    Fraction xview () {return xview ((char *) 0);}
    Fraction xview (char *, char * = 0, char * = 0);
    Fraction xview (int i) {return xview (Index.n(i));}
    Fraction xview (char *, float);
    Fraction xview (char *s, int i, char *p){return  xview (s, Index.n(i), p);}
    Fraction yview () {return yview ((char *) 0);}
    Fraction yview (char *, char * = 0, char * = 0);
    Fraction yview (char *s, int i, char *p){return  yview (s, Index.n(i), p);}
    Fraction yview (char *, float);
    Fraction yview (int i) {return yview (Index.n(i));}
    void xscrollcommand (void (*fcn)(int, char **), char * = 0); 
    void yscrollcommand (void (*fcn)(int, char **), char * = 0); 
    friend Canvas TkCanvas (char *, char * = 0, char * = 0);
};

class Scale {
private:
    char *pname;
public:
    const char *pathname() {return pname;}
    Scale () {}
    ~Scale () {}
    void command (void (*fcn)(int, char **), char * = 0);
    void variable (int *);
    char *cget (char *);
    char *configure (char *, char * = 0); 
    char *coords (char *, char * = 0);
    char *coords (int i, char *p = 0) {return coords (Index.n(i), p);}
    char *get ();
    char *get (int, int);
    char *identify (int i, int y);
    void set (int);
    void set (float);
    friend Scale TkScale (char *, char * = 0);
};

class Menubutton {
private:
    char *pname;
public:
    const char *pathname() {return pname;}
    Menubutton () {}
    ~Menubutton () {}
    void textvariable (char *);
    char *cget (char *);
    char *configure (char *, char * = 0); 
    friend Menubutton TkMenubutton (char *, char * = 0);
};

class Menu {
private:
    char *pname;
public:
    const char *pathname() {return pname;}
    Menu () {}
    ~Menu () {}
    void postcommand (void (*fcn)());
    void tearoffcommand (void (*fcn)(int, char **));
    void variable (int *);
    char *configure (char *, char * = 0); 
    void activate (char *);
    void activate (int i) {activate (Index.n(i));}
    void add (char *, char * = 0, char * = 0);
    void add (char *, void (*fcn)(int, char **), char * = 0);
    char *cget (char *);
    void delet (char *, char * = 0);
    void delet (int i) {delet (Index.n(i));}
    char *entrycget (char *);
    char *entrycget (int i) {entrycget (Index.n(i));}
    char *entryconfigure (char *, char *p);
    char *entryconfigure (int i, char *p = 0) {entryconfigure (Index.n(i), p);}
    int index (char *);
    int index (int i) {index(Index.n(i));}
    void insert (char*, char *, char * = 0);
    void insert (char *a, int i, char *b = 0) {insert (a, Index.n(i), b);}
    char *invoke (char *);
    char *invoke (int i) {return invoke (Index.n(i));}
    void post (int, int);
    void postcascade (char *);
    void postcascade (int i) {postcascade (Index.n(i));}
    char *type (char *);
    char *type (int i) {return type (Index.n(i));}
    void unpost ();
    void yposition (char *);
    void yposition (int i) {yposition (Index.n(i));}
    friend Menu TkMenu (char *, char * = 0);
};
#ifdef TIX
class tixsubwidget {
private:
char *pname, *name;
public:
    tixsubwidget () {}
    ~tixsubwidget () {}
    char *configure (char * = 0, char * = 0);
    void command (void (*fcn)(int, char **), char * = 0);
    void browsecmd (void (*fcn)(int, char **), char * = 0);
    void _(char *p, char *q) {pname = p; name = q;}
};
class DirList {
private:
    char *pname;
    tixsubwidget *sub;
public:
    const char *pathname() {return pname;}
    DirList () {sub = 0;}
    ~DirList () {if (sub) delete sub;}
    char *cget (char *);
    char *chdir (char *);
    char *configure (char *, char * = 0); 
    tixsubwidget *subwidget (char *); 
    char *subwidget (char *, char *, char * = 0); 
    friend DirList tixDirList (char *, char * = 0);
};
class Balloon {
private:
    char *pname;
    tixsubwidget *sub;
public:
    const char *pathname() {return pname;}
    Balloon () {sub = 0;}
    ~Balloon () {if (sub) delete sub;}
    void bind (char *, char * = 0);
    char *cget (char *);
    char *configure (char *, char * = 0); 
    void unbind (char *, char *);
    tixsubwidget *subwidget (char *);
    char *subwidget (char *, char *, char * = 0); 
    friend Balloon tixBalloon (char *, char * = 0);
};
class ButtonBox {
private:
    char *pname;
    tixsubwidget *sub;
public:
    const char *pathname() {return pname;}
    ButtonBox () {sub = 0;}
    ~ButtonBox () {if (sub) delete sub;}
    void add (char *, char * = 0);
    char *cget (char *);
    char *configure (char *, char * = 0); 
    void invoke (char *);
    tixsubwidget *subwidget (char *);
    char *subwidget (char *, char *, char * = 0); 
    friend ButtonBox tixButtonBox (char *, char * = 0);
};
class CheckList {
private:
    char *pname;
    tixsubwidget *sub;
public:
    const char *pathname() {return pname;}
    CheckList () {sub = 0;}
    ~CheckList () {if (sub) delete sub;}
    char *getselection (char * = 0);
    char *getstatus (char *);
    char *setstatus (char *, char *);
    tixsubwidget *subwidget (char *);
    char *subwidget (char *, char *, char * = 0); 
    friend CheckList tixCheckList (char *, char * = 0);
};
class ComboBox {
private:
    char *pname;
    tixsubwidget *sub;
public:
    const char *pathname() {return pname;}
    ComboBox () {sub = 0;}
    ~ComboBox () {if (sub) delete sub;}
    void addhistory (char *);
    void appendhistory (char *);
    char *cget (char *);
    char *configure (char *, char * = 0); 
    void flash (char *, char *);
    void flash (int i, char *p) {flash (Index.n(i), p);}
    void insert (char *, char *);
    void insert (int i, char *p) {insert (Index.n(i), p);}
    void pick (char *);
    void pick (int i) {pick (Index.n(i));}
    tixsubwidget *subwidget (char *);
    char *subwidget (char *, char *, char * = 0); 
    friend ComboBox tixComboBox (char *, char * = 0);
};
class DirSelectDialog {
private:
    char *pname;
    tixsubwidget *sub;
public:
    const char *pathname() {return pname;}
    DirSelectDialog () {sub = 0;}
    ~DirSelectDialog () {if (sub) delete sub;}
    void command (void (*fcn)(int, char **), char * = 0);
    char *cget (char *);
    char *configure (char *, char * = 0); 
    void popup ();
    tixsubwidget *subwidget (char *);
    char *subwidget (char *, char *, char * = 0); 
    friend  DirSelectDialog tixDirSelectDialog (char *, char * = 0);
};
class LabelEntry {
private:
    char *pname;
    tixsubwidget *sub;
public:
    const char *pathname() {return pname;}
    LabelEntry () {sub = 0;}
    ~LabelEntry () {if (sub) delete sub;}
    char *cget (char *);
    char *configure (char *, char * = 0); 
    tixsubwidget *subwidget (char *);
    char *subwidget (char *, char *, char * = 0); 
    friend  LabelEntry tixLabelEntry (char *, char * = 0);
};
class FileSelectDialog {
private:
    char *pname;
    tixsubwidget *sub;
public:
    const char *pathname() {return pname;}
    FileSelectDialog () {sub = 0;}
    ~FileSelectDialog () {if (sub) delete sub;}
    void command (void (*fcn)(int, char **), char * = 0);
    char *cget (char *);
    char *configure (char *, char * = 0); 
    void popdown ();
    void popup ();
    tixsubwidget *subwidget (char *);
    char *subwidget (char *, char *, char * = 0); 
    friend  FileSelectDialog tixFileSelectDialog (char *, char * = 0);
};
class FileSelectBox {
private:
    char *pname;
    tixsubwidget *sub;
public:
    const char *pathname() {return pname;}
    FileSelectBox () {sub = 0;}
    ~FileSelectBox () {if (sub) delete sub;}
    void browsecmd (void (*fcn)(int, char **), char * = 0);
    void command (void (*fcn)(int, char **), char * = 0);
    char *cget (char *);
    char *configure (char *, char * = 0); 
    void filter ();
    void invoke ();
    tixsubwidget *subwidget (char *);
    char *subwidget (char *, char *, char * = 0); 
    friend  FileSelectBox tixFileSelectBox (char *, char * = 0);
};
class ExFileSelectBox2 {
private:
    char *pname;
    tixsubwidget *sub;
public:
    const char *pathname() {return pname;}
    ExFileSelectBox2 () {sub = 0;}
    ~ExFileSelectBox2 () {if (sub) delete sub;}
    void browsecmd (void (*fcn)(int, char **), char * = 0);
    void command (void (*fcn)(int, char **), char * = 0);
    char *cget (char *);
    char *configure (char *, char * = 0); 
    void filter ();
    void invoke ();
    tixsubwidget *subwidget (char *);
    char *subwidget (char *, char *, char * = 0); 
    friend  ExFileSelectBox2 tixExFileSelectBox2 (char *, char * = 0);
};
class ScrolledTList {
private:
    char *pname;
   tixsubwidget *sub;
public:
    const char *pathname() {return pname;}
    ScrolledTList () {sub = 0;}
    ~ScrolledTList () {if (sub) delete sub;}
    char *cget (char *);
    char *configure (char *, char * = 0); 
    tixsubwidget *subwidget (char *);
    char *subwidget (char *, char *, char * = 0); 
    friend  ScrolledTList tixScrolledTList (char *, char * = 0);
};
class ScrolledHList {
private:
    char *pname;
   tixsubwidget *sub;
public:
    const char *pathname() {return pname;}
    ScrolledHList () {sub = 0;}
    ~ScrolledHList () {if (sub) delete sub;}
    char *cget (char *);
    char *configure (char *, char * = 0); 
    tixsubwidget *subwidget (char *);
    char *subwidget (char *, char *, char * = 0); 
    friend  ScrolledHList tixScrolledHList (char *, char * = 0);
};
class ScrolledListBox {
private:
    char *pname;
   tixsubwidget *sub;
public:
    const char *pathname() {return pname;}
    ScrolledListBox () {sub = 0;}
    ~ScrolledListBox () {if (sub) delete sub;}
    char *cget (char *);
    char *configure (char *, char * = 0); 
    tixsubwidget *subwidget (char *);
    char *subwidget (char *, char *, char * = 0); 
    friend  ScrolledListBox tixScrolledListBox (char *, char * = 0);
};
class Meter {
private:
    char *pname;
public:
    const char *pathname() {return pname;}
    Meter () {}
    ~Meter () {}
    char *cget (char *);
    char *configure (char *, char * = 0); 
    friend  Meter tixMeter (char *, char * = 0);
};
class OptionMenu  {
private:
    char *pname;
    tixsubwidget *sub;
public:
    const char *pathname() {return pname;}
    OptionMenu () {sub = 0;}
    ~OptionMenu () {if (sub) delete sub;}
    void command (void (*fcn)(int, char **), char * = 0);
    void add (char *, char * = 0);
    char *cget (char *);
    char *configure (char *, char * = 0); 
    void delet (char *);
    void disable (char *);
    void enable (char *);
    char *entrycget (char *, char *);
    char *entryconfigure (char *, char * = 0);
    char *entries ();
    tixsubwidget *subwidget (char *);
    char *subwidget (char *, char *, char * = 0); 
    friend  OptionMenu tixOptionMenu (char *, char * = 0);
};

class ScrolledWindow {
private:
    char *pname;
    tixsubwidget *sub;
public:
    const char *pathname() {return pname;}
    ScrolledWindow () {sub = 0;}
    ~ScrolledWindow () {if (sub) delete sub;}
    char *cget (char *);
    char *configure (char *, char * = 0); 
    tixsubwidget *subwidget (char *);
    char *subwidget (char *, char *, char * = 0); 
    friend ScrolledWindow tixScrolledWindow (char *, char * = 0);
};

class Control {
private:
    char *pname;
    tixsubwidget *sub;
public:
    const char *pathname() {return pname;}
    Control () {sub = 0;}
    ~Control () {if (sub) delete sub;}
    void command (void (*fcn)(int, char **), char * = 0);
    void decrcmd (void (*fcn)(int, char **), char * = 0);
    void incrcmd (void (*fcn)(int, char **), char * = 0);
    void validatecmd (void (*fcn)(int, char **), char * = 0);
    void variable (char *);
    char *cget (char *);
    char *configure (char *, char * = 0); 
    void decr ();
    void incr ();
    void invoke ();
    void update ();
    tixsubwidget *subwidget (char *);
    char *subwidget (char *, char *, char * = 0); 
    friend Control tixControl (char *, char * = 0);
};

class Select {
private:
    char *pname;
    tixsubwidget *sub;
public:
    const char *pathname() {return pname;}
    Select () {sub = 0;}
    ~Select () {if (sub) delete sub;}
    void command (void (*fcn)(int, char **), char * = 0);
    void validatecmd (void (*fcn)(int, char **), char * = 0);
    void variable (char *);
    void add (char *, char * = 0);
    char *cget (char *);
    char *configure (char *, char * = 0); 
    void invoke ();
    tixsubwidget *subwidget (char *);
    char *subwidget (char *, char *, char * = 0); 
    friend Select tixSelect (char *, char * = 0);
};

char *tixForm (char *, char * = 0, char * = 0);
#endif // TIX
void TkPack (char *, char * = 0, char * = 0);
void TkPlace (char *, char * = 0, char * = 0);
char *TkBind (char *, char *s = 0);
char *TkBind (char *, char *, void (*fcn)(int, char **), char *s = 0);
char *TkWm (char *, char *s = 0, char *t = 0);
char *TkDestroy (char *, char * = 0, char * = 0);
char *TkAfter (int, void (*fcn)() = 0);
char *TkAfter (int, char *, int);
char *TkAfter (int, char *);
char *TkWinfo (char *, char *s = 0);
void TkBell ();
char *TkGrab (char *, char * = 0);
void TkWait (char *, char * = 0);
void TkWait (int *);
void TkUpdate (char * = 0);
char *TkClock (char *);
void TkPopup (char *, char *, char *, char * = 0);
char *TkFocus (char * = 0, char * = 0);
static void TkPopup (char *p, int x, int y, char *q = 0) {char s[10]; strcpy (s, Index.n(x)); TkPopup(p, s, Index.n(y), q);}

char *TkTcl (char *, void (*fcn)(int, char **) = 0, void (*fcn)(int, char **) = 0, 
	      void (*fcn)(int, char **) = 0, void (*fcn)(int, char **) = 0, 
	      void (*fcn)(int, char **) = 0);
int TkDialog (char *, char *, char *, char *, int, char *, char * = 0, char * = 0, char * = 0);
char *TkGetOpenFile (char * = 0, char * = 0, char * = 0);
char *TkGetSaveFile (char * = 0, char * = 0, char * = 0);
void TkDiag (int);
int Tk_error ();
extern "C" {
    void Tk_MainLoop();
};
void TkSelect (int, char *, void (*) (void *, int));
#define TkMainLoop Tk_MainLoop
void TkResult (char *, char *  = 0);
#endif // __CXXTK_H__
