Wrapper Macros

Description:

The following sections describe the different LEADTOOLS Class Library macros. These macros are used by various LEADTOOLS Class Library classes. In order to create user-defined classes that derive from LEAD classes, you can make use of these macros. Some of these macros are required, while some are optional.

LEAD_DECLAREOBJECT

LEAD_IMPLEMENTOBJECT

LEAD_DECLARE_PLAYBACK_BITMAP

LEAD_INIT_PLAYBACK_BITMAP

LEAD_DECLARE_LIST_BITMAP

LEAD_INIT_LIST_BITMAP

LEAD_DECLAREOBJECT(ClassName):

This macro declares a LEADTOOLS Class Library class. This is a required macro if you wish to derive a class from one of the LEADTOOLS Class Library classes. Use this macro in the header file that contains the derived class declaration:

Example:

This example derives class MyPrint from LPrint

class MyPrint : Public LPrint
{
   LEAD_DECLAREOBJECT(MyPrint);

   private: /*user private section */
   //….
   protected: /*user protected section */
   //….
   public: /*user public section */
   //….
};

LEAD_IMPLEMENTOBJECT(ClassName):

This macro declares the implementation of a LEADTOOLS Class Library class. This is a required macro if you wish to derive a class from one of the LEADTOOLS Class Library classes. Use this macro in the class implementation file that contains the derived class implementation:

Example:

This example derives class MyPrint from LPrint

LEAD_IMPLEMENTOBJECT(MyPrint)

MyPrint::MyPrint()
{
   //….
}

MyPrint::~MyPrint()
{
   //….
}

MyPrint::SomeFunction()
{
   //….
}

LEAD_DECLARE_PLAYBACK_BITMAP():

This is an optional macro that you can use to connect a class derived from LBitmapBase or LBitmap to the LPlayBack class.

This macro allows the bitmap class to be used by the playback class as the playback animation bitmap, and must be used in conjunction with the LEAD_INIT_PLAYBACK_BITMAP() macro.

For example in the LEADTOOLS Class Library header for the LPlayBack class, a bitmap object is declared to be used by this class:

class LPlayBack : Public LBase
{
   LEAD_DECLARE_PLAYBACK_BITMAP();

   private: /*private section */
   //….
   protected: /*protected section */
   //….
   public: /*public section */
   //….
};

This example allows the derived bitmap class (LUserBitmap) to be used by the playback class.

LUserPlayBack: public LPlayBack
{
   LEAD_DECLARE_PLAYBACK_BITMAP();

   private: /*user private section */
   //….
   protected: /*user protected section */
   //….
   public: /*user public section */
   //….
};

LEAD_INIT_PLAYBACK_BITMAP(PlayBackClassName, BitmapClassName):

This macro connects the playback class to a bitmap class that is derived from LBitmapBase or LBitmap. You must use this macro if you want to connect a derived bitmap class to the playback class.

Example:

For example in the LEADTOOLS Class Library implementation for the LPlayBack class, a bitmap object is connected to this class:

LEAD_INIT_PLAYBACK_BITMAP(LPlayBack, LBitmapBase)

LPlayBack::LPlayBack()
{
   //….
}

This example connects the user-defined LUserBitmap class, which is derived from LBitmap, to the playback class.

LEAD_INIT_PLAYBACK_BITMAP(LUserPlayBack, LUserBitmap)

LUserPlayBack::LUserPlayBack()
{
   //….
}

Now, in order to get the playback bitmap, the user can call:

LUserPlayBack UserPlayBack;
LUserBitmap* pLUserBitmap= (LUserBitmap* ) UserPlayBack.GetBitmap();
pLUserBitmap->SomeUserDefinedFunctionInLUserBitmap();

LEAD_DECLARE_LIST_BITMAP():

This is an optional macro that you can use to connect a class derived from LBitmapBase or LBitmap to the LBitmapList class.

This macro allows the bitmap class to be used by the bitmap list class as the bitmap returned when using the [ ] operator of the bitmap list class. This macro must be used in conjunction with the LEAD_INIT_LIST_BITMAP() macro.

Example:

For example in the LEADTOOLS Class Library header for the LBitmapList class, a bitmap object is declared to be used by this class:

class LBitmapList : Public LBase
{
   LEAD_DECLARE_LIST_BITMAP();

   private: /*private section */
   //….
   protected: /*protected section */
   //….
   public: /*public section */
   //….
};

This example allows the derived bitmap class (LUserBitmap) to be used by the bitmap list class.

LUserBitmapList: public LBitmapList
{
   LEAD_DECLARE_LIST_BITMAP();

   private: /*user private section */
   //….
   protected: /*user protected section */
   //….
   public: /*user public section */
   //….
};

LEAD_INIT_LIST_BITMAP(BitmapListClassName,BitmapClassName):

This macro connects the bitmap list class to a bitmap class that is derived from LBitmapBase or LBitmap. You must use this macro if you want to connect a derived bitmap class to the bitmap list class.

LEAD_INIT_LIST_BITMAP(LBitmapList, LBitmapBase)

LBitmapList::LBitmapList
()
{
   //….
}

This example connects the user-defined LUserBitmap class, which is derived from LBitmap, to the bitmap list class.

LEAD_INIT_LIST_BITMAP(LUserBitmapList, LUserBitmap)

LUserBitmapList::LUserBitmapList()
{
   //….
}

Then, when the you use the [ ] operator for enumerating the bitmap list items, you can do the following:

for(int i=0;i<LUserBitmapList.GetCount();i++)
   ( (LUserBitmap)LUserBitmapList[ i ] ).SomeUserDefinedFunctionInLUserBitmap();