TABLE OF CONTENTS intuition.library/ActivateGadget intuition.library/ActivateWindow intuition.library/AddClass intuition.library/AddGadget intuition.library/AddGList intuition.library/AllocRemember intuition.library/AutoRequest intuition.library/BeginRefresh intuition.library/BuildEasyRequestArgs intuition.library/BuildSysRequest intuition.library/ChangeWindowBox intuition.library/ClearDMRequest intuition.library/ClearMenuStrip intuition.library/ClearPointer intuition.library/CloseScreen intuition.library/CloseWindow intuition.library/CloseWorkBench intuition.library/CurrentTime intuition.library/DisplayAlert intuition.library/DisplayBeep intuition.library/DisposeObject intuition.library/DoubleClick intuition.library/DrawBorder intuition.library/DrawImage intuition.library/DrawImageState intuition.library/EasyRequestArgs intuition.library/EndRefresh intuition.library/EndRequest intuition.library/EraseImage intuition.library/FreeClass intuition.library/FreeRemember intuition.library/FreeScreenDrawInfo intuition.library/FreeSysRequest intuition.library/GadgetMouse intuition.library/GetAttr intuition.library/GetDefaultPubScreen intuition.library/GetDefPrefs intuition.library/GetPrefs intuition.library/GetScreenData intuition.library/GetScreenDrawInfo intuition.library/InitRequester intuition.library/IntuiTextLength intuition.library/ItemAddress intuition.library/LockIBase intuition.library/LockPubScreen intuition.library/LockPubScreenList intuition.library/MakeClass intuition.library/MakeScreen intuition.library/ModifyIDCMP intuition.library/ModifyProp intuition.library/MoveScreen intuition.library/MoveWindow intuition.library/MoveWindowInFrontOf intuition.library/NewModifyProp intuition.library/NewObject intuition.library/NextObject intuition.library/NextPubScreen intuition.library/ObtainGIRPort intuition.library/OffGadget intuition.library/OffMenu intuition.library/OnGadget intuition.library/OnMenu intuition.library/OpenScreen intuition.library/OpenScreenTagList intuition.library/OpenWindow intuition.library/OpenWindowTagList intuition.library/OpenWorkBench intuition.library/PointInImage intuition.library/PrintIText intuition.library/PubScreenStatus intuition.library/QueryOverscan intuition.library/RefreshGadgets intuition.library/RefreshGList intuition.library/RefreshWindowFrame intuition.library/ReleaseGIRPort intuition.library/RemakeDisplay intuition.library/RemoveClass intuition.library/RemoveGadget intuition.library/RemoveGList intuition.library/ReportMouse intuition.library/Request intuition.library/ResetMenuStrip intuition.library/RethinkDisplay intuition.library/ScreenToBack intuition.library/ScreenToFront intuition.library/SetAttrsA intuition.library/SetDefaultPubScreen intuition.library/SetDMRequest intuition.library/SetEditHook intuition.library/SetGadgetAttrsA intuition.library/SetMenuStrip intuition.library/SetMouseQueue intuition.library/SetPointer intuition.library/SetPrefs intuition.library/SetPubScreenModes intuition.library/SetWindowTitles intuition.library/ShowTitle intuition.library/SizeWindow intuition.library/SysReqHandler intuition.library/UnlockIBase intuition.library/UnlockPubScreen intuition.library/UnlockPubScreenList intuition.library/ViewAddress intuition.library/ViewPortAddress intuition.library/WBenchToBack intuition.library/WBenchToFront intuition.library/WindowLimits intuition.library/WindowToBack intuition.library/WindowToFront intuition.library/ZipWindow intuition.library/ActivateGadget intuition.library/ActivateGadget NAME ActivateGadget -- Activate a (string or custom) gadget. SYNOPSIS Success = ActivateGadget( Gadget, Window, Request ) D0 A0 A1 A2 BOOL ActivateGadget( struct Gadget *, struct Window *, struct Requester * ); FUNCTION Activates a string or custom gadget. If successful, this means that the user does not need to click in the gadget before typing. The window parameter must point to the window which contains the gadget. If the gadget is actually in a requester, the window must contain the requester, and a pointer to the requester must also be passed. The requester parameter must only be valid if the gadget has the GTYP_REQGADGET flag set, a requirement for all requester gadgets. The success of this function depends on a rather complex set of conditions. The intent is that the user is never interrupted from what interactions he may have underway. The current set of conditions includes: - The window must be active. If you are opening a new window and want an active gadget in it, it is not sufficient to assume that the WFLG_ACTIVATE flag has taken effect by the time OpenWindow() returns, even if you insert a delay of some finite amount of time. Use the IDCMP_ACTIVEWINDOW IntuiMessage to tell when your window really becomes active. Many programs use an event loop that calls ActivateGadget() whenever they receive the IDCMP_ACTIVEWINDOW message, and also the IDCMP_MOUSEBUTTONS messages, and so on, to keep the gadget active until it is used (or the user selects some other "Cancel" gadget). - No other gadgets may be in use. This includes system gadgets, such as those for window sizing, dragging, etc. - If the gadget is in a requester, that requester must be active. (Use IDCMP_REQSET and IDCMP_REQCLEAR). - The right mouse button cannot be held down (e.g. menus) NOTE: Don't try to activate a gadget which is disabled or not attached to a window or requester. INPUTS Gadget = pointer to the gadget that you want activated. Window = pointer to a window structure containing the gadget. Requester = pointer to a requester (may by NULL if this isn't a requester gadget (i.e. GTYP_REQGADGET is not set)). RESULT If the conditions above are met, and the gadget is in fact a string gadget, then this function will return TRUE, else FALSE. BUGS At present, this function will not return FALSE if a custom gadget declines to be activated. SEE ALSO intuition.library/ActivateWindow intuition.library/ActivateWindow NAME ActivateWindow -- Activate an Intuition window. SYNOPSIS [success =] ActivateWindow( Window ) [D0] A0 [LONG] ActivateWindow( struct Window * ); /* returns LONG in V36 and higher */ FUNCTION Activates an Intuition window. Note that this call may have its action deferred: you cannot assume that when this call is made the selected window has become active. This action will be postponed while the user plays with gadgets and menus, or sizes and drags windows. You may detect when the window actually has become active by the IDCMP_ACTIVEWINDOW IDCMP message. This call is intended to provide flexibility but not to confuse the user. Please call this function synchronously with some action by the user. INPUTS Window = a pointer to a Window structure RESULT V35 and before: None. V36 and later: returns zero if no problem queuing up the request for deferred action BUGS Calling this function in a tight loop can blow out Intuition's deferred action queue. SEE ALSO OpenWindow(), and the WFLG_ACTIVATE window flag intuition.library/AddClass intuition.library/AddClass NAME AddClass -- Make a public class available (V36) SYNOPSIS AddClass( Class ) A0 VOID AddClass( struct IClass * ); FUNCTION Adds a public boopsi class to the internal list of classes available for public consumption. You must call this function after you call MakeClass(). INPUTS Class = pointer returned by MakeClass() RESULT Nothing returned. NOTES BUGS Although there is some protection against creating classes with the same name as an existing class, this function does not do any checking or other dealings with like-named classes. Until this is rectified, only officially registered names can be used for public classes, and there is no "class replacement" policy in effect. SEE ALSO MakeClass(), FreeClass(), RemoveClass() Document "Basic Object-Oriented Programming System for Intuition" and the "boopsi Class Reference" document. intuition.library/AddGadget intuition.library/AddGadget NAME AddGadget -- Add a gadget to the gadget list of a window. SYNOPSIS RealPosition = AddGadget( Window, Gadget, Position ) D0 A0 A1 D0 UWORD AddGadget( struct Window *, struct Gadget *, UWORD ); FUNCTION Adds the specified gadget to the gadget list of the given window, linked in at the position in the list specified by the position argument (that is, if Position == 0, the gadget will be inserted at the head of the list, and if Position == 1 then the gadget will be inserted after the first gadget and before the second). If the position you specify is greater than the number of gadgets in the list, your gadget will be added to the end of the list. Calling AddGadget() does not cause your gadget to be redisplayed. The benefit of this is that you may add several gadgets without having the gadget list redrawn every time. This procedure returns the position at which your gadget was added. NOTE: A relatively safe way to add the gadget to the end of the list is to specify a position of -1 (i.e., (UWORD) ~0). That way, only the 65536th (and multiples of it) will be inserted at the wrong position. The return value of the procedure will tell you where it was actually inserted. NOTE: The system window gadgets are initially added to the front of the gadget list. The reason for this is: If you position your own gadgets in some way that interferes with the graphical representation of the system gadgets, the system's ones will be "hit" first by user. If you then start adding gadgets to the front of the list, you will disturb this plan, so beware. On the other hand, if you don't violate the design rule of never overlapping your gadgets, there's no problem. NOTE: You may not add your own gadgets to a screen. Gadgets may be added to backdrop windows, however, which can be visually similar, but also provide an IDCMP channel for gadget input messages. INPUTS Window = pointer to the window to get your gadget Gadget = pointer to the new gadget Position = integer position in the list for the new gadget (starting from zero as the first position in the list) RESULT Returns the position of where the gadget was actually added. BUGS SEE ALSO AddGList(), RemoveGadget(), RemoveGList() intuition.library/AddGList intuition.library/AddGList NAME AddGList -- Add a linked list of gadgets to a window or requester. SYNOPSIS RealPosition = AddGList( Window, Gadget, Position, Numgad, Requester ) D0 A0 A1 D0 D1 A2 UWORD AddGList( struct Window *, struct Gadget *, UWORD, WORD, struct Requester * ); FUNCTION Adds the list of gadgets to the gadget list of the given window or requester linked in at the position in the list specified by the position argument. See AddGadget() for more information about gadget list position, and more information about gadgets in general. The requester parameter will be ignored unless the GTYP_REQGADGET bit is set in the GadgetType field of the first gadget in the list. In that case, the gadget list is added to the requester gadgets. NOTE: be sure that GTYP_REQGADGET is either set or cleared consistently for all gadgets in the list. NOTE ALSO: The window parameter should point to the window that the requester (will) appear in. Will add 'Numgad' gadgets from gadget list linked by the field NextGadget, or until some NextGadget field is found to be NULL. Does not assume that the Numgad'th gadget has NextGadget equal to NULL. NOTE WELL: In order to link your gadget list in, the NextGadget field of the Numgad'th (or last) gadget will be modified. Thus, if you are adding the first 3 gadgets from a linked list of five gadgets, this call will sever the connection between your third and fourth gadgets. INPUTS Window = pointer to the window to get your gadget Gadget = pointer to the first gadget to be added Position = integer position in the list for the new gadget (starting from zero as the first position in the list) Numgad = the number of gadgets from the linked list to be added if Numgad equals -1, the entire null-terminated list of gadgets will be added. Requester = the requester the gadgets will be added to if the GTYP_REQGADGET GadgetType flag is set for the first gadget in the list RESULT Returns the position of where the first gadget in the list was actually added. BUGS SEE ALSO AddGadget(), RemoveGadget(), RemoveGList() intuition.library/AllocRemember intuition.library/AllocRemember NAME AllocRemember -- AllocMem() with tracking to make freeing easy. SYNOPSIS MemBlock = AllocRemember( RememberKey, Size, Flags ) D0 A0 D0 D1 APTR AllocRemember( struct Remember **, ULONG, ULONG ); FUNCTION This routine calls the Exec AllocMem() function for you, but also links the parameters of the allocation into a master list, so that you can simply call the Intuition routine FreeRemember() at a later time to deallocate all allocated memory without being required to remember the details of the memory you've allocated. This routine will have two primary uses: - Let's say that you're doing a long series of allocations in a procedure. If any one of the allocations fails, your program may need to abort the procedure. Abandoning ship correctly involves freeing up what memory you've already allocated. This procedure allows you to free up that memory easily, without being required to keep track of how many allocations you've already done, what the sizes of the allocations were, or where the memory was allocated. - Also, in the more general case, you may do all of the allocations in your entire program using this routine. Then, when your program is exiting, you can free it all up at once with a simple call to FreeRemember(). You create the "anchor" for the allocation master list by creating a variable that's a pointer to struct Remember, and initializing that pointer to NULL. This is called the RememberKey. Whenever you call AllocRemember(), the routine actually does two memory allocations, one for the memory you want and the other for a copy of a Remember structure. The Remember structure is filled in with data describing your memory allocation, and it's linked into the master list pointed to by your RememberKey. Then, to free up any memory that's been allocated, all you have to do is call FreeRemember() with your RememberKey. Please read the FreeRemember() function description, too. As you will see, you can select either to free just the link nodes and keep all the allocated memory for yourself, or to free both the nodes and your memory buffers. INPUTS RememberKey = the address of a pointer to struct Remember. Before the very first call to AllocRemember, initialize this pointer to NULL. Size = the size in bytes of the memory allocation. Please refer to the exec.library/AllocMem() function for details. Flags = the specifications for the memory allocation. Please refer to the exec.library/AllocMem() function for details. EXAMPLE struct Remember *RememberKey; RememberKey = NULL; buffer = AllocRemember(&RememberKey, BUFSIZE, MEMF_CHIP); if (buffer) { /* Use the buffer */ ... } FreeRemember(&RememberKey, TRUE); RESULT If the memory allocation is successful, this routine returns the byte address of your requested memory block. Also, the node to your block will be linked into the list pointed to by your RememberKey variable. If the allocation fails, this routine returns NULL and the list pointed to by RememberKey, if any, will be unchanged. BUGS This function makes two allocations for each memory buffer you request. This is neither fast nor good for memory fragmentation. This function should use the exec AllocPool() function internally, at least for the Remember headers. SEE ALSO FreeRemember(), exec.library/AllocMem() intuition.library/AutoRequest intuition.library/AutoRequest NAME AutoRequest -- Automatically build and get response from a requester. SYNOPSIS Response = AutoRequest( Window, BodyText, PosText, NegText, D0 A0 A1 A2 A3 PosFlags, NegFlags, Width, Height ) D0 D1 D2 D3 BOOL AutoRequest( struct Window *, struct IntuiText *, struct IntuiText *, struct IntuiText *, ULONG, ULONG, WORD, WORD ); FUNCTION This procedure automatically builds a requester for you and then waits for a response from the user, or for the system to satisfy your request. If the response is positive, this procedure returns TRUE. If the response is negative, this procedure returns FALSE. An IDCMPFlag specification is created by bitwise "or'ing" your PosFlags, NegFlags, and the IDCMP classes IDCMP_GADGETUP and IDCMP_RAWKEY. You may specify zero flags for either the PosFlags or NegFlags arguments. The IntuiText arguments, and the width and height values, are passed directly to the BuildSysRequest() procedure along with your window pointer and the IDCMP flags. Please refer to BuildSysRequest() for a description of the IntuiText that you are expected to supply when calling this routine. It's an important but long-winded description that need not be duplicated here. If the BuildSysRequest() procedure does not return a pointer to a window, it will return TRUE or FALSE (not valid structure pointers) instead, and these BOOL values will be returned to you immediately. On the other hand, if a valid window pointer is returned, that window will have had its IDCMP ports and flags initialized according to your specifications. AutoRequest() then waits for IDCMP messages on the UserPort, which satisfies one of four requirements: - either the message is of a class that matches one of your PosFlags arguments (if you've supplied any), in which case this routine returns TRUE. Or - the message class matches one of your NegFlags arguments (if you've supplied any), in which case this routine returns FALSE. Or - the IDCMP message is of class IDCMP_GADGETUP, which means that one of the two gadgets, as provided with the PosText and NegText arguments, was selected by the user. If the TRUE gadget was selected, TRUE is returned. If the FALSE gadget was selected, FALSE is returned. - Lastly, two IDCMP_RAWKEY messages may satisfy the request: those for the V and B keys with the left Amiga key depressed. These keys, satisfy the gadgets on the left or right side of the requester--TRUE or FALSE--, respectively. NOTE: For V36, these two keys left-Amiga-B and V are processed through the default keymap. When the dust has settled, this routine calls FreeSysRequest() if necessary to clean up the requester and any other allocated memory. NOTE: For V36, this function now switches the processor stack to ensure sufficient stack space for the function to succeed. INPUTS Window = pointer to a Window structure. See BuildSysRequest() for a full discussion. BodyText = pointer to an IntuiText structure PosText = pointer to an IntuiText structure, may by NULL. NegText = pointer to an IntuiText structure, MUST be valid! PosFlags = flags for the IDCMP NegFlags = flags for the IDCMP Width, Height = the sizes to be used for the rendering of the requester NOTE for V36: The width and height parameters are ignored, as are several other specifications in the IntuiText, to make AutoRequest() requesters retroactively conform to the new look designed for EasyRequest(). RESULT The return value is either TRUE or FALSE. See the text above for a complete description of the chain of events that might lead to either of these values being returned. NOTES When DOS brings up AutoRequests() on your process (eg. "Please insert volume XXX in any drive", they normally come up on the Workbench screen. If you set your Process pr_WindowPtr field to point to one of your windows, then DOS will bring its requesters up on the same screen as that window. A pr_WindowPtr of -1 prevents requesters from coming up at all. (Some FileSystem requesters cannot be redirected or supressed). BUGS The requester no longer devolves into a call to DisplayAlert() if there is not enough memory for the requester. SEE ALSO EasyRequest(), BuildSysRequest(), SysReqHandler() intuition.library/BeginRefresh intuition.library/BeginRefresh NAME BeginRefresh -- Sets up a window for optimized refreshing. SYNOPSIS BeginRefresh( Window ) A0 VOID BeginRefresh( struct Window * ); FUNCTION This routine sets up your window for optimized refreshing. Its role is to provide Intuition integrated access to the Layers library function BeginUpdate(). Its additional contribution is to be sure that locking protocols for layers are followed, by locking both layers of a WFLG_GIMMEZEROZERO window only after the parent Layer_Info has been locked. Also, the WFLG_WINDOWREFRESH flag is set in your window, for your information. The purpose of BeginUpdate(), and hence BeginRefresh(), is to restrict rendering in a window (layer) to the region that needs refreshing after an operation such as window sizing or uncovering. This restriction to the "damage region" persists until you call EndRefresh(). For instance, if you have a WFLG_SIMPLE_REFRESH window which is partially concealed and the user brings it to the front, you can receive an IDCMP_REFRESHWINDOW message asking you to refresh your display. If you call BeginRefresh() before doing any of the rendering, then the layer that underlies your window will be arranged so that the only rendering that will actually take place will be that which goes to the newly-revealed areas. This is very performance- efficient, and visually attractive. After you have performed your refresh of the display, you should call EndRefresh() to reset the state of the layer and the window. Then you may proceed with rendering to the entire window as usual. You learn that your window needs refreshing by receiving either a message of class IDCMP_REFRESHWINDOW through the IDCMP, or an input event of class IECLASS_REFRESHWINDOW through the Console device. Whenever you are told that your window needs refreshing, you should call BeginRefresh() and EndRefresh() to clear the refresh-needed state, even if you don't plan on doing any rendering. You may relieve yourself of even this burden by setting the WFLG_NOCAREREFRESH flag when opening your window. WARNING: You should only perform graphics refreshing operations during the period between calling BeginRefresh() and EndRefresh(). In particular, do not call RefreshGadgets() or RefreshGList(), since the locking protocol internal to Intuition runs the risk of creating a deadlock. Note that Intuition refreshes the gadgets (through the damage region) before it sends the IDCMP_REFRESHWINDOW message. ANOTHER WARNING: The concept of multiple refresh passes using EndRefresh( w, FALSE ) is not completely sound without further protection. The reason is that between two sessions, more damage can occur to your window. Your final EndRefresh( w, TRUE ) will dispose of all damage, including the new, and your initial refreshing pass will never get the chance to refresh the new damage. To avoid this, you must protect your session using LockLayerInfo() which will prevent Intuition from performing window operations or anything else which might cause further damage from occurring. Again, while holding the LayerInfo lock make no Intuition function calls dealing with gadgets; just render. You can, however, call InstallClipRegion() for the different refresh passes, if you have two clip regions. SIMILAR WARNING: Your program and Intuition "share" your window layer's DamageList. BeginRefresh() helps arbitrate this sharing, but the lower-level function layers.library/BeginUpdate() does not. It isn't really supported to use BeginUpdate() on a window's layer, but if you do--for whatever reason--it is critical that you first acquire the LayerInfo lock as in the above example: even if you only have one pass of refresh rendering to do. Otherwise, the refreshing of your window's borders and gadgets can be incomplete, and the problem might occur only under certain conditions of task priority and system load. EXAMPLE Code fragment for "two pass" window refreshing, in response to an IDCMP_REFRESHWINDOW message: switch ( imsg->Class ) { ... case IDCMP_REFRESHWINDOW: window = imsg->IDCMPWindow; /* this lock only needed for "two-pass" refreshing */ LockLayerInfo( &window->WScreen->LayerInfo ); /* refresh pass for region 1 */ origclip = InstallClipRegion( window->WLayer, region1 ); BeginRefresh( window ); myRefreshRegion1( window ); EndRefresh( window, FALSE ); /* refresh pass for region 2 */ InstallClipRegion( window->WLayer, region2 ); BeginRefresh( window ); myRefreshRegion2( window ); EndRefresh( window, TRUE ); /* and dispose damage list */ /* restore and unlock */ InstallClipRegion( window->WLayer, origclip ); UnlockLayerInfo( &window->WScreen->LayerInfo ); break; ... } INPUTS Window = pointer to the window structure which needs refreshing RESULT None BUGS This function should check the return code of layers.library/BeginUpdate(), and abort if that function fails. SEE ALSO EndRefresh(), layers.library/BeginUpdate(), OpenWindow() layer.library/InstallClipRegion(), graphics.library/LockLayerInfo() The "Windows" chapter of the Intuition Reference Manual intuition.library/BuildEasyRequestArgs intuition.library/BuildEasyRequestArgs NAME BuildEasyRequestArgs -- Simple creation of system request. (V36) BuildEasyRequest -- Varargs stub for BuildEasyRequestArgs(). (V36) SYNOPSIS ReqWindow = BuildEasyRequestArgs( RefWindow, easyStruct, IDCMP, Args ) D0 A0 A1 D0 A3 struct Window *BuildEasyRequestArgs( struct Window *, struct EasyStruct *, ULONG, APTR ); ReqWindow = BuildEasyRequest( RefWindow, easyStruct, IDCMP, Arg1, ... ) struct Window *BuildEasyRequest( struct Window *, struct EasyStruct *, ULONG, APTR, ... ); FUNCTION This function is to EasyRequest() as BuildSysRequest() is to AutoRequest(): it returns a pointer to the system requester window. The input from that window can then be processed under application control. It is recommended that this processing be done with SysReqHandler(), so that future enhancement to the processing will be enjoyed. After you have determined that the requester is satisfied or cancelled, you must free this requester using FreeSysRequest(). Please see the autodoc for EasyRequest(). NOTE: This function switches the processor stack to ensure sufficient stack space for the function to complete. INPUTS Window = reference window for requester: determines the requester window title and screen. easyStruct = pointer to EasyStruct structure, as described in the EasyRequest() autodocs. IDCMP = (NOT A POINTER) provided application specific IDCMP flags for the system requester window. Args = see EasyRequest() RESULT A pointer to the system request window opened. In the event of problems, you may also be returned the value '0' which is to be interpreted as the "FALSE, Cancel" choice, or (if you have a second gadget defined) the value '1', which is to be taken to mean the equivalent of your corresponding left-most gadget. If there is a problem creating the window, a recoverable alert may be substituted for the requester, and the result, either 0 or 1, returned. BUGS Does not put up alternative alert. See also BUGS listed for EasyRequestArgs(). SEE ALSO EasyRequestArgs(), FreeSysRequest(), SysReqHandler(), BuildSysRequest(), AutoRequest() intuition.library/BuildSysRequest intuition.library/BuildSysRequest NAME BuildSysRequest -- Build and display a system requester. SYNOPSIS ReqWindow = BuildSysRequest( Window, BodyText, PosText, NegText, D0 A0 A1 A2 A3 IDCMPFlags, Width, Height ) D0 D1 D2 struct Window *BuildSysRequest( struct Window *, struct IntuiText *, struct IntuiText *, struct IntuiText *, ULONG, WORD, WORD ); FUNCTION This procedure builds a system requester based on the supplied information. If all goes well and the requester is constructed, this procedure returns a pointer to the window in which the requester appears. That window will have its IDCMP initialized to reflect the flags found in the IDCMPFlags argument. You may then wait on those ports to detect the user's response to your requester, which response may include either selecting one of the gadgets or causing some other event to be noticed by Intuition (like IDCMP_DISKINSERTED, for instance). After the requester is satisfied, you should call the FreeSysRequest() procedure to remove the requester and free up any allocated memory. See the autodoc for SysReqHandler() for more information on the how to handle the IntuiMessages this window will receive. The requester used by this function has the NOISYREQ flag bit set, which means that the set of IDCMPFlags that may be used here include IDCMP_RAWKEY, IDCMP_MOUSEBUTTONS, and others. In release previous to V36, if the requester could not be built, this function would try to call DisplayAlert() with the same information, with more or less favorable results. In V36, the requesters themselves require less memory (SIMPLEREQ), but there is no alert attempt. The function may return TRUE (1) or FALSE if it cannot post the requester. (V36 will always return FALSE, but be sure to test for TRUE in case somebody reinstates the fallback alert.) If the window argument you supply is equal to NULL, a new window will be created for you in the Workbench screen, or the default public screen, for V36. If you want the requester created by this routine to be bound to a particular window (i.e., to appear in the same screen as the window), you should not supply a window argument of NULL. New for V36: if you pass a NULL window pointer, the system requester will appear on the default public screen, which is not always the Workbench. The text arguments are used to construct the display. Each is a pointer to an instance of the structure IntuiText. The BodyText argument should be used to describe the nature of the requester. As usual with IntuiText data, you may link several lines of text together, and the text may be placed in various locations in the requester. This IntuiText pointer will be stored in the ReqText variable of the new requester. The PosText argument describes the text that you want associated with the user choice of "Yes, TRUE, Retry, Good." If the requester is successfully opened, this text will be rendered in a gadget in the lower-left of the requester, which gadget will have the GadgetID field set to TRUE. If the requester cannot be opened and the DisplayAlert() mechanism is used, this text will be rendered in the lower-left corner of the alert display with additional text specifying that the left mouse button will select this choice. This pointer can be set to NULL, which specifies that there is no TRUE choice that can be made. The NegText argument describes the text that you want associated with the user choice of "No, FALSE, Cancel, Bad." If the requester is successfully opened, this text will be rendered in a gadget in the lower-right of the requester, which gadget will have the GadgetID field set to FALSE. If the requester cannot be opened and the DisplayAlert() mechanism is used, this text will be rendered in the lower-right corner of the alert display with additional text specifying that the right mouse button will select this choice. This pointer cannot be set to NULL. There must always be a way for the user to cancel this requester. The Positive and Negative Gadgets created by this routine have the following features: - GTYP_BOOLGADGET - GACT_RELVERIFY - GTYP_REQGADGET - GACT_TOGGLESELECT When defining the text for your gadgets, you may find it convenient to use the special constants used by Intuition for the construction of the gadgets. These include defines like AUTODRAWMODE, AUTOLEFTEDGE, AUTOTOPEDGE and AUTOFRONTPEN. You can find these in your local intuition.h (or intuition.i) file. These hard-coded constants are not very resolution or font sensitive, but V36 will override them to provide more modern layout. New for V36, linked lists of IntuiText are not correctly supported for gadget labels. The width and height values describe the size of the requester. All of your BodyText must fit within the width and height of your requester. The gadgets will be created to conform to your sizes. VERY IMPORTANT NOTE: for this release of this procedure, a new window is opened in the same screen as the one containing your window. Future alternatives may be provided as a function distinct from this one. NOTE: This function will pop the screen the requester and its window appears in to the front of all screens. New for V36, if the user doesn't perform any other screen arrangement before finishing with the requester, a popped screen will be pushed back behind. INPUTS Window = pointer to a Window structure BodyText = pointer to an IntuiText structure PosText = pointer to an IntuiText structure NegText = pointer to an IntuiText structure IDCMPFlags = the IDCMP flags you want used for the initialization of the IDCMP of the window containing this requester Width, Height = the size required to render your requester NOTE for V36: the width and height you pass are ignored, as are some of the parameters of your IntuiText, so that Intuition can make the Requesters real nice for the new look. RESULT If the requester was successfully created, the value returned by this procedure is a pointer to the window in which the requester is rendered. If the requester could not be created, this routine might have called DisplayAlert() before returning (it depends on the version) and will pass back TRUE if the user pressed the left mouse button and FALSE if the user pressed the right mouse button. If the version of Intuition doesn't call DisplayAlert(), or if it does, and there's not enough memory for the alert, the value of FALSE is returned. BUGS This procedure currently opens a window in the Screen which contains the window which is passed as a parameter, or the default public screen, if that parameter is NULL. Although not as originally envisioned, this will probably always be the behavior of this function. DisplayAlert() is not called in version V36. It's almost impossible to make complete, correct account of different system fonts, window border dimensions, and screen resolution to get the layout of a System Requester just right using this routine. For V36, we recommend the automatic layout implemented in BuildEasyRequest and EasyRequest. SEE ALSO FreeSysRequest(), DisplayAlert(), ModifyIDCMP(), exec.library/Wait(), Request(), AutoRequest(), EasyRequest(), BuildEasyRequestArgs() intuition.library/ChangeWindowBox intuition.library/ChangeWindowBox NAME ChangeWindowBox -- Change window position and dimensions. (V36) SYNOPSIS ChangeWindowBox( Window, Left, Top, Width, Height ) A0 D0 D1 D2 D3 VOID ChangeWindowBox( struct Window *, WORD, WORD, WORD, WORD ); FUNCTION Makes simultaneous changes in window position and dimensions, in absolute (not relative) coordinates. Like MoveWindow() and SizeWindow(), the effect of this function is deferred until the next input comes along. Unlike these functions, ChangeWindowBox() specifies absolute window position and dimensions, not relative. This makes for more reliable results considering that the action is deferred, so this function is typically preferable to MoveWindow() and SizeWindow() paired. You can detect that this operation has completed by receiving the IDCMP_CHANGEWINDOW IDCMP message The dimensions are limited to legal range, but you should still take care to specify sensible inputs based on the window's dimension limits and the size of its screen. This function limits the position and dimensions to legal values. INPUTS Window = the window to change position/dimension Left, Top, Width, Height = new position and dimensions RESULT Position and dimension are changed to your specification, or as close as possible. Returns nothing. BUGS SEE ALSO MoveWindow(), SizeWindow(), ZipWindow(), layers.library/MoveSizeLayer() intuition.library/ClearDMRequest intuition.library/ClearDMRequest NAME ClearDMRequest -- Clear (detaches) the DMRequest of the window. SYNOPSIS Response = ClearDMRequest( Window ) D0 A0 BOOL ClearDMRequest( struct Window * ); FUNCTION Attempts to clear the DMRequest from the specified window, that is detaches the special requester that you attach to the double-click of the menu button which the user can then bring up on demand. This routine WILL NOT clear the DMRequest if it's active (in use by the user). The IDCMP message class IDCMP_REQCLEAR can be used to detect that the requester is not in use, but that message is sent only when the last of perhaps several requesters in use in a window is terminated. INPUTS Window = pointer to the window from which the DMRequest is to be cleared. RESULT If the DMRequest was not currently in use, detaches the DMRequest from the window and returns TRUE. If the DMRequest was currently in use, doesn't change anything and returns FALSE. BUGS SEE ALSO SetDMRequest(), Request() intuition.library/ClearMenuStrip intuition.library/ClearMenuStrip NAME ClearMenuStrip -- Clear (detach) the menu strip from the window. SYNOPSIS ClearMenuStrip( Window ) A0 VOID ClearMenuStrip( struct Window * ); FUNCTION Detaches the current menu strip from the window; menu strips are attached to windows using the SetMenuStrip() function (or, for V36, ResetMenuStrip() ). If the menu is in use (for that matter if any menu is in use) this function will block (Wait()) until the user has finished. Call this function before you make any changes to the data in a Menu or MenuItem structure which is part of a menu strip linked into a window. INPUTS Window = pointer to a window structure RESULT None BUGS SEE ALSO SetMenuStrip(), ResetMenuStrip() intuition.library/ClearPointer intuition.library/ClearPointer NAME ClearPointer -- Clear the mouse pointer definition from a window. SYNOPSIS ClearPointer( Window ) A0 VOID ClearPointer( struct Window * ); FUNCTION Clears the window of its own definition of the Intuition mouse pointer. After calling ClearPointer(), every time this window is the active one the default Intuition pointer will be the pointer displayed to the user. If your window is the active one when this routine is called, the change will take place immediately. Custom definitions of the mouse pointer which this function clears are installed by a call to SetPointer(). INPUTS Window = pointer to the window to be cleared of its pointer definition RESULT None BUGS SEE ALSO SetPointer() intuition.library/CloseScreen intuition.library/CloseScreen NAME CloseScreen -- Close an Intuition screen. SYNOPSIS [Success =] CloseScreen( Screen ) [D0] A0 [BOOL] CloseScreen( struct Screen * ); /* returns BOOL in V36 and greater */ FUNCTION Unlinks the screen, unlinks the viewport, deallocates everything that Intuition allocated when the screen was opened (using OpenScreen()). Doesn't care whether or not there are still any windows attached to the screen. Doesn't try to close any attached windows; in fact, ignores them altogether (but see below for changes in V36). If this is the last screen to go, attempts to reopen Workbench. New for V36: this function will refuse to close the screen if there are windows open on the screen when CloseScreen() is called. This avoids the almost certain crash when a screen is closed out from under a window. INPUTS Screen = pointer to the screen to be closed. RESULT New for V36: returns TRUE (1) if screen is closed, returns FALSE (0) if screen had open windows when called. BUGS SEE ALSO OpenScreen() intuition.library/CloseWindow intuition.library/CloseWindow NAME CloseWindow -- Close an Intuition window. SYNOPSIS CloseWindow( Window ) A0 VOID CloseWindow( struct Window * ); FUNCTION Closes an Intuition window. Unlinks it from the system, deallocates its memory, and makes it disappear. When this function is called, all IDCMP messages which have been sent to your window are deallocated. If the window had shared a message Port with other windows, you must be sure that there are no unreplied messages for this window in the message queue. Otherwise, your program will try to make use of a linked list (the queue) which contains free memory (the old messages). This will give you big problems. See the code fragment CloseWindowSafely(), below. NOTE: If you have added a Menu strip to this Window (via a call to SetMenuStrip()) you must be sure to remove that Menu strip (via a call to ClearMenuStrip()) before closing your Window. NOTE: This function may block until it is safe to de-link and free your window. Your program may thus be suspended while the user plays with gadgets, menus, or window sizes and position. New for V36: If your window is a "Visitor Window" (see OpenWindow) CloseWindow will decrement the "visitor count" in the public screen on which the window was open. When the last visitor window is closed, a signal will be sent to the public screen task, if this was pre-arranged (see OpenScreen). INPUTS Window = a pointer to a Window structure RESULT None BUGS SEE ALSO OpenWindow(), OpenScreen(), CloseScreen() EXAMPLE /* CloseWindowSafely */ /* these functions close an Intuition window * that shares a port with other Intuition * windows or IPC customers. * * We are careful to set the UserPort to * null before closing, and to free * any messages that it might have been * sent. */ #include "exec/types.h" #include "exec/nodes.h" #include "exec/lists.h" #include "exec/ports.h" #include "intuition/intuition.h" CloseWindowSafely( win ) struct Window *win; { /* we forbid here to keep out of race conditions with Intuition */ Forbid(); /* send back any messages for this window * that have not yet been processed */ StripIntuiMessages( win->UserPort, win ); /* clear UserPort so Intuition will not free it */ win->UserPort = NULL; /* tell Intuition to stop sending more messages */ ModifyIDCMP( win, 0L ); /* turn multitasking back on */ Permit(); /* and really close the window */ CloseWindow( win ); } /* remove and reply all IntuiMessages on a port that * have been sent to a particular window * (note that we don't rely on the ln_Succ pointer * of a message after we have replied it) */ StripIntuiMessages( mp, win ) struct MsgPort *mp; struct Window *win; { struct IntuiMessage *msg; struct Node *succ; msg = (struct IntuiMessage *) mp->mp_MsgList.lh_Head; while( succ = msg->ExecMessage.mn_Node.ln_Succ ) { if( msg->IDCMPWindow == win ) { /* Intuition is about to free this message. * Make sure that we have politely sent it back. */ Remove( msg ); ReplyMsg( msg ); } msg = (struct IntuiMessage *) succ; } } intuition.library/CloseWorkBench intuition.library/CloseWorkBench NAME CloseWorkBench -- Closes the Workbench screen. SYNOPSIS Success = CloseWorkBench() D0 LONG CloseWorkBench( VOID ); FUNCTION This routine attempts to close the Workbench screen: - Test whether or not any applications have opened windows on the Workbench, and return FALSE if so. Otherwise ... - Clean up all special buffers - Close the Workbench screen - Make the Workbench program mostly inactive (it will still monitor disk activity) - Return TRUE INPUTS None RESULT TRUE if the Workbench screen closed successfully FALSE if the Workbench was not open, or if it has windows open which are not Workbench drawers. NOTES This routine has been drastically rewritten for V36. It is much more solid, although we haven't eliminated all the problem cases yet. BUGS The name of this function is improperly spelled. It ought to have been CloseWorkbench(). It might be more convenient to have it return TRUE if the Workbench wasn't opened when called. The idea as it is now is probably this: if you want to free up the memory of the Workbench screen when your program begins, you can call CloseWorkBench(). The return value of that call indicates whether you should call OpenWorkBench() when your program exits: if FALSE, that means either the the Workbench existed but you could not close it, or that it wasn't around to begin with, and you should not try to re-open it. We would prefer that you provide a user selection to attempt to open or close the Workbench screen from within your application, rather than your making assumptions like these. SEE ALSO OpenWorkBench() intuition.library/CurrentTime intuition.library/CurrentTime NAME CurrentTime -- Get the current time values. SYNOPSIS CurrentTime( Seconds, Micros ) A0 A1 VOID CurrentTime( ULONG *, ULONG * ); FUNCTION Puts copies of the current time into the supplied argument pointers. This time value is not extremely accurate, nor is it of a very fine resolution. This time will be updated no more than sixty times a a second, and will typically be updated far fewer times a second. INPUTS Seconds = pointer to a LONG variable to receive the current seconds value Micros = pointer to a LONG variable for the current microseconds value RESULT Puts the time values into the memory locations specified by the arguments Return value is not defined. BUGS SEE ALSO timer.device/TR_GETSYSTIME intuition.library/DisplayAlert intuition.library/DisplayAlert NAME DisplayAlert -- Create the display of an alert message. SYNOPSIS Response = DisplayAlert( AlertNumber, String, Height ) D0 D0 A0 D1 BOOL DisplayAlert( ULONG, UBYTE *, WORD ); FUNCTION Creates an alert display with the specified message. If the system can recover from this alert, it's a RECOVERY_ALERT and this routine waits until the user presses one of the mouse buttons, after which the display is restored to its original state and a BOOL value is returned by this routine to specify whether or not the user pressed the LEFT mouse button. If the system cannot recover from this alert, it's a DEADEND_ALERT and this routine returns immediately upon creating the alert display. The return value is FALSE. NOTE: Starting with V33, if Intuition can't get enough memory for a RECOVERY_ALERT, the value FALSE will be returned. AlertNumber is a LONG value, historically related to the value sent to the Alert() routine. But the only bits that are pertinent to this routine are the ALERT_TYPE bit(s). These bits must be set to either RECOVERY_ALERT for alerts from which the system may safely recover, or DEADEND_ALERT for those fatal alerts. These states are described in the paragraph above. There is a third type of alert, the DAISY_ALERT, which is used only by the Exec. The string argument points to an AlertMessage string. The AlertMessage string is comprised of one or more substrings, each of which is composed of the following components: - first, a 16-bit x-coordinate and an 8-bit y-coordinate, describing where on the alert display you want this string to appear. The y-coordinate describes the offset to the baseline of the text. - then, the bytes of the string itself, which must be null-terminated (end with a byte of zero) - lastly, the continuation byte, which specifies whether or not there's another substring following this one. If the continuation byte is non-zero, there IS another substring to be processed in this alert message. If the continuation byte is zero, this is the last substring in the message. The last argument, Height, describes how many video lines tall you want the alert display to be. New for V36: Alerts are always rendered in Topaz 8 (80 column font), regardless of the system default font. Also, RECOVERY_ALERTs are displayed in amber, while DEADEND_ALERTs are still red. Alerts no longer push down the application screens to be displayed. Rather, they appear alone in a black display. Also new for V36: Alerts block each other out, and input during an alert is deprived of the rest of the system. Internal input buffers still cause alert clicks to be processed by applications sometimes. INPUTS AlertNumber = the number of this alert message. The only pertinent bits of this number are the ALERT_TYPE bit(s). The rest of the number is ignored by this routine. String = pointer to the alert message string, as described above Height = minimum display lines required for your message RESULT A BOOL value of TRUE or FALSE. If this is a DEADEND_ALERT, FALSE is always the return value. If this is a RECOVERY_ALERT. The return value will be TRUE if the user presses the left mouse button in response to your message, and FALSE if the user presses the right hand button is response to your text, or if the alert could not be posted. BUGS If the system is worse off than you think, the level of your alert may become DEADEND_ALERT without you ever knowing about it. This will NOT happen due simply to low memory. Rather, the alert display will be skipped, and FALSE will be returned. The left and right button clicks satisfying the alerts are unfortunately passed to the normal applications, because of some internal system input buffering. SEE ALSO intuition.library/DisplayBeep intuition.library/DisplayBeep NAME DisplayBeep -- Flash the video display. SYNOPSIS DisplayBeep( Screen ) A0 VOID DisplayBeep( struct Screen * ); FUNCTION "Beeps" the video display by flashing the background color of the specified screen. If the screen argument is NULL, every screen in the display will be beeped. Flashing everyone's screen is not a polite thing to do, so this should be reserved for dire circumstances. The reason such a routine is supported is because the Amiga has no internal bell or speaker. When the user needs to know of an event that is not serious enough to require the use of a requester, the DisplayBeep() function may be called. New for V36: Intuition now calls DisplayBeep through the external library vector. This means that if you call SetFunction() to replace DisplayBeep with an audible beep, for example, then your change will affect even Intuition's calls to DisplayBeep. INPUTS Screen = pointer to a screen. If NULL, every screen in the display will be flashed RESULT None BUGS SEE ALSO intuition.library/DisposeObject intuition.library/DisposeObject NAME DisposeObject -- Deletes a 'boopsi' object. (V36) SYNOPSIS DisposeObject( Object ) A0 VOID DisposeObject( APTR ); FUNCTION Deletes a boopsi object and all of it auxiliary data. These objects are all created by NewObject(). Objects of certain classes "own" other objects, which will also be deleted when the object is passed to DisposeObject(). Read the per-class documentation carefully to be aware of these instances. INPUTS Object = abstract pointer to a boopsi object returned by NewObject() NOTES This function invokes the OM_DISPOSE method. RESULT None. BUGS SEE ALSO NewObject(), SetAttrs(), GetAttr(), MakeClass(), Document "Basic Object-Oriented Programming System for Intuition" and the "boopsi Class Reference" document. intuition.library/DoubleClick intuition.library/DoubleClick NAME DoubleClick -- Test two time values for double-click timing. SYNOPSIS IsDouble = DoubleClick( StartSecs, StartMicros, D0 D0 D1 CurrentSecs, CurrentMicros ) D2 D3 BOOL DoubleClick( ULONG, ULONG, ULONG, ULONG ); FUNCTION Compares the difference in the time values with the double-click timeout range that the user has set (using the "Preferences" tool) or some other program has configured into the system. If the difference between the specified time values is within the current double-click time range, this function returns TRUE, else it returns FALSE. These time values can be found in input events and IDCMP messages. The time values are not perfect; however, they are precise enough for nearly all applications. INPUTS StartSeconds, StartMicros = the timestamp value describing the start of the double-click time period you are considering CurrentSeconds, CurrentMicros = the timestamp value describing the end of the double-click time period you are considering RESULT If the difference between the supplied timestamp values is within the double-click time range in the current set of Preferences, this function returns TRUE, else it returns FALSE BUGS SEE ALSO CurrentTime() intuition.library/DrawBorder intuition.library/DrawBorder NAME DrawBorder -- Draw the specified Border structure into a RastPort. SYNOPSIS DrawBorder( RastPort, Border, LeftOffset, TopOffset ) A0 A1 D0 D1 VOID DrawBorder( struct RastPort *, struct Border *, WORD, WORD ); FUNCTION First, sets up the draw mode and pens in the RastPort according to the arguments of the Border structure. Then, draws the vectors of the border argument into the RastPort, offset by the left and top offsets. As with all graphics rendering routines, the border will be clipped to to the boundaries of the RastPort's layer, if it exists. This is the case with window RastPorts. This routine will draw all borders in the NULL-terminated list linked by the NextBorder field of the border argument. INPUTS RastPort = pointer to the RastPort to receive the border rendering Border = pointer to a Border structure LeftOffset = the offset to be added to each vector's x coordinate TopOffset = the offset to be added to each vector's y coordinate RESULT None BUGS SEE ALSO intuition.library/DrawImage intuition.library/DrawI