Creating the standard input focus frame implementation object

customkeyfocus.C's x::w::create_nonrecursive_visibility_focusframe_impl() and x::w::create_always_visible_focusframe_impl() assemble the implementation object for a standard input focus frame container. They implement two ways of handling the visibility of the focus frame container's contents.

A display element's show() or hide() makes the display element visible or invisible. A container's show_all() and hide_all() recursively updates the visibility of the container itself and everything inside it. This is equivalent to show() or hide() not just for the container itself, but for everything inside it, recursively.

This matters because a given display element is visible not only when it's show()n, but only if all of its parent containers are also show()n. hide()ing a container makes the entire container disappear, even if some display elements in the container are show()n. Each display element maintains its own visibility state, and the final visibility of a given display element requires all of its parent containers to be visible.

The x::w::nonrecursive_visibilityObj template mixin

x::w::create_nonrecursive_visibility_focusframe_impl() uses x::w::nonrecursive_visibilityObj to create the focus frame container's implementation object class. x::w::nonrecursive_visibilityObj is a template mixin that overrides show_all() and hide_all() for the resulting display element. They become equivalent to show() and hide().

This makes the resulting container behave similar to a monolithic display element. Otherwise, a hide_all() followed by show() tresults in the container being visible, but none of the container's elements being visible. This is because hide_all() hid everything, but show() made only the container visible.

For a simple display element, and not a container, show() and hide() are the same as show_all() and hide_all(). Only containers have other display elements that show_all() and hide_all() affects. This template mixin makes containers look like simple display elements in that respect.

The x::w::nonrecursive_visibilityObj template mixin results in a container that behaves as a monolithic display element, for visibility purposes. hide_all() followed by show() makes the container's contents appear, as if the container is just a single display element, because hide_all() ignored the container's elements in the first place.

Note

New display elements are not visible upon creation, by default. This remains the case. Each display element that gets added to this container should still be show()n (or show_all()ed, perhaps), in order for this to work correctly.

This is why customkeyfocus.C still needs to show() the custom display element after it gets added to a non-recursive visibility input focus frame.

The x::w::always_visibleObj template mixin

x::w::create_always_visible_focusframe_impl() uses the x::w::always_visibleObj to create the focus frame container's implementation object class. x::w::always_visibilityObj is a template mixin that overrides show_all() and hide_all() for the resulting display element.

x::w::always_visibleObj disables show_all() and hide_all() for its container, but only for the container itself. show_all() and hide_all() still apply to all display elements in the container. Additionally, x::w::always_visibleObj automatically show()s the container after it gets created.

Note

Only show_all() and hide_all() get disabled. show() and hide() still have the usual effect on the container.

The x::w::container_visibleObj template mixin

x::w::create_nonrecursive_visibility_focusframe_impl() and x::w::create_always_visible_focusframe_impl() use the x::w::container_visible_elementObj template mixin. LibCXXW automatically provides scroll-bars for the application's window if it's too big to fit on the screen. When that happens, display elements that receive keyboard focus get automatically scrolled into view if they are not fully visible.

This template mixin adjusts the scrolling so that its entire container gets scrolled into view instead of just some display element in the container. The standard input focus frame is a container, and using this template mixin scrolls the entire input focus frame into view, instead of the focusable display element in the container, leaving one edge of the input focus frame scrolled out of view.