aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/widget.c28
1 files changed, 28 insertions, 0 deletions
diff --git a/src/widget.c b/src/widget.c
new file mode 100644
index 0000000..e734cb6
--- /dev/null
+++ b/src/widget.c
@@ -0,0 +1,28 @@
+/* See LICENSE file for copyright and license details. */
+
+#include <stdlib.h>
+#include "widget.h"
+
+CherryWidget *
+cherry_widget_new(void)
+{
+ CherryWidget *comp = malloc(sizeof(*comp));
+ comp->x = 0;
+ comp->y = 0;
+ comp->components = clist_create();
+ comp->draw = NULL;
+ comp->dimension = cherry_dimension_new();
+
+ return comp;
+}
+
+CherryDimension *
+cherry_widget_get_dimension(CherryWidget *comp) {
+ return comp->dimension;
+}
+
+void
+cherry_widget_add_component(CherryWidget *parent, CherryWidget *child)
+{
+ clist_add(&parent->components, child);
+}