home *** CD-ROM | disk | FTP | other *** search
- FUNCTION makeboolgadget() - create an autosizing boolean gadget
-
- struct Gadget *makeboolgadget(win, l_edge, t_edge, text, id)
- struct Window *win;
- SHORT l_edge, t_edge;
- UBYTE *text;
- USHORT id;
-
- This function will create a boolean gadget in your window. The gadget
- will have your specified text, and id. The size is calculated
- automatically to nicely fit the given text (although there is a minimum
- size of 30 pixels). The return value is a pointer to the created gadget.
- You should keep this pointer so that you can later remove the gadget with a
- call to killgadget().
-
- The gadget returned is dynamically allocated, so take care to call
- killgadget() when you are done with the gadget. Note that you should call
- killgadget() before you call killwindow().
-
- The created gadget will have the id you specify so that you will be
- able to determine from your Intuition messages which gadget was pressed.
- You should take care to make sure that you will receive the GADGETUP
- messages in your window. Windows created with makewindow() do not receive
- these types of messages, however, you can use the Intuition function
- ModifyIDCMP() to change this behavior.
-
- The gadgets created by this call are simple box affairs with the
- highlight mode set to COMPLEMENT. The text is centered and should be
- offset nicely. The gadgets are not crowded or otherwise unsightly, except
- for being rather plain.
-
- To create a boolean gadget with the text "Click Me", you would do the
- following (assuming an already opened window) :
-
- struct Window *win; /* opened beforehand */
- struct Gadget *click_me;
-
- click_me = makeboolgadget(win, 100, 25, "Click Me", 43);
-
- /* do whatever we want (i.e. main loop, etc...) */
-
- /* free up gadget resources (i.e. memory) */
- killgadget(win, click_me);
-
- The previous code will create and cause to be displayed an autosized
- boolean gadget at 100, 25 which contains the text "Click Me", and has a
- gadget ID of 43. makeboolgadget() WILL take care of making sure the
- gadget is displayed, so you need not do anything after the return from the
- function. You should however keep track of the allocated gadgets so that
- you can properly free their allocated memory.
-
- For the curious, this function calls the lower level function
- create_boolgadget() with appropriate values. It then calls AddGList() and
- RefreshGList() to cause the gadget to display.
-
- TODO : Really need to make the gadgets more 3d'ish. They look kinda plain
- now.
-
- BUGS : could be, but none that I've seen (fingers crossed)
-
- SEE ALSO : create_boolgadget(), killgadget(), makewindow(), getyn(),
- getstring()
-
-