This class provides a generic implementation for sub-object types.
Instead of having to create a sub-class of ISubObjType the constructors of this class may be used to initialize private data members of the class. Then implementations of the GetName() and GetIcon() methods of ISubObjType are provided which simply return the data members. This SubObjectType will either use the subObjectIcons_16i.bmp and SubObjectIcons_16a.bmp bitmaps in the UI/icons directory (for the GenSubObjType(int idx) constructor), or any other bmp file that is specified in the GenSubObjType(MCHAR *nm, MCHAR* pFilePrefix, int idx) constructor. The bitmap files have to reside in the UI/icons directory. All methods of this class are implemented by the System.
#include <object.h>
Public Member Functions |
|
GenSubObjType (MCHAR *nm, MCHAR *pFilePrefix, int idx) | |
Constructor. |
|
GenSubObjType (int idx) | |
This constructor assumes that the icons are
in either UI/icons/SubObjectIcons_16i.bmp or SubObjectIcons_24i.bmp
depending on which size icons are in use by the system. |
|
CoreExport | ~GenSubObjType () |
Destructor. |
|
void | SetName (MCHAR *nm) |
Sets the name for this sub-object type.
|
|
MCHAR * | GetName () |
Returns the name for this sub-object type.
|
|
CoreExport MaxIcon * | GetIcon () |
Returns the icon for this sub-object type.
|
GenSubObjType | ( | MCHAR * | nm, |
MCHAR * | pFilePrefix, | ||
int | idx | ||
) | [inline] |
Constructor.
The private data members are inialized to the values passed and the corresponding Get methods of this class will return these data members.
nm | The name for this sub-object type. |
pFilePrefix | The BMP imagelist file name prefix for this sub-object type. This is the file name, without the extension, and with the assumption that the file is in the ui/icons directory. For example specifying _M("SubObjectIcons") for this parameter indicates the file UI/icons/SubObjectIcons_16i.bmp if the small icons are in use and SubObjectIcons_24i.bmp if the large icons are in use. |
idx | This is the one based index into the image list of the icon to use. |
: name(nm), mIcon(NULL), mIdx(idx), mFilePrefix(pFilePrefix) {}
GenSubObjType | ( | int | idx | ) | [inline] |
This constructor assumes that the icons are in either UI/icons/SubObjectIcons_16i.bmp or SubObjectIcons_24i.bmp depending on which size icons are in use by the system.
In this case only the index into the image list is required.
idx | This is the one based index into the image list of the icon to use. |
: mIcon(NULL), mIdx(idx), mFilePrefix(_M("SubObjectIcons")) {}
CoreExport ~GenSubObjType | ( | ) |
Destructor.
void SetName | ( | MCHAR * | nm | ) | [inline] |
Sets the name for this sub-object type.
nm | The name to set. |
{name = nm;}
MCHAR* GetName | ( | ) | [inline, virtual] |
Returns the name for this sub-object type.
This is the implementation of the ISubObjType method.
Implements ISubObjType.
{ return name;}
CoreExport MaxIcon* GetIcon | ( | ) | [virtual] |
Returns the icon for this sub-object type.
This is the implementation of the ISubObjType method.
Implements ISubObjType.