@@ -1402,3 +1402,16 @@ int widget_focus_y(struct nc_widget *widget)
return widget->focus_y;
}
+struct nc_widget *current_widget(struct nc_widgetset *set)
+{
+ FIELD *f;
+
+ f = current_field(set->form);
+
+ if (!f) {
+ pb_debug_fn("No field is selected!\n");
+ return NULL;
+ }
+
+ return field_userptr(f);
+}
@@ -90,6 +90,7 @@ int widget_width(struct nc_widget *widget);
int widget_y(struct nc_widget *widget);
int widget_x(struct nc_widget *widget);
int widget_focus_y(struct nc_widget *widget);
+struct nc_widget *current_widget(struct nc_widgetset *set);
/* widgetset API */
typedef void (*widget_focus_cb)(struct nc_widget *widget, void *arg);
Signed-off-by: Samuel Mendoza-Jonas <sam@mendozajonas.com> --- ui/ncurses/nc-widgets.c | 13 +++++++++++++ ui/ncurses/nc-widgets.h | 1 + 2 files changed, 14 insertions(+)