home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
The AGA Experience 2
/
agavol2.iso
/
software
/
utilities
/
icon_tools
/
iconian296
/
sources
/
docs
/
popupgadget.doc
Wrap
Text File
|
1995-09-18
|
5KB
|
137 lines
Class: popup.gadget
Superclass: gadgetclass
Very configurable popup-menu gadget.
New Methods:
None.
Changed Methods:
OM_SET - Any attribute that would result in a visual change will cause
the gadget to re-render itself, even if a popup window is opened.
Weird visual stuff may happen if the popup window is open.
Attributes:
GA_LEFT, GA_TOP (IS) - Same as for gadgetclass. Any change will
result in the gadget moving itself.
GA_WIDTH, GA_HEIGHT (IS) - Only used if PUA_AUTOGADGETRESIZE is set to
FALSE.
GA_IMAGE, GA_SELECTRENDER (IS) - If set, will determine the gadget's
imagery. Otherwise, the image is taken from the active item's image.
If GA_IMAGE is present, but GA_SELECTRENDER is absent, then a
IDS_SELECTED state will be sent to the GA_IMAGE image.
GA_RELVERIFY (I) (New for 2.0) - If set, only a final notification
will be sent, after the selection is made or canceled.
PUA_ACTIVE (ISGU) - The currently selected item.
PUA_OBJECTS (I) - A list of linked objects. This is the meat of the
gadget. The objectnode structure's documentation is at the end of
this file.
PUA_ROWS, PUA_COLUMNS (ISGU) - Determines the size of the popup
window.
PUA_POPUPARROW (ISU) - Selects the visual imagery. PUARROW_NONE,
PUARROW_TINY, or PUARROW_POPUP.
PUA_GADGETBORDER (ISU) - Selects the visual imagery of the gadget's
border. -1 for no border. Otherwise any FRAME_* type supported by
frameiclass is legal.
PUA_WINDOWBORDER (ISU) - Same as PUA_GADGETBORDER, but for the frame
around the window.
PUA_WINDOWSPACING, PUA_IMAGESPACING (ISU) - If TRUE, a few pixels
around each item. Otherwise, a bestfit is used.
PUA_NUMBEROFOBJECTS (G) - Number of objects found in the object list.
PUA_AUTOGADGETRESIZE (ISU) - If TRUE, the gadget will attempt to
resize itself based on it's imagery. This can be useful if you are
unsure how the gadget will look. Just create the gadget, and then use
gadget->width/gadget->height to determine it's size.
PUA_AUTOWINDOWLAYOUT - UNUSED for now.
PUA_CENTERIMAGES (ISU) - If TRUE, each image will be centered in it's
box.
PUA_CENTERGADGETIMAGE (ISU) - If TRUE, the GA_IMAGE will be centered
in the gadget.
Additional functions in library:
Class *InitPopUpClass (void)
Initializes the class and returns a pointer to it.
BOOL FreePopUpClass (Class *cl)
Frees the class.
struct objectnode AddObjectToList(List *list, Object *object, long frameType, Object *selobject, long selFrameType, long selFillColor)
Allocates an object node and fills in the appropriate fields. Pass
this node through the DisposeObjectNodes!
struct objectnode AddTextToList(List *list, STRPTR text, textAttr ta, struct DrawInfo *drawInfo)
Opens the font specified by ta. (If it fails, topaz.8 will be
opened. uk!) An objectnode will be allocated. Then, two itexticlass
objects will be inserted. The objectnode will be returned. This
objectnode MUST be passed thru the DisposeObjects() *and*
DiposeObjectNodes() routine.
void DisposeObjectNodes (List *list)
Frees a list of objectsnodes. Does not dispose any objects, so use
DisposeObjects before hand if needed. This routine is intelligent
enough to dispose only those nodes allocated by other popup.gadget
routines.
void DisposeObjects (List *list)
Walks a list or objectnodes and DisposeObject() all object and
selobjects encountered. Also correctly frees objects created with
AddTextToList().
List *BuildPalette (long firstcolor, long lastcolor, long width, long height)
Allocates, and creates a "palette" object list consisting of a
number of fillrectclass rectangles. You MUST use DisposePalette() to
free the list. objectnode.frametype and objectnode.selframetype for
individual nodes may be modified as needed. All other variables are
off-limits.
void DisposePalette (List *list)
Frees a palette list.
NOTICE:
I'm not very proficent in writing C stuff (just reading it). So some
of the above calls might have wrong variable types. Take a look at
testpu.e for examples.
HISTORY:
---v2.0---
Added MENUUP and SELECTDOWN to end/cancel the popup-window. You can
now use ActivateGadget() to bringup window inside a menu-button verify
cancel (right mouse button). This effect can be seen in Iconian
2.94b.
Added support for GA_RELVERIFY. If set, the gadget does not send
PUA_ACTIVE messages until the gadget is done. (Although, a final
message will still be sent if the window is canceled...this might
change in the future.)
---v1.0---
Original release