home *** CD-ROM | disk | FTP | other *** search
- /*
- project: gadutil example - 8 Color gadgets + PROGRESS_KIND usage.
- author: Staffan Hämälä
- e-mail: staham@algonet.se
-
- Compiled with StormC version 1.05 DEMO. Now SAS/C V6.0.
-
- Use MagicWB colors on WB to get the gadgets right..
-
- Push the gadgets for progress up / down.
-
- */
- /*-----------------------------------------------------------------------*/
- /*
- Since every C program usually has header files included, so we here include
- needed files to satisfy our compiler !
- */
- #include <proto/exec.h>
- #include <proto/intuition.h>
- #include <intuition/gadgetclass.h>
- #include <libraries/gadutil.h>
- #include <proto/gadtools.h>
- #include <proto/gadutil.h> /* the name of the game ! */
- /*-----------------------------------------------------------------------*/
- /*
- It's very useful to define absolute gadget's position in the window. Note:
- it's only for the first gadget - other gadgets may be positioned relatively
- each to other. Also these values are used to compute the right size of the
- window (see tags WA_InnerWidth and WA_InnerHeight). It means that gadutil
- will compute for you the final size of the window !
- */
- #define LEFT_OFFSET 10
- #define TOP_OFFSET 10
-
- /*
- The following variables will be further filled by gadutil internal
- routines. Aren't ya familar with these yet ? Just refer to gadutil autodocs
- and it'll becomes clear at once !
- */
- LONG farright, farbottom, gad_IDCMP;
-
- struct TagItem global_tags[] =
- {
- GU_RightExtreme, (ULONG)&farright,
- GU_LowerExtreme, (ULONG)&farbottom,
- GU_MinimumIDCMP, (ULONG)&gad_IDCMP,
- TAG_DONE
- };
-
- /*-----------------------------------------------------------------------*/
- /*
- Gadget Image data
- */
-
- /* #pragma chip*/ /* StormC specific. SAS/C uses "static UWORD __chip myData.." */
-
- /* Image data for Gadget 2 Unselected */
-
- static UWORD __chip myData2[] =
- {
- 0x0000,0x0000,0x0000,0x0600,0x2abf,0xaaaa,0xaaaa,0xae00,
- 0x557f,0xd555,0x5555,0x5600,0x2aff,0xeaa9,0x2aaa,0xae00,
- 0x557b,0xf152,0x9555,0x5600,0x2aff,0xffad,0x6aaa,0xae00,
- 0x557f,0x7fda,0xa555,0x5600,0x2aff,0xfae7,0x5aaa,0xae00,
- 0x557a,0xff4a,0xad55,0x5600,0x2afd,0xfff4,0x56aa,0xae00,
- 0x557f,0xff2a,0x2b55,0x5600,0x2abb,0x7fd5,0x95d6,0xae00,
- 0x555f,0xe02b,0x5afb,0x5600,0x2aaf,0xde54,0xad76,0xae00,
- 0x5555,0xf6ab,0x56bb,0x5600,0x2aab,0x8f56,0xebde,0xae00,
- 0x5554,0xd8ab,0xd5ed,0x5600,0x2aab,0xfc56,0xab16,0xae00,
- 0x5555,0x6e2a,0x56ab,0x5600,0x2aaa,0xef46,0x2d65,0xae00,
- 0x5554,0xff47,0x1a56,0x5600,0x2aab,0xfefb,0x94aa,0xae00,
- 0x555f,0x5eff,0xa955,0x5600,0x2aae,0xadff,0x52aa,0xae00,
- 0x5575,0x55ff,0x8d55,0x5600,0x2aaa,0xabcb,0x52aa,0xae00,
- 0x5555,0x5555,0x4955,0x5600,0x2aaa,0xaaaa,0xa5aa,0xae00,
- 0xffff,0xffff,0xffff,0xfe00,0xffff,0xffff,0xffff,0xfe00,
- 0xffff,0xffff,0xffff,0xfa00,0xaaa0,0x2aaa,0xaaaa,0xaa00,
- 0xd548,0x1554,0x5555,0x5200,0xaaa0,0x0aab,0xaaaa,0xaa00,
- 0xd52f,0x1757,0xd555,0x5200,0xaa8d,0x97a7,0xcaaa,0xaa00,
- 0xd517,0x9ddf,0xe555,0x5200,0xaa8d,0x9afd,0xfaaa,0xaa00,
- 0xd502,0xdf7d,0xfd55,0x5200,0xaac5,0xbf5e,0xfeaa,0xaa00,
- 0xd567,0x807f,0x7f55,0x5200,0xaaa7,0x7fff,0xbfbe,0xaa00,
- 0xd542,0xa0fe,0x5faf,0x5200,0xaaa7,0x5bfe,0xa7dc,0xaa00,
- 0xd555,0x37ff,0x59ef,0x5200,0xaaab,0x8dfc,0xbe76,0xaa00,
- 0xd554,0xdffd,0x7eb9,0x5200,0xaaab,0xfbfd,0xfdfe,0xaa00,
- 0xd555,0x65fd,0xfbff,0x5200,0xaaaa,0x26bd,0xf3ee,0xaa00,
- 0xd554,0xfffb,0xe753,0x5200,0xaaa9,0xffff,0xeeaa,0xaa00,
- 0xd55e,0x5ff3,0xdd55,0x5200,0xaaae,0xa7ff,0xfaaa,0xaa00,
- 0xd565,0x53ef,0xd555,0x5200,0xaaaa,0xa9cb,0x7aaa,0xaa00,
- 0xd555,0x5555,0x5d55,0x5200,0xaaaa,0xaaaa,0xaeaa,0xaa00,
- 0x0000,0x0000,0x0000,0x0200,0xffff,0xffff,0xffff,0xfe00,
- 0x0000,0x0000,0x0000,0x0400,0x5540,0x5555,0x5555,0x5000,
- 0x2a80,0x2aab,0xaaaa,0xa800,0x5500,0x1555,0x5555,0x5000,
- 0x2a84,0x0eaa,0xaaaa,0xa800,0x5509,0x0f5d,0x7555,0x5000,
- 0x2a87,0x9faa,0xaaaa,0xa800,0x550f,0x9bd7,0x5555,0x5000,
- 0x2a87,0x9fea,0xaaaa,0xa800,0x5503,0xbff5,0x5555,0x5000,
- 0x2a87,0xffea,0xaaaa,0xa800,0x5543,0xffd5,0x5555,0x5000,
- 0x2aa7,0xf0ab,0xbafa,0xa800,0x5553,0xff55,0x5d77,0x5000,
- 0x2aa9,0xfeaa,0xb6ba,0xa800,0x5555,0xdf57,0x6bdd,0x5000,
- 0x2aaa,0xfcaa,0xd5ee,0xa800,0x5554,0xec56,0xab55,0x5000,
- 0x2aaa,0x7e2a,0x56ea,0xa800,0x5555,0xff46,0x2d55,0x5000,
- 0x2aaa,0xef47,0x1a2e,0xa800,0x5557,0xceff,0x9555,0x5000,
- 0x2abf,0xaeff,0xeaaa,0xa800,0x556d,0x5df7,0xd555,0x5000,
- 0x2aba,0xadf7,0x8aaa,0xa800,0x5555,0x57d7,0x5555,0x5000,
- 0x2aaa,0xaaaa,0xaaaa,0xa800,0x5555,0x5555,0x5555,0x5000,
- 0x8000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- };
-
-
- /* Image data for Gadget 2 Selected */
-
- static UWORD __chip myData2b[] =
- {
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0200,
- 0x155f,0xd555,0x5555,0x5600,0x2abf,0xeaaa,0xaaaa,0xaa00,
- 0x157f,0xf554,0xe555,0x5600,0x2abd,0xf8a9,0x5555,0x7e00,
- 0x157f,0xffd6,0xaaaa,0xaa00,0x2abf,0xbfed,0x5557,0x7a00,
- 0x157f,0xfd73,0xaac5,0x9600,0x2abd,0x7fa5,0xf0aa,0xaa00,
- 0x157e,0xfffa,0x9555,0x5600,0x2abf,0xff95,0x2aaa,0xaa00,
- 0x155d,0xbfea,0xd56b,0x5600,0x2aaf,0xf015,0xabbd,0xaa00,
- 0x1557,0xef2a,0x555b,0x5600,0x2aaa,0xfb55,0xaab5,0xaa00,
- 0x1555,0xc7ab,0x756b,0x5600,0x2aaa,0x6c55,0xead6,0xaa00,
- 0x1555,0xfe2b,0x55ad,0x5600,0x2aaa,0xb715,0x2b5a,0xaa00,
- 0x1555,0x77a3,0x16b5,0x5600,0x2aaa,0x7fa3,0x8d2a,0xaa00,
- 0x1555,0xff7d,0xca55,0x5600,0x2aaf,0xaf7f,0xd4aa,0xaa00,
- 0x1557,0x56ff,0xa955,0x5600,0x2aba,0xaaff,0xc6aa,0xaa00,
- 0x1555,0x55e5,0xa955,0x5600,0x2aaa,0xaaaa,0xa4aa,0xaa00,
- 0x1555,0x5555,0x52d5,0x5600,0x7fff,0xffff,0xffff,0xfe00,
- 0x0000,0x0000,0x0000,0x0000,0x7fff,0xffff,0xffff,0xfc00,
- 0x5550,0x1555,0x5555,0x5400,0x6aa4,0x0aaa,0xaaaa,0xa800,
- 0x5550,0x0555,0xa555,0x5400,0x6a97,0x8bab,0xffff,0xc800,
- 0x5546,0xcbd3,0xffff,0xfc00,0x6a8b,0xceef,0xfffd,0xf000,
- 0x5546,0xcd7e,0xff45,0xd400,0x6a81,0x6fbf,0x00aa,0xa800,
- 0x5562,0xdfaf,0x9555,0x5400,0x6ab3,0xc03f,0xaaaa,0xa800,
- 0x5553,0xbfff,0xd51f,0x5400,0x6aa1,0x507f,0x2af7,0xa800,
- 0x5553,0xadff,0x57ee,0x5400,0x6aaa,0x9bff,0xafdf,0xa800,
- 0x5555,0xc6fe,0x5fbf,0x5400,0x6aaa,0x6ffe,0xbf7e,0xa800,
- 0x5555,0xfdfe,0xfefd,0x5400,0x6aaa,0xb2fe,0xfdfa,0xa800,
- 0x5555,0x135e,0xf9f5,0x5400,0x6aaa,0x7ffd,0xf3aa,0xa800,
- 0x5554,0xffff,0xf755,0x5400,0x6aaf,0x2ff9,0xeeaa,0xa800,
- 0x5557,0x53ff,0xfd55,0x5400,0x6ab2,0xa9f7,0xeaaa,0xa800,
- 0x5555,0x54e5,0xbd55,0x5400,0x6aaa,0xaaaa,0xaeaa,0xa800,
- 0x5555,0x5555,0x5755,0x5400,0x0000,0x0000,0x0000,0x0000,
- 0xffff,0xffff,0xffff,0xfe00,0x8000,0x0000,0x0000,0x0200,
- 0xaaa0,0x2aaa,0xaaaa,0xa800,0x9540,0x1555,0x5555,0x5400,
- 0xaa80,0x0aaa,0xfaaa,0xa800,0x9542,0x0755,0x5555,0x7400,
- 0xaa84,0x87ae,0xaaaa,0xa800,0x9543,0xcfd5,0x5557,0x7800,
- 0xaa87,0xcdeb,0xaada,0x8800,0x9543,0xcff5,0xf355,0x5400,
- 0xaa81,0xdffa,0xaaaa,0xa800,0x9543,0xfff5,0x5555,0x5400,
- 0xaaa1,0xffea,0xaaea,0xa800,0x9553,0xf855,0xd5bd,0x5400,
- 0xaaa9,0xffaa,0xa95b,0xa800,0x9554,0xff55,0x5ab5,0x5400,
- 0xaaaa,0xefab,0xb56a,0xa800,0x9555,0x7e55,0x6ad5,0x5400,
- 0xaaaa,0x762b,0x55aa,0xa800,0x9555,0x3f15,0x2b55,0x5400,
- 0xaaaa,0xffa3,0x16aa,0xa800,0x9555,0x77a3,0x8d15,0x5400,
- 0xaaab,0xe77f,0xcaaa,0xa800,0x955f,0xd77f,0xf555,0x5400,
- 0xaab6,0xaefb,0xeaaa,0xa800,0x955d,0x56fb,0xc555,0x5400,
- 0xaaaa,0xabeb,0xaaaa,0xa800,0x9555,0x5555,0x5555,0x5400,
- 0xaaaa,0xaaaa,0xaaaa,0xa800,0xc000,0x0000,0x0000,0x0000,
- };
-
- /* Image data for Gadget 3 Unselected */
-
- static UWORD __chip myData3[] =
- {
- 0x0000,0x0000,0x0080,0x0600,0x7fff,0xffff,0xf07f,0xfe00,
- 0x7fff,0xffff,0xe03f,0xfe00,0x7f87,0xffff,0xc43b,0xfe00,
- 0x2e7b,0xaeae,0x8a73,0xae00,0x7dfd,0xffff,0x15c1,0xfe00,
- 0x2dae,0xeaaa,0x2f09,0xae00,0x5bde,0xdddc,0x5c30,0xde00,
- 0x2baa,0xeaa8,0xb0cc,0xee00,0x1b10,0xd110,0x4330,0x5600,
- 0x2bab,0xebff,0xffff,0xee00,0x0b02,0xc000,0x0000,0x0600,
- 0x0b88,0x8854,0x0000,0x1e00,0x0b00,0x1068,0x0001,0x1e00,
- 0x1fff,0xf854,0x0000,0x1e00,0x1a00,0x3800,0x0003,0x9e00,
- 0x1d00,0x3800,0x0001,0x9e00,0x1a38,0x3800,0x0000,0x1e00,
- 0x1d38,0x3800,0x3780,0x1e00,0x1a38,0x3800,0x0000,0x1e00,
- 0x1c10,0x3800,0x2fe8,0x1e00,0x1a38,0x3800,0x0000,0x1e00,
- 0x1c7c,0x3800,0x2db0,0x1e00,0x1a00,0x3800,0x0000,0x1e00,
- 0x1c00,0x3800,0x0000,0x1e00,0x1fff,0xf800,0x0000,0x1e00,
- 0x1fff,0xf9ff,0xffff,0xfe00,0x0fff,0xf8ff,0xffff,0xfe00,
- 0xffff,0xffff,0xffff,0xfe00,0xffff,0xffff,0xffff,0xfe00,
- 0xffff,0xffff,0xff7f,0xfa00,0x8000,0x0000,0x0f80,0x0200,
- 0x8078,0x0000,0x1fc0,0x0200,0x81f8,0x0000,0x3bc4,0x0200,
- 0x8384,0x0000,0x758d,0x0200,0x8682,0x0000,0xea3e,0x0200,
- 0x8701,0x4001,0xd0f6,0x8200,0x8c03,0x0003,0xa3cf,0x0200,
- 0x8c03,0x0007,0x4f33,0x4200,0x8c01,0x000f,0xbccf,0x8200,
- 0x8c00,0x0000,0x0000,0x0200,0x8c03,0x01ff,0xffff,0xe200,
- 0x8c00,0x01ab,0xffff,0xf200,0x8c00,0x1197,0xffff,0xea00,
- 0x9fff,0xe9ab,0xffff,0xea00,0x95fd,0x29ff,0xffff,0xea00,
- 0x92fe,0xa9ff,0xffff,0xea00,0x95ed,0x29ff,0xffff,0xea00,
- 0x92c6,0xa9ff,0xf27f,0xea00,0x95ed,0x29ff,0xffff,0xea00,
- 0x93c6,0xa9ff,0xe4a7,0xea00,0x95c5,0x29ff,0xffff,0xea00,
- 0x93c6,0xa9ff,0xe48f,0xea00,0x95fd,0x29ff,0xffff,0xea00,
- 0x93fa,0x29ff,0xffff,0xea00,0x9fff,0xe9ff,0xffff,0xea00,
- 0x9000,0x0980,0x0000,0x0a00,0x8fff,0xf8ff,0xffff,0xfa00,
- 0x0000,0x0000,0x0000,0x0200,0xffff,0xffff,0xffff,0xfe00,
- 0x0000,0x0000,0x0000,0x0400,0x7fff,0xffff,0xf03f,0xf800,
- 0x7f87,0xffff,0xe01f,0xf800,0x7e01,0xffff,0xc429,0xf800,
- 0x2c7a,0xaeae,0x8a72,0xa800,0x7905,0x7fff,0x15c0,0xf800,
- 0x282a,0x2aaa,0x2f09,0x2800,0x52dc,0x9ddc,0x5c30,0x5800,
- 0x22a8,0xaaa8,0xb0cc,0xa800,0x1212,0x9110,0x4330,0x1000,
- 0x22ab,0xabff,0xffff,0xe800,0x0200,0x8000,0x0000,0x0000,
- 0x0288,0x8854,0x0000,0x0800,0x32ff,0xe068,0x0003,0x8000,
- 0x3fff,0xc054,0x0003,0x8000,0x3fff,0xc000,0x0001,0x8000,
- 0x3fff,0xc000,0x0003,0x0000,0x3fc7,0xc000,0x0000,0x0000,
- 0x7fc7,0xc400,0x0d80,0x0000,0x3fc7,0xc200,0x0000,0x0000,
- 0x7fef,0xc400,0x1b58,0x0000,0x3fc7,0xc200,0x0000,0x0000,
- 0x7f83,0xc400,0x1b70,0x0000,0x3fff,0xc200,0x0000,0x0000,
- 0x7fff,0xc400,0x0000,0x0000,0x7000,0x0600,0x0000,0x0000,
- 0x6000,0x0600,0x0000,0x0000,0x7000,0x0700,0x0000,0x0000,
- 0x8000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- };
-
-
-
-
- /* Image data for Gadget 3 Selected */
-
- static UWORD __chip myData3b[] =
- {
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0200,
- 0x3fff,0xffff,0xffff,0xfe00,0x3fff,0xffff,0xffff,0xfe00,
- 0x3fff,0xffff,0xffff,0xfe00,0x177f,0x5757,0x5fd7,0x5600,
- 0x3fc3,0xffff,0xffff,0xfe00,0x153d,0xd555,0x7ff5,0x5600,
- 0x2efe,0xeeee,0xfffe,0xee00,0x16d7,0x7555,0xff7d,0x5600,
- 0x0d89,0x688b,0xfff8,0x8a00,0x15d5,0x75ff,0xffff,0xf600,
- 0x0581,0x600d,0xeb60,0x0200,0x05c5,0x641b,0xf6c0,0x0e00,
- 0x0581,0x6836,0x7d80,0x8e00,0x0fff,0xfc1b,0x4b00,0x0e00,
- 0x0d00,0x1c0d,0x8601,0xce00,0x0e80,0x1c06,0xcc00,0xce00,
- 0x0d1c,0x1c03,0x7800,0x0e00,0x0e9c,0x1c01,0xbbc0,0x0e00,
- 0x0d1c,0x1c00,0xe000,0x0e00,0x0e08,0x1c00,0x57f4,0x0e00,
- 0x0d1c,0x1c00,0x0000,0x0e00,0x0e3e,0x1c00,0x16d8,0x0e00,
- 0x0d00,0x1c00,0x0000,0x0e00,0x0e00,0x1c00,0x0000,0x0e00,
- 0x0fff,0xfc00,0x0000,0x0e00,0x0fff,0xfcff,0xffff,0xfe00,
- 0x07ff,0xfc7f,0xffff,0xfe00,0x7fff,0xffff,0xffff,0xfe00,
- 0x0000,0x0000,0x0000,0x0000,0x7fff,0xffff,0xffff,0xfc00,
- 0x4000,0x0000,0x0000,0x0000,0x4000,0x0000,0x0200,0x0000,
- 0x4000,0x0000,0x0500,0x0000,0x403c,0x0000,0x0880,0x0000,
- 0x40fe,0x0000,0x1140,0x0000,0x41c2,0x0000,0x2060,0x0000,
- 0x4341,0x0000,0x4110,0x0000,0x4380,0xa000,0x8008,0x0000,
- 0x4601,0x8001,0x0010,0x0000,0x4601,0x8002,0x0060,0x0000,
- 0x4601,0x80f6,0x14df,0xf000,0x4601,0x80ec,0x09bf,0xf800,
- 0x4601,0x88d9,0x837f,0xf400,0x4fff,0xf4ec,0x36ff,0xf400,
- 0x4afe,0x94f6,0x7dff,0xf400,0x497f,0x54fb,0x3bff,0xf400,
- 0x4af6,0x94fd,0x97ff,0xf400,0x4963,0x54fe,0xe93f,0xf400,
- 0x4af6,0x94ff,0x5fff,0xf400,0x49e3,0x54ff,0xb253,0xf400,
- 0x4ae2,0x94ff,0xffff,0xf400,0x49e3,0x54ff,0xf247,0xf400,
- 0x4afe,0x94ff,0xffff,0xf400,0x49fd,0x14ff,0xffff,0xf400,
- 0x4fff,0xf4ff,0xffff,0xf400,0x4800,0x04c0,0x0000,0x0400,
- 0x47ff,0xfc7f,0xffff,0xfc00,0x0000,0x0000,0x0000,0x0000,
- 0xffff,0xffff,0xffff,0xfe00,0x8000,0x0000,0x0000,0x0200,
- 0xbfff,0xffff,0xfdff,0xfc00,0xbfff,0xffff,0xfaff,0xfc00,
- 0xbfff,0xffff,0xf77f,0xfc00,0x9743,0x5757,0x4c97,0x5400,
- 0xbf00,0xffff,0xd85f,0xfc00,0x943d,0x5555,0x3325,0x5400,
- 0xac82,0xaeee,0x7876,0xec00,0x9415,0x1554,0xcc79,0x5400,
- 0x8908,0x4889,0x9a70,0x8800,0x9154,0x55fb,0xb12f,0xf400,
- 0x8100,0x4004,0x0940,0x0000,0x8144,0x4408,0x8080,0x0400,
- 0x997e,0x5010,0x2101,0xc000,0x9fff,0xe008,0x8a01,0xc000,
- 0x9fff,0xe004,0x0400,0xc000,0x9fff,0xe002,0x0801,0x8000,
- 0x9fe3,0xe001,0x3000,0x0000,0xbfe3,0xe200,0xa6c0,0x0000,
- 0x9fe3,0xe100,0x4000,0x0000,0xbff7,0xe200,0x0dac,0x0000,
- 0x9fe3,0xe100,0x0000,0x0000,0xbfc1,0xe200,0x0db8,0x0000,
- 0x9fff,0xe100,0x0000,0x0000,0xbfff,0xe200,0x0000,0x0000,
- 0xb800,0x0300,0x0000,0x0000,0xb000,0x0300,0x0000,0x0000,
- 0xb800,0x0380,0x0000,0x0000,0xc000,0x0000,0x0000,0x0000,
- };
-
-
-
- /*#pragma fast*/ /* StormC specific. SAS/C uses "static UWORD __chip myData.." */
-
-
- /*-------------------------------------------------------------------------*/
-
- struct Image image2 = {0, 0, 55, 30, 3, myData2, 0x07, 0x00, NULL};
- struct Image image2b = {0, 0, 55, 30, 3, myData2b, 0x07, 0x00, NULL};
- struct Image image3 = {0, 0, 55, 30, 3, myData3, 0x07, 0x00, NULL};
- struct Image image3b = {0, 0, 55, 30, 3, myData3b, 0x07, 0x00, NULL};
-
-
- /*-----------------------------------------------------------------------*/
- /*
- Here we can define all gadgets ! It's very simple task - you don't need any
- GUI editor since gadget's positions may be specified relatively each to
- other !
- */
-
- /* gadget's names
- */
- #define GDG_ONTIME 1 /* Specify a name for the gadgets (GadgetID) */
- #define GDG_BUTTON2 2
- #define GDG_BUTTON3 3
-
-
- struct TagItem ontime[] =
- {
- GU_GadgetKind, PROGRESS_KIND, /* The gadget type */
- GU_GadgetText, (ULONG)"", /* No text! */
- GU_Left, LEFT_OFFSET,
- GU_Top, TOP_OFFSET,
- GU_Height, 10,
- GU_AlignRight, GDG_BUTTON3,
- GUPR_FillColor, 7, /* Fill color for the progress gadget */
- GUPR_BackColor, 0, /* Background color for the progress gadget */
- GUPR_Current, 75, /* Current position */
- GUPR_Total, 100, /* Max value. ie. 100% */
- TAG_DONE
- };
-
- struct TagItem button2[] =
- {
- GU_GadgetKind, IMAGE_KIND, /* Image kind gadget.. 8 Color image */
- GU_GadgetText, (ULONG)"",
- GU_Left, LEFT_OFFSET,
- GU_TopRel, GDG_ONTIME,
- GU_Height, 32,
- GU_Width, 59,
- GUIM_Image, (ULONG)&image2, /* Normal image */
- GUIM_SelectImg, (ULONG)&image2b,/* And selected image */
- TAG_DONE
- };
-
- struct TagItem button3[] =
- {
- GU_GadgetKind, IMAGE_KIND, /* Another 8 color gadget */
- GU_GadgetText, (ULONG)"",
- GU_LeftRel, GDG_BUTTON2,
- GU_AlignTop, GDG_BUTTON2,
- GU_Height, 32,
- GU_Width, 59,
- GUIM_Image, (ULONG)&image3, /* Normal image */
- GUIM_SelectImg, (ULONG)&image3b,/* Selected image */
- TAG_DONE
- };
-
-
-
- /* This is the list of the gadgets. To remove a gadget, just remove a line :-) */
-
- struct LayoutGadget gadgets[] =
- {
- GDG_ONTIME, ontime, NULL, NULL,
- GDG_BUTTON2, button2, NULL, NULL,
- GDG_BUTTON3, button3, NULL, NULL,
- -1
- };
- /*-----------------------------------------------------------------------*/
- struct Library *GadUtilBase = NULL; /* library base */
- struct Screen *myscreen = NULL; /* our screen */
- struct Window *mywindow = NULL; /* and its visitor window */
-
- struct ProgressGad *gadgetaddr; /* Progress gadget pointer */
-
- APTR ginfo; /* gadget stuff */
- struct Gadget *glist;
- UWORD sel_gadID; /* number of the selected gadget */
-
- struct IntuiMessage *imsg; /* IntuiMessage stuff */
- ULONG klass;
- UWORD code;
- APTR iaddress;
-
- BOOL done = FALSE; /* program termination flag */
- /*-----------------------------------------------------------------------*/
- void main(void)
- {
- /* lets open the famous library :-) */
- if (GadUtilBase = OpenLibrary(GADUTILNAME, 36))
- {
- /* lets get pointer to any public screen */
- if (myscreen = LockPubScreen(NULL))
- {
- /* lets initialize our pretty gadgets */
- if (ginfo = GU_LayoutGadgetsA(&glist, gadgets, myscreen, global_tags))
- {
- /* I think it would be great to have one small cute window ! */
- if (mywindow = OpenWindowTags(
- NULL,
- WA_Left, 5,
- WA_Top, 20,
- WA_InnerWidth, farright+LEFT_OFFSET,
- WA_InnerHeight, farbottom+TOP_OFFSET,
- WA_IDCMP, gad_IDCMP|
- IDCMP_CLOSEWINDOW|
- IDCMP_VANILLAKEY,
- WA_Flags, WFLG_DRAGBAR|
- WFLG_DEPTHGADGET|
- WFLG_CLOSEGADGET|
- WFLG_SMART_REFRESH|
- WFLG_ACTIVATE|
- WFLG_RMBTRAP,
- WA_Gadgets, glist,
- WA_Title, (ULONG)"Test gadgets.",
- TAG_DONE))
- {
- /* Hmm, our pretties need to be refreshed... */
- GU_RefreshWindow(mywindow, ginfo);
-
- /*
- As ya may see program will terminate if our boolean become TRUE !
- */
- while (!done)
- {
- /* Waiting for messages - is it heavy work ? */
- Wait(1L << mywindow->UserPort->mp_SigBit);
-
- /* lets process our messages */
- while (imsg = GU_GetIMsg(mywindow->UserPort))
- {
- /* Lets store every message and reply as fast as we can ! */
- klass = imsg->Class;
- code = imsg->Code;
- iaddress = imsg->IAddress;
- GU_ReplyIMsg(imsg);
-
- /*
- Let's take a brave decission and branch out (standard IDCMP
- handling).
- */
- switch (klass)
- {
- /* DRAWER_KIND, FILE_KIND or IMAGE_KIND */
-
- case IDCMP_GADGETUP:
-
- /* number of the selected gadget */
- sel_gadID = ((struct Gadget *)iaddress)->GadgetID;
-
- switch (sel_gadID)
- {
- case GDG_BUTTON2:
- gadgetaddr = GU_GetGadgetPtr(GDG_ONTIME, gadgets); /* Get a pointer for the gadget */
-
- if (gadgetaddr->pg_Current>=5) /* Decrement the progress gadget */
- gadgetaddr->pg_Current=gadgetaddr->pg_Current-5; /* (IF possible) */
-
- GU_UpdateProgress(mywindow,ginfo,gadgetaddr); /* And update the gadget itself */
-
- break;
-
- case GDG_BUTTON3:
-
- gadgetaddr = GU_GetGadgetPtr(GDG_ONTIME, gadgets); /* Pointer to the PROGRESS_KIND gadget */
-
- if (gadgetaddr->pg_Current<=95) /* Increment the progress gadget. */
- gadgetaddr->pg_Current=gadgetaddr->pg_Current+5; /* (IF possible) */
-
- GU_UpdateProgress(mywindow,ginfo,gadgetaddr); /* And update the gadget */
-
- break;
- }
-
- break;
-
- /* both close window and Esc key will cause quit */
- case IDCMP_CLOSEWINDOW: done = TRUE; break;
- case IDCMP_VANILLAKEY: done = (code==27); break;
- }
- }
- }
- /* Bye, bye dear window ! */
- CloseWindow(mywindow);
- }
- /* Bye for now, pretty gadgets ! */
- GU_FreeLayoutGadgets(ginfo);
- }
-
- /* According to the RKM we may unlock our screen now ! */
- UnlockPubScreen(NULL, myscreen);
-
- }
- /* Sorry, according to the RKM I... have to close ya :( */
- CloseLibrary(GadUtilBase);
- }
- }
-