| 1 |
/* SPDX-License-Identifier: GPL-3.0-or-later */
|
| 2 |
/*
|
| 3 |
* screen
|
| 4 |
* - advanced telnet-based user interactive input / output features
|
| 5 |
*
|
| 6 |
* Copyright (C) 2004-2026 Leaflet <leaflet@leafok.com>
|
| 7 |
*/
|
| 8 |
|
| 9 |
#ifndef _SCREEN_H_
|
| 10 |
#define _SCREEN_H_
|
| 11 |
|
| 12 |
#include "io.h"
|
| 13 |
#include <stddef.h>
|
| 14 |
|
| 15 |
extern const char CTRL_SEQ_CLR_LINE[];
|
| 16 |
|
| 17 |
enum display_constant_t
|
| 18 |
{
|
| 19 |
MSG_EXT_MAX_LEN = 400,
|
| 20 |
};
|
| 21 |
|
| 22 |
struct display_ctx_t
|
| 23 |
{
|
| 24 |
int reach_begin;
|
| 25 |
int reach_end;
|
| 26 |
long line_top;
|
| 27 |
long line_bottom;
|
| 28 |
char msg[MSG_EXT_MAX_LEN];
|
| 29 |
};
|
| 30 |
typedef struct display_ctx_t DISPLAY_CTX;
|
| 31 |
|
| 32 |
typedef int (*display_data_key_handler)(int *p_key, DISPLAY_CTX *p_ctx);
|
| 33 |
|
| 34 |
extern void moveto(int row, int col);
|
| 35 |
extern void clrtoeol();
|
| 36 |
extern void clrline(int line_begin, int line_end);
|
| 37 |
extern void clrtobot(int line_begin);
|
| 38 |
extern void clearscr();
|
| 39 |
|
| 40 |
extern int press_any_key();
|
| 41 |
extern int press_any_key_ex(const char *msg, int sec);
|
| 42 |
extern int press_any_key_no_prompt(int sec);
|
| 43 |
|
| 44 |
extern void set_input_echo(int echo);
|
| 45 |
|
| 46 |
extern int str_input(char *buffer, int buffer_length, enum io_echo_t echo_mode);
|
| 47 |
extern int get_data(int row, int col, char *prompt, char *buffer, int buffer_length, int max_display_len);
|
| 48 |
|
| 49 |
// eof_exit = 0 : Do not exit at EOF
|
| 50 |
// 1 : Prompt for any key at EOF, then exit
|
| 51 |
// 2 : Exit at EOF without prompt
|
| 52 |
extern int display_data(const void *p_data, long display_line_total, const long *p_line_offsets, int eof_exit,
|
| 53 |
display_data_key_handler key_handler, const char *help_filename);
|
| 54 |
extern int display_file(const char *filename, int eof_exit);
|
| 55 |
|
| 56 |
extern int display_file_key_handler(int *p_key, DISPLAY_CTX *p_ctx);
|
| 57 |
|
| 58 |
extern int show_top(const char *str_left, const char *str_center, const char *str_right);
|
| 59 |
extern int show_bottom(const char *msg);
|
| 60 |
|
| 61 |
extern int show_active_board();
|
| 62 |
|
| 63 |
#endif //_SCREEN_H_
|