hlogin/ui.h
2022-05-20 05:31:14 +00:00

55 lines
1.4 KiB
C

/*
* ui.h - hlogin(1) user interface functions
*
* Copyleft (C) 2022 ~keith <keith@keithhacks.cyou>
*
* This file is part of hlogin.
*
* hlogin is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the
* Free Software Foundation, version 3.
*
* hlogin is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* for more details.
*
* You should have received a copy of the GNU General Public License
* along with hlogin. If not, see <https://www.gnu.org/licenses/>.
*/
#define _XOPEN_SOURCE 600
#ifndef __UI_H
#define __UI_H
#include <ncurses.h>
#include <panel.h>
extern int term_rows, term_cols;
void *safe_realloc(void *ptr, size_t size, size_t new_size);
void safe_free(void *ptr, size_t size);
void ui_init();
void ui_end();
void paint_back();
void paint_login();
void ui_setup_dialog(char *prompt, bool password);
void ui_setup_message(char *text);
int ui_update();
int ui_run();
int ui_message_run();
char *ui_get_text();
void input_add_char(char ch);
void input_backdel_char();
void input_del_char();
void draw_outline(WINDOW *win, int height, int width, int y, int x, bool inset);
char **word_wrap(char *text, int width, int max_word, int *lines);
#endif // __UI_H