home *** CD-ROM | disk | FTP | other *** search
/ Falcon 030 Power 2 / F030_POWER2.iso / ST_STE / MAGS / ICTARI04.ARJ / ictari.04 / C / GEM_TUT / GEMCL3.C < prev    next >
Text File  |  1987-10-05  |  2KB  |  105 lines

  1. >>>>>>>>>>>>>>>>>>>>>>> Basic Dialog Handler <<<<<<<<<<<<<<<<<<<<<<<
  2.  
  3.     WORD
  4. hndl_dial(tree, def, x, y, w, h)
  5.     LONG    tree;
  6.     WORD    def;
  7.     WORD    x, y, w, h;
  8.     {
  9.     WORD    xdial, ydial, wdial, hdial, exitobj;
  10.  
  11.     form_center(tree, &xdial, &ydial, &wdial, &hdial);
  12.     form_dial(0, x, y, w, h, xdial, ydial, wdial, hdial);
  13.     form_dial(1, x, y, w, h, xdial, ydial, wdial, hdial);
  14.     objc_draw(tree, ROOT, MAX_DEPTH, xdial, ydial, wdial, hdial);
  15.     exitobj = form_do(tree, def) & 0x7FFF;
  16.     form_dial(2, x, y, w, h, xdial, ydial, wdial, hdial);
  17.     form_dial(3, x, y, w, h, xdial, ydial, wdial, hdial);
  18.     return (exitobj);
  19.     }
  20.  
  21. >>>>>>>>>>>>>>>>>>>>>>> Object rectangle utility <<<<<<<<<<<<<<<<<<<<<<<<<
  22.  
  23.     VOID
  24. objc_xywh(tree, obj, p)        /* get x,y,w,h for specified object    */
  25.     LONG    tree;
  26.     WORD    obj;
  27.     GRECT    *p;
  28.     {
  29.     objc_offset(tree, obj, &p->g_x, &p->g_y);
  30.     p->g_w = LWGET(OB_WIDTH(obj));
  31.     p->g_h = LWGET(OB_HEIGHT(obj));
  32.     }
  33.  
  34. >>>>>>>>>>>>>>>>>>>>>>> Object flag utilities <<<<<<<<<<<<<<<<<<<<<<<<<<<
  35.  
  36.     VOID
  37. undo_obj(tree, which, bit)    /* clear specified bit in object state    */
  38.     LONG    tree;
  39.     WORD    which, bit;
  40.     {
  41.     WORD    state;
  42.  
  43.     state = LWGET(OB_STATE(which));
  44.     LWSET(OB_STATE(which), state & ~bit);
  45.     }
  46.  
  47.     VOID
  48. desel_obj(tree, which)        /* turn off selected bit of spcfd object*/
  49.     LONG    tree;
  50.     WORD    which;
  51.     {
  52.     undo_obj(tree, which, SELECTED);
  53.     }
  54.  
  55.     VOID
  56. do_obj(tree, which, bit)    /* set specified bit in object state    */
  57.     LONG    tree;
  58.     WORD    which, bit;
  59.     {
  60.     WORD    state;
  61.  
  62.     state = LWGET(OB_STATE(which));
  63.     LWSET(OB_STATE(which), state | bit);
  64.     }
  65.  
  66.     VOID
  67. sel_obj(tree, which)        /* turn on selected bit of spcfd object    */
  68.     LONG    tree;
  69.     WORD    which;
  70.     {
  71.     do_obj(tree, which, SELECTED);
  72.     }
  73.  
  74.     BOOLEAN
  75. statep(tree, which, bit)
  76.     LONG    tree;
  77.     WORD    which;
  78.     WORD    bit;
  79.     {
  80.     return ( (LWGET(OB_STATE(which)) & bit) != 0);
  81.     }
  82.  
  83.     BOOLEAN
  84. selectp(tree, which)
  85.     LONG    tree;
  86.     WORD    which;
  87.     {
  88.     return statep(tree, which, SELECTED);
  89.     }
  90.  
  91. >>>>>>>>>>>>>>>>>>>>>> Sample radio buttons after dialog <<<<<<<<<<<<<<<<<<<<
  92.  
  93.     WORD
  94. encode(tree, ob1st, num)
  95.     LONG    tree;
  96.     WORD    ob1st, num;
  97.     {
  98.     for (; num--; )
  99.         if (selectp(ob1st+num))
  100.             return(num);
  101.     return (-1);
  102.     }
  103.  
  104.  
  105.