aboutsummaryrefslogtreecommitdiff
path: root/ui.h
diff options
context:
space:
mode:
authorRandy Palamar <randy@rnpnr.xyz>2024-05-12 11:28:56 -0600
committerRandy Palamar <randy@rnpnr.xyz>2024-05-21 20:21:46 -0600
commit54b3babf49ac75fce78815ae1d7a19f3def69660 (patch)
tree2808906457e0e09abeac6301ff874b887ae41695 /ui.h
parent06d7681cfffbc3e982fe192db4190f124b2b0848 (diff)
downloadvis-54b3babf49ac75fce78815ae1d7a19f3def69660.tar.gz
vis-54b3babf49ac75fce78815ae1d7a19f3def69660.tar.xz
replace UiTermWin with UiWin & remove function pointers
Diffstat (limited to 'ui.h')
-rw-r--r--ui.h25
1 files changed, 17 insertions, 8 deletions
diff --git a/ui.h b/ui.h
index 45b6065..3a4bb8b 100644
--- a/ui.h
+++ b/ui.h
@@ -12,6 +12,7 @@
typedef struct Ui Ui;
typedef struct UiWin UiWin;
+typedef struct UiTerm UiTerm;
enum UiLayout {
UI_LAYOUT_HORIZONTAL,
@@ -96,16 +97,24 @@ struct Ui {
};
struct UiWin {
- void (*style_set)(UiWin*, Cell*, enum UiStyle);
- bool (*style_set_pos)(UiWin*, int x, int y, enum UiStyle);
- void (*status)(UiWin*, const char *txt);
- void (*options_set)(UiWin*, enum UiOption);
- enum UiOption (*options_get)(UiWin*);
- bool (*style_define)(UiWin*, int id, const char *style);
- int (*window_width)(UiWin*);
- int (*window_height)(UiWin*);
+ UiTerm *ui; /* ui which manages this window */
+ Win *win; /* editor window being displayed */
+ int id; /* unique identifier for this window */
+ int width, height; /* window dimension including status bar */
+ int x, y; /* window position */
+ int sidebar_width; /* width of the sidebar showing line numbers etc. */
+ UiWin *next, *prev; /* pointers to neighbouring windows */
+ enum UiOption options; /* display settings for this window */
};
+#define UI_OPTIONS_GET(ui) ((ui) ? (ui)->options : 0)
+
+bool ui_style_define(UiWin *win, int id, const char *style);
+bool ui_window_style_set_pos(UiWin *win, int x, int y, enum UiStyle id);
+void ui_window_style_set(UiWin *win, Cell *cell, enum UiStyle id);
+
enum UiLayout ui_layout_get(Ui *ui);
+void ui_window_options_set(UiWin *win, enum UiOption options);
+void ui_window_status(UiWin *win, const char *status);
#endif