Table of Contents

 
AddCursor
 

Purpose

Adds a cursor image to the map

 

Protoype

void CCursorMngr::AddCursor (string str_id, string str_image_id, int i_orient, bool b_current = false)
 

Parameters

id the ID to assign the cursor object
image_id the ID of the cursor image object
orient the orientation of the cursor image
current whether or not this is the currently displayed cursor
 

Description

This function adds a new cursor object to the manager. Each cursor object must be assigned a unique ID that will be used to reference the object throughout the application. This ID is passed in for str_id. Each cursor object also has an associated image object - this image is the image of the cursor that will be displayed when this cursor object is active and is passed in for str_image_id.

NOTE: The system cursor does not become hidden until you add a cursor object.

Cursor Orientation

A cursor can be oriented in many ways. In this case, the definition of oirientation is the way the cursor image is oriented around the current mouse coordinates. The most common cursor orientation is top-left, like a normal mouse cursor. Another one is bottom-left, like an eyedropper tool. Another is center, like a crosshair. Top right and bottom right aren't all that common, but supported none the less. To orient the cursor properly pass in one of these predefined values for i_orient - BOTTOM_LEFT, BOTTOM_RIGHT, TOP_LEFT, TOP_RIGHT, CENTER.

Current Cursor

When you create a cursor you have the option of making it the current cursor, which is the cursor that is displayed on the screen. If this is what you want, then you can pass TRUE in for b_current. If not, then pass FALSE instead. You can also invoke setting this cursor as current by passing in the ID of "default". If you create a cursor with an ID of "default" then it will automatically be set as the current cursor.

NOTE: Even though creating a cursor object with ID "default" will make that the current cursor, that doesn't stop objects added after that one to become current if the flag is set.

Default Cursor

The default cursor is a cursor object that can be thought of as the most commonly displayed cursor. The easiest way to do this is to create a cursor object with the ID of "default". In addition to automatically becoming the current cursor, it will become the default cursor as well. If you don't use this method then you must set a default cursor with SetDefaultCursor().

NOTE: You must have a default cursor object.

 
Use
CCursorMngr cursor;
// create default cursor
cursor.AddCursor("default", "cursor_img", TOP_LEFT);
 

Prev: Table of Contents
Next: Assign