moving items between lists
[taskasaur.git] / render.c
1
2 #include "headers/render.h"
3 #include <string.h>
4 #include "config.h"
5
6 int init_tscolors(void);
7
8 int create_todowin(void);
9
10 /* init stuff */
11 int
12 init_tscurses(void)
13 {
14     initscr();
15     cbreak();
16     curs_off();
17     keypad(stdscr, TRUE);
18
19     /* need to error check this */
20     if (has_colors() == FALSE) {
21         fprintf(stderr, "Your terminal does not support color.\n");
22
23         /* maybe just return 1 */
24         /* exit_tscurses(); */
25         /* exit(1); */
26         return 1;
27     }
28     start_color();
29     init_tscolors();
30
31     return 0;
32 }
33
34 int
35 exit_tscurses(void)
36 {
37     endwin();
38
39     return 0;
40 }
41
42 int
43 init_tscolors(void)
44 {
45     init_pair(TS_SELECTED, selected_color, COLOR_BLACK);
46     init_pair(TS_NONSELECTED, non_selected_color, COLOR_BLACK);
47     init_pair(TS_MENU_SELECTED, menu_selected_color, COLOR_BLACK);
48     init_pair(TS_MENU_NONSELECTED, menu_non_selected_color, COLOR_BLACK);
49
50     return 0;
51 }
52
53 /* cursor */
54 int
55 curs_on(void)
56 {
57     echo();
58     curs_set(1);
59     return 0;
60 }
61
62 int
63 curs_off(void)
64 {
65     noecho();
66     curs_set(0);
67     return 0;
68 }
69
70 /* wins */
71 int
72 create_todowin(void)
73 {
74
75
76
77     return 0;
78 }
79
80 int
81 ungetstr(char* str)
82 {
83     // ignore null character (it's fine even if strlen = 0)
84     for (int i = strlen(str)-1; i >= 0; i--) {
85         ungetch(str[i]);
86     }
87
88     return 0; 
89 }
90