Image Check Boxes

OBJECTS

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

FUNCTIONS

  Control *new_image_check_box(Window *w, Rect r, Image *img,
                             ControlFunc fn);
  Control *add_image_check_box(Control *c, Rect r, Image *img,
                             ControlFunc fn);

  int      is_checked(Control *c);  /* is it checked? */
  void     check(Control *c);       /* check the check box */
  void     uncheck(Control *c);     /* uncheck the check box */

NOTES

The new_image_check_box function creates a check box which displays an image. This is similar to an image button, except that clicking in the button with a mouse will swap its state between unchecked (normal button appearance) and checked (pressed in appearance). If the control is disabled, a greyed version of the image will be displayed instead.

Each time the control changes between a checked and unchecked state, the call-back function fn is called after the event and the image check box is passed to the function as its parameter. This call-back function can be set to NULL, which means no function will be called in response to checking or unchecking the image check box.

The add_image_check_box function works in the same way as new_image_check_box, except that it attaches the image check box to a control rather than directly to a window.

The function is_checked can be used to determine if the image check box is currently checked. The function check can be used to change the state to checked, and uncheck can be used to restore an unchecked state.

To implement mutually exclusive sets of image check boxes (like radio button groups), the call-back function must uncheck the other image check boxes in each set whenever a new image check box becomes checked.