Home |
Class PegIcon HMI (Human-Machine Interface) Classes |
Class PegIconPegIcon is a simple bitmap display object derived from PegThing. PegIcon can also be used to represent another object. PegIcon can be assigned a Proxy object pointer. If this pointer is assigned, the icon will add the Proxy object to the icon parent and destroy itself when selected. This is how window icons function. PegDecoratedWindow classes will create an instance of PegIcon when they are minimized, add the icon to the window parent, and remove themselves from the parent. A PegIcon object with no Proxy assignment is also useful for simply displaying a PegBitmap. class PegIcon : public PegThing { public: PegIcon(PegThing * pProxy, PegBitmap * pbitmap = NULL, PEGUINT wId = 0, PEGUINT wStyle = FF_NONE); PegIcon(const PegRect &Where, PegBitmap * pbitmap, PEGUINT wId = 0, PEGUINT wStyle = FF_NONE); PegIcon(PegBitmap * pbitmap, PEGUINT wId = 0, PEGUINT wStyle = FF_NONE); virtual void Draw(void); virtual PEGINT Message(const PegMessage &Mesg); virtual void SetIcon(PegBitmap * nbm); virtual PegBitmap * GetIcon(void); virtual PegThing * GetProxy(void); virtual void SetProxy(PegThing * pNew); protected: PegBitmap * mpBitmap; PegThing * mpProxy; }; Demo program Table uses this class. ConstructorsThe first constructor creates a PegIcon which represents or is proxy for another object. The second and third constructor create a PegIcon that will simply display a bitmap. The second constructor allows the caller to specify the icon size and position. The third constructor allows the icon to self determine the overall icon size to match the bitmap size. When the third constructor is used, the application software may immediately use the resize function to position the icon. Method DrawPegIcon overrides the Draw() function to draw the icon's bitmap. Method GetIconReturns the address of the bitmap associated with the Icon. Method GetProxyReturns the address of the object that is represented by the Icon. Method MessagePegIcon overrides Message() to catch PM_LBUTTONUP messages. Method SetIconAlters the Icon bitmap at any time. Method SetProxyAssigns or alters the object represented by the PegIcon. Examples:The following are examples of PegIcon:
|