LControl is a PowerPlant class that is used for manipulation and control of radio buttons, check boxes, pop-up menus, and other visual interface controls.
A control is an object of any class which inherits from the LControl class. All the standard Mac OS controls are provided by PowerPlant, and some additional controls as well.
Methods :
The methods in this class are:
Data Members:
The data members in this class are:
Operation:
Controls are a large topic of discussion. In order to master the concepts and terminology of Controls within PowerPlant, a careful reading of the "Controls and Messaging" chapter in The PowerPlant Book is a good thing.
Source files:
Ancestors:
Purpose:
The constructors create objects from the passed-in parameters.
Access:
Prototype:
LControl();
LControl( const LControl &inOriginal );
LControl( const SPaneInfo &inPaneInfo,
MessageT inValueMessage,
SInt32 inValue,
SInt32 inMinValue,
SInt32 inMaxValue );
LControl( LStream *inStream );Parameters:
These constructors have the following parameters:
Purpose:
The destructor destroys the object.
Access:
Prototype:
virtual ~LControl();
Purpose:
Broadcasts a message indicating a control change to the Listeners.
Access:
Prototype:
virtual void BroadcastValueMessage();Parameters:
Return:
Purpose:
Tracks the mouse click and determines if a hot spot within a control was selected. If the hot spot was selected then this method responds to the mouse click by calling the HotSpotResult() method defined for the class.
Access:
Prototype:
virtual void ClickSelf(Parameters:
const SMouseDownEvent &inMouseDown );
This method has the following parameters:
Return:
Purpose:
Determine which hot spot, if any, was clicked.
Access:
Prototype:
virtual SInt16 FindHotSpot( Point inPoint );Parameters:
This method has the following parameters:
Return:
SInt16 containing the value of the hot spot selected.
Remarks:
If the return value is 0 then no hot spot was selected. Valid hot spots are integer values greater than 0.
Purpose:
Get the maximum value for the control, found in the mMaxValue data member.
Access:
Prototype:
SInt32 GetMaxValue() const;Parameters:
Return:
SInt32 containing the value in mMaxValue.
Purpose:
Get the minimum value for the control, found in the mMinValue data member.
Access:
Prototype:
SInt32 GetMinValue() const;Parameters:
Return:
SInt32 containing the value in mMinValue.
Purpose:
Return the current value of a Control.
Access:
Prototype:
virtual SInt32 GetValue() const;Parameters:
Return:
SInt32 containing the value in mValue
Purpose:
Returns the value of the message.
Access:
Prototype:
MessageT GetValueMessage() const;Parameters:
Return:
MessageT containing the value in mValueMessage.
Purpose:
This method allows you to take action while the hot spot is down clicked by the mouse.
Access:
Prototype:
virtual void HotSpotAction( SInt16 inHotSpot,Parameters :
Boolean inCurrInside,
Boolean inPrevInside );
This method has the following parameters:
Return:
Remarks:
Depending on whether the mouse in inside or outside the hot spot you can override to change the control's visual appearance.
While the mouse is down you can override to continuously perform some action.
Purpose:
Perform an action as a result of clicking and releasing the mouse inside a hot spot.
Access:
Prototype:
virtual void HotSpotResult( SInt16 inHotSpot );Parameters:
This method has the following parameters:
Return:
Remarks:
Subclasses need to override this function to implement behavior associated with clicking in a Control hot spot.
Purpose:
Increment the current value of the control.
Access:
Prototype:
virtual void IncrementValue( SInt32 inIncrement );Parameters:
This method has the following parameters:
Return:
Remarks:
The incremental change in the amount of the value can be a negative amount.
Purpose:
Determine if the mouse is in the hot spot while down-clicking the mouse.
Access:
Prototype:
virtual Boolean PointInHotSpot( Point inPoint,Parameters:
SInt16 inHotSpot);
This method has the following parameters:
Return:
Boolean true if the point is with the hot spot, else false.
Purpose:
If the value is greater than mMaxValue then set to the maximum value.
Access:
Prototype:
virtual void SetMaxValue( SInt32 inMaxValue );Parameters:
This method has the following parameters:
Return:
Purpose:
If the value is less than mMinValue then set to the minimum value.
Access:
Prototype:
virtual void SetMinValue( SInt32 inMinValue);Parameters:
This method has the following parameters:
Return:
Purpose:
If the value has changed then set the new value and inform Listeners of the value change.
Access:
Prototype:
virtual void SetValue( SInt32 inValue );Parameters:
This method has the following parameters:
Return:
Purpose:
Sets the value of the message.
Access:
Prototype:
void SetValueMessage( MessageT inValueMessage);Parameters:
This method has the following parameters:
Return:
Purpose:
This method allows you to simulate clicking the hot spot of a Control. Visual feedback is provided as if the user had clicked inside the hot spot of a Control.
HotSpotAction() is called to simulate a down of the mouse. Then HotSpotResult() is used to simulate release within a particular hot spot.
Access:
Prototype:
virtual void SimulateHotSpotClick(SInt16 inHotSpot);Parameters:
This method has the following parameters:
Return:
Remarks:
This function can be used to implement keystroke equivalents for
Control-Click operations.
Purpose:
After down clicking this function tracks the mouse and PointInHotSpot() determines if a point is within a particular hopspot. Movement inside and outside the hotspot is tracked. HotSpotAction() is called to take action during mouse tracking.
Once the mouse is released the location of the event is recorded.
Access:
Prototype:
virtual Boolean TrackHotSpot( SInt16 inHotSpot,Parameters:
Point inPoint);
This method has the following parameters:
Return:
Boolean true if mouse released inside the hot spot, else false.
Purpose:
This data member is set using SetValueMessage(). The message is broadcast to all Listeners via BroadcastValueMessage().
Access:
Prototype:
MessageT mValueMessage;
Purpose:
Contains the value for the control.
Access:
Prototype:
SInt32 mValue;
Purpose:
Minimum value for the control.
Access:
Prototype:
SInt32 mMinValue;
Purpose:
Maximum value for the control.
Access:
Prototype:
SInt32 mMaxValue;