Home |
Class PegGroup HMI (Human-Machine Interface) Classes |
Class PegGroupPegGroup is a container class that visually groups any number of children. You can add any type of PEG object to a PegGroup, including window objects, nested groups, etc. PegGroup is especially useful for grouping sets of PegRadioButton objects, since these objects are mutually exclusive within a common parent. class PegGroup : public PegThing, public PegTextThing { public: PegGroup(PegRect &, const PEGCHAR * Text, PEGUINT wStyle = AF_ENABLED); virtual void Draw(void); virtual void Add(PegThing * Who, BOOL bDraw = TRUE); virtual PEGINT Message(const PegMessage &Mesg); virtual void Enable(BOOL bEnable); virtual PegThing * Remove(PegThing * pWhat, BOOL bDraw = TRUE); }; Demo programs PegDemo, Table, and Notebook use this class. Style FlagsSignalsPegGroup sends no signals. Signals sent by child objects of PegGroup are passed up to the parent of the PegGroup object. ConstructorThe PegGroup constructor creates a PegGroup at the indicated position with an initial text value indicated by * Text. Method Addoverrides the Add function. PegGroup is not a viewport object, and therefore overrides the Add function to prevent breaks in the viewport tree. Method DrawPegGroup overrides the Draw() function to draw the group box. Method EnableEnables or Disables the group and all children of the group. Method MessagePegGroup catches the PM_SHOW message. Method RemoveSince PegGroup does not fill the client area of the group, when object is removed from the group PegGroup commands the parent object to redraw. For this reason PegGroup overrides the Remove() function. Examples:The following are examples of PegGroup: The following example creates a PegGroup and adds a collection of PegRadioButton objects to the group. The group is then added to the parent object. void MyWindow::AddGroup(void) { PegRect GroupRect; GroupRect.Set(mClient.wLeft + 10, mClient.wTop + 10, mClient.Right - 10, mClient.wTop + 100); PegGroup * pGroup = new PegGroup(GroupRect, "RadioButtons"); pGroup->Add(new PegRadioButton(mClient.wLeft + 20, mClient.wTop + 20, "Button1")); pGroup->Add(new PegRadioButton(mClient.wLeft + 20, mClient.wTop + 40, "Button2")); pGroup->Add(new PegRadioButton(mClient.wLeft + 20, mClient.wTop + 60, "Button3")); Add(pGroup); }
|