Image Buttons


  typedef void (*ControlFunc)  (Control *c);


  Control *new_image_button(Window *w, Rect r, Image *i, ControlFunc fn);
  Control *add_image_button(Control *c, Rect r, Image *i, ControlFunc fn);

  void     set_control_image(Control *c, Image *img);
  Image *  get_control_image(Control *c);


The new_image_button function creates a push-button control, which has the specified image drawn within it. The button will appear on the specified window, in the rectangle given in window co-ordinates. The image is not copied by this function, so the image should not be released from memory or modified while it is being used by the control.

When the user clicks on the button with the mouse, the specified call-back function fn is called. The parameter to this function will be the button which called the function.

If the button is disabled, an algorithm is used to generate a 'greyed out' image based on the original image.

The add_image_button function works in the same way as new_image_button, except that it attaches the button to a control rather than directly to a window.

To change the image used by a button, call set_control_image, and to retrieve a pointer to the image currently being used by the button, use get_control_image.