1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
|
#pragma once
#include <al/types.h>
#include <al/array.h>
#include <al/wstr.h>
#include <nnwt/event_loop.h>
#include <nnwt/timer.h>
#include <notcurses/notcurses.h>
#include "panes/list.h"
#include "panes/log.h"
enum {
CMC_PANE_LIST = 0,
CMC_PANE_SEARCH,
CMC_PANE_LOG
};
struct cmc;
struct cmc_ui {
struct notcurses *nc;
struct nn_event_loop *loop;
u32 term_cols;
u32 term_rows;
u8 pane;
bool layed_out;
struct ncplane *n; // window.
struct ncplane *oln; // overlay.
bool overlay_shown;
u32 last_mouse_x;
u32 last_mouse_y;
u64 last_mouse_ts;
struct cmc_list_pane lists;
struct cmc_log_pane log;
struct nn_poll input_poll;
struct nn_timer render_timer;
struct cmc *c;
};
#define CONSIDER_INPUT() \
if (!cmc_ui_consider_input(input, false)) return false
#define CONSIDER_INPUT_REPEAT() \
if (!cmc_ui_consider_input(input, true)) return false
#define CONSIDER_INPUT_MOD_CTRL() \
if (!input->ctrl) return false;
void cmc_ui_putnwstr_yx(struct ncplane *n, u32 y, u32 x, u32 width, wstr *w);
void cmc_ui_putnstr_yx(struct ncplane *n, u32 y, u32 x, u32 width, str *s);
bool cmc_ui_consider_input(struct ncinput *input, bool repeat);
bool cmc_ui_init(struct cmc_ui *ui, struct nn_event_loop *loop, struct cmc *c);
void cmc_ui_queue_render(struct cmc_ui *ui);
void cmc_ui_toggle_overlay(struct cmc_ui *ui);
void cmc_ui_close(struct cmc_ui *ui);
|