Debian Codegraph @

src/utils/ui.h

raw symbols SCIP
1 // SPDX-License-Identifier: MPL-2.0
2 // Copyright (c) 2024 Yuxuan Shui <[email protected]>
3
4 #include <picom/types.h>
5
6 struct x_connection;
7 struct ui;
8
9 enum ui_colors {
10 UI_COLOR_WHITE,
11 UI_COLOR_YELLOW,
12 UI_COLOR_RED,
13 };
14
15 enum ui_style { UI_STYLE_NORMAL, UI_STYLE_BOLD };
16
17 enum ui_justify { UI_JUSTIFY_LEFT, UI_JUSTIFY_CENTER, UI_JUSTIFY_RIGHT };
18
19 struct ui_message_box_line {
20 enum ui_colors color;
21 enum ui_style style;
22 enum ui_justify justify;
23 ivec2 position;
24 ivec2 size;
25 unsigned pad_bottom;
26 const char *text;
27 };
28
29 struct ui_message_box_content {
30 unsigned num_lines;
31 ivec2 size;
32 unsigned margin;
33 double scale;
34 struct ui_message_box_line lines[];
35 };
36
37 /// Layout the content of a message box.
38 /// @return true if the layout is successful, false if an error occurred.
39 bool ui_message_box_content_plan(struct ui *ui, struct x_connection *c,
40 struct ui_message_box_content *content);
41 bool ui_message_box_show(struct ui *ui, struct x_connection *c,
42 struct ui_message_box_content *content, unsigned timeout);
43 /// Initialize necessary resources for displaying UI.
44 struct ui *ui_new(struct x_connection *c);
45 void ui_destroy(struct ui *ui, struct x_connection *c);