home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Fresh Fish 8
/
FreshFishVol8-CD2.bin
/
bbs
/
dev
/
cmanual-3.0.lha
/
CManual
/
Intuition
/
Requesters
/
Example4.c
< prev
next >
Wrap
C/C++ Source or Header
|
1993-10-12
|
15KB
|
366 lines
/***********************************************************/
/* */
/* Amiga C Encyclopedia (ACE) V3.0 Amiga C Club (ACC) */
/* ------------------------------- ------------------ */
/* */
/* Book: ACM Intuition Amiga C Club */
/* Chapter: Requesters Tulevagen 22 */
/* File: Example4.c 181 41 LIDINGO */
/* Author: Anders Bjerin SWEDEN */
/* Date: 92-05-01 */
/* Version: 1.10 */
/* */
/* Copyright 1992, Anders Bjerin - Amiga C Club (ACC) */
/* */
/* Registered members may use this program freely in their */
/* own commercial/noncommercial programs/articles. */
/* */
/***********************************************************/
/* This program will open a normal window which is connected to the */
/* Workbench Screen. The window will use all System Gadgets, and will */
/* close first when the user has selected the System gadget Close */
/* window. Inside the window we have activated an Application requester */
/* with a connecting gadget. The requester will first be satisfied when */
/* the user has selected the gadget, and will then be deactivated. The */
/* window can now be closed. */
#include <intuition/intuition.h>
struct IntuitionBase *IntuitionBase;
/***************/
/* THE GADGET: */
/***************/
/* The coordinates for the box: */
SHORT gadget_border_points[]=
{
0, 0, /* Start at position (0,0) */
70, 0, /* Draw a line to the right to position (70,0) */
70, 10, /* Draw a line down to position (70,10) */
0, 10, /* Draw a line to the right to position (0,10) */
0, 0 /* Finish of by drawing a line up to position (0,0) */
};
/* The Border structure: */
struct Border gadget_border=
{
0, 0, /* LeftEdge, TopEdge. */
1, /* FrontPen, colour register 1. */
0, /* BackPen, for the moment unused. */
JAM1, /* DrawMode, draw the lines with colour 1. */
5, /* Count, 5 pair of coordinates in the array. */
gadget_border_points, /* XY, pointer to the array with the coord. */
NULL, /* NextBorder, no other Border structures are connected. */
};
/* The IntuiText structure: */
struct IntuiText gadget_text=
{
1, /* FrontPen, colour register 1. */
0, /* BackPen, colour register 0. */
JAM1, /* DrawMode, draw the characters with colour 1, do not */
/* change the background. */
4, 2, /* LeftEdge, TopEdge. */
NULL, /* ITextFont, use default font. */
"PRESS ME",/* IText, the text that will be printed. */
NULL, /* NextText, no other IntuiText structures are connected. */
};
struct Gadget requester_gadget=
{
NULL, /* NextGadget, no more gadgets in the list. */
40, /* LeftEdge, 40 pixels out. */
20, /* TopEdge, 20 lines down. */
71, /* Width, 71 pixels wide. */
11, /* Height, 11 pixels lines heigh. */
GADGHCOMP, /* Flags, when this gadget is highlighted, the gadget */
/* will be rendered in the complement colours. */
/* (Colour 0 (00) will be changed to colour 3 (11) */
/* (Colour 1 (01) - " - 2 (10) */
/* (Colour 2 (10) - " - 1 (01) */
/* (Colour 3 (11) - " - 0 (00) */
GADGIMMEDIATE| /* Activation, our program will recieve a message when */
RELVERIFY| /* the user has selected this gadget, and when the user */
/* has released it. */
ENDGADGET, /* When the user has selected this gadget, the */
/* requester is satisfied, and is deactivated. */
/* IMPORTANT! At least one gadget per requester */
/* must have the flag ENDGADGET set. If not, the */
/* requester would never be deactivated! */
BOOLGADGET| /* GadgetType, a Boolean gadget which is connected to */
REQGADGET, /* a requester. IMPORTANT! Every gadget which is */
/* connectd to a requester must have the REQGADGET flsg */
/* set in the GadgetType field. */
(APTR) &gadget_border, /* GadgetRender, a pointer to our Border struc. */
NULL, /* SelectRender, NULL since we do not supply the gadget */
/* with an alternative image. (We complement the */
/* colours instead) */
&gadget_text, /* GadgetText, a pointer to our IntuiText structure. */
/* (See chapter 3 GRAPHICS for more information) */
NULL, /* MutualExclude, no mutual exclude. */
NULL, /* SpecialInfo, NULL since this is a Boolean gadget. */
/* (It is not a Proportional/String or Integer gdget) */
0, /* GadgetID, no id. */
NULL /* UserData, no user data connected to the gadget. */
};
/***********************************************************************/
/* Important notice: */
/* Remember that every gadget which is connected to a requester must */
/* have the flag REQGADGET set in the GadgetType field. Remember also */
/* that at least one gadget per requester must have the ENDGADGET flag */
/* set in the Activation field. */
/***********************************************************************/
/************************************/
/* THE BORDER AROUND THE REQUESTER: */
/************************************/
/* The coordinates for the box around the requester: */
SHORT requester_border_points[]=
{
0, 0, /* Start at position (0,0) */
319, 0, /* Draw a line to the right to position (319,0) */
319, 99, /* Draw a line down to position (319,99) */
0, 99, /* Draw a line to the right to position (319,99) */
0, 0 /* Finish of by drawing a line up to position (0,0) */
};
/* The Border structure for the requester: */
struct Border requester_border=
{
0, 0, /* LeftEdge, TopEdge. */
1, /* FrontPen, colour register 1. */
0, /* BackPen, for the moment unused. */
JAM1, /* DrawMode, draw the lines with colour 1. */
5, /* Count, 5 pair of coordinates in the array. */
requester_border_points, /* XY, pointer to the array with the coord. */
NULL, /* NextBorder, no other Border structures are connected. */
};
/**********************************/
/* THE TEXT INSIDE THE REQUESTER: */
/**********************************/
/* The IntuiText structure used to print some text inside the requester: */
struct IntuiText requester_text=
{
1, /* FrontPen, colour register 1. */
0, /* BackPen, unused since JAM1. */
JAM1, /* DrawMode, draw the characters with colour 1, do not */
/* change the background. */
4, 2, /* LeftEdge, TopEdge. */
NULL, /* ITextFont, use default font. */
"This is the requester!", /* IText, the text that will be printed. */
NULL, /* NextText, no other IntuiText structures are connected. */
};
struct Requester my_requester=
{
NULL, /* OlderRequester, used by Intuition. */
40, 20, /* LeftEdge, TopEdge, 40 pixels out, 20 lines down. */
320, 100, /* Width, Height, 320 pixels wide, 100 lines high. */
0, 0, /* RelLeft, RelTop, Since POINTREL flag is not set, */
/* Intuition ignores these values. */
&requester_gadget, /* ReqGadget, pointer to the first gadget. */
&requester_border, /* ReqBorder, pointer to a Border structure. */
&requester_text, /* ReqText, pointer to a IntuiText structure. */
NULL, /* Flags, no flags set. */
3, /* BackF