Now that we have a wrapper exposable, we need to implement
on_mouse(). In it, we need to check if we have our own on-click
handler, or else, check if mouse is inside the sub-exposable, or in
the left- or right margin.
Now that we have a wrapper exposable, we need to implement
on_mouse(). In it, we need to check if we have our own on-click
handler, or else, check if mouse is inside the sub-exposable, or in
the left- or right margin.
This is done by wrapping the selected particle/exposable in a
ramp-specific exposable. This way, we can add the margins before
delegating begin_expose() and expose() to the selected exposable.
This is done by wrapping the selected particle/exposable in a
ramp-specific exposable. This way, we can add the margins before
delegating begin_expose() and expose() to the selected exposable.
Since we're typically interrested in *where* (on the progress-bar) the
user clicked, we need a way to pass the clicked position to the
handler.
Normally, the on-click handler is expanded when a particle
instantiates its exposable. At this point, we (obviously) don't have
the click position.
This is solved by expanding the handler a second time, when the bar is
clicked.
Thus, the user can use the "{where}" tag in the click handler. "where"
will be expanded to a percentage value (0-100).
If we have our own on_click handler, call the default
implementation. Otherwise, check which sub-particle the mouse is over,
and delegate the on_mouse() call.
This is intended to be a format-like string, with the possibility to
use tag formatters.
The expanded string will later be passed to the system() call.
The ramp particle is configured with a tag name and a list of
particles.
At instantiation time, a single particle is selected from the list,
depending on the tag value and it's minimum and maximum values.
I.e. this particle acts kind of like a progress bar.
This was always done before. Now that it is optional, one can for
example generate lists dynamically, using the same set of base
particles over and over again.