home *** CD-ROM | disk | FTP | other *** search
/ Amiga MA Magazine 1998 #3 / amigamamagazinepolishissue1998.iso / bazy / db3.4 / toolbox.c < prev    next >
C/C++ Source or Header  |  1995-08-14  |  7KB  |  208 lines

  1. /* Images for the toolbox */
  2.  
  3. #include "toolbox.h"
  4. #include "dbGUI.h"
  5. #include <proto/intuition.h>
  6.  
  7. #define LATER 0
  8.  
  9.  
  10. UWORD __chip CheckBoxIData[] =
  11. {
  12. /* Plane 0 */
  13.     0x0000,0x0000,0x0040,0x0000,0x0000,0x00C0,0x0000,0x0000,
  14.     0x00C0,0x0000,0x0000,0x00C0,0x0000,0x0000,0x00C0,0x0000,
  15.     0x0000,0x00C0,0x0000,0x0000,0x20C0,0x0000,0x0000,0x60C0,
  16.     0x0000,0x0000,0x60C0,0x0000,0x0000,0x60C0,0x0000,0x0078,
  17.     0x60C0,0x0000,0x00C0,0x60C0,0x0000,0x00C0,0x60C0,0x0000,
  18.     0x0180,0x60C0,0x0000,0x0180,0x60C0,0x0001,0xC300,0x60C0,
  19.     0x0000,0xC200,0x60C0,0x0000,0xE600,0x60C0,0x0000,0x6400,
  20.     0x60C0,0x0000,0x7C00,0x60C0,0x0000,0x3800,0x60C0,0x0000,
  21.     0x0000,0x60C0,0x0000,0x0000,0x60C0,0x0000,0x0000,0x60C0,
  22.     0x00FF,0xFFFF,0xE0C0,0x0000,0x0000,0x00C0,0x0000,0x0000,
  23.     0x00C0,0x0000,0x0000,0x00C0,0x0000,0x0000,0x00C0,0x0000,
  24.     0x0000,0x00C0,0x7FFF,0xFFFF,0xFFC0,
  25. /* Plane 1 */
  26.     0xFFFF,0xFFFF,0xFF80,0xC000,0x0000,0x0000,0xC000,0x0000,
  27.     0x0000,0xC000,0x0000,0x0000,0xC000,0x0000,0x0000,0xC000,
  28.     0x0000,0x0000,0xC1FF,0xFFFF,0xC000,0xC180,0x0000,0x0000,
  29.     0xC180,0x0000,0x0000,0xC180,0x0000,0x0000,0xC180,0x0000,
  30.     0x0000,0xC180,0x0000,0x0000,0xC180,0x0000,0x0000,0xC180,
  31.     0x0000,0x0000,0xC180,0x0000,0x0000,0xC180,0x0000,0x0000,
  32.     0xC180,0x0000,0x0000,0xC180,0x0000,0x0000,0xC180,0x0000,
  33.     0x0000,0xC180,0x0000,0x0000,0xC180,0x0000,0x0000,0xC180,
  34.     0x0000,0x0000,0xC180,0x0000,0x0000,0xC180,0x0000,0x0000,
  35.     0xC100,0x0000,0x0000,0xC000,0x0000,0x0000,0xC000,0x0000,
  36.     0x0000,0xC000,0x0000,0x0000,0xC000,0x0000,0x0000,0xC000,
  37.     0x0000,0x0000,0x8000,0x0000,0x0000,
  38. };
  39.  
  40. struct Image CheckBoxI =
  41. {
  42.     0, 0,            /* Upper left corner */
  43.     TBGadW, TBGadH, 2,            /* Width, Height, Depth */
  44.     CheckBoxIData,        /* Image data */
  45.     0x0003, 0x0000,        /* PlanePick, PlaneOnOff */
  46.     NULL            /* Next image */
  47. };
  48.  
  49.  
  50. UWORD __chip CycleIData[] =
  51. {
  52. /* Plane 0 */
  53.     0x0000,0x0000,0x0040,0x0000,0x0000,0x00C0,0x0000,0x0000,
  54.     0x00C0,0x0000,0x0000,0x00C0,0x0000,0x0000,0x00C0,0x0000,
  55.     0x0000,0x00C0,0x0000,0x0000,0x20C0,0x0000,0x0000,0x60C0,
  56.     0x0003,0xF810,0x60C0,0x0006,0x0C10,0x60C0,0x0006,0x0C10,
  57.     0x60C0,0x0006,0x3F10,0x60C0,0x0006,0x1E10,0x60C0,0x0006,
  58.     0x0C10,0x60C0,0x0006,0x0010,0x60C0,0x0006,0x0010,0x60C0,
  59.     0x0006,0x0010,0x60C0,0x0006,0x0010,0x60C0,0x0006,0x0010,
  60.     0x60C0,0x0006,0x0010,0x60C0,0x0006,0x0C10,0x60C0,0x0003,
  61.     0xF810,0x60C0,0x0000,0x0010,0x60C0,0x0000,0x0000,0x60C0,
  62.     0x00FF,0xFFFF,0xE0C0,0x0000,0x0000,0x00C0,0x0000,0x0000,
  63.     0x00C0,0x0000,0x0000,0x00C0,0x0000,0x0000,0x00C0,0x0000,
  64.     0x0000,0x00C0,0x7FFF,0xFFFF,0xFFC0,
  65. /* Plane 1 */
  66.     0xFFFF,0xFFFF,0xFF80,0xC000,0x0000,0x0000,0xC000,0x0000,
  67.     0x0000,0xC000,0x0000,0x0000,0xC000,0x0000,0x0000,0xC000,
  68.     0x0000,0x0000,0xC1FF,0xFFFF,0xC000,0xC180,0x0000,0x0000,
  69.     0xC180,0x0008,0x0000,0xC180,0x0008,0x0000,0xC180,0x0008,
  70.     0x0000,0xC180,0x0008,0x0000,0xC180,0x0008,0x0000,0xC180,
  71.     0x0008,0x0000,0xC180,0x0008,0x0000,0xC180,0x0008,0x0000,
  72.     0xC180,0x0008,0x0000,0xC180,0x0008,0x0000,0xC180,0x0008,
  73.     0x0000,0xC180,0x0008,0x0000,0xC180,0x0008,0x0000,0xC180,
  74.     0x0008,0x0000,0xC180,0x0008,0x0000,0xC180,0x0000,0x0000,
  75.     0xC100,0x0000,0x0000,0xC000,0x0000,0x0000,0xC000,0x0000,
  76.     0x0000,0xC000,0x0000,0x0000,0xC000,0x0000,0x0000,0xC000,
  77.     0x0000,0x0000,0x8000,0x0000,0x0000,
  78. };
  79.  
  80. struct Image CycleI =
  81. {
  82.     0, 0,            /* Upper left corner */
  83.     TBGadW, TBGadH, 2,            /* Width, Height, Depth */
  84.     CycleIData,        /* Image data */
  85.     0x0003, 0x0000,        /* PlanePick, PlaneOnOff */
  86.     NULL            /* Next image */
  87. };
  88.  
  89.  
  90. UWORD __chip StringIData[] =
  91. {
  92. /* Plane 0 */
  93.     0x0000,0x0000,0x0040,0x0000,0x0000,0x00C0,0x0000,0x0000,
  94.     0x00C0,0x0000,0x0000,0x00C0,0x0000,0x0000,0x00C0,0x0000,
  95.     0x0000,0x00C0,0x0000,0x0000,0x20C0,0x00FF,0xFFFF,0x60C0,
  96.     0x00C0,0x0000,0x60C0,0x00C0,0x0000,0x60C0,0x00C3,0xC400,
  97.     0x60C0,0x00C4,0x2400,0x60C0,0x00C4,0x0EA0,0x60C0,0x00C3,
  98.     0x04C0,0x60C0,0x00C0,0xC480,0x60C0,0x00C0,0x2480,0x60C0,
  99.     0x00C4,0x2480,0x60C0,0x00C4,0x2480,0x60C0,0x00C3,0xC680,
  100.     0x60C0,0x00C0,0x0000,0x60C0,0x00C0,0x0000,0x60C0,0x00C0,
  101.     0x0000,0x60C0,0x00C0,0x0000,0x60C0,0x0080,0x0000,0x60C0,
  102.     0x01FF,0xFFFF,0xE0C0,0x0000,0x0000,0x00C0,0x0000,0x0000,
  103.     0x00C0,0x0000,0x0000,0x00C0,0x0000,0x0000,0x00C0,0x0000,
  104.     0x0000,0x00C0,0x7FFF,0xFFFF,0xFFC0,
  105. /* Plane 1 */
  106.     0xFFFF,0xFFFF,0xFF80,0xC000,0x0000,0x0000,0xC000,0x0000,
  107.     0x0000,0xC000,0x0000,0x0000,0xC000,0x0000,0x0000,0xC000,
  108.     0x0000,0x0000,0xC3FF,0xFFFF,0xC000,0xC300,0x0000,0x8000,
  109.     0xC300,0x0001,0x8000,0xC300,0x0001,0x8000,0xC300,0x0001,
  110.     0x8000,0xC300,0x0001,0x8000,0xC300,0x0001,0x8000,0xC300,
  111.     0x0001,0x8000,0xC300,0x0001,0x8000,0xC300,0x0001,0x8000,
  112.     0xC300,0x0001,0x8000,0xC300,0x0001,0x8000,0xC300,0x0001,
  113.     0x8000,0xC300,0x0001,0x8000,0xC300,0x0001,0x8000,0xC300,
  114.     0x0001,0x8000,0xC300,0x0001,0x8000,0xC37F,0xFFFF,0x8000,
  115.     0xC200,0x0000,0x0000,0xC000,0x0000,0x0000,0xC000,0x0000,
  116.     0x0000,0xC000,0x0000,0x0000,0xC000,0x0000,0x0000,0xC000,
  117.     0x0000,0x0000,0x8000,0x0000,0x0000,
  118. };
  119.  
  120. struct Image StringI =
  121. {
  122.     0, 0,            /* Upper left corner */
  123.     TBGadW, TBGadH, 2,            /* Width, Height, Depth */
  124.     StringIData,        /* Image data */
  125.     0x0003, 0x0000,        /* PlanePick, PlaneOnOff */
  126.     NULL            /* Next image */
  127. };
  128.  
  129.  
  130. struct Gadget ToolBoxGadgets[] = {
  131.     {
  132.         NULL, LATER, LATER,
  133.         TBGadW, TBGadH,
  134.         GFLG_GADGHCOMP|GFLG_GADGIMAGE,        /* Flags */
  135.         GACT_RELVERIFY,        /* Activation */
  136.         GTYP_BOOLGADGET,        /* GadgetType */
  137.         &CheckBoxI,                /* GadgetRender */
  138.         NULL,                        /* SelectRender */
  139.         NULL,                        /* GadgetText */
  140.         0,                            /* MutualExclude */
  141.         NULL,                        /* SpecialInfo */
  142.         CheckBoxID,                /* GadgetID */
  143.         NULL                        /* UserData */
  144.     },
  145.     {
  146.         &ToolBoxGadgets[CheckBoxID], LATER, LATER,
  147.         TBGadW, TBGadH,
  148.         GFLG_GADGHCOMP|GFLG_GADGIMAGE,        /* Flags */
  149.         GACT_RELVERIFY,        /* Activation */
  150.         GTYP_BOOLGADGET,        /* GadgetType */
  151.         &CycleI,                    /* GadgetRender */
  152.         NULL,                        /* SelectRender */
  153.         NULL,                        /* GadgetText */
  154.         0,                            /* MutualExclude */
  155.         NULL,                        /* SpecialInfo */
  156.         CycleID,                    /* GadgetID */
  157.         NULL                        /* UserData */
  158.     },
  159.     {
  160.         &ToolBoxGadgets[CycleID], LATER, LATER,
  161.         TBGadW, TBGadH,
  162.         GFLG_GADGHCOMP|GFLG_GADGIMAGE,        /* Flags */
  163.         GACT_RELVERIFY,        /* Activation */
  164.         GTYP_BOOLGADGET,        /* GadgetType */
  165.         &StringI,                /* GadgetRender */
  166.         NULL,                        /* SelectRender */
  167.         NULL,                        /* GadgetText */
  168.         0,                            /* MutualExclude */
  169.         NULL,                        /* SpecialInfo */
  170.         StringID,                /* GadgetID */
  171.         NULL                        /* UserData */
  172.     }
  173. };
  174.  
  175.  
  176. void CloseToolBox(struct Window *win)
  177. {
  178.     CloseWindow(win);
  179. }
  180.  
  181. struct Window *OpenToolBox(struct Window *parent)
  182. {
  183.     struct Window *win;
  184.  
  185.     ToolBoxGadgets[StringID].LeftEdge = OffX;
  186.     ToolBoxGadgets[StringID].TopEdge = OffY;
  187.  
  188.     ToolBoxGadgets[CycleID].LeftEdge = OffX;
  189.     ToolBoxGadgets[CycleID].TopEdge = OffY + TBGadH;
  190.  
  191.     ToolBoxGadgets[CheckBoxID].LeftEdge = OffX;
  192.     ToolBoxGadgets[CheckBoxID].TopEdge = OffY + 2*TBGadH;
  193.     
  194.     win = OpenWindowTags( NULL,
  195.                 WA_Left,       parent->LeftEdge + parent->Width+32,
  196.                 WA_Top,        parent->TopEdge,
  197.                 WA_Width,    OffX + TBGadW + Scr->WBorRight,
  198.                 WA_Height,    OffY + 3*TBGadH + Scr->WBorBottom,
  199.                 WA_IDCMP,    IDCMP_GADGETUP,
  200.                 WA_Flags,    WFLG_NEWLOOKMENUS|WFLG_RMBTRAP|WFLG_DRAGBAR|WFLG_DEPTHGADGET|WFLG_SMART_REFRESH,
  201.                 WA_Gadgets,    &ToolBoxGadgets[StringID],
  202.                 WA_ScreenTitle, parent->ScreenTitle,
  203.                 WA_PubScreen,    Scr,
  204.                 TAG_DONE );
  205.  
  206.     return win;
  207. }
  208.