home *** CD-ROM | disk | FTP | other *** search
/ The World of Computer Software / World_Of_Computer_Software-02-385-Vol-1of3.iso / d / dots151.zip / GRAPHSRC.ZIP / WINDOW.H < prev   
C/C++ Source or Header  |  1990-05-26  |  4KB  |  132 lines

  1. /*
  2.     window.h - declarations for window package
  3.     
  4. */
  5.  
  6. #ifndef _WINDOW
  7. #define _WINDOW
  8.  
  9. typedef enum {NORMAL, CROSS, BOX, LINE, BORDER} CURSOR;
  10. extern CURSOR DragShape;
  11.  
  12. typedef enum         /* data required: */
  13.     {
  14.     INVALID,
  15.     REDRAW, CLEAR, HIDE, 
  16.     RESIZE,         /* width, height */
  17.     MOVETO,         /* x, y position (top left corner) */
  18.     MOVE,             /* x, y position of mouse */
  19.     CLICK,             /* x, y position of mouse */
  20.     CLICKR,            /* x, y position of mouse */
  21.     START_DRAGGING,    /* x, y position of mouse */
  22.     DRAG,             /* x, y position of mouse */
  23.     RELEASE,         /* x, y position of mouse */
  24.     HIGHLIGHT, NORMALIZE
  25.     } MESSAGE;
  26.  
  27.             /* these are created by CreateWindow */
  28. typedef struct window_st
  29.     {
  30.     char *text;            /* label at top of window */
  31.     void (*accept)();    /* points to message handler */
  32.     int x, y;            /* top left corner of window */
  33.     int w, h;            /* width & height of window */
  34.     int window_style;
  35.     int border_style;
  36.     int    norm, high;        /* text attributes */
  37.     int vis;            /* nonzero if the window is visible */
  38.     } WINDOW;
  39.  
  40.             /* these are created by CreateVMenu and CreateHMenu */
  41. typedef struct menu_st
  42.     {
  43.     char *text;            /* label at top of window */
  44.     void (*accept)();    /* points to new message handler */
  45.     int x, y;            /* top left corner of window */
  46.     int w, h;            /* width & height of window */
  47.     int window_style;
  48.     int border_style;
  49.     int    norm, high;        /* text attributes */
  50.     int vis;            /* nonzero if the menu is visible */
  51.  
  52.         /* above fields are like WINDOW */
  53.     void (*w_accept)();        /* points to window message handler */
  54.     int menu_style;            /* 0 for vertical, 1 for horizontal */
  55.     int sel;                /* the currently selected button (else -1) */
  56.     int shown;                /* the highlighted button (else -1) */
  57.     int cButtons;            /* # buttons to follow */
  58.     struct button_st *pab;    /* the menu button(s) */
  59.     } MENU;
  60.  
  61.             /* these are allocated by the programmer */
  62. typedef struct button_st
  63.     {
  64.                 /* first four fields are filled in by the programmer */
  65.     char *text;                /* displayed in button area */
  66.     char *trigger;            /* type this to trigger the button */
  67.     char *val;                /* what the button generates */
  68.     void (*accept)();        /* points to message handler */
  69.     struct menu_st *pm;        /* pointer to child menu */
  70.  
  71.                 /* remaining fields are filled in by
  72.                     CreateVMenu and CreateHMenu */
  73.     int    norm, high;            /* text attributes */
  74.     int x, y;                /* top left corner of button area */
  75.     int w, h;                /* width & height of button in pixels */
  76.     } BUTTON;
  77.  
  78. /*
  79. WINDOW *CreateWindow();
  80. MENU *CreateVMenu();
  81. MENU *CreateHMenu();
  82.  
  83. void MsgWindow();
  84. void MsgMenu();
  85. void MsgButton();
  86.  
  87. void far MouseHandler();
  88. */
  89.  
  90. #ifndef MODEL
  91. #ifdef __LARGE__
  92. #define MODEL far
  93. #else
  94. #define MODEL
  95. #endif
  96. #endif /* MODEL */
  97.  
  98.          MODEL ClearBox( int x1, int y1, int x2, int y2 );
  99.          MODEL flip_box( int x0, int y0, int x1, int y1 );
  100.          MODEL flip_cross( int x, int y );
  101.          MODEL box( int x0, int y0, int x1, int y1 );
  102.     void far   MouseHandler( int trigger, int status, int hor, int ver );
  103.          MODEL ShowMouse( );
  104.          MODEL HideMouse( );
  105. #ifndef __TURBOC__
  106. int      MODEL IsMouse( );
  107. #endif
  108.          MODEL ShowMouseCursor( );
  109.          MODEL HideMouseCursor( );
  110.          MODEL MenuResponse( MENU *pm );
  111. void     MODEL MsgButton( MESSAGE msg, int *data, BUTTON *pb );
  112.          MODEL inside( int x, int y, int x1, int y1, int w, int h );
  113. void     MODEL MsgMenu( MESSAGE msg, int *data, MENU *pm );
  114. MENU    *MODEL CreateHMenu( BUTTON *pb, int x, int y, int extra );
  115. MENU    *MODEL CreateVMenu( char *text, BUTTON *pb, int x, int y, int extra );
  116.          MODEL deliver( );
  117.          MODEL deposit( MESSAGE msg, int data[], WINDOW *pw );
  118.          MODEL WinGetString( char *query, char *s, int appending, int x, int y, WINDOW *pw );
  119.          MODEL WinShowString( char *s, int x, int y, WINDOW *pw );
  120.          MODEL WinOverlaps( WINDOW *pw1, WINDOW *pw2 );
  121.          MODEL WinCovers( WINDOW *pw1, WINDOW *pw2 );
  122. void     MODEL MsgWindow( MESSAGE msg, int *data, WINDOW *pw );
  123. WINDOW * MODEL CreateWindow( char *text, int x, int y, int extra );
  124.          MODEL getse( char *s, int appending, int x, int y, int w, int norm, int high );
  125.          MODEL ungets( char *s );
  126.          MODEL terminate( );
  127.          MODEL init_menus( );
  128. MENU *   MODEL CreateSubMenu( char ch, BUTTON *child_strings, MENU *pm );
  129.          MODEL GetEvent( );
  130.  
  131. #endif /* _WINDOW */
  132.