Table of Contents

 
AddHotSpot
 

Purpose

Adds a new hot spot to the manager

 

Protoype

void CButtonMngr::AddHotSpot (string str_id, int i_width, int i_height, int i_xpos, int i_ypos, bool b_state, 
                              string str_cursor = "")
 

Parameters

id the unique ID of the new hotspot
width the width of the hotspot
height the height of the hotspot
xpos the X coordinate location on the screen
ypos the Y coordinate loaction on the screen
state the initial state of the hotspot
cursor the ID of the cursor object to change to on mouse-over
 

Description

This function adds a hotspot to the button manager. A hotspot is almost like a button - in fact it uses the same structure as a button, minus a few properties. The only exception is that it is invisible. Hotspots are always created with a preceding "_" character so that they are forced to the top of the manager's render queue, which means that they can sit atop buttons and other objects. If you place a hotspot object directly over a button, the hotspot and the button can both react to the actions of the mouse cursor. You can also layer hotspots on top of hotspots on top of a button and acheive the same effect. All hotspots can be handled until a button or no more button-type objects are detected beneath the mouse cursor. Each hotspot must have a unique ID for later reference in the application. This ID is passed in for str_id.

NOTE: The hotspot stacking feature is not built in. The CApp framework class automates this but CButton does not. See CheckButtons() for more.

Size and Location

Unlike a button, a hotspot has no visible states and therefore no button template. So to define its proportions you just have to assign it a width (i_width) and height (i_height) and a rectangle will be formed covering the area starting from the hotspot's location, which is defined using i_xpos and i_ypos.

HotSpot States

A hotspot can only have two states. If the hotspot is disabled, then any mouse or cursor actions performed over its area are ignored - it's basically the equivalent of hiding a button. If a hotspot is enabled, then it is considered in its up-state and will respond to any mouse or cursor actions performed over its area. b_state is the parameter that sets the initial state of the hotspot. For an enabled hotspot, pass in TRUE, for a disabled hotspot, pass in FALSE.

HotSpot Cursors

Cursors function for hotspots the same way they do for buttons. If you want the mouse cursor to automatically change when it hovers over a hotspot, then you would pass in for str_cursor the ID of the CCursor object you want the cursor to turn into when a mouse-over event occurs for the hotspot. When the cursor moves off the hotspot it will be restored to its previous state. If you don't want a hotspot cursor then use NO_BCONTENT.

NOTE: If a button object is beneath a hotspot, and it too has a cursor assigned to it, then the hotspot cursor will be overridden since the button object is handled after the hotspot. Same goes for a hotspot on top of another hotspot.

 

Use

CButtonMngr button;
button.AddHotSpot("_my_hotspot", 50, 50, 300, 227, 1, 0, 1, NO_BCONTENT); 
 

Prev: AddButton
Next: Assign