2 Copyright © 1995-2006, The AROS Development Team. All rights reserved.
5 Desc: Demo/test for AROS stringgadgets.
9 #include <proto/exec.h>
10 #include <proto/intuition.h>
11 #include <intuition/intuition.h>
14 #include <aros/debug.h>
16 VOID
HandleEvents(struct Window
*);
21 #define STRBUFSIZE 100
22 #define STRGADWIDTH 100
23 #define STRGADHEIGHT 20
26 UBYTE strbuf
[STRBUFSIZE
];
27 UBYTE undobuf
[STRBUFSIZE
];
29 UWORD strborderdata
[] = { 0,0, STRGADWIDTH
+ 3,0, STRGADWIDTH
+ 3,STRGADHEIGHT
+3,
30 0,STRGADHEIGHT
+ 3, 0,0};
32 struct Border strborder
= { -2, -2, 1, 0, JAM1
, 5, strborderdata
, };
34 struct StringInfo strinfo
= {strbuf
, undobuf
, 0, STRBUFSIZE
, };
35 struct Gadget strgad
= {NULL
, 20, 20, STRGADWIDTH
, STRGADHEIGHT
,
36 GFLG_GADGHCOMP
, GACT_RELVERIFY
|GACT_STRINGLEFT
, GTYP_STRGADGET
,
37 &strborder
, NULL
, NULL
, 0, &strinfo
, 0, NULL
, };
39 struct IntuitionBase
*IntuitionBase
;
44 int main(int argc
, char **argv
)
46 IntuitionBase
= (struct IntuitionBase
*)OpenLibrary("intuition.library", 37);
49 struct Window
*window
= OpenWindowTags(NULL
,
52 WA_Title
, (IPTR
)"Stringgadget Demo",
53 WA_Gadgets
, (IPTR
)&strgad
,
54 WA_IDCMP
, IDCMP_GADGETUP
|IDCMP_RAWKEY
|IDCMP_CLOSEWINDOW
,
64 CloseLibrary((struct Library
*)IntuitionBase
);
73 VOID
HandleEvents(struct Window
*win
)
75 struct IntuiMessage
*imsg
;
76 struct MsgPort
*port
= win
->UserPort
;
77 BOOL terminated
= FALSE
;
81 if ((imsg
= (struct IntuiMessage
*)GetMsg(port
)) != NULL
)
91 if(imsg
->Code
== 0x10)
96 case IDCMP_CLOSEWINDOW
:
100 } /* switch (imsg->Class) */
101 ReplyMsg((struct Message
*)imsg
);
104 } /* if ((imsg = GetMsg(port)) != NULL) */
107 Wait(1L << port
->mp_SigBit
);
109 } /* while (!terminated) */
112 } /* HandleEvents() */