com.phloxui
Version:
PhloxUI Ng2+ Framework
31 lines (30 loc) • 1.58 kB
TypeScript
/**
* <p style="text-indent: 2em;">
* An interface of <code>component</code> classes requiring the user's focus. For example, the [[ContextMenu]] which that it requires the user to focus on itself
* all the time it is being displayed. Once the user click on anywhere else outside its area (losing its focus), the [[ContextMenu]] will be disappeared. For this
* kind of requirement, the [[ContextMenu]] must implement this interface and register itself as a <code>focusing component</code> to [[NeedFocusService]] (via
* [[NeedFocusService.setFocusingComponent]] method). Then, [[NeedFocusService]] will automatically call [[onFocus]] callback method on the <code>focusing
* component</code>. Once the component loses its focus, [[NeedFocusService]] will automatically call [[onLostFocus]] callback method.
* </p>
*
* @author shiorin, tee4cute
* @see [[NeedFocusService]]
*/
export interface INeedFocus {
/**
* <p style="text-indent: 1em;">
* A callback method automatically called by [[NeedFocusService]] when <code>this</code> component loses its focus.
* </p>
*
* @param event The source UI <code>event</code> causing <code>this</code> component to lose its focus.
*/
onLostFocus(event: any): void;
/**
* <p style="text-indent: 1em;">
* A callback method automatically called by [[NeedFocusService]] when <code>this</code> component gains the focus.
* </p>
*
* @param event The source UI <code>event</code> causing <code>this</code> component to gain the focus.
*/
onFocus(event: any): void;
}