home *** CD-ROM | disk | FTP | other *** search
-
- /* gadget.h */
-
- #ifndef iconbar_gadget_H
- #define iconbar_gadget_H
-
- #include "OS:os.h"
- #include "OS:osspriteop.h"
- #include "OS:toolbox.h"
-
-
- /* An iconbar_gadget is the display part of an iconbar icon. It deals with
- the creation of an icon in a window, but will not deal with user/app
- interaction with the icon. It knows nothing about other icons in a
- group. */
-
- typedef struct iconbar_gadget iconbar_gadget; /* Contents private. */
- typedef struct sprite_details sprite_details;
-
- /* This handler can be attached to an iconbar_gadget object. It is called
- when the icon needs to be resized. It is called with the existing
- bounding box, which you must modify to the new size. Return non-zero if
- something goes wrong. A default handler will expand icon rightwards. */
- typedef bool (iconbar_gadget_resize_handler)(iconbar_gadget *gadget,
- os_box *bbox, const os_coord *new_size, void *handle);
-
- /* Specifies all the details of an iconbar sprite. */
- struct sprite_details {
- union {
- char *name; /* Name of sprite. */
- osspriteop_id ptr; /* Or pointer to sprite (area must != 0). */
- } id;
- osspriteop_area *area; /* 0 for Wimp pool. */
- unsigned is_ptr: 1; /* Set if sprite is by pointer not name. */
- };
-
- /* Methods for iconbar_gadget. */
-
- iconbar_gadget *iconbar_gadget_create(void);
- void iconbar_gadget_destroy(iconbar_gadget *obj);
-
- void iconbar_gadget_set_window(iconbar_gadget *obj, toolbox_o w);
- toolbox_o iconbar_gadget_get_window(const iconbar_gadget *obj);
- void iconbar_gadget_set_bbox(iconbar_gadget *obj, const os_box *b);
- void iconbar_gadget_get_bbox(const iconbar_gadget *obj, os_box *b);
- void iconbar_gadget_set_resize_handler(iconbar_gadget *obj,
- iconbar_gadget_resize_handler *function, void *handle);
-
- void iconbar_gadget_set_text(iconbar_gadget *obj, const char *text);
- void iconbar_gadget_set_sprite(iconbar_gadget *obj,
- const sprite_details *sprite);
- void iconbar_gadget_set_task_name(iconbar_gadget *obj, const char *name);
-
-
- #endif
-