Defining a New Editing Mode

An editing mode is an Views Studio object that encapsulates an object of type IlvManagerViewInteractor. To add a new editing mode:

  1. Create an object of the class IlvStMode.

  2. Add this object to the Views Studio mode delegate IlvStModes.

  3. Define a command constructor that returns an instance of the IlvStSetMode class.

  4. Register this command constructor.

  5. Declare the command descriptor in a command declaration file.

Once the editing mode has been created, you can associate it with a bitmap and add it to the tool bar to the left of the Main window.

Adding an Object to the Views Studio Mode Delegate

IlvStudio has several “delegates” that are dedicated to handling specific services. IlvStudio has a member of the class IlvStModes to manage the modes. Its reference can be accessed by:

IlvStModes& IlvStudio::modes();

You can use the following function to add your editing mode:

void IlvStModes::add(IlvStMode* mode)

Defining a Command Constructor that Returns an Instance of the IlvStSetMode Class

The command constructor to be defined can be a simple function. The Menu mode, for example, can be coded as follows:

  • Adding the new mode:

editor->modes().add(new IlvStMode(editor,

"Menu",

"SelectMenuMode",

new IlvMakeMBLinkInteractor));

  • Command constructor function:

static IlvStCommand*

MkSelectMenuMode(IlvStudio*)

{

return new IlvStSetMode("Menu");

}