Widget::TestPosition
Defined in:
Returns the widget part corresponding to a mouse position.
C4Widgets.h
Prototype
virtual WidgetPart TestPosition(const Point2D& position) const override;
Parameters
position |
The position to test, in widget space. |
Description
The TestPosition
function is called by the Interface Manager to determine what part of a widget was hit by a mouse event. The position
parameter specifies the position of the mouse in the local coordinate system of the widget. A subclass implementation should return a widget part code corresponding to the part of the widget in which the mouse position lies or the value kWidgetPartNone
if the mouse position did not hit an interactive part of the widget.The
TestPosition
function is only called if the mouse position falls within the bounding box for the widget. The default implementation of the TestPosition
function always returns the value kWidgetPartInterior
, and this does not need to be overridden unless a widget needs to make a distinction among multiple parts of a widget for its own reference in the Widget::HandleMouseEvent
function or Widget::TrackTask
function.A widget part code is a nonzero 32-bit identifier, normally represented as a four-character code. Identifiers consisting entirely of uppercase letters and numerical characters are reserved for use by the engine.
See Also