home *** CD-ROM | disk | FTP | other *** search
/ Stars of Shareware: Programmierung / SOURCE.mdf / programm / msdos / c / objease3 / libs / gui.h next >
Encoding:
C/C++ Source or Header  |  1994-05-18  |  21.1 KB  |  1,115 lines

  1. #include <dos.h>
  2. #include <string.h>
  3. #include <graphics.h>
  4. #include <direct.h>
  5. #include <alloc.h>
  6. #include <conio.h>
  7. #include <dos.h>
  8. #include <fcntl.h>
  9. #include <io.h>
  10. #include <mem.h>
  11. #include <stdio.h>
  12. #include <stdlib.h>
  13. #include <sys\stat.h>
  14.  
  15. #define TRUE 1
  16. #define FALSE 0
  17. #define IN 0
  18. #define OUT 1
  19. #define THICK 0
  20. #define THIN 1
  21. #define TEXT 0
  22. #define IMAGE 1
  23. #define SAVEBGD 1
  24.  
  25. #define ALTA 30
  26. #define ALTB 48
  27. #define ALTC 46
  28. #define ALTD 32
  29. #define ALTE 18
  30. #define ALTF 33
  31. #define ALTG 34
  32. #define ALTH 35
  33. #define ALTI 23
  34. #define ALTJ 36
  35. #define ALTK 37
  36. #define ALTL 38
  37. #define ALTM 50
  38. #define ALTN 49
  39. #define ALTO 24
  40. #define ALTP 25
  41. #define ALTQ 16
  42. #define ALTR 19
  43. #define ALTS 31
  44. #define ALTT 20
  45. #define ALTU 22
  46. #define ALTV 47
  47. #define ALTW 17
  48. #define ALTX 45
  49. #define ALTY 21
  50. #define ALTZ 44
  51.  
  52. #define ALT1 120
  53. #define ALT2 121
  54. #define ALT3 122
  55. #define ALT4 123
  56. #define ALT5 124
  57. #define ALT6 125
  58. #define ALT7 126
  59. #define ALT8 127
  60. #define ALT9 128
  61. #define ALT0 129
  62.  
  63. #define ALTMINUS  130
  64. #define ALTPLUS   131
  65.  
  66. //GENERAL
  67. void dlay(int ticks);
  68. long getticks();
  69. int altkey();
  70. int ctrlkey();
  71. int lshiftkey();
  72. int rshiftkey();
  73. int shiftkey();
  74. void flushkeys();
  75. unsigned char getvidmode();
  76. unsigned char alt_to_asc(unsigned char);
  77.  
  78. //MCURSOR
  79. extern int _MX;
  80. extern int _MY;
  81.  
  82. void far interrupt MouseHandler(void);
  83.  
  84. class Mcursor {
  85.       int shown;
  86.       int current;
  87.       int xpos;
  88.       int ypos;
  89.       void mouse_interrupt();
  90.       void InstallHandler(unsigned mask,void far interrupt (*handler)(void)=MouseHandler);
  91.       void ClearHandler(void);
  92.       int m1;
  93.       int m2;
  94.       int m3;
  95.       int m4;
  96.       int button;
  97.       int disabled;
  98.       int pos_changed;
  99.       int lastx,lasty;
  100.       int y_changed;
  101.       int x_changed;
  102.       int eventMask;
  103.       int handler_installed;
  104.     public:
  105.       ~Mcursor();
  106.       int  init();
  107.       void set();
  108.       void changeto(int);
  109.       void get_status();
  110.       void show();
  111.       void hide();
  112.       void set_hor_bounds(int,int);
  113.       void set_ver_bounds(int,int);
  114.       void conditional_off(int x1,int y1,int x2,int y2);
  115.       void position(int,int);
  116.       int  LBP();
  117.       int  RBP();
  118.       int  moved();
  119.       int  moved_y();
  120.       int  moved_x();
  121.       int  getcurrent();
  122.       int  mousex();
  123.       int  mousey();
  124.       int  mx();
  125.       int  my();
  126.       void unarm();
  127.       void arm();
  128.       int  LBDCLK();
  129.       long thistick;
  130.       long previoustick;
  131.       int doubleclicked;
  132.       };
  133.  
  134. #define UPARROW 1
  135. #define DOT 2
  136. #define PENCIL 3
  137. #define CROSSHAIR 4
  138. #define ARROW 5
  139. #define FINGER 6
  140. #define POINT 7
  141. #define CLOCK 8
  142. #define DISK 9
  143. #define IBAR 10
  144. #define PAINTCAN 11
  145. #define HAND 12
  146. #define ERASOR 13
  147. #define GUNSIGHT 14
  148. #define SCISSORS 15
  149. #define JAWS 16
  150.  
  151. //POINT
  152. class Point
  153. {
  154.     protected:
  155.         int x,y,color;
  156.         void far * background;
  157.         long backgroundsize;
  158.         char tempfile[MAXPATH];
  159.         int image_is_on_disk;
  160.     public:
  161.         Point();
  162.         ~Point();
  163.         void elim();
  164.         int Getx();
  165.         int Gety();
  166.         int Getcolor();
  167.         int write_background();
  168.         int read_background();
  169.         };
  170.  
  171.  
  172. //GSTRING
  173. void beep();
  174. char *strdel(char *,int);
  175. char *strins(char *,int,char);
  176.  
  177. class Gstring:public Point {
  178.     protected:
  179.         int xpos;
  180.         int length;
  181.         int strlength;
  182.         int height;
  183.         int ucase;
  184.         char laststring[81];
  185.         int shown,wasshown;
  186.         int outlined,wasoutlined;
  187.         int escape;
  188.         int retrn;
  189.         int tab;
  190.         int uparrow;
  191.         int dnarrow;
  192.         int infgd;
  193.         int inbgd;
  194.         int firstchar;
  195.         int curpos;
  196.         int curson;
  197.         void showcurs();
  198.         void hidecurs();
  199.         long last_tick;
  200.         int clickcount;
  201.     public:
  202.         Gstring();
  203.         ~Gstring();
  204.         void elim();
  205.         void init(int,int,int,int,int savebgd=0);
  206.         void reinit(int,int,int,int);
  207.         void show();
  208.         void input();
  209.         void get_input();
  210.         void get_form_input();
  211.         void get_form_mouse_input();
  212.         char *getstring();
  213.         void reset();
  214.         void preset(char *);
  215.         int isshown();
  216.         void check_for_blink();
  217.         int returnhit();
  218.         int escapehit();
  219.         int uparrowhit();
  220.         int dnarrowhit();
  221.         int tabhit();
  222.         void setincolors(int,int);
  223.         int hit();
  224.         void outline(int,int offset=0);
  225.         void move(int,int);
  226.         void hide();
  227.         int Getx();
  228.         int Gety();
  229.         int is_ucase();
  230.         int clicked();
  231.         int LBDCLK();
  232.         int Getlength();
  233.         };
  234.  
  235.  
  236.  
  237. //LINE
  238. class Line:public Point
  239. {
  240.     protected:
  241.         int x2;
  242.         int y2;
  243.         int style;
  244.     public:
  245.         Line();
  246.         ~Line();
  247.         int Getx2();
  248.         int Gety2();
  249.         int Getstyle();
  250.         void init(int,int,int,int,int,int);
  251.         void show();
  252.         void outline();
  253.         int starthit();
  254.         int endhit();
  255.         void end_to_start();
  256.         void start_to_end();
  257.         void swap_ends();
  258.         void new_end(int,int);
  259.         void new_start(int,int);
  260.         };
  261.  
  262. //GTEXT
  263. class Gtext:public Point
  264. {
  265.     protected:
  266.         struct textsettingstype ts;
  267.         int length;
  268.         int height;
  269.         int strlength;
  270.         int fgd;
  271.         int bgd;
  272.         int size;
  273.         char text[41];
  274.         int shown,wasshown;
  275.         int outlined,wasoutlined;
  276.         long last_tick;
  277.         int clickcount;
  278.     public:
  279.         Gtext();
  280.         ~Gtext();
  281.         int Getlength();
  282.         int Getstrlength();
  283.         int Getsize();
  284.         void init(int,int,char *,int,int,int,int savebgd=0);
  285.         void show();
  286.         void hide();
  287.         void outline(int,int offset=0);
  288.         void reinit(int,int,char *,int,int,int);
  289.         int is_shown();
  290.         int hit();
  291.         int clicked();
  292.         int LBDCLK();
  293.         void move(int,int);
  294.         char * Gettext();
  295.         int Getfgd();
  296.         int Getbgd();
  297.         };
  298.  
  299. //COLORBUTTON
  300. class Colorbutton:public Point
  301. {
  302.     protected:
  303.         int color;
  304.         int width;
  305.         int height;
  306.     public:
  307.         void init(int,int,int,int,int);
  308.         void show(int);
  309.         int  clicked();
  310.         int      hit();
  311.         int getcolor();
  312.         };
  313.  
  314. //COLSEBUTTON
  315. class Closebutton:public Colorbutton
  316. {
  317.     public:
  318.         void move(int,int);
  319.         void  show();
  320.         };
  321.  
  322. //ICON
  323. class Icon:public Point
  324. {
  325.     protected:
  326.         int state;
  327.         int w,h;
  328.         void far *picture;
  329.         int shown,wasshown;
  330.         int outlined,wasoutlined;
  331.         char fn[9];
  332.         char filename[13];
  333.         long last_tick;
  334.         int clickcount;
  335.     public:
  336.         Icon();
  337.         ~Icon();
  338.         void init(int,int,char*,int savebgd=0);
  339.         void reinit(int,int,char*);
  340.         void freepicture();
  341.         void show();
  342.         void choose();
  343.         int hit();
  344.         int clicked();
  345.         int ispressed();
  346.         void outline(int,int offset=0);
  347.         void hide();
  348.         void move(int,int);
  349.         char * Getfilename();
  350.         int LBDCLK();
  351.         int Getw();
  352.         int Geth();
  353.         };
  354.  
  355. //GCHECKBOX
  356. class Gcheckbox:public Point
  357. {
  358.     protected:
  359.         int checked;
  360.         char desc[40];
  361.         int length;
  362.         int shown,wasshown;
  363.         int outlined,wasoutlined;
  364.         long last_tick;
  365.         int clickcount;
  366.     int bgd;
  367.     public:
  368.         Gcheckbox();
  369.         ~Gcheckbox();
  370.         void init(int,int,char *,int savebgd=0);
  371.         void reinit(int,int,char *);
  372.         void show();
  373.         void check();
  374.         void uncheck();
  375.         int is_checked();
  376.         int hit();
  377.         void outline(int,int offset=0);
  378.         void hide();
  379.         void move(int,int);
  380.         char * Gettext();
  381.         int clicked();
  382.         int LBDCLK();
  383.         void setbgd(int);
  384.         };
  385.  
  386. //GRADIO
  387. class Gradio:public Gcheckbox
  388. {
  389.     public:
  390.         void show();
  391.         void check();
  392.         void uncheck();
  393.         };
  394.  
  395. //ACTICON
  396. class Acticon:public Icon
  397. {
  398.     protected:
  399.         void far *picture[32];
  400.         int state;
  401.         int numpix;
  402.     public:
  403.         Acticon();
  404.         ~Acticon();
  405.         void init(int,int,char*);
  406.         void show(int);
  407.         void choose();
  408.         int ispressed();
  409.         void animate(int);
  410.         void backforth(int);
  411.         };
  412.  
  413. //BUTTON
  414. class Button:public Point
  415. {
  416.     protected:
  417.         int state,sizex,sizey;
  418.         char btntxt[40];
  419.         int  file_text;
  420.         void far *picture;
  421.         void getpic(char*);
  422.         int outlined,wasoutlined;
  423.         int shown,wasshown;
  424.         long last_tick;
  425.         int clickcount;
  426.         int w,h;
  427.     public:
  428.         Button();
  429.         ~Button();
  430.         virtual void show();
  431.         virtual void press();
  432.         void init(int ptx,int pty,char* text,int,int savebgd=0);
  433.         void reinit(int,int,char *,int);
  434.         void freepicture();
  435.         void resize(int,int,int savebgd=0);
  436.         int hit();
  437.         int pressed();
  438.         void hide();
  439.         void outline(int,int offset=0);
  440.         void move(int,int);
  441.         int Getformat();
  442.         char * Getcontents();
  443.         int clicked();
  444.         int LBDCLK();
  445.         int Getw();
  446.         int Geth();
  447.         };
  448.  
  449. //BITMAP
  450. class Bitmap:public Point
  451. {
  452.     protected:
  453.         int sizex,sizey;
  454.         int size;
  455.         void far *picture;
  456.         int shown;
  457.         int clickcount;
  458.     long last_tick;
  459.     public:
  460.         Bitmap();
  461.         ~Bitmap();
  462.         void init(int,int);
  463.         void load(char *);
  464.         void save(char *);
  465.         void show_XOR();
  466.         void show_COPY();
  467.         void show_AND();
  468.         void show_OR();
  469.         void show_NOT();
  470.         int is_shown();
  471.         void hide();
  472.         void moveto(int,int);
  473.         int capture(int,int,int,int);
  474.         int hit();
  475.         int clicked();
  476.         int LBDCLK();
  477.         int LBSCLK();
  478.         int xsize();
  479.         int ysize();
  480.         int bitmapx();
  481.         int bitmapy();
  482.         void changexy(int,int);
  483.         };
  484.  
  485. //PANEL
  486. class Panel:public Point
  487. {
  488.     protected:
  489.         int w;
  490.         int h;
  491.         int in_or_out;
  492.         int thick_or_thin;
  493.         int shown,wasshown;
  494.         int outlined,wasoutlined;
  495.         long last_tick;
  496.         int clickcount;
  497.     int panelcolor;
  498.     public:
  499.         Panel();
  500.         ~Panel();
  501.         virtual void show();
  502.         void init(int,int,int,int,int,int,int savebgd=0);
  503.         void reinit(int,int,int,int,int,int);
  504.         void hide();
  505.         int isshown();
  506.         void outline(int,int offset=0);
  507.         void move(int,int);
  508.         int hit();
  509.         void resize(int,int,int savebgd=0);
  510.         int sizerhit();
  511.         int Getw();
  512.         int Geth();
  513.         int clicked();
  514.         int LBDCLK();
  515.         int Getthick();
  516.         int Getin();
  517.         void setpanelcolor(int);
  518.         };
  519.  
  520. //BEVEL
  521. class Bevel:public Point
  522. {
  523.     private:
  524.         int w;
  525.         int h;
  526.         int thick_or_thin;
  527.         Panel *outerbevel;
  528.         Panel *innerbevel;
  529.         int outlined,wasoutlined;
  530.         int shown,wasshown;
  531.         long last_tick;
  532.         int clickcount;
  533.         int bevelcolor;
  534.     public:
  535.         Bevel();
  536.         ~Bevel();
  537.         void init(int,int,int,int,int,int savebgd=0);
  538.         void reinit(int,int,int,int,int);
  539.         virtual void show();
  540.         void hide();
  541.         int isshown();
  542.         void outline(int,int offset=0);
  543.         void move(int,int);
  544.         int hit();
  545.         int sizerhit();
  546.         void resize(int,int,int savebgd=0);
  547.         int Getw();
  548.         int Geth();
  549.         int clicked();
  550.         int LBDCLK();
  551.         int Getthick();
  552.         void setbevelcolor(int);
  553.         };
  554.  
  555. //BUTTONBOX
  556. class Buttonbox:public Point
  557. {
  558.     protected:
  559.         Bevel *box;
  560.         Button  *buttons[16];
  561.         int outlined,wasoutlined;
  562.         int shown,wasshown;
  563.         int numbuttons;
  564.         int w,h;
  565.     public:
  566.         Buttonbox();
  567.         ~Buttonbox();
  568.         void init(int,int,int);
  569.         void setbutton(int,char *);
  570.         int hit();
  571.         int moverhit();
  572.         void show();
  573.         void outline(int,int offset=0);
  574.         void hide();
  575.         void move(int,int);
  576.         int buttoncount();
  577.         int buttonhit(int);
  578.         void buttonpress(int);
  579.         void buttonshow(int);
  580.         int isshown();
  581.         };
  582.  
  583. //GWINDOW
  584. class Gwindow:public Point
  585. {
  586.     protected:
  587.         Closebutton *closebox;
  588.         int                     w,h;
  589.         int                     fgd,bgd;
  590.         int                     tfgd,tbgd;
  591.         int                     active;
  592.         char            title[48];
  593.         void            *beneath;
  594.     public:
  595.         Gwindow();
  596.         ~Gwindow();
  597.         void init(int,int,int,int,int,int,int,int,char *);
  598.         void show();
  599.         void redraw();
  600.         void hide();
  601.         int      closeboxhit();
  602.         int  sizecornerhit();
  603.         int  titlebarhit();
  604.         void resize();
  605.         void move();
  606.         int write_to_disk();
  607.         int read_from_disk();
  608.         int totalGwindows();
  609.         };
  610.  
  611. //GMENU
  612. typedef char gitemarray[80][10];
  613.  
  614.  
  615. class Gmenu {
  616.     protected:
  617.         int on;
  618.         int x,y,w,h;
  619.         int num;
  620.         gitemarray gitems;
  621.         int menuchoice;
  622.         int oldbarx,oldbary;
  623.         void *ptr;
  624.         void *menubar;
  625.     public:
  626.         Gmenu();
  627.         ~Gmenu();
  628.         void init(int xloc,int yloc,int numentries,gitemarray gitem);
  629.         int show();
  630.         void hide();
  631.         int isshown();
  632.         };
  633.  
  634. //OPTION
  635. class option:public Point {
  636.     protected:
  637.         int r_value;
  638.         int selectable;
  639.         int selected;
  640.         char text[30];
  641.         int width;
  642.         int hl;
  643.         int self_colored;
  644.         int sfgd;
  645.         int sbgd;
  646.         int shfgd;
  647.         int shbgd;
  648.         int disabled;
  649.         int disabled_fgd;
  650.         int disabled_bgd;
  651.         int divider;
  652.         int underline;
  653.         int underline_position;
  654.         long last_tick;
  655.         int clickcount;
  656.     public:
  657.         void init(int,int,char *,int);
  658.         void set_highlight_attrib(int);
  659.         void display(int,int,int);
  660.         char * get_text();
  661.         int is_selectable();
  662.         int get_r_value();
  663.         void set_width(int);
  664.         int hit();
  665.         int is_highlighted();
  666.         void self_color(int,int,int,int);
  667.         void unable(int,int);
  668.         void reenable();
  669.         int is_enabled();
  670.         int is_divider();
  671.         void adjust_pos_to_pulldown(int,int);
  672.         int clicked();
  673.         int LBDCLK();
  674.         void show_deactivated();
  675.         int _3d;
  676.         };
  677.  
  678. //PULLDOWN
  679. class pulldown:public Point {
  680.     protected:
  681.         friend class menubar;
  682.         int nfg,nbg,hfg,hbg;
  683.         int shown;
  684.         int width,height;
  685.         int num_options;
  686.         int part_of_menubar;
  687.         char hotkeys[20];
  688.         int kbtrigger_index;
  689.     public:
  690.         option options[20];
  691.         void init(int,int,int,int,int xpos=10,int ypos=10);
  692.         void set_option(int,char *,int);
  693.         void determine_width_height();
  694.         void display();
  695.     void position(int,int);
  696.         int trackmenu();
  697.         void hide();
  698.         int is_shown();
  699.         void adjust_option_widths();
  700.         void adjust_pos_to_menubar(int);
  701.         int is_part_of_menubar();
  702.         };
  703.  
  704. //MENUBAR
  705. class menubar:public Point {
  706.     protected:
  707.         option *titles[10];
  708.         pulldown *pd[10];
  709.         int nfg,nbg,hfg,hbg;
  710.         int num_titles;
  711.         char hotkeys[10];
  712.         int kbtrigger_index;
  713.     public:
  714.         menubar();
  715.         ~menubar();
  716.         int _3d;
  717.         void make_3d();
  718.         void init(int,int,int,int);
  719.         void set_title(int,char *,pulldown *);
  720.         void display();
  721.         int trackbar();
  722.         int hit();
  723.         int mouse_triggered();
  724.         int kb_triggered();
  725.         int triggered();
  726.         };
  727.  
  728. //GMENUBUTTON
  729. class Gmenubutton {
  730.     protected:
  731.         int on;
  732.         int x,y;
  733.         int offfgd,offbgd;
  734.         int onfgd,onbgd;
  735.         char id[20];
  736.     public:
  737.         Gmenubutton();
  738.         ~Gmenubutton();
  739.         void init(int xloc,int yloc,int ffgd,int fbgd,
  740.         int nfgd,int nbgd,char txt[20]);
  741.         void show();
  742.         void press();
  743.         int hit();
  744.         };
  745.  
  746. //GPRINT
  747. void gprintf(int xloc,int yloc,char *fmt,...);
  748. void gprintc(int xloc, int yloc, char *fmt,...);
  749. void gprintxy(int xloc,int yloc,char *fmt,...);
  750.  
  751. //SOUNDQ
  752. #define TimerTick 0x8
  753. #define noisemax 4096
  754. #define ON 1
  755. #define OFF 0
  756.  
  757. #define C 523
  758. #define CS 554
  759. #define D 587
  760. #define DS 622
  761. #define E 659
  762. #define F 698
  763. #define FS 740
  764. #define G 784
  765. #define GS 831
  766. #define A 880
  767. #define AS 932
  768. #define B 988
  769. #define C1 1046
  770.  
  771. #define SN 32
  772. #define EN 63
  773. #define QN 125
  774. #define HN 250
  775. #define WN 500
  776.  
  777. #define ENT 20
  778. #define QNT 41
  779. #define HNT 83
  780.  
  781. #define BN 30000,5
  782. #define SR 30000,32
  783. #define ER 30000,63
  784. #define QR 30000,125
  785. #define HR 30000,250
  786. #define WR 30000,500
  787. #define NM 30000,1
  788.  
  789. class SoundQ{
  790.     protected:
  791.         float speed_factor;
  792.     public:
  793.         SoundQ();
  794.         ~SoundQ();
  795.         void play(int,int);
  796.         void adjust_speed(float);
  797.         };
  798.  
  799. typedef struct
  800. {
  801.   int duration;
  802.   int freq;
  803. } noise;
  804.  
  805. void empty_sound_queue();
  806. void init_sound(void);
  807. void restore_sound(void);
  808. int submit_sound(int freq,int delay);
  809. void interrupt soundsystem(...);
  810.  
  811. #ifndef _DAC256_
  812. #define _DAC256_
  813. typedef unsigned char DacPalette256[256][3];
  814. #endif
  815.  
  816. //SCREEN
  817. extern "C" void         _Cdecl vga256_driver();
  818. //extern "C" void       _Cdecl svga256m_driver(void);
  819. //extern "C" void               _Cdecl svga16_driver(void);
  820. extern "C" void         _Cdecl egavga_driver(void);
  821. //extern "C" void       _Cdecl vga256_driver(void);
  822.  
  823.  
  824. class Screen {
  825.     protected:
  826.         static int huge alwayszero();
  827.         static int huge alwaysone();
  828.         static int huge alwaystwo();
  829.         static int huge alwaysthree();
  830.         static int huge alwaysfour();
  831.         static int huge alwaysfive();
  832.     public:
  833.         Screen();
  834.         ~Screen();
  835. //              int VGA_600_16();
  836.         int VGA_480_16();
  837.         int VGA_350_16();
  838.         int VGA_200_16();
  839.         int VGA_200_256();
  840. //              int VGA_350_256();
  841. //              int VGA_400_256();
  842. //              int VGA_480_256();
  843. //              int VGA_600_256();
  844.         void fill(int);
  845.         };
  846.  
  847. //SUPPORTING FUNCTIONS FOR USE WITH 3rd PARTY .BGI DRIVERS
  848. //long imsize(int,int,int,int);
  849.  
  850.  
  851. /*
  852. //SCREEN
  853. extern "C" void         _Cdecl vga256_driver();
  854.  
  855. class Screen {
  856.     protected:
  857.         static int huge alwayszero();
  858.     public:
  859.         Screen();
  860.         ~Screen();
  861.         int VGA_480_16();
  862.         int VGA_350_16();
  863.         int VGA_200_16();
  864.         int VGA_200_256();
  865.         void fill(int);
  866.         };
  867. */
  868.  
  869. //LISTBOX
  870. struct optionrec {
  871.     option *entry;
  872.     int index;
  873.     optionrec *next;
  874.     optionrec *previous;
  875.     };
  876.  
  877. class listbox:public Point {
  878.     protected:
  879.         optionrec *listroot;
  880.         optionrec *listend;
  881.         optionrec *currentsel;
  882.         Bevel *box;
  883.         Button *up,*down,*pup,*pdown;
  884.         Panel *controlpanel;
  885.         int should_show_controls;
  886.         int should_save_bgd;
  887.         int selected_index;
  888.         char * selected_string;
  889.         int option_string_length;
  890.         int changed;
  891.         int size_forced;
  892.         int forced_width;
  893.         int forced_height;
  894.     public:
  895.         listbox();
  896.         ~listbox();
  897.         int part_of_structure;
  898.         void init(int,int,int,int savebgd=0);
  899.         void force_size(int,int);
  900.         void set_highlight_position(int);
  901.         void append_item(char *);
  902.         void show();
  903.         void show_options(int);
  904.         void hide();
  905.         void scroll_list_up();
  906.         void scroll_list_down();
  907.         int tracklist();
  908.         int options_displayed;
  909.         int options_in_list;
  910.         int option_width;
  911.         int shown;
  912.         int nfg,nbg,hfg,hbg;
  913.         int index_at_top;
  914.         int index_at_bottom;
  915.         int hit();
  916.         int is_current_index();
  917.         char *is_current_string();
  918.         int is_selected_index();
  919.         char *is_selected_string();
  920.         int selection_changed();
  921.         void deactivate();
  922.         void reactivate();
  923.         int active;
  924.         };
  925.  
  926. //DIRBOX
  927. int name_sort(const void *a,const void *b);
  928. class dirbox:public Point {
  929.     protected:
  930.         Bevel *box;
  931.         listbox *drive;
  932.         listbox *directory;
  933.         Button *OK;
  934.         Button *CANCEL;
  935.         char fullpath[MAXPATH];
  936.         char returnpath[MAXPATH];
  937.         char lastvalidpath[MAXPATH];
  938.         Gstring *filename;
  939.         int shown;
  940.         int turn;
  941.         char dirmask[13];
  942.         int intnumber;
  943.         void interrupt (*oldhandler)(...);
  944.     public:
  945.         dirbox();
  946.         ~dirbox();
  947.         void show();
  948.         void hide();
  949.         char * trackdir();
  950.         void print_current_path();
  951.         void change_directory(char *);
  952.         void fill_directory_list();
  953.         void fill_drive_list();
  954.         void set_mask(char *);
  955.         static void interrupt _handler(...);
  956.         };
  957.  
  958. //PALETTE
  959. typedef char palette_rec[256][3];
  960. class Palette{
  961.     protected:
  962.         void loadpalette(int start, int number, const palette_rec palette);
  963.         void readpalette(int start, int number, palette_rec palette);
  964.         void clrpalette(int start, int number);
  965.         void fadepalettein(int start, int count, const palette_rec palette);
  966.         void fadepaletteout(int start, int count);
  967.         void wait_vbi();
  968.     public:
  969.         Palette();
  970.         ~Palette();
  971.         void read();
  972.         void write();
  973.         void fadein();
  974.         void fadeout();
  975.         void clear();
  976.         };
  977.  
  978. //MESSAGEBOX
  979. #define MB_OK           0x0001
  980. #define MB_CANCEL   0x0002
  981. #define MB_OKCANCEL     0x0003
  982. #define MB_YESNO        0x0004
  983. #define ID_OK           1
  984. #define ID_CANCEL       2
  985. #define ID_YES          1
  986. #define ID_NO           2
  987.  
  988. class messagebox:public Point {
  989.     protected:
  990.         Button *OK,*CANCEL,*YES,*NO;
  991.         char bit;
  992.         int border_color;
  993.         int fill_color;
  994.         int text_color;
  995.         int OKbutton,CANCELbutton,YESbutton,NObutton;
  996.         char *str;
  997.     public:
  998.         messagebox();
  999.         ~messagebox();
  1000.         int show(char *,char);
  1001.         void hide();
  1002.         };
  1003.  
  1004. int Messagebox(char *,char);
  1005.  
  1006. #define HORIZONTAL 0
  1007. #define VERTICAL 1
  1008. //SCROLLBAR
  1009. class scrollbar:public Point {
  1010.     protected:
  1011.         Button *thumbpad;
  1012.         Button *increase;
  1013.         Button *decrease;
  1014.         Panel *rect;
  1015.         int vertical;
  1016.         int width,height,length;
  1017.         int small_d,large_d;
  1018.         long minimum,maximum;
  1019.         long value;
  1020.         int changed;
  1021.         int _SCROLLWIDTH;
  1022.     public:
  1023.         void init(int,int,int,int,int,int,int scrollwidth=16);
  1024.         int get_scrollwidth();
  1025.         int button_widths();
  1026.         void show();
  1027.         int thumbpad_hit();
  1028.         int decrease_hit();
  1029.         int increase_hit();
  1030.         void track_scrollbar();
  1031.         long get_value();
  1032.         int value_changed();
  1033.         int hit();
  1034.         void set_small_d(int);
  1035.         void set_large_d(int);
  1036.         void set_minimum(long);
  1037.         void set_maximum(long);
  1038.         };
  1039.  
  1040. //PCX
  1041. #define PCX_COMP_FLAG 0xC0
  1042. #define PCX_COMP_MASK 0x3F
  1043. #define FILE_BUFFER_SIZE 16384
  1044.  
  1045. //**************************************************************************
  1046.  
  1047. typedef struct PCX_PALETTE
  1048.     {
  1049.     unsigned char red;
  1050.     unsigned char green;
  1051.     unsigned char blue;
  1052.     };
  1053.  
  1054. //*************************************************************************
  1055.  
  1056. typedef struct PCX_HEADER
  1057.     {
  1058.     unsigned char pcx_id;
  1059.     unsigned char version;
  1060.     unsigned char encoding;
  1061.     unsigned char bppixel;
  1062.     unsigned int start_X;
  1063.     unsigned int start_Y;
  1064.     unsigned int end_X;
  1065.     unsigned int end_Y;
  1066.     unsigned int resolution_X;
  1067.     unsigned int resolution_Y;
  1068.     PCX_PALETTE palette[16];
  1069.     unsigned char reserved;
  1070.     unsigned char nplanes;
  1071.     unsigned int bppscan;
  1072.     unsigned int palette_type;
  1073.     unsigned int screen_X;
  1074.     unsigned int screen_Y;
  1075.     unsigned char filler[54];
  1076.     };
  1077.  
  1078. //**************************************************************************
  1079.  
  1080. class PCX:public Point {
  1081.     protected:
  1082.         char pcxname[MAXPATH];
  1083.         int initial_palette;
  1084.         int is_256;
  1085.     public:
  1086.         int width;
  1087.         int depth;
  1088.     protected:
  1089.         int bytes;
  1090.         int mask;
  1091.         unsigned long page_offset;
  1092.         PCX_HEADER pcx_header;
  1093.         PCX_PALETTE *pcx_palette;
  1094.         unsigned char *saved_palette;
  1095.     public:
  1096.         PCX();
  1097.         ~PCX();
  1098.         void init(char *,int,int);
  1099.         void show(int xpos=0,int ypos=0);
  1100.         void restore_palette();
  1101.         void unpackpcxfile();
  1102.         void readpcxline(char *,FILE *);
  1103.         int is_256_color();
  1104.         void save_initial_palette();
  1105.         void set_VGA_palette();
  1106.         void set_orig_palette();
  1107.         void Restore_initial_palette();
  1108.         void Set_16_Colors(unsigned char *);
  1109.         int PCX_Read();
  1110.         int PCX_Read_Init(FILE *);
  1111.         int PCX_Read_Line(FILE *,unsigned char *,int);
  1112.         void Put_EGA_Line(unsigned char *,int);
  1113.         void Set_PCX_Palette();
  1114.         };
  1115.