summaryrefslogtreecommitdiff
path: root/framebuffer/fbtk/fbtk.c
diff options
context:
space:
mode:
Diffstat (limited to 'framebuffer/fbtk/fbtk.c')
-rw-r--r--framebuffer/fbtk/fbtk.c44
1 files changed, 44 insertions, 0 deletions
diff --git a/framebuffer/fbtk/fbtk.c b/framebuffer/fbtk/fbtk.c
index db298ebdc..8e8bc112c 100644
--- a/framebuffer/fbtk/fbtk.c
+++ b/framebuffer/fbtk/fbtk.c
@@ -220,6 +220,28 @@ fbtk_set_pos_and_size(fbtk_widget_t *widget,
return false;
}
+
+/* exported function docuemnted in fbtk.h */
+void
+fbtk_set_caret(fbtk_widget_t *widget, bool set,
+ int x, int y, int height)
+{
+ fbtk_widget_t *root;
+
+ assert(widget != NULL);
+ root = fbtk_get_root_widget(widget);
+
+ if (set) {
+ root->u.root.caret.owner = widget;
+ root->u.root.caret.x = x;
+ root->u.root.caret.y = y;
+ root->u.root.caret.height = height;
+
+ } else {
+ root->u.root.caret.owner = NULL;
+ }
+}
+
/* exported function documented in fbtk.h */
int
fbtk_destroy_widget(fbtk_widget_t *widget)
@@ -429,6 +451,27 @@ fbtk_get_bbox(fbtk_widget_t *widget, nsfb_bbox_t *bbox)
return true;
}
+bool
+fbtk_get_caret(fbtk_widget_t *widget, int *x, int *y, int *height)
+{
+ fbtk_widget_t *root = fbtk_get_root_widget(widget);
+
+ if (root->u.root.caret.owner == widget) {
+ *x = root->u.root.caret.x;
+ *y = root->u.root.caret.y;
+ *height = root->u.root.caret.height;
+
+ return true;
+
+ } else {
+ *x = 0;
+ *y = 0;
+ *height = 0;
+
+ return false;
+ }
+}
+
/* exported function documented in fbtk.h */
fbtk_widget_t *
fbtk_get_widget_at(fbtk_widget_t *nwid, int x, int y)
@@ -727,6 +770,7 @@ fbtk_init(nsfb_t *fb)
root->type = FB_WIDGET_TYPE_ROOT;
root->u.root.fb = fb;
+ root->u.root.caret.owner = NULL;
nsfb_get_geometry(fb, &root->width, &root->height, NULL);