Commit 23cbfe029f21365b190af160604015c5185b6f12

Authored by Alain Prouté
1 parent 75bcd2d5

*** empty log message ***

anubis_dev/library/widgets4/host_window.anubis
... ... @@ -71,6 +71,17 @@ public type WidgetHostWindowState:
71 71 public define Bool
72 72 open_host_window
73 73 (
  74 + Widget root, // content of host window
  75 + Int32 x, // position on screen
  76 + Int32 y,
  77 + String title
  78 + ).
  79 +
  80 + If your widget needs to use the host window state, use the following:
  81 +
  82 +public define Bool
  83 + open_host_window
  84 + (
74 85 WidgetHostWindowState -> Widget root, // content of host window
75 86 Int32 x, // position on screen
76 87 Int32 y,
... ... @@ -78,7 +89,14 @@ public define Bool
78 89 ).
79 90  
80 91  
81   - Below is a variant which centers the window on the screen when it is created:
  92 + Below are variants which centers the window on the screen when it is created:
  93 +
  94 +public define Bool
  95 + open_host_window
  96 + (
  97 + Widget root, // content of host window
  98 + String title
  99 + ).
82 100  
83 101 public define Bool
84 102 open_host_window
... ... @@ -272,8 +290,8 @@ define (HostWindow,HostWindowEvent(One)) -> List(Rectangle)
272 290 [],
273 291  
274 292 pointer_leaving then
275   - mouse_capture_ticket_v <- failure;
276   - keyboard_capture_ticket_v <- failure;
  293 + //mouse_capture_ticket_v <- failure;
  294 + //keyboard_capture_ticket_v <- failure;
277 295 with result = translate(win,
278 296 transmit(event_tool_box(0,0,*pmx_v,*pmy_v))(root_widget,0,0,
279 297 mouse_gone),
... ... @@ -503,7 +521,8 @@ public define Bool
503 521 registration(f) then f(mvtb),
504 522 regs);
505 523  
506   - with buffer = to_host_image(create_rgba_image(root_w>>1,root_h>>1,rgba(0,0,0,0)),1),
  524 + with buffer = to_host_image(create_rgba_image(800,800, //root_w>>1,root_h>>1,
  525 + rgba(0,0,0,0)),1),
507 526  
508 527 with mouse_capture_ticket_v = var((Maybe(Var(One)))failure),
509 528 keyboard_capture_ticket_v = var((Maybe(Var(One)))failure),
... ... @@ -539,6 +558,17 @@ public define Bool
539 558 true
540 559 }.
541 560  
  561 +
  562 +public define Bool
  563 + open_host_window
  564 + (
  565 + Widget root, // content of host window
  566 + Int32 x,
  567 + Int32 y,
  568 + String title
  569 + ) =
  570 + open_host_window((WidgetHostWindowState hws) |-> root,x,y,title).
  571 +
542 572  
543 573 public define Bool
544 574 open_host_window
... ... @@ -560,6 +590,13 @@ public define Bool
560 590 max(0,(sh-rh)>>1),
561 591 title).
562 592  
  593 +public define Bool
  594 + open_host_window
  595 + (
  596 + Widget root, // content of host window
  597 + String title
  598 + ) =
  599 + open_host_window((WidgetHostWindowState hws) |-> root,title).
563 600  
564 601  
565 602  
566 603 \ No newline at end of file
... ...
anubis_dev/library/widgets4/widget_demo.anubis
... ... @@ -134,6 +134,7 @@ define WidgetHostWindowState -&gt; Widget
134 134 Parms p
135 135 ) =
136 136 with grey = rgb(180,180,200),
  137 + height_v = var((Int32)450),
137 138 (WidgetHostWindowState hws) |->
138 139 table(borders(grey,grey,2,1),
139 140 0,0,
... ... @@ -143,8 +144,8 @@ define WidgetHostWindowState -&gt; Widget
143 144 text(the_title,title_font(p),title_color(p),10))
144 145 ],
145 146 [
146   - cell(window(grey,250,500,make_index(p,root_item(p)))),
147   - cell(window(grey,600,500,variable(content_v(p))))
  147 + cell(window(grey,var(250),height_v,make_index(p,root_item(p)))),
  148 + cell(window(grey,var(600),height_v,variable(content_v(p))))
148 149 ]
149 150 ]).
150 151  
... ...
anubis_dev/library/widgets4/widget_test.anubis
... ... @@ -299,7 +299,7 @@ global define One
299 299 ) =
300 300 forget(open_host_window
301 301 (
302   - (WidgetHostWindowState hws) |-> window(rgb(230,230,100),
  302 + window(rgb(180,180,180),
303 303 200,200,
304 304 image(load_jpg("images/cows.jpg"))),
305 305 "Window Test"
... ...
anubis_dev/library/widgets4/window.anubis
... ... @@ -21,15 +21,28 @@ public define Widget
21 21 window
22 22 (
23 23 RGB color, // of scrollbars
24   - Int32 width, // of window
25   - Int32 height, // of window
  24 + Int32 width, // initial width of window
  25 + Int32 height, // initial height of window
26 26 Widget content
27 27 ).
28 28  
  29 +public define Widget
  30 + window
  31 + (
  32 + RGB color, // of scrollbars
  33 + Var(Int32) width_v,
  34 + Var(Int32) height_v,
  35 + Widget content
  36 + ).
  37 +
  38 +
29 39 --- That's all for the public part ! --------------------------------------------------
30 40  
31 41  
32 42  
  43 +
  44 +
  45 +
33 46 read table.anubis
34 47 read simple_window.anubis
35 48 read scrollbar.anubis
... ... @@ -39,15 +52,12 @@ read resizer.anubis
39 52 public define Widget
40 53 window
41 54 (
42   - RGB color, // of scrollbars
43   - Int32 width, // of window
44   - Int32 height, // of window
45   - Widget content
  55 + RGB color, // of scrollbars
  56 + Var(Int32) width_v, // of window
  57 + Var(Int32) height_v, // of window
  58 + Widget content
46 59 ) =
47   - with width_v = var(width),
48   - height_v = var(height),
49   -
50   - x_scroll_v = var((Int32)0),
  60 + with x_scroll_v = var((Int32)0),
51 61 y_scroll_v = var((Int32)0),
52 62  
53 63 content_width_v = var((Int32)0),
... ... @@ -100,4 +110,12 @@ public define Widget
100 110 ]
101 111 ]).
102 112  
103   -
104 113 \ No newline at end of file
  114 +public define Widget
  115 + window
  116 + (
  117 + RGB color, // of scrollbars
  118 + Int32 width, // of window
  119 + Int32 height, // of window
  120 + Widget content
  121 + ) =
  122 + window(color,var(width),var(height),content).
105 123 \ No newline at end of file
... ...