|
wxArt2D
|
A class for id's of various kinds. More...
#include <id.h>
Public Member Functions | |
| virtual wxString | GetIdClassName () |
A class for id's of various kinds.
a2dIdBase is used in situations, where traditionally an enumeration type is used. The disadvantage of an enumeration is, that it cannot easily be expanded by derived classes. If this would be done, all derived classes would share the same id range and would have to know each other. a2dIdBase solves this. Instead of a enum value, a distinct a2dIdBase object is used for identification. The identification is usually done by address. The a2dIdBase objects are generally static members of a class of global variables, so that they are accessable by all objects requiring the id. A a2dIdBase should always be derived of, so that different ID classes cannot be inadvertedly intermixed. A a2dIdBase cannot easily be serialized, because the address will change. To do this, it must be converted to a string form. Derived classes will have ways to do this. Another way to have unique IDs is to use wxNewId. The advantage of a2dIdBase is, that it can be extended to be serialized and that it need not be initialized.