quickwin 2.2.0 → 2.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (111) hide show
  1. package/README.en.md +7 -7
  2. package/README.md +7 -7
  3. package/constants.ts +1063 -0
  4. package/enum_map.d.ts +129 -0
  5. package/examples/PdfCanvas.js +2 -2
  6. package/examples/PdfCanvas.tsx +3 -2
  7. package/examples/{execd.js → execd/main.js} +563 -122
  8. package/examples/execd/tray.js +192 -0
  9. package/examples/{execd_worker.js → execd/worker.js} +7 -7
  10. package/examples/pdf_preview2.js +46 -46
  11. package/examples/pdf_preview2.ts +55 -54
  12. package/examples/pdf_viewer.js +34 -19
  13. package/examples/pdf_viewer.tsx +6 -5
  14. package/examples/test_gallery.js +35 -20
  15. package/examples/test_gallery.tsx +9 -8
  16. package/examples/test_react_lazy.js +34 -19
  17. package/examples/test_react_lazy.tsx +7 -6
  18. package/examples/test_react_listbox.js +34 -19
  19. package/examples/test_react_listbox.tsx +8 -7
  20. package/examples/test_root_window.js +34 -19
  21. package/examples/test_root_window.tsx +5 -5
  22. package/examples/test_tab.js +34 -19
  23. package/examples/test_tab.tsx +7 -6
  24. package/examples/tray_demo.js +8 -8
  25. package/examples/tray_demo.tsx +9 -8
  26. package/lib/dumpRects.js +2 -2
  27. package/lib/dumpRects.ts +3 -2
  28. package/lib/fetch.js +15 -15
  29. package/lib/fetch.ts +16 -15
  30. package/lib/ffi/bind.js +3 -3
  31. package/lib/ffi/bind.ts +3 -3
  32. package/lib/http-server.js +4 -4
  33. package/lib/http-server.ts +5 -4
  34. package/lib/react-qw/components/Button.js +2 -2
  35. package/lib/react-qw/components/CheckBox.js +4 -4
  36. package/lib/react-qw/components/ComboBox.js +10 -10
  37. package/lib/react-qw/components/DateTimePicker.js +12 -12
  38. package/lib/react-qw/components/Input.js +7 -7
  39. package/lib/react-qw/components/Link.js +4 -4
  40. package/lib/react-qw/components/ListBox.js +12 -12
  41. package/lib/react-qw/components/ListView.js +35 -35
  42. package/lib/react-qw/components/PathPicker.js +3 -3
  43. package/lib/react-qw/components/ProgressBar.js +4 -4
  44. package/lib/react-qw/components/RadioButton.js +4 -4
  45. package/lib/react-qw/components/ScrollView.js +28 -28
  46. package/lib/react-qw/components/Slider.js +11 -11
  47. package/lib/react-qw/components/Tab.js +10 -10
  48. package/lib/react-qw/components/Tooltip.js +8 -8
  49. package/lib/react-qw/components/TreeView.js +20 -20
  50. package/lib/react-qw/index.js +5 -5
  51. package/lib/react-qw/index.ts +6 -5
  52. package/lib/react-qw/props.js +4 -4
  53. package/lib/react-qw/props.ts +5 -4
  54. package/lib/react-qw/reconciler.js +10 -10
  55. package/lib/react-qw/reconciler.ts +11 -10
  56. package/lib/text-measure.js +3 -3
  57. package/lib/text-measure.ts +4 -3
  58. package/lib/websocket.js +17 -17
  59. package/lib/websocket.ts +18 -17
  60. package/lib/windows/advapi32.js +7 -7
  61. package/lib/windows/advapi32.ts +7 -7
  62. package/lib/windows/gdi32.js +16 -16
  63. package/lib/windows/gdi32.ts +16 -16
  64. package/lib/windows/kernel32.js +41 -2
  65. package/lib/windows/kernel32.ts +45 -2
  66. package/lib/windows/shell32.js +24 -3
  67. package/lib/windows/shell32.ts +27 -4
  68. package/lib/windows/structs.js +54 -0
  69. package/lib/windows/structs.ts +63 -1
  70. package/lib/windows/user32.js +18 -6
  71. package/lib/windows/user32.ts +18 -6
  72. package/lib/windows/winspool.js +3 -3
  73. package/lib/windows/winspool.ts +3 -3
  74. package/package.json +4 -3
  75. package/quickwin.d.ts +32 -10
  76. package/qwin-nowasm-x86.exe +0 -0
  77. package/qwin-nowasm.exe +0 -0
  78. package/qwin-x86.exe +0 -0
  79. package/qwin.exe +0 -0
  80. package/test/test_ffi_bind.js +7 -7
  81. package/test/test_ffi_bind.ts +8 -8
  82. package/test/test_ffi_struct.js +2 -2
  83. package/test/test_ffi_struct.ts +3 -3
  84. package/test/test_ffi_windows.js +1 -1
  85. package/test/test_ffi_windows.ts +1 -1
  86. package/test/test_files.js +7 -7
  87. package/test/test_files.ts +8 -8
  88. package/test/test_gdi_draw.js +51 -51
  89. package/test/test_gdi_draw.ts +57 -57
  90. package/test/test_http_server.js +3 -3
  91. package/test/test_http_server.ts +4 -3
  92. package/test/test_ipv6.js +3 -3
  93. package/test/test_ipv6.ts +4 -3
  94. package/test/test_net_event.js +3 -3
  95. package/test/test_net_event.ts +4 -3
  96. package/test/test_printer.js +4 -4
  97. package/test/test_printer.ts +5 -5
  98. package/test/test_react_complex.js +36 -21
  99. package/test/test_react_counter.js +34 -19
  100. package/test/test_react_flex.js +36 -21
  101. package/test/test_react_hidden.js +34 -19
  102. package/test/test_react_listview_link.js +35 -20
  103. package/test/test_react_notify.js +52 -37
  104. package/test/test_react_render.js +34 -19
  105. package/test/test_registry.js +6 -6
  106. package/test/test_registry.ts +8 -8
  107. package/test/test_wolfssl_read.js +8 -8
  108. package/test/test_wolfssl_read.ts +9 -8
  109. package/examples/execd.tsx +0 -798
  110. package/examples/execd_worker.ts +0 -127
  111. package/quickwin_const.d.ts +0 -1063
