Defining and Integrating an Inspector Panel
To inspect the properties of a user-defined graphic object, do the following:
1. Define a new inspector panel class for this object class.
2. Integrate this inspector class into Rogue Wave® Views Studio.
Defining an Inspector Panel Class
The new inspector panel class must derive from the
IlvStInspectorPanel class, which is declared in the file
$ILVHOME/studio/ivstudio/inspectors/insppnl.h. You could also derive this class from
IlvStIGraphicInspectorPanel to automatically inherit from the inspection features of properties that are common to
IlvGraphic objects. These properties will be displayed in two notebook pages: General and Callbacks. This class can be found in the file
$ILVHOME/studio/ivstudio/inspectors/gadpnl.h. It defines an inspector panel that edits a subclass of an
IlvGraphic class.
To derive this class, define the following functions:
The constructor calls the parent class constructor providing a display, the title of the panel, a data file name, and the update mode. The last two parameters are optional.
initializeEditors is called to register the accessors and editors in the inspector panel. Do not forget to declare the notebook pages that should appear in the inspector panel at the beginning of the method.
initFrom is called whenever the inspector panel is initialized with a new object. It initializes the panel according to the given object. For example, if you edit the x position of the object in a line editor, you set the label of the line editor to the position of the x object using this function. By default, this method initializes accessors and editors and should not be overridden.
applyChange is called when the user clicks the Apply button to apply changes to the inspected object. By default, this method delegates his role to accessors and editors and should not be overridden.
The following is an example of these function definitions:
class MyClassInspectorPanel
: public IlvStIGraphicInspectorPanel
{
public:
// Constructor
MyClassInspectorPanel(IlvDisplay* display,
const char* title,
const char* filename = 0,
IlvSystemView transientFor = 0,
IlvStIAccessor::UpdateMode mode
= IlvStIAccessor::OnApply):
IlvStIGraphicInspectorPanel(display, title, filename,
transientFor, mode) {}
virtual void initializeEditors();
};
IlvStDefineInspectorPanelBuilderExp(MyClassInspectorPanel,\
MyClassInspectorPanelBuilder,
IL_EMPTYMACRO);
MyClassInspectorPanel::MyClassInspectorPanel(IlvDisplay* display,
const char* title,
const char* filename,
IlvSystemView transientFor,
IlvStIAccessor::UpdateMode mode)
:IlvInspectorPanel(display, title, filename, transientFor, mode)
{}
void
MyClassInspectorPanel::initializeEditors()
{
IlvStIGraphicInspectorPanel::initializeEditors();
// Add notebook pages.
addPage("&Specific", "../data/myclinsp.ilv";
// Add editors.
link("xfield", IlvGraphic::_xValue);
link("yfield", IlvGraphic::_yValue);
}
IlvBoolean
MyStudioExtension::initializeInspectors()
{
IlvStudio* editor = getEditor();
editor->inspector().registerBuilder("MyClass",
new MyClassInspectorPanelBuilder);
return IlTrue;
}
Integrating the Inspector Panel into Rogue Wave Views Studio
To integrate the new inspector into the editor, modify your extension class to define the initializeInspectors as follows:
IlBoolean
MyStudioExtension::initializeInspectors()
{
IlvStudio* editor = getEditor();
editor->inspector().registerBuilder("MyClass",
new MyClassInspectorPanel);
return IlTrue;
}
Version 5.7
Copyright © 2013, Rogue Wave Software, Inc. All Rights Reserved.