Avoid invalid memory address access by no trying to get parent's
control if next control is nil on event processing.
Signed-off-by: Leandro Dorileo <leandro.maciel.dorileo@intel.com>
We're using the wrong control to calculate the clipped area, it should
be the clipped control not its clipped parent.
Signed-off-by: Leandro Dorileo <leandro.maciel.dorileo@intel.com>
Keeps current API as-is by defaulting to the new BorderAuto BorderStyle
which keeps the default borders on Windows and defaults on none on Frames.
Allows setting a Window Border to BorderNone for a frameless Window.
Need to allow setting the border default in the Window Manager to avoid
the border from being drawn and then removed.
Signed-off-by: Mark D Horn <mark.d.horn@intel.com>
Frequently a user needs forcefully scroll a scrollable frame to an
arbitrary position. This API will scroll the content leaving the
clipper untouched.
Signed-off-by: Leandro Dorileo <leandro.maciel.dorileo@intel.com>
When dealing with mouse events we use ChildAt() to find the controls
in the clicked area, but we may have hidden elements in the same position
in that case we want to dispatch events to the visible one. This patch
fixes this issue by filtering out the non visible elements.
Signed-off-by: Leandro Dorileo <leandro.maciel.dorileo@intel.com>
Whenever running through NextControl() also exclude those controls
which parents are also non visible.
Signed-off-by: Leandro Dorileo <leandro.maciel.dorileo@intel.com>
With this demo we show how to use the scrollable frame with a frame
containing 10 buttons.
Signed-off-by: Leandro Dorileo <leandro.maciel.dorileo@intel.com>
This patch introduce internal changes in order to #1 actually clip
content avoid growing parent's size and keeping controls with their
own pre-set sizes and also #2 add a scrollable feature to frame control.
Signed-off-by: Leandro Dorileo <leandro.maciel.dorileo@intel.com>
In order to keep caller's context this patch introduces a interface{}
argument to carry on arbitrary data and pass it back based on the
registered callback.
Signed-off-by: Leandro Dorileo <leandro.maciel.dorileo@intel.com>
When stacking a popup window on top of #1 a visible window and
all over. This patch fixes the issue by [re]flushing the terminal.
Signed-off-by: Leandro Dorileo <leandro.maciel.dorileo@intel.com>
Introduce SetColorMap()/GetColorMap() API's. With this the user may
change the termbox's output (i.e with Output256) mode and set a broader
color map.
In the future - if needed - we could introduce an API to switch modes
and automatically remap the colors as required. For now, this API's
are good enough.
Signed-off-by: Leandro Dorileo <leandro.maciel.dorileo@intel.com>
With this helper we may iterate over the control list and end up
not having any control that match the search criteria (namely: tabStop,
visible and enabled). In that case an index out of bounds error will
happen.
This patch checks for the resulting list and return if no control's
found.
Signed-off-by: Leandro Dorileo <leandro.maciel.dorileo@intel.com>
Currently when setting a control visible no matter if this control has
active children new KeyTab events will be dispatched. This results in
errors when an application has explicitly set the active control -
i.e with clui.ActivateControl().
In this case the expected behavior is to have that control active
instead of the next one, since we are not considering the the children
state then we always emit the KeyTab event resulting into a focus/active
status change.
This patch changes this behavior by querying the children's status and
checking if there is a child with active state set and only triggering
the KeyTab event when no child is active.
Signed-off-by: Leandro Dorileo <leandro.maciel.dorileo@intel.com>