Taxonomy Categories:
Member Functions:
Interface Category:
API.
Inherits From:
TMomentaryMenuItem
Inherited By:
None.
Purpose:
TSliderMenuItem derives from TMomentaryMenuItem, and it establishes the protocol for displaying the slider in a menu. It is used to add a volume slider to the menu.
Instantiation:
Allocate on the heap or the stack.
Deriving Classes:
None.
Concurrency:
Not multithread safe.
Resource Use:
No special requirements.
Other Considerations:
None.
- TSliderMenuItem (TSliderControl * sliderToAdopt)
- TSliderMenuItem (const TSliderMenuItem & copy)
- TSliderMenuItem ()
Interface Category:
API.
Purpose:
- Constructs a TSliderMenuItem given a slider object.
- Copy constructor.
- Default constructor.
Calling Context:
- Called to create a slider menu item for a slider.
- Called to copy an object.
- Called by the stream-in operators and derived classes.
Parameters:
- TSliderControl * sliderToAdopt -A pointer to the slider object.
- const TSliderMenuItem & copy -A reference to the object to be copied.
- Takes no parameters.
Return Value:
None.
Exceptions:
Throws no exceptions, passes all exceptions through.
Concurrency:
Not multithread safe.
Other Considerations:
None.
virtual ~ TSliderMenuItem ()
Interface Category:
API.
Purpose:
Destructor.
Calling Context:
Called to destroy an object.
Parameters:
Return Value:
None.
Exceptions:
Throws no exceptions, passes all exceptions through.
Concurrency:
Not multithread safe.
Other Considerations:
None.
TSliderMenuItem & operator =(const TSliderMenuItem &)
Interface Category:
API.
Purpose:
Assignment operator.
Calling Context:
Called when an object is assigned to another compatible object.
Parameters:
Return Value:
A non-const reference to the left-hand side object.
Exceptions:
Throws no exceptions, passes all exceptions through.
Concurrency:
Not multithread safe.
Other Considerations:
None.
virtual long Hash () const
Interface Category:
API.
Purpose:
Returns the hash value that uniquely identifies this object within its type. Hash values are used to build dictionaries of objects.
Calling Context:
Call this function directly.
Parameters:
Return Value:
Returns the hash value that uniquely identifies this object.
Exceptions:
Throws no exceptions, passes all exceptions through.
Concurrency:
Not multithread safe.
Other Considerations:
None.
bool operator ==(const TSliderMenuItem &) const
Interface Category:
API.
Purpose:
Tests for equality between the specified TSliderMenuItem object and this TSliderMenuItem object.
Calling Context:
Call this function directly.
Parameters:
Return Value:
Returns true if the two objects are equal; otherwise, returns false.
Exceptions:
Throws no exceptions, passes all exceptions through.
Concurrency:
Not multithread safe.
Other Considerations:
None.
bool operator != (const TSliderMenuItem &) const
Interface Category:
API.
Purpose:
Tests for inequality between the specified TSliderMenuItem object and this TSliderMenuItem object.
Calling Context:
Call this function directly.
Parameters:
Return Value:
Returns true if the two objects are different; otherwise, returns false.
Exceptions:
Throws no exceptions, passes all exceptions through.
Concurrency:
Not multithread safe.
Other Considerations:
None.
virtual TStream & operator >>=(TStream &) const
Interface Category:
API.
Purpose:
Stream-out operator.
Calling Context:
Called to stream out data.
Parameters:
- TStream & -The stream the object streams itself out to.
Return Value:
Returns a reference to the stream the object streams itself out to.
Exceptions:
Throws no exceptions, passes all exceptions through.
Concurrency:
Not multithread safe.
Other Considerations:
None.
virtual TStream & operator <<= (TStream &)
Interface Category:
API.
Purpose:
Stream-in operator.
Calling Context:
Called to stream in data.
Parameters:
- TStream & -The stream the object streams itself in from.
Return Value:
Returns a reference to the stream the object streams itself in from.
Exceptions:
Throws no exceptions, passes all exceptions through.
Concurrency:
Not multithread safe.
Other Considerations:
None.
Member Function: TSliderMenuItem::GetNumberOfParts
virtual unsigned long GetNumberOfParts () const
Interface Category:
API.
Purpose:
Allows the developer to add new menu item subparts, such as checkmarks or arrows, to the slider menu item. Returns the number of parts in this menu item. Menu items can contain any number of parts, which are automatically aligned by the owning menu. The menu calls this function to determine how many parts a given menu item actually contains.
Calling Context:
Called by the owning menu during layout negotiations.
Parameters:
Return Value:
Returns the number of parts.
Exceptions:
Throws no exceptions, passes all exceptions through.
Concurrency:
Not multithread safe.
Other Considerations:
None.
Member Function: TSliderMenuItem::GetLabelPartIndex
virtual unsigned long GetLabelPartIndex () const
Interface Category:
API.
Purpose:
Returns the index of the main label for this menu item. The index indicates the position of the main label relative to the beginning edge of the menu item. Indices begin at 0.
Each menu item must define a main subpart, which is referred to as the label part. The columns of the menu are aligned around this label part. For example, consider a menu that contains two items. The first item contains a checkmark subpart and the second item doesn't. GetLabelPartIndex returns 1 for the first item and returns 0 for the second item. This tells the menu to align subpart 1 in the first item with subpart 0 in the second item. As a result, the label part of the second item is shifted by the size of the checkmark part so that it is aligned with the label part of the first item.
Calling Context:
Called by the owning menu during layout negotiations.
Parameters:
Return Value:
Returns the label part index.
Exceptions:
Throws no exceptions, passes all exceptions through.
Concurrency:
Not multithread safe.
Other Considerations:
None.
Member Function: TSliderMenuItem::GetPreferredPartSize
virtual TGPoint GetPreferredPartSize (unsigned long part) const
Interface Category:
API.
Purpose:
Determines the preferred size of the specified subpart. The input parameter must be between zero and the value returned by GetNumberOfParts. The menu uses this information to align the subparts of each menu item.
Calling Context:
Called by the owning menu during layout negotiations.
Parameters:
- unsigned long part -The index of the subpart for which to calculate the preferred size.
Return Value:
Returns the preferred size of the specified subpart. This function returns a TGPoint value of (0, 0) if the specified subpart is invalid.
Exceptions:
Throws no exceptions, passes all exceptions through.
Concurrency:
Not multithread safe.
Other Considerations:
None.
Member Function: TSliderMenuItem::SetPartBounds
virtual void SetPartBounds (unsigned long part, TGRect & bounds)
Interface Category:
API.
Purpose:
Sets the bounds of the specified subpart. Before invoking this function, the owning menu calls GetNumberOfParts, GetLabelPartIndex, and GetPreferredPartSize for each item. In addition, the menu has determined the maximum size of each subpart. The menu then calls SetPartBounds to tell the menu item the final size of each subpart. The bounds given are relative to the overall bounds of the menu item, as specified in SetItemBounds. It is important to note that you should not count on the bounds being origin-based. If the bounds are larger than required for the subpart, the menu item decides how to position the subpart within these bounds. For text labels, it is probably best to align the bottom of the label with the bottom of the given bounds. For graphic labels, such as checkmarks and arrows, it is probably better to center the graphic within the part bounds.
Calling Context:
Called by the owning menu during layout negotiations.
Parameters:
- unsigned long part -The subpart index for which to set the bounds.
- TGRect & bounds -The new bounds for that subpart.
Return Value:
None.
Exceptions:
Throws no exceptions, passes all exceptions through.
Concurrency:
Not multithread safe.
Other Considerations:
None.
Member Function: TSliderMenuItem::SetItemBounds
virtual void SetItemBounds (TGRect & bounds)
Interface Category:
API.
Purpose:
Sets the overall bounds of this menu item. The owning menu calls this function to notify the menu item of its overall bounds. The overall bounds can be larger that the union of the subpart bounds. For example, if this menu item only contains one subpart, and if other menu items contain two or three subparts, then the item bounds for this menu item is stretched to include the space reserved for the subparts of the other items. As a result, the menu item knows to draw a larger highlighted background that is the same size as the other menu items. It also means that the menu item is a larger hit target.
Calling Context:
Called by the owning menu during layout negotiations.
Parameters:
- TGRect & bounds -The new bounds for this menu item.
Return Value:
None.
Exceptions:
Throws no exceptions, passes all exceptions through.
Concurrency:
Not multithread safe.
Other Considerations:
None.
virtual void DrawParts (TGrafPort & port) const
Interface Category:
API.
Purpose:
Draws the subparts for this menu item to the specified grafport. TSliderMenuItem maintains an item label and an optional command key label. This function draws these labels in the appropriate places.
Calling Context:
Called by the owning menu during a draw operation.
Parameters:
- TGrafPort & port -The port into which to draw.
Return Value:
None.
Exceptions:
Throws no exceptions, passes all exceptions through.
Concurrency:
Not multithread safe.
Other Considerations:
None.
Member Function: TSliderMenuItem::DrawItemBackground
virtual void DrawItemBackground (TGrafPort & port) const
Interface Category:
API.
Purpose:
Draws the background of the menu item. TSliderMenuItem draws a plain background using the fill paint defined in the owning menu's MGraphic TGrafBundle. It also draws a highlighted background when the menu item is pressed.
Calling Context:
Called by the owning menu class during a draw operation.
Parameters:
- TGrafPort & port -The port into which to draw.
Return Value:
None.
Exceptions:
Throws no exceptions, passes all exceptions through.
Concurrency:
Not multithread safe.
Other Considerations:
None.
Member Function: TSliderMenuItem::CreateInteractor
virtual TInteractor * CreateInteractor (const TGPoint & pt)
Interface Category:
API.
Purpose:
Creates an interactor used to interpret user gestures on this menu item. This is an MControl override that is used by the menu owning this menu item to interact with the menu item. The interactor returned from this function must know how to translate user input that is received in the context of menu interaction to state changes on the menu item.
This function creates a TMomentaryControlInteractor.
Calling Context:
Called by the owning menu during user interaction.
Parameters:
- const TGPoint & pt -The mouse location of the event that started the user interaction.
Return Value:
Returns the newly created interactor, or NIL if no interactor was created. If no interactor is returned, the owning menu simply calls SetPressed(true) when the mouse is inside the item and SetPressed(false) when the mouse moves outside the item.
Exceptions:
Throws no exceptions, passes all exceptions through.
Concurrency:
Not multithread safe.
Other Considerations:
None.
virtual void SetOwner (TMenu * menu)
Interface Category:
API.
Purpose:
Notifies this menu item that it has been adopted into a menu. Menu items require a pointer to the owning menu so that the item can call back to the menu when it needs to redraw itself. Menu items that are views can also adopt themselves into the view hierarchy at this time.
Calling Context:
Called when the menu item is adopted into a menu.
Parameters:
- TMenu * menu -The menu that now owns this menu item.
Return Value:
None.
Exceptions:
Throws no exceptions, passes all exceptions through.
Concurrency:
Not multithread safe.
Other Considerations:
None.
Member Function: TSliderMenuItem::HandleAttributesChanged
virtual void HandleAttributesChanged ()
Interface Category:
API.
Purpose:
Handles a change to the attributes for the control panel slider menu items.
Calling Context:
Called when there is a change to the slider menu item attributes.
Parameters:
Return Value:
None.
Exceptions:
Throws no exceptions, passes all exceptions through.
Concurrency:
Not multithread safe.
Other Considerations:
None.
Click the icon to mail questions or corrections about this material to Taligent personnel.
Copyright©1995 Taligent,Inc. All rights reserved.