summaryrefslogtreecommitdiff
path: root/src/draw.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/draw.c')
-rw-r--r--src/draw.c26
1 files changed, 25 insertions, 1 deletions
diff --git a/src/draw.c b/src/draw.c
index 57e0021..d19a45b 100644
--- a/src/draw.c
+++ b/src/draw.c
@@ -3,8 +3,12 @@
#include <stdlib.h>
#include "draw.h"
+#include "entry.h"
+#include "group.h"
-void tui_init(Group **groups, Entry **entries) {
+void draw_data(Group **groups, int g_count, Entry **entries, int e_count, int start_x, int start_y);
+
+void tui_init(Group **groups, int g_count, Entry **entries, int e_count) {
int input; // capture user input
WINDOW *w_main;
@@ -24,6 +28,7 @@ void tui_init(Group **groups, Entry **entries) {
wrefresh(w_main);
// draw groups and entries
+ draw_data(groups, g_count, entries, e_count, 1, 1);
input = getch();
tui_end();
@@ -34,3 +39,22 @@ void tui_init(Group **groups, Entry **entries) {
void tui_end() {
endwin();
}
+
+
+
+void draw_data(Group **groups, int g_count, Entry **entries, int e_count, int start_x, int start_y) {
+ int i;
+ int j;
+
+ for(i = 0; i < g_count; ++i) {
+ mvprintw(start_y, start_x, "%s", group_get_name(&((*groups)[i])));
+ ++start_y;
+ for(j = 0; j < e_count; ++j) {
+ if(entry_get_group_id(&((*entries)[j])) == group_get_id(&((*groups)[i]))) {
+ mvprintw(start_y, start_x, "\t%s", entry_get_title(&((*entries)[i])));
+ ++start_y;
+ }
+ }
+ ++start_y;
+ }
+}