Interface to a brush preset context.
A context represents a specific brush-based feature, defining a
set of parameters used by the features and a UI. Context objects
are responsible for creating and deleting the parameter set objects
held by a brush preset, and for providing general information about
the parameters. Contexts are required to communicate with the
manager in the following ways: 1) Contexts should register
themselves with the manager as soon as they loaded into memory,
using IBrushPresetMgr::RegisterContext().
If the context plug-in is loaded before the manager plug-in, then
the context can use a notification handler to register with the
manager after system startup. 2) When a context is active, meaning
its UI is displayed and ready to begin painting, the context should
call IBrushPresetMgr::BeginContext(),
and EndContext() when the context is deactivated. 3) When the user
changes any parameter in the context's UI, the context should call
IBrushPresetMgr::OnContextUpdated().
Implemented by the plug-in.
#include <IBrushPresets.h>
Public Member Functions |
|
virtual | ~IBrushPresetContext () |
Destructor. |
|
virtual Class_ID | ContextID ()=0 |
Returns the unique ID for the context. These
ID numbers should be random, as per standard class IDs. |
|
virtual MCHAR * | GetContextName ()=0 |
Returns a name for the context. This is for
UI display and may be localized. |
|
virtual IBrushPresetParams * | CreateParams ()=0 |
Creates and returns a parameter set object
of appropriate type for this context. |
|
virtual void | DeleteParams (IBrushPresetParams *params)=0 |
Deletes a parameter set object created by
this context. |
|
virtual int | GetNumParams ()=0 |
Returns the number of individual parameters
in a parameter set of this context. |
|
virtual int | GetParamID (int paramIndex)=0 |
Translates the index number of a parameter
value into the corresponding parameter ID. |
|
virtual int | GetParamIndex (int paramID)=0 |
Translates the ID of a parameter value into
the corresponding parameter index number. |
|
virtual MCHAR * | GetParamName (int paramID)=0 |
Returns the name of a parameter value.
|
|
virtual ParamType2 | GetParamType (int paramID)=0 |
Returns the type of a parameter value.
|
|
virtual int | GetNumDisplayParams () |
Returns the number of parameters that should
be displayed in the brush preset manager dialog. |
|
virtual int | GetDisplayParamID (int displayIndex) |
Translates the index number of a display
parameter into the corresponding parameter ID. |
|
virtual int | GetDisplayParamIndex (int paramID) |
Translates the ID of a parameter value into
the corresponding display parameter index number. |
|
virtual MCHAR * | GetDisplayParamName (int paramID) |
Returns the name of a display parameter.
|
|
virtual BOOL | IsDisplayParam (int paramID) |
Returns whether the given parameter should
be displayed in the brush preset manager dialog. |
|
virtual BOOL | IsTransientParam (int paramID) |
Returns whether the given parameter is
transient. |
|
virtual Class_ID | PluginClassID ()=0 |
Returns the class ID of a plug-in
implemented in the same module as this context. |
|
virtual SClass_ID | PluginSuperClassID ()=0 |
Returns the superclass ID of a plug-in
implemented in the same module as this context. |
virtual ~IBrushPresetContext | ( | ) | [inline, virtual] |
Destructor.
{;}
virtual Class_ID ContextID | ( | ) | [pure virtual] |
Returns the unique ID for the context. These ID numbers should be random, as per standard class IDs.
virtual MCHAR* GetContextName | ( | ) | [pure virtual] |
Returns a name for the context. This is for UI display and may be localized.
virtual IBrushPresetParams* CreateParams | ( | ) | [pure virtual] |
Creates and returns a parameter set object of appropriate type for this context.
virtual void DeleteParams | ( | IBrushPresetParams * | params | ) | [pure virtual] |
Deletes a parameter set object created by this context.
This is called by the system when the user deletes a preset or at shutdown; the object passed is always a parameter set created previously by the context.
virtual int GetNumParams | ( | ) | [pure virtual] |
Returns the number of individual parameters in a parameter set of this context.
virtual int GetParamID | ( | int | paramIndex | ) | [pure virtual] |
Translates the index number of a parameter value into the corresponding parameter ID.
[in] | paramIndex | The index of the parameter value |
virtual int GetParamIndex | ( | int | paramID | ) | [pure virtual] |
Translates the ID of a parameter value into the corresponding parameter index number.
[in] | paramID | The ID of the parameter value |
virtual MCHAR* GetParamName | ( | int | paramID | ) | [pure virtual] |
Returns the name of a parameter value.
[in] | paramID | The ID of the parameter value |
virtual ParamType2 GetParamType | ( | int | paramID | ) | [pure virtual] |
Returns the type of a parameter value.
[in] | paramID | The ID of the parameter value |
virtual int GetNumDisplayParams | ( | ) | [inline, virtual] |
Returns the number of parameters that should be displayed in the brush preset manager dialog.
{return GetNumParams();}
virtual int GetDisplayParamID | ( | int | displayIndex | ) | [inline, virtual] |
Translates the index number of a display parameter into the corresponding parameter ID.
[in] | displayIndex | The index of the display parameter |
{return GetParamID(displayIndex);}
virtual int GetDisplayParamIndex | ( | int | paramID | ) | [inline, virtual] |
Translates the ID of a parameter value into the corresponding display parameter index number.
[in] | paramID | The ID of the parameter value |
{return GetParamIndex(paramID);}
virtual MCHAR* GetDisplayParamName | ( | int | paramID | ) | [inline, virtual] |
Returns the name of a display parameter.
[in] | paramID | The ID of the display parameter |
{return GetParamName(paramID);}
virtual BOOL IsDisplayParam | ( | int | paramID | ) | [inline, virtual] |
Returns whether the given parameter should be displayed in the brush preset manager dialog.
[in] | paramID | The ID of the parameter |
{ UNUSED_PARAM(paramID); return TRUE;}
virtual BOOL IsTransientParam | ( | int | paramID | ) | [inline, virtual] |
Returns whether the given parameter is transient.
Transient parameters are not stored to disk. This can be useful, for example, with display-only parameters, whose value is a user-friendly string built from other non-display parameters.
[in] | paramID | The ID of the parameter |
{ UNUSED_PARAM(paramID); return FALSE; }
virtual Class_ID PluginClassID | ( | ) | [pure virtual] |
Returns the class ID of a plug-in implemented in the same module as this context.
The class ID is used to support deferred plug-in loading. When the brush preset manager needs to ensure that a context implementation is loaded into memory, it will load the module using this ID. The manager calls this method when a context is first registered, and then stores the value in the brush preset file for later use.
virtual SClass_ID PluginSuperClassID | ( | ) | [pure virtual] |
Returns the superclass ID of a plug-in implemented in the same module as this context.
The superclass ID is used to support deferred plug-in loading. When the brush preset manager needs to ensure that a context implementation is loaded into memory, it will load the module using this ID. The manager calls this method when a context is first registered, and then stores the value in the brush preset file for later use.