From 2c10cb38e2816c5f367fd891c25f1b18da3ea07f Mon Sep 17 00:00:00 2001 From: toni Date: Fri, 5 Dec 2014 13:03:48 +0100 Subject: - preparing majore update (ui_input) .. --- ui.c | 5 +++++ ui_input.c | 4 +++- ui_input.h | 6 +++--- 3 files changed, 11 insertions(+), 4 deletions(-) diff --git a/ui.c b/ui.c index 280f85b..a72a69a 100644 --- a/ui.c +++ b/ui.c @@ -9,6 +9,7 @@ #include "ui.h" #include "ui_ani.h" +#include "ui_input.h" static WINDOW *wnd_main; @@ -148,6 +149,7 @@ stop_ui_thrd(void) { int main(int argc, char **argv) { + struct input *pw_input = init_input(true, true, "PASSWORD", 128); struct anic *heartbeat = init_anic(2,2); struct anic *a = init_anic(4,4); struct anic *b = init_anic(6,6); @@ -156,6 +158,7 @@ main(int argc, char **argv) register_anic(heartbeat, A_BOLD | COLOR_PAIR(3)); register_anic(a,0); register_anic(b,COLOR_PAIR(1)); + register_input(pw_input, COLOR_PAIR(2), 5, 5, 10, 5); if (run_ui_thrd() != 0) { exit(EXIT_FAILURE); } @@ -164,6 +167,8 @@ sleep(5); unregister_ui_elt(a); unregister_ui_elt(heartbeat); unregister_ui_elt(b); + unregister_ui_elt(pw_input); + free_input(pw_input); free_anic(heartbeat); free_anic(a); free_anic(b); return (0); diff --git a/ui_input.c b/ui_input.c index 3340e6b..261ebf8 100644 --- a/ui_input.c +++ b/ui_input.c @@ -36,6 +36,8 @@ input_cb(WINDOW *win, void *data, bool needs_update) } void -register_input(struct input *a, chtype attr) +register_input(struct input *a, unsigned int x, unsigned int y, unsigned int width, unsigned int height, chtype attr) { + WINDOW *wnd = newwin(y, x, width, height); + register_ui_elt(input_cb, (void *) a, wnd, attr); } diff --git a/ui_input.h b/ui_input.h index a586d15..aa4605c 100644 --- a/ui_input.h +++ b/ui_input.h @@ -1,5 +1,5 @@ -#ifndef UI_ANIC_H -#define UI_ANIC_H 1 +#ifndef UI_INPUT_H +#define UI_INPUT_H 1 #include @@ -21,6 +21,6 @@ int input_cb(WINDOW *win, void *data, bool needs_update); void -register_input(struct input *a, chtype attr); +register_input(struct input *a, unsigned int x, unsigned int y, unsigned int width, unsigned int height, chtype attr); #endif -- cgit v1.2.3