Commit 9e6807641c553f9856df397b2abb8d2959d1b372
1 parent
1fe9a3b0
*** empty log message ***
Showing
1 changed file
with
51 additions
and
3 deletions
Show diff stats
anubis_dev/library/widgets4/widget_test.anubis
| ... | ... | @@ -29,6 +29,7 @@ read window.anubis |
| 29 | 29 | read tree_node.anubis |
| 30 | 30 | read button.anubis |
| 31 | 31 | |
| 32 | + | |
| 32 | 33 | read trace.anubis |
| 33 | 34 | |
| 34 | 35 | |
| ... | ... | @@ -167,7 +168,40 @@ define WidgetHostWindowState -> Widget |
| 167 | 168 | offset_v, |
| 168 | 169 | window_size_v)) |
| 169 | 170 | ] |
| 170 | - ]). | |
| 171 | + ]). | |
| 172 | + | |
| 173 | + | |
| 174 | +define WidgetHostWindowState -> Widget | |
| 175 | + root_widget_3 | |
| 176 | + ( | |
| 177 | + SystemFont font, | |
| 178 | + Var(String) justify | |
| 179 | + ) = | |
| 180 | + | |
| 181 | + with | |
| 182 | + black = rgb(0,0,0), | |
| 183 | + red = rgb(255,0,0), | |
| 184 | + | |
| 185 | + print((if *justify = "l" then "LEFT" else "RIGHT")+"\n"); | |
| 186 | + | |
| 187 | + (WidgetHostWindowState hws) |-> | |
| 188 | + table(borders(rgb(200,255,150),rgb(180,180,180),2,2),2,2, | |
| 189 | + [[ | |
| 190 | + cell(text("Justify",font,rgb(60,90,30),2)), | |
| 191 | + cell(button( | |
| 192 | + (One u) |-> link("left",font,black,red), | |
| 193 | + (One u) |-> blocking, | |
| 194 | + (One u) |-> justify <- "l", | |
| 195 | + [register(justify)])), | |
| 196 | + cell(button( | |
| 197 | + (One u) |-> link("right",font,black,red), | |
| 198 | + (One u) |-> blocking, | |
| 199 | + (One u) |-> justify <- "r", | |
| 200 | + [register(justify)])), | |
| 201 | + cell(text(if *justify = "l" then "LEFT" else "RIGHT",font,black,2)) | |
| 202 | + ] | |
| 203 | + ]). | |
| 204 | + | |
| 171 | 205 | |
| 172 | 206 | define HostImage |
| 173 | 207 | load_jpg |
| ... | ... | @@ -196,13 +230,18 @@ global define One |
| 196 | 230 | n_v = var((Int32)10), |
| 197 | 231 | color_v = var((RGB)rgb(50,100,130)), |
| 198 | 232 | widget_v = var((Widget)space(5,40,*color_v)), |
| 233 | + | |
| 199 | 234 | widget_ticket = register_monitor(widget_v, |
| 200 | 235 | (One u) |-> if *n_v = 0 then unique else |
| 201 | 236 | (sleep(1000); |
| 202 | 237 | n_v <- *n_v-1; |
| 203 | 238 | if *color_v is rgb(r,g,b) then |
| 204 | 239 | color_v <- rgb(g,b,r); |
| 205 | - widget_v <- space(5,40,*color_v))), | |
| 240 | + widget_v <- space(5,40,*color_v))), | |
| 241 | + | |
| 242 | + with justify = var((String)"l"), | |
| 243 | + | |
| 244 | + | |
| 206 | 245 | if image("images/cows.jpg") is |
| 207 | 246 | { |
| 208 | 247 | failure then print("Image './images/cows.jpg' not found.\n"), |
| ... | ... | @@ -235,12 +274,21 @@ global define One |
| 235 | 274 | 630, |
| 236 | 275 | 100, |
| 237 | 276 | "Widget Test 2")); |
| 277 | + | |
| 278 | + if load_system_font("helvetica_medium_r_10") is | |
| 279 | + { | |
| 280 | + failure then print("Cannot load system font.\n"), | |
| 281 | + success(font) then | |
| 282 | + forget(open_host_window( | |
| 283 | + root_widget_3(font,justify), | |
| 284 | + 300,100, | |
| 285 | + "Widget Test 3 (Hypertext)")) | |
| 286 | + }; | |
| 238 | 287 | widget_v <- space(5,40,*color_v) |
| 239 | 288 | } |
| 240 | 289 | }. |
| 241 | 290 | |
| 242 | 291 | |
| 243 | - | |
| 244 | 292 | |
| 245 | 293 | *** [] The test. |
| 246 | 294 | ... | ... |