| 1 |
sysadm |
1.1 |
/***************************************************************************
|
| 2 |
|
|
screen.h - description
|
| 3 |
|
|
-------------------
|
| 4 |
sysadm |
1.3 |
copyright : (C) 2004-2025 by Leaflet
|
| 5 |
sysadm |
1.1 |
email : leaflet@leafok.com
|
| 6 |
|
|
***************************************************************************/
|
| 7 |
|
|
|
| 8 |
|
|
/***************************************************************************
|
| 9 |
|
|
* *
|
| 10 |
|
|
* This program is free software; you can redistribute it and/or modify *
|
| 11 |
|
|
* it under the terms of the GNU General Public License as published by *
|
| 12 |
sysadm |
1.3 |
* the Free Software Foundation; either version 3 of the License, or *
|
| 13 |
sysadm |
1.1 |
* (at your option) any later version. *
|
| 14 |
|
|
* *
|
| 15 |
|
|
***************************************************************************/
|
| 16 |
|
|
|
| 17 |
|
|
#ifndef _SCREEN_H_
|
| 18 |
|
|
#define _SCREEN_H_
|
| 19 |
|
|
|
| 20 |
sysadm |
1.11 |
#include <stddef.h>
|
| 21 |
|
|
|
| 22 |
sysadm |
1.7 |
#define CTRL_SEQ_CLR_LINE "\033[K"
|
| 23 |
sysadm |
1.13 |
#define MSG_EXT_MAX_LEN 200
|
| 24 |
sysadm |
1.7 |
|
| 25 |
sysadm |
1.13 |
struct display_ctx_t
|
| 26 |
|
|
{
|
| 27 |
|
|
int reach_begin; // of data
|
| 28 |
|
|
int reach_end; // of data
|
| 29 |
|
|
long line_top; // current screen
|
| 30 |
|
|
long line_bottom; // current screen
|
| 31 |
|
|
char msg[MSG_EXT_MAX_LEN];
|
| 32 |
|
|
};
|
| 33 |
|
|
typedef struct display_ctx_t DISPLAY_CTX;
|
| 34 |
|
|
|
| 35 |
|
|
typedef int (*display_data_key_handler)(int *p_key, DISPLAY_CTX *p_ctx);
|
| 36 |
sysadm |
1.11 |
|
| 37 |
sysadm |
1.1 |
extern void moveto(int row, int col);
|
| 38 |
|
|
extern void clrtoeol();
|
| 39 |
|
|
extern void clrline(int line_begin, int line_end);
|
| 40 |
|
|
extern void clrtobot(int line_begin);
|
| 41 |
|
|
extern void clearscr();
|
| 42 |
|
|
|
| 43 |
|
|
extern int press_any_key();
|
| 44 |
|
|
|
| 45 |
|
|
extern void set_input_echo(int echo);
|
| 46 |
|
|
|
| 47 |
|
|
extern int str_input(char *buffer, int buffer_length, int echo_mode);
|
| 48 |
|
|
extern int get_data(int row, int col, char *prompt, char *buffer, int buffer_length, int echo_mode);
|
| 49 |
|
|
|
| 50 |
sysadm |
1.12 |
// eof_exit = 0 : Do not exit at EOF
|
| 51 |
|
|
// 1 : Prompt for any key at EOF, then exit
|
| 52 |
|
|
// 2 : Exit at EOF without prompt
|
| 53 |
|
|
extern int display_data(const void *p_data, long line_total, const long *p_line_offsets, int begin_line, int eof_exit,
|
| 54 |
sysadm |
1.11 |
display_data_key_handler key_handler, const char *help_filename);
|
| 55 |
sysadm |
1.12 |
extern int display_file(const char *filename, int begin_line, int eof_exit);
|
| 56 |
sysadm |
1.1 |
|
| 57 |
sysadm |
1.9 |
extern int show_top(const char *str_left, const char *str_center, const char *str_right);
|
| 58 |
sysadm |
1.6 |
extern int show_bottom(const char *msg);
|
| 59 |
sysadm |
1.1 |
|
| 60 |
|
|
extern int show_active_board();
|
| 61 |
|
|
|
| 62 |
|
|
#endif //_SCREEN_H_
|