aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlessandro Iezzi <aiezzi@alessandroiezzi.it>2023-05-29 22:54:23 +0200
committerAlessandro Iezzi <aiezzi@alessandroiezzi.it>2023-05-29 22:54:23 +0200
commitf36b910104dd6b34d42659eaa0cf63ae8b0dcc58 (patch)
tree73e646449b8fa06339900bba5db1849ef35bf94b
parent5797c9c8f631d87aac9d2d080e0e5eb7fea67c36 (diff)
downloadcherry-f36b910104dd6b34d42659eaa0cf63ae8b0dcc58.tar.gz
cherry-f36b910104dd6b34d42659eaa0cf63ae8b0dcc58.zip
Add new functions to CherryWidget
-rw-r--r--src/widget.c33
-rw-r--r--src/widget.h5
2 files changed, 38 insertions, 0 deletions
diff --git a/src/widget.c b/src/widget.c
index 6cf1b62..ccb59f1 100644
--- a/src/widget.c
+++ b/src/widget.c
@@ -32,7 +32,40 @@ cherry_widget_get_dimension(CherryWidget *widget, int *width, int *height) {
}
void
+cherry_widget_set_dimension(CherryWidget *widget, int width, int height)
+{
+ widget->width = width;
+ widget->height = height;
+}
+
+void
cherry_widget_add_component(CherryWidget *parent, CherryWidget *child)
{
clist_add(&parent->widgets, child);
}
+
+int
+cherry_widget_is_visible(CherryWidget *widget)
+{
+ return widget->visible;
+}
+
+void
+cherry_widget_set_visible(CherryWidget *widget, int visible)
+{
+ widget->visible = visible;
+}
+
+void
+cherry_widget_get_position(CherryWidget *widget, int *x, int *y)
+{
+ *x = widget->x;
+ *y = widget->y;
+}
+
+void
+cherry_widget_set_position(CherryWidget *widget, int x, int y)
+{
+ widget->x = x;
+ widget->y = y;
+}
diff --git a/src/widget.h b/src/widget.h
index c7cc757..c324e0b 100644
--- a/src/widget.h
+++ b/src/widget.h
@@ -24,5 +24,10 @@ typedef struct CherryWidget {
CherryWidget *cherry_widget_new(void);
void cherry_widget_get_dimension(CherryWidget *, int *, int *);
+void cherry_widget_set_dimension(CherryWidget *, int, int);
+int cherry_widget_is_visible(CherryWidget *);
+void cherry_widget_set_visible(CherryWidget *, int);
+void cherry_widget_get_position(CherryWidget *, int *, int *);
+void cherry_widget_set_position(CherryWidget *, int, int);
#endif /* __CHERRY_WIDGET_H__ */