@@ -12,27 +12,14 @@ using cycfi::artist::rgba;
12
12
auto constexpr bkd_color = rgba(35 , 35 , 37 , 255 );
13
13
auto background = box(bkd_color);
14
14
15
- template <size_t Size >
16
- struct fixed_size_base : default_label
15
+ inline auto make_icon_label (std::string name, int i)
17
16
{
18
- view_limits limits (const basic_context &ctx) const override
19
- {
20
- point size = measure_text (ctx.canvas , " 9" ,get_font ());
21
- size.x *= Size ;
22
- return {{size.x , size.y }, {size.x , size.y }};
23
- }
24
- };
25
-
26
- template <size_t Size >
27
- using basic_fixed_size = basic_label_base<fixed_size_base<Size >>;
28
-
29
- template <size_t Size >
30
- using fixed_size_label = label_gen<basic_fixed_size<Size >>;
31
-
32
- inline auto make_icon_label (std::string name, int i)
33
- {
34
- auto h = htile (fixed_size_label<10 >(name), hspace (50 ), icon_button (i,1 ));
35
- return share (h);
17
+ auto h =
18
+ htile (
19
+ label (name),
20
+ align_right (hsize (64 , icon (i)))
21
+ );
22
+ return share (h);
36
23
}
37
24
38
25
int main (int argc, char * argv[])
@@ -130,12 +117,13 @@ int main(int argc, char* argv[])
130
117
comp.push_back (make_icon_label (" unlink" , icons::unlink ));
131
118
comp.push_back (make_icon_label (" folder_open" , icons::folder_empty));
132
119
comp.push_back (make_icon_label (" folder_open_empty" , icons::folder_open_empty));
120
+
133
121
view_.content (
134
- margin ({10 , 10 , 10 , 10 },
135
- vscroller (margin ({40 , 20 , 40 , 20 }, comp))),
136
- // Add more content layers here. The order
137
- // specifies the layering. The lowest layer
138
- // is at the bottom of this list.
122
+ margin ({10 , 10 , 10 , 10 },
123
+ vscroller (margin ({10 , 10 , 30 , 10 }, comp))),
124
+ // Add more content layers here. The order
125
+ // specifies the layering. The lowest layer
126
+ // is at the bottom of this list.
139
127
140
128
background // Replace background with your main element,
141
129
// or keep it and add another layer on top of it.
0 commit comments