HImagePanel

Detailed Description

class HImagePanel : public HBaseOperator

The HImagePanel class displays an image usually representing buttons which a user can highlight with a mouse click and which trigger user defined actions

An image panel object consists of 3 HOOPS images which must be stored in separate HMF files. One of them represents the visual representaton of the unselected panel while the other represents the selected state. The third image defines regions inside the panel (based on the rgb values in the image) which trigger execution of a user supplied callback function.

Public Functions

HImagePanel(HBaseView *view, HC_KEY startkey, int width, int height, float xpos, float ypos, char const *name)

Constructs an HImagePanel object.

Parameters:
  • view – A pointer to the HBaseView object.
  • startkey – Key of segment containing the image panel.
  • width – Width of image panel
  • height – Height of image panel
  • xpos – Initial X Position of image panel
  • ypos – Initial Y Position of image panel
  • name – Name of image panel
virtual ~HImagePanel()
HImageRegion *FindSelectedRegion(float xpos, float ypos)

This method finds the region associated to a specific x/y position in the image

Parameters:
  • xpos – Mouse X Position
  • ypos – Mouse Y Position
Returns:

Image Region

virtual int OnLButtonDownAndMove(HEventInfo &hevent)

Mouse Move Handler

Parameters:hevent – An HEventInfo object containing information about the current event
virtual int OnLButtonDown(HEventInfo &hevent)

Left Button Down Handler

Parameters:hevent – An HEventInfo object containing information about the current event
virtual int OnLButtonUp(HEventInfo &hevent)

Left Button Up Handler

Parameters:hevent – An HEventInfo object containing information about the current event
void AddImageRegion(int identifier, char const *const name)

This method adds a new image region to the panel

Parameters:
  • identifier – Identifier of new image region
  • name – Name of new image region
inline char const *GetPanelName()

This method returns the name of the image panel

Returns:Name of image panel
inline void SetImageAction(int (*image_action)(HImageRegion *ii, void *data, HButtonState button_state), void *data)

This method associates a callback function to the image panel

Parameters:
  • image_action – Function to call for image actions
  • data – generic data passed to image panel callback function
void SetImagesFromFile(char const *normal_image_path, char const *highlighted_image_path, char const *region_image_path)

This method associates a callback function to the image panel

This method sets the 3 images used for display of the image panel and region selection

Parameters:
  • image_action – Function to call for image actions
  • data – generic data passed to image panel callback function
  • normal_image_path – Path to HMF file containing the image which defines the unhighligted “look” of the image panel
  • highlighted_image_path – Path to HMF file containing the image which defines the highlighted “look” of the image panel
  • region_image_path – Path to HMF file containing the image which defines the selectable regions of the image panel
void SetImages(HC_KEY NormalImageKey, HC_KEY HighlightedImageKey, HC_KEY RegionImageKey)
void ZoomIn()
void ZoomOut()
void SetPosition(float x, float y, float z = 0.0f)

Public Static Functions

static bool ButtonTimerClbk(float request_time, float actual_time, void *user_data)

Timer callback used to react to button presses