Home |
Class PegButton HMI (Human-Machine Interface) Classes |
Class PegButtonPegButton serves as the base class for nearly all PEG button style objects. PegButton provides the BF_REPEAT timer operation, default frame drawing, and default selection SIGNALS. You would not normally create an instance of PegButton in your system software, however PegButton is very useful as a base class for your own custom button styles. class PegButton : public PegThing { public: PegButton(const PegRect &, PEGUINT wId = 0, PEGUINT wFlags = AF_ENABLED); PegButton(PEGUINT wId = 0, PEGUINT wFlags = AF_ENABLED); virtual void Draw(void); virtual PEGINT Message(const PegMessage &Mesg); void Enable(void); void Disable(void); virtual void Style(PEGUINT wStyle); protected: virtual void DrawFocusIndicator(BOOL bDraw); virtual void EraseFocusIndicator(void); }; Demo program Robot uses this class. Style FlagsFF_NONE, BF_REPEAT, BF_SELECTED, BF_DOWNACTION, BF_FULLBORDER. SignalsPegButton sends the PSF_CLICKED signal when selected. ConstructorsThe first constructor creates a PegButton with a defined size and position. The second constructor creates a PegButton with an undefined position. Method DisableDisables the button, and prevents it from being selected. Method EnableEnables the button, and allows the button to be selected. Method DrawProvides the 3D appearance when the button is selected. Method DrawFocusIndicatorDraws the focus indication for all PegButton derived classes. The DrawFocusIndicator function is called in two places: when the button is visible and received focus, and when the button is re-drawn and already has focus. When called because focus is received, the incoming parameter is TRUE. This indicates that the function should do any drawing required, including invalidation, BeginDraw, and EndDraw, to indicate that the object has focus. When called during a re-draw do to the button having focus, the incoming parameter is FALSE. This indicates that the function is being called at the conclusion of the Draw() routine, and therefore need only perform those drawing operations need to indicate the button has focus. Method EraseFocusIndicatorCalled when a button derived object loses input focus. The default operation of this function is to re-draw the button client area. Method MessagePegButton catches PM_LBUTTONDOWN, PM_LBUTTONUP, and PM_TIMER messages.
|