@@ -16560,6 +16560,14 @@ var LVCOLUMNW_DECL = {
16560
16560
  cxIdeal: "i32"
16561
16561
  };
16562
16562
  var LVCOLUMNW = /* @__PURE__ */ struct("LVCOLUMNW", LVCOLUMNW_DECL);
16563
+ var NOTIFYICONIDENTIFIER_DECL = {
16564
+ "#": "struct",
16565
+ cbSize: "u32",
16566
+ hWnd: "<HWND>ptr",
16567
+ uID: "u32",
16568
+ guidItem: "u32[4]"
16569
+ };
16570
+ var NOTIFYICONIDENTIFIER = /* @__PURE__ */ struct("NOTIFYICONIDENTIFIER", NOTIFYICONIDENTIFIER_DECL);
16563
16571
 
16564
16572
  // _build/lib/windows/user32.js
16565
16573
  var b = (name, sig, encoders) => bind("user32.dll", name, sig, encoders);
@@ -16625,14 +16633,14 @@ function applyProps(instance, newProps, _oldProps) {
16625
16633
  gui.ShowWindow(
16626
16634
  hwnd,
16627
16635
  newProps.hidden ? 0 : 5
16628
- /* gui.ShowWindowCmd.SHOW */
16636
+ /* ShowWindowCmd.SHOW */
16629
16637
  );
16630
16638
  }
16631
16639
  if ("visible" in newProps) {
16632
16640
  gui.ShowWindow(
16633
16641
  hwnd,
16634
16642
  newProps.visible ? 5 : 0
16635
- /* gui.ShowWindowCmd.HIDE */
16643
+ /* ShowWindowCmd.HIDE */
16636
16644
  );
16637
16645
  }
16638
16646
  }
@@ -16728,7 +16736,7 @@ function measureText(hdc, text, maxWidth) {
16728
16736
  -1,
16729
16737
  r.ptr,
16730
16738
  1024
16731
- /* gui.DrawTextFlag.CALCRECT */
16739
+ /* DrawTextFlag.CALCRECT */
16732
16740
  );
16733
16741
  const { right, bottom } = RECT.decode(r);
16734
16742
  return { width: right, height: bottom };
