home *** CD-ROM | disk | FTP | other *** search
/ Encyclopedia of Graphics File Formats Companion / GFF_CD.ISO / software / unix / saoimage / sao1_07.tar / hfiles / window.h < prev   
C/C++ Source or Header  |  1989-11-09  |  6KB  |  172 lines

  1. #ifndef lint
  2. static char SccsWndwId[] = "%W%  %G%";
  3. #endif
  4.  
  5. /* Module:    Window.h
  6.  * Purpose:    Define the struct for each window's parameters and some
  7.  *        related constants
  8.  * Modified:    {0} Michael VanHilst    initial version           9 May 1989
  9.  *        {n} <who> -- <does what> -- <when>
  10.  */
  11.  
  12. /* standard width of auziliary windows */
  13. #define AUXWIDTH    128
  14. /* codes to identify corner to be anchored when making a window adjustment */
  15. #define ULCORNER    1
  16. #define LLCORNER    2
  17. #define URCORNER    3
  18. #define LRCORNER    4
  19. /* codes to indicate type of window adjustment */
  20. #define ADJ_MOVE    1
  21. #define ADJ_RESIZE    2
  22. /* indices for array of adjustment parameters */
  23. #define ADJ_REF        0
  24. #define ADJ_X        1
  25. #define ADJ_Y        2
  26. #define ADJ_W        3
  27. #define ADJ_H        4
  28.  
  29. /*
  30.  *  struct windowRec
  31.  *
  32.  *  record structure with useful parameters for a window
  33.  */
  34. struct windowRec {
  35.   Window ID;            /* window's nom de plume (ptr) */
  36.   Display *display;        /* display server handle */
  37.   int screen;            /* display screen number */
  38.   Window parent;        /* parent of this window */
  39.   unsigned int depth;        /* window depth */
  40.   int active;            /* flag to say window is there */
  41.   int x, y;            /* upper left screen coords */
  42.   unsigned int width, height;    /* window width (-1 border) */
  43.   unsigned int bdrwidth;    /* width of the border */
  44.   int bdrtotal;            /* width added by both borders */
  45.   int rightx, lowery;        /* useful screen coordinates */
  46.   int xzero, yzero;        /* u-l corner of drawing area */
  47.   int xwidth, yheight;        /* size of drawing area */
  48.   int moored;            /* flag to move window with disp */
  49.   int data_size;        /* byte size of image data buf */
  50.   XImage image;            /* for XPutImage */
  51.   Visual *visual;        /* visual type */
  52.   unsigned long valuemask;    /* mask to set attributes */
  53.   XSetWindowAttributes attrs;    /* for XCreateWindow */
  54.   XSizeHints hints;        /* for XSetNormalHints */
  55. };
  56.  
  57. /*
  58.  * typical attributes neeeding to be set:
  59.  *  attrs.cursor = [window cursor];
  60.  *  attrs.background_pixel = [window backcolor];
  61.  *  attrs.event_mask = [window eventmask];
  62.  *  valuemask = CWBackPixel | CWCursor;        (event_mask set separately)
  63.  */
  64.  
  65. /*
  66.  * typical hints to set and use:
  67.  *  hints.flags = USPosition | USSize | PMinSize;
  68.  *  hints.x =
  69.  *  hints.y =
  70.  *  hints.width =
  71.  *  hints.height =
  72.  *  hints.min_width =
  73.  *  hints.min_height =
  74.  */
  75.  
  76. #ifdef SAMPLE
  77. struct windowRec foobox = {
  78.  0,        /* Window ID;            window's nom de plume (ptr) */
  79.  NULL,        /* Display *display;        display server handle */
  80.  0,        /* int screen;            display screen number */
  81.  0,        /* Window parent;        parent of this window */
  82.  0,        /* unsigned int depth;        window depth */
  83.  0,        /* int active;            flag to say window is there */
  84.  0, 0,        /* int x, y;            upper left screen coords */
  85.  0, 0,        /* unsigned int width, height;    window width (-1 border) */
  86.  3,        /* unsigned int bdrwidth;    width of the border */
  87.  6,        /* int bdrtotal;        width added by both borders */
  88.  0, 0,        /* int rightx, lowery;        useful screen coordinates */
  89.  0, 0,        /* int xzero, yzero;        u-l corner of drawing area */
  90.  0, 0,        /* int xwidth, yheight;        size of drawing area */
  91.  1,        /* int moored;            move window with disp box */
  92.  0,        /* int data_size;        byte size of image data buf */
  93.  {        /* XImage image;        for XPutImage */
  94.    0, 0,    /*  int width, height;            0, 0 */
  95.    0,        /*  int xoffset;            0 */
  96.    0,        /*  int format;                XYBitmap, XY/ZPixmap */
  97.    NULL,    /*  char *data;                NULL */
  98.    LSBFirst,    /*  int byte_order;            LSBFirst */
  99.    8,        /*  int bitmap_unit;            8 */
  100.    LSBFirst,    /*  int bitmap_bit_order;        LSBFirst */
  101.    8,        /*  int bitmap_pad;            8 */
  102.    0,        /*  int depth;                1 or runtime set */
  103.    0,        /*  int bytes_per_line;            0 */
  104.    8,        /*  int bits_per_pixel;            1 or 8 */
  105.    0, 0, 0,    /*  unsigned long red_mask, green_mask, blue_mask; runtime */
  106.    NULL,    /*  char *obdata;            NULL */
  107.    { 0 } },    /*  { struct func f };            { NULL } */
  108.  NULL,        /* Visual *visual;        visual type */
  109.  0,        /* unsigned long valuemask;    mask to set attributes */
  110.  {        /* XSetWindowAttributes attrs;    for XCreateWindow */
  111.    0,        /*  Pixmap background_pixmap;        CWBackPixmap */
  112.    0,        /*  unsigned long background_pixel;    CWBackPixel */
  113.    0,        /*  Pixmap border_pixmap;        CWBorderPixmap */
  114.    0,        /*  unsigned long border_pixel        CWBorderPixel */
  115.    0,        /*  int bit_gravity;            CWBitGravity */
  116.    0,        /*  int win_gravity;            CWWinGravity */
  117.    0,        /*  backing_store;            CWBackingStore */
  118.    0,        /*  unsigned long backing_planes;    CWBackingPlanes */
  119.    0,        /*  unsigned long backing_pixel;    CWBackingPixel */
  120.    0,        /*  Bool save_under;            CWSaveUnder */
  121.    0,        /*  long event_mask;            CWEventMask */
  122.    0,        /*  long do_not_propogate_mask;        CWDontPropagate */
  123.    0,        /*  Bool override_redirect;        CWOverrideRedirect */
  124.    0,        /*  Colormap colormap;            CWColormap */
  125.    0 },        /*  Cursor cursor;            CWCursor */
  126.  {         /* XSizeHints hints;        for XSetNormalHints */
  127.    0,        /*  long flags;                defined fields */
  128.    0, 0,    /*  int x, y;                USPosition PPosition */
  129.    0, 0,    /*  int width, height;            USSize PSize */
  130.    0, 0,    /*  int min_width, min_height;        PMinSize */
  131.    0, 0,    /*  int max_width, max_height;        PMaxSize */
  132.    0, 0,    /*  int width_inc, height_inc;        PResizeInc */
  133.    { 0 },    /*  { int min_aspect.x, min_aspect.y }    PAspect */
  134.    { 0 } }    /*  { int max_aspect.x, max_aspect.y }     x/y=ratio */
  135. }
  136. #endif
  137.  
  138. #ifdef NOTES
  139. application notes: What Must Be Set At Runtime, When Exactly and Where
  140.  
  141. init_time:
  142.     - init_main
  143.         display, screen,
  144.     - init_color
  145.         visual, depth, ximage.depth, attrs.colormap, ximage.format,
  146.     - init_mousecursors
  147.         attrs.cursor,
  148.     - init_window
  149.         attrs.background_pixel, attrs.border_pixel,
  150.         valuemask,
  151.         hints.x, hints.y, hints.width, hints.height,
  152.         bdrwidth, bdrtotal,
  153.         x, y, width, height, xwidth, yheight, active,
  154.         ximage.width, ximage.height, ximage.bytes_per_line,
  155.     - init_buffer
  156.         data_buf, buf_size, ximage.data,
  157.     - init_drawing         
  158.         gc,
  159.  
  160. change_colormode:
  161.         ximage.format, ximage.bytes_per_line,
  162.         [attrs.colormap, data_buf, buf_size, ximage.data],
  163.  
  164. change_window:
  165.         x, y, width, height, xwidth, yheight,
  166.         data_buf, buf_size, ximage.data,
  167.         ximage.width, ximage.height, ximage.bytes_per_line,
  168.  
  169. map/unmap_window:
  170.         active,
  171. #endif
  172.