From cc1f6d08e843a2d80e7d536ff71535aaca15f318 Mon Sep 17 00:00:00 2001 From: pacien Date: Mon, 4 Dec 2017 16:21:26 +0100 Subject: Add GUI spec draft Signed-off-by: pacien --- include/gui/button.h | 16 ++++++++++++++++ include/gui/group.h | 19 +++++++++++++++++++ include/gui/pictureframe.h | 22 ++++++++++++++++++++++ include/gui/textview.h | 20 ++++++++++++++++++++ include/gui/window.h | 26 ++++++++++++++++++++++++++ 5 files changed, 103 insertions(+) create mode 100644 include/gui/button.h create mode 100644 include/gui/group.h create mode 100644 include/gui/pictureframe.h create mode 100644 include/gui/textview.h create mode 100644 include/gui/window.h (limited to 'include') diff --git a/include/gui/button.h b/include/gui/button.h new file mode 100644 index 0000000..62f75a3 --- /dev/null +++ b/include/gui/button.h @@ -0,0 +1,16 @@ +#ifndef UPEM_MORPHING_BUTTON +#define UPEM_MORPHING_BUTTON + +/** + * File: button.h + */ + +typedef struct { + Component component; +} Button; + +void button_init(Button *button, char *text); + +void button_free(Button *button); + +#endif diff --git a/include/gui/group.h b/include/gui/group.h new file mode 100644 index 0000000..6914d55 --- /dev/null +++ b/include/gui/group.h @@ -0,0 +1,19 @@ +#ifndef UPEM_MORPHING_GROUP +#define UPEM_MORPHING_GROUP + +/** + * File: group.h + */ + +typedef struct { + Component component; + Component *sub_components; +} Group; + +void group_init(Group *group, int padding); + +void group_free(Group *group); + +void group_add_component(Group *group, Component *component); + +#endif diff --git a/include/gui/pictureframe.h b/include/gui/pictureframe.h new file mode 100644 index 0000000..59aaf3b --- /dev/null +++ b/include/gui/pictureframe.h @@ -0,0 +1,22 @@ +#ifndef UPEM_MORPHING_PITUREFRAME +#define UPEM_MORPHING_PITUREFRAME + +/** + * File: pictureframe.h + */ + +typedef struct { + Component component; +} PictureFrame; + +void pictureframe_init(PictureFrame *pictureFrame, int length); + +void pictureframe_free(PictureFrame *pictureFrame); + +void pictureframe_draw_canvas(PictureFrame *pictureFrame, Canvas *canvas); + +void pictureframe_draw_triangulation(PictureFrame *pictureFrame, void *triangulation); + +void pictureframe_draw_point(PictureFrame *pictureFrame, int x_pos, int y_pos); + +#endif diff --git a/include/gui/textview.h b/include/gui/textview.h new file mode 100644 index 0000000..7a07eb3 --- /dev/null +++ b/include/gui/textview.h @@ -0,0 +1,20 @@ +#ifndef UPEM_MORPHING_TEXTVIEW +#define UPEM_MORPHING_TEXTVIEW + +/** + * File: textview.h + */ + +typedef struct { + Component component; + int length; + char *text; +} TextView; + +void textview_init(TextView *textview, int length); + +void textview_free(TextView *textview); + +void textview_set_text(TextView *textView, char *text); + +#endif diff --git a/include/gui/window.h b/include/gui/window.h new file mode 100644 index 0000000..9394c84 --- /dev/null +++ b/include/gui/window.h @@ -0,0 +1,26 @@ +#ifndef UPEM_MORPHING_WINDOW +#define UPEM_MORPHING_WINDOW + +/** + * File: window.h + */ + +typedef void (*ClickHandler)(int x_pos, int y_pos); + +typedef struct { + int width, height; + ClickHandler click_handler; +} Component; + +typedef struct { + int width, height; + Component *components; +} Window; + +void window_init(Window *window, int width, int height, char *title); + +void window_free(Window *window); + +void window_add_component(Window *window, Component *component, int x_pos, int y_pos); + +#endif -- cgit v1.2.3