XTkInputFocus.mesa
Copyright Ó 1992 by Xerox Corporation. All rights reserved.
Christian Jacobi, February 4, 1992 12:51 pm PST
Christian Jacobi, February 5, 1992 10:43 am PST
DIRECTORY
Xl USING [currentTime, TimeStamp],
XTk USING [Widget];
XTkInputFocus: CEDAR DEFINITIONS
~ BEGIN OPEN XTk;
Input focus procedures may result in no-ops if widget is not realized (or NIL).
Setting focus
SetFocus: PROC [w: Widget, time: Xl.TimeStamp ¬ Xl.currentTime];
(Directly) sets the input focus the ICCCM way (good for either globally or locally active mode). It is up to the shell's input focus mode whether this actively sets the input focus, or, whether this only sets the target for WM←TAKE𡤏OCUS protocol.
If the caller wants to enable delegation, he must do so himself.
GiveUpFocus: PROC [w: XTk.Widget, time: Xl.TimeStamp ¬ Xl.currentTime];
ICCCM does NOT allow to give up focus. However: there has to be a way to set focus back just in case there would be no window manager running.
Navigation
Procedures useful to implement a NEXT key.
searchLimit limits levels of delegation and nesting to limit damage on circular delegations.
FirstFocusTarget: PROC [w: XTk.Widget, searchLimit: INT ¬ 5] RETURNS [XTk.Widget ¬ NIL];
Returns w or its first child which is capable of taking the input focus
NextFocusTarget: PROC [w: XTk.Widget, searchLimit: INT ¬ 5] RETURNS [XTk.Widget ¬ NIL];
Returns first sibling of w, or, child of a sibling capable of taking the input focus.
Implement: PROC [w: XTk.Widget, bool: BOOL ¬ TRUE];
Denotes whether w implements the input focus.
Note that the input focus capability is enabled when either the widget instance or the widget class supports it.
Delegate: PROC [w: XTk.Widget, using: XTk.Widget ¬ NIL];
Denotes that "using" should be substituted for "w" on calls of FirstFocusTarget or NextFocusTarget.
This is mainly useful for widget class implementors delegating focus operations to a particular child. NIL establishes default behaviour.
SetNext: PROC [w: XTk.Widget, using: XTk.Widget ¬ NIL];
Sets the target of the "next" operation.
This is mainly useful for navigation within composed widgets to implement fancy "next" behaviour. NIL establishes default behaviour.
END.