elementObj::implObj
's basic
do_draw
() method
customkeyfocus.C
does not use the simplified drawing interface implemented by the
x::w::scratch_and_mask_buffer_draw
template.
customkeyfocus.C
overrides the base
do_draw
() method that takes just two
parameters:
A
x::w::draw_info
object that's needed by fundamental drawing-related methods
from the parent elementObj::implobj
class.
A list of rectangles that specify the portion or portions of the widget that require drawing. In nearly all cases this is just one rectangle representing the entire area taken up by the widget; but it doesn't have to be. A partially-obscured widget results in just the visible parts of its appearing in the rectangle set.
customkeyfocus.C
gives an example of manually redrawing the widget, one
rectangle at a time.
Creating a
x::w::clip_region_set
sets a clip mask on the underlying window, clipping the subsequent
draw operations to the widget.
Calling draw_using_scratch_buffer
()
to redraw each portion of the widget.
The lambda that gets passed to
draw_using_scratch_buffer
()
gets invoked with a picture, pixmap, and a graphic context representing
a scratch buffer for drawing.
draw_using_scratch_buffer
() is the only
mechanism that must be used for updating the apperance of the widget.
After the lambda returns, the scratch buffers get copied to the window
after some additional, optional processing related
to shading inactive windows and
adjusting the image in the style of a disabled widget, if the
focusable widget is disabled.
draw_using_scratch_buffer
()'s remaining
parameters, in addition to the closure are:
the rectangle to be redrawn;
the x::w::draw_info
object
(always passed as two separate parameters, some internal functions
use different objects for specific situations);
and the
x::w::clip_region_set
object in order to
prove, by contract, that the clipping region is installed.