@@ -16776,7 +16784,7 @@ function setupWindowProc(instance, hwnd) {
16776
16784
  const oldProc = GetWindowLongPtr(
16777
16785
  hwnd,
16778
16786
  -4
16779
- /* gui.Gwlp.WNDPROC */
16787
+ /* Gwlp.WNDPROC */
16780
16788
  );
16781
16789
  instancesByHwnd.set(hwnd, instance);
16782
16790
  gui3.SetWindowProc(hwnd, (hwnd2, msg, wParam, lParam) => {
@@ -16864,7 +16872,7 @@ function runFlexLayout(inst) {
16864
16872
  r.width * scaleFactor,
16865
16873
  r.height * scaleFactor,
16866
16874
  64
16867
- /* gui.SetWindowPosFlag.SWP_SHOWWINDOW */
16875
+ /* SetWindowPosFlag.SWP_SHOWWINDOW */
16868
16876
  );
16869
16877
  InvalidateRect(child.hwnd, NULL, 1);
16870
16878
  child.lastRect = { x: r.x, y: r.y, w: r.width, h: r.height };
@@ -17020,7 +17028,7 @@ var hostConfig = {
17020
17028
  gui3.ShowWindow(
17021
17029
  instance.hwnd,
17022
17030
  0
17023
- /* gui.ShowWindowCmd.HIDE */
17031
+ /* ShowWindowCmd.HIDE */
17024
17032
  );
17025
17033
  },
17026
17034
  hideTextInstance(instance) {
@@ -17028,7 +17036,7 @@ var hostConfig = {
17028
17036
  gui3.ShowWindow(
17029
17037
  instance.hwnd,
17030
17038
  0
17031
- /* gui.ShowWindowCmd.HIDE */
17039
+ /* ShowWindowCmd.HIDE */
17032
17040
  );
17033
17041
  },
17034
17042
  unhideInstance(instance, _props) {
@@ -17036,7 +17044,7 @@ var hostConfig = {
17036
17044
  gui3.ShowWindow(
17037
17045
  instance.hwnd,
17038
17046
  5
17039
- /* gui.ShowWindowCmd.SHOW */
17047
+ /* ShowWindowCmd.SHOW */
17040
17048
  );
17041
17049
  },
17042
17050
  unhideTextInstance(instance, _text) {
@@ -17044,7 +17052,7 @@ var hostConfig = {
17044
17052
  gui3.ShowWindow(
17045
17053
  instance.hwnd,
17046
17054
  5
17047
- /* gui.ShowWindowCmd.SHOW */
17055
+ /* ShowWindowCmd.SHOW */
17048
17056
  );
17049
17057
  },
17050
17058
  shouldSetTextContent(_type, props) {
@@ -17472,7 +17480,7 @@ function getCellFont(hwnd, style) {
17472
17480
  ...base,
17473
17481
  ...style.bold ? {
17474
17482
  lfWeight: 700
17475
- /* gui.FontWeight.BOLD */
17483
+ /* FontWeight.BOLD */
17476
17484
  } : {},
17477
17485
  ...style.italic ? { lfItalic: 1 } : {},
17478
17486
  ...style.underline ? { lfUnderline: 1 } : {}
@@ -17594,7 +17602,7 @@ var ListView = (0, import_react9.forwardRef)(function ListViewInner({ columns, d
17594
17602
  4150,
17595
17603
  0,
17596
17604
  32 | 1 | 65536
17597
- /* gui.LvExStyle.DOUBLEBUFFER */
17605
+ /* LvExStyle.DOUBLEBUFFER */
17598
17606
  );
17599
17607
  const n = columns.length;
17600
17608
  for (let j = 0; j < n; j++) {
@@ -17639,7 +17647,7 @@ var ListView = (0, import_react9.forwardRef)(function ListViewInner({ columns, d
17639
17647
  4126,
17640
17648
  j,
17641
17649
  -2
17642
- /* gui.LvColumnWidthCmd.AUTOSIZE_USEHEADER */
17650
+ /* LvColumnWidthCmd.AUTOSIZE_USEHEADER */
17643
17651
  );
17644
17652
  }
17645
17653
  }
@@ -17781,7 +17789,7 @@ var ScrollView = (0, import_react12.forwardRef)(({ children, style, contentWidth
17781
17789
  natW,
17782
17790
  natH,
17783
17791
  4
17784
- /* gui.SetWindowPosFlag.SWP_NOZORDER */
17792
+ /* SetWindowPosFlag.SWP_NOZORDER */
17785
17793
  );
17786
17794
  forceFlexLayout(content);
17787
17795
  if (natW > svW) {
@@ -17820,7 +17828,7 @@ var ScrollView = (0, import_react12.forwardRef)(({ children, style, contentWidth
17820
17828
  0,
17821
17829
  0,
17822
17830
  1 | 4
17823
- /* gui.SetWindowPosFlag.SWP_NOZORDER */
17831
+ /* SetWindowPosFlag.SWP_NOZORDER */
17824
17832
  );
17825
17833
  gui12.SetScrollInfo(sv, bar, { pos: newPos }, true);
17826
17834
  }
@@ -17886,7 +17894,7 @@ var ScrollView = (0, import_react12.forwardRef)(({ children, style, contentWidth
17886
17894
  handleScroll(
17887
17895
  e,
17888
17896
  1
17889
- /* gui.ScrollBar.VERT */
17897
+ /* ScrollBar.VERT */
17890
17898
  );
17891
17899
  return 0;
17892
17900
  }
@@ -17894,7 +17902,7 @@ var ScrollView = (0, import_react12.forwardRef)(({ children, style, contentWidth
17894
17902
  handleScroll(
17895
17903
  e,
17896
17904
  0
17897
- /* gui.ScrollBar.HORZ */
17905
+ /* ScrollBar.HORZ */
17898
17906
  );
17899
17907
  return 0;
17900
17908
  }
@@ -18058,7 +18066,7 @@ function deleteAllItems(hTree) {
18058
18066
  4353,
18059
18067
  1,
18060
18068
  -65536
18061
- /* gui.TvInsertAfter.ROOT */
18069
+ /* TvInsertAfter.ROOT */
18062
18070
  );
18063
18071
  }
18064
18072
  var TreeView = (0, import_react16.forwardRef)(function TreeViewInner({ data, onSelect, defaultSelectedKey, selectedKey: controlledKey, style }, ref) {
@@ -18090,7 +18098,7 @@ var TreeView = (0, import_react16.forwardRef)(function TreeViewInner({ data, onS
18090
18098
  4396,
18091
18099
  0,
18092
18100
  4
18093
- /* gui.TvExStyle.DOUBLEBUFFER */
18101
+ /* TvExStyle.DOUBLEBUFFER */
18094
18102
  );
18095
18103
  }, []);
18096
18104
  (0, import_react16.useEffect)(() => {
@@ -18132,9 +18140,16 @@ var b3 = (name, sig) => bind("comdlg32.dll", name, sig);
18132
18140
  var GetOpenFileName = /* @__PURE__ */ b3("GetOpenFileNameW", "<OPENFILENAMEW>ptr -> u32");
18133
18141
 
18134
18142
  // _build/lib/windows/shell32.js
18135
- var b4 = (name, sig) => bind("shell32.dll", name, sig);
18143
+ var b4 = (name, sig, encoders) => bind("shell32.dll", name, sig, encoders);
18136
18144
  var SHBrowseForFolder = /* @__PURE__ */ b4("SHBrowseForFolderW", "<BROWSEINFOW>ptr -> <>ptr");
18137
18145
  var SHGetPathFromIDList = /* @__PURE__ */ b4("SHGetPathFromIDListW", "<>ptr <BYTE>ptr -> u32");
18146
+ var Shell_NotifyIconGetRect = (() => {
18147
+ try {
18148
+ return b4("Shell_NotifyIconGetRect", "<NOTIFYICONIDENTIFIER>ptr <RECT>ptr -> i32", { NOTIFYICONIDENTIFIER });
18149
+ } catch {
18150
+ return null;
18151
+ }
18152
+ })();
18138
18153
 
18139
18154
  // _build/lib/windows/ole32.js
18140
18155
  var b5 = (name, sig) => bind("ole32.dll", name, sig);
@@ -1,14 +1,14 @@
1
1
  import '../lib/polyfill.js'
2
2
  import { useState } from 'react'
3
3
  import { Button, Input, createRoot } from '../lib/react-qw/index.js'
4
- import * as gui from 'gui'
4
+ import { WindowStyle } from '../constants'
5
5
 
6
6
  function Counter() {
7
7
  const [count, setCount] = useState(0)
8
8
  return (
9
- <w type="STATIC" ws={gui.WindowStyle.VISIBLE}
9
+ <w type="STATIC" ws={WindowStyle.VISIBLE}
10
10
  style={{ flexDirection: 'column', gap: 8, flexGrow: 1 }}>
11
- <w type="STATIC" ws={gui.WindowStyle.VISIBLE}
11
+ <w type="STATIC" ws={WindowStyle.VISIBLE}
12
12
  style={{ flexDirection: 'row', alignItems: 'center', gap: 8 }}>
13
13
  <Button onClick={() => setCount(c => c + 1)}>Count: {count}</Button>
14
14
  <Button onClick={() => setCount(0)}>Reset</Button>
@@ -23,10 +23,10 @@ function Logger() {
23
23
  const [logs, setLogs] = useState<string[]>([])
24
24
  const add = () => setLogs(prev => [...prev, `log ${prev.length + 1}`])
25
25
  return (
26
- <w type="STATIC" ws={gui.WindowStyle.VISIBLE}
26
+ <w type="STATIC" ws={WindowStyle.VISIBLE}
27
27
  style={{ flexDirection: 'column', gap: 8, flexGrow: 1 }}>
28
28
  <Button onClick={add}>Add Log</Button>
29
- <w type="STATIC" ws={gui.WindowStyle.VISIBLE}
29
+ <w type="STATIC" ws={WindowStyle.VISIBLE}
30
30
  style={{ flexDirection: 'column', gap: 4, flexGrow: 1 }}>
31
31
  {logs.map((l, i) => <w key={String(i)} type="STATIC" text={l} />)}
32
32
  </w>
@@ -16561,6 +16561,14 @@ var LVCOLUMNW_DECL = {
16561
16561
  cxIdeal: "i32"
16562
16562
  };
16563
16563
  var LVCOLUMNW = /* @__PURE__ */ struct("LVCOLUMNW", LVCOLUMNW_DECL);
16564
+ var NOTIFYICONIDENTIFIER_DECL = {
16565
+ "#": "struct",
16566
+ cbSize: "u32",
16567
+ hWnd: "<HWND>ptr",
16568
+ uID: "u32",
16569
+ guidItem: "u32[4]"
16570
+ };
16571
+ var NOTIFYICONIDENTIFIER = /* @__PURE__ */ struct("NOTIFYICONIDENTIFIER", NOTIFYICONIDENTIFIER_DECL);
16564
16572
 
16565
16573
  // _build/lib/windows/user32.js
16566
16574
  var b = (name, sig, encoders) => bind("user32.dll", name, sig, encoders);
@@ -16626,14 +16634,14 @@ function applyProps(instance, newProps, _oldProps) {
16626
16634
  gui.ShowWindow(
16627
16635
  hwnd2,
16628
16636
  newProps.hidden ? 0 : 5
16629
- /* gui.ShowWindowCmd.SHOW */
16637
+ /* ShowWindowCmd.SHOW */
16630
16638
  );
16631
16639
  }
16632
16640
  if ("visible" in newProps) {
16633
16641
  gui.ShowWindow(
16634
16642
  hwnd2,
16635
16643
  newProps.visible ? 5 : 0
16636
- /* gui.ShowWindowCmd.HIDE */
16644
+ /* ShowWindowCmd.HIDE */
16637
16645
  );
16638
16646
  }
16639
16647
  }
@@ -16729,7 +16737,7 @@ function measureText(hdc, text, maxWidth) {
16729
16737
  -1,
16730
16738
  r.ptr,
16731
16739
  1024
16732
- /* gui.DrawTextFlag.CALCRECT */
16740
+ /* DrawTextFlag.CALCRECT */
16733
16741
  );
16734
16742
  const { right, bottom } = RECT.decode(r);
16735
16743
  return { width: right, height: bottom };
@@ -16777,7 +16785,7 @@ function setupWindowProc(instance, hwnd2) {
16777
16785
  const oldProc = GetWindowLongPtr(
16778
16786
  hwnd2,
16779
16787
  -4
16780
- /* gui.Gwlp.WNDPROC */
16788
+ /* Gwlp.WNDPROC */
16781
16789
  );
16782
16790
  instancesByHwnd.set(hwnd2, instance);
16783
16791
  gui3.SetWindowProc(hwnd2, (hwnd3, msg, wParam, lParam) => {
@@ -16865,7 +16873,7 @@ function runFlexLayout(inst) {
16865
16873
  r.width * scaleFactor,
16866
16874
  r.height * scaleFactor,
16867
16875
  64
16868
- /* gui.SetWindowPosFlag.SWP_SHOWWINDOW */
16876
+ /* SetWindowPosFlag.SWP_SHOWWINDOW */
16869
16877
  );
16870
16878
  InvalidateRect(child.hwnd, NULL, 1);
16871
16879
  child.lastRect = { x: r.x, y: r.y, w: r.width, h: r.height };
@@ -17021,7 +17029,7 @@ var hostConfig = {
17021
17029
  gui3.ShowWindow(
17022
17030
  instance.hwnd,
17023
17031
  0
17024
- /* gui.ShowWindowCmd.HIDE */
17032
+ /* ShowWindowCmd.HIDE */
17025
17033
  );
17026
17034
  },
17027
17035
  hideTextInstance(instance) {
@@ -17029,7 +17037,7 @@ var hostConfig = {
17029
17037
  gui3.ShowWindow(
17030
17038
  instance.hwnd,
17031
17039
  0
17032
- /* gui.ShowWindowCmd.HIDE */
17040
+ /* ShowWindowCmd.HIDE */
17033
17041
  );
17034
17042
  },
17035
17043
  unhideInstance(instance, _props) {
@@ -17037,7 +17045,7 @@ var hostConfig = {
17037
17045
  gui3.ShowWindow(
17038
17046
  instance.hwnd,
17039
17047
  5
17040
- /* gui.ShowWindowCmd.SHOW */
17048
+ /* ShowWindowCmd.SHOW */
17041
17049
  );
17042
17050
  },
17043
17051
  unhideTextInstance(instance, _text) {
@@ -17045,7 +17053,7 @@ var hostConfig = {
17045
17053
  gui3.ShowWindow(
17046
17054
  instance.hwnd,
17047
17055
  5
17048
- /* gui.ShowWindowCmd.SHOW */
17056
+ /* ShowWindowCmd.SHOW */
17049
17057
  );
17050
17058
  },
17051
17059
  shouldSetTextContent(_type, props) {
@@ -17473,7 +17481,7 @@ function getCellFont(hwnd2, style) {
17473
17481
  ...base,
17474
17482
  ...style.bold ? {
17475
17483
  lfWeight: 700
17476
- /* gui.FontWeight.BOLD */
17484
+ /* FontWeight.BOLD */
17477
17485
  } : {},
17478
17486
  ...style.italic ? { lfItalic: 1 } : {},
17479
17487
  ...style.underline ? { lfUnderline: 1 } : {}
@@ -17595,7 +17603,7 @@ var ListView = (0, import_react9.forwardRef)(function ListViewInner({ columns, d
17595
17603
  4150,
17596
17604
  0,
17597
17605
  32 | 1 | 65536
17598
- /* gui.LvExStyle.DOUBLEBUFFER */
17606
+ /* LvExStyle.DOUBLEBUFFER */
17599
17607
  );
17600
17608
  const n = columns.length;
17601
17609
  for (let j = 0; j < n; j++) {
@@ -17640,7 +17648,7 @@ var ListView = (0, import_react9.forwardRef)(function ListViewInner({ columns, d
17640
17648
  4126,
17641
17649
  j,
17642
17650
  -2
17643
- /* gui.LvColumnWidthCmd.AUTOSIZE_USEHEADER */
17651
+ /* LvColumnWidthCmd.AUTOSIZE_USEHEADER */
17644
17652
  );
17645
17653
  }
17646
17654
  }
@@ -17782,7 +17790,7 @@ var ScrollView = (0, import_react12.forwardRef)(({ children, style, contentWidth
17782
17790
  natW,
17783
17791
  natH,
17784
17792
  4
17785
- /* gui.SetWindowPosFlag.SWP_NOZORDER */
17793
+ /* SetWindowPosFlag.SWP_NOZORDER */
17786
17794
  );
17787
17795
  forceFlexLayout(content);
17788
17796
  if (natW > svW) {
@@ -17821,7 +17829,7 @@ var ScrollView = (0, import_react12.forwardRef)(({ children, style, contentWidth
17821
17829
  0,
17822
17830
  0,
17823
17831
  1 | 4
17824
- /* gui.SetWindowPosFlag.SWP_NOZORDER */
17832
+ /* SetWindowPosFlag.SWP_NOZORDER */
17825
17833
  );
17826
17834
  gui12.SetScrollInfo(sv, bar, { pos: newPos }, true);
17827
17835
  }
@@ -17887,7 +17895,7 @@ var ScrollView = (0, import_react12.forwardRef)(({ children, style, contentWidth
17887
17895
  handleScroll(
17888
17896
  e,
17889
17897
  1
17890
- /* gui.ScrollBar.VERT */
17898
+ /* ScrollBar.VERT */
17891
17899
  );
17892
17900
  return 0;
17893
17901
  }
@@ -17895,7 +17903,7 @@ var ScrollView = (0, import_react12.forwardRef)(({ children, style, contentWidth
17895
17903
  handleScroll(
17896
17904
  e,
17897
17905
  0
17898
- /* gui.ScrollBar.HORZ */
17906
+ /* ScrollBar.HORZ */
17899
17907
  );
17900
17908
  return 0;
17901
17909
  }
@@ -18059,7 +18067,7 @@ function deleteAllItems(hTree) {
18059
18067
  4353,
18060
18068
  1,
18061
18069
  -65536
18062
- /* gui.TvInsertAfter.ROOT */
18070
+ /* TvInsertAfter.ROOT */
18063
18071
  );
18064
18072
  }
18065
18073
  var TreeView = (0, import_react16.forwardRef)(function TreeViewInner({ data, onSelect, defaultSelectedKey, selectedKey: controlledKey, style }, ref) {
@@ -18091,7 +18099,7 @@ var TreeView = (0, import_react16.forwardRef)(function TreeViewInner({ data, onS
18091
18099
  4396,
18092
18100
  0,
18093
18101
  4
18094
- /* gui.TvExStyle.DOUBLEBUFFER */
18102
+ /* TvExStyle.DOUBLEBUFFER */
18095
18103
  );
18096
18104
  }, []);
18097
18105
  (0, import_react16.useEffect)(() => {
@@ -18133,9 +18141,16 @@ var b3 = (name, sig) => bind("comdlg32.dll", name, sig);
18133
18141
  var GetOpenFileName = /* @__PURE__ */ b3("GetOpenFileNameW", "<OPENFILENAMEW>ptr -> u32");
18134
18142
 
18135
18143
  // _build/lib/windows/shell32.js
18136
- var b4 = (name, sig) => bind("shell32.dll", name, sig);
18144
+ var b4 = (name, sig, encoders) => bind("shell32.dll", name, sig, encoders);
18137
18145
  var SHBrowseForFolder = /* @__PURE__ */ b4("SHBrowseForFolderW", "<BROWSEINFOW>ptr -> <>ptr");
18138
18146
  var SHGetPathFromIDList = /* @__PURE__ */ b4("SHGetPathFromIDListW", "<>ptr <BYTE>ptr -> u32");
18147
+ var Shell_NotifyIconGetRect = (() => {
18148
+ try {
18149
+ return b4("Shell_NotifyIconGetRect", "<NOTIFYICONIDENTIFIER>ptr <RECT>ptr -> i32", { NOTIFYICONIDENTIFIER });
18150
+ } catch {
18151
+ return null;
18152
+ }
18153
+ })();
18139
18154
 
18140
18155
  // _build/lib/windows/ole32.js
18141
18156
  var b5 = (name, sig) => bind("ole32.dll", name, sig);
@@ -2,10 +2,11 @@ import '../lib/polyfill.js'
2
2
  import * as gui from 'gui'
3
3
  import { useState } from 'react'
4
4
  import { render, Button, Tab } from '../lib/react-qw/index.js'
5
+ import { WindowStyle, WmMsg } from '../constants'
5
6
 
6
7
  gui.RegisterClass('TabDemo', (hwnd, msg, wParam, lParam) => {
7
8
  if (!hwnd) return gui.DefWindowProc(hwnd, msg, wParam, lParam)
8
- if (msg === gui.WmMsg.DESTROY) {
9
+ if (msg === WmMsg.DESTROY) {
9
10
  gui.PostQuitMessage(0)
10
11
  return 0
11
12
  }
@@ -17,7 +18,7 @@ function App() {
17
18
 
18
19
  return (
19
20
  <w type="STATIC"
20
- ws={gui.WindowStyle.VISIBLE}
21
+ ws={WindowStyle.VISIBLE}
21
22
  style={{ flexDirection: 'column', width: 600, height: 400, padding: 10 }}
22
23
  >
23
24
  <Tab
@@ -26,7 +27,7 @@ function App() {
26
27
  title: 'Counter',
27
28
  content: (
28
29
  <w type="STATIC"
29
- ws={gui.WindowStyle.VISIBLE | gui.WindowStyle.CLIPCHILDREN}
30
+ ws={WindowStyle.VISIBLE | WindowStyle.CLIPCHILDREN}
30
31
  style={{ flexDirection: 'column', gap: 10, padding: 10, width: 580, height: 300 }}>
31
32
  <Button onClick={() => setTabIndex(1)}>Go to Tab 2</Button>
32
33
  </w>
@@ -36,7 +37,7 @@ function App() {
36
37
  title: 'Buttons',
37
38
  content: (
38
39
  <w type="STATIC"
39
- ws={gui.WindowStyle.VISIBLE | gui.WindowStyle.CLIPCHILDREN}
40
+ ws={WindowStyle.VISIBLE | WindowStyle.CLIPCHILDREN}
40
41
  style={{ flexDirection: 'row', gap: 10, padding: 10, width: 580, height: 300, alignItems: 'stretch' }}>
41
42
  <Button onClick={() => setTabIndex(2)}>Go to Tab 3</Button>
42
43
  <Button onClick={() => setTabIndex(0)} style={{ width: 120 }}>Back</Button>
@@ -47,7 +48,7 @@ function App() {
47
48
  title: 'Final',
48
49
  content: (
49
50
  <w type="STATIC"
50
- ws={gui.WindowStyle.VISIBLE | gui.WindowStyle.CLIPCHILDREN}
51
+ ws={WindowStyle.VISIBLE | WindowStyle.CLIPCHILDREN}
51
52
  style={{ flexDirection: 'column', gap: 10, padding: 10, width: 580, height: 300 }}>
52
53
  <Button onClick={() => setTabIndex(0)}>Back to Tab 1</Button>
53
54
  <Button onClick={() => setTabIndex(1)}>Back to Tab 2</Button>
@@ -65,7 +66,7 @@ function App() {
65
66
 
66
67
  const hwnd = gui.CreateWindow(
67
68
  'TabDemo', 'Tab Demo',
68
- gui.WindowStyle.OVERLAPPEDWINDOW,
69
+ WindowStyle.OVERLAPPEDWINDOW,
69
70
  100, 100, 640, 480, null, null
70
71
  )
71
72
 
@@ -24,14 +24,14 @@ gui.RegisterClass('TrayApp', (hwnd, msg, wParam, lParam) => {
24
24
  gui.ShowWindow(hwnd, 5); // SW_SHOW
25
25
  }
26
26
  else if (cmd === 2) {
27
- gui.ShellNotifyIcon(2 /* gui.NotifyIconCmd.DELETE */, { hwnd, uID: 1 });
27
+ gui.ShellNotifyIcon(2 /* NotifyIconCmd.DELETE */, { hwnd, uID: 1 });
28
28
  gui.PostQuitMessage(0);
29
29
  }
30
30
  }
31
31
  }
32
32
  return 0;
33
33
  }
34
- if (msg === 16 /* gui.WmMsg.CLOSE */) {
34
+ if (msg === 16 /* WmMsg.CLOSE */) {
35
35
  gui.ShowWindow(hwnd, 0); // SW_HIDE
36
36
  return 0;
37
37
  }
@@ -42,14 +42,14 @@ const W = 500, H = 400;
42
42
  const scr = gui.GetScreenSize();
43
43
  const x = (scr[0] - W) >> 1;
44
44
  const y = (scr[1] - H) >> 1;
45
- const hwnd = gui.CreateWindow('TrayApp', '系统托盘示例', 13565952 /* gui.WindowStyle.OVERLAPPEDWINDOW */, x, y, W, H, null, null);
45
+ const hwnd = gui.CreateWindow('TrayApp', '系统托盘示例', 13565952 /* WindowStyle.OVERLAPPEDWINDOW */, x, y, W, H, null, null);
46
46
  if (!hwnd)
47
47
  std.exit(0);
48
48
  gui.ShowWindow(hwnd);
49
49
  // 添加说明文字
50
50
  const ES_MULTILINE = 0x0004;
51
51
  const ES_READONLY = 0x0800;
52
- const style = 1073741824 /* gui.WindowStyle.CHILD */ | 268435456 /* gui.WindowStyle.VISIBLE */ | ES_MULTILINE | ES_READONLY;
52
+ const style = 1073741824 /* WindowStyle.CHILD */ | 268435456 /* WindowStyle.VISIBLE */ | ES_MULTILINE | ES_READONLY;
53
53
  const text = gui.CreateWindow('EDIT', 'QuickWin 系统托盘示例\r\n'
54
54
  + '\r\n'
55
55
  + '右键点击托盘图标打开上下文菜单。\r\n'
@@ -58,15 +58,15 @@ const text = gui.CreateWindow('EDIT', 'QuickWin 系统托盘示例\r\n'
58
58
  if (text) {
59
59
  const font = gui.CreateSystemDpiFont();
60
60
  if (font)
61
- gui.SendMessage(text, 48 /* gui.WmMsg.SETFONT */, font, 1);
61
+ gui.SendMessage(text, 48 /* WmMsg.SETFONT */, font, 1);
62
62
  }
63
63
  let hIcon = gui.LoadAppIcon();
64
64
  if (!hIcon)
65
- hIcon = gui.LoadImage(null, 32512 /* gui.IDI.APPLICATION */, 1 /* gui.ImageType.ICON */, 0, 0, 32768 /* gui.LoadImageFlag.SHARED */);
65
+ hIcon = gui.LoadImage(null, 32512 /* IDI.APPLICATION */, 1 /* ImageType.ICON */, 0, 0, 32768 /* LoadImageFlag.SHARED */);
66
66
  if (hIcon) {
67
- const ok = gui.ShellNotifyIcon(0 /* gui.NotifyIconCmd.ADD */, {
67
+ const ok = gui.ShellNotifyIcon(0 /* NotifyIconCmd.ADD */, {
68
68
  hwnd: hwnd, uID: 1,
69
- flags: 1 /* gui.NotifyIconFlag.MESSAGE */ | 2 /* gui.NotifyIconFlag.ICON */,
69
+ flags: 1 /* NotifyIconFlag.MESSAGE */ | 2 /* NotifyIconFlag.ICON */,
70
70
  callbackMessage: WM_TRAY,
71
71
  hIcon,
72
72
  });
@@ -1,5 +1,6 @@
1
1
  import * as gui from 'gui'
2
2
  import * as std from 'std'
3
+ import { IDI, ImageType, LoadImageFlag, NotifyIconCmd, NotifyIconFlag, WindowStyle, WmMsg } from '../constants'
3
4
 
4
5
  const WM_TRAY = 0x8001
5
6
 
@@ -24,14 +25,14 @@ gui.RegisterClass('TrayApp', (hwnd, msg, wParam, lParam) => {
24
25
  if (cmd === 1) {
25
26
  gui.ShowWindow(hwnd, 5) // SW_SHOW
26
27
  } else if (cmd === 2) {
27
- gui.ShellNotifyIcon(gui.NotifyIconCmd.DELETE, { hwnd, uID: 1 })
28
+ gui.ShellNotifyIcon(NotifyIconCmd.DELETE, { hwnd, uID: 1 })
28
29
  gui.PostQuitMessage(0)
29
30
  }
30
31
  }
31
32
  }
32
33
  return 0
33
34
  }
34
- if (msg === gui.WmMsg.CLOSE) {
35
+ if (msg === WmMsg.CLOSE) {
35
36
  gui.ShowWindow(hwnd, 0) // SW_HIDE
36
37
  return 0
37
38
  }
@@ -43,14 +44,14 @@ const W = 500, H = 400
43
44
  const scr = gui.GetScreenSize()
44
45
  const x = (scr[0] - W) >> 1
45
46
  const y = (scr[1] - H) >> 1
46
- const hwnd = gui.CreateWindow('TrayApp', '系统托盘示例', gui.WindowStyle.OVERLAPPEDWINDOW, x, y, W, H, null, null)
47
+ const hwnd = gui.CreateWindow('TrayApp', '系统托盘示例', WindowStyle.OVERLAPPEDWINDOW, x, y, W, H, null, null)
47
48
  if (!hwnd) std.exit(0)
48
49
  gui.ShowWindow(hwnd)
49
50
 
50
51
  // 添加说明文字
51
52
  const ES_MULTILINE = 0x0004
52
53
  const ES_READONLY = 0x0800
53
- const style = gui.WindowStyle.CHILD | gui.WindowStyle.VISIBLE | ES_MULTILINE | ES_READONLY
54
+ const style = WindowStyle.CHILD | WindowStyle.VISIBLE | ES_MULTILINE | ES_READONLY
54
55
  const text = gui.CreateWindow('EDIT',
55
56
  'QuickWin 系统托盘示例\r\n'
56
57
  + '\r\n'
@@ -61,15 +62,15 @@ const text = gui.CreateWindow('EDIT',
61
62
  if (text) {
62
63
  const font = gui.CreateSystemDpiFont()
63
64
  if (font)
64
- gui.SendMessage(text, gui.WmMsg.SETFONT, font, 1)
65
+ gui.SendMessage(text, WmMsg.SETFONT, font, 1)
65
66
  }
66
67
 
67
68
  let hIcon = gui.LoadAppIcon()
68
- if (!hIcon) hIcon = gui.LoadImage(null, gui.IDI.APPLICATION, gui.ImageType.ICON, 0, 0, gui.LoadImageFlag.SHARED)
69
+ if (!hIcon) hIcon = gui.LoadImage(null, IDI.APPLICATION, ImageType.ICON, 0, 0, LoadImageFlag.SHARED)
69
70
  if (hIcon) {
70
- const ok = gui.ShellNotifyIcon(gui.NotifyIconCmd.ADD, {
71
+ const ok = gui.ShellNotifyIcon(NotifyIconCmd.ADD, {
71
72
  hwnd: hwnd, uID: 1,
72
- flags: gui.NotifyIconFlag.MESSAGE | gui.NotifyIconFlag.ICON,
73
+ flags: NotifyIconFlag.MESSAGE | NotifyIconFlag.ICON,
73
74
  callbackMessage: WM_TRAY,
74
75
  hIcon,
75
76
  })
package/lib/dumpRects.js CHANGED
@@ -2,7 +2,7 @@ import * as os from 'os';
2
2
  import * as gui from 'gui';
3
3
  export function startDumpRects(rootHwnd, intervalMs = 3000) {
4
4
  function dumpChild(parent, indent) {
5
- var ch = gui.GetWindow(parent, 5 /* gui.GetWindowCmd.CHILD */);
5
+ var ch = gui.GetWindow(parent, 5 /* GetWindowCmd.CHILD */);
6
6
  var n = 0;
7
7
  while (ch) {
8
8
  n++;
@@ -11,7 +11,7 @@ export function startDumpRects(rootHwnd, intervalMs = 3000) {
11
11
  var txt = String(gui.GetWindowText(ch) || '').slice(0, 16);
12
12
  console.log(indent + '[' + n + '] hwnd=' + String(ch) + ' txt="' + txt + '" wr=' + JSON.stringify(wr) + ' cr=' + JSON.stringify(cr));
13
13
  dumpChild(ch, indent + ' ');
14
- ch = gui.GetWindow(ch, 2 /* gui.GetWindowCmd.NEXT */);
14
+ ch = gui.GetWindow(ch, 2 /* GetWindowCmd.NEXT */);
15
15
  }
16
16
  if (n === 0)
17
17
  console.log(indent + '(no children)');
package/lib/dumpRects.ts CHANGED
@@ -1,9 +1,10 @@
1
1
  import * as os from 'os'
2
2
  import * as gui from 'gui'
3
+ import { GetWindowCmd } from '../constants'
3
4
 
4
5
  export function startDumpRects(rootHwnd: gui.HWND, intervalMs: number = 3000): void {
5
6
  function dumpChild(parent: gui.HWND, indent: string): void {
6
- var ch = gui.GetWindow(parent, gui.GetWindowCmd.CHILD)
7
+ var ch = gui.GetWindow(parent, GetWindowCmd.CHILD)
7
8
  var n = 0
8
9
  while (ch) {
9
10
  n++
@@ -12,7 +13,7 @@ export function startDumpRects(rootHwnd: gui.HWND, intervalMs: number = 3000): v
12
13
  var txt = String(gui.GetWindowText(ch) || '').slice(0, 16)
13
14
  console.log(indent + '[' + n + '] hwnd=' + String(ch) + ' txt="' + txt + '" wr=' + JSON.stringify(wr) + ' cr=' + JSON.stringify(cr))
14
15
  dumpChild(ch, indent + ' ')
15
- ch = gui.GetWindow(ch, gui.GetWindowCmd.NEXT)
16
+ ch = gui.GetWindow(ch, GetWindowCmd.NEXT)
16
17
  }
17
18
  if (n === 0) console.log(indent + '(no children)')
18
19
  }