2024-09-16 14:11:01 +02:00
|
|
|
#ifndef UI_H_
|
|
|
|
#define UI_H_
|
|
|
|
|
|
|
|
#include <ncurses.h>
|
|
|
|
|
2024-09-26 12:36:37 +02:00
|
|
|
enum modes {
|
|
|
|
NORMAL,
|
|
|
|
INSERT,
|
|
|
|
COMMAND
|
|
|
|
};
|
|
|
|
|
|
|
|
enum windows {
|
|
|
|
USERS_WINDOW,
|
|
|
|
CHAT_WINDOW
|
|
|
|
};
|
|
|
|
|
|
|
|
enum colors {
|
|
|
|
BLUE = 9,
|
|
|
|
GREEN,
|
|
|
|
PEACH,
|
|
|
|
YELLOW,
|
|
|
|
LAVENDER,
|
|
|
|
PINK,
|
|
|
|
MAUVE,
|
|
|
|
RED,
|
|
|
|
SURFACE1
|
|
|
|
};
|
2024-09-18 09:37:02 +02:00
|
|
|
|
2024-09-20 16:51:07 +02:00
|
|
|
/* Key code */
|
2024-09-18 09:37:02 +02:00
|
|
|
#define CTRLA 0x01
|
|
|
|
#define CTRLD 0x04
|
|
|
|
#define CTRLE 0x05
|
2024-09-20 16:51:07 +02:00
|
|
|
#define CTRLX 0x18
|
2024-09-18 09:37:02 +02:00
|
|
|
#define DOWN 0x102
|
|
|
|
#define UP 0x103
|
|
|
|
#define LEFT 0x104
|
|
|
|
#define RIGHT 0x105
|
2024-09-24 20:05:49 +02:00
|
|
|
#define ENTER 0xA
|
2024-09-26 12:36:37 +02:00
|
|
|
#define ESC 0x1B
|
|
|
|
|
|
|
|
#define MAX_ARGS 10
|
2024-09-18 09:37:02 +02:00
|
|
|
|
2024-09-16 14:11:01 +02:00
|
|
|
void ncurses_init();
|
|
|
|
void windows_init();
|
|
|
|
void draw_border(WINDOW *window, bool active);
|
2024-09-18 09:37:02 +02:00
|
|
|
void add_message(uint8_t *author, uint8_t *recipient, uint8_t *content, uint32_t length, time_t creation);
|
|
|
|
void show_chat(uint8_t *recipient);
|
2024-09-16 14:11:01 +02:00
|
|
|
void add_username(char *username);
|
2024-09-24 20:05:49 +02:00
|
|
|
void deinit();
|
2024-09-16 14:11:01 +02:00
|
|
|
void ui();
|
|
|
|
|
|
|
|
#endif
|