Part Implementation

The following checklists contain the items required to implement a new part or to convert an existing class to a part. Because parts are implemented as classes, you can convert existing classes to parts and still use them as classes.

Make the following interface changes to support parts:

  1. To enable notification, make sure your class inherits from the appropriate notifier.

  2. Define the constructors.

  3. Define a virtual destructor.

  4. If appropriate, define the assignment operator for nonvisual parts.

  5. Define a public notification ID for each event.

  6. Define a public notification ID for each attribute.

  7. Define a public get member function with no parameters so users can obtain the value of each attribute.

  8. If the attribute can be changed, define a public set member function with a single parameter containing the new value. If this attribute is a boolean, set the default to true.

  9. Define any public action member functions. Consider reset or default actions for attributes, including disable and enable actions for boolean attributes.

Make the following code changes to support parts:

  1. Code each event notification ID using a string containing the class name and event name.

  2. Code each attribute notification ID using a string containing the class name and attribute name.

  3. Code the constructors and a virtual destructor.

  4. If defined, code the assignment operator.

  5. Code the public get member functions for each attribute.

  6. Code the public set member functions for each attribute. Notify observers when the value changes.

  7. Call get and set member functions to return and change attribute values in actions. In addition, notify observers of events specified by the part.


Related concepts
Part Design Guidelines
Naming Guidelines for Parts and Their Features