home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Fresh Fish 8
/
FreshFishVol8-CD2.bin
/
bbs
/
dev
/
cmanual-3.0.lha
/
CManual
/
Intuition
/
Requesters
/
Example9.c
< prev
next >
Wrap
C/C++ Source or Header
|
1993-10-12
|
22KB
|
553 lines
/***********************************************************/
/* */
/* Amiga C Encyclopedia (ACE) V3.0 Amiga C Club (ACC) */
/* ------------------------------- ------------------ */
/* */
/* Book: ACM Intuition Amiga C Club */
/* Chapter: Requesters Tulevagen 22 */
/* File: Example9.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 three connecting gadgets. Two are Boolean gadgets ("OK and */
/* "CANCEL"), and one is a Proportional gadget. */
#include <intuition/intuition.h>
struct IntuitionBase *IntuitionBase;
/*****************************************/
/* THE PROPORTIONAL GADGET's STRUCTURES: */
/*****************************************/
/* The IntuiText structure for the proportional gadget: */
struct IntuiText prop_text=
{
1, /* FrontPen, colour register 1. */
0, /* BackPen, colour register 0. */
JAM1, /* DrawMode, draw the characters with colour 1, do not */
/* change the background. */
-65, 2, /* LeftEdge, TopEdge. */
NULL, /* ITextFont, use default font. */
"Colour:", /* IText, the text that will be printed. */
NULL, /* NextText, no other IntuiText structures. */
};
/* We need to declare an Image structure for the knob, but since */
/* Intuition will take care of the size etc of the knob, we do not need */
/* to initialize the Image structure: */
struct Image prop_image;
struct PropInfo prop_info=
{
FREEHORIZ| /* Flags, the knob should be moved horizontally, and */
AUTOKNOB, /* Intuition should take care of the knob image. */
0, /* HorizPot, start position of the knob. */
0, /* VertPot, 0 since we will not move the knob hor. */
MAXBODY * 1/16, /* HorizBody, 16 steps. */
0, /* VertBody, 0 since we will not move the knob hor. */
/* These variables are initialized and maintained by Intuition: */
0, /* CWidth */
0, /* CHeight */
0, 0, /* HPotRes, VPotRes */
0, /* LeftBorder */
0 /* TopBorder */
};
struct Gadget prop_gadget=
{
NULL, /* NextGadget, no more gadgets in the list. */
80, /* LeftEdge, 80 pixels out. */
30, /* TopEdge, 30 lines down. */
189, /* Width, 189 pixels wide. */
12, /* Height, 12 pixels lines heigh. */
GADGHCOMP, /* Flags, complement the colours. */
GADGIMMEDIATE| /* Activation, our program will recieve a message */
RELVERIFY, /* when the user has selected this gadget, and when */
/* the user has released it. */
PROPGADGET, /* GadgetType, a Proportional gadget. */
(APTR) &prop_image,/* GadgetRender, a pointer to our Image structure. */
/* (Intuition will take care of the knob image) */
/* (See chapter 3 GRAPHICS for more information) */
NULL, /* SelectRender, NULL since we do not supply the */
/* gadget with an alternative image. */
&prop_text, /* GadgetText, colour. */
NULL, /* MutualExclude, no mutual exclude. */
(APTR) &prop_info, /* SpecialInfo, pointer to a PropInfo structure. */
0, /* GadgetID, no id. */
NULL /* UserData, no user data connected to the gadget. */
};
/*******************************/
/* THE OK GADGET's STRUCTURES: */
/*******************************/
/* The coordinates for the OK box: */
SHORT ok_border_points[]=
{
0, 0, /* Start at position (0,0) */
22, 0, /* Draw a line to the right to position (22,0) */
22, 10, /* Draw a line down to position (22,10) */
0, 10, /* Draw a line to the left to position (0,10) */
0, 0 /* Finish of by drawing a line up to position (0,0) */
};
/* The Border structure: */
struct Border ok_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. */
ok_border_points, /* XY, pointer to the array with the coord. */
NULL, /* NextBorder, no other Border structures are connected. */
};
/* The IntuiText structure: */
struct IntuiText ok_text=
{
1, /* FrontPen, colour register 1. */
0, /* BackPen, not used since JAM1. */
JAM1, /* DrawMode, draw the characters with colour 1, do not */
/* change the background. */
4, 2, /* LeftEdge, TopEdge. */
NULL, /* ITextFont, use default font. */
"OK", /* IText, the text that will be printed. */
NULL, /* NextText, no other IntuiText structures are connected. */
};
struct Gadget ok_gadget=
{
&prop_gadget, /* NextGadget, linked to the Proportional gadget. */
14, /* LeftEdge, 14 pixels out. */
47, /* TopEdge, 47 lines down. */
23, /* Width, 23 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) &ok_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) */
&ok_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. */
/* (No binary mask) */
0, /* GadgetID, no id. */
NULL /* UserData, no user data connected to the gadget. */
};
/***********************************/
/* THE CANCEL GADGET's STRUCTURES: */
/***********************************/
/* The coordinates for the