| |
1 /* |
| |
2 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
| |
3 * |
| |
4 * Copyright 2025 Olaf Wintermann. All rights reserved. |
| |
5 * |
| |
6 * Redistribution and use in source and binary forms, with or without |
| |
7 * modification, are permitted provided that the following conditions are met: |
| |
8 * |
| |
9 * 1. Redistributions of source code must retain the above copyright |
| |
10 * notice, this list of conditions and the following disclaimer. |
| |
11 * |
| |
12 * 2. Redistributions in binary form must reproduce the above copyright |
| |
13 * notice, this list of conditions and the following disclaimer in the |
| |
14 * documentation and/or other materials provided with the distribution. |
| |
15 * |
| |
16 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" |
| |
17 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |
| |
18 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE |
| |
19 * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE |
| |
20 * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR |
| |
21 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF |
| |
22 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS |
| |
23 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN |
| |
24 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) |
| |
25 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE |
| |
26 * POSSIBILITY OF SUCH DAMAGE. |
| |
27 */ |
| |
28 |
| |
29 #ifndef CONTAINER_H |
| |
30 |
| |
31 #include "../ui/container.h" |
| |
32 |
| |
33 #define CONTAINER_H |
| |
34 |
| |
35 #define UI_APPLY_LAYOUT(layout, args) \ |
| |
36 layout.fill = args->fill; \ |
| |
37 layout.hexpand = args->hexpand; \ |
| |
38 layout.vexpand = args->vexpand; \ |
| |
39 layout.hfill = args->hfill; \ |
| |
40 layout.vfill = args->vfill; \ |
| |
41 layout.override_defaults = args->override_defaults; \ |
| |
42 layout.colspan = args->colspan; \ |
| |
43 layout.rowspan = args->rowspan |
| |
44 |
| |
45 typedef struct UiLayout UiLayout; |
| |
46 |
| |
47 struct UiLayout { |
| |
48 UiBool fill; |
| |
49 UiBool newline; |
| |
50 char *label; |
| |
51 UiBool hexpand; |
| |
52 UiBool vexpand; |
| |
53 UiBool hfill; |
| |
54 UiBool vfill; |
| |
55 UiBool override_defaults; |
| |
56 int width; |
| |
57 int colspan; |
| |
58 int rowspan; |
| |
59 }; |
| |
60 |
| |
61 enum UiBoxOrientation { |
| |
62 UI_BOX_VERTICAL = 0, |
| |
63 UI_BOX_HORIZONTAL |
| |
64 }; |
| |
65 typedef enum UiBoxOrientation UiBoxOrientation; |
| |
66 |
| |
67 enum UiContainerType { |
| |
68 UI_CONTAINER_GENERIC = 0, |
| |
69 UI_CONTAINER_TABVIEW |
| |
70 }; |
| |
71 typedef enum UiContainerType UiContainerType; |
| |
72 |
| |
73 typedef struct UiContainerPrivate UiContainerPrivate; |
| |
74 |
| |
75 typedef struct UiRect { |
| |
76 int x; |
| |
77 int y; |
| |
78 int width; |
| |
79 int height; |
| |
80 } UiRect; |
| |
81 |
| |
82 |
| |
83 struct UiContainerPrivate { |
| |
84 UiContainerX container; |
| |
85 void (*prepare)(UiContainerPrivate*, UiRect*); |
| |
86 void (*add)(UiContainerPrivate*, UiRect*, W32Widget*); |
| |
87 UiContainerType type; |
| |
88 UiLayout layout; |
| |
89 }; |
| |
90 |
| |
91 #endif //CONTAINER_H |