home *** CD-ROM | disk | FTP | other *** search
/ ARM Club 3 / TheARMClub_PDCD3.iso / programs / patches / newbar / Source / NewBar / h / gadget < prev    next >
Encoding:
Text File  |  1998-07-22  |  1.9 KB  |  56 lines

  1.  
  2. /* gadget.h */
  3.  
  4. #ifndef iconbar_gadget_H
  5. #define iconbar_gadget_H
  6.  
  7. #include "OS:os.h"
  8. #include "OS:osspriteop.h"
  9. #include "OS:toolbox.h"
  10.  
  11.  
  12. /* An iconbar_gadget is the display part of an iconbar icon.  It deals with
  13.    the creation of an icon in a window, but will not deal with user/app
  14.    interaction with the icon.  It knows nothing about other icons in a
  15.    group. */
  16.  
  17. typedef struct iconbar_gadget iconbar_gadget; /* Contents private. */
  18. typedef struct sprite_details sprite_details;
  19.  
  20. /* This handler can be attached to an iconbar_gadget object.  It is called
  21.    when the icon needs to be resized.  It is called with the existing
  22.    bounding box, which you must modify to the new size.  Return non-zero if
  23.    something goes wrong.  A default handler will expand icon rightwards. */
  24. typedef bool (iconbar_gadget_resize_handler)(iconbar_gadget *gadget,
  25.     os_box *bbox, const os_coord *new_size, void *handle);
  26.  
  27. /* Specifies all the details of an iconbar sprite. */
  28. struct sprite_details {
  29.   union {
  30.     char *name;            /* Name of sprite. */
  31.     osspriteop_id ptr;        /* Or pointer to sprite (area must != 0). */
  32.   } id;
  33.   osspriteop_area *area;    /* 0 for Wimp pool. */
  34.   unsigned is_ptr: 1;        /* Set if sprite is by pointer not name. */
  35. };
  36.  
  37. /* Methods for iconbar_gadget. */
  38.  
  39. iconbar_gadget *iconbar_gadget_create(void);
  40. void iconbar_gadget_destroy(iconbar_gadget *obj);
  41.  
  42. void iconbar_gadget_set_window(iconbar_gadget *obj, toolbox_o w);
  43. toolbox_o iconbar_gadget_get_window(const iconbar_gadget *obj);
  44. void iconbar_gadget_set_bbox(iconbar_gadget *obj, const os_box *b);
  45. void iconbar_gadget_get_bbox(const iconbar_gadget *obj, os_box *b);
  46. void iconbar_gadget_set_resize_handler(iconbar_gadget *obj,
  47.     iconbar_gadget_resize_handler *function, void *handle);
  48.  
  49. void iconbar_gadget_set_text(iconbar_gadget *obj, const char *text);
  50. void iconbar_gadget_set_sprite(iconbar_gadget *obj,
  51.     const sprite_details *sprite);
  52. void iconbar_gadget_set_task_name(iconbar_gadget *obj, const char *name);
  53.  
  54.  
  55. #endif
  56.