WDS_Scope

WDS_Scope

wds

1998 12-05


CLASS

WDS_Scope - event redirection widget


SYNOPSIS

Class WDS_Scope is used used to bypass scoped events to registered destination widgets. Normally, events will trickle through the widget hierarchy to the deepest widget whose geometry intersects the event location. A widget can register with an ancestral scope to recieve events that fall within the geometry of the scope but not necessarily with that decendent widget itself. This is done by creating a WDS_Bypass object and registering it with the scope. From any widget, an ancestral scope can be found by using the WDS_Widget call:

	scope=(WDS_Scope *)FindWidgetType(WDS_Typecode scope_code,long first);

where first specifies whether you are looking for the nearest ancestral scope (first = TRUE) or the scope nearest to the root window (first = FALSE). The scope_code is a long pointer unique to WDS_Scope and can be determined by calling WDS_Widget::GetTypeCode() on any WDS_Scope or directly to the static function WDS_Scope::GetTypeCodeStatic().


For any incoming event, the scope will search its list of bypasses for all entries that have the same source and any common event items and event states. For each match, the corresponding destination widgets are directly sent the incoming event (not necessarily with all the items and states as set in the bypass), but with the OR'ed event widget flag WDS_BYPASS_EVENT set. The event widget flags can be read using EW_Event::GetWidgetFlags().


If a widget registers for exclusive access using the WDS_Bypass flag WDS_BYPASS_FLAG_TAKE, any previous intersecting exclusive bypasses are removed from the scope's bypass list and sent a psuedo-event matching their bypass and with the OR'ed event widget flags WDS_BYPASS_EVENT and WDS_BYPASS_TAKE_LOST both set.


Widgets, who have not otherwise excluded such through their event mask, can expected events resembling their bypass with the widget flag WDS_BYPASS_IN_FOCUS set. This happens when the scope determines that if the event occured, it would be sent to this widget. It generally occurs during the descension processing of an idlemouse event after the idlemouse event itself is sent to the widget. Other unfocused widgets will recieve the idlemouse event, but no following WDS_BYPASS_IN_FOCUS event. From such, they know they are not focused. WDS_GetString uses this as evident when in shallow focus mode.


When non-idlemouse events are sent to exclusive bypasses, they are first propagated normally through the hierarchy but with WDS_BYPASS_EVENT set and as EW_EVENT_USED_ALL. After that, the bypass recieves the event as unused and WDS_BYPASS_EVENT still set.


The following lists the sequence of event processing in a scope. The process is specifically different for idlemouse events.


For idlemouse event on all bypasses,
Phase 1 non-exclusive bypasses sent event with WDS_BYPASS_EVENT set
Phase 2 normal event propagation through hierarchy
Phase 3 exclusive bypasses whose widget is in focus sent event with WDS_BYPASS_IN_FOCUS set


For other events,
Phase 1 non-exclusive bypasses sent event with WDS_BYPASS_EVENT set
Phase 2 normal event propagation through hierarchy; if there is an intersecting exclusive bypass, events sent as EW_EVENT_USED_ALL and with WDS_BYPASS_EVENT set
Phase 3 exclusive bypasses of intersecting content sent event with WDS_BYPASS_EVENT set


PUBLIC MEMBER FUNCTIONS

Inheritance from class WDS_Widget



void RegisterBypass(WDS_Bypass *bypass)

void DeRegisterBypass(WDS_Bypass *bypass)
Register/DeRegister the given bypass with this scope. There is no specified limit on the number of destination widgets or bypasses per destination widget.



void ExcludeAncestors(WDS_Bypass *bypass)
Find widgets whose bypass in ancestral scopes conficts with the one specified, and remove their exclusive access. Intended for internal use.


FILES

wds/scope.h Scope/Bypass header file


SEE ALSO

WDS_intro(3), WDS_Widget(3), WDS_Bypass(3), EW_Event(3)